summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-30 21:15:45 +0100
committerSven Gothel <[email protected]>2015-01-30 21:15:45 +0100
commit0deceee37d943faa7c34971388863a27f395d6a5 (patch)
tree8bbdba69305671c6764b4796d022f9c5e6c49c43 /src/java/com/jogamp
parent12feaa7d3b1544098f684d851e3caff1ec88cbc8 (diff)
Bug 1122: Refine AArch64 and OSType/32Bit incl. MachineDescription
Android: - Detect ABIType.EABI_GNU_ARMHF via 'armeabi-v7a-hard' Platform.CPUType: - contains is32Bit now MachineDescription: - Rename *x86_64_unix* -> *lp64_unix*, reflecting universal __LP64__ mode - Remove is32Bit, which is determined by CPUType
Diffstat (limited to 'src/java/com/jogamp')
-rw-r--r--src/java/com/jogamp/common/os/AndroidVersion.java18
-rw-r--r--src/java/com/jogamp/common/os/MachineDescription.java27
-rw-r--r--src/java/com/jogamp/common/os/Platform.java81
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java2
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/StructLayout.java2
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/Type.java2
6 files changed, 59 insertions, 73 deletions
diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java
index 0e30602..f727a47 100644
--- a/src/java/com/jogamp/common/os/AndroidVersion.java
+++ b/src/java/com/jogamp/common/os/AndroidVersion.java
@@ -91,7 +91,8 @@ public class AndroidVersion {
} else if( cpuABI.equals("aarch64") ||
cpuABI.startsWith("arm64") ) {
return CPUType.ARM64;
- } else if( cpuABI.equals("armeabi-v7a") ) {
+ } else if( cpuABI.equals("armeabi-v7a") ||
+ cpuABI.equals("armeabi-v7a-hard") ) {
return CPUType.ARMv7;
} else if( cpuABI.equals("armeabi") ||
cpuABI.startsWith("arm") ) { // last 32bit chance ..
@@ -107,13 +108,18 @@ public class AndroidVersion {
private static final ABIType getABITypeImpl(final CPUType cpuType, final String cpuABI) {
if( null == cpuType || null == cpuABI ) {
return null;
- } else if( CPUFamily.ARM != cpuType.family ) {
+ } else if( CPUFamily.ARM == cpuType.family ) {
+ if( CPUType.ARM64 == cpuType ||
+ CPUType.ARMv8_A == cpuType ) {
+ return ABIType.EABI_AARCH64;
+ } else if( cpuABI.equals("armeabi-v7a-hard") ) {
+ return ABIType.EABI_GNU_ARMHF;
+ } else {
+ return ABIType.EABI_GNU_ARMEL;
+ }
+ } else {
return ABIType.GENERIC_ABI;
- } else if( CPUType.ARM64 == cpuType ||
- CPUType.ARMv8_A == cpuType ) {
- return ABIType.EABI_AARCH64;
}
- return ABIType.EABI_GNU_ARMEL; // FIXME: How will they name ABIType.EABI_GNU_ARMHF
}
static {
diff --git a/src/java/com/jogamp/common/os/MachineDescription.java b/src/java/com/jogamp/common/os/MachineDescription.java
index a9a46b2..98093d0 100644
--- a/src/java/com/jogamp/common/os/MachineDescription.java
+++ b/src/java/com/jogamp/common/os/MachineDescription.java
@@ -51,7 +51,7 @@ public class MachineDescription {
private final static int[] size_x86_32_unix = { 4, 4, 4, 8, 12, 4, 4096 };
private final static int[] size_x86_32_macos = { 4, 4, 4, 8, 16, 4, 4096 };
private final static int[] size_x86_32_windows = { 4, 4, 4, 8, 12, 4, 4096 };
- private final static int[] size_x86_64_unix = { 4, 8, 4, 8, 16, 8, 4096 };
+ private final static int[] size_lp64_unix = { 4, 8, 4, 8, 16, 8, 4096 };
private final static int[] size_x86_64_windows = { 4, 4, 4, 8, 16, 8, 4096 };
private final static int[] size_sparc_32_sunos = { 4, 4, 4, 8, 16, 4, 8192 };
@@ -60,7 +60,7 @@ public class MachineDescription {
private final static int[] align_x86_32_unix = { 1, 2, 4, 4, 4, 4, 4, 4, 4, 4 };
private final static int[] align_x86_32_macos = { 1, 2, 4, 4, 4, 4, 4, 4, 16, 4 };
private final static int[] align_x86_32_windows = { 1, 2, 4, 8, 4, 4, 4, 8, 4, 4 };
- private final static int[] align_x86_64_unix = { 1, 2, 4, 8, 4, 8, 4, 8, 16, 8 };
+ private final static int[] align_lp64_unix = { 1, 2, 4, 8, 4, 8, 4, 8, 16, 8 };
private final static int[] align_x86_64_windows = { 1, 2, 4, 8, 4, 4, 4, 8, 16, 8 };
private final static int[] align_sparc_32_sunos = { 1, 2, 4, 8, 4, 4, 4, 8, 8, 4 };
@@ -69,8 +69,8 @@ public class MachineDescription {
ARMle_EABI(true, size_armeabi, align_armeabi),
/** {@link Platform.CPUType#X86_32} Little Endian Unix */
X86_32_UNIX(true, size_x86_32_unix, align_x86_32_unix),
- /** {@link Platform.CPUType#X86_64} Little Endian Unix, {@link Platform.CPUType#ARM64} EABI Little Endian */
- X86_64_UNIX(true, size_x86_64_unix, align_x86_64_unix),
+ /** LP64 Unix, e.g.: {@link Platform.CPUType#X86_64} Little Endian Unix, {@link Platform.CPUType#ARM64} EABI Little Endian, ... */
+ LP64_UNIX(true, size_lp64_unix, align_lp64_unix),
/** {@link Platform.CPUType#X86_32} Little Endian MacOS (Special case gcc4/OSX) */
X86_32_MACOS(true, size_x86_32_macos, align_x86_32_macos),
/** {@link Platform.CPUType#X86_32} Little Endian Windows */
@@ -136,7 +136,6 @@ public class MachineDescription {
final private int ldoubleSizeInBytes;
final private int pointerSizeInBytes;
final private int pageSizeInBytes;
- final private boolean is32Bit;
final private int int8AlignmentInBytes;
final private int int16AlignmentInBytes;
@@ -180,7 +179,6 @@ public class MachineDescription {
this.ldoubleSizeInBytes = ldoubleSizeInBytes;
this.pointerSizeInBytes = pointerSizeInBytes;
this.pageSizeInBytes = pageSizeInBytes;
- this.is32Bit = 4 == pointerSizeInBytes;
this.int8AlignmentInBytes = int8AlignmentInBytes;
this.int16AlignmentInBytes = int16AlignmentInBytes;
@@ -208,20 +206,6 @@ public class MachineDescription {
return littleEndian;
}
- /**
- * Returns true if this JVM/ARCH is 32bit.
- */
- public final boolean is32Bit() {
- return is32Bit;
- }
-
- /**
- * Returns true if this JVM/ARCH is 64bit.
- */
- public final boolean is64Bit() {
- return !is32Bit;
- }
-
public final int intSizeInBytes() { return intSizeInBytes; }
public final int longSizeInBytes() { return longSizeInBytes; }
public final int int8SizeInBytes() { return int8SizeInBytes; }
@@ -292,7 +276,6 @@ public class MachineDescription {
doubleSizeInBytes == md.doubleSizeInBytes &&
ldoubleSizeInBytes == md.ldoubleSizeInBytes &&
pointerSizeInBytes == md.pointerSizeInBytes &&
- is32Bit == md.is32Bit &&
int8AlignmentInBytes == md.int8AlignmentInBytes &&
int16AlignmentInBytes == md.int16AlignmentInBytes &&
@@ -310,7 +293,7 @@ public class MachineDescription {
if(null==sb) {
sb = new StringBuilder();
}
- sb.append("MachineDescription: runtimeValidated ").append(isRuntimeValidated()).append(", littleEndian ").append(isLittleEndian()).append(", 32Bit ").append(is32Bit()).append(", primitive size / alignment:").append(PlatformPropsImpl.NEWLINE);
+ sb.append("MachineDescription: runtimeValidated ").append(isRuntimeValidated()).append(", littleEndian ").append(isLittleEndian()).append(", 32Bit ").append(4 == pointerAlignmentInBytes).append(", primitive size / alignment:").append(PlatformPropsImpl.NEWLINE);
sb.append(" int8 ").append(int8SizeInBytes) .append(" / ").append(int8AlignmentInBytes);
sb.append(", int16 ").append(int16SizeInBytes) .append(" / ").append(int16AlignmentInBytes).append(Platform.getNewline());
sb.append(" int ").append(intSizeInBytes) .append(" / ").append(intAlignmentInBytes);
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index 5b3befa..0d00a9a 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -92,42 +92,44 @@ public class Platform extends PlatformPropsImpl {
public enum CPUType {
/** X86 32bit */
- X86_32( CPUFamily.X86, 0x0001),
+ X86_32( CPUFamily.X86, 0x0001, true),
/** X86 64bit */
- X86_64( CPUFamily.X86, 0x0002),
- /** ARM default */
- ARM( CPUFamily.ARM, 0x0000),
+ X86_64( CPUFamily.X86, 0x0002, false),
+ /** ARM 32bit default */
+ ARM( CPUFamily.ARM, 0x0000, true),
/** ARM7EJ, ARM9E, ARM10E, XScale */
- ARMv5( CPUFamily.ARM, 0x0001),
+ ARMv5( CPUFamily.ARM, 0x0001, true),
/** ARM11 */
- ARMv6( CPUFamily.ARM, 0x0002),
+ ARMv6( CPUFamily.ARM, 0x0002, true),
/** ARM Cortex */
- ARMv7( CPUFamily.ARM, 0x0004),
+ ARMv7( CPUFamily.ARM, 0x0004, true),
/** ARM64 default (64bit) */
- ARM64( CPUFamily.ARM, 0x0008),
- /** ARM AArch64 (64bit) and AArch32 (32bit) */
- ARMv8_A( CPUFamily.ARM, 0x0010),
- /** PPC default */
- PPC( CPUFamily.PPC, 0x0000),
+ ARM64( CPUFamily.ARM, 0x0008, false),
+ /** ARM AArch64 (64bit) */
+ ARMv8_A( CPUFamily.ARM, 0x0010, false),
+ /** PPC 32bit default */
+ PPC( CPUFamily.PPC, 0x0000, true),
/** SPARC 32bit */
- SPARC_32( CPUFamily.SPARC, 0x0001),
+ SPARC_32( CPUFamily.SPARC, 0x0001, true),
/** SPARC 64bit */
- SPARCV9_64(CPUFamily.SPARC, 0x0002),
+ SPARCV9_64(CPUFamily.SPARC, 0x0002, false),
/** MIPS 32bit */
- MIPS_32( CPUFamily.MIPS, 0x0001),
+ MIPS_32( CPUFamily.MIPS, 0x0001, true),
/** MIPS 64bit */
- MIPS_64( CPUFamily.MIPS, 0x0002),
- /** Itanium default */
- IA64( CPUFamily.IA64, 0x0000),
- /** PA_RISC2_0 */
- PA_RISC2_0(CPUFamily.PA_RISC, 0x0001);
+ MIPS_64( CPUFamily.MIPS, 0x0002, false),
+ /** Itanium 64bit default */
+ IA64( CPUFamily.IA64, 0x0000, false),
+ /** PA_RISC2_0 64bit */
+ PA_RISC2_0(CPUFamily.PA_RISC, 0x0001, false);
public final int id;
public final CPUFamily family;
+ public final boolean is32Bit;
- CPUType(final CPUFamily type, final int id){
+ CPUType(final CPUFamily type, final int id, final boolean is32Bit){
this.family = type;
this.id = id;
+ this.is32Bit = is32Bit;
}
public CPUFamily getFamily() { return family; }
@@ -170,8 +172,6 @@ public class Platform extends PlatformPropsImpl {
private static final MachineDescription machineDescription;
- private static final boolean is32Bit;
-
/** <code>true</code> if AWT is available and not in headless mode, otherwise <code>false</code>. */
public static final boolean AWT_AVAILABLE;
@@ -244,7 +244,6 @@ public class Platform extends PlatformPropsImpl {
}
}
machineDescription = md;
- is32Bit = machineDescription.is32Bit();
}
private Platform() {}
@@ -340,6 +339,22 @@ public class Platform extends PlatformPropsImpl {
}
/**
+ * Returns true if this JVM/ARCH is 32bit.
+ * <p>Shortcut to {@link #getCPUType()}.{@link CPUType#is32Bit is32Bit}</p>
+ */
+ public static boolean is32Bit() {
+ return CPU_ARCH.is32Bit; // used very often
+ }
+
+ /**
+ * Returns true if this JVM/ARCH is 64bit.
+ * <p>Shortcut to !{@link #getCPUType()}.{@link CPUType#is32Bit is32Bit}</p>
+ */
+ public static boolean is64Bit() {
+ return !CPU_ARCH.is32Bit; // used very often
+ }
+
+ /**
* Returns the ABI type.
* <p>
* In case of {@link CPUFamily#ARM}, the value is determined by parsing the <i>Elf Headers</i> of the running VM.
@@ -412,24 +427,6 @@ public class Platform extends PlatformPropsImpl {
}
/**
- * Returns true if this JVM/ARCH is 32bit.
- * <p>Shortcut to {@link #getMachineDescription()}.{@link MachineDescription#is32Bit() is32Bit()}</p>
- */
- public static boolean is32Bit() {
- // return Platform.machineDescription.is32Bit();
- return Platform.is32Bit; // used very often
- }
-
- /**
- * Returns true if this JVM/ARCH is 64bit.
- * <p>Shortcut to {@link #getMachineDescription()}.{@link MachineDescription#is32Bit() is64Bit()}</p>
- */
- public static boolean is64Bit() {
- // return Platform.machineDescription.is64Bit();
- return !Platform.is32Bit; // used very often
- }
-
- /**
* Returns the MachineDescription of the running machine.
*/
public static MachineDescription getMachineDescription() {
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 93ef696..7e5ce51 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -100,7 +100,7 @@ public class JavaEmitter implements GlueEmitter {
private PrintWriter javaWriter; // Emits either interface or, in AllStatic mode, everything
private PrintWriter javaImplWriter; // Only used in non-AllStatic modes for impl class
private PrintWriter cWriter;
- private final MachineDescription machDescJava = MachineDescription.StaticConfig.X86_64_UNIX.md;
+ private final MachineDescription machDescJava = MachineDescription.StaticConfig.LP64_UNIX.md;
private final MachineDescription.StaticConfig[] machDescTargetConfigs = MachineDescription.StaticConfig.values();
protected final static Logger LOG = Logger.getLogger(JavaEmitter.class.getPackage().getName());
diff --git a/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java b/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java
index e3ed7c2..9d1a293 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/StructLayout.java
@@ -69,7 +69,7 @@ public class StructLayout {
final MachineDescription dbgMD;
if( GlueGen.debug() ) {
- dbgMD = MachineDescription.StaticConfig.X86_64_UNIX.md;
+ dbgMD = MachineDescription.StaticConfig.LP64_UNIX.md;
System.err.printf("SL.__: o %03d, s %03d, t %s{%d}%n", curOffset.computeSize(dbgMD), 0, t, t.getNumFields());
} else {
dbgMD = null;
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java
index 32f48a6..63890a1 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/Type.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java
@@ -112,7 +112,7 @@ public abstract class Type implements Cloneable {
{
long _mdSize = -1;
try {
- _mdSize = size.computeSize(MachineDescription.StaticConfig.X86_64_UNIX.md);
+ _mdSize = size.computeSize(MachineDescription.StaticConfig.LP64_UNIX.md);
} catch (final Exception e) {}
mdSize = _mdSize;
}