<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1022</bug_id>
          
          <creation_ts>2014-06-17 08:37:17 +0200</creation_ts>
          <short_desc>GlueGen: Add support for compound [array] call-by-value (code generation)</short_desc>
          <delta_ts>2014-06-25 09:52:39 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Gluegen</product>
          <component>core</component>
          <version>2</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>1021</blocked>
    
    <blocked>1025</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>harvey.harrison</cc>
    
    <cc>rami.santina</cc>
          
          <cf_type>---</cf_type>
          <cf_scm_refs>c3054a01990e55ab35756ea23ab7d7c05f24dd37
f4e753ff1f39be381307ffdb0fb6bb7a2d323eff
9843e983a4fc71a64eb3de9cb364a1f4ffa56b3a
1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f
2f6586292cd298bbc19d8acda0f7cf303c82078b
6cb643671578aa912d16dd17e773d92f4667118b</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>3974</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-06-17 08:37:17 +0200</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3975</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-06-17 08:40:00 +0200</bug_when>
    <thetext>c3054a01990e55ab35756ea23ab7d7c05f24dd37
  GlueGen: Add support for &apos;compound call-by-value&apos;, i.e. passing and returning struct instance

f4e753ff1f39be381307ffdb0fb6bb7a2d323eff
  GlueGen: Add support for &apos;compound array call-by-value&apos;

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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3977</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-06-17 23:07:05 +0200</bug_when>
    <thetext>9843e983a4fc71a64eb3de9cb364a1f4ffa56b3a
  Fix commit f4e753ff1f39be381307ffdb0fb6bb7a2d323eff: 
    &apos;compound array call-by-value&apos; JavaMethodBindingEmitter, 
    array may still require NIO handling, also consider NIO arr</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3978</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-06-18 01:45:43 +0200</bug_when>
    <thetext>Only add static initialization code (java, native)
and hence native code &apos;JVMUtil_NewDirectByteBufferCopy(..)&apos;
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 &lt;code&gt;initializeImpl()&lt;/code&gt;
 * for the given class will be manually implemented by the end user
 * as requested via configuration directive &lt;code&gt;ManualStaticInitCall &apos;class-name&apos;&lt;/code&gt;.
 */
public boolean manualStaticInitCall(String clazzName);

/**
 * Returns true if the static initialization java code implementing &lt;code&gt;initializeImpl()&lt;/code&gt;
 * and the native code implementing:
 * &lt;pre&gt;
 *   static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity);
 * &lt;/pre&gt;
 * for the given class will be included in the generated code, always,
 * as requested via configuration directive &lt;code&gt;ForceStaticInitCode &apos;class-name&apos;&lt;/code&gt;.
 * &lt;p&gt;
 * If case above code has been generated, static class initialization is generated
 * to call &lt;code&gt;initializeImpl()&lt;/code&gt;, see {@link #manualStaticInitCall(String)}.
 * &lt;/p&gt;
 */
public boolean forceStaticInitCode(String clazzName);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3979</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-06-18 03:59:11 +0200</bug_when>
    <thetext>1eadaf928f4f61aae4de1c8bf33c5b77bdfa882f
2f6586292cd298bbc19d8acda0f7cf303c82078b
  - Changes as described in comment 3
  - JVMUtil_NewDirectByteBufferCopy: Throw FatalError if initializeImpl() has not been called</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3980</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-06-19 06:14:02 +0200</bug_when>
    <thetext>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 &apos;SE.&apos; - to analyze 
      emitting struct fields (offset+size and accessors)

    - Struct Layout  prefix &apos;SL.&apos; - to analyze 
      memory layout (based on MachineDescription.StaticConfig.X86_64_UNIX)
    
Tested via test1.[ch] BaseClass ..</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>