Menu

#67 Adding support for optional JNI 1.4 functions

closed
None
5
2012-09-21
2006-08-30
Elias Naur
No

This patch against the HEAD of the subversion
repository adds support for the optional JNI 1.4
functions, GetDirectBufferAddress,
NewDirectByteBuffer and GetDirectBufferCapacity. I've
included a test that should cover most of the
functionality.

The meat of the patch is the JikesRVMSupport classes
in gnu.classpath and in
java.nio which acts as a bridge between the classpath
direct buffers and the
JNI 1.4 functions. One controversal change might be
the return type change of
NewDirectByteBuffer from Address to int, which seems
to be the correct type
for functions that return JNI references to objects.

Discussion

  • Elias Naur

    Elias Naur - 2006-08-30

    Patch, description, test and statement of origin

     
  • Dave Grove

    Dave Grove - 2006-08-30

    Logged In: YES
    user_id=1215435

    great!

    I'll have to take a look at the Address=> int change. I
    suspect this won't work for us since we run Jikes RVM on 64
    bit platforms, but I'll have to look through the code path
    to be sure.

     
  • Elias Naur

    Elias Naur - 2006-08-30

    Logged In: YES
    user_id=648271

    I think the int is fine since it's not an address but a JNI
    reference as returned from env.pushJNIRef. For example, the
    NewObject JNI function also return an int, regardless of
    platform, as returned from env.pushJNIRef.

    What I was worried about was some kind of odd ABI
    dependency on the Address return type I don't know about.

    • elias
     
  • Ian Rogers

    Ian Rogers - 2006-08-30

    Logged In: YES
    user_id=308843

    I think in:

    rvm/src/vm/libSupport/gnu/classpath/JikesRVMSupport.java

    • //-#if RVM_FOR_32_ADDR
    • return new Pointer32(address.toInt());
    • //-#elif RVM_FOR_64_ADDR
    • return new Pointer32(address.toLong());
    • //-#endif

    should be:

    • //-#if RVM_FOR_32_ADDR
    • return new Pointer32(address.toInt());
    • //-#elif RVM_FOR_64_ADDR
    • return new Pointer64(address.toLong());
    • //-#endif

    I agree the int looks funny, but I also agree we do it
    elsewhere :-)

    Regards,
    Ian

     
  • Elias Naur

    Elias Naur - 2006-08-30

    Logged In: YES
    user_id=648271

    Yes, I fixed the Pointer32 issue in the second upload of
    the patch a few minutes later than the original patch. I'm
    sorry you got the patch too soon :)

     
  • Dave Grove

    Dave Grove - 2006-08-31

    Logged In: YES
    user_id=1215435

    ok, makes sense...I should read the patch before commenting
    next time :)

    Regression testing now; should commit later this morning.

     

Log in to post a comment.