Conversation
…ould result in an empty dispatch
compiler/stz-el.stanza
Outdated
| EExternFn|EExtern|EDefType|EDefObject|EDefTypeObject) : | ||
| n(e) | ||
|
|
||
| ;; definitions that need to be in runtime and aren't traceable from roots |
There was a problem hiding this comment.
Please follow the code comment conventions. Comments begin with a single semicolon, are capitalized and end with periods.
compiler/stz-el.stanza
Outdated
| do(walk-top, predefines(epackage)) | ||
| while not empty?(q) : walk-top(pop(q)) | ||
|
|
||
| println("FOUND %_ REACHABLE OUT OF %_ DEFINED %_%%" % [length(reachables), length(defs), 100.0 * to-double(length(reachables)) / to-double(length(defs))]) when prune-trace? |
There was a problem hiding this comment.
Please strip out development prints before merging. Or move to a configuration flag.
compiler/stz-el.stanza
Outdated
| val new-exps = remove-unused-var-stores $ for e in filter(keep?, exps(epackage)) seq : prune-methods(e, reachables) | ||
| val res = EPackage(new-packageio, to-tuple $ new-exps) | ||
|
|
||
| if prune-trace? : |
There was a problem hiding this comment.
Please strip out development prints before merging.
compiler/stz-stitcher.stanza
Outdated
| val types* = map(resolve{pkgids, _}, types(m)) | ||
| val branch* = Branch(to-list(types*), M(lbl)) | ||
| add(method-table, multi*, branch*) | ||
| match(global-id(pkgids,multi(m))) : |
There was a problem hiding this comment.
Why does the tree-shaker affect the stitcher?
There was a problem hiding this comment.
because you can have methods without multis when stripping. the stitcher assumed that methods always needed multis but if there are no calls to multis only to the methods then there is no need for a multi and in fact the multi doesn't exist.
There was a problem hiding this comment.
Okay, thanks for the explanation. In this case, let's move the logic out of the stitcher, and promote the methods to simple functions in the final EL transform.
CuppoJava
left a comment
There was a problem hiding this comment.
Please update changes.
Strip dead code and variables in optimized mode. Traces from inits and externfns.