I am not sure if native_interface is the correct subcategory for this issue.
If not, please reassign it.
As you know, for better performance, 8-byte aligned buffers are desired,
especially when SIMD-style instructions like the VIS on UltraSPARC are
used. The Get<PrimitiveType>ArrayElements functions seem to be able to
copy arrays to native buffers starting from 8-byte aligned addresses all
the time, which is good.
It came to my notice that non-double arrays pinned by the JNI function
GetPrimitiveArrayCritical are always starting from addresses which are
not 8-byte aligned. In fact, they are always starting from either ...4
or ...C. I hope that the VM can be somewhat modified to allocate arrays
starting from 8-byte aligned addresses.
A test case, TestArray.java, is attached to this report. The results
I got are as follows:
solarcell % run.csh
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
------ i = 0 ------
bp = e243ee14, Get-isCopy = 0, Release-isCopy = 2
sp = e243f2ec, Get-isCopy = 0, Release-isCopy = 2
ip = e243fbc4, Get-isCopy = 0, Release-isCopy = 2
fp = e2440c9c, Get-isCopy = 0, Release-isCopy = 2
dp = e2441d78, Get-isCopy = 0, Release-isCopy = 2
------ i = 1 ------
bp = e2443f9c, Get-isCopy = 0, Release-isCopy = 2
sp = e24443ac, Get-isCopy = 0, Release-isCopy = 2
ip = e2444bbc, Get-isCopy = 0, Release-isCopy = 2
fp = e2445bcc, Get-isCopy = 0, Release-isCopy = 2
dp = e2446be0, Get-isCopy = 0, Release-isCopy = 2
------ i = 2 ------
bp = e2448d3c, Get-isCopy = 0, Release-isCopy = 2
sp = e244914c, Get-isCopy = 0, Release-isCopy = 2
ip = e244995c, Get-isCopy = 0, Release-isCopy = 2
fp = e244a96c, Get-isCopy = 0, Release-isCopy = 2
dp = e244b980, Get-isCopy = 0, Release-isCopy = 2
------ i = 3 ------
bp = e244dadc, Get-isCopy = 0, Release-isCopy = 2
sp = e244deec, Get-isCopy = 0, Release-isCopy = 2
ip = e244e6fc, Get-isCopy = 0, Release-isCopy = 2
fp = e244f70c, Get-isCopy = 0, Release-isCopy = 2
dp = e2450720, Get-isCopy = 0, Release-isCopy = 2
------ i = 4 ------
bp = e245287c, Get-isCopy = 0, Release-isCopy = 2
sp = e2452c8c, Get-isCopy = 0, Release-isCopy = 2
ip = e245349c, Get-isCopy = 0, Release-isCopy = 2
fp = e24544ac, Get-isCopy = 0, Release-isCopy = 2
dp = e24554c0, Get-isCopy = 0, Release-isCopy = 2