| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
src/java/com/jogamp/common/os/Platform.java
src/junit/com/jogamp/common/util/TestTempJarCache.java
(re-injected that api-doc of addNativeJarLibsImpl)
|
| |
| |
| |
| | |
of the method.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
|
|/ |
|
|
|
|
| |
types / removed them)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and string (code generation)
Enhance compound access as delivered by Bug 1022,
to also generate accessors (getter and setter) for
array, pointer and string types.
Allow configuration of array length either via
their internal size (c-header) or config 'ReturnedArrayLength'.
'ReturnedArrayLength' allows specifying a java expression.
Canonical field names of compounds are _now_ specified as
follows for configuration entries:
COMPOUND.FIELD
e.g.
StructA.fieldB
Also allow configuration of pointer fields to be treated as
referenced arrays via 'ReturnedArrayLength'.
Further, allow specifying 'pointer fields' as String values
via 'ReturnsString' configuration.
++++
Implementation details:
- handle above described accessor features
- enhance JavaDoc for generated accessors
- generate native JNI compound and string accessor on demand
- encapsule accessor code generation in their own methods
- enhance exception messages
- enhance type verbosity in debug mode
- verbose debug output via GlueGen.debug()
Tests:
- Features covered by test1.[ch]
and Test1p1JavaEmitter and Test1p2ProcAddressEmitter
- Validated compilation and unit tests for modules:
- joal
- jogl (minor config changes req.)
- jocl (minor config changes req.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C-Enum values for array length
- Parser (HeaderParser.g): Support using C-Enum values for array length specification
- Will throw an exception if enum identifier is unknown or exceeds int-size
- Add StructEmitter supports for compound-arrays
- Add Debug stderr verbose info:
- Struct Emitter prefix 'SE.' - to analyze emitting struct fields (offset+size and accessors)
- Struct Layout prefix 'SL.' - to analyze memory layout (based on MachineDescription.StaticConfig.X86_64_UNIX)
Tested via test1.[ch] BaseClass ..
|
|
|
|
| |
call-by-value' JavaMethodBindingEmitter, array may still require NIO handling, also consider NIO array length.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Completing commit c3054a01990e55ab35756ea23ab7d7c05f24dd37
by allowing passing compound arrays via 'call-by-value.
- Creating linear temp heap, copying NIO values into it
and passing to C function.
Copy-back if not 'const', see below.
- Respect 'const' qualifier to skip write-back of
temp heap passed to C function
- See tag: // FIXME: Compound and Compound-Arrays
for code changes and validation of completeness
- triggers for compound arrays are:
- javaType.isArrayOfCompoundTypeWrappers()
- type.isArray()
- simplified const query by c-type: FunctionEmitter.isBaseTypeConst(ctype)
+++
Tests: Added call-by-value to test1.[ch] binding test!
|
|
|
|
| |
to 2.2.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
returning struct instance
'compound call-by-value' is not efficient.
However, to allow mapping APIs utilizing passing small structs
as arguments and return values - this feature has been added.
+++
To return the struct value, native code needs to
allocate a NIO ByteBuffer and copy the data.
The stack return value can be dismissed afterwards and the
NIO buffer is returned.
We include this functionality for all generated [impl] classes,
native method:
'static jobject JVMUtil_NewDirectByteBufferCopy(JNIEnv *env, void * source_address, jlong capacity)'
(See: 'JavaEmitter.initClassAccessCode')
Since this code requires knowledge of java classes and methods,
for which a reference needs to be acquired, a static initialization method
has been introduced for all generated [impl] classes:
'private static native boolean initializeImpl();'
Per default the this method will be called in the new
static initializer block of the class,
which can be supressed via the configuration element:
'ManualStaticInit <class-name>'
'ManualStaticInit' can be used to issue the 'initializeImpl()'
call in a custom static initializer written by the user.
However, at the time 'initializeImpl()' gets called
the JNI native library must have been loaded, of course!
+++
- See tag: // FIXME: Compound call-by-value
for code changes and validation of completeness
Trigger for compond call-by-value in CMethodBindingEmitter is:
!cArgType.isPointer() && javaArgType.isCompoundTypeWrapper()
Trigger for compond call-by-value in JavaEmitter is:
t.isCompound()
+++
Further more we do tolerate 'javaType.isCPrimitivePointerType()',
i.e. adding comments for offset/size and field entries,
which are all NOP.
This allows to utilize the remaining fields of the native structure.
+++
Tests: Added call-by-value to test1.[ch] binding test!
|
|
|
|
| |
Dumper.dumpFullStats(..)
|
|
|
|
| |
dump diffs per diff-type
|
|
|
|
| |
branch): Using direct regexp for excludes
|
|
|
|
|
|
|
| |
Refactor base semjar unit test class into
com.jogamp.junit.util.VersionSemanticsUtil, part of new gluegen-test-util.jar.
The new gluegen-test-util.jar shall be used by all other modules to test versioning.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TestVersionSemantics adds testing of semantic versioning
of 2.1.5 gluegen-rt.jar against the current version within a unit test.
Currently we expect BACKWARD_COMPATIBLE_USER
and need to toggle this to NON_BACKWARD_COMPATIBLE,
if actually perfoming non compatible major or minor version changes.
The latter is allowed right now, since we increment from 2.1 -> 2.2!
- Added https://github.com/jeluard/semantic-versioning semver.jar (Apache License Version 2.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
generated_class_user due to Java8 issues.
Java8's annotation processor as embedded within javac does not allow
referencing not-yet existing generated classes in a class source code
which will produce these generated classes via the annotation process.
Example:
+++
import com.jogamp.gluegen.structgen.CStruct;
public class Lala {
@CStruct(name="RenderingConfig", header="TestStruct01.h")
public RenderingConfig config;
}
+++
Above example illustrates that the type 'RenderingConfig'
does not exist at time of processing the annotation.
The type will be created via the annotation process itself.
Even though we pass '-proc:only', i.e. skip java compilation,
Java8's annotation processing via javac fails in such case.
We see this as a bug within javac's annotation processing itself!
+++
This workaround splits the annotation process and using the class as
generated by the former.
To allow this to work, CStruct receives a new field 'jname'
allowing to enforce the java-name of the structure
using a dummy field type like boolean.
@CStruct(name="RenderingConfig", jname="RenderingConfig", header="TestStruct01.h")
public boolean dummy;
Further more CStruct can be annotated on the package, i.e. 'package-info.java',
avoiding the dependency problem altogether.
To support multiple header files and types,
'CStructs' has been introduced using an array of 'CStruct'.
@CStructs({@CStruct(name="RenderingConfig", header="TestStruct01.h"), @CStruct(name="Pixel", header="TestStruct02.h")})
package com.jogamp.gluegen.test.junit.structgen;
Tests:
- Build w/ Java7 and Java8
- Validated 'major version 50' (Java 6) class files (OK)
|
|
|
|
| |
recipe (inactive); Misc ..
|
| |
|
|
|
|
|
|
|
|
| |
Fix 1: Only emit "int * _offsetHandle = NULL" if it will be used, to
avoid unused variable warning. Fix 2: Add "unsigned" to typecasts in C
function calls when needed to avoid implicit typecast warning. This
commit also adds a unit test for a method that uses an "unsigned char
**" parameter, to mimic the JOCL clCreateProgramWithBinary() function
that caused the typecast warnings.
|
|
|
|
| |
readUInt32(..) must return long due to EOF
|
|
|
|
| |
-> 'toUInt32Long', add 'uint32LongtoInt'
|
|
|
|
| |
conversion functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We already have several locations where bitstream operations are required and
partially implemented (JPEG decoder, media parsing, ..)
as well as endian related conversion (elf parser, ..).
Create a versatile Bitstream class allowing:
- Utilize I/O operations on I/O streams, buffers and arrays
- Consider MSBfirst / LSBfirst mode
- Linear bit R/W operations
- Bulk R/W operations w/ endian related type conversion
- Allow mark/reset and switching streams and input/output mode
- Optimized operations
Complete set of unit tests included, covering hopefully all cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
converting to file-path or URI (Windows UNC / share host)
Note: Authority for 'file-scheme' URI's is used on Windows to denote the host of the shared resource -> UNC
Following methods of IOUtil didn't consider the authority for file-scheme URI:
'URL toURL(final URI uri)'
'String decodeURIToFilePath(final String uriPath)'
'String decodeURIIfFilePath(final URI uri)'
Further more, the patterns 'patternSingleFS' and 'patternSingleBS'
converted multiple '\' '/' to one replacement.
However, we should not change the separator count and replace them one-by-one.
TestIOUtilURIHandling:
- Added shared-file-host 'filehost' test cases to file URIs and plain file path tests.
- Passed on Unix and Windows.
Added 'make/scripts/test-win32-smb_share.bat'
- Testing actual windows share usage
- Passed on Windows
|
|
|
|
|
|
|
| |
Only use IOUtil.encodeToURI() if required,
i.e. 'new URI(String)' but not 'new URI(scheme, ...)' since the latter already encodes the path.
TestIOUtilURIHandling.test00BasicCoding() validates above findings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
IOUtil.decodeURIToFilePath(..) for native usage.
Refine comments, API doc.
toURL(..): Apply space conversion, decodeFromURI(..), on file-scheme path,
ensuring decoded space.
++
Add decodeURIToFilePath(String uriPath) and decodeURIToFilePath(URI uri)
Both methods shall simplify decoding a file-URI for native platform usage.
Tested in TestIOUtilURIHandling
+++
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Netbeans's JarURLStreamHandler
- 'URL IOUtil.toURL(URI)'
- Needs to encode the file-path portion on Windows(*) if exists.
The file-path here shall only be encoded as follows:
- backslash -> slash
- ensure starting with slash
(*) We perform above action for all OS,
if 'false == File.separator.equals("/")'
- Added high verbosity in DEBUG mode to easy debugging
for future cases ..
- Cleanup URI/URL unit tests, i.e. split URLCompositionTest into:
- TestIOUtilURICompose
- TestIOUtilURIHandling (Now covers Bug 857 as well)
- TestUrisWithAssetHandler
- TestURIQueryProps
Tested all unit tests manually on GNU/Linux and Windows w/ JRE 7u45
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'os.and.arch' libraries]
JNILibLoaderBase.addNativeJarLibsImpl(..):
If the modules's jar file contains the folder 'natives/<os.and.arch>/'
we assume a big-fat jar and attempt to load all native libraries from the same.
The test for above folder is performed via the class ClassLoader's getResource(..)
and is considered inexpensive.
If the folder exists and native libraries could be loaded, the method returns successfull.
Otherwise, the 'slim' jar file is attempted to be loaded, even if such folder exist.
|
|
|
|
| |
native URI root and jar file.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'@FixMethodOrder(MethodSorters.NAME_ASCENDING)' annotation
Issue: Java7 unit test order is no more predictable
Fix: junit 4.11 performs a determined (not defined default) test order.
Additionally user can force ascending method name test order
Produced a drop-in junit.jar / junit-source.zip replacement, which includes
- junit version version 4.11
- hamcrest-core version 1.3
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
simple approach; Split 'grow' into 'growEmpty' and 'growFull'
- java.lang.reflect.Array can instantiate an array w/ a given array-type and length
- array-type is Class<? extends T[]>
- We either deduct the array-type via array.getClass(), or pass it (ctor for empty Ringbuffer).
- Split 'growBuffer(T[] newElements, int amount, ..)' into:
- 'growEmptyBuffer(T[] newElements)'
- 'growFullBuffer(int amount)'
Allowing a more clean API w/ simpler semantics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SyncedRingbuffer and lock-free LFRingbuffer.
SyncedRingbuffer is moved from JOGL to GlueGen, and generalized w/ common interface Ringbuffer
to allow testing diff. implementations.
- Added Ringbuffer.AllocEmptyArray factory interface, allowing to pass a constructor
to construct the generic array.
- Added functionality is growBuffer(..), allowing to either grow a full or empty buffer,
using Ringbuffer.AllocEmptyArray.
- Removed explicit 'clearRef' at get*(..), always clear the taken reference for better
interface generalization.
- Added LFRingbuffer, exposing lock-free get*(..) and put*(..) methods
using the 'Always Keep One Slot Open' pattern using the read/write index as barriers only.
- Ctor's copy an optional passed user array into the internal array,
utilizing Ringbuffer.AllocEmptyArray.
- Added unit tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
access (2)
- Completes 23341a2df2d2ea36784a16fa1db8bc7385351a12
- Replace 'DynamicLinker' interface w/ well documented one
- All DynamicLinker methods are now considered secure, i.e.:
- open/lookup and close utilize reference counting on handle via a hash map.
- lookupSymbol(..) and close(..) impl. validate the passed library handle
whether it's retrieved via open*.
This is the fast path, not that expensive.
- lookupSymbolGlobal(..) performs
Check acccess of 'new RuntimePermission("loadLibrary.*")' if SecurityManager is installed.
This is the slow path.
- DynamicLibraryBundleInfo now reflects the security requirements,
i.e. whether priviledged access is needed.
|
|
|
|
|
|
| |
result w/ OS specific File.separatorChar
Take 3 (duh!): JRE impl. varies .. i.e. plain URL w/o JAR path differs from URL w/ JAR scheme on Windows .. well.
|
|
|
|
|
|
| |
result w/ OS specific File.separatorChar
The JAR entry shall stay untouched, i.e. separator is platform independent '/'.
|
|
|
|
| |
w/ OS specific File.separatorChar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
compatible w/ file scheme.
Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823).
The URI encoded path cannot be read by File I/O (if file scheme), since the latter
requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space).
The encoded URL is produced if calling 'uri.toURL()' and hence
the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'.
Tested w/
- synthetic URI/URL coposition (unit test)
- manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl.
+++
Misc.:
- 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)'
++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and privileged access)
This review focuses on how we perform permission checks,
or better - do we circumvent some assuming full privileges ?
Some native methods do need extra permission validation, i.e. loading native libraries.
Further more AccessController.doPrivileged(..) shall not cover generic code
exposing a critical feature to the user.
Further more .. we should rely on the SecuritManager, i.e. AccessControlContext's
'checkPermission(Permission)' code to comply w/ fine grained permission access.
It is also possible to have full permission w/o having any certificates (-> policy file).
+++
We remove implicit AccessController.doPrivileged(..) from within our trusted code
for generic methods, like Property access, temp. files.
+++
SecurityUtil:
- Remove 'getCommonAccessControlContext(Class<?> clz)',
which returned a local AccessControlContext for later restriction
if the passed class contains all certificates as the 'trusted' GlueGen class has.
- Simply expose convenient permission check methods relying on
SecurityManager / AccessControlContext.
PropertyAccess:
- 'protected static void addTrustedPrefix(..)' requires AllPermissions if SecurityManager is installed.
- Remove implicit doPrivileged(..) triggered by passed AccessControlContext instance,
only leave it for trusted prefixes.
IOUtil:
- Remove all doPrivileged(..) - Elevation shall be performed by caller.
DynamicLinker:
- 'public long openLibraryLocal(..)' and 'public long openLibraryGlobal(..)'
may throw SecurityException, if a SecurityManager is installed and the dyn. link permission
is not granted in the calling code.
Implemented in their respective Unix, OSX and Windows manifestation.
Caller has to elevate privileges via 'doPrivileged(..) {}' !
+++
Tests:
- Property access
- File access
- Native library loading
Manual Applet test (unsigned, but w/ SecurityManager and policy file):
> gluegen/test/applet
Applet has been tested w/ signed JAR w/ Firefox and Java7 on GNU/Linux as well.
Manual Application test (unsigned, but w/ SecurityManager and policy file):
com.jogamp.junit.sec.TestSecIOUtil01
- Run w/ SecurityManager and policy file:
- gluegen/scripts/runtest-secmgr.sh
- Run w/o SecurityManager:
- gluegen/scripts/runtest.sh
|
|
|
|
| |
to remove DNS Lookups etc ..
|
|
|
|
| |
whitespace tokenizer); String match: Store end-of-match and flag defined components.
|
|
|
|
|
|
|
|
|
|
|
|
| |
test array offset working correct.
The 'carray' pointer returned from GetPrimitiveArrayCritical(..) is moved about the array offset
and used in ReleasePrimitiveArrayCritical(..) to release the pinpointed memory.
Even though this 'is' a bug by violating the _sparse_ specification, Hotspot impl. doesn't use the value at all (NOP)
and hence this code didn't produce an error since .. (Same w/ Dalvik).
A followup commit will fix this issue.
|
|
|
|
| |
address cleanup (32bit)
|
|
|
|
|
|
| |
PointerBuffer, since referenced memory-size is arch dependent
Added extensive PointerBuffer unit tests w/ new mapping in generated test class.
|
|
|
|
|
|
|
| |
blocking exceptions to be shown.
Exceptions occuring on non blocking off-thread tasks shall at least be made visible
while not allowed to crash the system.
|