Closed Bug 517888 Opened 15 years ago Closed 15 years ago

Optimize load when calling a function in a declared slot

Categories

(Tamarin Graveyard :: Baseline JIT (CodegenLIR), defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: edwsmith, Assigned: edwsmith)

References

Details

Attachments

(1 file, 1 obsolete file)

we're missing this optimization: class A { var f } function test(a:A) { a.f() } We can early bind to the slot A.f, even if we have to call the value as a closure. Currently we're doing the slow path which has to look up A.f at runtime in addition to calling the result as a closure.
Depends on: 517762
Some refactoring included, to make this maintainable: * loading from slot is relegated to loadFromSlot() helper that doesn't update FrameState, so it can be used as an intermediate step. emitGetSlot() now calls loadFromSlot in the obvious way. * loadAtomRep factored to take Traits* as an argument, when the input value isn't something sitting in a variable slot tracked in FrameState * loadAtomRep cleaned up to switch builtin type instead of testing each type one at a time. removed some redundant constant folding (that is already handled by nanojit::ExprFilter) * callprop_late calls callprop_late_slot when we dynamically discover the same situation.
Assignee: nobody → edwsmith
Attachment #401854 - Flags: review?(rreitmai)
Comment on attachment 401854 [details] [diff] [review] early bind slot load in OP_callprop (call to closure in slot) I see loadAtomRep() has lost the constant micro-opt for boolean types. Overlooked or not relevant?
it is redundant with constant folding performed later in the pipeline by nanojit::ExprFilter
Comment on attachment 401854 [details] [diff] [review] early bind slot load in OP_callprop (call to closure in slot) (1) Does newly added getBinding() call at 3570 introduce a new path for an exception to get fired (e.g.kAmbiguousBindingError) (2) may need to add 'break;' to each case for some brain-dead compilers.
Attachment #401854 - Flags: review?(rreitmai) → review+
(In reply to comment #4) > (From update of attachment 401854 [details] [diff] [review]) > (1) Does newly added getBinding() call at 3570 introduce a new path for an > exception to get fired (e.g.kAmbiguousBindingError) Nope, this code is copied right from Toplevel::getBinding which also can throw a kAmbiguousBindingError I cringe at "copied" so I'm looking for a better way to factor the code to avoid the copying. will repost if this code changes substantially as a result.
(In reply to comment #4) > (2) may need to add 'break;' to each case for some brain-dead compilers. I've yet to see a compiler require that particular stupidity. Have you seen one?
(In reply to comment #6) > (In reply to comment #4) > > (2) may need to add 'break;' to each case for some brain-dead compilers. > > I've yet to see a compiler require that particular stupidity. Have you seen > one? I thought we saw it (or something similar) on the sparc. But lets go without it, until proven otherwise.
I've bumped into problems when the last case of a switch falls through, but this code doesn't do that, all cases return. and i've never had problems with that pattern iirc.
this patch needs to be rebased, it currently depends on the OP_callproperty cleanup code which is stalled.
previous patch was sufficiently changed to deserve re-review * no longer based on (abandoned) callprop cleanup patch * includes use of slightly optimized op_call
Attachment #401854 - Attachment is obsolete: true
Attachment #402864 - Flags: review?(rreitmai)
Attachment #402864 - Flags: review?(rreitmai) → review+
pushed
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Resolved fixed engineering / work item that has been pushed. Setting status to verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: