Hi. I would like to add a new shortcut bytecode to do a little experiment to see if I can improve the speed of a serializer we are doing. In the serializer we call  #basicNew for each object. I know that #new is in a bytecodePrim, and I wanted to see if doing the same with #basicNew give us some speed improvement. Just as an experiment.<br>

<br>Now, adding a new bytecode primitive seems complicated and I am not sure how to do it. Can someone help me?  I seems I need <br><br>1) to add the selector in <br>Smalltalk specialSelectors<br>or in<br>Smalltalk specialObjectsArray at: 24<br>

<br>2) Modify   VariableNode &gt;&gt;#initialize<br>the part of: <br><br> encoder<br>        fillDict: StdSelectors<br>        with: SelectorNode<br>        mapping: ((1 to: Smalltalk specialSelectorSize) collect: <br>                            [:i | Smalltalk specialSelectorAt: i])<br>
        to: (SendPlus to: SendPlus + 31).<br><br>to:<br><br> encoder<br>
        fillDict: StdSelectors<br>
        with: SelectorNode<br>
        mapping: ((1 to: Smalltalk specialSelectorSize) collect: <br>
                            [:i | Smalltalk specialSelectorAt: i])<br>
        to: (SendPlus to: SendPlus + 32).<br>
<br><br>3) Change  ParserNode &gt;&gt;#initialize<br>
<br>
from :<br>
<br>
Send := 208.<br>
<br>
to:<br>
<br>
Send := 209.<br><br>4)  Interpreter &gt;&gt;# <br><br>I need to change from:<br><br>.....<br>    (205 bytecodePrimNewWithArg)<br>        (206 bytecodePrimPointX)<br>        (207 bytecodePrimPointY)<br><br>        (208 255 sendLiteralSelectorBytecode)<br>
<br>to<br><br>.....<br>    (205 bytecodePrimNewWithArg)<br>        (206 bytecodePrimPointX)<br>        (207 bytecodePrimPointY)<br>        (208 bytecodePrimBasicNew)<br><br>        (209 255 sendLiteralSelectorBytecode)<br>
<br>What I am not sure here is if I am sure that the compiler will to still be poiting normal messages to bytecode 208 instead of starting in 209.<br><br><br><br>6) Evaluate:<br><br> ParserNode initialize.<br>
VariableNode initialize.<br><br><br>Am I missing something?<br><br>Finally, is there a bytecode primitive that it is not really used? because maybe it is easier to change for a moment an already existing one. The problem is that I want to see if we improve performance. So removing another bytecode primitive may have negatives effects too.<br>
<br>Thanks a lot in advance,<br><br>Mariano<br>