diff options
author | Sven Gothel <[email protected]> | 2023-08-04 00:14:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-04 00:14:42 +0200 |
commit | d4e8ecc3b4f68b86d95ec951971a0fea20217988 (patch) | |
tree | 09ae1667e927607358ff989391edb82b6b6cd3fc /src/java/com/jogamp | |
parent | 88941c41dbb134984fd0857db9ea0729d9306bbb (diff) |
JavaEmitter: Encapsulate 'needsJavaCallbackCode' query in JavaConfiguration. TBD: Is this even required?
- needsIntermediateOperation -> needsJavaCallbackCode
- Use JavaConfiguration.requiresJavaCallbackCode(..)
TBD: Is this even required?
As far as I see, the non-userParam callback case adds no additional code requirements.
Both, callback with and without userParam shares same code path
and the respective native static fields.
Only that the non-userParam code path adds additional native static fields,
but all code sections are produced in both cases.
Diffstat (limited to 'src/java/com/jogamp')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaConfiguration.java | 6 | ||||
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java index 6d0eae5..95e1480 100644 --- a/src/java/com/jogamp/gluegen/JavaConfiguration.java +++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java @@ -2518,4 +2518,10 @@ public class JavaConfiguration { /* pp */ final Map<String, JavaCallbackInfo> setFuncToJavaCallbackMap = new HashMap<String, JavaCallbackInfo>(); final Set<String> emittedJavaCallbackUserParamClasses = new HashSet<String>(); + /** Returns true if a method binding requires specific java callback code */ + final boolean requiresJavaCallbackCode(final String bindingName) { + final JavaCallbackInfo jcbi = setFuncToJavaCallbackMap.get(bindingName); + return null != jcbi && !jcbi.cbUserParamIsDefined; + } + } diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 4a836f5..5b40470 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -465,12 +465,11 @@ public class JavaEmitter implements GlueEmitter { final boolean isUnimplemented = cfg.isUnimplemented(cSymbol); final List<String> prologue = cfg.javaPrologueForMethod(binding, false, false); final List<String> epilogue = cfg.javaEpilogueForMethod(binding, false, false); - final JavaCallbackInfo jcbi = cfg.setFuncToJavaCallbackMap.get(binding.getName()); - final boolean needsIntermediateOperation = null != jcbi && !jcbi.cbUserParamIsDefined; + final boolean needsJavaCallbackCode = cfg.requiresJavaCallbackCode( binding.getName() ); final boolean needsBody = isUnimplemented || binding.needsNIOWrappingOrUnwrapping() || binding.signatureUsesJavaPrimitiveArrays() || - needsIntermediateOperation || + needsJavaCallbackCode || null != prologue || null != epilogue; @@ -534,8 +533,7 @@ public class JavaEmitter implements GlueEmitter { final boolean hasPrologueOrEpilogue = cfg.javaPrologueForMethod(binding, false, false) != null || cfg.javaEpilogueForMethod(binding, false, false) != null ; - final JavaCallbackInfo jcbi = cfg.setFuncToJavaCallbackMap.get(binding.getName()); - final boolean needsIntermediateOperation = null != jcbi && !jcbi.cbUserParamIsDefined; + final boolean needsJavaCallbackCode = cfg.requiresJavaCallbackCode( binding.getName() ); if ( !cfg.isUnimplemented( cSymbol ) ) { // If we already generated a public native entry point for this @@ -546,7 +544,7 @@ public class JavaEmitter implements GlueEmitter { // the private native entry point for it along with the version // taking only NIO buffers if ( !binding.signatureUsesJavaPrimitiveArrays() && - ( binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue || needsIntermediateOperation ) + ( binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue || needsJavaCallbackCode ) ) { final CodeUnit unit = (cfg.allStatic() ? javaUnit() : javaImplUnit()); @@ -593,7 +591,7 @@ public class JavaEmitter implements GlueEmitter { cfg.implClassName(), true, // NOTE: we always disambiguate with a suffix now, so this is optional cfg.allStatic(), - (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue || needsIntermediateOperation), + (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue || needsJavaCallbackCode), !cfg.useNIODirectOnly(binding.getName()), machDescJava, getConfig()); prepCEmitter(binding.getName(), binding.getJavaReturnType(), cEmitter); |