[m-rev.] diff: make semidet_call_*, result_call_* no-typeinfo builtins

Peter Wang novalazy at gmail.com
Tue Apr 27 13:40:21 AEST 2010


Branches: main, 10.04

Mark rtti_implementation.semidet_call_* and result_call_* as builtin predicates
which don't require typeinfo arguments to be passed.  This specifically
improves the implementation of generic_unify and generic_compare on the Java
backend.

mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
        As above.

library/rtti_implementation.m:
        Add a comment.

diff --git a/library/rtti_implementation.m b/library/rtti_implementation.m
index d5e16b0..625966c 100644
--- a/library/rtti_implementation.m
+++ b/library/rtti_implementation.m
@@ -802,6 +802,9 @@ compare_tuple_pos(Loc, TupleArity, TypeInfo,
Result, TermA, TermB) :-
     %
     % We first give "unimplemented" definitions in Mercury, which will be
     % used by default.
+    %
+    % NOTE: semidet_call_* and result_call_* are declared as no-typeinfo
+    % builtins.

 :- type unify_or_compare_pred
     --->    unify_or_compare_pred.
diff --git a/mdbcomp/prim_data.m b/mdbcomp/prim_data.m
index f270692..40689c9 100644
--- a/mdbcomp/prim_data.m
+++ b/mdbcomp/prim_data.m
@@ -340,6 +340,11 @@
     %
 :- func mercury_par_builtin_module = sym_name.

+    % Returns the name of the module containing the RTTI implementation for
+    % certain backends.
+    %
+:- func mercury_rtti_implementation_builtin_module = sym_name.
+
     % Returns the name of the module containing the builtins for the
     % source-to-source debugger.
     %
@@ -554,6 +559,7 @@ all_builtin_modules = [
     mercury_profiling_builtin_module,
     mercury_term_size_prof_builtin_module,
     mercury_par_builtin_module,
+    mercury_rtti_implementation_builtin_module,
     mercury_ssdb_builtin_module
 ].

@@ -574,6 +580,7 @@ mercury_table_statistics_module =
unqualified("table_statistics").
 mercury_profiling_builtin_module = unqualified("profiling_builtin").
 mercury_term_size_prof_builtin_module = unqualified("term_size_prof_builtin").
 mercury_par_builtin_module = unqualified("par_builtin").
+mercury_rtti_implementation_builtin_module =
unqualified("rtti_implementation").
 mercury_ssdb_builtin_module = unqualified("ssdb").
 mercury_list_module = unqualified("list").
 mercury_string_module = unqualified("string").
diff --git a/mdbcomp/program_representation.m b/mdbcomp/program_representation.m
index 5e98f6f..0f09468 100644
--- a/mdbcomp/program_representation.m
+++ b/mdbcomp/program_representation.m
@@ -1699,6 +1699,9 @@ no_type_info_builtin(ModuleName, PredName, Arity) :-
     ;
         ModuleNameType = par_builtin,
         ModuleName = mercury_par_builtin_module
+    ;
+        ModuleNameType = rtti_implementation_builtin,
+        ModuleName = mercury_rtti_implementation_builtin_module
     ).

 :- type builtin_mod
@@ -1706,7 +1709,8 @@ no_type_info_builtin(ModuleName, PredName, Arity) :-
     ;       private_builtin
     ;       table_builtin
     ;       term_size_prof_builtin
-    ;       par_builtin.
+    ;       par_builtin
+    ;       rtti_implementation_builtin.

 :- pred no_type_info_builtin_2(builtin_mod::out, string::in, int::in)
     is semidet.
@@ -1734,6 +1738,18 @@ no_type_info_builtin_2(par_builtin, "new_future", 1).
 no_type_info_builtin_2(par_builtin, "wait_future", 2).
 no_type_info_builtin_2(par_builtin, "get_future", 2).
 no_type_info_builtin_2(par_builtin, "signal_future", 2).
+no_type_info_builtin_2(rtti_implementation_builtin, "semidet_call_3", 3).
+no_type_info_builtin_2(rtti_implementation_builtin, "semidet_call_4", 4).
+no_type_info_builtin_2(rtti_implementation_builtin, "semidet_call_5", 5).
+no_type_info_builtin_2(rtti_implementation_builtin, "semidet_call_6", 6).
+no_type_info_builtin_2(rtti_implementation_builtin, "semidet_call_7", 7).
+no_type_info_builtin_2(rtti_implementation_builtin, "semidet_call_8", 8).
+no_type_info_builtin_2(rtti_implementation_builtin, "result_call_4", 4).
+no_type_info_builtin_2(rtti_implementation_builtin, "result_call_5", 5).
+no_type_info_builtin_2(rtti_implementation_builtin, "result_call_6", 6).
+no_type_info_builtin_2(rtti_implementation_builtin, "result_call_7", 7).
+no_type_info_builtin_2(rtti_implementation_builtin, "result_call_8", 8).
+no_type_info_builtin_2(rtti_implementation_builtin, "result_call_9", 9).

     % True iff the given predicate is defined with an :- external
     % declaration.  Note that the arity includes the hidden type info
--------------------------------------------------------------------------
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