mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 05:12:33 +00:00
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.
30 lines
870 B
Java
30 lines
870 B
Java
//
|
|
// Copyright (C) 2009 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 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 MethodPtr1 getMessageHook = null;
|
|
|
|
// Should be univ.Univ_0 but we don't want to depend on the standard
|
|
// library.
|
|
public Object exception;
|
|
|
|
public Exception(Object exception) {
|
|
this.exception = exception;
|
|
}
|
|
|
|
public String getMessage() {
|
|
if (getMessageHook != null) {
|
|
return (String) getMessageHook.call___0_0(exception);
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
}
|