Re: [Sablevm-user] SableVM question
Brought to you by:
egagnon
From: Marcel A. <ma...@ca...> - 2000-08-29 08:14:08
|
Etienne M. Gagnon wrote (eg...@j-...) > Hi! > > Marcel Ammerlaan wrote: > > Name: benchmark.tar.bz2 > > benchmark.tar.bz2 Type: unspecified type (application/octet-stream) > > Encoding: base64 > > > I've looked at your test2.c. You wrote: > > goto *code_addr[data[i]]; > > This should have been: > > goto *datap++; > > to correspond to your switch based test.c. > > Mainly, you forgot the bytecode->address pre-interpretation phase. > Mainly, you don't have bytecodes anymnore; each bytecode is directly > replaced by its address, which is why it is much quicker (no loop, no > bound check [included in a switch], etc.) I've experimented with pre-interpretation but it doesn't seem to matter much (ie. same results). A testing version of that code is in test2.c. I've included the new version (test3.c) which uses the same testdata.h. Maybe I'm wrong (could be, haven't slept) but I don't think using goto is going to be faster than the switch. As for the bounds check; I remember that C doesn't guarantee anything when there is no default label, aka. bounds check is optional. I'd liked to be proved wrong because using the goto table makes some things possible in a JVM that I'd like to try in my own VM. I've tried both gcc 2.95.2 and gcc 2.7.2.3 and both give comparable results. Marcel ps. The var=i statement in the interpreter loop becomes a NOP because 'i' isn't changed anymore. GCC doesn't seem to see this. -- Don't let people drive you crazy when you know it's in walking distance |