summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen/JavaEmitter.java
Commit message (Collapse)AuthorAgeFilesLines
* gluegen: add all missing @Override annotationsHarvey Harrison2013-10-171-0/+21
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* gluegen: remove trailing whitespaceHarvey Harrison2013-10-171-24/+24
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* ProcAddressTable: Make all handles package private, use local ↵Sven Gothel2013-06-201-1/+10
| | | | | | | | PROCADDRESS_VAR_PREFIX instance, add checkAllPermissions() for reset() and initEntry(..) - Generated ProcAddressTable's function handles are all package private - Generated ProcAddressTable's visibility can be set via 'AccessControl' config, default: public. - ProcAddressTable's reset() and initEntry(..) perform checkAllPermissions() 1st.
* GlueGen (Compile Time): Add 'CStruct' Annotation Processor (APT) to ↵Sven Gothel2013-06-141-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'gluegen' C Structs on-the-fly (2-pass actually). Convenient annotation processing (APT) hooked to 'javac' (1.6) via gluegen.jar META-INF service provider 'javax.annotation.processing.Processor' -> 'com.jogamp.gluegen.structgen.CStructAnnotationProcessor'. Am implicit APT / JAVAC would be possible, however - to have a proper process the unit test utilizes an explicit 2 pass run: <!-- Annotation Processor Only - First --> <javac destdir="${build_t.java}"> <classpath refid="junit.compile.classpath"/> <compilerarg value="-proc:only"/> <compilerarg value="-J-Djogamp.gluegen.structgen.debug"/> <compilerarg value="-J-Djogamp.gluegen.structgen.output=${build_t.gen}/classes"/> <src path="${test.base.dir}/com/jogamp/gluegen/test/junit/structgen"/> </javac> <!-- Javac Only - Second --> <javac destdir="${build_t.java}"> <classpath refid="junit.compile.classpath"/> <compilerarg value="-proc:none"/> <src path="${test.base.dir}"/> <src path="${build_t.gen}" /> </javac> Original code from Michael Bien's 'superglue' git://github.com/mbien/superglue.git, finally merged to GlueGen (as once intended). Note: The APT javac pass requires to use 'gluegen.jar' instead of 'gluegen-rt.jar' ! The 2-pass process also alows using the runtime gluegen-rt.jar and hence ensures clean namespace check at compilation.
* Fix intptr_t*, uintptr_t*, ptrdiff_t* and size_t* mapping, map them to ↵Sven Gothel2013-03-201-3/+4
| | | | | | PointerBuffer, since referenced memory-size is arch dependent Added extensive PointerBuffer unit tests w/ new mapping in generated test class.
* Minor cleanup of JavaEmitterSven Gothel2012-07-191-2/+2
|
* Fix 'NIOOnly' impl ; Use 'final' in gen. Java stubs ;Sven Gothel2012-03-221-17/+14
| | | | | | | | | | | | | | | | | | - Fix 'NIOOnly' impl - Use 'final' in gen. Java stubs ; - No null check for Buffers.isDirect(arrayArg) [required] - Clarify Buffer arg API doc (NIOOnly or NIODirectOnly) - cleaned up loop / branch (CMethodBindingEmitter) - remove unsued vars/code - Tests: - covers normal/NIOOnly/NIODirectOnly - covers passing null for array and NIO
* JavaEmitter: Fix primitive StructEmitter for non-fixed-sized (size ↵Sven Gothel2011-12-181-7/+16
| | | | | | | | | conversion, ie. 32/64 bits) An opaque type still needs to be converted to the right size (32/64 bit). In case of a conversion, respect the pointer type. This fixes bug 536 .
* Enhance ReleasePrimitiveArrayCritical: Use mode-flag JNI_ABORT if array is ↵Sven Gothel2011-10-061-1/+1
| | | | | | | | | | | | | const, ie no write-back We shall consider the C header declaration as being correct and no modification shall happen on const arrays. Tested w/ unit tests and JOGL +++ Cleanup JavaType: final immutable fields, proper CVoidPointer name
* Fix PCPP/DumpCPP: Avoid NPE ; More descriptive exception in case of non ↵Sven Gothel2011-09-031-1/+1
| | | | integer opaque in struct
* Reversed Type relocation ; Minor fixSven Gothel2011-07-211-7/+0
| | | | | | | Reversed Type relocation (commit 92d6c9dc5fa72b01703456452c60822f36c14fff) from com.jogamp.gluegen.runtime.types back to com.jogamp.gluegen.cgram.types Enabled MemoryLayoutType.setLayouted(), avoiding double layout
* GlueGen proper size / alignment of primitive and compound types usage [2/2] ↵Sven Gothel2011-07-211-206/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | - Fin MachineDesction == MD MD.StaticConfig: - enum for all supported static configs (ID -> MD) - verified at runtime: test runtime queried-MD versus static-MD, hard fail if not compatible (size/alignment) SizeThunk primitive sizes: - Add notion of fixed native size (eg. int64_t) and otherwise (eg. long) java struct 'wrappers' code generation: - single class using size/offset arrays of all MachineDescription configurations - at runtime the array idx is queried in static block - type aligment for not fixed-native-size types (SizeThunk, undef long/int) via StructAccessor junit test: - add float test - fix native code - add java (create, write) -> native (verify) test works (tested) on: linux 32/64 and windows 32/64
* FIX StructAccessor / JavaEmitter's struct-emitter: Using byte offsetsSven Gothel2011-07-201-35/+6
| | | | | | | | | | | | | | | | | | | | Problem: 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 "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. FIXES 32bit unit test, works well (static) on 32/64 bit (unix). TODO: Respect diff alignment for OS/ARCH either by offset tables for all, or runtime computing.
* Cleanup: Platform CPU enum, MachineDescription,Sven Gothel2011-07-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - Moved most types and StructLayout to runtime package:Sven Gothel2011-07-181-1/+9
| | | | | | | | | | | | | | | | | | | | | com.jogamp.gluegen.cgram.types -> com.jogamp.gluegen.runtime.types This is required for desired runtime memory layout. - Split CompoundType to StructType + UnionType - StructLayout: - Utilizing SizeThunk alignment - Alignment 1) Natural type alignment 2) Add Size 3) Trailing padding w/ largest element alignment - Only perform memory layout once for type. Status: - Unit test passes w/ static MachineDescriptor64Bit - FIXME static 32bit is faulty, uses 64bit size/alignment - TODO runtime struct layout to please all platforms w/o worrying
* GlueGen proper size / alignment of primitive and compound types usage [1/2] ↵Sven Gothel2011-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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, ..
* refactoring in common.nio public api - removed Int64BufferMichael Bien2011-04-261-2/+2
| | | | | | - removed Int64Buffer since it is no longer needed for LongBuffer emulation Signed-off-by: Sven Gothel <[email protected]>
* Renamed com.sun.gluegen -> com.jogamp.gluegenSven Gothel2010-11-061-0/+1950