This is the Part 2 of a series. Feel free to read the prequel for more context: Building the fastest Lua interpreter automatically Building a good VM for a dynamic language takes a ton of engineerin
or a subclass.
This is not a simple process like “call the function at the given address
specified by the type”. The runtime has to find out what kind of object
add
is. Maybe it’s just a function, or maybe it’s a
property, or maybe it’s some
custom descriptor protocol thing. There’s no way to just turn this into a
call instruction!
Runtime type information
Though dynamic runtimes do not know ahead of time what types variables have at
any given opcode, they do eventually find out
when the code is run. The first
time someone calls