Commit Graph

4 Commits

Author SHA1 Message Date
Peter Wang
68a5c0047a On the Java backend, use specialised MethodPtr interfaces so that when calling
Branches: main

On the Java backend, use specialised MethodPtr interfaces so that when calling
a method pointer input arguments do not have to be passed via a temporary
array, for arities up to 15.  For higher arities the temporary array is still
used.

java/runtime/MethodPtr.java:
java/runtime/MethodPtr1.java:
java/runtime/MethodPtr10.java:
java/runtime/MethodPtr11.java:
java/runtime/MethodPtr12.java:
java/runtime/MethodPtr13.java:
java/runtime/MethodPtr14.java:
java/runtime/MethodPtr15.java:
java/runtime/MethodPtr2.java:
java/runtime/MethodPtr3.java:
java/runtime/MethodPtr4.java:
java/runtime/MethodPtr5.java:
java/runtime/MethodPtr6.java:
java/runtime/MethodPtr7.java:
java/runtime/MethodPtr8.java:
java/runtime/MethodPtr9.java:
java/runtime/MethodPtrN.java:
        Add specialised MethodPtr interfaces and MethodPtrN for any higher
        arities.

compiler/mlds_to_java.m:
        Make the code generator use the specialised MethodPtr interfaces.

library/Mmakefile:
        Compile java/runtime/*.java files explicitly as some MethodPtr*.java
        files won't be compiled implicitly when compiling the standard library.

library/exception.m:
java/runtime/Exception.java:
library/rtti_implementation.m:
        Conform to changes.
2009-09-03 05:04:16 +00:00
Peter Wang
26498eb230 Make the Java jmercury.runtime.Exception class implement the getMessage()
Branches: main

Make the Java jmercury.runtime.Exception class implement the getMessage()
method for Throwable objects.  This is useful when Mercury code is called
from Java code, without the main/2 wrapper.

java/runtime/Exception.java:
        Add a method pointer as a class variable.

        Implement the getMessage() method by calling the method pointer
        if set.

library/exception.m:
        On module initialisation set the method pointer in the
        jmercury.runtime.Exception class.

        Factor out code from report_uncaught_exception_2.
2009-08-03 05:13:55 +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
2ed239c286 Implement exception handling predicates for Java.
Branches: main

library/exception.m:
        Implement exception handling predicates for Java.

java/runtime/Exception.java:
        Add a helper class.
2009-05-07 07:05:39 +00:00