| To quote another post: > generally sucks at the hardware level because most CPUs are register-based Whoa, hold on there folks. This is not a CPU register VM. It's a 'register-based VM' and it isn't even that. iconst 1 vs set t3, t1
iconst 2 set t4, t2
iadd add t3, t4, t5
t1 through t5 are allocated in the stack frame. They are NOT magically somehow mapped to x86_64 registers R8-12.Actually, calling this a register-based VM is just wrong. It's lazy thinking but really it's just wrong. The value of t1 will be in memory. Yes, it's standard terminology which easily lets people misunderstand what's happening under the hood, as in the above quoted case. The article doesn't even say virtual registers which would have helped. It could. It should. It doesn't. BTW, a good interpreter will cache the top of stack in a CPU register. |