summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/MethodBinding.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-18 03:46:38 +0200
committerSven Gothel <[email protected]>2014-06-18 03:46:38 +0200
commit2f6586292cd298bbc19d8acda0f7cf303c82078b (patch)
tree2ba07679216b1781696fff4e7e652c13723fa7fb /src/java/com/jogamp/gluegen/MethodBinding.java
parent1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f (diff)
GlueGen: Refine compound [array] call-by-value native code injection and initialization
Follow-up of commit 1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f - Refine MethodBinding detection for 'requiresStaticInitialization', i.e. return type is a "compound type" and not a pointer - JVMUtil_NewDirectByteBufferCopy: Throw FatalError if initializeImpl() has not been called
Diffstat (limited to 'src/java/com/jogamp/gluegen/MethodBinding.java')
-rw-r--r--src/java/com/jogamp/gluegen/MethodBinding.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/java/com/jogamp/gluegen/MethodBinding.java b/src/java/com/jogamp/gluegen/MethodBinding.java
index d199db1..61732fb 100644
--- a/src/java/com/jogamp/gluegen/MethodBinding.java
+++ b/src/java/com/jogamp/gluegen/MethodBinding.java
@@ -68,6 +68,7 @@ public class MethodBinding {
private boolean signatureUsesCPrimitivePointers;
private boolean signatureUsesCArrays;
private boolean signatureUsesJavaPrimitiveArrays;
+ private boolean signatureRequiresStaticInitialization;
private JavaType containingType;
private Type containingCType;
private int thisPointerIndex = -1;
@@ -96,6 +97,7 @@ public class MethodBinding {
this.signatureUsesCPrimitivePointers = bindingToCopy.signatureUsesCPrimitivePointers;
this.signatureUsesCArrays = bindingToCopy.signatureUsesCArrays;
this.signatureUsesJavaPrimitiveArrays = bindingToCopy.signatureUsesJavaPrimitiveArrays;
+ this.signatureRequiresStaticInitialization = bindingToCopy.signatureRequiresStaticInitialization;
this.thisPointerIndex = bindingToCopy.thisPointerIndex;
}
@@ -254,6 +256,21 @@ public class MethodBinding {
}
/**
+ * Returns true if the wrapper implementation requires
+ * static native code to be initialized, see {@link JavaConfiguration#forceStaticInitCode(String)}.
+ * <p>
+ * Currently triggered by:
+ * <ul>
+ * <li>Return type is a "compound type" and not a pointer</li>
+ * </ul>
+ * </p>
+ */
+ public boolean signatureRequiresStaticInitialization() {
+ computeSignatureProperties();
+ return signatureRequiresStaticInitialization;
+ }
+
+ /**
* Returns true if the return type or any of the outgoing arguments
* in the method's signature use arrays of "compound type wrappers",
* or NIO-based wrappers for C data structures.
@@ -326,11 +343,17 @@ public class MethodBinding {
signatureUsesCPrimitivePointers = false;
signatureUsesCArrays = false;
signatureUsesJavaPrimitiveArrays = false;
+ signatureRequiresStaticInitialization = false;
- if (javaReturnType.isCompoundTypeWrapper()) {
+ if ( javaReturnType.isCompoundTypeWrapper() ) {
// Needs wrapping and/or setting of byte order (neither of which
// can be done easily from native code)
signatureUsesCompoundTypeWrappers = true;
+
+ final Type cReturnType = getCReturnType();
+ if ( !cReturnType.isPointer() ) { // FIXME: Compound call-by-value
+ signatureRequiresStaticInitialization = true;
+ }
}
if (javaReturnType.isNIOBuffer() ||