Claus' VM? I don't know it and i'm interested on the topic, any precise pointer?<br><br>Cheers,<div>Guido.</div><div><br><div class="gmail_quote">2012/10/16 Stefan Marr <span dir="ltr"><<a href="mailto:smalltalk@stefan-marr.de" target="_blank">smalltalk@stefan-marr.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Eliot:<br>
<br>
On 16 Oct 2012, at 22:32, Eliot Miranda wrote:<br>
<br>
> StackInterpreter methods<br>
> fetchNextBytecode<br>
> "This method fetches the next instruction (bytecode)."<br>
> currentBytecode := self fetchByte + bytecodeSetSelector<br>
<br>
Thanks, that's what I was looking for.<br>
<br>
> I couldn't see much of an impact when I measured it, but I don't have my measurements handy. Modern processors cache the read so well that even in the interpreter impact is minimal (it was certainly less than 10%, probably less than 5%, in a pure interpreter), and of course in the JIT it matters not at all. But the impact was enough that I ended up conditionalizing the code so it reads<br>
<br>
Hm, ok. Sounds better than the 5-30% hit I have for having a check inside the bytecodes to have different semantics.<br>
<br>
> I don't suppose its something people do a lot. Claus' VM is the only one I was aware of. I think its useful to support multiple languages and to support migrating the bytecode set using incremental development, but in a production VM if one didn't need the support I think one would end up disabling it.<br>
<br>
The other example I found is the LuaJIT2 interpreter.<br>
It is used to enable and disable debugging hooks, as far as I understand.<br>
But since it is written in assembler, it is just patching the dispatch table<br>
and let's the bytecode jump to different code when the debugging hooks are enabled.<br>
But I didn't see any performance numbers for that. Would guess it would take some interaction with the OS to deactivate protection on executable memory pages to change the dispatch table.<br>
<br>
Thanks<br>
<div class="HOEnZb"><div class="h5">Stefan<br>
<br>
--<br>
Stefan Marr<br>
Software Languages Lab<br>
Vrije Universiteit Brussel<br>
Pleinlaan 2 / B-1050 Brussels / Belgium<br>
<a href="http://soft.vub.ac.be/~smarr" target="_blank">http://soft.vub.ac.be/~smarr</a><br>
Phone: +32 2 629 2974<br>
Fax: +32 2 629 3525<br>
<br>
</div></div></blockquote></div><br></div>