Som v3.1

It is a continuing development of Som v3 with an improved vm.  The new vm had fully decodes opcode and argument.  It also employs a few techniques to speed up the execution of sx-code.  The new vm is 30% faster than  the old one.  The new vm has the following characters:

1.  op and arg are fully decoded (no decoder)
2.  use tos register (need a few special codes)
3.  all jumps are absolute
4.  faster access to local variables

The disadvantage is that the size of code segment is double (as xop[] and xarg[] is two arrays replacing cs[] ).  The object file format is changed.  The compiler itself has also been improved.  The symbol table is changed to be more space efficient.  It is also better tuned (now with only 1/3 probing of the previous version).  The listing generation is much faster as it employs "index" to the symbol table instead of requiring to search for a symbol by a reference.  I found out that the meaning of a full macro and a normal macro are different.  Therefore I decide to adopt only one meaning.  A normal macro is much more useful, hence the full macro is discarded. Please read an update of the document about macro.

How to

The executable code is in the directory /test.  To compile and run do:
>  som31 file.txt

The compiler uses som30.obj  (som-compiler object code) and lib2.som must be presented in the same directory of the source files. Here is options:
> som31 -?
som31          interactive mode
som31 file     compile and run, output .lst and .obj
som31 -x file  execute obj file
som31 -?       this help

The som-compiler is presented in the directory /som.  For more detailed discussion of the code development see /doc.

Benchmark result

Compare to som-v3  (from som-v16t/doc/fast-result.txt) it is about 1.5x faster. The speedup is 30%, som-v3.1 is 30% faster than som-v3 (in other words, the running time of som-v3.1 is 70% of v3).

<note correction on the calculation of the speedup figures, 5 Aug 2008>
speedup % = (1- time_v31/time_v3) * 100

quick                 32.5%
hanoi                 22.3%
bubble                32.8%
queen2                37.3%
compiler              21.1%
compiler (no output)  29.8%
                  avg 29.3%

Object file format of Som v3.1

magic                                      5678931
start end (op arg)*                  code segment
start end data*                        data segment
size  (name type ref arity lv)*   symbol table

19 Aug 2007