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/common/util | |
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/common/util')
-rw-r--r-- | src/java/com/jogamp/common/util/IOUtil.java | 8 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/VersionUtil.java | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java index 1fd7cbf..c773b21 100644 --- a/src/java/com/jogamp/common/util/IOUtil.java +++ b/src/java/com/jogamp/common/util/IOUtil.java @@ -54,7 +54,7 @@ import jogamp.common.os.PlatformPropsImpl; import com.jogamp.common.net.AssetURLContext; import com.jogamp.common.net.Uri; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.os.MachineDescription; +import com.jogamp.common.os.MachineDataInfo; import com.jogamp.common.os.Platform; public class IOUtil { @@ -160,14 +160,14 @@ public class IOUtil { * @throws IOException */ public static int copyStream2Stream(final InputStream in, final OutputStream out, final int totalNumBytes) throws IOException { - return copyStream2Stream(Platform.getMachineDescription().pageSizeInBytes(), in, out, totalNumBytes); + return copyStream2Stream(Platform.getMachineDataInfo().pageSizeInBytes(), in, out, totalNumBytes); } /** * Copy the specified input stream to the specified output stream. The total * number of bytes written is returned. * - * @param bufferSize the intermediate buffer size, should be {@link MachineDescription#pageSizeInBytes()} for best performance. + * @param bufferSize the intermediate buffer size, should be {@link MachineDataInfo#pageSizeInBytes()} for best performance. * @param in the source * @param out the destination * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown @@ -246,7 +246,7 @@ public class IOUtil { if( initialCapacity < avail ) { initialCapacity = avail; } - final MachineDescription machine = Platform.getMachineDescription(); + final MachineDataInfo machine = Platform.getMachineDataInfo(); ByteBuffer data = Buffers.newDirectByteBuffer( machine.pageAlignedSize( initialCapacity ) ); final byte[] chunk = new byte[machine.pageSizeInBytes()]; int chunk2Read = Math.min(machine.pageSizeInBytes(), avail); diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java index aef3fc2..6fec8fa 100644 --- a/src/java/com/jogamp/common/util/VersionUtil.java +++ b/src/java/com/jogamp/common/util/VersionUtil.java @@ -59,7 +59,7 @@ public class VersionUtil { // environment sb.append("Platform: ").append(Platform.getOSType()).append(" / ").append(Platform.getOSName()).append(' ').append(Platform.getOSVersion()).append(" (").append(Platform.getOSVersionNumber()).append("), "); sb.append(Platform.getArchName()).append(" (").append(Platform.getCPUType()).append(", ").append(Platform.getABIType()).append("), "); - sb.append(Runtime.getRuntime().availableProcessors()).append(" cores"); + sb.append(Runtime.getRuntime().availableProcessors()).append(" cores, ").append("littleEndian ").append(PlatformPropsImpl.LITTLE_ENDIAN); sb.append(Platform.getNewline()); if( Platform.OSType.ANDROID == PlatformPropsImpl.OS_TYPE ) { sb.append("Platform: Android Version: ").append(AndroidVersion.CODENAME).append(", "); @@ -67,7 +67,7 @@ public class VersionUtil { sb.append(Platform.getNewline()); } - Platform.getMachineDescription().toString(sb).append(Platform.getNewline()); + Platform.getMachineDataInfo().toString(sb).append(Platform.getNewline()); // JVM/JRE sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(" (").append(Platform.getJavaVersionNumber()).append("u").append(PlatformPropsImpl.JAVA_VERSION_UPDATE).append("), VM: ").append(Platform.getJavaVMName()); |