Last Comment Bug 651966 - DEFFUN and SETCONST should mark aliased local names as closed
: DEFFUN and SETCONST should mark aliased local names as closed
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: general
:
:
Mentors:
Depends on:
Blocks: TypeInference 657193
  Show dependency treegraph
 
Reported: 2011-04-21 13:43 PDT by Brian Hackett (:bhackett)
Modified: 2011-06-08 18:24 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Brian Hackett (:bhackett) 2011-04-21 13:43:30 PDT
Locals and args marked as closed should only be written through SETLOCAL/SETARG/etc. ops.  There is an exception to this for the DEFFUN and SETCONST ops, and to maintain copy/constant invariants JM has to do this weird hack and wipe out all constants and copies when it sees such an op that could alis a non-closed local/arg:

            if (script->fun && script->bindings.hasBinding(cx, innerFun->atom))
                frame.syncAndForgetEverything();

Instead, locals/args which could alias a DEFFUN or SETCONST should be marked as closed, and always synced after writes and loaded from memory for reads.  This same thing is already being done for vars aliased by NAME* opcodes; we should have uniform handling for these opcodes that can read or write local names indirectly, to avoid the need to duplicate this logic elsewhere in the engine (e.g. for SSA analysis).
Comment 1 Brian Hackett (:bhackett) 2011-04-24 09:19:50 PDT
This is also needed for NAME accesses inside 'with' blocks.  This doesn't affect JM currently because scripts using 'with' aren't compiled.  See bug 652422.
Comment 2 Brian Hackett (:bhackett) 2011-06-08 18:24:19 PDT
Instead of doing this in the emitter, it seems easier to watch for NAME aliasing during bytecode analysis.  The closed vars/args attached to the script are still only for upvars, but the trackSlot/slotEscapes info which analyses and the compiler actually use take name aliasing into account.

http://hg.mozilla.org/projects/jaegermonkey/rev/8816703032a6

Note You need to log in before you can comment on or make changes to this bug.