[Vm-dev] Proposal: get rid of primitive numbers
Andreas Raab
andreas.raab at gmx.de
Sat Mar 10 17:56:06 UTC 2012
On 3/10/2012 12:08, Igor Stasenko wrote:
> I am get annoyed by these numbers..
> why, living in our amazingly powerful smalltalk world, in order to see
> what the primitive does,
> i should first lookup the selector in #initializePrimitiveTable method?
>
> Is it so hard for compiler to lookup the prim by its symbolic name ,
> why i forced to do that manually all the time?
>
> Just out of curiosity, can anyone say (without looking into image), what
> <primitive: 135> does?
> And now, same question, what
> <primitive: #primitiveMillisecondClock>
> does?
>
> Never ending fight: meaningful names vs meaningless numbers
Easy: Just do the same thing the compiler does with messages that it has
specialized bytecodes for. I.e., add a class var to the compiler
containing names and indicees for indexed prims and make it so that the
compiler knows that it can replace primitiveFoo with prim index 123. Do
the opposite in the decompiler and voila! you're done. Shouldn't take
more than a day to do that, really.
Cheers,
- Andreas
More information about the Vm-dev
mailing list