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)
Tamarin Graveyard
Baseline JIT (CodegenLIR)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: edwsmith, Assigned: edwsmith)
References
Details
Attachments
(1 file, 1 obsolete file)
10.74 KB,
patch
|
rreitmai
:
review+
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Comment 1•15 years ago
|
||
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 2•15 years ago
|
||
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?
Assignee | ||
Comment 3•15 years ago
|
||
it is redundant with constant folding performed later in the pipeline by nanojit::ExprFilter
Comment 4•15 years ago
|
||
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+
Assignee | ||
Comment 5•15 years ago
|
||
(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.
Comment 6•15 years ago
|
||
(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?
Comment 7•15 years ago
|
||
(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.
Assignee | ||
Comment 8•15 years ago
|
||
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.
Assignee | ||
Comment 9•15 years ago
|
||
this patch needs to be rebased, it currently depends on the OP_callproperty cleanup code which is stalled.
Assignee | ||
Comment 10•15 years ago
|
||
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)
Updated•15 years ago
|
Attachment #402864 -
Flags: review?(rreitmai) → review+
Assignee | ||
Comment 11•15 years ago
|
||
pushed
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 12•15 years ago
|
||
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.
Description
•