[RFC] Add init_pmc() to ExceptionHandler
chromatic
chromatic at wgz.org
Mon Dec 7 09:20:17 UTC 2009
While we need to consider ways to make EHs less expensive, a cheap and easy
gain comes from adding the init_pmc() VTABLE entry in the attached patch. For
an EH which handles only a single type of exception, we can rewrite code from:
.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
... to:
.sub "fib" :subid("11_1259711141.42547") :outer("10_1259711141.42547")
.param pmc param_16
.annotate "line", 3
$P1 = box 58
new $P15, 'ExceptionHandler', $P1
set_addr $P15, control_14
push_eh $P15
...
.end
Note that this replaces a method call with Integer boxing. The resulting code
(PIR generated by a Fibonacci benchmark written with NQP-rx) runs 22.166%
faster.
It might be useful to extend the initializer to take a PMC array as well, when
the EH can handle multiple types of exceptions, but most of the uses I've seen
in NQP-rx so far handle only one type of exception.
-- c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eh_init_pmc.patch
Type: text/x-patch
Size: 534 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20091207/51412a30/attachment.bin>
More information about the parrot-dev
mailing list