[m-rev.] trivial diff: fix benchmark compilation problems

Julien Fischer juliensf at csse.unimelb.edu.au
Fri May 6 15:59:16 AEST 2011


Branches: main

Fix compilation problems in the benchmark suite.

benchmarks/progs/icfp2000*/eval.m:
benchmarks/progs/icfp2000*/globals.m:
benchmarks/progs/ray/scene.m:
 	Conform to recent changes to the map module.

benchmarks/progs/ray/ray.m:
benchmarks/progs/icfp2000*/space_partition.m:
 	Replace some uses of the old C interface.

benchmarks/prog/ray/off.m:
 	Replace calls to a predicate that no longer exists.

Julien.

Index: progs/icfp2000_no_iostate/eval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_no_iostate/eval.m,v
retrieving revision 1.1
diff -u -r1.1 eval.m
--- progs/icfp2000_no_iostate/eval.m	16 Dec 2009 04:44:21 -0000	1.1
+++ progs/icfp2000_no_iostate/eval.m	6 May 2011 05:48:59 -0000
@@ -205,7 +205,7 @@
  do_token(binder(Id), Env0, Stack0, Env, Stack) -->
  	{ pop(Stack0, Val, Stack1) ->
  		Stack = Stack1,
-		map__set(Env0, Id, Val, Env)
+		map__set(Id, Val, Env0, Env)
  			% XXX what if id is already bound?
  			% is it right to just overwrite
  			% the old value?
Index: progs/icfp2000_no_iostate/globals.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_no_iostate/globals.m,v
retrieving revision 1.1
diff -u -r1.1 globals.m
--- progs/icfp2000_no_iostate/globals.m	16 Dec 2009 04:44:21 -0000	1.1
+++ progs/icfp2000_no_iostate/globals.m	6 May 2011 05:49:26 -0000
@@ -52,9 +52,8 @@
  		{ univ_to_type(UMap0, Map0) }
  	->
  		{ type_to_univ(Value, UValue) },
-		{ map__set(Map0, univ(Name), UValue, Map) },
-		{ type_to_univ(Map, UMap1) },
-		{ unsafe_promise_unique(UMap1, UMap) },
+		{ map__set(univ(Name), UValue, Map0, Map) },
+		{ type_to_univ(Map, UMap) },
  		io__set_globals(UMap)
  	;
  		{ error("globals: global store stuffed up") }
Index: progs/icfp2000_no_iostate/space_partition.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_no_iostate/space_partition.m,v
retrieving revision 1.1
diff -u -r1.1 space_partition.m
--- progs/icfp2000_no_iostate/space_partition.m	16 Dec 2009 04:44:22 -0000	1.1
+++ progs/icfp2000_no_iostate/space_partition.m	6 May 2011 05:48:43 -0000
@@ -405,9 +405,11 @@
  		real::in, real::in, real::in, real::in, real::in, real::in,
  		real::in, real::in, real::in) is semidet.

-:- pragma c_code(intersect_bounding_box_2(XRay::in, YRay::in, ZRay::in,
+:- pragma foreign_proc("C",
+	intersect_bounding_box_2(XRay::in, YRay::in, ZRay::in,
  		XDir::in, YDir::in, ZDir::in, XMin::in, YMin::in, ZMin::in,
-		XMax::in, YMax::in, ZMax::in), will_not_call_mercury,
+		XMax::in, YMax::in, ZMax::in),
+	[promise_pure, will_not_call_mercury],
  "
  {
  	double minB[3], maxB[3];	/*box */
@@ -432,7 +434,7 @@
  	SUCCESS_INDICATOR = succeeded;
  }").

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "
  /*
  Fast Ray-Box Intersection
  by Andrew Woo
Index: progs/icfp2000_no_iostate_no_accum/eval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_no_iostate_no_accum/eval.m,v
retrieving revision 1.1
diff -u -r1.1 eval.m
--- progs/icfp2000_no_iostate_no_accum/eval.m	11 Jan 2010 23:26:01 -0000	1.1
+++ progs/icfp2000_no_iostate_no_accum/eval.m	6 May 2011 05:51:26 -0000
@@ -205,7 +205,7 @@
  do_token(binder(Id), Env0, Stack0, Env, Stack) -->
  	{ pop(Stack0, Val, Stack1) ->
  		Stack = Stack1,
-		map__set(Env0, Id, Val, Env)
+		map__set(Id, Val, Env0, Env)
  			% XXX what if id is already bound?
  			% is it right to just overwrite
  			% the old value?
Index: progs/icfp2000_no_iostate_no_accum/globals.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_no_iostate_no_accum/globals.m,v
retrieving revision 1.1
diff -u -r1.1 globals.m
--- progs/icfp2000_no_iostate_no_accum/globals.m	11 Jan 2010 23:26:01 -0000	1.1
+++ progs/icfp2000_no_iostate_no_accum/globals.m	6 May 2011 05:51:50 -0000
@@ -52,9 +52,8 @@
  		{ univ_to_type(UMap0, Map0) }
  	->
  		{ type_to_univ(Value, UValue) },
-		{ map__set(Map0, univ(Name), UValue, Map) },
-		{ type_to_univ(Map, UMap1) },
-		{ unsafe_promise_unique(UMap1, UMap) },
+		{ map__set(univ(Name), UValue, Map0, Map) },
+		{ type_to_univ(Map, UMap) },
  		io__set_globals(UMap)
  	;
  		{ error("globals: global store stuffed up") }
Index: progs/icfp2000_no_iostate_no_accum/space_partition.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_no_iostate_no_accum/space_partition.m,v
retrieving revision 1.1
diff -u -r1.1 space_partition.m
--- progs/icfp2000_no_iostate_no_accum/space_partition.m	11 Jan 2010 23:26:02 -0000	1.1
+++ progs/icfp2000_no_iostate_no_accum/space_partition.m	6 May 2011 05:51:08 -0000
@@ -405,9 +405,11 @@
  		real::in, real::in, real::in, real::in, real::in, real::in,
  		real::in, real::in, real::in) is semidet.

-:- pragma c_code(intersect_bounding_box_2(XRay::in, YRay::in, ZRay::in,
+:- pragma foreign_proc("C",
+	intersect_bounding_box_2(XRay::in, YRay::in, ZRay::in,
  		XDir::in, YDir::in, ZDir::in, XMin::in, YMin::in, ZMin::in,
-		XMax::in, YMax::in, ZMax::in), will_not_call_mercury,
+		XMax::in, YMax::in, ZMax::in),
+	[promise_pure, will_not_call_mercury],
  "
  {
  	double minB[3], maxB[3];	/*box */
@@ -432,7 +434,7 @@
  	SUCCESS_INDICATOR = succeeded;
  }").

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "
  /*
  Fast Ray-Box Intersection
  by Andrew Woo
Index: progs/icfp2000_par_pbone/eval.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_par_pbone/eval.m,v
retrieving revision 1.1
diff -u -r1.1 eval.m
--- progs/icfp2000_par_pbone/eval.m	9 Jul 2009 06:11:08 -0000	1.1
+++ progs/icfp2000_par_pbone/eval.m	6 May 2011 05:55:11 -0000
@@ -205,7 +205,7 @@
  do_token(binder(Id), Env0, Stack0, Env, Stack) -->
  	{ pop(Stack0, Val, Stack1) ->
  		Stack = Stack1,
-		map__set(Env0, Id, Val, Env)
+		map__set(Id, Val, Env0, Env)
  			% XXX what if id is already bound?
  			% is it right to just overwrite
  			% the old value?
Index: progs/icfp2000_par_pbone/globals.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_par_pbone/globals.m,v
retrieving revision 1.1
diff -u -r1.1 globals.m
--- progs/icfp2000_par_pbone/globals.m	9 Jul 2009 06:11:08 -0000	1.1
+++ progs/icfp2000_par_pbone/globals.m	6 May 2011 05:55:30 -0000
@@ -52,9 +52,8 @@
  		{ univ_to_type(UMap0, Map0) }
  	->
  		{ type_to_univ(Value, UValue) },
-		{ map__set(Map0, univ(Name), UValue, Map) },
-		{ type_to_univ(Map, UMap1) },
-		{ unsafe_promise_unique(UMap1, UMap) },
+		{ map__set(univ(Name), UValue, Map0, Map) },
+		{ type_to_univ(Map, UMap) },
  		io__set_globals(UMap)
  	;
  		{ error("globals: global store stuffed up") }
Index: progs/icfp2000_par_pbone/space_partition.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/icfp2000_par_pbone/space_partition.m,v
retrieving revision 1.1
diff -u -r1.1 space_partition.m
--- progs/icfp2000_par_pbone/space_partition.m	9 Jul 2009 06:11:08 -0000	1.1
+++ progs/icfp2000_par_pbone/space_partition.m	6 May 2011 05:54:33 -0000
@@ -405,9 +405,11 @@
  		real::in, real::in, real::in, real::in, real::in, real::in,
  		real::in, real::in, real::in) is semidet.

-:- pragma c_code(intersect_bounding_box_2(XRay::in, YRay::in, ZRay::in,
+:- pragma foreign_proc("C",
+	intersect_bounding_box_2(XRay::in, YRay::in, ZRay::in,
  		XDir::in, YDir::in, ZDir::in, XMin::in, YMin::in, ZMin::in,
-		XMax::in, YMax::in, ZMax::in), will_not_call_mercury,
+		XMax::in, YMax::in, ZMax::in),
+	[promise_pure, will_not_call_mercury],
  "
  {
  	double minB[3], maxB[3];	/*box */
@@ -432,7 +434,7 @@
  	SUCCESS_INDICATOR = succeeded;
  }").

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "
  /*
  Fast Ray-Box Intersection
  by Andrew Woo
Index: progs/ray/off.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/ray/off.m,v
retrieving revision 1.1
diff -u -r1.1 off.m
--- progs/ray/off.m	12 Jul 2002 23:38:15 -0000	1.1
+++ progs/ray/off.m	6 May 2011 05:42:51 -0000
@@ -304,9 +304,9 @@
              string__to_int(W2, I2), 0 =< I2, I2 =< 255,
              string__to_int(W3, I3), 0 =< I3, I3 =< 255
          ->
-            int__to_float(I1, F1a),
-            int__to_float(I2, F2a),
-            int__to_float(I3, F3a),
+            F1a = float(I1),
+            F2a = float(I2),
+            F3a = float(I3),
              Colour = colour(F1a/255.0, F2a/255.0, F3a/255.0)
          ;
              string__to_float(W1, F1), 0.0 =< F1, F1 =< 1.0,
@@ -325,7 +325,7 @@
          (
              string__to_int(W1, I1), 0 =< I1, I1 =< 255
          ->
-            int__to_float(I1, F1a),
+            F1a = float(I1),
              F1b = F1a/255.0,
              Colour = colour(F1b, F1b, F1b)
          ;
Index: progs/ray/ray.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/ray/ray.m,v
retrieving revision 1.2
diff -u -r1.2 ray.m
--- progs/ray/ray.m	6 Oct 2005 09:11:22 -0000	1.2
+++ progs/ray/ray.m	6 May 2011 05:43:43 -0000
@@ -202,8 +202,11 @@
  :- pred area3(float, float,  float,  float,  float,  float,  float,  float,  float,  float).
  :- mode area3(in, in,  in,  in,  in,  in,  in,  in,  in,  out) is det.

-:- pragma c_code(area3(X1::in, X2::in, X3::in, Y1::in, Y2::in, Y3::in, Z1::in, Z2::in, Z3::in, A::out), "
-{
+:- pragma foreign_proc("C",
+    area3(X1::in, X2::in, X3::in, Y1::in, Y2::in, Y3::in, Z1::in, Z2::in,
+        Z3::in, A::out),
+    [promise_pure, will_not_call_mercury, thread_safe],
+"
  	float X4, Y4, Z4, X5, Y5, Z5;
  	float Ax, Bx, Cx, Ay, By, Cy, Az, Bz, Cz;

@@ -215,7 +218,6 @@
  	Cy = Az*Bx - Ax*Bz;
  	Cz = Ax*By - Ay*Bx;
  	A = Cx*Cx + Cy*Cy + Cz*Cz;
-}
  ").


Index: progs/ray/scene.m
===================================================================
RCS file: /home/mercury/mercury1/repository/benchmarks/progs/ray/scene.m,v
retrieving revision 1.1
diff -u -r1.1 scene.m
--- progs/ray/scene.m	12 Jul 2002 23:38:15 -0000	1.1
+++ progs/ray/scene.m	6 May 2011 05:44:02 -0000
@@ -296,7 +296,7 @@
  	;
  		Fs1 = []
  	),
-	map__set(Map0, V, [N|Fs1], Map1),
+	map__set(V, [N|Fs1], Map0, Map1),
  	insert_vertices(N, Vs, Map1, Map).

  % convert degress to radians


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