mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
Some fixes to the Java back-end, to make it work again after
Estimated hours taken: 3 Branches: main Some fixes to the Java back-end, to make it work again after Zoltan's recent type class RTTI changes. java/runtime/DuExistInfo.java: Add a new field "exist_constraints" to the DuExistInfo type and a corresponding argument to the constructor, to match Zoltan's recent changes. java/runtime/TypeClassId.java: java/runtime/TypeClassMethod.java: java/runtime/TypeClassDeclStruct.java: java/runtime/TypeClassConstraint.java: New files. These correspond to the C types MR_TypeClassId, MR_TypeClassMethod, MR_TypeClassDeclStruct, and MR_TypeClassConstraint in the C runtime. java/runtime/TypeCtorInfo_Struct.java: Add a comment. compiler/rtti_to_mlds.m: Don't cast null pointers to mlds__generic_type; they should have the right type already. Casting to mlds__generic_type here causes type errors for the Java back-end, because in Java there are no implicit conversions from Object (unlike C, which allows implicit conversions from `void *'). compiler/rtti.m: Change tc_rtti_name_java_type so that it maps the new typeclass-related RTTI types to the appropriate Java types. library/private_builtin.m: Define MR_PREDICATE and MR_FUNCTION. java/runtime/PredFunc.java: Fix a bug in my previous change: s/MR_PRED/MR_PREDICATE/ s/MR_FUNC/MR_FUNCTION/
This commit is contained in:
64
java/runtime/TypeClassConstraint.java
Normal file
64
java/runtime/TypeClassConstraint.java
Normal file
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// Copyright (C) 2004 The University of Melbourne.
|
||||
// This file may only be copied under the terms of the GNU Library General
|
||||
// Public License - see the file COPYING.LIB in the Mercury distribution.
|
||||
//
|
||||
|
||||
package mercury.runtime;
|
||||
|
||||
// This corresponds to the C type MR_TypeClassConstraint
|
||||
// in runtime/mercury_type_info.h.
|
||||
|
||||
public class TypeClassConstraint {
|
||||
public TypeClassDeclStruct tc_constr_type_class;
|
||||
public PseudoTypeInfo tc_constr_arg_ptis[];
|
||||
|
||||
public TypeClassConstraint(TypeClassDeclStruct type_class)
|
||||
{
|
||||
tc_constr_type_class = type_class;
|
||||
tc_constr_arg_ptis = new PseudoTypeInfo[] {};
|
||||
}
|
||||
|
||||
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