Commit Graph

4 Commits

Author SHA1 Message Date
Peter Wang
b573e83761 Mark Java RTTI classes as implementing java.io.Serializable to
Branches: main

Mark Java RTTI classes as implementing java.io.Serializable to
enable serialization of existentially typed values.

java/runtime/DuExistInfo.java:
java/runtime/DuExistLocn.java:
java/runtime/DuFunctorDesc.java:
java/runtime/DuPtagLayout.java:
java/runtime/EnumFunctorDesc.java:
java/runtime/ForeignEnumFunctorDesc.java:
java/runtime/MethodPtr.java:
java/runtime/NotagFunctorDesc.java:
java/runtime/PseudoTypeInfo.java:
java/runtime/ReservedAddrFunctorDesc.java:
java/runtime/Sectag_Locn.java:
java/runtime/TypeClassConstraint.java:
java/runtime/TypeClassDeclStruct.java:
java/runtime/TypeClassId.java:
java/runtime/TypeClassMethod.java:
java/runtime/TypeCtorInfo_Struct.java:
java/runtime/TypeCtorRep.java:
java/runtime/TypeFunctors.java:
java/runtime/TypeInfo_Struct.java:
java/runtime/TypeLayout.java:
        As above.

        TypeCtorInfo_Struct.unify() cannot rely on the uniqueness of
        TypeCtorInfo_Struct instances, as deserialisation will create new
        copies.
2009-09-07 03:10:02 +00:00
Peter Wang
1b648d0ac2 Put all Mercury-generated Java classes into the package `jmercury' and
Branches: main

Put all Mercury-generated Java classes into the package `jmercury' and
runtime classes into `jmercury.runtime'.  The Mercury module hierarchy is
not reflected in the package name.  We name sub-module classes using
their fully-qualified module names with `__' between components, e.g.
`bit_buffer.read' produces `class bit_buffer__read'.

As all generated Java code is in the same package we don't need to package
qualify identifiers, and we don't need the hack to avoid clashing package
and class names.  It also makes it easier to write Java foreign code because
generated Java class names are easier to predict from Mercury module names.

The package names are not `mercury' and `mercury.runtime' because on
case-insensitive file systems we may end up with a `mercury' directory
that could be confused with the `Mercury' directory.


compiler/java_names.m:
        Delete code related to mangling package names.

        Remove the extra `mercury' prefix added to standard library module
        names, as it is redundant with `jmercury'.

        Change runtime package name.

compiler/mlds_to_java.m:
        Make generated code follow the new packaging scheme.

        Don't automatically import all runtime classes.  It doesn't seem
        necessary.

        Update for new packaging scheme.

compiler/file_names.m:
        Fix Java file paths for the new packaging scheme.

compiler/module_cmds.m:
compiler/rtti.m:
library/array.m:
library/backjump.m:
library/benchmarking.m:
library/bitmap.m:
library/builtin.m:
library/exception.m:
library/io.m:
library/library.m:
library/mutvar.m:
library/private_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.m:
library/time.m:
library/type_desc.m:
java/runtime/*.java:
        Rename package names.

        Delete unnecessary package qualification.

compiler/mlds.m:
        Add some XXXs to be fixed later.

library/Mmakefile:
        Update for new packaging scheme.

        Let mmake --use-mmc-make work in this directory.
2009-06-17 07:48:16 +00:00
Peter Wang
d1cffc4523 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.
2009-04-30 00:43:35 +00:00
Fergus Henderson
647f7965ea 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/
2004-02-09 11:54:58 +00:00