[m-rev.] diff: fix problem with order of static constants in java backend
Peter Wang
novalazy at gmail.com
Wed Apr 22 15:28:11 AEST 2009
Bootchecked in hlc.gc.
Branches: main
compiler/ml_elim_nested.m:
Fix a problem with generated Java code where, after hoisting static
constants to the top level, closure_layout vectors refer to typevar
vectors which are defined afterwards because the order of the locals
have been reversed.
diff --git a/compiler/ml_elim_nested.m b/compiler/ml_elim_nested.m
index 8d97ec1..74846dd 100644
--- a/compiler/ml_elim_nested.m
+++ b/compiler/ml_elim_nested.m
@@ -1949,7 +1949,11 @@ fixup_lval(Lval0, Lval, !Info) :-
:- pred fixup_gc_statements(elim_info::in, elim_info::out) is det.
fixup_gc_statements(!Info) :-
- Locals = elim_info_get_local_data(!.Info),
+ RevLocals = elim_info_get_local_data(!.Info),
+ % We must preserve the order for the Java backend, otherwise the generated
+ % code may contain closure_layout vectors that reference typevar vectors
+ % which are defined later.
+ Locals = list.reverse(RevLocals),
fixup_gc_statements_defns(Locals, !Info).
:- pred fixup_gc_statements_defns(list(mlds_defn)::in,
--------------------------------------------------------------------------
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