Commit Graph

2428 Commits

Author SHA1 Message Date
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
Joel Dice
2216b22ccb add lib/currency.data to javahome-files on Windows
This file is needed by OpenJDK for both Windows and Posix systems.
2011-02-17 14:11:37 -07:00
Joel Dice
59183c7821 fix subroutine stack mapping bug leading to crashes during GC
The stack mapping code was broken for cases of stack slots being
reused to hold primitives or addresses within subroutines after
previously being used to hold object references.  We now bitwise "and"
the stack map upon return from the subroutine with the map as it
existed prior to calling the subroutine, which has the effect of
clearing map locations previously marked as GC roots where
appropriate.
2011-02-16 14:29:57 -07:00
Joel Dice
c743140e08 add new subroutine test
This test covers the case where a local stack slot is first used to
store an object reference and later to store a subroutine return
address.  Unfortunately, this confuses the VM's stack mapping code;
I'll be working on a fix for that next.

The new test requires generating bytecode from scratch, since there's
no reliable way to get javac to generate the code we want.  Since we
already had primitive bytecode construction code in Proxy.java, I
factored it out so we can reuse it in Subroutine.java.
2011-02-16 11:41:33 -07:00
Joel Dice
0bbd11e9be return false if javaThread is null in Thread::Runnable::interrupted
This field may be null if the thread is in the process of being
attached to the VM.
2011-02-15 21:44:27 -07:00
Joel Dice
86c48f3ff6 handle null p->javaThread in addThread and removeThread
These functions may be called when p->javaThread is null, in which
case we must not try to set the threadPeer field.
2011-02-15 08:47:48 -07:00
Joel Dice
6461e0a1af fix SetEvent assert
SetEvent returns nonzero on success, so the assert was backwards.
2011-02-14 18:57:47 -07:00
Joel Dice
6e19f4dcca use vmRun to execute implementations of JVM_MonitorWait/Notify/NotifyAll
These methods can all throw exceptions, so they must be run using
vmRun to avoid unwinding past the JVM entry points.
2011-02-14 18:55:11 -07:00
Joel Dice
2f727dc3ce move java.net.PlainDatagramSocketImpl to posix-only openjdk-headers-classes
This class is not present in the Windows build of OpenJDK 6u20.
2011-02-14 18:53:47 -07:00
Joel Dice
468edb97d2 work around GCC name mangling bug
It seems that older versions of GCC (4.0 and older, at least) generate
assembly files with duplicate symbols for function templates which
differ only by the attributes of the templated types.  Newer versions
have no such problem, but we need to support both, hence the
workaround in this commit of using a dedicated, non-template "alias"
function where we previously used "cast<alias_t>".
2011-02-14 11:47:59 -07:00
Joel Dice
2e0770b0f3 fix MSVC build
MSVC doesn't support __attribute__((__packed__)), but both it and GCC
support pack pragmas, so that's what we'll use.
2011-02-14 08:48:44 -07:00
Joel Dice
8d50d0fd76 fix aliasing bug in util.cpp
We use a template function called "cast" to get raw access to fields
in in the VM.  In particular, we use this function in util.cpp to
treat reference fields as intptr_t fields so we can use the least
significant bit as the red/black flag in red/black tree nodes.
Unfortunately, this runs afoul of the type aliasing rules in C/C++,
and the compiler is permitted to optimize in a way that assumes such
aliasing cannot occur.  Such optimization caused all the nodes in the
tree to be black, leading to extremely unbalanced trees and thus slow
performance.

The fix in this case is to use the __may_alias__ attribute to tell the
compiler we're doing something devious.  I've also used this technique
to avoid other potential aliasing problems.  There may be others
lurking, so a complete audit of the VM might be a good idea.
2011-02-11 21:57:27 -07:00
Joel Dice
cb7dc1aeef fix various regressions due to 0.5 work 2011-02-11 21:13:11 -07:00
Joel Dice
eae79fdb34 clean up MINIDUMP_EXCEPTION_INFORMATION mess in windows.cpp
The last two commits were meant to work around a supposed bug in
mingw-w64's dbghelp.h, but closer inspection reminded me that we're
not using dbghelp.h at all; legacy mingw doesn't have it, so we had to
declare the structures we needed ourselves based on the MSDN
documentation.  What that documentation doesn't mention is that
MINIDUMP_EXCEPTION_INFORMATION is subject to a special, packed layout,
which we must represent using the __packed__ attribute.
2011-02-11 17:18:53 -07:00
Joel Dice
5c88f77412 fix aliasing warning introduced in last commit 2011-02-10 13:33:21 -07:00
Joel Dice
8e57639ff5 use packed version of MINIDUMP_EXCEPTION_INFORMATION
dbghelp.dll expects that MINIDUMP_EXCEPTION_INFORMATION has a packed
layout and will crash if it doesn't (at least on 64-bit systems), but
as of this writing mingw-w64's version is not declared to be so.
Hence this workaround.
2011-02-10 11:54:00 -07:00
Joel Dice
8fdd547922 Merge branch 'oss-master' into dev 2011-02-08 19:08:41 -07:00
Joel Dice
a8645b6b2d fix BufferedInputStream.read regression
In commit 7fffba2, I had modified BufferedInputStream.read to keep
reading until in.available() <= 0 or an EOF was reached, but neglected
to update the offset into the destination buffer after each read.
This caused the previously-read data to be overwritten.  This commit
fixes that regression.
2011-02-08 18:56:25 -07:00
Joel Dice
c2cbecbaf0 switch to using mingw-w64 tools for 32-bit Windows cross build
This allows us to use the same tools for 32-bit and 64-bit builds.
2011-02-08 10:37:54 -07:00
Joel Dice
b72473f651 ensure stack alignment in powerpc.S's vmRun 2011-02-07 19:44:59 -07:00
Joel Dice
a63909b818 update VA_LIST definition for various platforms
Apparently, 64-bit Linux and OS X are the only ones where we must
define VA_LIST(x) as (x) instead of (&x).
2011-02-07 16:28:17 -07:00
Joel Dice
6e79e98d18 increase default stack size to 128KB
64KB was too small for many apps.  SWT in particular can use a lot of
stack space, especially on 64-bit systems.
2011-02-07 11:45:39 -07:00
Joel Dice
12ab935597 fix 32-bit vmRun stack alignment 2011-02-02 16:06:09 -07:00
Joel Dice
85bd36c75a fix 64-bit Windows implementation of vmRun 2011-02-02 15:34:18 -07:00
Joel Dice
cdb75ef6d7 define VA_LIST(x) (&x) on Windows
Each platform and architecture defines the va_list type differently;
on some we can treat it as a pointer and on others we must treat it as
a non-pointer.  Turns out Windows is one of the latter.
2011-02-02 15:11:34 -07:00
jet
5f9a2a1b9b Added -marm flag to ARM cflags, as we don't support Thumb. 2011-02-02 10:02:15 -07:00
Joel Dice
51a1081adc remove unused Heap::Client::outOfMemory method
The heap-dump-on-OOM feature has been moved to the collect function.
2011-02-02 08:46:20 -07:00
Joel Dice
4d5aeb5ab2 disable debug logging in compile.cpp 2011-02-02 08:32:40 -07:00
Joel Dice
5586f8133c update readme.txt to reflect new test classpath 2011-02-02 08:31:52 -07:00
Joel Dice
cce89c8ddd fix MSVC build 2011-02-02 08:15:25 -07:00
Joel Dice
ac49eb8c9a return empty array instead of null from interpret.cpp's getStackTrace
This avoids a crash elsewhere when we try to use the result.
2011-02-01 19:51:00 -07:00
Joel Dice
79247a9885 ensure native method frame always popped in interpret.cpp's invokeNative
If a native method using the fast calling convention throws an
exception, we need to make sure the frame for that method is popped
before handling the exception.
2011-02-01 19:23:25 -07:00
Joel Dice
c4ededda83 add progress indicators to Trace test
Also, add a yield call to the tracing thread so it doesn't monopolize
the CPU.
2011-02-01 18:14:53 -07:00
Joel Dice
aa9c887fb4 implement Thread.yield 2011-02-01 18:14:32 -07:00
Joel Dice
9ef9d9619d avoid deadlock due to entering active state before running destroyJavaVM
We risked deadlock when waiting for other non-daemon threads to exit
since they could not exit without entering exclusive state, which
required waiting for all other threads to go idle.
2011-02-01 17:45:43 -07:00
Joel Dice
132f188ff0 fix cut-and-paste error in jnienv.cpp
release0 should call release, not acquire.
2011-02-01 14:23:53 -07:00