News for hackers. Stuff that matters.
Re:Crafting Interpreters: Superclasses by monocasa on Wednesday March 18, 2020 @01:18PM (#22618955)
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).

Re:Crafting Interpreters: Superclasses by kazinator on Wednesday March 18, 2020 @01:45PM (#22619267)
But this OP_INHERIT instruction isn't for calling methods; it's just for setting up the inheritance relationship.
Re:Crafting Interpreters: Superclasses by _old_dude_ on Wednesday March 18, 2020 @03:05PM (#22620120)
The 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.