mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
With these changes, it now passes all tests/general/* test cases
except those with floats.
Changes to the compiler:
- Added extra argument to test instruction (string comparisons were
being treated as integer comparisons; properly deals with different
atomic type unifications now)
- Changed bytecode stub functions
Changes to the bytecode interpreter:
- Cleaned up comments
- Forked part of mb_machine to mb_exec
- Added support for submodules
- Added support for nondet procedures
- Added support for cc_xxx procedures
- Finished higher order calls
- Added (very basic) debug interface
- Added support for type information
- Added memory corruption checking
- Changed machine state dump formatting
- Fixed bug in nested switches
- Resolved builtin__unify and builtin_compare failures
- Modified bytecode tags generation so .c & .m tag files are separate
- Header usage rationalised
Changes to test suite:
- Added test cases for the bytecode interpreter.
- More work on the bytecode interpreter.
bytecode/Mmakefile:
Modified bytecode tags generation so .c & .m tag files are separate.
mb_machine split into mb_exec.
test file renamed to simple.m (copy over tests/simple??.m to test).
bytecode/TODO:
Updated.
bytecode/mb_basetypes.h:
Removed redundant MB_WORD_BITS (use MR_WORDBITS instead).
bytecode/mb_bytecode.h:
bytecode/mpb_bytecode.c:
Formatting changes
Third test instruction argument added.
bytecode/mb_disasm.h:
bytecode/mb_disasm.c:
Formatting changes.
Third test instruction argument added.
Added MB_FMT_INTWIDE.
bytecode/mb_exec.h:
bytecode/mb_exec.c:
bytecode/mb_machine.h:
bytecode/mb_machine.c:
mb_machine* split into mb_exec* and mb_machine*.
Almost all instructions now work (see important changes above).
bytecode/mb_interface.h:
bytecode/mb_interface.c:
Added nondet stub functions.
Added functions to lookup builtin compiler procedures:
do_redo, do_fail, __unify, __compare.
Removed old debugging code.
Stack layout changed to support nondet procedures.
bytecode/mb_interface_stub.c:
bytecode/mb_interface_stub.h:
Split off bare minimum of includes for bytecode stubs.
Added nondet stubs.
bytecode/mb_machine_show.c:
Made code cleaner (added subfunctions for MB_show_state).
Added variable names to machine state dump.
bytecode/mb_mem.h:
bytecode/mb_mem.c:
Added limited memory corruption checking.
bytecode/mb_module.h:
bytecode/mb_module.c:
Swapped order of temps & vars on stack.
Fixed nested switches causing random crashes.
Added nested module support.
bytecode/test/simple??.m:
Various test files - just to check that it doesn't crash.
(Most do not output anything & must be verified by stepping through
manually).
compiler/bytecode.m:
compiler/bytecode_gen.m:
Added extra argument to test instruction (otherwise
string comparisons would be treated as integer comparisons).
compiler/code_gen.m:
Changed call structure name in bytecode stub to resolve
issues with illegal characters in C structure names.
Changed bytecode stub header file name.
148 lines
3.8 KiB
Plaintext
148 lines
3.8 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1998-2001 The University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Mmake - Mmake file for the bytecode interpreter
|
|
|
|
MAIN_TARGET=all
|
|
|
|
MERCURY_DIR=..
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
-include ../Mmake.params
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
# NOTE: any library functions that called from bytecode must be compiled
|
|
# with trace information. (So their entry labels can be looked up)
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
MERCURY_SYSTEM = \
|
|
$(RUNTIME_DIR)/*.c $(RUNTIME_DIR)/*.h \
|
|
$(RUNTIME_DIR)/machdeps/*.c $(RUNTIME_DIR)/machdeps/*.h\
|
|
$(LIBRARY_DIR)/*.m \
|
|
$(TRACE_DIR)/*.h $(TRACE_DIR)/*.c \
|
|
$(BROWSER_DIR)/*.h $(BROWSER_DIR)/*.c \
|
|
$(BOEHM_GC_DIR)/*.h $(BOEHM_GC_DIR)/include/*.h
|
|
|
|
MERCURY_INC = \
|
|
-I$(LIBRARY_DIR) \
|
|
-I$(RUNTIME_DIR) \
|
|
-I$(BOEHM_GC_DIR) \
|
|
-I$(BOEHM_GC_DIR)/include \
|
|
-I$(TRACE_DIR)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
CFLAGS = $(MERCURY_INC) -DMR_BYTECODE_CALLABLE -g
|
|
|
|
MGNUCFLAGS-mb_disasm = --no-ansi
|
|
|
|
MCFLAGS = --trace shallow --generate-bytecode -O 0
|
|
|
|
C2INITFLAGS = --trace
|
|
MLFLAGS = --trace
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
# keep these lists in alphabetical order, please
|
|
|
|
# bytecode headers
|
|
MB_HDRS = \
|
|
mb_basetypes.h \
|
|
mb_bytecode.h \
|
|
mb_disasm.h \
|
|
mb_exec.h \
|
|
mb_interface.h \
|
|
mb_machine.h \
|
|
mb_machine_def.h \
|
|
mb_machine_show.h \
|
|
mb_mem.h \
|
|
mb_module.h \
|
|
mb_stack.h \
|
|
mb_util.h
|
|
|
|
# bytecode c files
|
|
MB_CFILES = \
|
|
mb_bytecode.c \
|
|
mb_disasm.c \
|
|
mb_exec.c \
|
|
mb_interface.c \
|
|
mb_interface_stub.c \
|
|
mb_machine.c \
|
|
mb_machine_show.c \
|
|
mb_mem.c \
|
|
mb_module.c \
|
|
mb_stack.c \
|
|
mb_util.c
|
|
|
|
# bytecode mercury files
|
|
MB_MFILES = \
|
|
# mb_interface_stub.m
|
|
|
|
# bytecode object files
|
|
MB_OBJS = $(MB_MFILES:%.m=%.o) $(MB_CFILES:%.c=%.o)
|
|
|
|
$(MB_OBJS): $(MB_HDRS)
|
|
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
# The actual program (as distinct from bytecode interpreter)
|
|
|
|
HDRS =
|
|
|
|
CFILES =
|
|
|
|
MFILES = simple.m
|
|
|
|
OBJS = simple_init.o $(MFILES:%.m=%.o) $(CFILES:%.c=%.o)
|
|
|
|
$(OBJS): $(HDRS) $(MB_HDRS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
ALL_HDRS = $(HDRS) $(MB_HDRS)
|
|
ALL_MFILES = $(MFILES) $(MB_MFILES)
|
|
ALL_CFILES = $(CFILES) $(MB_CFILES)
|
|
ALL_OBJS = $(OBJS) $(MB_OBJS)
|
|
|
|
ALL_DEPENDS=$(ALL_MFILES:%=%.depend)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
.PHONY: all
|
|
all: check
|
|
|
|
MLOBJS = $(MB_OBJS)
|
|
|
|
.PHONY: check
|
|
check: simple
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
# tags actually depends on $(MERCURY_SYSTEM) too but since changes to that
|
|
# hardly ever have an effect, just ignore them
|
|
tags: $(ALL_CFILES) $(ALL_HDRS) tags2
|
|
ctags $(CTAGFLAGS) $(ALL_CFILES) $(ALL_HDRS) $(MERCURY_SYSTEM)
|
|
|
|
tags2: $(ALL_MFILES)
|
|
mtags $(MTAGFLAGS) $(ALL_MFILES) $(MERCURY_SYSTEM)
|
|
mv tags tags2
|
|
|
|
.PHONY: depend
|
|
depend: $(ALL_DEPENDS)
|
|
|
|
.PHONY: clean_local
|
|
clean_local:
|
|
rm -f $(ALL_MFILES:%.m=%.mbc)
|
|
rm -f $(ALL_MFILES:%.m=%.bytedebug)
|
|
rm -f $(ALL_OBJS)
|
|
|
|
.PHONY: realclean_local
|
|
realclean_local:
|
|
rm -f tags tags2 *.mbc *.bytedebug
|
|
# XXX: The dependencies in mmake ignore .mbc and .bytedebug files
|
|
# so we have to manually delete them. We delete all bytecode files
|
|
# because it will leave submodule files if we don't
|
|
# (eg: module simple contains simple2: simple.simple2.mbc will be
|
|
# generated but will not be removed properly)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|