[m-rev.] diff: restore deconstruct for C#, Java

Peter Wang novalazy at gmail.com
Mon Jun 27 18:08:50 AEST 2011


Branches: main

The direct argument functor change added the constant MR_SECTAG_NONE_DIRECT_ARG
in some places but not others, breaking deconstruct on C# and Java back-ends.

compiler/mlds_to_gcc.m:
java/runtime/Sectag_Locn.java:
library/rtti_implementation.m:
runtime/mercury_dotnet.cs.in:
	Add missing constants.

diff --git a/compiler/mlds_to_gcc.m b/compiler/mlds_to_gcc.m
index 0644080..0bf2a30 100644
--- a/compiler/mlds_to_gcc.m
+++ b/compiler/mlds_to_gcc.m
@@ -2446,9 +2446,10 @@ rtti_enum_const("MR_TYPECTOR_REP_DUMMY", 42).
 rtti_enum_const("MR_TYPECTOR_REP_BITMAP", 43).
 rtti_enum_const("MR_TYPECTOR_REP_UNKNOWN", 44).
 rtti_enum_const("MR_SECTAG_NONE", 0).
-rtti_enum_const("MR_SECTAG_LOCAL", 1).
-rtti_enum_const("MR_SECTAG_REMOTE", 2).
-rtti_enum_const("MR_SECTAG_VARIABLE", 3).
+rtti_enum_const("MR_SECTAG_NONE_DIRECT_ARG", 1).
+rtti_enum_const("MR_SECTAG_LOCAL", 2).
+rtti_enum_const("MR_SECTAG_REMOTE", 3).
+rtti_enum_const("MR_SECTAG_VARIABLE", 4).
 rtti_enum_const("MR_PREDICATE", 0).
 rtti_enum_const("MR_FUNCTION", 1).
 
diff --git a/java/runtime/Sectag_Locn.java b/java/runtime/Sectag_Locn.java
index ff1d38e..d166c14 100644
--- a/java/runtime/Sectag_Locn.java
+++ b/java/runtime/Sectag_Locn.java
@@ -9,8 +9,9 @@ package jmercury.runtime;
 public class Sectag_Locn implements java.io.Serializable {
 	
 	public static final int MR_SECTAG_NONE = 0;
-	public static final int MR_SECTAG_LOCAL = 1;
-	public static final int MR_SECTAG_REMOTE = 2;
+	public static final int MR_SECTAG_NONE_DIRECT_ARG = 1;
+	public static final int MR_SECTAG_LOCAL = 2;
+	public static final int MR_SECTAG_REMOTE = 3;
 
 	public int value;
 
diff --git a/library/rtti_implementation.m b/library/rtti_implementation.m
index 96b4916..07783c1 100644
--- a/library/rtti_implementation.m
+++ b/library/rtti_implementation.m
@@ -2537,6 +2537,9 @@ deconstruct_2(Term, TypeInfo, TypeCtorInfo, TypeCtorRep, NonCanon,
                 SecTagLocn = stag_none,
                 FunctorDesc = PTagEntry ^ du_sectag_alternatives(0)
             ;
+                SecTagLocn = stag_none_direct_arg,
+                FunctorDesc = PTagEntry ^ du_sectag_alternatives(0)
+            ;
                 SecTagLocn = stag_remote,
                 SecTag = get_remote_secondary_tag(Term),
                 FunctorDesc = PTagEntry ^ du_sectag_alternatives(SecTag)
@@ -2877,6 +2880,9 @@ univ_named_arg_2(Term, TypeInfo, TypeCtorInfo, TypeCtorRep, NonCanon, Name,
                 SecTagLocn = stag_none,
                 SecTag = 0
             ;
+                SecTagLocn = stag_none_direct_arg,
+                SecTag = 0
+            ;
                 SecTagLocn = stag_remote,
                 SecTag = get_remote_secondary_tag(Term)
             ),
@@ -3056,7 +3062,12 @@ get_arg(Term, SecTagLocn, FunctorDesc, TypeInfo, Index, Arg) :-
     PseudoTypeInfo = get_pti_from_arg_types(ArgTypes, Index),
     get_arg_type_info(TypeInfo, PseudoTypeInfo, Term, FunctorDesc,
         ArgTypeInfo),
-    ( ( SecTagLocn = stag_none ; high_level_data ) ->
+    (
+        ( SecTagLocn = stag_none
+        ; SecTagLocn = stag_none_direct_arg
+        ; high_level_data
+        )
+    ->
         TagOffset = 0
     ;
         TagOffset = 1
@@ -3696,6 +3707,7 @@ get_remote_secondary_tag(_::in) = (0::out) :-
 
 :- type sectag_locn
     --->    stag_none
+    ;       stag_none_direct_arg
     ;       stag_local
     ;       stag_remote
     ;       stag_variable.
diff --git a/runtime/mercury_dotnet.cs.in b/runtime/mercury_dotnet.cs.in
index fdf9db7..25dba29 100644
--- a/runtime/mercury_dotnet.cs.in
+++ b/runtime/mercury_dotnet.cs.in
@@ -700,9 +700,10 @@ public class DuFunctorDesc {
 }
 
 public enum Sectag_Locn {
-    MR_SECTAG_NONE      = 0,
-    MR_SECTAG_LOCAL     = 1,
-    MR_SECTAG_REMOTE    = 2
+    MR_SECTAG_NONE              = 0,
+    MR_SECTAG_NONE_DIRECT_ARG   = 1,
+    MR_SECTAG_LOCAL             = 2,
+    MR_SECTAG_REMOTE            = 3
 }
 
 public class DuPtagLayout {

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