aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2004-07-15 22:47:31 +0000
committerKenneth Russel <[email protected]>2004-07-15 22:47:31 +0000
commitb233755e292994fa8dfbc7543b6a450ee83a24cc (patch)
treede9fd640c13d9e96f9670e9aff99fdb420bd4900 /src
parent556d51486c1692f124304a4b391c7fc05df576af (diff)
Fixed Issue 86: code generation problem
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@139 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r--src/net/java/games/gluegen/CMethodBindingEmitter.java45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/net/java/games/gluegen/CMethodBindingEmitter.java b/src/net/java/games/gluegen/CMethodBindingEmitter.java
index e65b8ca00..e0abf86a6 100644
--- a/src/net/java/games/gluegen/CMethodBindingEmitter.java
+++ b/src/net/java/games/gluegen/CMethodBindingEmitter.java
@@ -468,27 +468,29 @@ public class CMethodBindingEmitter extends FunctionEmitter
protected void emitBodyVariablePreCallSetup(PrintWriter writer,
boolean emittingPrimitiveArrayCritical)
{
- // Convert all Buffers to pointers first so we don't have to
- // call ReleasePrimitiveArrayCritical for any arrays if any
- // incoming buffers aren't direct
- if (binding.hasContainingType()) {
- emitPointerConversion(writer, binding,
- binding.getContainingType(),
- binding.getContainingCType(),
- JavaMethodBindingEmitter.javaThisArgumentName(),
- CMethodBindingEmitter.cThisArgumentName());
- }
-
- for (int i = 0; i < binding.getNumArguments(); i++) {
- JavaType type = binding.getJavaArgumentType(i);
- if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) {
- continue;
+ if (!emittingPrimitiveArrayCritical) {
+ // Convert all Buffers to pointers first so we don't have to
+ // call ReleasePrimitiveArrayCritical for any arrays if any
+ // incoming buffers aren't direct
+ if (binding.hasContainingType()) {
+ emitPointerConversion(writer, binding,
+ binding.getContainingType(),
+ binding.getContainingCType(),
+ JavaMethodBindingEmitter.javaThisArgumentName(),
+ CMethodBindingEmitter.cThisArgumentName());
}
- if (type.isNIOBuffer()) {
- emitPointerConversion(writer, binding, type,
- binding.getCArgumentType(i),
- binding.getArgumentName(i),
- pointerConversionArgumentName(i));
+
+ for (int i = 0; i < binding.getNumArguments(); i++) {
+ JavaType type = binding.getJavaArgumentType(i);
+ if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) {
+ continue;
+ }
+ if (type.isNIOBuffer()) {
+ emitPointerConversion(writer, binding, type,
+ binding.getCArgumentType(i),
+ binding.getArgumentName(i),
+ pointerConversionArgumentName(i));
+ }
}
}
@@ -504,6 +506,9 @@ public class CMethodBindingEmitter extends FunctionEmitter
boolean needsDataCopy = javaArgTypeNeedsDataCopy(javaArgType);
Class subArrayElementJavaType = javaArgType.getJavaClass().getComponentType();
+ // We only defer the emission of GetPrimitiveArrayCritical
+ // calls that won't be matched up until after the function
+ // we're calling
if ((!needsDataCopy && !emittingPrimitiveArrayCritical) ||
(needsDataCopy && emittingPrimitiveArrayCritical)) {
continue;