[m-dev.] for review: cleanup of dl.m
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Feb 21 15:02:29 AEDT 2001
This for review (and maybe commit) by Fergus, on both branches.
Address Fergus's late review comments on a previous change.
browser/dl.m:
Allocate closures on the heap.
runtime/mercury_heap.h:
Add a mechanism to allocate C structures on the heap.
runtime/mercury_stacks.h:
runtime/mercury_types.h:
Move a macro from mercury_stacks.h to mercury_types.h, to give
mercury_heap.h access to it.
Zoltan.
cvs diff: Diffing .
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/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
Index: browser/dl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/dl.m,v
retrieving revision 1.11
diff -u -b -r1.11 dl.m
--- browser/dl.m 2001/02/13 00:06:12 1.11
+++ browser/dl.m 2001/02/15 07:28:14
@@ -210,7 +210,12 @@
ML_DL_closure_counter++;
sprintf(buf, ""@%d;"", ML_DL_closure_counter);
- closure_id = MR_GC_NEW(MR_Closure_Id);
+ /*
+ ** XXX All the allocations in this code should use malloc
+ ** in deep profiling grades.
+ */
+
+ MR_incr_hp_type(closure_id, MR_Closure_Id);
closure_id->proc_id.MR_proc_user.MR_user_pred_or_func = MR_PREDICATE;
closure_id->proc_id.MR_proc_user.MR_user_decl_module = ""unknown"";
closure_id->proc_id.MR_proc_user.MR_user_def_module = ""unknown"";
@@ -220,9 +225,9 @@
closure_id->module_name = ""dl"";
closure_id->file_name = __FILE__;
closure_id->line_number = __LINE__;
- closure_id->goal_path = strdup(buf);
+ closure_id->goal_path = MR_make_aligned_string_copy(buf);
- closure_layout = MR_GC_NEW(MR_Closure_Dyn_Link_Layout);
+ MR_incr_hp_type(closure_layout, MR_Closure_Dyn_Link_Layout);
closure_layout->closure_id = closure_id;
closure_layout->type_params = NULL;
closure_layout->num_all_args = 0;
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
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/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
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/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/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 library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_heap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_heap.h,v
retrieving revision 1.19
diff -u -b -r1.19 mercury_heap.h
--- runtime/mercury_heap.h 2001/01/10 10:57:25 1.19
+++ runtime/mercury_heap.h 2001/01/19 02:14:22
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 1995-2000 The University of Melbourne.
+** Copyright (C) 1995-2001 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
*/
@@ -116,13 +116,15 @@
** min_heap_reclamation_point. See the comments in mercury_context.h next to
** the set_min_heap_reclamation_point() macro.
*/
- #define MR_restore_hp(src) ( \
+ #define MR_restore_hp(src) \
+ ( \
MR_LVALUE_CAST(MR_Word, MR_hp) = (src), \
(void) 0 \
)
/*
- #define MR_restore_hp(src) ( \
+ #define MR_restore_hp(src) \
+ ( \
MR_LVALUE_CAST(MR_Word, MR_hp) = \
( (MR_Word) MR_min_hp_rec < (src) ? \
(src) : (MR_Word) MR_min_hp_rec ), \
@@ -174,6 +176,13 @@
MR_tag_incr_hp_atomic((dest), MR_mktag(0), (count))
#define MR_incr_hp_atomic_msg(dest, count, proclabel, type) \
MR_tag_incr_hp_atomic_msg((dest), MR_mktag(0), (count), \
+ proclabel, (type))
+#define MR_incr_hp_type(dest, typename) \
+ MR_tag_incr_hp((dest), MR_mktag(0), \
+ (MR_bytes_to_words(sizeof(typename))))
+#define MR_incr_hp_type_msg(dest, typename, proclabel, type) \
+ MR_tag_incr_hp_msg((dest), MR_mktag(0), \
+ (MR_bytes_to_words(sizeof(typename))), \
proclabel, (type))
#ifdef MR_HIGHLEVEL_CODE
cvs diff: cannot find runtime/mercury_memory.c
cvs diff: cannot find runtime/mercury_memory.h
Index: runtime/mercury_stacks.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.28
diff -u -b -r1.28 mercury_stacks.h
--- runtime/mercury_stacks.h 2001/02/19 02:07:16 1.28
+++ runtime/mercury_stacks.h 2001/02/19 08:03:05
@@ -126,9 +126,6 @@
MR_nondstack_overflow_check(); \
} while (0)
-/* convert a size in bytes to a size in words, rounding up if necessary */
-#define MR_bytes_to_words(x) (((x) + sizeof(MR_Word) - 1) / sizeof(MR_Word))
-
/* just like mkframe, but also reserves space for a struct */
/* with the given tag at the bottom of the nondet stack frame */
#define MR_mkpragmaframe(predname, numslots, structname, redoip) \
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.25
diff -u -b -r1.25 mercury_types.h
--- runtime/mercury_types.h 2000/12/04 04:48:05 1.25
+++ runtime/mercury_types.h 2001/01/19 02:13:25
@@ -60,6 +60,12 @@
typedef MR_intptr_t MR_Bool;
/*
+** Convert a size in bytes to a size in words, rounding up if necessary.
+*/
+
+#define MR_bytes_to_words(x) (((x) + sizeof(MR_Word) - 1) / sizeof(MR_Word))
+
+/*
** `MR_Code *' is used as a generic pointer-to-label type that can point
** to any label defined using the Define_* macros in mercury_goto.h.
*/
@@ -109,12 +115,11 @@
** Since it is used in some C code fragments, we define it as MR_Word
** in the low-level backend.
*/
+
#ifdef MR_HIGHLEVEL_CODE
typedef void *MR_Box;
#else
typedef MR_Word MR_Box;
#endif
-
-
#endif /* not MERCURY_TYPES_H */
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/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/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
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