i tried the patch you suggested cranphin, on top of latest JNA SVN (17).
You might test with putting the two jars into the AI/Interfaces/Java/0.1/jlib dir (dont forget to delete the linux specific one, when going back the the default jna).
I did not compile hte windows version, if you need that, tell me, and i'll do it.
in case you want to fiddle around with the code yourself, i also attached the changed source file (no other changes then in this file).
this is the diff:
Code: Select all
240c240
< allocateMemory(initFromNative(true));
---
> allocateMemory(calculateSize(true));
251c251
< size = initFromNative(false);
---
> size = calculateSize(false);
613,647d612
< private static class StructureInfo {
< int structAlignment;
< int size;
< Map/*<String, StructureField>*/ structFields;
< //List (Set?) initializeFieldNames;
< }
<
< private static Map/*<Class, StructureInfo>*/ structureInfos = new HashMap/*<Class, StructureInfo>*/();
<
< int initFromNative(boolean force) {
<
< int myNativeSize = Structure.CALCULATE_SIZE;
<
< Class myClass = this.getClass();
< // try to get from the cache
< if (structureInfos.containsKey(myClass)) {
< StructureInfo myInfo = (StructureInfo) structureInfos.get(myClass);
< myNativeSize = myInfo.size;
< structAlignment = myInfo.structAlignment;
< structFields.putAll(myInfo.structFields);
< } else {
< myNativeSize = calculateSize(force);
< if (myNativeSize != Structure.CALCULATE_SIZE) {
< // cache the calculated values
< StructureInfo myInfo = new StructureInfo();
< myInfo.size = myNativeSize;
< myInfo.structAlignment = structAlignment;
< myInfo.structFields = structFields;
< structureInfos.put(myClass, myInfo);
< }
< }
<
< return myNativeSize;
< }
<
659c624
< protected int calculateSize(boolean force) {
---
> int calculateSize(boolean force) {
831c796
< initFromNative(true);
---
> calculateSize(true);

test:
It compiles and runs with the javaaispeed branch as it is now (no changes were needed). Just the performance is to be checked.
edit:
* added source file to attached zip
* added "test" paragraph