[m-rev.] diff: MR_compute_max_mr_num
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue Jun 3 19:58:22 AEST 2003
Centralize the code for figuring out how many registers the debugger ought to
save at labels in a procedure.
runtime/mercury_stack_layout.h:
Add a macro to do the computation.
trace/mercury_trace.c:
Call the macro where relevant instead of duplicating code.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.71
diff -u -b -r1.71 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h 7 May 2003 03:21:46 -0000 1.71
+++ runtime/mercury_stack_layout.h 3 Jun 2003 04:32:27 -0000
@@ -688,6 +688,15 @@
MR_int_least8_t MR_exec_maybe_call_table;
} MR_Exec_Trace;
+#define MR_compute_max_mr_num(max_mr_num, layout) \
+ do { \
+ int max_r_num; \
+ \
+ max_r_num = (layout)->MR_sll_entry->MR_sle_max_r_num + \
+ MR_NUM_SPECIAL_REG; \
+ max_mr_num = MR_max(max_r_num, MR_MAX_SPECIAL_REG_MR); \
+ } while (0)
+
/*-------------------------------------------------------------------------*/
/*
** Definitions for MR_Proc_Layout
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.61
diff -u -b -r1.61 mercury_trace.c
--- trace/mercury_trace.c 2 May 2003 21:44:17 -0000 1.61
+++ trace/mercury_trace.c 2 Jun 2003 17:27:50 -0000
@@ -177,18 +177,11 @@
#ifdef MR_USE_EXTERNAL_DEBUGGER
MR_Event_Info event_info;
MR_Word *saved_regs = event_info.MR_saved_regs;
- int max_r_num;
const char *path;
MR_bool stop_collecting = MR_FALSE;
int lineno = 0;
- max_r_num = layout->MR_sll_entry->MR_sle_max_r_num;
- if (max_r_num + MR_NUM_SPECIAL_REG > MR_MAX_SPECIAL_REG_MR) {
- event_info.MR_max_mr_num = max_r_num + MR_NUM_SPECIAL_REG;
- } else {
- event_info.MR_max_mr_num = MR_MAX_SPECIAL_REG_MR;
- }
-
+ MR_compute_max_mr_num(event_info.MR_max_mr_num, layout);
port = (MR_Trace_Port) layout->MR_sll_port;
path = MR_label_goal_path(layout);
MR_copy_regs_to_saved_regs(event_info.MR_max_mr_num, saved_regs);
@@ -421,7 +414,6 @@
MR_Code *jumpaddr;
MR_Event_Info event_info;
MR_Word *saved_regs = event_info.MR_saved_regs;
- int max_r_num;
event_info.MR_event_number = MR_trace_event_number;
event_info.MR_call_seqno = seqno;
@@ -430,13 +422,7 @@
event_info.MR_event_sll = layout;
event_info.MR_event_path = MR_label_goal_path(layout);
- max_r_num = layout->MR_sll_entry->MR_sle_max_r_num;
- if (max_r_num + MR_NUM_SPECIAL_REG > MR_MAX_SPECIAL_REG_MR) {
- event_info.MR_max_mr_num = max_r_num + MR_NUM_SPECIAL_REG;
- } else {
- event_info.MR_max_mr_num = MR_MAX_SPECIAL_REG_MR;
- }
-
+ MR_compute_max_mr_num(event_info.MR_max_mr_num, layout);
/* This also saves the regs in MR_fake_regs. */
MR_copy_regs_to_saved_regs(event_info.MR_max_mr_num, saved_regs);
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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