Commit Graph

2490 Commits

Author SHA1 Message Date
Joel Dice
6bd9ec3735 enable link time optimization when using GCC 4.6 or greater 2011-03-26 14:44:08 -06:00
Joel Dice
01b3f1cb93 fix GCC 4.6 unused variable warnings 2011-03-26 14:43:03 -06:00
Joel Dice
d02d7c9846 fix IllegalAccessException in LazyLoading test 2011-03-26 12:00:40 -06:00
Joel Dice
3fd6af152f fix Windows and GCC 3.4 builds 2011-03-26 11:45:33 -06:00
Joel Dice
ba0cc803a6 implement various JVM_* methods
This includes a proper implementation of JVM_ActiveProcessorCount, as
well as JVM_SetLength and JVM_NewMultiArray.  Also, we now accept up
to JNI_VERSION_1_6 in JVM_IsSupportedJNIVersion.
2011-03-26 11:15:52 -06:00
Joel Dice
3dd091c67a implement jar and file URL stream handlers 2011-03-25 19:14:21 -06:00
Joel Dice
31eb047391 handle redundant, unreachable gotos in JIT compiler
I recently encountered a Batik JAR with a method containing a
redundant goto which confused the JIT compiler because it was refered
to in the exception handler and line number tables despite being
unreachable.  I don't know how such code was generated, but this
commit ensures the compiler can handle it.
2011-03-25 19:13:10 -06:00
Joel Dice
639ef50079 handle null caller in JVM_GetCallerClass 2011-03-25 19:13:10 -06:00
Joel Dice
7b4b43e119 implement JVM_CompileClass and JVM_CompileClasses stubs
These don't currently do anything but return false.
2011-03-25 19:13:10 -06:00
Joel Dice
20baef4e69 implement File.toString 2011-03-25 19:12:47 -06:00
Joel Dice
838cf9fdd1 avoid calling doCollect recursively
We must not allocate heap objects from doCollect, since it might
trigger a GC while one is already in progress, which can cause trouble
when we're still queuing up objects to finalize, among other things.
To avoid this, I've added extra fields to the finalizer and cleaner
types which we can use to link instances up during GC without
allocating new memory.
2011-03-25 19:11:38 -06:00
Joel Dice
b9f8188544 don't try to release monitor if we get OOME when trying to acquire it
We can't blindly try release the monitors for all synchronized methods
when unwinding the stack since we may not have finished acquiring the
most recent one when the exception was thrown.
2011-03-25 18:40:51 -06:00
Joel Dice
3e93d5d337 fix Value::home integer overflow
A method with a large number of local variable slots may imply offsets
larger than a int8_t can represent, so we now use an int16_t instead.
2011-03-25 18:27:02 -06:00
Joel Dice
960bd28296 preallocate monitor node in monitorWait
If we don't preallocate the memory we need to reacquire the lock after
we finish waiting, we risk an OOME which may unwind the stack into
code which assumes we still have acquire the lock successfully.
2011-03-25 18:21:15 -06:00
Joel Dice
d928d695ff try harder in low memory situations in Zone::allocate
Instead of giving up when the backing allocator's tryAllocate method
returns null, we switch to the allocate method to show we mean
business.  This makes use of zones more robust under low memory
situations since it allows us to exceed the soft memory ceiling when
the only alternative is to abort.
2011-03-25 18:14:34 -06:00
Joel Dice
61552b6b8a check for and handle instances of sun.misc.Cleaner during GC
OpenJDK uses an alternative to Object.finalize for resource cleanup in
the form of sun.misc.Cleaner.  Normally, OpenJDK's
java.lang.ref.Reference.ReferenceHandler thread handles this, calling
Cleaner.clean on any instances it finds in its "pending" queue.
However, Avian handles reference queuing internally, so it never
actually adds anything to that queue, so the VM must call
Cleaner.clean itself.
2011-03-19 15:10:52 -06:00
Joel Dice
7004c0ddf3 various fixes and additions to increase app compatiblity
The main changes here are:

  * fixes for runtime annotation support

  * proper support for runtime generic type introspection

  * throw NoClassDefFoundErrors instead of ClassNotFoundExceptions
    where appropriate
2011-03-17 21:42:15 -06:00
Joel Dice
8a28578ef5 don't defer to previous handler in signal handler
It isn't necessarily safe or desireable to call the previous handler
even if it's non-null, so we ignore it entirely except to reinstate it
when unregistering our own handler.
2011-03-17 21:32:37 -06:00
Joel Dice
86733a25f4 increase executable area size to 30MB
Big applications can exceed the 16MB limit we previously used.
Increasing this above 30MB (if/when desired) will require changes to
the ARM and PowerPC JIT code to work around immediate branch encoding
limits on those platforms,
2011-03-17 21:24:35 -06:00
Joel Dice
023e1d93d5 return null for non-array classes in JVM_GetComponentType 2011-03-17 09:41:52 -06:00
Joel Dice
0922dd3429 swap NativeLine and UnknownLine values to match Sun's convention 2011-03-17 09:41:23 -06:00
Joel Dice
366dfc009c fix mode=stress thinko and GC safety issue in machine.cpp 2011-03-17 08:49:41 -06:00
Joel Dice
3f87129cbc use correct names for primitive classes in type generator 2011-03-17 08:48:47 -06:00
Joel Dice
110e2e1d52 fix putstatic code order regression in compile.cpp
Also, ensure that class is initialized before getting or setting
static fields in lazy loading code.
2011-03-17 08:46:46 -06:00
Joel Dice
44020482e5 fix GC safety bugs in classpath-openjdk.cpp 2011-03-17 08:43:01 -06:00
Joel Dice
7152c3fdb3 handle volatile fields properly in JNI Get/Set methods
This commit ensures that we use the proper memory barriers or locking
necessary to preserve volatile semantics for such fields when accessed
or updated via JNI.
2011-03-15 19:34:00 -06:00
Joel Dice
453ceb42ab implement lazy class/field/method resolution in JIT compiler
Unlike the interpreter, the JIT compiler tries to resolve all the
symbols referenced by a method when compiling that method.  However,
this can backfire if a symbol cannot be resolved: we end up throwing
an e.g. NoClassDefFoundError for code which may never be executed.
This is particularly troublesome for code which supports multiple
APIs, choosing one at runtime.

The solution is to defer to stub code for symbols which can't be
resolved at JIT compile time.  Such a stub will try again at runtime
to resolve the needed symbol and throw an appropriate error if it
still can't be found.
2011-03-15 18:07:13 -06:00
Joel Dice
48e569c65a add tail call test 2011-03-15 17:51:32 -06:00
Joel Dice
e6cf992af7 uncomment testStatic call in DefineClass
I had commented it out for debugging purposes and forgot to uncomment
it.
2011-03-15 17:33:09 -06:00
Joel Dice
a3a7a7a2de use getcwd instead of getenv("PWD") to get working directory
PWD is not always set, whereas getcwd is more reliable.
2011-03-15 17:33:09 -06:00
Joel Dice
e5ecb5b549 add optional avian.error.log system property
This property may be used to specify a file name to use for printing
stack traces for unhandled exceptions.  The default is stderr.
2011-03-15 17:27:17 -06:00
Joel Dice
51c8d7511a fix OS X PowerPC parameter passing
We were not always placing parameters in the correct stack positions
in the PowerPC implementations of dynamicCall and vmNativeCall.  In
particular, the first stack slot used to hold a parameter depends on
the sizes and types of the preceding parameters which are passed in
registers.
2011-03-15 17:20:44 -06:00
Joel Dice
93b3d3d8a6 fix IpPromise::resolved
This method was returning true when it shouldn't have, and this led to
an assertion failure when we actually tried to get the promise's
value.
2011-03-15 17:17:26 -06:00
Joel Dice
78790a0f68 fix OpenJDK JCE support
This primarily required additions to classpath-openjdk.cpp to
intercept ZipFile, ZipEntry, and JarFile native methods to consult
embedded encryption policy jars when required.
2011-03-04 16:55:31 -07:00
Joel Dice
874890e317 assert exception parameter is not null in throw_ 2011-03-04 16:01:50 -07:00
Joel Dice
8fb9523de5 don't try to print null exception trace in printTrace
It is possible to create an Exception with no stack trace by
overriding Throwable.fillInStackTrace, so we can't assume any given
instance will have one.
2011-03-04 15:58:10 -07:00
Joel Dice
4db79b9be6 implement various sun.misc.Unsafe and JVM_* methods 2011-03-02 08:35:45 -07:00
Joel Dice
fc45cf767b implement JNIEnv::GetSuperclass; use vm::run in JNIEnv::GetObjectClass 2011-03-02 08:29:44 -07:00
Joel Dice
16b936a600 mention Linux/PowerPC support in readme.txt 2011-03-01 15:32:14 -07:00
Joel Dice
7a91074a32 fix OS X cross-arch build regression 2011-03-01 12:20:49 -07:00
Joel Dice
6d3975adb7 fix OS X PowerPC continuations=true build regression 2011-03-01 12:06:35 -07:00
Joel Dice
bb4be4de7e fix Linux/PowerPC continuations=true build 2011-03-01 11:24:44 -07:00
Joel Dice
30feba8b56 fix PowerPC tails=true stack undwinding 2011-03-01 11:01:13 -07:00
Joel Dice
8f519531d4 UseFramePointer should always be true on PowerPC
The Apple and SYSV ABIs specify that the stack/frame pointer is always
saved at the tip of the stack.
2011-03-01 10:59:00 -07:00
Joel Dice
a0962d7ab2 look for __powerpc__ as well as __POWERPC__ in jni-util.h
The former is used on GNU/Linux.
2011-02-28 16:50:17 -07:00
Joel Dice
7ad59731c0 reserve register 2 for system use on Linux/PowerPC
The SYSV ABI specifies that it be reserved.  In practice, it is used
for thread-local storage.
2011-02-28 16:48:58 -07:00
Joel Dice
25f1a9f1e8 fix Thread::exit/Thread::dispose race condition
There was a race between these two functions such that one thread A
would run dispose on thread B just before thread B finishes exit, with
the result that Thread::lock and/or Thread::systemThread would be
disposed twice, resulting in a crash.
2011-02-28 10:14:01 -07:00
Joel Dice
255fc9f9d3 handle long conditional immediate branches properly on PowerPC
Due to encoding limitations, the immediate operand of conditional
branches can be no more than 32KB forward or backward.  Since the
JIT-compiled form of some methods can be larger than 32KB, and we also
do conditional jumps to code outside the current method in some cases,
we must work around this limitation.

The strategy of this commit is to provide inline, intermediate jump
tables where necessary.  A given conditional branch whose target is
too far for a direct jump will instead point to an unconditional
branch in the nearest jump table which points to the actual target.

Unconditional immediate branches are also limited on PowerPC, but this
limit is 32MB, which is not an impediment in practice.  If it does
become a problem, we'll need to encode such branches using multiple
instructions.
2011-02-27 23:03:13 -07:00
Joel Dice
5f50226ae0 enable Linux/PowerPC cross build 2011-02-27 22:54:59 -07:00
Joel Dice
039916b519 fix incorrect offset in compile-powerpc.S 2011-02-26 17:08:08 -07:00