[m-rev.] for review: improvements to subterm dependency tracking
Julien Fischer
juliensf at cs.mu.OZ.AU
Thu Nov 3 12:38:23 AEDT 2005
On Sun, 30 Oct 2005, Ian MacLarty wrote:
> Estimated hours taken: 20
> Branches: main
>
> Implement a second version of the subterm dependency tracking algorithm
> that uses the following heuristic to speed things up: If the subterm is being
> tracked through an output argument, and there is an input argument with the
> same name as the output argumnet, except for a numerical suffix, then the new
> algorithm will check if the subterm appears in the same position in the input
> argument. If it does then it will continue tracking the subterm in the input
...
> runtime/Mmakefile:
> runtime/mercury_layout_util.h:
> runtime/mercury_stack_layout.h:
> trace/mercury_trace_vars.c:
> trace/mercury_trace_vars.h:
> Move the function for finding the name of a variable to the runtime,
> so that it can be called from the declarative debugger.
You forgot to do cvs add on mercury_stack_layout.c.
I've grabbed the file and committed it - Ian, could you please check
all this when you get back.
Estimated hours taken: 0.5
Branches: main
runtime/Mmakefile:
runtime/mercury_stack_layout.c:
Add a file that Ian forgot to add as part of his
change to subterm dependency tracking.
Julien.
Index: mercury_stack_layout.c
===================================================================
RCS file: mercury_stack_layout.c
diff -N mercury_stack_layout.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mercury_stack_layout.c 3 Nov 2005 01:25:03 -0000
@@ -0,0 +1,67 @@
+/*
+** vim:sw=4 ts=4 expandtab
+*/
+/*
+** Copyright (C) 2005 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.
+*/
+
+/*
+** This file implements utility functions operating on the data structures
+** defined in the corresponding header file.
+**
+** Author: Zoltan Somogyi
+*/
+
+#include "mercury_imp.h"
+#include "mercury_stack_layout.h"
+
+MR_ConstString
+MR_hlds_var_name(const MR_Proc_Layout *entry, int hlds_var_num)
+{
+ const char *string_table;
+ MR_Integer string_table_size;
+ int offset;
+
+ string_table = entry->MR_sle_module_layout->MR_ml_string_table;
+ string_table_size = entry->MR_sle_module_layout->MR_ml_string_table_size;
+
+ if (hlds_var_num == 0) {
+ /* this value is not a variable */
+ return NULL;
+ }
+
+ if (hlds_var_num > entry->MR_sle_max_named_var_num) {
+ /* this value is a compiler-generated variable */
+ return NULL;
+ }
+
+ /* variable number 1 is stored at offset 0 */
+ offset = entry->MR_sle_used_var_names[hlds_var_num - 1];
+ if (offset > string_table_size) {
+ MR_fatal_error("MR_hlds_var_name: bounds error on string table");
+ }
+
+ return string_table + offset;
+}
+
+int
+MR_find_start_of_num_suffix(const char *str)
+{
+ int len;
+ const char *s;
+
+ len = strlen(str);
+ s = str + len - 1;
+ while (s > str && MR_isdigit(*s)) {
+ s--;
+ }
+
+ if (s == str + len - 1) {
+ return -1;
+ } else {
+ /* *(s+1) is the first character of the numerical suffix */
+ return (s + 1) - str;
+ }
+}
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.128
diff -u -r1.128 Mmakefile
--- runtime/Mmakefile 3 Nov 2005 00:17:02 -0000 1.128
+++ runtime/Mmakefile 3 Nov 2005 01:26:04 -0000
@@ -179,6 +179,7 @@
mercury_runtime_util.c \
mercury_signal.c \
mercury_stacks.c \
+ mercury_stack_layout.c \
mercury_stack_trace.c \
mercury_string.c \
mercury_tabling.c \
--------------------------------------------------------------------------
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