Commit Graph

390 Commits

Author SHA1 Message Date
Joel Dice
dca75df926 add vmfPrintTrace method for dumping traces to a specific stream 2013-04-09 18:44:34 -06:00
Joel Dice
a648787e11 update method table for all classes in updateClassTables
Previously we only updated this table for non-interfaces, but
interfaces may have methods which need updating too.
2013-03-16 10:54:35 -06:00
Joel Dice
3309a9f4ad ensure that array classes implement Cloneable and Serializable in bootimage build 2013-03-15 13:26:18 -06:00
Joel Dice
3c44cdc50b fix unintentionally retained finalizables and improve low mem performance
Objects which are eligable for finalization must be retained until
after their finalize methods are called.  However, the VM must
determine the entire set of such objects before retaining any of them;
otherwise the process of retaining a given object may cause others to
become reachable and thus be considered ineligible for finalization
even though they are only reachable via other finalizable objects.
The end result of this mistake is that only a few of the objects which
are finalizable will be recognized at each GC cycle, so it requires
many such cycles to find them all, and if new objects become
finalizable at a faster rate, the VM will never catch up and
eventually run out of memory.

This patch fixes the above mistake and also includes tuning to
minimize the need for GC in low memory situations.
2013-03-07 20:32:02 -07:00
Joel Dice
5e2d00010b move headers from src to src/avian
This is necessary to avoid name conflicts on various platforms.  For
example, iOS has its own util.h, and Windows has a process.h.  By
including our version as e.g. "avian/util.h", we avoid confusion with
the system version.
2013-02-27 13:33:29 -07:00
Joel Dice
0a4a04cc09 Merge remote-tracking branch 'github/master' into dicej 2013-02-22 17:13:10 -07:00
Joshua Warner
fc84f62a65 prevent garbage collection as vm shuts down 2013-02-22 16:33:07 -07:00
Joel Dice
9060a31348 Merge remote-tracking branch 'github/master' into dicej
Conflicts:
	src/classpath-openjdk.cpp
2013-02-22 14:43:20 -07:00
Joel Dice
201473cf87 more work on Android classpath port 2013-02-22 11:06:49 -07:00
Joshua Warner
af0e7767eb Merge branch 'master' of github.com:ReadyTalk/avian
Conflicts:
	makefile
2013-02-21 16:23:22 -07:00
Joel Dice
42d39b1af1 more Android class library work 2013-02-21 15:37:17 -07:00
Joshua Warner
48691bb50a move stream.h to include, and type-generator to src/tools 2013-02-20 21:26:34 -07:00
Joel Dice
f04f444f23 modify (THREAD_)RUNTIME_ARRAY definition so RUNTIME_ARRAY_BODY must be used
Previously, if you forgot to use RUNTIME_ARRAY_BODY to reference an
array declared with (THREAD_)RUNTIME_ARRAY, you wouldn't get a
compiler error until you tried to build on e.g. MSVC, where
runtime-sized stack arrays aren't supported.  This change ensures you
find out regardless of what compiler you're using, which ought to
protect us from regressions going forward.
2013-02-20 17:20:17 -07:00
Joshua Warner
52b2fd74ef move math functions out of common.h, and into include/avian/util/math.h 2013-02-20 07:51:57 -07:00
Joshua Warner
b9e281612b move runtime-array to include 2013-02-19 22:56:05 -07:00
Joshua Warner
71765bb26f fix cross-compile windows build 2013-02-15 09:53:02 -07:00
Joshua Warner
34471e5d60 factor out assert / abort / expect implementations 2013-02-13 22:13:52 -07:00
Joshua Warner
3589d5c205 Merge branch 'master' of git://github.com/ReadyTalk/avian
Conflicts:
	src/codegen/arm/assembler.cpp
	src/common.h
	src/machine.cpp
2013-02-12 17:37:19 -07:00
Joshua Warner
964d054117 move RUNTIME_ARRAY into it's own header 2013-02-10 18:07:11 -07:00
Joshua Warner
5dd770d7ea rename cast -> fieldAtOffset 2013-02-10 18:07:03 -07:00
Joshua Warner
2a1834e48a rename mask -> maskAlignedPointer 2013-02-10 18:06:48 -07:00
Joshua Warner
d26d8fdb9f rename ceiling -> ceilingDivide 2013-02-10 18:06:15 -07:00
Joel Dice
5241660463 fix SIGSEGV and off-by-one error in logDebug
We must use separate va_start/va_end pairs for each call to vsnprintf
on Linux and possibly other platforms in order to avoid a crash.
Also, we need to give it room to null terminate the string at the
right point.
2013-02-07 09:33:22 -07:00
Alexey Pelykh
9e4144f92b Trace writeout refactor 2013-02-07 11:39:28 +02:00
Alexey Pelykh
3287b1354a Fix crash if no avian.boostrap is specified (oops) 2013-02-07 11:39:14 +02:00
Alexey Pelykh
ba0ec3759d Fix crash if no avian.boostrap is specified (oops) 2013-02-07 11:39:13 +02:00
Alexey Pelykh
8e879f80a7 Fix crash if no avian.boostrap is specified (oops) 2013-02-07 11:39:12 +02:00
Alexey Pelykh
2e3856211b Fix crash if no avian.boostrap is specified 2013-02-07 11:39:11 +02:00
Alexey Pelykh
e523547b19 Allow avian.bootstrap to accept multiple libraries 2013-02-07 11:39:10 +02:00
Alexey Pelykh
5a1b478b89 Allow output of exceptions to debugger. Generate WinMD file 2013-02-07 11:39:06 +02:00
Joel Dice
5a07e04d56 assert that there are no outstanding Get*Critical requests during allocation
When GetStringCritical or GetPrimitiveArrayCritical are called, the VM
cannot risk new Java heap allocations until the corresponding release
method is called because allocations may result in GC, which cannot
happen while a string or array is pinned in memory.  We already have a
check for this latter in the footprint function used during GC, but
it's best to catch the problem as early as possible.
2013-02-05 09:48:20 -07:00
Joel Dice
e8f8ebdc67 fail quickly if an object allocation cannot be satisfied
Previously, we would blithely exceed the heap ceiling and force the
next allocation to deal with the problem, including a major GC and
possible OutOfMemoryError.  As of this commit, we throw an error
immediately if we find that the allocation will push us over the
ceiling.
2013-02-03 15:53:36 -07:00
Joel Dice
23bb2e8743 force a GC in allocate3 if the heap limit has been exceeded
Otherwise, we'll throw an OOME even though there may be enough
unreachable objects eligible for collection to get back below the
limit.
2013-02-03 15:20:53 -07:00
Joel Dice
1890e348fb fix handling of classe, method, and field names with non-ASCII characters 2013-02-03 14:10:47 -07:00
Joel Dice
3a452309b3 update static table class reference in updateClassTables
Commit c918cbc added this reference to ensure
sun.misc.Unsafe.getLongVolatile could be implemented efficiently on
32-bit platforms.  However, I neglected to ensure the reference was
updated to point to the final class instance instead of the temporary
one used in parseClass.  This led to extra memory usage and
inconsistent locking behavior, plus broken bootimage builds.
2012-10-06 15:25:12 -06:00
Joel Dice
f8d3494b1c clear any weak/soft/phantom references to finalizable objects before queuing
If we don't clear these references, we risk finalizing objects which
can still be reached by one of the special reference types.

It's a bit of a chicken-and-egg problem.  We need to visit finalizable
objects before visiting weak references, since some of the weak
references and/or their targets may become reachable once the
finalizable objects are visited.  However, that ordering means we have
no efficient way of distinguishing between objects which are reachable
from one or more normal GC roots and those which are only reachable
via the finalization queue.  The solution is to clear all weak
references to finalizable objects before visiting them.
2012-10-05 10:06:01 -06:00
Joel Dice
3693201911 make JVM_GetSystemPackage a bit smarter
The original stub implementation just echoed back its argument, but
that confused URLClassLoader when dealing with sealed JARs --
returning a non-null value for a non-system class from
JVM_GetSystemPackage made URLClassloader think it had already loaded a
class from a package which was supposed to be sealed, resulting in
SecurityExceptions which ultimately triggered NoClassDefFoundErrors.
The solution is to only return non-null values for actual system
classes.
2012-09-24 17:43:34 -06:00
Joel Dice
e20c5cd9c6 fix a couple of OpenJDK reflection bugs
We weren't wrapping exceptions thrown by invoked methods in
InvocationTargetExceptions in JVM_InvokeMethod or
JVM_NewInstanceFromConstructor.  Also, JVM_GetCallerClass is supposed
to ignore Method.invoke frames when walking the stack.
2012-09-22 20:22:33 -06:00
Joel Dice
3a5abaf58a fix incorrect reporting of fixie collection status in heap.cpp (part 2)
My earlier fix (f8e8609) was almost -- but not quite -- sufficient.
It asked the heap to mark the dead fixies too early, so some of them
were marked dead even though they ultimately survived, causing us to
clear weak JNI references when we shouldn't.
2012-09-12 17:23:19 -06:00
Joel Dice
c918cbced1 fix sun.misc.Unsafe.getLongVolatile for static fields on 32-bit platforms
The existing code did not handle static field lookups for
synchronization on 32-bit systems, which is necessary because such
systems generally don't support atomic operations on 64-bit values.
2012-09-11 19:28:02 -06:00
Joel Dice
9ceacf16e9 don't throw an exception from resolveClass when throw_ == false
resolveClass was correctly respecting throw_ == false if the requested
class was not found, but it still threw an exception if e.g. the
superclass was missing.  Now we catch such exceptions and return null
as appropriate.
2012-08-29 18:34:51 -06:00
Joel Dice
f8e860999a fix incorrect reporting of fixie collection status in heap.cpp
This led to fixed-position objects being considered unreachable when
they were actually still reachable, causing global weak JNI references
to be cleared prematurely, most notably leading to crashes in AWT
buffered image code.

This commit also fixes a field offset calculation mismatch in
bootimage.cpp relative to machine.cpp.
2012-08-12 10:55:37 -06:00
Joel Dice
248ff91d74 terminate zero-length char array with null char in stringUTFChars 2012-08-04 12:36:18 -06:00
Joel Dice
156644b8e5 fix incorrect array sizing in populateMultiArray
We were assuming the array element size was always the native word
size, which is not correct in general for primitive arrays, and this
led to wasted space at best and memory corruption at worst.
2012-06-26 10:43:47 -06:00
Joel Dice
d61501453f add support for LZMA on Windows 2012-06-02 15:43:42 -06:00
Joel Dice
5d9f7b2bc3 add optional LZMA support for compressing embedded JARs, boot images, and shared objects 2012-06-02 09:06:22 -06:00
Joel Dice
879df617df add use-clang option for building with LLVM Clang instead of GCC
This also fixes several errors and warnings emitted by Clang.
2012-06-01 17:43:42 -06:00
Joshua Warner
5d6899a867 fix warning in disassembler code
Apple's GCC is more picky about undefined ordering (and rightfully so)...
2012-05-24 08:36:21 -06:00
Joshua Warner
7bd3ea1892 add simple disassembler for debugging 2012-05-22 13:58:53 -06:00
Joel Dice
0addd8c814 update copyright years 2012-05-11 17:43:27 -06:00