[Vm-dev] Interpreter>>isContextHeader: optimization
Igor Stasenko
siguctua at gmail.com
Sat Feb 21 07:37:29 UTC 2009
Here the method:
isContextHeader: aHeader
self inline: true.
^ ((aHeader >> 12) bitAnd: 16r1F) = 13 "MethodContext"
or: [((aHeader >> 12) bitAnd: 16r1F) = 14 "BlockContext"
or: [((aHeader >> 12) bitAnd: 16r1F) = 4]] "PseudoContext"
i think it wouldn't hurt to rewrite it as:
isContextHeader: aHeader
self inline: true.
| hdr |
hdr := aHeader bitAnd: (16r1F << 12).
^ hdr = (13 << 12) "MethodContext"
or: [ hdr = (14 << 12) "BlockContext"
or: [ hdr = (4 << 12)]] "PseudoContext"
which will allow GCC to optimize it more easily.
I'm not sure if it can optimize it in its current state.
This may impact a small speedup of copy operations and any other
operations which need to determine a number of pointer fields in
object (users of #lastPointerOf:)
--
Best regards,
Igor Stasenko AKA sig.
More information about the Vm-dev
mailing list