Commit Graph

2462 Commits

Author SHA1 Message Date
Joel Dice
cac2d2cac5 fix race condition in monitorRelease
There was an unlikely but dangerous race condition in monitorRelease
such that when a thread released a monitor and then tried to notify
the next thread in line, the latter thread might exit before it can be
notified.  This potentially led to a crash as the former thread tried
to acquire and notify the latter thread's private lock after it had
been disposed.

The solution is to do as we do in the interrupt and join cases: call
acquireSystem first and thereby either block the target thread from
exiting until we're done or find that it has already exited, in which
case nothing needs to be done.

I also looked at monitorNotify to see if we have a similar bug there,
but in that case the target thread can't exit without first acquiring
and releasing the monitor, and since we ensure that no thread can
execute monitorNotify without holding the monitor, there's no
potential for a race.
2010-12-16 16:46:25 -07:00
Joel Dice
6c53068f4f clear Thread::stack before vmInvoke_safeStack in compile-arm.S 2010-12-15 10:41:18 -07:00
Joel Dice
d5d414aa52 update gprIndex when switching to stack-based argument passing
This is necessary when passing a 64-bit value on 32-bit ARM since
otherwise we risk using a register for the following argument instead
of the stack.
2010-12-10 14:01:22 -07:00
Joel Dice
64b11f0c64 close ZipFile when done with it in Zip test 2010-12-10 01:20:44 -07:00
Joel Dice
651ad20fc3 fix GC safety bugs 2010-12-09 22:17:57 -07:00
Joel Dice
2d0ff83653 fix assertion abort when generating boot image
In makeCodeImage, we were passing zero to Promise::Listener::resolve,
which would lead to an assertion error if the address of the code
image was further from the base of the address space (i.e. zero) than
could be spanned by a jump on the target architecture.  Since, in this
context, we immediately overwrite the value stored, we may pass
whatever we want to this function (we're only calling it so we can
retrieve the location of the value in the image), and the code image
pointer is a better choice for the above reason.
2010-12-09 21:09:48 -07:00
Joel Dice
3d49173b0b avoid inifinite recursion if java.lang.Object is missing; refactoring
When trying to create an array class, we try to resolve
java.lang.Object so we can use its vtable in the array class.
However, if Object is missing, we'll try to create and throw a
ClassNotFoundException, which requires creating an array to store the
stack trace, which requires creating an array class, which requires
resolving Object, etc..  This commit short-circuits this process by
telling resolveClass not to create and throw an exception if it can't
find Object.

While doing the above work, I noticed that the implementations of
Classpath::makeThrowable in classpath-avian.cpp and
classpath-openjdk.cpp were identical, so I made makeThrowable a
top-level function.

Finally, I discovered that Thread.setDaemon can only be called before
the target thread has been started, which allowed me to simplify the
code to track daemon threads in the VM.
2010-12-09 19:38:12 -07:00
Joel Dice
cda1ae81c8 protect networking and time zone classes from obfuscation/shrinking 2010-12-08 21:39:20 -07:00
Joel Dice
d381ece44b rework loadLibrary interception to handle builtins properly 2010-12-08 21:38:16 -07:00
Joel Dice
bc2b4802ec add todo comment to classpath-common.h 2010-12-08 21:36:02 -07:00
Joel Dice
544cebb7f0 use MyBlock::start when computing constant pool offsets, not MyBlock::offset 2010-12-07 18:17:41 -07:00
Joel Dice
314bdae80d freeze BranchEvent operands to ensure they aren't clobbered as temporaries 2010-12-07 18:16:19 -07:00
Joel Dice
378f7086b7 fix return address code offset calculation on ARM
We have to be careful about how we calculate return addresses on ARM
due to padding introduced by constant pools interspersed with code.
When calculating the offset of code where we're inserting a constant
pool, we want the offset of the end of the pool for jump targets, but
we want the offset just prior to the beginning of the pool (i.e. the
offset of the instruction responsible for jumping past the pool) when
calculating a return address.
2010-12-07 15:57:11 -07:00
Joel Dice
61fe7efd6d specify -mmacosx-version-min=10.4 for 32-bit OS X builds 2010-12-07 09:33:07 -07:00
Joel Dice
d408040b2c add trademark notice to readme.txt and specify Proguard 4.6 in example 2010-12-05 20:39:17 -07:00
Joel Dice
a5742f5985 update copyright years 2010-12-05 20:21:09 -07:00
Joel Dice
a2f14dce6f increment version number to 0.4 2010-12-05 20:20:48 -07:00
Joel Dice
800463bb45 clarify Continuations.java JavaDoc comment 2010-12-05 18:56:19 -07:00
Joel Dice
019e032f4f add boot-javahome.cpp
This should have been included in an earlier commit.
2010-12-05 18:04:25 -07:00
Joel Dice
ceae61a6a8 fix misspelling in openjdk.pro 2010-12-05 18:01:38 -07:00
Joel Dice
1271678d41 various fixes for embedded resource loading in OpenJDK build 2010-12-05 17:40:50 -07:00
Joel Dice
b5ae66b10f update openjdk.pro to get avian-swt-examples working 2010-12-05 17:40:18 -07:00
Joel Dice
d19cab9ac9 update readme.txt to cover OpenJDK and ARM support 2010-12-05 17:38:10 -07:00
Joel Dice
b1b433b63a remove debug code from GetMethodID 2010-12-05 17:37:13 -07:00
Joel Dice
c7b73e23ae protect classes in avian package from obfuscation 2010-12-03 18:24:19 -07:00
Joel Dice
0bd6822ed7 fix PowerPC build 2010-12-03 13:42:13 -07:00
Joel Dice
768fc7cf7d fix posix openjdk-src build 2010-12-01 20:31:54 -07:00
Joel Dice
3d56a3211d revert part of earlier comment involving setDaemon and runJavaThread
The code added to runJavaThread was unecessary and harmful since it
allowed the global daemon thread count to become permanently
out-of-sync with the actual number of daemon threads.
2010-12-01 20:29:56 -07:00
Joel Dice
4a3b5ad1ab fix windows cross openjdk-src build
This mainly involves some makefile ugliness to work around bugs in the
native Windows OpenJDK code involving conflicting static and
not-static declarations which GCC 4.0 and later justifiably reject but
MSVC tolerates.
2010-12-01 20:05:22 -07:00
Joel Dice
af8e043989 fix windows cross build 2010-12-01 16:05:56 -07:00
Joel Dice
7164743009 fix Array.makeObjectArray regression 2010-12-01 15:44:09 -07:00
Joel Dice
8cbe323d52 update Avian_avian_Machine_dumpHeap to reflect classpath refactoring 2010-12-01 15:43:27 -07:00
Joel Dice
1722b68277 handle case of not-yet-started thread in setDaemon 2010-12-01 15:42:46 -07:00
Joel Dice
d00f4c5390 fix BufferedInputStream.read to not read more than specified length 2010-12-01 15:41:55 -07:00
Joel Dice
84520cde51 Merge remote branch 'origin/master' into openjdk 2010-12-01 14:40:58 -07:00
Joel Dice
6d1ad1e5ba intercept UnixFileSystem.checkAccess calls to handle embedded java home case 2010-12-01 13:40:43 -07:00
Joel Dice
8f06ac402a compare library to RTLD_DEFAULT, not zero in JVM_FindLibraryEntry
Although RTLD_DEFAULT is zero on Linux, it's not on OS X.
2010-12-01 09:54:29 -07:00
Joel Dice
6a7f651f79 fix OS X openjdk-src build 2010-12-01 08:33:00 -07:00
Joel Dice
4b1b3e032b add new array classes to classloader map upon creation
We were already doing this for non-array classes; we need to do it for
all classes or else risk creating duplicates.
2010-11-30 20:27:36 -07:00
Joel Dice
cca9a5ee0b build ProcessImpl_md.c as part of Windows openjdk-src build 2010-11-30 20:27:07 -07:00
Joel Dice
21a54cdf55 set java.protocol.handler.pkgs on Windows as well as Posix
Also, fix cut-and-paste error where we should have called
fieldAddendum instead of methodAddendum.
2010-11-30 20:25:48 -07:00
Joel Dice
1d9489a76e fix a couple of 64-bit-op-on-32-bit-system bugs
We weren't properly handling the case where a 64-bit value is
multipled with itself in multiplyRR, leading to wrong code.  Also,
addCarryCR didn't know how to handle constants more than 8-bits wide.
2010-11-30 16:58:51 -07:00
Joel Dice
19dca18cd0 disable Math.abs(long) intrinsic on 32-bit x86
It never worked and caused the compiler to crash instead due to an
impossible-to-fulfill constraint.
2010-11-30 11:36:18 -07:00
Joel Dice
8de53aeacc fix Windows openjdk-src build 2010-11-29 17:39:41 -07:00
Joel Dice
70a36c05b9 fix time==0 case in Unsafe.park and implement JVM_DumpThreads
Also, set name field on system threads for OpenJDK build to avoid NPEs
in Thread.getName.
2010-11-27 16:27:30 -07:00
Joel Dice
3cba6edf1f print path elements if DebugFind == true in parsePath 2010-11-27 16:27:22 -07:00
Joel Dice
0f04865e93 implement -jar option in main.cpp 2010-11-27 14:46:07 -07:00
Joel Dice
1f6ccbf5b7 meant to add my_net_util.c in previous commit 2010-11-27 14:45:38 -07:00
Joel Dice
adc5c95214 fix GC safety bug in resolveClass 2010-11-27 14:44:49 -07:00
Joel Dice
d4708907ea fix non-openjdk build 2010-11-27 11:31:34 -07:00