summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1995-07-18 08:41:12 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1995-07-18 08:41:12 +0000
commita7d235831975e9b925336a91a897c26c1c39fc7c (patch)
tree399269a01c5e9d0db90c160e5be916ab192f7cf8
parentfafb9d5084b1621a2abfe0ef3189a7b194f07737 (diff)
Production des exceptions predefinies par le linker natif.
MAJ du Makefile suite a la separation de compilos C pour le bytecode / pour le compilo natif. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@115 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmrun/Makefile32
-rw-r--r--asmrun/fail.c49
-rw-r--r--asmrun/main.c1
3 files changed, 25 insertions, 57 deletions
diff --git a/asmrun/Makefile b/asmrun/Makefile
index af067387f..73fc63dab 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -1,22 +1,20 @@
include ../config/Makefile.h
include ../Makefile.config
-CFLAGS=-I../byterun -DTARGET_$(ARCH) -O $(CCCOMPOPTS)
-DFLAGS=-I../../byterun -DTARGET_$(ARCH) -g -DDEBUG $(CCCOMPOPTS)
-
-COMMONOBJS=../byterun/misc.o ../byterun/freelist.o \
- ../byterun/major_gc.o ../byterun/minor_gc.o ../byterun/memory.o \
- ../byterun/alloc.o ../byterun/compare.o ../byterun/ints.o \
- ../byterun/floats.o ../byterun/str.o ../byterun/array.o \
- ../byterun/io.o ../byterun/extern.o ../byterun/intern.o \
- ../byterun/hash.o ../byterun/sys.o ../byterun/parsing.o \
- ../byterun/gc_ctrl.o ../byterun/terminfo.o ../byterun/crc.o \
- ../byterun/obj.o
-OWNOBJS=main.o fail.o roots.o signals.o
+CC=$(NATIVECC)
+CFLAGS=-I../byterun -DTARGET_$(ARCH) -O $(NATIVECCCOMPOPTS)
+DFLAGS=-I../byterun -DTARGET_$(ARCH) -g -DDEBUG $(NATIVECCCOMPOPTS)
+
+VPATH=.:../byterun
+
+COBJS=main.o fail.o roots.o signals.o \
+ misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o \
+ floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o \
+ gc_ctrl.o terminfo.o crc.o obj.o
ASMOBJS=$(ARCH).o
-OBJS=$(OWNOBJS) $(ASMOBJS) $(COMMONOBJS)
-DOBJS=$(OWNOBJS:.o=.d.o) $(ASMOBJS) $(COMMONOBJS:.o=.d.o)
+OBJS=$(COBJS) $(ASMOBJS)
+DOBJS=$(COBJS:.o=.d.o) $(ASMOBJS)
all: libasmrun.a libasmrund.a
@@ -36,8 +34,10 @@ libasmrund.a: $(DOBJS)
$(AS) $(ASFLAGS) -o $*.o $*.asm
.c.d.o:
- cd .debugobj; $(CC) -c $(DFLAGS) -I.. ../$<
- mv .debugobj/$*.o $*.d.o
+ @ if test -f $*.o; then mv $*.o $*.f.o; else :; fi
+ $(CC) -c $(DFLAGS) $<
+ mv $*.o $*.d.o
+ @ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi
clean::
rm -f *.o *.s *.a *~
diff --git a/asmrun/fail.c b/asmrun/fail.c
index 1f074b773..c73b75dd3 100644
--- a/asmrun/fail.c
+++ b/asmrun/fail.c
@@ -14,39 +14,8 @@ struct longjmp_buffer * external_raise;
/* The globals holding predefined exceptions */
-value Out_of_memory, Sys_error, Failure, Invalid_argument;
-value End_of_file, Division_by_zero, Not_found, Match_failure;
-
-/* Initialize the predefined exceptions */
-
-static struct { value * loc; char * name; } predefined_exceptions[] = {
- &Out_of_memory, "Out_of_memory",
- &Sys_error, "Sys_error",
- &Failure, "Failure",
- &Invalid_argument, "Invalid_argument",
- &End_of_file, "End_of_file",
- &Division_by_zero, "Division_by_zero",
- &Not_found, "Not_found",
- &Match_failure, "Match_failure",
- NULL, NULL
-};
-
-void init_exceptions()
-{
- int i;
- value * loc;
- value exn_bucket;
- Push_roots(r, 1);
- for (i = 0; predefined_exceptions[i].loc != NULL; i++) {
- r[0] = copy_string(predefined_exceptions[i].name);
- exn_bucket = alloc(1, 0);
- Field(exn_bucket, 0) = r[0];
- loc = predefined_exceptions[i].loc;
- *loc = exn_bucket;
- register_global_root(loc);
- }
- Pop_roots();
-}
+extern int Out_of_memory, Sys_error, Failure, Invalid_argument;
+extern int End_of_file, Division_by_zero, Not_found, Match_failure;
/* Exception raising */
@@ -96,13 +65,13 @@ void raise_with_string(tag, msg)
void failwith (msg)
char * msg;
{
- raise_with_string(Failure, msg);
+ raise_with_string((value) &Failure, msg);
}
void invalid_argument (msg)
char * msg;
{
- raise_with_string(Invalid_argument, msg);
+ raise_with_string((value) &Invalid_argument, msg);
}
/* To raise Out_of_memory, we can't use raise_constant,
@@ -119,28 +88,28 @@ static struct {
void raise_out_of_memory()
{
out_of_memory_bucket.hdr = Make_header(1, 0, White);
- out_of_memory_bucket.exn = Out_of_memory;
+ out_of_memory_bucket.exn = (value) &Out_of_memory;
mlraise((value) &(out_of_memory_bucket.exn));
}
void raise_sys_error(msg)
value msg;
{
- raise_with_arg(Sys_error, msg);
+ raise_with_arg((value) &Sys_error, msg);
}
void raise_end_of_file()
{
- raise_constant(End_of_file);
+ raise_constant((value) &End_of_file);
}
void raise_zero_divide()
{
- raise_constant(Division_by_zero);
+ raise_constant((value) &Division_by_zero);
}
void raise_not_found()
{
- raise_constant(Not_found);
+ raise_constant((value) &Not_found);
}
diff --git a/asmrun/main.c b/asmrun/main.c
index be9cca81a..8914c44fe 100644
--- a/asmrun/main.c
+++ b/asmrun/main.c
@@ -45,7 +45,6 @@ int main(argc, argv)
}
init_gc (minor_heap_init, heap_chunk_init, percent_free_init, verbose_init);
init_atoms();
- init_exceptions();
sys_init(argv);
retcode = caml_start_program();
if (retcode == 0) {