-
Notifications
You must be signed in to change notification settings - Fork 21
jb/tree shaker #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
jb/tree shaker #60
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the code comment conventions. Comments begin with a single semicolon, are capitalized and end with periods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please strip out development prints before merging. Or move to a configuration flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please strip out development prints before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the tree-shaker affect the stitcher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
CuppoJava
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update changes.
Strip dead code and variables in optimized mode. Traces from inits and externfns.