[m-rev.] for review: external pseudo-imported special preds bug fix

Peter Ross pro at missioncriticalit.com
Thu Dec 4 03:07:01 AEDT 2003


On Wed, Dec 03, 2003 at 10:43:13PM +1100, Fergus Henderson wrote:
> On 03-Dec-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> > Fix a bug where the compiler was treating pseudo_imported external
> > definitions incorrectly.
> ...
> > Index: il_compiler/compiler/ml_code_gen.m
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
> > retrieving revision 1.132
> > diff -u -r1.132 ml_code_gen.m
> > --- il_compiler/compiler/ml_code_gen.m	24 Oct 2003 06:17:42 -0000	1.132
> > +++ il_compiler/compiler/ml_code_gen.m	3 Dec 2003 11:49:10 -0000
> > @@ -980,6 +980,8 @@
> >  		(
> >  			{ ImportStatus = imported(_)
> >  			; pred_info_is_aditi_relation(PredInfo)
> > +			; is_unify_or_compare_pred(PredInfo),
> > +				ImportStatus = external(pseudo_imported)
> >  			}
> >  		->
> 
> This if-then-else needs some comments.
> 
> Otherwise this change looks fine.
> 
> > +++ tests/hard_coded/external_unification_pred.m	3 Dec 2003 11:49:25 -0000
> > +    :- pragma foreign_type(c, ft, "int") where equality is unify_ft.
> > +    :- pragma foreign_type(il, ft, "valuetype [mscorlib]System.Int32")
> > +		    where equality is unify_ft.
> 
> BTW, you know that you can declare this as just
> 
>     :- pragma foreign_type(il, ft, "int32") where equality is unify_ft.
> 
> ?
> 
> P.S. Would be nice to add Java definitions for the foreign code in
> this test case, and/or add Mercury definitions so that it works for new
> back-ends without any additional effort.  But this is not essential.
> 

diff -u il_compiler/compiler/hlds_out.m il_compiler/compiler/hlds_out.m
--- il_compiler/compiler/hlds_out.m
+++ il_compiler/compiler/hlds_out.m
@@ -2737,7 +2737,7 @@
 hlds_out__write_import_status(imported(ancestor)) -->
 	io__write_string("imported by an ancestor").
 hlds_out__write_import_status(external(Status)) -->
-	io__write_string("external (and"),
+	io__write_string("external (and "),
 	hlds_out__write_import_status(Status),
 	io__write_string(")").
 hlds_out__write_import_status(abstract_imported) -->
diff -u il_compiler/compiler/hlds_pred.m il_compiler/compiler/hlds_pred.m
--- il_compiler/compiler/hlds_pred.m
+++ il_compiler/compiler/hlds_pred.m
@@ -1197,8 +1197,8 @@
 		hlds_pred__in_in_unification_proc_id(ProcId)
 	;
 		pred_info_import_status(PredInfo, ImportStatus),
-		ImportStatus = external(ImportStatus),
-		status_is_exported(ImportStatus, yes)
+		ImportStatus = external(ExternalImportStatus),
+		status_is_exported(ExternalImportStatus, yes)
 	).
 
 pred_info_mark_as_external(PredInfo0, PredInfo) :-
diff -u il_compiler/compiler/ml_code_gen.m il_compiler/compiler/ml_code_gen.m
--- il_compiler/compiler/ml_code_gen.m
+++ il_compiler/compiler/ml_code_gen.m
@@ -980,6 +980,11 @@
 		(
 			{ ImportStatus = imported(_)
 			; pred_info_is_aditi_relation(PredInfo)
+
+				% We generate incorrect and unecessary
+				% code for the external special preds
+				% which are pseudo_imported so just
+				% ignore them.
 			; is_unify_or_compare_pred(PredInfo),
 				ImportStatus = external(pseudo_imported)
 			}
--------------------------------------------------------------------------
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