Commit Graph

2103 Commits

Author SHA1 Message Date
Alexey Pelykh
4d03650544 Replaced TODO comments with messages ; More correct AVIAN_AOT_ONLY usage 2013-02-09 09:42:21 +02:00
Alexey Pelykh
1b43caf815 Makefile fix 2013-02-09 09:42:20 +02:00
Alexey Pelykh
2f2cac556c Windows Phone 8 / Windows RT initial support
Conflicts:

	makefile
2013-02-09 09:42:19 +02:00
Alexey Pelykh
b1990ba55f Android toolchain 2013-02-09 09:42:14 +02:00
Victor Shcherb
3a42db9f6f Add android platform 2013-02-09 09:42:13 +02:00
Joel Dice
f9b3be0301 fix format string in loadLibrary call to snprintf
"%*s" means "at least", whereas "%.*s" means at most, and the latter
is what I intended.  This only became noticable as of 9f22a70, when I
added another directory to the library path, which caused loadLibrary
to fail to find libraries in either directory.
2013-02-08 08:24:06 -07: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
5dcf6eae5a fix GC safety issue in MyClasspath::updatePackageMap 2013-02-03 20:29:24 -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
3db9e73aa1 fix GC safety issues in classpath-openjdk.cpp 2013-02-03 15:19:35 -07:00
Joel Dice
80c8940b7f ensure joining threads are always notified when a thread exits
Previously, we'd only do this if the thread exited without throwing an
exception.  Now we do it regardless.
2013-02-03 15:18:32 -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
0c5471d25e remove temporary #error used for debugging
Sorry, that wasn't supposed to be checked in.
2013-01-28 16:24:08 -07:00
Joel Dice
67fd707254 fix handling of unusual exception handler layout
Scala sometimes generates bytecode such that the scope of an exception
handler starts at another exception handler, e.g.:

      Exception table:
         from    to  target type
           290   372   382   any
           382   451   451   any
           290   372   451   any

Avian's compiler was incorrectly initializing the stack frame for the
second handler in this case.  This commit fixes the problem.
2013-01-26 22:06:53 -07:00
Joel Dice
70a7a50a49 fix int-to-long conversions from memory on x86_32
The instruction for 32-bit-to-64-bit sign extension on x86_32 requires
that the input value be placed in EAX and the sign extension in EDX.
However, the compiler can get confused if the input value is in memory
addressed via one of those registers and doesn't know how to move it.
This patch works around that limitation by doing the move explicitly
in MemoryEvent::compile if necessary.
2013-01-26 17:15:15 -07:00
Joel Dice
1a44ec9eef fix incorrect macro name in bootimage.cpp 2013-01-25 16:47:31 -07:00
Joel Dice
2131adf3aa fix Windows OpenJDK build 2013-01-25 08:07:47 -07:00
Joel Dice
844520a402 fix embed.cpp build for 64-bit Windows 2013-01-25 07:57:57 -07:00
Joel Dice
36eee724c9 check argument types in JVM_InvokeMethod
Method.invoke must throw an IllegalArgumentException if it receives
the wrong number or types of arguments, and since this isn't done by
the OpenJDK class library, we must do it in the VM.
2013-01-24 12:16:41 -07:00
Joel Dice
0adccdc99c return unadorned filename from JVM_GetSystemPackage
Package.defineSystemPackage expects a filename, not a URL.
2013-01-24 12:16:40 -07:00
Joel Dice
2a45a5919c return XToolkit from iOS getPreferredToolkit stub
This is necessary to prevent an NPE in Hashtable.put when
System.initProperites tries to put a null value in the map for
java.awt.graphicsenv.
2013-01-19 14:10:31 -07:00
Joel Dice
ccbdd6723a specify CodeCapacity based on target arch, not build arch 2013-01-19 14:08:07 -07:00
Carsten Elton Sørensen
cad4719f7d Handle null pointer in PopLocalFrame 2012-12-21 09:38:03 -07:00
Joel Dice
9f22a701cc load libmawt.so proactively when booting the VM for OpenJDK
This library is placed in the xawt subdirectory of jre/lib/$arch on
POSIX systems, so it isn't found automatically when third-party
libraries which depend on it are loaded.  The simplest way to ensure
that it's found seems to be to just load it when the VM starts up.
2012-12-20 12:30:15 -07:00
Joel Dice
b75497c8ff implement JNIEnv::NewLocalRef 2012-12-20 09:05:30 -07:00
Joel Dice
1094483a7c fix 32-bit build regression 2012-12-19 16:48:20 -07:00
Joel Dice
d200019d10 implement JNI reflection methods
These include FromReflectedMethod, ToReflectedMethod,
FromReflectedField, and ToReflectedField.
2012-12-19 12:39:33 -07:00
Joel Dice
7b07b5b9a3 print more of the stack map when DebugFrameMaps is enabled 2012-12-12 16:04:26 -07:00
Joel Dice
663d8da975 fix stack mapping bug for try blocks containing jsr/ret instructions
In order to calculate the initial stack map of GC roots for an
exception handler, we do a logical "and" of maps across all the
instructions contained in the try block for that handler.  This is
complicated by the presence of jsr/ret instructions, though, because
instructions in a subroutine may have multiple maps associated with
them corresponding to all the paths from which execution might flow to
them.

The bug in this case was that we were using an uninitialized map in
our calculation, resulting in a map with no GC roots at all.  By the
time the map was initialized, the damage had already been done.  The
solution is to treat an uninitialized map as if it has roots at all
positions so that it has no effect on the calculation until it has
been initialized with real data.
2012-12-12 15:54:15 -07:00
Joel Dice
f79f320859 fix MSVC build regression 2012-12-05 17:17:29 -07:00
Joel Dice
36aa74316a fix Windows cross-compile build 2012-12-04 17:37:02 -07:00
Joel Dice
2659e32b80 Merge remote-tracking branch 'csoren/master' 2012-12-04 14:04:57 -07:00
Stanisław Szymczyk
de1f5c7b9f fix pthread mutex and condition leak
Hi,

I did some more tests with my x86 QNX Avian port and found one major problem
in Avian VM while trying to run Apache Ivy. The problem manifests as
follows:

1. MySystem::Thread X is created, during its creation pthread mutex and
conditional variable are initialized
2. Program runs for some time
3. MySystem Thread X is disposed, it's memory is freed (during garbage
collection I guess)
4. Program runs for some time
5. MySystem::Thread Y is created in exactly the same memory address as
MySystem::Thread X disposed in step 3 (I suppose that's due to the way
memory allocator works in Avian)
6. During MySystem::Thread Y creation pthread mutex and conditional variable
initialization fail silently with EBUSY. QNX documentation says it means
"The given mutex was previously initialized and hasn't been destroyed."
which is correct, because it's exactly in the same memory address as mutex
and conditional variable of MySystem::Thread X and they haven't been
destroyed during MySystem::Thread X disposal

Fortunately solution for this is easy, see the attached patch. Now Apache
Ivy works without any problems.

Regards,
Stanisław Szymczyk
2012-12-04 10:14:44 -07:00
Carsten Elton Sorensen
2b44fb6b93 Compile fix for GCC 4.7.2 in C++11 mode 2012-11-30 11:14:35 +01:00
Carsten Elton Sorensen
859f0ec503 Fix for C++ compile error 2012-11-30 11:08:54 +01:00
Carsten Elton Sorensen
571cc6a85e Added new embed utility for Windows 2012-11-13 09:11:49 +01:00
Carsten Elton Sørensen
53b1a2423a Accept M and K suffixes for memory sizes like the java command 2012-11-12 22:35:58 +01:00
Joel Dice
3665753d1f fix MSVC build regression 2012-10-13 13:09:24 -06:00
Joel Dice
8f308291b0 eliminate call stack recursion in compile method
Some OSes (notably, Windows CE) restrict the size of the call stack
such that recursive compilation of branch instructions can lead to
stack overflow in methods with large numbers of such instructions.  In
fact, a worst-case method could even lead to overflow when the stack
size limit is relatively generous.

The solution is to convert this recursion into iteration with an
explicit stack to maintain state about alternate paths through each
branch.
2012-10-13 09:46:12 -06:00
Joel Dice
a3c4b60f43 rename package avian.avian_vm_resource to avian.avianvmresource
This package name must match the URL protocol we use for loading
embedded resources, but OpenJDK's URL class won't tolerate underscores
in a protocol name.  Also, I had not updated the names of the native
methods in avian.avianvmresource.Handler, leading to
UnsatisfiedLinkErrors when they were called.
2012-10-06 15:33:24 -06:00
Joel Dice
7946aaf48f update static table mapping code in bootimage.cpp to match machine.cpp
Commit c918cbc added a reference to ensure
sun.misc.Unsafe.getLongVolatile could be implemented efficiently on
32-bit platforms, but I forgot to update bootimage.cpp to account for
it.
2012-10-06 15:30:59 -06: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
45073db421 fix Call[Static]<type>MethodA float argument marshalling 2012-10-05 10:56:07 -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
c680dd4215 use ldmneia on Clang < 4 and GCC, ldmiane on Clang >= 4
I don't know why this instruction was renamed, but we have to deal
with it.
2012-10-03 17:01:00 -06:00
Joel Dice
16c526b775 fix OS X 10.8 and iOS 6.0 builds
This also adds support for Clang ARM builds, which involved removing
unused functions from arm.cpp to avoid link-time warnings.
2012-10-03 13:36:51 -06:00
Joel Dice
1ce012aa68 fix abort in classpath-openjdk.cpp due to buffer overflow
This addresses the case where -Djava.home=<some really long path>.

https://github.com/ReadyTalk/avian/issues/15
2012-10-03 09:43:51 -06:00
Joel Dice
ab5ec510bf handle zero length arrays properly in JNIEnv::NewString 2012-10-03 08:16:41 -06:00
Xerxes Rånby
2a15201b18 gcc define __ARM_PCS_VFP for -mfloat-abi=hard, use it to detect armhf builds.
Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
2012-10-01 13:39:18 +02:00