[m-dev.] for review: bytecode interpreter

Levi Cameron l.cameron2 at ugrad.unimelb.edu.au
Fri Dec 8 18:18:17 AEDT 2000


Estimated hours taken: About a week

  Now that I have started on the actual interpreter instead of
  just support code, this is the beginnings of the new bytecode
  interpreter. Probably just over half the code is the same or a
  superficially modified revision of the old one.

mb_bytecode
Almost identical. Only real change is made MB_read_cstring not use
any static variables

mb_disasm
Again, code very similar. Changed all the functions to write to a
buffer instead of a file and to allow for bytecode indenting. Output
format string for some instructions changed (hopefully more menaingful
than just a dump of numbers)

mb_machine
(completely different from old machine.c)
The actual part that contains an abstract machine.
 The rest is really just support code.
The instruction_table array is how instructions are dispatched. Look
at instr_xxxx for the actual interpreter code. Not all instructions
are implemented. MB_step and MB_run execute the actual
 interpreting code

mb_machine_show
displays output showing the state of the machine

mb_mem
Identical to old mem apart from file name changes

mb_util
took out strdup (not needed) and changed some comments

mb_stack
word based stack that will reallocate itself if it needs to

mbi
front end for bytecode interpreter

mdis
disassembles a file and dumps it to the screen


Levi
l.cameron2 at ugrad.unimelb.edu.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_bytecode.c
Type: text/x-csrc
Size: 25789 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_disasm.c
Type: text/x-csrc
Size: 21298 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_machine.c
Type: text/x-csrc
Size: 28564 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0002.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_machine_show.c
Type: text/x-csrc
Size: 6978 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0003.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_mem.c
Type: text/x-csrc
Size: 1955 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0004.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_stack.c
Type: text/x-csrc
Size: 2871 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0005.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_util.c
Type: text/x-csrc
Size: 1126 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0006.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbi.c
Type: text/x-csrc
Size: 4174 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0007.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdis.c
Type: text/x-csrc
Size: 1712 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0008.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_bytecode.h
Type: text/x-chdr
Size: 8168 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_disasm.h
Type: text/x-chdr
Size: 703 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_machine.h
Type: text/x-chdr
Size: 5785 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0002.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_machine_show.h
Type: text/x-chdr
Size: 580 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0003.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_mem.h
Type: text/x-chdr
Size: 890 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0004.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_stack.h
Type: text/x-chdr
Size: 1821 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0005.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mb_util.h
Type: text/x-chdr
Size: 753 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20001208/c3cec70e/attachment-0006.h>


More information about the developers mailing list