Commit Graph

2463 Commits

Author SHA1 Message Date
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
Joel Dice
9e1ee7e974 enable Linux PowerPC build 2011-02-26 12:45:22 -07:00
Joel Dice
944e223335 use wait/notifyAll too avoid starvation in Trace test
Thread.yield is not enough to ensure that the tracing thread does not
starve the test thread on some QEMU VMs, so we use wait/notifyAll to
make sure both threads have opportunities to run and the test actually
finishes.
2011-02-26 12:40:54 -07:00
Joel Dice
a4c4d54cdd restore MyThread::ip in MyThread::CallTrace destructor
This is necessary to ensure we can unwind the stack properly on ARM
after returning from a recursive invocation of vmInvoke.
2011-02-25 11:04:23 -07:00
Joel Dice
42fd021acf various fixes for running Tomcat on the OpenJDK build 2011-02-25 08:17:15 -07:00
Joel Dice
f1255c8fd8 use pthread_sigmask instead of sigprocmask to unblock signals
Apparently, the behavior of the latter is undefined in multithreaded
processes.
2011-02-25 08:13:25 -07:00
Joel Dice
cd3d1800c4 fix return of double values from Java to native code on ARM 2011-02-22 19:46:15 -07:00
Joel Dice
6025ba736e fix return of double values from Java to native code on PowerPC 2011-02-22 19:16:54 -07:00
Joel Dice
8b9cdc13ba fix return of double values from Java to native code on x86_32 2011-02-22 19:13:38 -07:00
Joel Dice
783c6092af remove dead break statement from translateInvokeResult 2011-02-22 19:12:41 -07:00
Joel Dice
45674efcea implement JVM_SetSockOpt and Unsafe.getLongVolatile 2011-02-22 18:37:42 -07:00
Joel Dice
bead78d982 wrap primitive return values using correct types in Method.invoke
The VM uses Integer and Long instances internally to wrap the results
of dynamic method invocations, but Method.invoke should use the
correct, specific type for the primitive (e.g. Character for char).
2011-02-22 17:54:56 -07:00
Joel Dice
6014cb93b1 fix Mac OS PowerPC cross build
While we can use Linux's jni.h to cross compile the i386 Mac OS build,
that doesn't work for the PowerPC one.  Now we use the proper
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers/jni.h
from the sysroot instead.
2011-02-22 15:45:46 -07:00
Joel Dice
d520514a87 add support for Class-Path manifest attribute
This attribute, found in some JAR manifests, indicates additional JARs
and/or directories to append to the classpath.  Tomcat in particular
uses it.
2011-02-21 16:05:28 -07:00
Joel Dice
addaf09aa3 use run function to call boot in JNI_CreateJavaVM
boot may throw an exception, which we can't allow to propagate beyond
the JNI_CreateJavaVM call.
2011-02-21 16:00:20 -07:00
Joel Dice
e20daca297 use link register to determine return address when appropriate in getStackTrace
On PowerPC and ARM, we can't rely on the return address having already
been saved on the stack on entry to a thunk, so we must look for it in
the link register instead.
2011-02-21 15:25:52 -07:00
Joel Dice
20f4510122 fix ARM stack unwinding (part 2)
My previous attempt at this was incomplete; it did not address
Java->native->Java->native call sequences, nor did it address
continuations.  This commit takes care of both.
2011-02-20 13:49:40 -07:00
Joel Dice
98e74f66e9 fix compile-arm.S's vmJumpAndInvoke 2011-02-20 20:30:56 +00:00
Joel Dice
ab3929d411 fix PowerPC and ARM bootimage builds
This requires reducing HeapCapacity and CodeCapacity back to 128MB and
30MB respectively.  I had set them to larger values to test
non-ProGuard'ed OpenJDK bootimage builds, which naturally needed a lot
more space.  However, such builds aren't really useful in the real
world, and the compiler currently can't handle jumps or calls spanning
more than the maximum size of an immediate branch offset on ARM or
PowerPC, so I'm lowering them back down to more realistic values.
2011-02-20 05:59:36 +00:00
Joel Dice
45a2469672 abort if allocation fails in heap.cpp's allocate 2011-02-20 05:59:13 +00:00
Joel Dice
8a88c6ee3c fix ARM stack unwinding
We can't rely on the C++ compiler to save the return address in a
known location on entry to each function we might call from Java
(although GCC 4.5 seems to do so consistently, which is why I hadn't
realized the unwinding code was relying on that assumption), so we
must store it explicitly in MyThread::ip in each thunk.  For PowerPC
and x86, we continue saving it on the stack as always, since the
calling convention guarantees its location relative to the stack
pointer.
2011-02-19 20:52:14 -07:00
Joel Dice
b2268143f5 preserve statck alignment in arm.S's vmRun 2011-02-20 02:48:56 +00:00
Joel Dice
5524b9a5a3 fix OS X 10.4 build
pthread_mach_thread_np is not declared in pthread.h on OS X unless
_XOPEN_SOURCE and _POSIX_C_SOURCE are undefined.
2011-02-19 14:36:48 -07:00
Joel Dice
00307b9b30 fix Mac OS MySystem::visit and MySystem::Thread::interrupt implementations
On Mac OS, signals sent using pthread_kill are never delivered if the
target thread is blocked (e.g. acquiring a lock or waiting on a
condition), so we can't rely on it and must use the Mach-specific
thread execution API instead to implement Thread.getStackTrace.

For Thread.interrupt, we must not only use pthread_kill but also
pthread_cond_signal to ensure the thread is woken up.
2011-02-19 14:20:02 -07:00
Joel Dice
2ce549d3f8 fix GC safety bug in jvmGetClassInterfaces 2011-02-19 14:07:45 -07:00
Joel Dice
19c443254d Merge remote branch 'oss/r0.5' into dev 2011-02-17 17:41:21 -07:00
Joel Dice
1ca8a20731 enable i686-apple-darwin8 cross compile 2011-02-17 17:39:41 -07:00
Joel Dice
c761ac6717 fix Subroutine test for use with OpenJDK build 2011-02-17 14:28:51 -07:00