summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-09-30 01:46:03 +0000
committerKenneth Russel <[email protected]>2007-09-30 01:46:03 +0000
commit0792c18eb439df8d945b21422bfe15d5bb898e01 (patch)
treea3fb7e2a86ea66ec6bf7bd06e0c2c800fd50148f /src
parentcc659efa4b20bfbce96227df9620c5f1cdd5f879 (diff)
Changed structure layout for 32-bit Windows to more closely match what
the C compiler produces. More work is needed in this area. Synchronized StructLayout and CPU classes. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@69 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src')
-rw-r--r--src/java/com/sun/gluegen/StructLayout.java34
-rwxr-xr-xsrc/java/com/sun/gluegen/runtime/CPU.java1
2 files changed, 19 insertions, 16 deletions
diff --git a/src/java/com/sun/gluegen/StructLayout.java b/src/java/com/sun/gluegen/StructLayout.java
index ef1e15d..fb7ff4d 100644
--- a/src/java/com/sun/gluegen/StructLayout.java
+++ b/src/java/com/sun/gluegen/StructLayout.java
@@ -123,22 +123,24 @@ public class StructLayout {
// Note: this code is replicated in CPU.java
String os = System.getProperty("os.name").toLowerCase();
String cpu = System.getProperty("os.arch").toLowerCase();
- if ((os.startsWith("windows") && cpu.equals("x86")) ||
- (os.startsWith("windows") && cpu.equals("amd64")) ||
- (os.startsWith("linux") && cpu.equals("i386")) ||
- (os.startsWith("linux") && cpu.equals("x86")) ||
- (os.startsWith("linux") && cpu.equals("amd64")) ||
- (os.startsWith("linux") && cpu.equals("x86_64")) ||
- (os.startsWith("linux") && cpu.equals("ia64")) ||
- (os.startsWith("sunos") && cpu.equals("sparc")) ||
- (os.startsWith("sunos") && cpu.equals("sparcv9")) ||
- (os.startsWith("sunos") && cpu.equals("x86")) ||
- (os.startsWith("sunos") && cpu.equals("amd64")) ||
- (os.startsWith("mac os") && cpu.equals("ppc")) ||
- (os.startsWith("mac os") && cpu.equals("i386")) ||
- (os.startsWith("freebsd") && cpu.equals("i386")) ||
- (os.startsWith("hp-ux") && cpu.equals("pa_risc2.0"))
- ) {
+ if ((os.startsWith("windows") && cpu.equals("x86"))) {
+ // It appears that Windows uses a packing alignment of 4 bytes in 32-bit mode
+ return new StructLayout(0, 4);
+ } else if ((os.startsWith("windows") && cpu.equals("amd64")) ||
+ (os.startsWith("linux") && cpu.equals("i386")) ||
+ (os.startsWith("linux") && cpu.equals("x86")) ||
+ (os.startsWith("linux") && cpu.equals("amd64")) ||
+ (os.startsWith("linux") && cpu.equals("x86_64")) ||
+ (os.startsWith("linux") && cpu.equals("ia64")) ||
+ (os.startsWith("sunos") && cpu.equals("sparc")) ||
+ (os.startsWith("sunos") && cpu.equals("sparcv9")) ||
+ (os.startsWith("sunos") && cpu.equals("x86")) ||
+ (os.startsWith("sunos") && cpu.equals("amd64")) ||
+ (os.startsWith("mac os") && cpu.equals("ppc")) ||
+ (os.startsWith("mac os") && cpu.equals("i386")) ||
+ (os.startsWith("freebsd") && cpu.equals("i386")) ||
+ (os.startsWith("hp-ux") && cpu.equals("pa_risc2.0"))
+ ) {
// FIXME: make struct alignment configurable? May need to change
// packing rules on a per-type basis?
return new StructLayout(0, 8);
diff --git a/src/java/com/sun/gluegen/runtime/CPU.java b/src/java/com/sun/gluegen/runtime/CPU.java
index a399b11..74106fc 100755
--- a/src/java/com/sun/gluegen/runtime/CPU.java
+++ b/src/java/com/sun/gluegen/runtime/CPU.java
@@ -55,6 +55,7 @@ public class CPU {
String cpu = System.getProperty("os.arch").toLowerCase();
if ((os.startsWith("windows") && cpu.equals("x86")) ||
(os.startsWith("linux") && cpu.equals("i386")) ||
+ (os.startsWith("linux") && cpu.equals("x86")) ||
(os.startsWith("mac os") && cpu.equals("ppc")) ||
(os.startsWith("mac os") && cpu.equals("i386")) ||
(os.startsWith("sunos") && cpu.equals("sparc")) ||