[m-rev.] diff: fix failure of valid/foreign_type_spec
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue Jun 12 13:22:07 AEST 2007
Estimated hours taken: 1
Branches: main
Fix the failure of tests/valid/foreign_type_spec.
compiler/mlds_to_il.m:
Avoid triggering an assertion failure. The constructor functions
emitted for DU types have their names set to a placeholder name by the
ml code generator. The recent change to name mangling for the IL
backend does not take this into account. (XXX - the underlying problem
here is that at ml_type_gen.m:795 we set the name of the constructor
function to be `entity_export("<constructor>")'. Rather than using
entity_export, which is intended for pragma foregin_exported
procedures, we should have a separate mlds_entity_name for
constructor functions.)
Julien.
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.181
diff -u -r1.181 mlds_to_il.m
--- compiler/mlds_to_il.m 6 Jun 2007 01:17:34 -0000 1.181
+++ compiler/mlds_to_il.m 12 Jun 2007 02:27:38 -0000
@@ -1051,13 +1051,6 @@
ClassMember, !Info) :-
Entity = mlds_function(_MaybePredProcId, Params, MaybeStatement,
Attributes, EnvVarNames),
- ( Name = entity_function(PredLabel0, ProcId0, MaybeSeqNum0, _PredId) ->
- PredLabel = PredLabel0,
- ProcId = ProcId0,
- MaybeSeqNum = MaybeSeqNum0
- ;
- unexpected(this_file, "IL procedure is not a function")
- ),
expect(set.empty(EnvVarNames), this_file,
"generate_method: EnvVarNames"),
@@ -1087,11 +1080,23 @@
class_member_name(ParentClass, ctor), []))]
;
IsCons = no,
- predlabel_to_il_id(PredLabel, ProcId, MaybeSeqNum, MemberName0),
- predlabel_to_managed_id(PredLabel, ProcId, MaybeSeqNum,
- ManagedMemberName0),
- MemberName = id(MemberName0),
- ManagedMemberName = id(ManagedMemberName0),
+ (
+ Name = entity_function(PredLabel, ProcId, MaybeSeqNum, _PredId),
+ predlabel_to_il_id(PredLabel, ProcId, MaybeSeqNum, MemberName0),
+ predlabel_to_managed_id(PredLabel, ProcId, MaybeSeqNum,
+ ManagedMemberName0),
+ MemberName = id(MemberName0),
+ ManagedMemberName = id(ManagedMemberName0)
+ ;
+ Name = entity_export(ExportName),
+ MemberName = id(ExportName),
+ ManagedMemberName = id(ExportName)
+ ;
+ ( Name = entity_type(_, _)
+ ; Name = entity_data(_)
+ ),
+ unexpected(this_file, "IL procedure is not a function")
+ ),
CtorInstrs = []
),
@@ -1160,9 +1165,9 @@
% in an exception handler and call the initialization instructions
% in the cctor of this module.
(
- PredLabel = mlds_user_pred_label(pf_predicate, no, "main", 2,
- model_det, no),
- MaybeSeqNum = no
+ Name = entity_function(MainPredLabel, _ProcId, no, _),
+ MainPredLabel = mlds_user_pred_label(pf_predicate, no, "main", 2,
+ model_det, no)
->
EntryPoint = [entrypoint],
!:Info = !.Info ^ has_main := yes,
--------------------------------------------------------------------------
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