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.
This commit is contained in:
Peter Wang
2009-09-03 05:04:16 +00:00
parent de1329a55e
commit 68a5c0047a
22 changed files with 486 additions and 94 deletions

View File

@@ -9,7 +9,7 @@ package jmercury.runtime;
public class Exception extends java.lang.Error {
// This is to be set when the exception module is initialised, to avoid
// having the runtime depend on the standard library.
public static MethodPtr getMessageHook = null;
public static MethodPtr1 getMessageHook = null;
// Should be univ.Univ_0 but we don't want to depend on the standard
// library.
@@ -21,8 +21,7 @@ public class Exception extends java.lang.Error {
public String getMessage() {
if (getMessageHook != null) {
Object[] args = new Object[] { exception };
return (String) getMessageHook.call___0_0(args);
return (String) getMessageHook.call___0_0(exception);
} else {
return null;
}