[m-rev.] diff: (partially) fix library compiliation in grade java

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Apr 28 15:59:45 AEST 2005


On Thu, 28 Apr 2005, Julien Fischer wrote:

>
> Estimated hours taken: 1
> Branches: main, release
>
> Fix compilation of the standard library in grade java.
> Compiling the library from Mercury -> Java now works again.
> Compiling the resulting Java code -> bytecode is still broken
> because of problems in the Java version of the runtime.
>
> Presumably some of the problems below also affect the IL
> backend.
>
> compiler/post_term_analysis.m:
> 	Don't look up hlds_type_defns for builtin types that may
> 	not have them (the termination properties for the special
> 	preds for these types are known anyway).
>
> library/term_size_prof_builtin.m:
> 	Fix errors in the default Mercury clauses for some
> 	procedures in this module; there were some module imports
> 	and purity annotations missing.
>
Hmmm...that wasn't the correct diff, this is.  I've modified the log
message to mention an number of fixes I made to the post_term_analysis
module.

Index: compiler/post_term_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/post_term_analysis.m,v
retrieving revision 1.2
diff -u -r1.2 post_term_analysis.m
--- compiler/post_term_analysis.m	22 Mar 2005 06:40:18 -0000	1.2
+++ compiler/post_term_analysis.m	28 Apr 2005 05:49:47 -0000
@@ -35,6 +35,8 @@
 :- import_module backend_libs.
 :- import_module backend_libs.foreign.

+:- import_module check_hlds.type_util.
+
 :- import_module hlds.goal_form.
 :- import_module hlds.goal_util.
 :- import_module hlds.hlds_data.
@@ -94,7 +96,7 @@
 		Termination = yes, WarnSpecialPreds = yes,
 		%
 		% Don't run this pass if we are only building the
-		% optimization inferface and we are compiling
+		% optimization interface and we are compiling
 		% with `--transitive-intermodule-optimization'
 		% enabled because we'll get more accurate results
 		% when we build the .trans_opt files.  Any warnings
@@ -117,10 +119,15 @@
 warn_non_term_user_special_pred(ModuleInfo, TypeTable,
 		SpecialPredId - TypeCtor, PredId, !IO) :-
 	%
-	% index predicate cannot be defined by the user and should
-	% always terminate in any case.
+	% index predicates cannot be defined by the user and should
+	% always terminate in any case.  Do not perform this
+	% check for builtin types that don't have hlds_type_defns.
 	%
-	( SpecialPredId \= index ->
+	BuiltinTypeCtors = builtin_type_ctors_with_no_hlds_type_defn,
+	(
+		SpecialPredId \= index,
+		not list.member(TypeCtor, BuiltinTypeCtors)
+	->
 		map.lookup(TypeTable, TypeCtor, TypeDefn),
 		get_type_defn_status(TypeDefn, ImportStatus),
 		(
@@ -211,14 +218,14 @@
 :- pred get_user_unify_compare(module_info::in, hlds_type_body::in,
 	unify_compare::out) is semidet.

-get_user_unify_compare(_ModuleInfo, du_type(_, _, _, yes(UnifyCompare), _, _),
-		UnifyCompare).
-get_user_unify_compare(ModuleInfo, foreign_type(ForeignTypeBody),
-		UnifyCompare) :-
+get_user_unify_compare(_ModuleInfo, TypeBody, UnifyCompare) :-
+	TypeBody = du_type(_, _, _, yes(UnifyCompare), _, _).
+get_user_unify_compare(ModuleInfo, TypeBody, UnifyCompare) :-
+	TypeBody = foreign_type(ForeignTypeBody),
 	UnifyCompare = foreign_type_body_has_user_defined_eq_comp_pred(
 		ModuleInfo, ForeignTypeBody).
-get_user_unify_compare(_ModuleInfo, solver_type(_, yes(UnifyCompare)),
-		UnifyCompare).
+get_user_unify_compare(_ModuleInfo, TypeBody, UnifyCompare) :-
+	TypeBody = solver_type(_, yes(UnifyCompare)).

 :- pred emit_non_term_user_special_warning(prog_context::in,
 	special_pred_id::in, type_ctor::in, io::di, io::uo) is det.
Index: library/term_size_prof_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/term_size_prof_builtin.m,v
retrieving revision 1.3
diff -u -r1.3 term_size_prof_builtin.m
--- library/term_size_prof_builtin.m	15 Feb 2005 05:22:29 -0000	1.3
+++ library/term_size_prof_builtin.m	28 Apr 2005 05:24:43 -0000
@@ -64,10 +64,13 @@
 :- impure pred complexity_redo_proc(complexity_slot::in) is failure.

 %---------------------------------------------------------------------------%
+%---------------------------------------------------------------------------%

 :- implementation.

 :- import_module int.
+:- import_module require.
+:- import_module std_util.

 :- pragma foreign_decl("C", "
 #ifndef MR_TERM_SIZE_PROFILING_GUARD
@@ -152,7 +155,7 @@
 }").

 increment_size(_Value, _Incr) :-
-	private_builtin__imp.
+	impure private_builtin__imp.

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

@@ -200,7 +203,7 @@
 ").

 complexity_is_active(IsActive) :-
-	private_builtin__imp,
+	impure private_builtin__imp,
 	( semidet_succeed ->
 		error("complexity_mark_active: not implemented")
 	;
@@ -209,19 +212,19 @@
 	).

 complexity_call_proc(Slot) :-
-	private_builtin__imp,
+	impure private_builtin__imp,
 	% Required only to avoid warnings; never executed.
 	private_builtin__unsafe_type_cast(0, Slot).

 complexity_exit_proc(_Slot) :-
-	private_builtin__imp.
+	impure private_builtin__imp.

 complexity_fail_proc(_Slot) :-
-	private_builtin__imp,
+	impure private_builtin__imp,
 	fail.

 complexity_redo_proc(_Slot) :-
-	private_builtin__imp,
+	impure private_builtin__imp,
 	fail.

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