2 ms·
It depends on the language, but in the Smalltalk vm I'm writing, super class methods get called a lot it seems. More than enough to have their own bytecode. >
by monocasa 7y ago
It depends on the language, but in the Smalltalk vm I'm writing, super class methods get called a lot it seems. More than enough to have their own bytecode.
> You want to minimize the proliferation of VM instructions as much as possible.
I guess that seems like half the trade off to me, or else VMs would all be OISCs. What you really want to do is to approximate Huffman encoding in your ISA, balancing that with ease of parsing (so bytes generally rather than bits).
- kazinator 7y agoBut this OP_INHERIT instruction isn't for calling methods; it's just for setting up the inheritance relationship.
- _old_dude_ 7y agoThe opcode OP_INHERIT takes two classes as parameter on the stack so this is equivalent to do a function/method calls with the class and the super class and let the function do the magic of filling the vtable, etc.