From dc4b259b6651bdc0cec0895bc74e26e504870c8e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 21 Jul 2011 11:06:52 +0200 Subject: GlueGen proper size / alignment of primitive and compound types usage [2/2] - Fin MachineDesction == MD MD.StaticConfig: - enum for all supported static configs (ID -> MD) - verified at runtime: test runtime queried-MD versus static-MD, hard fail if not compatible (size/alignment) SizeThunk primitive sizes: - Add notion of fixed native size (eg. int64_t) and otherwise (eg. long) java struct 'wrappers' code generation: - single class using size/offset arrays of all MachineDescription configurations - at runtime the array idx is queried in static block - type aligment for not fixed-native-size types (SizeThunk, undef long/int) via StructAccessor junit test: - add float test - fix native code - add java (create, write) -> native (verify) test works (tested) on: linux 32/64 and windows 32/64 --- .../NativeSizeAlignment-linux-x86_32.log | 101 +++++++++++++++++++++ .../NativeSizeAlignment-linux-x86_64.log | 99 ++++++++++++++++++++ .../native-size/NativeSizeAlignment-win32.log | 99 ++++++++++++++++++++ .../native-size/NativeSizeAlignment-win64.log | 97 ++++++++++++++++++++ 4 files changed, 396 insertions(+) create mode 100644 doc/Implementation/native-size/NativeSizeAlignment-linux-x86_32.log create mode 100644 doc/Implementation/native-size/NativeSizeAlignment-linux-x86_64.log create mode 100644 doc/Implementation/native-size/NativeSizeAlignment-win32.log create mode 100644 doc/Implementation/native-size/NativeSizeAlignment-win64.log (limited to 'doc/Implementation/native-size') diff --git a/doc/Implementation/native-size/NativeSizeAlignment-linux-x86_32.log b/doc/Implementation/native-size/NativeSizeAlignment-linux-x86_32.log new file mode 100644 index 0000000..531ff8a --- /dev/null +++ b/doc/Implementation/native-size/NativeSizeAlignment-linux-x86_32.log @@ -0,0 +1,101 @@ +LD_LIBRARY_PATH=../build-x86/obj:../build-x86/test/build/natives:: java -Djogamp.debug.TraceLock -Djava.library.path=../build-x86/obj:../build-x86/test/build/natives: -classpath lib/junit.jar:/opt-share/apache-ant/lib/ant.jar:/opt-share/apache-ant/lib/ant-junit.jar:/opt-share/apache-ant/lib/ant-launcher.jar:../build-x86/gluegen-rt.jar:../build-x86/gluegen.jar:../build-x86/test/build/classes com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter +JUnit version 4.8.2 +.......static md: MachineDescriptionStatic: X86_32_UNIX(1): MachineDescription: runtimeValidated false, littleEndian true, 32Bit true, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 4 / 4 + int32 4 / 4, int64 8 / 4 + float 4 / 4, double 8 / 4, ldouble 12 / 4 + pointer 4 / 4, page 4096 +runtime md: MachineDescription: runtimeValidated true, littleEndian true, 32Bit true, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 4 / 4 + int32 4 / 4, int64 8 / 4 + float 4 / 4, double 8 / 4, ldouble 12 / 4 + pointer 4 / 4, page 4096 +compatible static/runtime: true +TK_ComplicatedSubSet: sizeof(): 52 +TK_ComplicatedSubSet: bits1-s offset: 0 +TK_ComplicatedSubSet: id-s offset: 4 +TK_ComplicatedSubSet: bits2-s offset: 8 +TK_ComplicatedSubSet: long0-s offset: 12 +TK_ComplicatedSubSet: bits3-s offset: 20 +TK_ComplicatedSubSet: real0-s offset: 24 +TK_ComplicatedSubSet: bits4-s offset: 32 +TK_ComplicatedSubSet: real1-s offset: 36 +TK_ComplicatedSubSet: bits5-s offset: 40 +TK_ComplicatedSubSet: longX-s offset: 44 +TK_ComplicatedSubSet: bits6-s offset: 48 +TK_ComplicatedSuperSet: sizeof(): 116 +TK_ComplicatedSuperSet: bits1-s offset: 0 +TK_ComplicatedSuperSet: sub1-s offset: 4 +TK_ComplicatedSuperSet: bits2-s offset: 56 +TK_ComplicatedSuperSet: sub2-s offset: 60 +TK_ComplicatedSuperSet: bits3-s offset: 112 +createComplicatedSuperSet: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x9ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x9ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + +hasInitValues res 1: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x9ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x9ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + +0x123456789abcdef0 == 0x9abcdef09abcdef0 +0x9abcdef0 == 0x9abcdef0 +0x123456789abcdef0 == 0xaf10570e9abcdef0 +0x9abcdef0 == 0x9abcdef0 + +Time: 0.037 + +OK (7 tests) + + diff --git a/doc/Implementation/native-size/NativeSizeAlignment-linux-x86_64.log b/doc/Implementation/native-size/NativeSizeAlignment-linux-x86_64.log new file mode 100644 index 0000000..72fccf8 --- /dev/null +++ b/doc/Implementation/native-size/NativeSizeAlignment-linux-x86_64.log @@ -0,0 +1,99 @@ +LD_LIBRARY_PATH=../build-x86_64/obj:../build-x86_64/test/build/natives:: java -Djogamp.debug.TraceLock -Djava.library.path=../build-x86_64/obj:../build-x86_64/test/build/natives: -classpath lib/junit.jar:/opt-share/apache-ant/lib/ant.jar:/opt-share/apache-ant/lib/ant-junit.jar:/opt-share/apache-ant/lib/ant-launcher.jar:../build-x86_64/gluegen-rt.jar:../build-x86_64/gluegen.jar:../build-x86_64/test/build/classes com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter +JUnit version 4.8.2 +.......static md: MachineDescriptionStatic: X86_64_UNIX(2): MachineDescription: runtimeValidated false, littleEndian true, 32Bit false, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 8 / 8 + int32 4 / 4, int64 8 / 8 + float 4 / 4, double 8 / 8, ldouble 16 / 16 + pointer 8 / 8, page 4096 +runtime md: MachineDescription: runtimeValidated true, littleEndian true, 32Bit false, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 8 / 8 + int32 4 / 4, int64 8 / 8 + float 4 / 4, double 8 / 8, ldouble 16 / 16 + pointer 8 / 8, page 4096 +compatible static/runtime: true +TK_ComplicatedSubSet: sizeof(): 72 +TK_ComplicatedSubSet: bits1-s offset: 0 +TK_ComplicatedSubSet: id-s offset: 4 +TK_ComplicatedSubSet: bits2-s offset: 8 +TK_ComplicatedSubSet: long0-s offset: 16 +TK_ComplicatedSubSet: bits3-s offset: 24 +TK_ComplicatedSubSet: real0-s offset: 32 +TK_ComplicatedSubSet: bits4-s offset: 40 +TK_ComplicatedSubSet: real1-s offset: 44 +TK_ComplicatedSubSet: bits5-s offset: 48 +TK_ComplicatedSubSet: longX-s offset: 56 +TK_ComplicatedSubSet: bits6-s offset: 64 +TK_ComplicatedSuperSet: sizeof(): 168 +TK_ComplicatedSuperSet: bits1-s offset: 0 +TK_ComplicatedSuperSet: sub1-s offset: 8 +TK_ComplicatedSuperSet: bits2-s offset: 80 +TK_ComplicatedSuperSet: sub2-s offset: 88 +TK_ComplicatedSuperSet: bits3-s offset: 160 +createComplicatedSuperSet: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x123456789ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x123456789ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + +hasInitValues res 1: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x123456789ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x123456789ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB54442D18P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + +0x123456789abcdef0 == 0x123456789abcdef0 +0x123456789abcdef0 == 0x123456789abcdef0 + +Time: 0.038 + +OK (7 tests) + + diff --git a/doc/Implementation/native-size/NativeSizeAlignment-win32.log b/doc/Implementation/native-size/NativeSizeAlignment-win32.log new file mode 100644 index 0000000..d2ccfe5 --- /dev/null +++ b/doc/Implementation/native-size/NativeSizeAlignment-win32.log @@ -0,0 +1,99 @@ +JUnit version 4.8.2 +.......static md: MachineDescriptionStatic: X86_32_WINDOWS(3): MachineDescription: runtimeValidated false, littleEndian true, 32Bit true, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 4 / 4 + int32 4 / 4, int64 8 / 8 + float 4 / 4, double 8 / 8, ldouble 12 / 4 + pointer 4 / 4, page 4096 +runtime md: MachineDescription: runtimeValidated true, littleEndian true, 32Bit true, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 4 / 4 + int32 4 / 4, int64 8 / 8 + float 4 / 4, double 8 / 8, ldouble 12 / 4 + pointer 4 / 4, page 4096 +compatible static/runtime: true +0x123456789abcdef0 == 0x9abcdef09abcdef0 +0x9abcdef0 == 0x9abcdef0 +0x123456789abcdef0 == 0x708c12949abcdef0 +0x9abcdef0 == 0x9abcdef0 + +Time: 0.044 + +OK (7 tests) + +TK_ComplicatedSubSet: sizeof(): 64 +TK_ComplicatedSubSet: bits1-s offset: 0 +TK_ComplicatedSubSet: id-s offset: 4 +TK_ComplicatedSubSet: bits2-s offset: 8 +TK_ComplicatedSubSet: long0-s offset: 16 +TK_ComplicatedSubSet: bits3-s offset: 24 +TK_ComplicatedSubSet: real0-s offset: 32 +TK_ComplicatedSubSet: bits4-s offset: 40 +TK_ComplicatedSubSet: real1-s offset: 44 +TK_ComplicatedSubSet: bits5-s offset: 48 +TK_ComplicatedSubSet: longX-s offset: 52 +TK_ComplicatedSubSet: bits6-s offset: 56 +TK_ComplicatedSuperSet: sizeof(): 152 +TK_ComplicatedSuperSet: bits1-s offset: 0 +TK_ComplicatedSuperSet: sub1-s offset: 8 +TK_ComplicatedSuperSet: bits2-s offset: 72 +TK_ComplicatedSuperSet: sub2-s offset: 80 +TK_ComplicatedSuperSet: bits3-s offset: 144 +createComplicatedSuperSet: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x9ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB5P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x9ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB5P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + +hasInitValues res 1: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x9ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB5P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x9ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB5P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + diff --git a/doc/Implementation/native-size/NativeSizeAlignment-win64.log b/doc/Implementation/native-size/NativeSizeAlignment-win64.log new file mode 100644 index 0000000..69c3e6f --- /dev/null +++ b/doc/Implementation/native-size/NativeSizeAlignment-win64.log @@ -0,0 +1,97 @@ +JUnit version 4.8.2 +.......static md: MachineDescriptionStatic: X86_64_WINDOWS(4): MachineDescription: runtimeValidated false, littleEndian true, 32Bit false, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 4 / 4 + int32 4 / 4, int64 8 / 8 + float 4 / 4, double 8 / 8, ldouble 16 / 16 + pointer 8 / 8, page 4096 +runtime md: MachineDescription: runtimeValidated true, littleEndian true, 32Bit false, primitive size / alignment: + int8 1 / 1, int16 2 / 2 + int 4 / 4, long 4 / 4 + int32 4 / 4, int64 8 / 8 + float 4 / 4, double 8 / 8, ldouble 16 / 16 + pointer 8 / 8, page 4096 +compatible static/runtime: true +0x123456789abcdef0 == 0x123456789abcdef0 +0x123456789abcdef0 == 0x123456789abcdef0 + +Time: 0.033 + +OK (7 tests) + +TK_ComplicatedSubSet: sizeof(): 64 +TK_ComplicatedSubSet: bits1-s offset: 0 +TK_ComplicatedSubSet: id-s offset: 4 +TK_ComplicatedSubSet: bits2-s offset: 8 +TK_ComplicatedSubSet: long0-s offset: 16 +TK_ComplicatedSubSet: bits3-s offset: 24 +TK_ComplicatedSubSet: real0-s offset: 32 +TK_ComplicatedSubSet: bits4-s offset: 40 +TK_ComplicatedSubSet: real1-s offset: 44 +TK_ComplicatedSubSet: bits5-s offset: 48 +TK_ComplicatedSubSet: longX-s offset: 52 +TK_ComplicatedSubSet: bits6-s offset: 56 +TK_ComplicatedSuperSet: sizeof(): 152 +TK_ComplicatedSuperSet: bits1-s offset: 0 +TK_ComplicatedSuperSet: sub1-s offset: 8 +TK_ComplicatedSuperSet: bits2-s offset: 72 +TK_ComplicatedSuperSet: sub2-s offset: 80 +TK_ComplicatedSuperSet: bits3-s offset: 144 +createComplicatedSuperSet: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x9ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB5P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x9ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB5P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + +hasInitValues res 1: +TK_ComplicatedSuperSet [ + cs.b1 0xA0 + cs.sub1.b1 0xA1 + cs.sub1.id 0x12345678 + cs.sub1.b2 0xA2 + cs.sub1.long0 0x9ABCDEF0 + cs.sub1.b3 0xA3 + cs.sub1.real0 3.14159 0X1.921FB5P+1 + cs.sub1.b4 0xA4 + cs.sub1.real1 256.123 0X1.001F9AP+8 + cs.sub1.b5 0xA5 + cs.sub1.longX 0xDEADBEEF + cs.sub1.b6 0xA6 + cs.b2 0xB0 + cs.sub2.b1 0xB1 + cs.sub2.id 0x12345678 + cs.sub2.b2 0xB2 + cs.sub2.long0 0x9ABCDEF0 + cs.sub2.b3 0xB3 + cs.sub2.real0 3.14159 0X1.921FB5P+1 + cs.sub2.b4 0xB4 + cs.sub2.real1 256.123 0X1.001F9AP+8 + cs.sub2.b5 0xB5 + cs.sub2.longX 0xDEADBEEF + cs.sub2.b6 0xB6 + cs.b3 0xC0 +] + -- cgit v1.2.3