Commit Graph

244 Commits

Author SHA1 Message Date
Joel Dice
851187f0ce refine memory barrier implementation and usage 2009-11-30 15:38:16 +00:00
Joel Dice
0b09c6aa30 avoid busy wait when entering "exclusive" state 2009-11-29 16:53:05 -07:00
Joel Dice
6d9e1270ca fix race conditions in atomic operations 2009-11-29 09:08:07 -07:00
Joel Dice
1558b85acf second attempt to fix "idle to active" fast path
If another thread succeeds in entering the "exclusive" state while we
use the fast path to transition the current thread to "active", we
must switch back to "idle" temporarily to allow the exclusive thread a
chance to continue, and then retry the transition to "active" via the
slow path.
2009-11-28 15:35:15 -07:00
Joel Dice
3418a8bcbe fix race condition introduced in previous commit 2009-11-28 15:24:02 -07:00
Joel Dice
75934c8342 provide fast paths for common thread state transitions
These paths reduce contention among threads by using atomic operations
and memory barriers instead of mutexes where possible.  This is
especially important for JNI calls, since each such call involves two
state transitions: from "active" to "idle" and back.
2009-11-28 15:01:54 -07:00
Joel Dice
1a63b72b41 clean up float-vs.-int tracking in constant pools 2009-10-17 20:11:03 -06:00
Joel Dice
325f93b4d1 Merge branch 'master' into wip
Conflicts:

	src/compile.cpp
	src/compiler.cpp
	src/machine.h
	src/x86.cpp
2009-09-20 15:43:32 -06:00
Joel Dice
953cb69e5e move proxy and annotation code from C++ to Java
This allows code shrinkers to remove it if it's not used by the application.
2009-09-19 16:21:15 -06:00
Joel Dice
1a2eb3836c Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2009-09-18 18:01:57 -06:00
Joel Dice
7aa906d97b support runtime-visible annotations and java.lang.reflect.Proxy 2009-09-18 18:01:54 -06:00
Joel Dice
d0f8889e27 fix GC safety bugs in parseMethodTable and makeArrayClass 2009-09-18 12:20:35 -06:00
Joel Dice
b645c284b5 fix memory leak in debug build 2009-09-17 21:36:52 -06:00
Joel Dice
fcc4ff93e0 remove debug logging 2009-09-17 21:22:47 -06:00
Joel Dice
6519047342 fix bootimage build 2009-09-03 09:06:04 -06:00
Joel Dice
84ac2e417d follow reference pointer before using in in refrenceTargetUnreachable in case it points to a moved object 2009-09-01 18:32:21 -06:00
Joel Dice
4f794f533e fix handling of reachable, moved weak references in postVisit 2009-09-01 17:23:30 -06:00
Joel Dice
73dc058c14 implement StackTraceElement.getFileName properly 2009-08-27 16:28:44 -06:00
Joel Dice
1a0eef7e2d add support for building with MSVC on Windows 2009-08-26 18:26:44 -06:00
Joel Dice
4297fa04b3 run java finalizers in a separate thread to guarantee no application locks are held when doing so 2009-08-24 17:51:31 -06:00
Joel Dice
a56c1d8765 fix GC-safety bug in resolveSpec 2009-08-20 12:37:03 -06:00
Joel Dice
6196f61938 clear Thread::javaThread before entering zombie state, since clearing it in Thread::dispose is too late - the reference may already be invalid since we don't visit GC roots for zombie threads 2009-08-20 08:49:01 -06:00
Joel Dice
c4b5ecec90 implement Runtime.addShutdownHook and Thread.setDaemon; avoid segfaults due to an application calling e.g. CallStaticBooleanMethod when it really meant CallStaticVoidMethod 2009-08-19 14:27:03 -06:00
Joel Dice
01dcb1661b don't resolve all constant pool entries in linkClass - just the field and method specs 2009-08-18 15:27:21 -06:00
Joel Dice
c4edabdc02 implement ClassLoader.resolveClass and ensure class is linked in e.g. Class.getMethods; minor bugfixes 2009-08-18 14:26:28 -06:00
Joel Dice
7fcbf9d85c fix reading 2-byte UTF-8 constants 2009-08-14 08:52:31 -06:00
Joel Dice
3facd3f735 treat SoftReferences as WeakReferences; do vtable or interface table lookups as necessary in MyProcessor::invoke; various bugfixes 2009-08-13 09:17:05 -06:00
Joel Dice
db58097165 re-enable finalization 2009-08-11 10:04:41 -06:00
Joel Dice
fb5b0570c3 replace slashes with dots in class name before passing it to ClassLoader.loadClass 2009-08-11 09:20:49 -06:00
Joel Dice
28b5c46a0b fix GC safety bug in makeNewGeneral 2009-08-10 17:35:44 -06:00
Josh warner
1d3ef1fc43 Merge branch 'master' of git://oss.readytalk.com/avian, fixed problems that occured in broader testing
Conflicts:
	src/compile.cpp
	src/compiler.cpp
	src/powerpc.cpp
	src/x86.S
	src/x86.cpp
2009-08-10 13:20:23 -06:00
Joel Dice
001000364d add classloader parameter to functions which may directly or indirectly load classes; include methods inherited from interfaces (but not explicitly declared) in method tables and virtual tables of abstract classes 2009-08-10 07:56:16 -06:00
Joel Dice
d5f4811b43 check for exception after calling resolveClass in parseInterfaceTable 2009-08-04 08:50:04 -06:00
Joel Dice
f8bf83bfec fix recent regression in findInHierarchy 2009-08-04 08:42:16 -06:00
Joel Dice
cb563f76e1 check superinterfaces when looking up methods and fields 2009-08-03 16:16:41 -06:00
Joel Dice
ad0592df6f print class name properly when throwing NoSuchMethodError 2009-07-29 10:32:16 -06:00
Joel Dice
7b183e8f4e don't run Java finalizers when exiting the VM 2009-07-28 16:58:01 -06:00
Joel Dice
27d863790c Merge branch 'win64' into gnu
Conflicts:

	makefile
	src/compile-x86.S
	src/x86.S
	src/x86.cpp
2009-07-25 20:48:36 -06:00
Joel Dice
3787985b25 implement basic finalization support
This implementation does not conform to the Java standard in that
finalize methods are called from whichever thread happens to be garbage
collecting, and that thread may hold locks, whereas the standard
guarantees that finalize will be run from a thread which holds no locks.
Also, an object will never be finalized more than once, even if its
finalize method "rescues" (i.e. makes reachable) the object such that it
might become unreachable a second time and thus a candidate for
finalization once more.  It's not clear to me from the standard if this
is OK or not.

Nonwithstanding the above, this implementation is useful for "normal"
finalize methods which simply release resources associated with an
object.
2009-07-21 18:57:55 -06:00
Joel Dice
514d0bf7e5 fix deadlocks and other misbehaviors in class initialization code 2009-07-20 14:12:38 -06:00
Joel Dice
138f8444df Merge branch 'master' into gnu 2009-07-20 08:27:33 -06:00
Joel Dice
8662361f71 Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2009-07-20 08:27:17 -06:00
Joel Dice
47ab980550 fix thread heap overflow corner case in allocate3
The previous code relied on the invalid assumption that the thread-local
heaps for all threads would have been cleared immediately following a
garbage collection.  However, the last thing the garbage collection
function does is run finalizers which may allocate new objects.  This
can lead allocate3 to call allocateSmall with a size which is too large
to accomodate, overflowing the heap.

The solution is to iterate until there really is enough room for the
original allocation request.
2009-07-17 19:37:46 -06:00
Joel Dice
3e4336eba4 rearrange finalization code in collect to avoid inifinite recursion when finalizer allocates memory 2009-07-17 09:29:24 -06:00
Joel Dice
9c9eb86b2f fix deadlock in allocate3 when another thread wants to enter the exclusive state 2009-07-16 11:51:35 -06:00
Josh warner
9681a8a1ff added debugging method 'vmAddressFromLine' 2009-06-11 09:44:37 -06:00
Joel Dice
f239424930 implement NewDirectByteBuffer etc. properly when building against Classpath; call JNI_OnLoad if found in newly-loaded libraries 2009-06-10 18:15:00 -06:00
Joel Dice
c1ca653fef intern CONSTANT_Utf8 pool entries to save memory and reduce bootimage size 2009-06-06 18:26:23 -06:00
Joel Dice
ac34bc072c remove obsolete todo comments 2009-06-06 14:58:06 -06:00
Joel Dice
0857f53651 more progress on GNU Classpath compatibility 2009-06-04 17:21:42 -06:00