[m-rev.] diff: replace pragma c_code in compiler and deep profiler

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Jul 22 00:41:29 AEST 2004


Estimated hours taken: 0.5
Branches: main

compiler/bytecode_data.m:
compiler/gcc.m:
compiler/stack_layout.m:
deep_profiler/read_profile.m:
	Use the new foreign language interface rather than the old one.
Julien.

Index: compiler/bytecode_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_data.m,v
retrieving revision 1.14
diff -u -r1.14 bytecode_data.m
--- compiler/bytecode_data.m	14 Jun 2004 04:15:57 -0000	1.14
+++ compiler/bytecode_data.m	21 Jul 2004 07:34:11 -0000
@@ -233,10 +233,10 @@
 	int::out, int::out, int::out, int::out,
 	int::out, int::out, int::out, int::out) is det.

-:- pragma c_code(
+:- pragma foreign_proc("C",
 	float_to_float64_bytes(FloatVal::in, B0::out, B1::out, B2::out,
 		B3::out, B4::out, B5::out, B6::out, B7::out),
-	[will_not_call_mercury],
+	[promise_pure, will_not_call_mercury],
 "
 	{
 		MR_Float64	float64;
Index: compiler/gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/gcc.m,v
retrieving revision 1.30
diff -u -r1.30 gcc.m
--- compiler/gcc.m	14 Jun 2004 04:16:03 -0000	1.30
+++ compiler/gcc.m	21 Jul 2004 07:36:15 -0000
@@ -676,7 +676,7 @@

 :- import_module int, string.

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "

 #ifndef MC_GUARD_GCC_HEADERS
 #define MC_GUARD_GCC_HEADERS
@@ -772,7 +772,7 @@
 	[may_call_mercury, tabled_for_io],
 	"MC_call_gcc_backend").

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "
 /* We use an `MC_' prefix for C code in the mercury/compiler directory. */

 extern MR_Word MC_frontend_callback;
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.92
diff -u -r1.92 stack_layout.m
--- compiler/stack_layout.m	30 Jun 2004 02:48:14 -0000	1.92
+++ compiler/stack_layout.m	21 Jul 2004 07:35:18 -0000
@@ -171,7 +171,7 @@
 :- pred stack_layout__concat_string_list_2(list(string)::in, int::in,
 	string::out) is det.

-:- pragma c_header_code("
+:- pragma foreign_decl("C", "
 	#include ""mercury_tags.h""	/* for MR_list_*() */
 	#include ""mercury_heap.h""	/* for MR_offset_incr_hp_atomic*() */
 	#include ""mercury_misc.h""	/* for MR_fatal_error() */
Index: deep_profiler/read_profile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.6
diff -u -r1.6 read_profile.m
--- deep_profiler/read_profile.m	19 May 2004 03:59:41 -0000	1.6
+++ deep_profiler/read_profile.m	21 Jul 2004 12:43:37 -0000
@@ -1082,69 +1082,103 @@

 %------------------------------------------------------------------------------%

-:- pragma c_header_code("
-#include ""mercury_deep_profiling.h""
-").
+:- pragma foreign_decl("C", "#include ""mercury_deep_profiling.h""").

 :- func token_call_site_static = int.
-:- pragma c_code(token_call_site_static = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_call_site_static;").
+:- pragma foreign_proc("C",
+	token_call_site_static = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_call_site_static;
+").

 :- func token_call_site_dynamic = int.
-:- pragma c_code(token_call_site_dynamic = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_call_site_dynamic;").
+:- pragma foreign_proc("C",
+	token_call_site_dynamic = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_call_site_dynamic;
+").

 :- func token_proc_static = int.
-:- pragma c_code(token_proc_static = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_proc_static;").
+:- pragma foreign_proc("C",
+	token_proc_static = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_proc_static;
+").

 :- func token_proc_dynamic = int.
-:- pragma c_code(token_proc_dynamic = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_proc_dynamic;").
+:- pragma foreign_proc("C",
+	token_proc_dynamic = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_proc_dynamic;
+").

 :- func token_normal_call = int.
-:- pragma c_code(token_normal_call = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_normal_call;").
+:- pragma foreign_proc("C",
+	token_normal_call = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_normal_call;
+").

 :- func token_special_call = int.
-:- pragma c_code(token_special_call = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_special_call;").
+:- pragma foreign_proc("C",
+	token_special_call = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_special_call;
+").

 :- func token_higher_order_call = int.
-:- pragma c_code(token_higher_order_call = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_higher_order_call;").
+:- pragma foreign_proc("C",
+	token_higher_order_call = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_higher_order_call;
+").

 :- func token_method_call = int.
-:- pragma c_code(token_method_call = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_method_call;").
+:- pragma foreign_proc("C",
+	token_method_call = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_method_call;
+").

 :- func token_callback = int.
-:- pragma c_code(token_callback = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_callback;").
+:- pragma foreign_proc("C",
+	token_callback = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_callback;
+").

 :- func token_isa_predicate = int.
-:- pragma c_code(token_isa_predicate = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_isa_predicate;").
+:- pragma foreign_proc("C",
+	token_isa_predicate = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_isa_predicate;
+").

 :- func token_isa_function = int.
-:- pragma c_code(token_isa_function = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_isa_function;").
+:- pragma foreign_proc("C",
+	token_isa_function = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_isa_function;
+").

 :- func token_isa_uci_pred = int.
-:- pragma c_code(token_isa_uci_pred = (X::out),
-	[will_not_call_mercury, thread_safe],
-	"X = MR_deep_token_isa_uci_pred;").
+:- pragma foreign_proc("C",
+	token_isa_uci_pred = (X::out),
+	[promise_pure, will_not_call_mercury, thread_safe],
+"
+	X = MR_deep_token_isa_uci_pred;
+").

 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%

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