Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Long-running compilation steps

26 views
Skip to first unread message

Nicholas Nethercote

unread,
Apr 15, 2013, 2:41:13 AM4/15/13
to JS Internals list
Hi,

For https://bugzilla.mozilla.org/show_bug.cgi?id=842800 I'm interested
in adding more checks of SpiderMonkey's operation callback in
potentially long-running operations. For example, when running the
asm.js Unreal demo, parsing takes several seconds, so in my patch I
added a check after the parsing of each statement.

I'm also seeing that IonMonkey compilation can take a while on the
demo. Is there a loop or loops in IonMonkey that are good candidates
for adding operation callback checks?

Nick

Nicolas B. Pierron

unread,
Apr 15, 2013, 6:49:28 PM4/15/13
to
IonMonkey compilation is currently sequential for the IonBuilder phase and
the CodeGenerator::link phase. All the rest might run in a separate thread
(or not in case of mono core architectures).

Before the compilation we allocate a lifo-alloc which got extend if needed
by the compilation. As far as I know, everything which goes into the
lifo-alloc is considered as dark-matter from the about:memory point of view.

I am not sure what you are trying to look at but what might be interesting
would be to look at the usage of the lifo alloc. It would be safe to do it
at the creation of each basic block, and in MIRGenerator::shouldCancel
(called at each loop iteration on basic blocks) if it is safe to report such
status from another thread.

--
Nicolas B. Pierron

David Anderson

unread,
Apr 15, 2013, 6:53:50 PM4/15/13
to dev-tech-js-en...@lists.mozilla.org
IonBuilder::traverseBytecode() should probably have an operation
callback check.

-David

Luke Wagner

unread,
Apr 15, 2013, 7:28:03 PM4/15/13
to David Anderson, dev-tech-js-en...@lists.mozilla.org
There are also a bunch of phases in backend codegen that take a bunch of time. (To wit, IonBuilder doesn't run for OdinMonkey.) From profiling asm.js, phi-removal and register allocation are the expensive phases. Unfortunately, each compilation step has it's own driving loop. I think one nice pinch point (that is checked between each phases) is MIRGenerator::shouldCancel; the name even lines up.
> _______________________________________________
> dev-tech-js-engine-internals mailing list
> dev-tech-js-en...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
>

Brian Hackett

unread,
Apr 15, 2013, 7:31:48 PM4/15/13
to Luke Wagner, David Anderson, JS Internals list
MIRGenerator::shouldCancel is actually checked all over the place within
phases too, and is, yeah, the trigger to use for canceling off thread
compilations from a different thread.

Brian
0 new messages