Skip to content

Conversation

@jackbackrack
Copy link
Contributor

Strip dead code and variables in optimized mode. Traces from inits and externfns.

EExternFn|EExtern|EDefType|EDefObject|EDefTypeObject) :
n(e)

;; definitions that need to be in runtime and aren't traceable from roots
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

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?
Copy link
Collaborator

@CuppoJava CuppoJava Feb 7, 2020

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

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? :
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

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))) :
Copy link
Collaborator

@CuppoJava CuppoJava Feb 7, 2020

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Collaborator

@CuppoJava CuppoJava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants