diff options
author | Sven Gothel <[email protected]> | 2015-02-02 00:22:29 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-02-02 00:22:29 +0100 |
commit | 7db9df61142694965b50f2e0553d4c9e5668439b (patch) | |
tree | 411c69a61d0f693acd55a65f458a2d2b75b84db8 /src/java/com/jogamp/gluegen/JavaConfiguration.java | |
parent | 234819d531cdf20842cd0b3302935b187b2012d6 (diff) |
Bug 1126 - Remove static query requirement of MachineDescriptor, find matching StaticConfig at runtime; Fix PPC (Bug 1056) and MIPSLE (Bug 1014) issues.
Currently the StaticConfig is being queried
via the key[OSType, CPUType ..]
as pre-determined by Java properties or the ELF parser.
This adds complication to maintain different platforms
and the key query might not even be sufficient.
The MachineDescriptor's StaticConfig only purpose shall be
to speed-up native data size and offset/alignment retrieval.
This is done by using the StaticConfig index within
all StaticConfig[]s as a lookup-index for the precomputed
struct's size and offset tables.
+++
Solution:
Rename: MachineDescriptor -> MachineDataInfo
Rename: MachineDescriptorRuntime -> MachineDataInfoRuntime
After having defined os.and.arch (OSType, CPUType and ABIType)
w/ the optional help of the now self containing ELF Reader (Bug 1125),
the native gluegen-rt library gets loaded enabling JNI methods.
It is satisfactory to retrieve MachineDataInfo
at runtime w/ JNI and find the matching/compatible StaticConfig.
Only in case none is found, the program needs to abort.
Otherwise the found MachineDataInfo.StaticConfig and MachineDataInfo
are stored for further use (see above).
This removes above complication and key to StaticConfig mapping.
New platforms simply need to add a new unique entry into the
StaticConfig[] table.
++
Also fixes Bug 1056 (PPC), thanks to tmancill [@] debian [.] org,
and Bug 1014 (MIPSLE), thanks to Dejan Latinovic.
Parts of the patch for Bug 1014 from Dejan Latinovic are included.
also solved by this change set.
Diffstat (limited to 'src/java/com/jogamp/gluegen/JavaConfiguration.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaConfiguration.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java index 3924ec2..346920d 100644 --- a/src/java/com/jogamp/gluegen/JavaConfiguration.java +++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java @@ -54,7 +54,7 @@ import com.jogamp.gluegen.cgram.types.*; import java.util.logging.Logger; -import jogamp.common.os.MachineDescriptionRuntime; +import jogamp.common.os.MachineDataInfoRuntime; import static java.util.logging.Level.*; import static com.jogamp.gluegen.JavaEmitter.MethodAccess.*; import static com.jogamp.gluegen.JavaEmitter.EmissionStyle.*; @@ -166,7 +166,7 @@ public class JavaConfiguration { private final Map<String, String> structPackages = new HashMap<String, String>(); private final List<String> customCCode = new ArrayList<String>(); private final List<String> forcedStructs = new ArrayList<String>(); - private final Map<String, String> structMachineDescriptorIndex = new HashMap<String, String>(); + private final Map<String, String> structMachineDataInfoIndex = new HashMap<String, String>(); private final Map<String, String> returnValueCapacities = new HashMap<String, String>(); private final Map<String, String> returnValueLengths = new HashMap<String, String>(); private final Map<String, List<String>> temporaryCVariableDeclarations = new HashMap<String, List<String>>(); @@ -650,12 +650,12 @@ public class JavaConfiguration { * <p> * If undefined, code generation uses the default expression: * <pre> - * private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal(); + * private static final int mdIdx = MachineDataInfoRuntime.getStatic().ordinal(); * </pre> * </p> */ - public String returnStructMachineDescriptorIndex(final String structName) { - return structMachineDescriptorIndex.get(structName); + public String returnStructMachineDataInfoIndex(final String structName) { + return structMachineDataInfoIndex.get(structName); } /** @@ -1123,8 +1123,8 @@ public class JavaConfiguration { readTemporaryCVariableAssignment(tok, filename, lineNo); // Warning: make sure delimiters are reset at the top of this loop // because TemporaryCVariableAssignment changes them. - } else if (cmd.equalsIgnoreCase("StructMachineDescriptorIndex")) { - readStructMachineDescriptorIndex(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("StructMachineDataInfoIndex")) { + readStructMachineDataInfoIndex(tok, filename, lineNo); // Warning: make sure delimiters are reset at the top of this loop // because StructMachineDescriptorIndex changes them. } else if (cmd.equalsIgnoreCase("ReturnValueCapacity")) { @@ -1525,14 +1525,14 @@ public class JavaConfiguration { } } - protected void readStructMachineDescriptorIndex(final StringTokenizer tok, final String filename, final int lineNo) { + protected void readStructMachineDataInfoIndex(final StringTokenizer tok, final String filename, final int lineNo) { try { final String structName = tok.nextToken(); String restOfLine = tok.nextToken("\n\r\f"); restOfLine = restOfLine.trim(); - structMachineDescriptorIndex.put(structName, restOfLine); + structMachineDataInfoIndex.put(structName, restOfLine); } catch (final NoSuchElementException e) { - throw new RuntimeException("Error parsing \"StructMachineDescriptorIndex\" command at line " + lineNo + + throw new RuntimeException("Error parsing \"StructMachineDataInfoIndex\" command at line " + lineNo + " in file \"" + filename + "\"", e); } } |