[m-rev.] diff: fix user events seg fault

Mark Brown mark at csse.unimelb.edu.au
Wed Apr 4 14:38:20 AEST 2007


On 04-Apr-2007, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> On Wed, 4 Apr 2007, Mark Brown wrote:
> >+The C code fragment should not declare any labels or static variables
> >+unless there is also a Mercury @samp{pragma no_inline} declaration
> 
> or @samp{may_not_duplicate} foreign code attribute ...
> 
> >+    /*
> >+    ** Space to reserve for local vars.  If this parameter is modified
> >+    ** then the reference manual will also need to be updated.
> >+    */
> >+    #define LOCALS_SIZE     10240
> >+
> 
> I suggest putting a comment in the reference manual source that points
> to here as well.

Estimated hours taken: 0.1
Branches: main

Address Julien's review comments.

doc/reference_manual.texi:
	Add a reference to the LOCALS_SIZE definition.

	Mention the may_not_duplicate attribute in the discussion on
	labels and static variables in C foreign_procs.

Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.389
diff -u -r1.389 reference_manual.texi
--- doc/reference_manual.texi	4 Apr 2007 01:09:48 -0000	1.389
+++ doc/reference_manual.texi	4 Apr 2007 04:34:05 -0000
@@ -7070,13 +7070,14 @@
 
 The C code fragment may declare local variables,
 up to a total size of 10kB for the procedure.
+ at c The relevant parameter is LOCALS_SIZE, defined in runtime/mercury_engine.c.
 If a procedure requires more than this for its local variables,
 the code can be moved into a separate function
 (defined in a @samp{pragma foreign_code} declaration, for example).
 
 The C code fragment should not declare any labels or static variables
-unless there is also a Mercury @samp{pragma no_inline} declaration
-for the procedure.
+unless there is also a @samp{pragma no_inline} declaration
+or a @samp{may_not_duplicate} foreign code attribute for the procedure.
 The reason for this is that otherwise the Mercury implementation may
 inline the procedure by duplicating the C code fragment for each call.
 If the C code fragment declared a static variable, inlining it in this
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list