Commit Graph

3102 Commits

Author SHA1 Message Date
Joel Dice
2190d0e99a fix reads of out-of-bounds values in tokenizer.h 2012-09-12 15:25:17 -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
90fa4c9b69 add JNI_GetCreatedJavaVMs stub
Recent versions of IcedTea will not run unless libjvm.so exports this
symbol.  The quick fix is to provide a stub which just always returns
-1 to indicate an error.  I'll leave a proper implementation for when
we need to support an app that actually uses this function.
2012-09-07 19:05:05 -06:00
Joel Dice
eee2ce27e4 ignore DetachCurrentThread calls for the main thread
My earlier commit to allow detaching the main thread (1f1c3c4) seems
to have caused subtle stability problems
(e.g. https://groups.google.com/group/avian/msg/d2c797c0dcf925c3), so
for now we'll just ignore that operation, which leaks a bit of memory
but should be harmless otherwise.
2012-09-07 08:47:49 -06:00
Joel Dice
d3b32ecffd Merge branch 'openjdk-version' of https://github.com/xranby/avian 2012-09-05 12:38:42 -06:00
Xerxes Rånby
db0c14d742 Set java.vm.info based on makefile info= and
set java.vm.version based on makefile version=
in order to display relevant OpenJDK -version information.

Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
2012-09-05 15:30:49 +02:00
Xerxes Rånby
d88a33329a Add a non-versioned SONAME to Avian libjvm.so that
matches the Hotspot Server/Client libjvm.so SONAME,
this allow libjava.so in OpenJDK 7 to find the Avian libjvm.so during ldopen.
2012-09-05 10:29:12 +02:00
Joel Dice
24f682f5b6 fix 64-bit shifts on x86_32 (part 2)
My earlier attempt (fa5d76b) missed an important detail, and somehow I
forgot to test the 32-bit OpenJDK build which made that omission
obvious.  Here's the fix.
2012-09-03 08:44:13 -06:00
Joel Dice
3f039864d1 fix memcpy argument order bug in jvmConstantPoolGetDoubleAt 2012-08-29 12:10:31 -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
7534eecdb3 implement JVM_ConstantPoolGetDoubleAt 2012-08-29 18:34:28 -06:00
Joel Dice
374bdb3726 implement Runtime.maxMemory for OpenJDK port
Some apps refuse to run if Runtime.maxMemory returns a value that's
"too small", so our stub implementation returning zero was not
sufficient.  Now we return the actual heap size limit in bytes.
2012-08-29 18:32:45 -06:00
Joel Dice
8c48a44e54 set main thread context classloader correctly for OpenJDK port
sun.misc.Launcher has its own idea about what the application
classloader should be, but we need to override it with the system
classloader created by the VM.  This is achieved by running
Launcher.getLauncher (which has the side effect of setting
Thread.contextClassLoader) and then overriding it.
2012-08-29 18:27:37 -06:00
Gernot Kvas
c2b53497ab Fix stacktrace when building with MSVC 2012-08-26 20:14:37 -06:00
Joel Dice
1f1c3c4c41 allow main thread to use DetachCurrentThread
When I originally implemented DetachCurrentThread, I assumed it didn't
make sense for the main thread to detach itself from the VM, and I was
concerned that allowing it might cause problems for any other threads
still attached.  However, detaching the main thread is allowed by the
JNI spec as of Java 2, and OpenJDK's java command does this just
before calling DestroyJavaVM.  Therefore, this commit ensures that the
VM doesn't abort if the main thread is detached.
2012-08-24 18:14:01 -06:00
Joel Dice
bac4099acb fix crash in findFrameMapInSimpleTable due to bug in instanceof implementation
We weren't adding entries to the frame map for calls to the instanceof
thunk when compiling methods.  However, that thunk may trigger a GC,
in which case we'll need to unwind the stack, which will lead to a
crash if we don't have a frame map entry for that instruction.
2012-08-17 12:47:38 -06:00
Mike Jensen
3372210f45 Added .get() implementation 2012-08-16 16:13:51 -06:00
Joel Dice
38454ce7d4 fix MSVC build of test JNI library 2012-08-15 17:43:45 -06:00
Gernot Kvas
ff9757e811 fix Win32 build regressions
Date: Wed, 15 Aug 2012 15:59:25 -0700 (PDT)
From: Gernot Kvas <gernot.kvas@gmail.com>
Reply-To: avian@googlegroups.com
To: avian@googlegroups.com
Subject: Win32 build regression

Hi,

As I've forked on the July 19th and haven't updated since, I decided to
merge master into my WinCE branch. I found out that the following commits
have introduced build regressions on Windows:

1.)https://github.com/ReadyTalk/avian/commit/5a7c78e71ac7b4045c23d215162fb1284
8f1a5f3

=> strncasecmp is undefined for Windows

2.)https://github.com/ReadyTalk/avian/commit/b98abe3f94dbf552595554787ef2115c3
009856c

=> fpclassify and related constants are undefined for Windows

3.)https://github.com/ReadyTalk/avian/commit/20a290b992112f9b376d3a8d0180c1cca
8dd21e2

=> signbit is undefined for Windows

I attached a patch that makes everything build through (within Visual
Studio, the makefile still fails)
2012-08-15 17:43:44 -06:00
Joel Dice
127d56d0fe fix register masks used for planning in arm.cpp
We can't use a floating point register where an integer register is
needed, or we may generate an invalid instruction.
2012-08-13 09:22:18 +00:00
Joel Dice
95cf6cf941 fix integer shifts on PowerPC 2012-08-13 11:17:34 -06:00
Joel Dice
665c4448bd fix PowerPC floating point argument and return value marshalling 2012-08-13 11:16:30 -06:00
Joel Dice
2abc4e28a5 handle missing classpath or jar file name gracefully 2012-08-13 08:36:36 -06:00
Joel Dice
fa5d76b43e fix 64-bit shifts on x86_32 2012-08-13 08:26:39 -06:00
Joel Dice
a3a816c9a4 remove test of DataOutputStream from Integers.java
We haven't implemented that class yet, so the test only compiles with
the OpenJDK port.
2012-08-12 20:58:07 -06:00
Joel Dice
69ffa28e1b fix shift instruction implementations on ARM
Unlike x86, ARM does not implicitly mask the shift value, so we must
do so explicitly.
2012-08-11 19:09:03 +00:00
Joel Dice
2687333a37 Merge remote-tracking branch 'github/master' 2012-08-12 15:03:40 -06:00
Joel Dice
20a290b992 use signbit instead of isinf to determine floating point sign
glibc's use of isinf's return value to indicate sign is a non-standard
extension which can't be relied upon on other platforms.
2012-08-12 14:52:48 -06:00
Joel Dice
b98abe3f94 fix float to integer conversion
Java requires that NaNs be converted to zero and that numbers at or
beyond the limits of integer representation be clamped to the largest
or smallest value that can be represented, respectively.
2012-08-12 14:31:58 -06:00
Joel Dice
47503854d5 Thread.sleep(0) should not sleep indefinitely
Our implementation uses Object.wait(long) to implement Thread.sleep,
which had the side effect of interpreting zero as infinity.  However,
for Thread.sleep, zero just means zero.  I assume that doesn't mean
"don't sleep at all", though, or else the app wouldn't have called
Thread.sleep in the first place, so this patch sleeps for one
millisecond when zero is passed -- just enough to yield the processor
for a bit.  Thread.yield might be a better choice in this case, but I
assume the app would have called that directly if that's what it
wanted.
2012-08-12 11:17:59 -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
b325221579 rename "resource" URL protocol to "avian_vm_resource"
This fixes a problem with JOSM, which attaches its own meaning to the
"resource" protocol.  The new name is less likely to cause such
conflicts.
2012-08-11 19:01:32 -06:00
Joel Dice
e2ff771baa handle basic argument substitution in MessageFormat.format
Thanks to Remi for an initial version of this patch.
2012-08-11 08:58:40 -06:00
Joel Dice
e2416ddb85 strip trailing separators when normalizing java.io.File.path
This addresses the case of e.g. new File("c:/foo/").exists() returning
false when the specified directory really does exist.
2012-08-11 08:21:14 -06:00
Joel Dice
373a92d4d6 add Buffers test 2012-08-11 08:01:44 -06:00
Joel Dice
242a6a0d0f fix field offset calculation mismatch between type-generator.cpp and machine.cpp 2012-08-11 06:58:07 -06:00
Joel Dice
01be4b23bb implement JNI methods needed by AWT
These include PushLocalFrame, PopLocalFrame, NewDirectByteBuffer,
GetDirectBufferAddress, and GetDirectBufferCapacity.
2012-08-11 06:56:19 -06:00
Joel Dice
2642a167e2 fix Class.getPackage for system classes in OpenJDK build 2012-08-11 06:46:24 -06:00
Joel Dice
3af278b5e6 fix Clang warnings in windows.cpp 2012-08-07 17:18:04 -06:00
Joel Dice
6aba7bef5a add java.lang.Deprecated 2012-08-06 16:55:49 -06:00
Damjan Jovanovic
53b15d1bca look for initIDs in SunFontManager instead of FontManager
OpenJDK 7 has refactored this code relative to OpenJDK 6, and now
FontManager is an interface, with SunFontManager providing a (partial)
implementation.
2012-08-05 19:31:20 -06:00
Joel Dice
5a7c78e71a ignore case when looking for Main-Class manifest attribute
Per the spec, attribute names should be case-insensitive:

http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html
2012-08-05 19:18:51 -06:00
Joel Dice
021590af05 fix JNI test for openjdk-src build 2012-08-04 18:50:43 -06:00
Joel Dice
96d5dae06c specify UTF-8 explicitly in Strings.testDecode
This fixes a test failure with the OpenJDK port.
2012-08-04 18:41:44 -06:00
Joel Dice
c63668c1ce fix ArrayIndexOutOfBoundsException when decoding a UTF-8 stream 2012-08-04 16:11:27 -06:00
Joel Dice
852d77d0b5 implement Arrays.toString(byte[]) 2012-08-04 16:08:32 -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
ebd7f69c41 fix a couple of QNX/ARM issues
On QNX, we need to use msync to sync the instruction cache.  Also,
even though the compiler doesn't define __SOFTFP__, QNX uses the
softfp ABI on ARM.
2012-08-03 20:02:33 -06:00
Damjan Jovanovic
59d7f5a47a fix java.library.path on the ARM platform
On the ARM platform, Avian compiled to use OpenJDK gets this error on
startup:
java/lang/UnsatisfiedLinkError: no zip in java.library.path
  at java/lang/ClassLoader.loadLibrary (line 1860)
  at java/lang/Runtime.loadLibrary0 (line 845)
  at java/lang/System.loadLibrary (line 1084)
  at java/lang/System.initializeSystemClass (line 1145)

Using strace shows why:
[pid 22431]
stat64("/usr/lib/jvm/java-7-openjdk-armhf/jre/lib/i386/libzip.so",
0xbee377e0) = -1 ENOENT (No such file or directory)

The attached patch uses "arm" instead of "i386" in that path. This fixes the
problem.
2012-08-04 07:31:54 -06:00
Damjan Jovanovic
5a09774353 tests don't compile when building with OpenJDK
I get this error when compiling with "make openjdk=...." on both x86_64 and
arm:

compiling test classes
test/Arrays.java:90: error: reference to equals is ambiguous, both method
equals(float[],float[]) in Arrays and method equals(Object[],Object[]) in
Arrays match
      expect(java.util.Arrays.equals(null, null));

test/Arrays.java:95: error: reference to hashCode is ambiguous, both method
hashCode(double[]) in Arrays and method hashCode(Object[]) in Arrays match
      java.util.Arrays.hashCode(null);

The attached patch fixes this.
2012-08-04 07:29:39 -06:00