mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 07:15:19 +00:00
Bug fixes and code simplifications in the RTTI handling
Estimated hours taken: 4 Branches: main Bug fixes and code simplifications in the RTTI handling for the Java back-end. compiler/rtti.m: For Java, map all the different C representations for TypeInfos to a single Java type "java.runtime.TypeInfo_Struct". Likewise map all the different C representations for type class constraints to a single Java type "java.runtime.TypeInfo_Struct". java/runtime/FA_PseudoTypeInfo_Struct1.java: java/runtime/FA_PseudoTypeInfo_Struct2.java: java/runtime/FA_TypeInfo_Struct1.java: java/runtime/FA_TypeInfo_Struct2.java: java/runtime/VA_PseudoTypeInfo_Struct0.java: java/runtime/VA_PseudoTypeInfo_Struct1.java: java/runtime/VA_PseudoTypeInfo_Struct2.java: java/runtime/VA_PseudoTypeInfo_Struct3.java: java/runtime/VA_PseudoTypeInfo_Struct4.java: java/runtime/VA_PseudoTypeInfo_Struct8.java: java/runtime/TypeclassInfo.java: Deleted these stub files, since they should no longer be needed. java/runtime/TypeInfo_Struct.java: Add two new constructors, corresponding to the constructors for the deleted FA_* and VA_*.java files. java/runtime/PseudoTypeInfo.java: Add some comments. Make the nullary constructor protected, to ensure that it is only used by derived classes, since it is only intended to be used for TypeInfo_Struct.
This commit is contained in:
@@ -1,16 +1,28 @@
|
||||
//
|
||||
// Copyright (C) 2001-2003 The University of Melbourne.
|
||||
// Copyright (C) 2001-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;
|
||||
|
||||
// A PseudoTypeInfo represents a possibly non-ground type.
|
||||
// There are three possible cases:
|
||||
//
|
||||
// - Unbound type variables are represented by directly constructing
|
||||
// a PseudoTypeInfo with the variable number.
|
||||
//
|
||||
// - Ground types with arity zero may be represented as TypeCtorInfo_Struct,
|
||||
// which extends PseudoTypeInfo, and uses the protected constructor
|
||||
// which sets variable_number to -1. This is a slightly optimized
|
||||
// version of the case below.
|
||||
//
|
||||
// - Any other types are represented as TypeInfo_Struct,
|
||||
// which extends PseudoTypeInfo, and uses the protected constructor
|
||||
// which sets variable_number to -1.
|
||||
//
|
||||
public class PseudoTypeInfo {
|
||||
// This class is intentionally empty.
|
||||
// XXX PsuedoTypeInfo's have not been implemented yet.
|
||||
// They should all extend this class.
|
||||
public int variable_number;
|
||||
public PseudoTypeInfo() { variable_number = -1; }
|
||||
public PseudoTypeInfo(int n) { variable_number = n; }
|
||||
public PseudoTypeInfo(int n) { variable_number = n; }
|
||||
protected PseudoTypeInfo() { variable_number = -1; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user