[m-dev.] diff: fix memory-profiling of arrays
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Sep 26 02:18:11 AEDT 2000
Estimated hours taken: 0.5
library/array.m:
Ensure that array allocations get recorded by the memory
profiler.
Workspace: /home/mercury0/fjh/mercury
Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.72
diff -u -d -r1.72 array.m
--- library/array.m 2000/08/02 14:13:06 1.72
+++ library/array.m 2000/09/25 10:23:06
@@ -403,11 +403,13 @@
:- pragma c_code(array__init(Size::in, Item::in, Array::array_uo),
[will_not_call_mercury, thread_safe], "
+ MR_maybe_record_allocation(Size + 1, MR_PROC_LABEL, ""array:array/1"");
Array = (Word) ML_make_array(Size, Item);
").
:- pragma c_code(array__make_empty_array(Array::array_uo),
[will_not_call_mercury, thread_safe], "
+ MR_maybe_record_allocation(1, MR_PROC_LABEL, ""array:array/1"");
Array = (Word) ML_make_array(0, 0);
").
@@ -551,6 +553,7 @@
:- pragma c_code(array__resize(Array0::array_di, Size::in, Item::in,
Array::array_uo), [will_not_call_mercury, thread_safe], "
+ MR_maybe_record_allocation(Size + 1, MR_PROC_LABEL, ""array:array/1"");
Array = (Word) ML_resize_array(
(MR_ArrayType *) Array0, Size, Item);
").
@@ -595,6 +598,7 @@
:- pragma c_code(array__shrink(Array0::array_di, Size::in, Array::array_uo),
[will_not_call_mercury, thread_safe], "
+ MR_maybe_record_allocation(Size + 1, MR_PROC_LABEL, ""array:array/1"");
Array = (Word) ML_shrink_array(
(MR_ArrayType *) Array0, Size);
").
@@ -630,11 +634,15 @@
:- pragma c_code(array__copy(Array0::array_ui, Array::array_uo),
[will_not_call_mercury, thread_safe], "
+ MR_maybe_record_allocation((((MR_ArrayType *) Array0)->size) + 1,
+ MR_PROC_LABEL, ""array:array/1"");
Array = (Word) ML_copy_array((MR_ArrayType *) Array0);
").
:- pragma c_code(array__copy(Array0::in, Array::array_uo),
[will_not_call_mercury, thread_safe], "
+ MR_maybe_record_allocation((((MR_ArrayType *) Array0)->size) + 1,
+ MR_PROC_LABEL, ""array:array/1"");
Array = (Word) ML_copy_array((MR_ArrayType *) Array0);
").
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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