Commit Graph

2413 Commits

Author SHA1 Message Date
Joel Dice
1ca8a20731 enable i686-apple-darwin8 cross compile 2011-02-17 17:39:41 -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
Joel Dice
78a80534e6 ensure stack remains aligned in compile-x86.S
If AVIAN_USE_FRAME_POINTER is not defined, the caller of vmInvoke will
calculate a frame size which assumes vmInvoke does not push rbp on the
stack before allocating the frame.  However, vmInvoke pushes rbp
reguardless, so we need to adjust the frame size to ensure the stack
remains aligned.
2011-02-01 11:01:28 -07:00
Joel Dice
d4c39e07a2 update readme.txt to reflect that 64-bit Windows does not use an underscore prefix for symbols 2011-02-01 08:48:30 -07:00
Joel Dice
a0a8c554d5 add a couple of test cases to NullPointer.java 2011-02-01 08:40:56 -07:00
Joel Dice
8ed2bb9dbb remove FrameEvent code from x86.cpp
That code was unused and will be unecessary until we add proper
support for unwinding through tail calls in nextFrame, at which point
it may be reinstated in some form.
2011-02-01 08:38:59 -07:00
Joel Dice
635f5ba7e6 avoid garbage collection from e.g. divideLong thunk
It is dangerous to initiate a GC from a thunk like divideLong (which
was possible when allocating a new ArithmeticException to signal
divide-by-zero) since we don't currently generate a GC root frame map
for the return address of the thunk call.  Instead, we use the backup
heap area if there is room, or else throw a pre-allocated exception
instead.
2011-01-31 21:18:55 -07:00
Joel Dice
2a5e556e09 Merge branch 'master' into r0.5 2011-01-31 15:54:46 -07:00
Joel Dice
9ed1ffff35 implement syncInstructionCache for ARM
Like, PowerPC, ARM has an instruction cache which must be manually
flushed if/when we compile a new method.  This commit updates
syncInstructionCache to use GCC's builtin __clear_cache routine.
2011-01-31 15:39:59 -07:00
Joel Dice
69af8a13aa add Thread.getStackTrace test 2011-01-31 09:55:58 -07:00
Joel Dice
69501a05b8 remove UNUSED modifier from parameter which is now used 2011-01-30 19:29:53 -07:00
Joel Dice
309c1cac6d fix PowerPC tails and continuations builds 2011-01-30 19:11:23 -07:00
Joel Dice
8a46ee92b4 use thunks for integer division on PowerPC
PowerPC doesn't generate traps for divides-by-zero, so we defer to
thunks which do explicit checks.
2011-01-30 14:28:02 -07:00
Joel Dice
fff51bad06 more progress on PowerPC build
Also, hide frame mapping for stack unwinding (which is still
incomplete) in x86.cpp, since no other platform needs it.
2011-01-30 14:14:57 -07:00
Joel Dice
1187613ad0 partial fix for PowerPC build 2011-01-29 20:04:29 -07:00
Joel Dice
8064b702c0 use parentheses around VA_LIST value in x86.h 2011-01-29 20:03:28 -07:00
Joel Dice
6296350d76 fix ARM tails=true and continuations=true builds 2011-01-29 18:09:47 -07:00