Hi.
I want to play with idea to make #ifNil: optimization in the way that for particular receiver it will be always real message send. I want to compile it with extra check like
receiver class = MySpecialClass ifTrue: ifNilBlock.
I want to measure performance impact. I know in the past #class was compiled as special bytecode. Is it available now? And what bytecode I could use?
Best regards, Denis
H Denis,
there are bytecodes for #== and #class that do no lookup. Look for Smalltalk specialSelectors and you'll figure it out. There are 32 special selectors. The first is #+ and has bytecode 176 in the default bytecode set.
_,,,^..^,,,_ (phone)
On May 27, 2016, at 12:54 PM, Denis Kudriashov dionisiydk@gmail.com wrote:
Hi.
I want to play with idea to make #ifNil: optimization in the way that for particular receiver it will be always real message send. I want to compile it with extra check like receiver class = MySpecialClass ifTrue: ifNilBlock.
I want to measure performance impact. I know in the past #class was compiled as special bytecode. Is it available now? And what bytecode I could use?
Best regards, Denis
Else in the sistaV1 bytecode set there is the #jumpIfNotInstanceOfOrPop: bytecode, which is heavily optimized for class test. I would be compiled much faster than obj class == Class ifTrue: [] because it compares class tags and not class pointers. The problem is that this bytecode relies on classes as literals, not as literal variables, which may not be convenient in your case.
On Fri, May 27, 2016 at 11:04 PM, Eliot Miranda eliot.miranda@gmail.com wrote:
H Denis,
there are bytecodes for #== and #class that do no lookup. Look for
Smalltalk specialSelectors and you'll figure it out. There are 32 special selectors. The first is #+ and has bytecode 176 in the default bytecode set.
_,,,^..^,,,_ (phone)
On May 27, 2016, at 12:54 PM, Denis Kudriashov dionisiydk@gmail.com wrote:
Hi.
I want to play with idea to make #ifNil: optimization in the way that for particular receiver it will be always real message send. I want to compile it with extra check like
receiver class = MySpecialClass ifTrue: ifNilBlock.
I want to measure performance impact. I know in the past #class was compiled as special bytecode. Is it available now? And what bytecode I could use?
Best regards, Denis
Thank's I will try it.
2016-05-27 23:04 GMT+02:00 Eliot Miranda eliot.miranda@gmail.com:
H Denis,
there are bytecodes for #== and #class that do no lookup. Look for
Smalltalk specialSelectors and you'll figure it out. There are 32 special selectors. The first is #+ and has bytecode 176 in the default bytecode set.
vm-dev@lists.squeakfoundation.org