| Summary: | GlueGen: Add support for compound [array] call-by-value (code generation) | ||
|---|---|---|---|
| Product: | [JogAmp] Gluegen | Reporter: | Sven Gothel <sgothel> |
| Component: | core | Assignee: | Sven Gothel <sgothel> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | harvey.harrison, rami.santina |
| Priority: | --- | ||
| Version: | 2 | ||
| Hardware: | All | ||
| OS: | all | ||
| Type: | --- | SCM Refs: |
c3054a01990e55ab35756ea23ab7d7c05f24dd37
f4e753ff1f39be381307ffdb0fb6bb7a2d323eff
9843e983a4fc71a64eb3de9cb364a1f4ffa56b3a
1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f
2f6586292cd298bbc19d8acda0f7cf303c82078b
6cb643671578aa912d16dd17e773d92f4667118b
|
| Workaround: | --- | ||
| Bug Depends on: | |||
| Bug Blocks: | 1021, 1025 | ||
c3054a01990e55ab35756ea23ab7d7c05f24dd37 GlueGen: Add support for 'compound call-by-value', i.e. passing and returning struct instance f4e753ff1f39be381307ffdb0fb6bb7a2d323eff GlueGen: Add support for 'compound array call-by-value' Tested manually w/ GlueGen unit tests and validated JOAL, JOGL and JOCL builds and tests. JOGL also does not expose API differences (of interfaces) due to this change. 9843e983a4fc71a64eb3de9cb364a1f4ffa56b3a
Fix commit f4e753ff1f39be381307ffdb0fb6bb7a2d323eff:
'compound array call-by-value' JavaMethodBindingEmitter,
array may still require NIO handling, also consider NIO arr
Only add static initialization code (java, native)
and hence native code 'JVMUtil_NewDirectByteBufferCopy(..)'
if either required _or_ forced via configuration.
This shall reduce possible sideffects
and dead code.
Add JavaConfiguration:
/**
* Returns true if the static initialization java code calling <code>initializeImpl()</code>
* for the given class will be manually implemented by the end user
* as requested via configuration directive <code>ManualStaticInitCall 'class-name'</code>.
*/
public boolean manualStaticInitCall(String clazzName);
/**
* Returns true if the static initialization java code implementing <code>initializeImpl()</code>
* and the native code implementing:
* <pre>
* static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity);
* </pre>
* for the given class will be included in the generated code, always,
* as requested via configuration directive <code>ForceStaticInitCode 'class-name'</code>.
* <p>
* If case above code has been generated, static class initialization is generated
* to call <code>initializeImpl()</code>, see {@link #manualStaticInitCall(String)}.
* </p>
*/
public boolean forceStaticInitCode(String clazzName);
1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f 2f6586292cd298bbc19d8acda0f7cf303c82078b - Changes as described in comment 3 - JVMUtil_NewDirectByteBufferCopy: Throw FatalError if initializeImpl() has not been called 6cb643671578aa912d16dd17e773d92f4667118b
Add support for compound-array in structs (accessors) ;
Allow using C-Enum values for array length
- Parser (HeaderParser.g): Support using C-Enum values
for array length specification
- Will throw an exception if enum identifier is unknown or exceeds int-size
- Add StructEmitter supports for compound-arrays
- Add Debug stderr verbose info:
- Struct Emitter prefix 'SE.' - to analyze
emitting struct fields (offset+size and accessors)
- Struct Layout prefix 'SL.' - to analyze
memory layout (based on MachineDescription.StaticConfig.X86_64_UNIX)
Tested via test1.[ch] BaseClass ..
|
For certain APIs we require support for inefficient call-by-value of compounds and compound-arrays. Both are inefficient, since: - compound array args need to copy data into c-heap and if non-const, even back to the NIO heap! - compound return values need to have new NIO heap allocated and data copied. - compound non-array args are not critical itself