Commit Graph

3458 Commits

Author SHA1 Message Date
Joel Dice
7e2d265fb9 filter flags argument to JVM_Open
The class library may pass non-standard flags to JVM_Open which will
confuse the OS if we pass them through, so we must filter them out.
2013-05-13 13:11:12 -06:00
Joel Dice
6d5fbdeb7b provide stub for JVM_UnloadLibrary
It may leak file handles under certain circumstances to do nothing in
JVM_UnloadLibrary, but, for now, an empty implementation is more
useful than one that aborts the process.
2013-05-13 13:08:40 -06:00
Joel Dice
419ac24963 don't load libmawt ahead of time when starting the VM
At one point, loading libmawt ahead of time was necessary to make AWT
work, but recent versions of OpenJDK seem to take care this from Java
code, in which case loading it ahead of time causes trouble, so we
comment it out for now until we exactly when it's needed.
2013-05-13 13:05:13 -06:00
Joel Dice
435dbbc874 add stub implementation of JVM_CurrentClassLoader 2013-05-10 11:29:20 -06:00
Joel Dice
6b3a352b38 Merge remote-tracking branch 'origin/master' 2013-04-30 23:08:18 -06:00
Joel Dice
529c7a17fb add support for the RuntimeVisibleParameterAnnotations attribute 2013-04-30 22:55:59 -06:00
Joel Dice
b1840a297d implement Unsafe.{put|get}Char 2013-04-30 22:54:45 -06:00
Joel Dice
af9e162827 fix OpenJDK build regression due to recent Android classpath refactoring 2013-04-30 22:53:56 -06:00
Joel Dice
bbc5d7fb50 only initialize class when necessary to avoid deadlock
Previously, we would attempt to initialize a class (e.g. call its
static initializer) whenever a method in that class was called, as
well as in any of the cases listed in
http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.

However, the above approach may lead to deadlock in an app which
relies on being able to call non-static methods in parallel with a
static initializer invocation in the same class.  Thus, this commit
ensures that we initialize classes only in the cases defined by the
standard.
2013-04-30 22:48:43 -06:00
Joel Dice
ed96693166 do not clear interrupted flag in Unsafe.park
Since park does not throw InterruptedException, we must leave the flag
set if we are interrupted while parked so that
e.g. AbstractQueuedSynchronizer can itself throw an exception if
appropriate.
2013-04-30 22:45:08 -06:00
Mike Jensen
f052c7780f Merge pull request #55 from jentfoo/master
Added more to the avian classpath for the collection interface as well as the list interface
2013-04-29 10:46:09 -07:00
Mike Jensen
bd2ebfce07 Merge branch 'master' of https://github.com/ReadyTalk/avian 2013-04-29 11:45:32 -06:00
Mike Jensen
a41f8c0103 Added more to the avian classpath for the collection interface as well as the list interface
Added to collection:
public boolean containsAll(Collection<?> c);
public boolean removeAll(Collection<?> c);

Added to list:
public boolean addAll(int startIndex, Collection<? extends T> c);

Also where possible for inner classes I made them extend the abstract version instead of just implement the interface.  This helps reduce code duplication where possible.

These changes were necessary to support protobuf 2.5.0
2013-04-29 11:32:56 -06:00
Joel Dice
4e12847858 code rearrangment to improve state of Android libcore tests
This mainly moves several sun.misc.Unsafe method implementations from
classpath-openjdk.cpp to builtin.cpp so that the Avian and Android
builds can use them.

It also replaces FinalizerReference.finalizeAllEnqueued with a no-op,
since the real implementations assumes too much about how the VM
handles (or delegates) finalization.
2013-04-23 13:47:15 -06:00
Joel Dice
dfdd1f6e6c move call to Classpath::shutDown
We must be in the Active state, not the Exclusive state when calling
this method since it may execute arbitrary Java code.  This fixes an
assertion failure in makeNew.
2013-04-22 21:52:27 -06:00
Joel Dice
8995db69d2 fix element spec calculation for multidimensional primitive arrays
The element class for e.g. [[[I should be [[I, not [I.
2013-04-22 21:28:25 -06:00
Joel Dice
023787d121 fix special case of exception handler table translation
scalac may generate bytecode such that an exception is thrown within
the bounds of a handler for that exception such that the throw is the
last instruction in the method, which we weren't handling properly.
2013-04-22 21:25:15 -06:00
Joel Dice
a18452f6c9 implement JVM_ConstantPoolGetFloatAt
This commit also simplifies JVM_ConstantPoolGetDoubleAt, which cannot
throw an exception and thus need not go through vmRun.
2013-04-22 21:23:32 -06:00
Joel Dice
e3fe9099a2 filter InnerClasses attribute for relevant classes in JVM_GetDeclaredClasses
The InnerClasses attribute may have entries for classes declared
inside classes we don't care about, so we must check each entry's
outer class reference and make sure it matches the one we do care
about.
2013-04-22 21:20:21 -06:00
Joel Dice
63ee3ab0a2 throw CloneNotSupportedException if Object.clone called on non-Cloneable 2013-04-22 21:19:01 -06:00
Joel Dice
e0ceaa5f43 avoid allocating new memory in hashMapRemove when GCing
This ensures that we don't abort when running an internal finalizer
that removes from a hash map.
2013-04-22 21:17:31 -06:00
Joel Dice
68c3b241ce handle sign extension of constants of various lengths
This is a generalization of 9918ea6 which handles 8-bit and 16-bit as
well as 32-bit values.
2013-04-22 21:15:49 -06:00
Joel Dice
d8729a7a8d fix zero-extension of constants in x86 compiler
scalac may emit a ldc followed by an i2c, whereas javac does the
conversion (including zero extension if necessary) at compile time.
This commit ensures we handle the i2c case properly.
2013-04-22 19:00:54 -06:00
Joel Dice
f38c4e25c6 fix array class name length calculation in invoke
The original calculation ommitted the last character, changing
e.g. "[I" into "[".
2013-04-22 18:57:26 -06:00
Joel Dice
64002319c5 use Android directory layout when accessing class library code
Per https://github.com/ReadyTalk/avian/issues/53, Avian should build
against a standard AOSP checkout, which means we should look for
subprojects in the directories the repo utility would place them.
2013-04-22 17:10:23 -06:00
Joel Dice
e9a8aa2e65 set boot library if run as java or javac command
If sun.java.command or sun.java.launcher are set, then the VM is being
loaded from e.g. libjvm.so, not as a stand-alone executable.  This
commit allows libjvm.dylib to be used with OpenJDK's java command on OS
X.
2013-04-19 18:28:20 -07:00
Joel Dice
a098926547 run Shutdown.shutdown on exit when using OpenJDK library
The OpenJDK library wants to track and run the shutdown hooks itself
rather than let the VM do it, so we need to tell it when we're
exiting.

Also, in machine.cpp we need to use only the modifiers specified in
the InnerClasses attribute for inner classes rather than OR them with
the flags given at the top level of the class file.
2013-04-19 13:00:47 -06:00
Joel Dice
9918ea6cdd fix sign extension from constant to register on x86
scalac may generate a ldc followed by an l2i, whereas javac always
seems to condense this into a single ldc_w.  The former exposed a bug
in the JIT compiler which we never hit with javac-generated bytecode.
2013-04-18 11:27:05 -06:00
Joel Dice
e6b6edfc25 ignore instance variable for static method invocations 2013-04-18 11:25:29 -06:00
Joel Dice
b4c3eea0f1 set InvocationTargetException target
When using the OpenJDK classpath, the target exception and the
Throwable cause are two different fields; we must set them both.
2013-04-18 11:23:59 -06:00
Joel Dice
81d7786716 fix Class.getModifiers for inner classes and implement JVM_GetDeclaringClass and JVM_GetEnclosingMethodInfo properly
This fixes a couple of tests in the Scala test suite
(run/reflection-modulemirror-toplevel-badpath.scala and
run/reflection-constructormirror-nested-good.scala).
2013-04-17 15:12:58 -06:00
Joel Dice
aa513c2c1d set default file.encoding to UTF-8 in classpath-openjdk.cpp
This default makes more sense than ASCII, which is what it had been.
2013-04-16 19:35:21 -06:00
Joel Dice
9f8369c5cc enter exclusive state in destroyJavaVM
This is necessary to ensure that new threads do not start while we're
shutting down (except for the ones that we start to run the shutdown
hooks), and that the shutdown hook threads can be safely started (it
is not safe to start threads from e.g. an idle state, and an assertion
will fail if we do).
2013-04-15 12:37:23 -06:00
U-JDICEVM7\Joel
45e4a6b022 Merge remote-tracking branch 'csoren/embed-fix' 2013-04-09 20:10:05 -06:00
Joel Dice
2c902a26ec handle non-ASCII strings properly in MyClasspath::makeString 2013-04-09 18:44:54 -06:00
Joel Dice
dca75df926 add vmfPrintTrace method for dumping traces to a specific stream 2013-04-09 18:44:34 -06:00
Joel Dice
83670d1df7 implement JVM_ConstantPoolGetLongAt 2013-04-09 18:44:34 -06:00
Joel Dice
73547db737 throw IllegalArgumentException in JVM_InvokeMethod on type mismatch 2013-04-09 18:44:34 -06:00
Joel Dice
49d8ccb1bd update Context::executableSize after allocating objectPool
This ensures that, if an exception is thrown later but before the
method has been fully compiled, we will know exactly how much memory
to free.  Previously, we would abort when trying to free the wrong
amount due to an assertion failure.
2013-04-09 18:43:46 -06:00
Joel Dice
8c1419fb89 jump to target if JumpIfFloatNotEqual comparison is unordered
A dcmpl or dcmpg followed by an ifneq should take the branch if an NaN
is involved.
2013-04-04 20:02:49 -06:00
Joel Dice
b436bd460a fix NaN handling in floating point comparisons 2013-04-03 16:19:33 -06:00
Joel Dice
cc8d655762 use %x,%x format for listing start and end addresses
This matches the format expected by recent versions of GDB's
disassemble command.
2013-04-03 16:07:06 -06:00
Carsten Elton Sorensen
43f41f6e73 Fixed embed.exe loader 2013-04-03 11:46:17 +02:00
Joel Dice
13d128c7be look for DirectByteBuffer, not ReadWriteDirectByteBuffer
The name of the class we need to use in makeDirectByteBuffer has
changed in Android's libcore, so now we use the new name.
2013-03-29 14:09:43 -06:00
Joel Dice
4777d1b6be fix Windows openjdk-src build regression 2013-03-26 09:53:47 -06:00
Joel Dice
e8a1900c2b fix openjdk-src build regression 2013-03-26 08:30:26 -06:00
Joel Dice
d873f096a1 set SO_NOSIGPIPE socket option when available
This ensures we avoid SIGPIPE on socket disconnect on Darwin.
2013-03-18 11:43:00 -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
3497354bbf allow extra flags to be passed to make in ci.sh 2013-03-15 17:48:47 -06:00
Joel Dice
1630739849 fix Windows x86_64 build regression due to unspecified AVIAN_TARGET_FORMAT 2013-03-15 17:47:15 -06:00