aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/common
Commit message (Collapse)AuthorAgeFilesLines
* Clock/Platform: Add currentMillis() analogue to currentNanos(), returning ↵Sven Gothel2023-10-061-6/+35
| | | | | | | | current monotonic milliseconds **since start of this application** Also added TSPrinter, a simple millisecond timestamp prepending `print*()` wrapper for a {@link PrintStream}. Test coverage via TestClock01.
* GlueGen Struct [1]: Enhance com.jogamp.common.nio.* to serve a most ↵Sven Gothel2023-06-162-14/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | native-free-code Struct-Code generation Recfactored all NIO buffer utils to Buffers, i.e. buffer <-> address, memcpy, strnlen, etc Buffers: - Added copyNativeToDirectByteBuffer(..), allowing to copy a native memory slice into a direct buffer. - Added typeNameToBufferClass(String) and sizeOfBufferElem(Class<? extends Buffer>) - Completed slize2<Type>(..) buffer-mapping methods - Exposure of safe getDirectByteBuffer(..) w/ null-check (package private) Added NativeBuffer.storeDirectAddress(..), allowing to write the array address into a native buffer (struct, etc), allowing to referencing the ElementBuffer (linear array of elements) and PointerBuffer (array of pointer). Hint: This can be read via PointerBuffer.wrap(..).get(0) Added ElementBuffer (a NativeBuffer) mapping an array of elements, completing native abstraction next to PointerBuffer (array of pointer). ElementBuffer can dereference an existing element-array by native address via ElementBuffer.derefPointer(..). Views of its content can be directly accessed via ElementBuffer.slice(..). +++ These utilities and buffer abstractions will allow to reuse code and simplify the GlueGen struct get/set implementations and help to reduce native code injection.
* Clock: Consider return code on failed native clock_gettime(..) call; Add ↵Sven Gothel2023-03-071-21/+153
| | | | | | | | | | | | | Win32 clock_gettime() implementation. Consider return code on failed native clock_gettime(..) call - Return Instant.EPOCH for all Instant variations (essentially 0) - Return 0 for all 'long' variations (ms, ns) Add Win32 clock_gettime() implementation. - Source: https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-libraries/winpthreads/src/clock.c - Public Domain within mingw-w64, included here to simplify linkage. - Tested on Win10 64bit w/ TestTextRendererNEWT00, all values are OK
* Clock: Rename currentTimeNanos() -> currentNanos() as it represents the ↵Sven Gothel2023-03-061-1/+1
| | | | duration since module startup and not time.
* Fix Clock for performance counter: Add currentTimeNanos() since module ↵Sven Gothel2023-03-061-17/+83
| | | | | | | | | | | startup, retrievable via getMonotonicStartupTime(). (performance) Settings two long fields in getMonotonicTime() and creating Instant and using Duration for high-frequency counter is too expensive. currentTimeNanos() subtracts the startup time from the current monotonic time and returns the resulting duration in nanoseconds, which lasts for 292 years since module startup. This satisfies performance counter requirements.
* Add Clock, implementing proper monotonic and wallclock time using Instant ↵Sven Gothel2023-03-062-25/+94
| | | | | | | | | (sec + nsec), currentTimeMillis() is also monotonic now, reused by Platform. Dropped Platform.currentTimeMicros() Clock and its implementation was copied from jaulibs, a spin-off from Direct-BT. The implementation uses `clock_gettime(CLOCK_MONOTONIC, &t)` and is considered safe and high-performant as it avoids a kernel call via VDSO (GNU/Linux).
* Bug 1363: Java 11: Recognize Java9+ ..; Support JEP 178 static linkage ↵Sven Gothel2019-06-171-0/+42
| | | | | | | | | | | | | | | | | | | | | libgluegen-rt[.so] -> libgluegen_rt[.so|.a] Recognize Java9+ .. - Recognize new Java9+ version string as of JEP 223 - Avoid Classpath's private findLibrary call +++ Support JEP 178 static linkage (OpenJDK 1.8) - Need to change native library basename: libgluegen-rt[.so] -> libgluegen_rt[.so|.a] since the dash '-' is not supported in a ANSI-c function name. - Added 'JNI_OnLoad_gluegen_rt' to recognize statical linked JNI code - Added JNI_VERSION_1_8 to jni/jni.h
* Bug 1126 - Remove static query requirement of MachineDescriptor, find ↵Sven Gothel2015-02-021-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* GlueGen: Cleanup static generated JNI code (fix method names)Sven Gothel2015-01-301-0/+5
| | | | | Symbol could not be found w/ Android: UnixDynamicLinkerImpl_JNI.c::Java_jogamp_common_os_UnixDynamicLinkerImpl_dlerror
* Minor edits: space, final qualifier; setenv-build-*: Add generic JDK locationSven Gothel2014-06-171-1/+2
|
* Fix Bug 865: Safari >= 6.1 [OSX]: May employ xattr on 'com.apple.quarantine' ↵Sven Gothel2013-10-231-0/+39
| | | | | | | | | on 'PluginProcess.app' - IOUtil.getTempDir(..): Don't test executable caps on OSX for java_io_tmpdir - JarUtil.extract(..): Issue native fixNativeLibAttribs(..) on OSX for native library files, i.e. remove xattr 'com.apple.quarantine'
* Platform: Add accurate currentTimeMillis() and currentTimeMicros() native ↵Sven Gothel2013-08-151-0/+25
| | | | methods, based on 'gettimeofday(..)'
* Moved JVMUtil to private package; Invoke JVMUtil.initSingleton() from ↵Sven Gothel2011-09-231-2/+2
| | | | Platform static init after loading native library.
* Android: Remove native (fake) detectionSven Gothel2011-07-241-9/+0
|
* Android integration / cross-test ; Enhance PlatformSven Gothel2011-07-241-0/+9
| | | | | | | | | | | - android minor build fix - started dex'ing (gluegen-rt.apk, more to come for full junit tests) - android remote dalvikvm launch works (crosstest-java-android-armv7-rel.sh) - android detection, incl version (reflection) - Platform: - Add JAVA_VM_NAME and JAVA_VM_RUNIME - OSType maybe ANDROID, where the OS name (String) is Linux ! (ok ?)
* Added scripts and custom cpp-tasks to build on android-armv7lRami Santina2011-07-211-0/+1
|
* Cleanup: Platform CPU enum, MachineDescription,Sven Gothel2011-07-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Platform: - enum CPUFamily is part of CPUType - DALVIK -> ANDROID - ARM: ARM + ARMv[567] MachineDescription - self contained - static size/alignment Config (enum) for unix32, unix64, win32, win64 and armeabi - add 'long double' - Removed MachineDescription32Bit, MachineDescription64Bit - createStatic(..) uses OS/CPU to fetch best match if not at runtime FIXES: JavaEmitter's struct-emit: Proper 32/64 struct sizes TODO: StructAccessor's mapping to <Type>Buffer w/ index os sizeof(<Type>) doesn't work, since offset may not be multiple of sizeof(<Type>)! i.e. typedef struct { int8_t bits1; // +1 - 0 // +3 (p32) int32_t id; // +4 - 4 int8_t bits2; // +1 - 8 // +3 (p32) - int64_t long0; // +8 - 12 so "longBuffer.get(<type-sized index>)" is invalid, but "byteBuffer.getLong(<byte index>)" must be done. The actual impl. doesn't matter, hence dropping the other nio type mappings is good.
* GlueGen: Alignment Cleanup ..Sven Gothel2011-07-171-40/+11
| | | | | | | | | | - SizeThunk - rename: compute -> computeSize - add: computeAlignment - merge types: char -> int8, short -> int16 - 'int' and 'long' may differ -
* GlueGen proper size / alignment of primitive and compound types usage [1/2] ↵Sven Gothel2011-07-172-29/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Preparation. Currently GlueGen fails for type long (size) and some alignments (see package.html). - The size and alignment values shall be queried at runtime. - Compound alignment needs to follow the described natural alignment (also @runtime). - - Build - add Linux Arm7 (EABI) - junit test - added compound/struct tests, pointing out the shortcomings of current impl. - package.html - Added alignment documentation - remove intptr.cfg - add GluGen types int8_t, int16_t, uint8_t, uint16_t - move MachineDescription* into runtime - Platform - has runtime MachineDescription - moved size, .. to MachineDescription - use enums for OSType, CPUArch and CPUType defined by os.name/os.arch, triggering exception if os/arch is not supported. This avoids Java String comparison and conscious os/arch detection. - MachineDescription: - compile time instances MachineDescription32Bits, MachineDescription64Bits - runtime queried instance MachineDescriptionRuntime - correct size, alignment, page size, ..
* remove warningsSven Gothel2011-06-102-2/+3
|
* Platform: Add getPageSize()Sven Gothel2011-06-071-0/+19
|
* Fix C / JNI compilation: Add/use javah, recompile if out of date,Sven Gothel2011-06-072-0/+4
|
* Importing files from JOGL (preserving history)Sven Gothel2010-04-191-1/+1
| | | | | | | | | git mv src/nativewindow/native/JVM_Tool.c src/native/common/JVM_Tool.c git mv src/nativewindow/classes/com/jogamp/nativewindow/impl/NativeLibLoaderBase.java src/java/com/jogamp/common/jvm/JNILibLoaderBase.java git mv src/nativewindow/classes/com/jogamp/nativewindow/impl/jvm/JVMUtil.java src/java/com/jogamp/common/jvm/JVMUtil.java git mv src/nativewindow/classes/com/jogamp/nativewindow/impl/NWReflection.java src/java/com/jogamp/common/util/ReflectionUtil.java Adding own JogampRuntimeException and Debug class
* Moving imported files to proper placeSven Gothel2010-04-191-0/+51
|
* introduced com.jogamp.common.{nio,os} packages and moved some classes.Michael Bien2010-03-312-2/+2
|
* http://www.jogamp.org/bugzilla/show_bug.cgi?id=392Sven Gothel2010-03-302-0/+10
| | | | | | | | | | | | | | | | | | 32bit/64bit values and arrays are misrepresented - PointerBuffer: Adding methods PointeRBuffer referenceBuffer(int index, Buffer data) PointeRBuffer referenceBuffer(Buffer data) Buffer getReferencedBuffer(int index) Buffer getReferencedBuffer() Adding a reference of a given direct Buffer to this pointer buffer, and retrieving a previously referenced direct Buffer. This allows a more convenient handling of PointerBuffer with the user API's ..
* Merge CPU to PlatformSven Gothel2010-03-281-1/+1
|
* renamed com.sun.gluegen.runtime -> com.jogamp.gluegen.runtime.Michael Bien2010-03-271-1/+1
|
* Fix: Native CPU 32/64 bit detection; Tested on CVM/J2SEsg2158892009-07-281-0/+10