[m-dev.] diff: move the initialisation of MR_mmc_options in MR_trace_event_external()

Erwan Jahier Erwan.Jahier at irisa.fr
Fri Oct 29 06:14:23 AEST 1999


I am afraid I have forgotten to commit that 5 months old change. I do it now.


| Estimated hours taken: 0.2
| 
| Initialise the variable MR_mmc_options in MR_trace_init_external() rather than
| in MR_trace_event_external() as it is useless to pay the price of a call to
| MR_TRACE_CALL_MERCURY() for every event.
| 
| 
| trace/mercury_trace_external.c:
| 	Move the call to 
| 	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options))
| 	from MR_trace_event_external() to MR_trace_init_external().
| 
| Index: trace/mercury_trace_external.c
| ===================================================================
| RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
| retrieving revision 1.17
| diff -u -r1.17 mercury_trace_external.c
| --- mercury_trace_external.c	1999/05/21 14:38:21	1.17
| +++ mercury_trace_external.c	1999/05/26 10:02:25
| @@ -83,6 +83,8 @@
|  MercuryFile MR_debugger_socket_in;
|  MercuryFile MR_debugger_socket_out;
|  
| +String	MR_mmc_options;
| +
|  /*
|  ** Use a GNU C extension to enforce static type checking
|  ** for printf-style functions. 
| @@ -214,6 +216,13 @@
|  	Word debugger_request;
|  	Integer debugger_request_type;
|  
| +	/* 
| +	** MR_mmc_options contains the options to pass to mmc when compiling 
| +	** queries. We initialise it to the String "".
| +	*/
| +
| +	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options));
| +
|  	/*
|  	** We presume that the user's program has been invoked from
|  	** within the debugger (e.g. Opium).
| @@ -401,13 +410,6 @@
|  	Integer		modules_list_length;
|  	Word		modules_list;
|  	int		ancestor_level;
| -
| -	/* 
| -	** MR_mmc_options contains the options to pass to mmc when compiling 
| -	** queries. We initialise it to the String "".
| -	*/
| -	static String	MR_mmc_options;
| -	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options));
|  
|  	/* by default, print variables from the current call */
|  	ancestor_level = 0;
| 
|

Fergus answered:
| On 26-May-1999, Erwan Jahier <Erwan.Jahier at irisa.fr> wrote:
| > +++ mercury_trace_external.c	1999/05/26 10:02:25
| > @@ -83,6 +83,8 @@
| >  MercuryFile MR_debugger_socket_in;
| >  MercuryFile MR_debugger_socket_out;
| >  
| > +String	MR_mmc_options;
| 
| That variable is only used in this file, so you should declare it as
| `static'.
| 
| Apart from that, this change looks fine now.




And the diff now looks like that:

Index: mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.26
diff -u -r1.26 mercury_trace_external.c
--- mercury_trace_external.c	1999/10/27 13:47:08	1.26
+++ mercury_trace_external.c	1999/10/28 20:12:47
@@ -83,6 +83,8 @@
 MercuryFile MR_debugger_socket_in;
 MercuryFile MR_debugger_socket_out;
 
+static String	MR_mmc_options;
+
 /*
 ** Use a GNU C extension to enforce static type checking
 ** for printf-style functions. 
@@ -205,6 +207,12 @@
 	Word debugger_request;
 	Integer debugger_request_type;
 
+	/* 
+	** MR_mmc_options contains the options to pass to mmc when compiling 
+	** queries. We initialise it to the String "".
+	*/
+	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options));
+
 	/*
 	** We presume that the user's program has been invoked from
 	** within the debugger (e.g. Opium).
@@ -400,7 +408,6 @@
 	Word		*saved_regs = event_info->MR_saved_regs;
 	Integer		modules_list_length;
 	Word		modules_list;
-	static String	MR_mmc_options;
 
 	MR_trace_enabled = FALSE;
 
@@ -415,12 +422,6 @@
 	event_details.MR_call_seqno = MR_trace_call_seqno;
 	event_details.MR_call_depth = MR_trace_call_depth;
 	event_details.MR_event_number = MR_trace_event_number;
-
-	/* 
-	** MR_mmc_options contains the options to pass to mmc when compiling 
-	** queries. We initialise it to the String "".
-	*/
-	MR_TRACE_CALL_MERCURY(ML_DI_init_mercury_string(&MR_mmc_options));
 
 	MR_trace_init_point_vars(event_info->MR_event_sll,
 		event_info->MR_saved_regs);

-- 
R1.


--------------------------------------------------------------------------
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