Обсуждение на virtual-machine

42 views
Skip to first unread message

pvax

unread,
Feb 28, 2010, 5:49:27 AM2/28/10
to Phantom OS
Just an idea to consider - register-based VM. It maks it easier to
implement lightwight threading and closures. To switch LW threads just
set the current register file, to resume a closure - do the same.
The size of the file can be variable, just the method's arguments and
locals. It leaves out C-style ellipsises from the language(s) but this
construct is ridiculous and can be replaced with an array argument. OO-
style programs also tend to have small implementations thus a small
amoutn of locals.
Of course, there is going to be a call stack, a stack of register
files, but don't even be kept in a single memory region.

dmitry.z...@gmail.com

unread,
Feb 28, 2010, 7:10:57 AM2/28/10
to Phantom OS
1. Threads in Phantom are quite light even on the kernel level. There
is no much difference between switching stack pointer or register-
frame pointer. No light threads impl exists, but it can be implemented
by switching to other stack-frame, which is quite fast as well.

2. Existing VM has direct stack slots access so register-style
compiler can generate code for it quite easily as well. But, of
course, it wil be slower than having direct 3-address register style
VM.

3. Technically it is easy to implement more than one virtual machine
in Phantom. The only thing which has to be the same is object format.
I'm quite open to this idea, if it will bring some more languages to
Phantom.

Reply all
Reply to author
Forward
0 new messages