Commit Graph

2726 Commits

Author SHA1 Message Date
Joel Dice
a254d20e0e improve seed generation in java.util.Random
The previous code caused frequent seed collisions for successive calls
to the no-arg constructor, even for single threaded workloads.  This
patch should avoid such collisions in both single and multi-threaded
cases.
2012-02-14 13:03:13 -07:00
Joshua Warner
a1c5cccd96 undo accidental modification of makefile 2012-02-13 10:04:13 -07:00
Joshua Warner
bbb4529752 implement File.setExecutable(), File.canExecute(), and File.createTempFile() 2012-02-09 14:23:24 -07:00
Joel Dice
33976d1ba4 ensure debug helper functions are retained by linker
Apple's linker tends to remove functions which are never called, which
is not what we want for e.g. vmPrintTrace, since that function is only
intended to be called interactively from within GDB.
2012-02-04 15:42:19 -07:00
Joel Dice
be6896b8a0 avoid running out of OS resources due to zombie thread accumulation (part 2)
My previous attempt wasn't quite sufficient, since it was too late to
call join on a thread which had already exited given the code was
written to aggressively dispose of system handles as soon as the
thread exited.  The solution is to delay disposing these handles until
after we're able to join the thread.
2012-02-03 17:20:20 -07:00
Joel Dice
67a3ca881b remove debug logging 2012-02-03 13:54:00 -07:00
Joel Dice
c3256c2874 avoid running out of OS resources due to zombie thread accumulation
The bug here is that when a thread exits and becomes a "zombie", the
OS resources associated with it are not necessarily released until we
actually join and dispose of that thread.  Since that only happens
during garbage collection, and collection normally only happens in
response to heap memory pressure, there's no guarantee that we'll GC
frequently enough to clean up zombies promptly and avoid running out
of resources.

The solution is to force a GC whenever we start a new thread and there
are at least N zombies waiting to be disposed, where N=16 for now.
2012-02-03 12:00:02 -07:00
Joel Dice
b45528203d avoid crashes due to calling select or wakeup on a closed Selector 2012-01-31 09:48:05 -07:00
Joel Dice
807f2a8d51 avoid crash when Selector.close is called more than once on the same instance 2012-01-30 13:42:32 -07:00
Joel Dice
222b357089 specify 4-byte alignment of functions defined in ARM assembly code
Apple's assembler, at least, won't automatically align these properly
for us, so we need to explicitly specify the required alignment.
2012-01-19 16:42:35 -07:00
Joel Dice
d29513c653 fix Avian_sun_misc_Unsafe_compareAndSwapLong for platforms without atomicCompareAndSwap64
We never define atomicCompareAndSwap64 for ARM or PowerPC, and
apparently only very recent ARM chips support it, so we must fall back
to synchronization-based emulation.
2012-01-15 10:02:36 -07:00
Joel Dice
49d19456d0 fix infinite wait in Unsafe.park
There were a couple of problems with the Avian_sun_misc_Unsafe_park
implementation in classpath-openjdk.cpp.  First, the wait time should
be interpreted as milliseconds if absolute, but as nanoseconds
otherwise, whereas we were treating it as milliseconds in both cases.
Second, there was no mechanism to exit the while loop after the
specified time; the only way we could exit was via an unpark or
interrupt.
2012-01-14 20:27:40 -07:00
Joel Dice
929315e1f2 avoid crash when parsing certain abstract classes which declare no methods 2012-01-13 16:51:39 -07:00
Joel Dice
0aa5755187 call C library free directly instead of System::free where possible
There was a subtle race condition in the VM shutdown process such that
a System::Thread would be disposed after the System instance it was
created under has been disposed, in which case doing a virtual call to
System::free with that instance would potentially cause a crash.  The
solution is to just call the C library version of free directly, since
that's all System::free does.
2012-01-12 11:00:58 -07:00
Joel Dice
7022b23b26 add AbstractCollection.toString implementation 2012-01-12 10:45:05 -07:00
Joel Dice
9ba7c504da Merge remote branch 'origin/SWT3.7_UrlUpdates' into oss-master 2011-12-29 11:00:59 -07:00
Seth Goings
51ae790e54 Added UrlTest.java to tests dir 2011-12-29 10:36:33 -07:00
Ben Limmer
d76191d2bb Adding unit tests for File.isAbsolute() method. 2011-12-29 10:17:01 -07:00
Seth Goings
a0c12ad259 Added another floatToIntBits test 2011-12-29 09:51:44 -07:00
Seth Goings
f5a168f584 Fixed tests for floatToIntBits. Probably want to add more comprehensive tests tomorrow (or today... as of 2 minutes) 2011-12-28 23:58:33 -07:00
Ben Limmer
b3850ac76d Initial attempt at resolving SWT3.7 missing operatons in Avian. Everything seems to be working except floatToIntBits, hence the test case failing. 2011-12-28 15:52:53 -07:00
Joel Dice
1c85ea8a6e fix GCC 4.6 LTO build
On Ubuntu 11.10, the optimized build was breaking, apparently because
it was eliminating most of the symbols defined in assembly code
(e.g. vmJump) as unreachable when linking libjvm.so, which left
avian-dynamic unlinkable due to an unresolved symbol.

The solution in this commit is to export makeSystem and makeFinder
from libjvm.so rather than build redundant versions of finder.cpp and
posix.cpp/windows.cpp into avian-dynamic like we've been doing.  This
avoids the whole problem of vmJump reachability and reduces the size
of avian-dynamic at the same time.

This commit also turns off LTO for the avian-dynamic link since we get
odd undefined symbol errors about libc-defined symbols otherwise.
This may merit future investigation, but avian-dynamic is so small and
simple that there's no need to optimize it anyway.
2011-11-19 19:26:25 -07:00
Joel Dice
b29db7fece fix OpenJDK 7 build error
OpenJDK 7's javac doesn't seem to like that we're accessing
Enum.ordinal in compareTo when it's private.
2011-11-19 19:22:34 -07:00
Joel Dice
e4c1f923b5 fix GC safety bug in resolveObjectArrayClass
The call to getClassRuntimeData may trigger a GC, so we must mark the
local variables to be visited.
2011-11-18 08:38:19 -07:00
Joel Dice
3e5a7d9a41 reset immortal fixed objects when heap is disposed
This should ensure that the bootimage is ready to reuse by another
instance of the VM later on.
2011-11-11 17:37:40 -07:00
Joel Dice
7d185dd27d revert heap.cpp part of last commit
That change seems to be causing crashes under certain circumstances,
so I'm reverting it for now while I debug.
2011-11-10 15:27:34 -07:00
Joel Dice
4d0b127989 support multiple sequential VM instances with bootimage build
Until now, the bootimage build hasn't supported using the Java
invocation API to create a VM, destroy it, and create another in the
same process.  Ideally, we would be able to create multiple VMs
simultaneously without any interference between them.  In fact, Avian
is designed to support this for the most part, but there are a few
places we use global, mutable state which prevent this from working.
Most notably, the bootimage is modified in-place at runtime, so the
best we can do without extensive changes is to clean up the bootimage
when the VM is destroyed so it's ready for later instances.  Hence
this commit.

Ultimately, we can move towards a fully reentrant VM by making the
bootimage immutable, but this will require some care to avoid
performance regressions.  Another challenge is our Posix signal
handlers, which currently rely on a global handle to the VM, since you
can't, to my knowledge, pass a context pointer when registering a
signal handler.  Thread local variables won't necessarily help, since
a thread might attatch to more than one VM at a time.
2011-11-10 13:33:36 -07:00
Ben Limmer
21610c1c9b Merge branch 'master' of ssh://git.ecovate.com/avian 2011-11-09 13:26:51 -07:00
Ben Limmer
89cdd9d0d2 Fixed bug where calling Process.destroy() on a PID that no longer exist kills all processes in Pgroup. 2011-11-09 13:26:36 -07:00
Ben Limmer
f1b0d995a8 Fixed bug where calling Process.destroy() on a PID that no longer exist kills all processes in Pgroup. 2011-11-09 13:18:04 -07:00
Joel Dice
6e86ac39db fix native call marshalling on Apple/ARM
When the fourth argument is a 64-bit value on the Apple ARM ABI, it is
passed half by register and half on the stack, unlike on Linux where
it is passed entirely on the stack.  The logic to handle this in arm.h
was flawed, and this commit fixes it.
2011-11-07 17:14:41 -07:00
Joel Dice
a2c6cc8882 implement ConcurrentLinkedQueue.clear 2011-11-07 15:52:42 -07:00
Joel Dice
bcb62af2a1 fix java-lang.cpp iOS build 2011-11-04 09:37:24 -06:00
Joel Dice
21cc4c6a87 implement AbstractList.indexOf 2011-11-04 08:27:11 -06:00
Joel Dice
4026ad208c update makefile to point to iPhoneOS5.0.sdk 2011-11-04 08:25:26 -06:00
Joel Dice
6153a5c83b Merge remote-tracking branch 'git/master' 2011-11-04 08:11:14 -06:00
JET
2b2a2e9446 Completion of previous fix. 2011-11-03 19:30:44 -06:00
JET
216b9a05ea RandomAccessFile now correctly reports lengths for growing files. 2011-11-03 13:39:24 -06:00
Joshua Warner
90dc552463 implement Process.destroy 2011-11-03 12:30:51 -06:00
Joshua Warner
76f57fc931 Merge branch 'master' of ssh://git.ecovate.com/avian 2011-11-03 09:43:34 -06:00
JET
3b1c769d2b Fixed RandomAccessFile to update position after reads. 2011-10-24 09:01:17 -06:00
JET
39bee886e3 ByteBuffer and InputStream now better match the standard. 2011-10-20 13:45:47 -06:00
Joel Dice
8501ce8711 avoid using runtime-generated thunks for bootimage native methods 2011-10-03 08:05:49 -06:00
Joel Dice
5c39819cf0 fix uninitialized value warnings in bootimage.cpp 2011-10-03 08:05:25 -06:00
Joel Dice
248ff26581 fix thinko in machine.cpp 2011-10-03 08:04:58 -06:00
Joel Dice
db9f9a300d Revert "remove distinction between thunks and bootThunks in compile.cpp"
This reverts commit 88d614eb25.

It turns out we still need separate sets of thunks for AOT-compiled
and JIT-compiled code to ensure we can always generate efficient jumps
and calls to thunks on architectures such as ARM and PowerPC, whose
relative jumps and calls have limited ranges.
2011-10-01 18:11:02 -06:00
Joel Dice
043e466921 change bool field types to uint8_t in Fixie class
The bool type is 32 bits on Darwin/PowerPC, unlike other platforms.
To make bootimage creation consistent, we now use an explicit 8-bit
type.
2011-09-30 18:46:54 -06:00
Joel Dice
d89a96ae6d use absolute path for test-executable in makefile
This is necessary to avoid crashes on OS X due to
CFBundleGetMainBundle and friends not behaving well otherwise.
2011-09-30 18:46:54 -06:00
Joel Dice
ad22de6d73 fix uninitialized variable in bootimage.cpp 2011-09-30 18:46:53 -06:00
Joel Dice
ed6945dec7 fix offset calculations in arm.cpp and powerpc.cpp 2011-09-30 18:46:53 -06:00