mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
RTTI improvements for Java backend. io.write/3 works for some simple types
Branches: main
RTTI improvements for Java backend. io.write/3 works for some simple types
(builtin types and non-existential d.u. types).
compiler/mlds_to_java.m:
Fix problem with cyclic RTTI definitions. Initialisers could refer to
other RTTI structures which weren't yet allocated, leading to fields
being null. The fix is to allocate all top-level RTTI objects first
and initialise in a second phase.
java/runtime/DuExistInfo.java:
java/runtime/DuExistLocn.java:
java/runtime/DuFunctorDesc.java:
java/runtime/EnumFunctorDesc.java:
java/runtime/ForeignEnumFunctorDesc.java:
java/runtime/TypeClassConstraint.java:
java/runtime/TypeClassDeclStruct.java:
java/runtime/TypeClassId.java:
java/runtime/TypeCtorInfo_Struct.java:
java/runtime/TypeInfo_Struct.java:
Separate constructors into constructors for the initial allocation,
and an `init' method to fill in the fields.
java/runtime/MethodPtr.java:
Use variadic method support to simplify semidet_call_* and
result_call_* in rtti_implementation.m.
library/builtin.m:
Make Java definitions of builtin.unify/2 and builtin.compare/3 call
rtti_implementation.generic_unify and generic_compare.
library/private_builtin.m:
Add missing MR_TYPECTOR_REP_FOREIGN_ENUM{,_USEREQ} constants
for C# and Java.
library/rtti_implementation.m:
Fix and add missing Java versions of many foreign_procs.
Add more attributes to foreign_procs.
Clean up the code a bit (fewer casts and ^ field access functions).
README.Java:
Bump Java version requirement to J2SE 1.5 or higher.
This commit is contained in:
@@ -13,20 +13,11 @@ public class TypeClassConstraint {
|
||||
public TypeClassDeclStruct tc_constr_type_class;
|
||||
public PseudoTypeInfo tc_constr_arg_ptis[];
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class)
|
||||
public TypeClassConstraint()
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[] {};
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
PseudoTypeInfo[] ptis)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = ptis;
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
public void init(TypeClassDeclStruct type_class,
|
||||
// XXX Object[] should be mercury.runtime.PseudoTypeInfo[],
|
||||
// but mlds_to_java.m generates Object[] since
|
||||
// init_array/1 doesn't give type info
|
||||
@@ -38,47 +29,4 @@ public class TypeClassConstraint {
|
||||
tc_constr_arg_ptis[i] = (PseudoTypeInfo) ptis[i];
|
||||
}
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
PseudoTypeInfo pti1)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[] { pti1 };
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
PseudoTypeInfo pti1, PseudoTypeInfo pti2)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[] { pti1, pti2 };
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
PseudoTypeInfo pti1, PseudoTypeInfo pti2,
|
||||
PseudoTypeInfo pti3)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[] { pti1, pti2, pti3 };
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
PseudoTypeInfo pti1, PseudoTypeInfo pti2,
|
||||
PseudoTypeInfo pti3, PseudoTypeInfo pti4)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[]
|
||||
{ pti1, pti2, pti3, pti4 };
|
||||
}
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class,
|
||||
PseudoTypeInfo pti1, PseudoTypeInfo pti2,
|
||||
PseudoTypeInfo pti3, PseudoTypeInfo pti4,
|
||||
PseudoTypeInfo pti5)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[] {
|
||||
pti1, pti2, pti3, pti4, pti5 };
|
||||
}
|
||||
|
||||
// XXX type classes with arity > 5 not supported
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user