A good optimization step is enabling the use of compile-time constant PMCs in
bytecode. Consider this code generated by NQP-rx:
.namespace []
.sub "fib" :subid("11_1259711141.42547") :outer("10_1259711141.42547")
.param pmc param_16
.annotate "line", 3
new $P15, 'ExceptionHandler'
set_addr $P15, control_14
$P15."handle_types"(58)
push_eh $P15
...
.end
The ExceptionHandler in $P15 is (effectively) constant and won't change
throughout the invocation of the program. Recreating it (and calling a
*method* on it to set the single type of exception it will handle) is busy
work all but the first time. (This code comes from the NQP-rx fib.pir
benchmark; we can get an easy 45% performance improvement from avoiding re-
creating this EH on every sub invocation.)
We should be able to create a single PMC once, at compile time, and refer to
it throughout the rest of the PIR. To accomplish this, we need:
* PIR syntax to declare a constant PMC and initialize it at compile time
* PIR syntax to refer to such a constant PMC
* tests for both
* (possibly) a way to refer to local symbols in other subs, such as the
label
used with the set_addr op
Arguably, we could instead use a way to associate an EH with a sub such that
entering the sub always activates that EH, but then we have to consider access
to the sub's local symbols within the EH, and that's trickier.
-- c
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev