At 01:48 -0500 1/3/04, Uri Guttman wrote:>>>>> "NS" == Nigel Sandever <[EMAIL PROTECTED]> writes:
NS> All that is required to protect an object from corruption through
NS> concurrent access and state change is to prevent two (or more) VMs
NS> trying to access the same object simultaneously. In order for the VM to
NS> address the PMC and must load it into a VM register, it must know where
NS> it is. Ie. It must have a pointer. It can use this pointer to access
NS> the PMC with a Bit Test and Set operation. (x86 BTS)
NS> [http://www.itis.mn.it/linux/quarta/x86/bts.htm] This is a CPU atomic
NS> operation. This occurs before the VM enters the VM operations critical
NS> section.
ding! ding! ding! you just brought in a cpu specific instruction which
is not guaranteed to be on any other arch. in fact many have such a
beast but again, it is not accessible from c.
I just _can't_ believe I'm hearing this. So what if it's not accessible from C? Could we just not build a little C-program that would create a small in whatever loadable library? Or have a post-processing run through the binary image inserting the right machine instructions in the right places? Not being from a *nix background, but more from a MS-DOS background, I've been used to inserting architecture specific machine codes from higher level languages into executable streams since 1983! Don't tell me that's not "done" anymore? ;-)
Yes, you are correct--we are already using bits of assembly in parrot. C compilers tend to allow you to insert bits of inline assembly, and we are taking advantage of that--for instance, look for "__asm__" in the following files:
jit/arm/jit_emit.h jit/ppc/jit_emit.h src/list.c src/malloc.c
Also, JIT is all about generating platform-specific machine instructions at runtime. So it's certainly do-able, and right along the lines of of what we are already doing.
JEff