[m-rev.] for review: add agc tracing code to exception.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jun 5 15:07:16 AEST 2002
On 05-Jun-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> Remove the trailing semi-colon.
>
> All of the new macros should have `ML_' prefixes, not `MR_'.
Fixed. I also fixed a couple of existing names that
had `MR_' prefixes rather than `ML_' prefixes.
----------
Estimated hours taken: 0.25
Branches: main
Address stayl's review comments on my previous change.
library/exception.m:
Use `ML_' prefixes rather than `MR_' prefixes.
Delete a stray semicolon.
Workspace: /home/ceres/fjh/mercury
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.61
diff -u -d -r1.61 exception.m
--- library/exception.m 4 Jun 2002 15:18:15 -0000 1.61
+++ library/exception.m 5 Jun 2002 04:55:56 -0000
@@ -555,8 +555,8 @@
:- pragma c_header_code("
/* protect against multiple inclusion */
-#ifndef MR_HLC_EXCEPTION_GUARD
-#define MR_HLC_EXCEPTION_GUARD
+#ifndef ML_HLC_EXCEPTION_GUARD
+#define ML_HLC_EXCEPTION_GUARD
#ifdef MR_HIGHLEVEL_CODE
@@ -645,7 +645,7 @@
#endif /* MR_HIGHLEVEL_CODE */
-#endif /* MR_HLC_EXCEPTION_GUARD */
+#endif /* ML_HLC_EXCEPTION_GUARD */
").
:- pragma c_code("
@@ -844,33 +844,33 @@
(MR_Word) &agc_locals->handler_pred);
}
- #define MR_DECLARE_AGC_HANDLER \
+ #define ML_DECLARE_AGC_HANDLER \
struct mercury__exception__builtin_catch_locals agc_locals;
- #define MR_INSTALL_AGC_HANDLER(TYPE_INFO, HANDLER_PRED) \
+ #define ML_INSTALL_AGC_HANDLER(TYPE_INFO, HANDLER_PRED) \
do { \
agc_locals.prev = mercury__private_builtin__stack_chain; \
agc_locals.trace = mercury__exception__builtin_catch_gc_trace; \
agc_locals.type_info = (TYPE_INFO); \
agc_locals.handler_pred = (HANDLER_PRED); \
mercury__private_builtin__stack_chain = &agc_locals; \
- } while(0);
+ } while(0)
- #define MR_UNINSTALL_AGC_HANDLER() \
+ #define ML_UNINSTALL_AGC_HANDLER() \
do { \
mercury__private_builtin__stack_chain = ((struct MR_StackChain *) \
mercury__private_builtin__stack_chain)->prev; \
} while (0)
- #define MR_AGC_LOCAL(NAME) (agc_locals.NAME)
+ #define ML_AGC_LOCAL(NAME) (agc_locals.NAME)
#else /* !MR_NATIVE_GC */
/* If accurate GC is not enabled, we define all of these as NOPs. */
- #define MR_DECLARE_AGC_HANDLER
- #define MR_INSTALL_AGC_HANDLER(type_info, handler_pred)
- #define MR_UNINSTALL_AGC_HANDLER()
- #define MR_AGC_LOCAL(name) (name)
+ #define ML_DECLARE_AGC_HANDLER
+ #define ML_INSTALL_AGC_HANDLER(type_info, handler_pred)
+ #define ML_UNINSTALL_AGC_HANDLER()
+ #define ML_AGC_LOCAL(name) (name)
#endif /* !MR_NATIVE_GC */
@@ -879,12 +879,12 @@
MR_Pred pred, MR_Pred handler_pred, MR_Box *output)
{
ML_ExceptionHandler this_handler;
- MR_DECLARE_AGC_HANDLER
+ ML_DECLARE_AGC_HANDLER
this_handler.prev = ML_exception_handler;
ML_exception_handler = &this_handler;
- MR_INSTALL_AGC_HANDLER(type_info, handler_pred);
+ ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
#ifdef MR_DEBUG_JMPBUFS
fprintf(stderr, ""detcatch setjmp %p\\n"", this_handler.handler);
@@ -893,7 +893,7 @@
if (setjmp(this_handler.handler) == 0) {
ML_call_goal_det_handcoded(type_info, pred, output);
ML_exception_handler = this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
} else {
#ifdef MR_DEBUG_JMPBUFS
fprintf(stderr, ""detcatch caught jmp %p\\n"",
@@ -901,9 +901,9 @@
#endif
ML_exception_handler = this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
ML_call_handler_det_handcoded(
- MR_AGC_LOCAL(type_info), MR_AGC_LOCAL(handler_pred),
+ ML_AGC_LOCAL(type_info), ML_AGC_LOCAL(handler_pred),
this_handler.exception, output);
}
}
@@ -913,12 +913,12 @@
MR_Pred pred, MR_Pred handler_pred, MR_Box *output)
{
ML_ExceptionHandler this_handler;
- MR_DECLARE_AGC_HANDLER
+ ML_DECLARE_AGC_HANDLER
this_handler.prev = ML_exception_handler;
ML_exception_handler = &this_handler;
- MR_INSTALL_AGC_HANDLER(type_info, handler_pred);
+ ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
#ifdef MR_DEBUG_JMPBUFS
fprintf(stderr, ""semicatch setjmp %p\\n"", this_handler.handler);
@@ -928,7 +928,7 @@
MR_bool result = ML_call_goal_semi_handcoded(type_info, pred,
output);
ML_exception_handler = this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
return result;
} else {
#ifdef MR_DEBUG_JMPBUFS
@@ -937,9 +937,9 @@
#endif
ML_exception_handler = this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
ML_call_handler_det_handcoded(
- MR_AGC_LOCAL(type_info), MR_AGC_LOCAL(handler_pred),
+ ML_AGC_LOCAL(type_info), ML_AGC_LOCAL(handler_pred),
this_handler.exception, output);
return MR_TRUE;
}
@@ -953,7 +953,7 @@
MR_NestedCont cont)
{
ML_ExceptionHandler this_handler;
- MR_DECLARE_AGC_HANDLER
+ ML_DECLARE_AGC_HANDLER
auto void MR_CALL success_cont(void);
void MR_CALL success_cont(void) {
@@ -978,7 +978,7 @@
this_handler.prev = ML_exception_handler;
ML_exception_handler = &this_handler;
- MR_INSTALL_AGC_HANDLER(type_info, handler_pred);
+ ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
#ifdef MR_DEBUG_JMPBUFS
fprintf(stderr, ""noncatch setjmp %p\\n"", this_handler.handler);
@@ -988,7 +988,7 @@
ML_call_goal_non_handcoded(type_info, pred, output,
success_cont);
ML_exception_handler = this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
} else {
#ifdef MR_DEBUG_JMPBUFS
fprintf(stderr, ""noncatch caught jmp %p\\n"",
@@ -996,9 +996,9 @@
#endif
ML_exception_handler = this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
ML_call_handler_det_handcoded(
- MR_AGC_LOCAL(type_info), MR_AGC_LOCAL(handler_pred),
+ ML_AGC_LOCAL(type_info), ML_AGC_LOCAL(handler_pred),
this_handler.exception, output);
(*cont)();
}
@@ -1039,7 +1039,7 @@
MR_Pred pred, MR_Pred handler_pred, MR_Box *output,
MR_Cont cont, void *cont_env)
{
- MR_DECLARE_AGC_HANDLER
+ ML_DECLARE_AGC_HANDLER
struct ML_catch_env locals;
locals.cont = cont;
locals.cont_env = cont_env;
@@ -1047,7 +1047,7 @@
locals.this_handler.prev = ML_exception_handler;
ML_exception_handler = &locals.this_handler;
- MR_INSTALL_AGC_HANDLER(type_info, handler_pred);
+ ML_INSTALL_AGC_HANDLER(type_info, handler_pred);
#ifdef MR_DEBUG_JMPBUFS
fprintf(stderr, ""noncatch setjmp %p\\n"", locals.this_handler.handler);
@@ -1063,7 +1063,7 @@
** handler
*/
ML_exception_handler = locals.this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
return;
} else {
/*
@@ -1080,9 +1080,9 @@
ML_exception_handler = locals.this_handler.prev;
- MR_UNINSTALL_AGC_HANDLER();
+ ML_UNINSTALL_AGC_HANDLER();
ML_call_handler_det_handcoded(
- MR_AGC_LOCAL(type_info), MR_AGC_LOCAL(handler_pred),
+ ML_AGC_LOCAL(type_info), ML_AGC_LOCAL(handler_pred),
locals.this_handler.exception, output);
cont(cont_env);
}
@@ -1268,7 +1268,7 @@
*/
static MR_Code *
-MR_trace_throw(MR_Code *success_pointer, MR_Word *base_sp, MR_Word *base_curfr)
+ML_trace_throw(MR_Code *success_pointer, MR_Word *base_sp, MR_Word *base_curfr)
{
const MR_Internal *label;
const MR_Label_Layout *return_label_layout;
@@ -1726,7 +1726,7 @@
MR_Code *MR_jumpaddr;
MR_trace_set_exception_value(exception);
MR_save_transient_registers();
- MR_jumpaddr = MR_trace_throw(MR_succip, MR_sp, MR_curfr);
+ MR_jumpaddr = ML_trace_throw(MR_succip, MR_sp, MR_curfr);
MR_restore_transient_registers();
if (MR_jumpaddr != NULL) MR_GOTO(MR_jumpaddr);
}
@@ -1785,10 +1785,10 @@
if (MR_trace_enabled) {
/*
** The stack has already been unwound
- ** by MR_trace_throw(), so we can't dump it.
+ ** by ML_trace_throw(), so we can't dump it.
** (In fact, if we tried to dump the now-empty
** stack, we'd get incorrect results, since
- ** MR_trace_throw() does not restore MR_succip
+ ** ML_trace_throw() does not restore MR_succip
** to the appropriate value.)
*/
} else {
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list