Commit Graph

1528 Commits

Author SHA1 Message Date
Joel Dice
0ca6c3ed53 fix native Windows GCC 3.4 OpenJDK build 2010-11-12 18:29:12 -07:00
Joel Dice
26a59612bb fix native Windows GCC 3.4 build 2010-11-12 16:53:16 -07:00
Joel Dice
8ca5e9780e fix OS X build 2010-11-07 21:23:25 -07:00
Joel Dice
75de0a621b fix windows.cpp MySystem::now 2010-11-07 12:35:31 -07:00
Joel Dice
6cf3666ed9 fix timezone lookup for Windows openjdk-src build 2010-11-07 12:24:40 -07:00
Joel Dice
33b945c10b fix Windows openjdk (non-openjdk-src) build 2010-11-07 10:08:04 -07:00
Joel Dice
e1b808024a initial support for Windows OpenJDK build
All the tests are passing for openjdk-src builds, but the non-src
openjdk build is crashing and there's trouble loading time zone info
from the embedded java.home directory.
2010-11-06 22:21:19 -06:00
Joel Dice
df299f3564 fix build against latest JRE 1.6.0_22
This commit accomodates a new field in java.lang.Thread and implements
JVM_FindClassFromBootLoader.
2010-11-05 15:34:28 -06:00
Joel Dice
d0a6096eb0 add support for accessing embedded JARs as if they were directories
This allows OpenJDK to access time zone data which is normally found
under java.home, but which we must embed in the executable itself to
create a self-contained build.  The VM intercepts various file
operations, looking for paths which start with a prefix specified by
the avian.embed.prefix property and redirecting those operations to an
embedded JAR.

For example, if avian.embed.prefix is "/avian-embedded", and code
calls File.exists() with a path of
"/avian-embedded/javahomeJar/foo.txt", the VM looks for a function
named javahomeJar via dlsym, calls the function to find the memory
region containing the embeded JAR, and finally consults the JAR to see
if the file "foo.txt" exists.
2010-11-05 13:18:28 -06:00
Joel Dice
4cb796d2fb only return null from JVM_GetClassLoader when called from Unsafe.getUnsafe
sun.misc.Unsafe.getUnsafe expects a null result if the class loader is
the boot classloader and will throw a SecurityException otherwise
(whereas it should really be checking both for null and comparing
against the system classloader).  However, just returning null
whenever the loader is the boot loader can cause trouble for embedded
apps which put everything in the boot loader, including application
resources.

Therefore, we only return null if it's the boot loader and we're being
called from Unsafe.getUnsafe.
2010-11-04 11:43:50 -06:00
Joel Dice
cabad6926f enable standalone OpenJDK builds
As described in readme.txt, a standalone OpenJDK build embeds all
libraries, classes, and other files needed at runtime in the resulting
binary, eliminating dependencies on external resources.
2010-11-04 11:02:09 -06:00
Joel Dice
cb69ac23bd Merge remote branch 'origin/master' into openjdk
Conflicts:
	classpath/java/lang/String.java
	src/posix.cpp
2010-11-03 11:54:41 -06:00
Joel Dice
25ca40931d keep track of original class in resolveField so we can throw an exception with a useful message 2010-10-24 11:49:59 -06:00
Joel Dice
6f839323a7 use user-specified boot classpath exclusively when present 2010-10-24 11:49:12 -06:00
Joel Dice
9c603c6525 fix member offset calculation inconsistencies in type-generator.cpp 2010-10-23 20:41:45 -06:00
Joel Dice
6df0b2cfd9 look for 32-bit JRE libraries under lib/i386 2010-10-23 20:40:48 -06:00
Joel Dice
081d2d68ce handle and ignore SIGPIPE on Posix systems
We must handle this signal or we'll get the default behavior of
exiting the process whenever we get an unexpected network
disconnection.
2010-10-14 23:43:35 +00:00
Joel Dice
ca251dfa17 print error message on failed dlopen if Verbose is true in posix.cpp 2010-10-13 13:37:09 -06:00
Joel Dice
1f67aea456 fix process=interpret build 2010-09-27 17:12:08 -06:00
Joel Dice
c1c9d2111b remove GNU Classpath and Apache Harmony compatibility code
Rather than try to support mixing Avian's core classes with those of
an external class library -- which necessitates adding a lot of stub
methods which throw UnsupportedOperationExceptions, among other
comprimises -- we're looking to support such external class libraries
in their unmodified forms.  The latter strategy has already proven
successful with OpenJDK's class library.  Thus, this commit removes
the stub methods, etc., which not only cleans up the code but avoids
misleading application developers as to what classes and methods
Avian's built-in class library supports.
2010-09-27 15:58:02 -06:00
Joel Dice
8c789fb92c return empty object array from MyProcessor::getStackTrace on failure 2010-09-27 09:39:44 -06:00
Joel Dice
1d4b54a9f6 fix failure to add abstract virtuals to class with no declared virtuals 2010-09-25 16:35:18 -06:00
Joel Dice
268d2de175 cache array class lookups in element class; misc. bugfixes 2010-09-25 15:54:01 -06:00
Joel Dice
a2cc95d196 remove trailing whitespace in compile.cpp 2010-09-25 15:52:43 -06:00
Joel Dice
e75b57a127 don't abort when compiling an array lookup with a constant negative index
Instead, just compile it as a direct call to the thunk which throws an
ArrayIndexOutOfBoundsException.
2010-09-25 15:48:15 -06:00
Joel Dice
ebc54c234f fix signedness error for wide iinc implementation 2010-09-23 08:50:09 -06:00
Joel Dice
b023d147df fix JVM_Available for when fd is a fifo or socket 2010-09-23 08:49:36 -06:00
Joel Dice
89f6adc93c fix various classloading deadlocks and races 2010-09-22 13:58:46 -06:00
Joel Dice
efd3ccb04f set java.home to path of JRE, not JDK 2010-09-20 18:38:38 -06:00
Joel Dice
17f495eb27 rework OpenJDK build to derive classpath and library path from environment
We now consult the JAVA_HOME environment variable to determine where
to find the system library JARs and SOs.  Ultimately, we'll want to
support self-contained build, but this allows Avian to behave like a
conventional libjvm.so.
2010-09-20 17:31:23 -06:00
Joel Dice
64e42da348 implement avian.Handler.ResourceInputStream.available 2010-09-17 16:11:04 -06:00
Joel Dice
93c9395f1d comment-out debug logging 2010-09-17 16:10:26 -06:00
Joel Dice
a0a23b4692 implement JVM_Yield 2010-09-17 16:10:01 -06:00
Joel Dice
d0d53e2e10 fix custom-classloader-related concurrency problems and other bugs
The main changes in this commit ensure that we don't hold the global
class lock when doing class resolution using application-defined
classloaders.  Such classloaders may do their own locking (in fact,
it's almost certain), making deadlock likely when mixed with VM-level
locking in various orders.

Other changes include a fix to avoid overflow when waiting for
extremely long intervals and a GC root stack mapping bug.
2010-09-16 20:49:02 -06:00
Joel Dice
f485016637 implement more JVM_* methods and avoid duplicate array class loading 2010-09-14 18:52:57 -06:00
Joel Dice
d819a75f36 more work towards OpenJDK classpath support
The biggest change in this commit is to split the system classloader
into two: one for boot classes (e.g. java.lang.*) and another for
application classes.  This is necessary to make OpenJDK's security
checks happy.

The rest of the changes include bugfixes and additional JVM method
implementations in classpath-openjdk.cpp.
2010-09-14 10:49:41 -06:00
Joel Dice
561ee6dff9 add debug logging to finder.cpp 2010-09-13 20:38:55 -06:00
Joel Dice
66280458c8 implement more JVM_* methods 2010-09-10 17:47:23 -06:00
Joel Dice
ea2509666a reverse operands when calling builtin isAssignableFrom
Our builtin function reverses the meanings of the operands relative to
the JNI method.
2010-09-10 17:45:52 -06:00
Joel Dice
64100d17c7 Merge branch 'master' of oss.readytalk.com:/var/local/git/avian into openjdk 2010-09-10 15:58:43 -06:00
Joel Dice
cddea7187d preliminary support for using OpenJDK's class library
Whereas the GNU Classpath port used the strategy of patching Classpath
with core classes from Avian so as to minimize changes to the VM, this
port uses the opposite strategy: abstract and isolate
classpath-specific features in the VM similar to how we abstract away
platform-specific features in system.h.  This allows us to use an
unmodified copy of OpenJDK's class library, including its core classes
and augmented by a few VM-specific classes in the "avian" package.
2010-09-10 15:05:29 -06:00
Joel Dice
e7a48c0fa2 save return address in powerpc.cpp's MyAssembler::saveFrame
We've been getting away with not doing this so far since our Java
calling convention matches the native calling convention concerning
where the return address is saved, so when our thunk calls native code
it gets saved for us automatically.  However, there was still the
danger that a thread would interrupt another thread after the stack
pointer was saved to the thread field but before the native code was
called and try to get a stack trace, at which point it would try to
find the return address relative to that stack pointer and find
garbage instead.  This commit ensures that we save the return address
before saving the stack pointer to avoid such a situation.
2010-09-02 17:28:20 -06:00
Joel Dice
17c1a552d5 break each Class, Field, and Method into separate classes
In order to facilitate making the VM compatible with multiple class
libraries, it's useful to separate the VM-specific representation of
these classes from the library implementations.  This commit
introduces VMClass, VMField, and VMMethod for that purpose.
2010-09-01 10:13:52 -06:00
Joel Dice
a4914daae4 remove unused functions from powerpc.cpp 2010-08-30 16:55:48 -06:00
Joel Dice
be1ba2ccf8 fix gnu build 2010-08-16 09:24:27 -06:00
Joel Dice
fca98df55b fix process=interpret class initialization regression
A long time ago, I refactored the class initialization code in the VM,
but did not notice until today that it had caused the
process=interpret build to break on certain recursive initializations.
In particular, we were not always detecting when a thread recursively
tried to initialize a class it was already in the process of
initializing, leading to the mistaken assumption that another thread
was initializing it and that we should wait until it was done, in
which case we would wait forever.

This commit ensures that we always detect recursive initialization and
short-circuit it.
2010-08-04 18:27:54 -06:00
Joel Dice
ddc90ef76e fix 64-bit left shifts with constant shifts greater than or equal to 32
The shiftLeftC function in powerpc.cpp was miscompiling such shifts,
leading to crashes due to illegal instructions and other weirdness due
to instructions that meant something completely different.  This
commit fixes that and adds a test to Longs.java to make sure it stays
fixed.
2010-07-23 10:52:58 -06:00
Joel Dice
4034a219d0 do nothing in System.arraycopy if length <= 0
Previously, we risked segfaults by passing negative numbers to memcpy.

This commit also makes arraycopy throw an IndexOutOfBounds exception
instead of an ArrayStoreException if the specified offsets and lengths
would take us outside the bounds of one or both of the arrays, per the
Sun documentation.
2010-07-13 18:40:29 -06:00
Joel Dice
1f8130f566 handle virtual thunk case in MyProcessor::getStackTrace
If we catch the target thread in a virtual thunk when getting its
stack trace, we must assume its Thread::stack field is garbage and use
the register values instead.  Previously, we treated these thunks as
any other native code, leading to crashes when we tried to use the
garbage pointer.
2010-07-06 16:13:11 -06:00
Joel Dice
bf8eb52611 reduce CodeCapacity value to 16MB in bootimage.cpp
32MB was just slightly too large for PowerPC immediate call instructions
to span, and 16MB matches the JIT executable memory area we use in
compile.cpp.
2010-06-25 21:54:01 -06:00