[m-dev.] for review: minor changes to exception.m

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Jun 9 13:53:22 AEST 1999


For Fergus.

extras/exceptions/exception.m:
	Fix references to COMPACT_ARGS and to obsolete stack layout macros.

Zoltan.

cvs diff: Diffing .
Index: exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/exceptions/exception.m,v
retrieving revision 1.3
diff -u -b -r1.3 exception.m
--- exception.m	1999/03/24 08:53:54	1.3
+++ exception.m	1999/06/09 05:38:54
@@ -620,11 +620,7 @@
 #endif
 Declare_label(mercury__exception__builtin_throw_1_0_i1);
 
-#ifdef COMPACT_ARGS
-  #define BUILTIN_THROW_STACK_SIZE 1
-#else
-  #define BUILTIN_THROW_STACK_SIZE 2
-#endif
+#define BUILTIN_THROW_STACK_SIZE 1
 
 
 /*
@@ -634,13 +630,9 @@
 /* do we need one for exception_handler_do_fail? */
 
 MR_MAKE_PROC_LAYOUT(mercury__exception__builtin_throw_1_0,
-        MR_DETISM_DET, BUILTIN_THROW_STACK_SIZE, MR_LIVE_LVAL_STACKVAR(1),
+        MR_DETISM_DET, BUILTIN_THROW_STACK_SIZE, MR_LONG_LVAL_STACKVAR(1),
         MR_PREDICATE, ""exception"", ""builtin_throw"", 1, 0);
 MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_throw_1_0, 1);
-#ifndef COMPACT_ARGS
-  MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_throw_1_0, 2);
-  MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_throw_1_0, 3);
-#endif
 
 /*
 ** The following procedures all allocate their stack frames on
@@ -650,15 +642,15 @@
 */ 
 MR_MAKE_PROC_LAYOUT(mercury__exception__builtin_catch_3_2,
 	MR_DETISM_NON,	/* really cc_multi; also used for det */
-	MR_ENTRY_NO_SLOT_COUNT, MR_LVAL_TYPE_UNKNOWN,
+	MR_ENTRY_NO_SLOT_COUNT, MR_LONG_LVAL_TYPE_UNKNOWN,
 	MR_PREDICATE, ""exception"", ""builtin_catch"", 3, 2);
 MR_MAKE_PROC_LAYOUT(mercury__exception__builtin_catch_3_3,
 	MR_DETISM_NON,	/* really cc_nondet; also used for semidet */
-	MR_ENTRY_NO_SLOT_COUNT, MR_LVAL_TYPE_UNKNOWN,
+	MR_ENTRY_NO_SLOT_COUNT, MR_LONG_LVAL_TYPE_UNKNOWN,
 	MR_PREDICATE, ""exception"", ""builtin_catch"", 3, 3);
 MR_MAKE_PROC_LAYOUT(mercury__exception__builtin_catch_3_5,
 	MR_DETISM_NON,	/* ; also used for multi */
-	MR_ENTRY_NO_SLOT_COUNT, MR_LVAL_TYPE_UNKNOWN,
+	MR_ENTRY_NO_SLOT_COUNT, MR_LONG_LVAL_TYPE_UNKNOWN,
 	MR_PREDICATE, ""exception"", ""builtin_catch"", 3, 5);
 
 MR_MAKE_INTERNAL_LAYOUT(mercury__exception__builtin_catch_3_2, 1);
@@ -698,7 +690,7 @@
 ** This is the model_det version.
 ** On entry, we have a type_info (which we don't use) in r1,
 ** the Goal to execute in r2 and the Handler in r3.
-** On exit, we should put Result in r1 (with COMPACT_ARGS) or r4.
+** On exit, we should put Result in r1.
 */
 Define_entry(mercury__exception__builtin_catch_3_0); /* det */
 #ifdef PROFILE_CALLS
@@ -763,9 +755,6 @@
 	/*
 	** On exit from do_call_det_closure, Result is in r1
 	*/
-#ifndef COMPACT_ARGS
-	r4 = r1;
-#endif
 #ifdef MR_USE_TRAIL
 	MR_discard_ticket();
 #endif
@@ -779,14 +768,9 @@
 **	if throws an exception, call Handler(Result).
 **
 ** This is the model_semi version.
-** With COMPACT_ARGS,
-** on entry, we have a type_info (which we don't use) in r1,
+** On entry, we have a type_info (which we don't use) in r1,
 ** the Goal to execute in r2 and the Handler in r3,
 ** and on exit, we should put Result in r2.
-** Without COMPACT_ARGS,
-** on entry, we have a type_info (which we don't use) in r2,
-** the Goal to execute in r3 and the Handler in r4,
-** and on exit, we should put Result in r5.
 */
 Define_entry(mercury__exception__builtin_catch_3_1); /* semidet */
 #ifdef PROFILE_CALLS
@@ -806,11 +790,7 @@
 		Exception_Handler_Frame_struct,
 		ENTRY(exception_handler_do_fail));
 	FRAMEVARS->code_model = MODEL_SEMI;
-#ifdef COMPACT_ARGS
 	FRAMEVARS->handler = r3;	/* save the Handler closure */
-#else
-	FRAMEVARS->handler = r4;	/* save the Handler closure */
-#endif
 	FRAMEVARS->stack_ptr = MR_sp;	/* save the det stack pointer */
 #ifndef CONSERVATIVE_GC
 	/* save the heap and solutions heap pointers */
@@ -844,11 +824,7 @@
 	/*
 	** Now call `Goal(Result)'.
 	*/
-#ifdef COMPACT_ARGS
 	r1 = r2;	/* The Goal to call */
-#else
-	r1 = r3;	/* The Goal to call */
-#endif
 	r2 = 0;		/* Zero additional input arguments */
 	r3 = 1;		/* One output argument */
 	call(ENTRY(do_call_semidet_closure), 
@@ -864,9 +840,6 @@
 	** of whether r1 is true or false.  We just return the r1 value
 	** back to our caller.
 	*/
-#ifndef COMPACT_ARGS
-	r5 = r2;
-#endif
 #ifdef MR_USE_TRAIL
 	MR_discard_ticket();
 #endif
@@ -882,7 +855,7 @@
 ** This is the model_non version.
 ** On entry, we have a type_info (which we don't use) in r1,
 ** the Goal to execute in r2 and the Handler in r3.
-** On exit, we should put Result in r1 (with COMPACT_ARGS) or r3.
+** On exit, we should put Result in r1.
 */
 Define_entry(mercury__exception__builtin_catch_3_4); /* multi */
 #ifdef PROFILE_CALLS
@@ -950,11 +923,7 @@
 	update_prof_current_proc(LABEL(mercury__exception__builtin_catch_3_5));
 	/*
 	** On exit from do_call_nondet_closure, Result is in r1
-	*/
-#ifndef COMPACT_ARGS
-	r3 = r1;
-#endif
-	/*
+	**
 	** Note that we need to keep the trail ticket still,
 	** in case it is needed again on backtracking.
 	** We can only discard it when we fail() out, or
@@ -1121,7 +1090,6 @@
 	r3 = 1;			/* One output argument */
 	r4 = exception;		/* This is our one input argument */
 
-#ifdef COMPACT_ARGS
 	/*
 	** If the catch was semidet, we need to set the success indicator
 	** r1 to TRUE and return the result in r2; otherwise, we return
@@ -1146,30 +1114,6 @@
 	MR_succip = (Code *) MR_stackvar(1);
 	decr_sp_pop_msg(1);
 	proceed();
-
-#else /* not COMPACT_ARGS */
-
-	incr_sp_push_msg(2, ""builtin_throw/1"");
-	MR_stackvar(1) = (Word) MR_succip;
-	MR_stackvar(2) = catch_code_model;
-	call(ENTRY(do_call_det_closure), 
-		LABEL(mercury__exception__builtin_throw_1_0_i1)),
-		ENTRY(mercury__exception__builtin_throw_1_0));
-}
-Define_label(mercury__exception__builtin_throw_1_0_i1);
-	update_prof_current_proc(LABEL(mercury__exception__builtin_throw_1_0));
-	/* we've just returned from do_call_det_closure */
-	catch_code_model = MR_stackvar(2);
-	if (catch_code_model == MODEL_SEMI) {
-		r5 = r1;
-	else {
-		r4 = r1;
-	}
-	MR_succip = (Code *) MR_stackvar(1);
-	decr_sp_pop_msg(2);
-	proceed();
-
-#endif /* not COMPACT_ARGS */
 
 Define_entry(exception_handler_do_fail);
 	/*
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list