Commit Graph

539 Commits

Author SHA1 Message Date
Joel Dice
d4708907ea fix non-openjdk build 2010-11-27 11:31:34 -07:00
Joel Dice
459f4d5194 fix openjdk-src bootimage build
The main change here is to use a lazily-populated vector to associate
runtime data with classes instead of referencing them directly from
the class which requires updating immutable references in the heap
image.  The other changes employ other strategies to avoid trying to
update immutable references.
2010-11-26 12:41:31 -07:00
Joel Dice
a611ccda6f Merge remote branch 'origin/master' into openjdk
Conflicts:
	makefile
	src/compile.cpp
	src/compiler.cpp
	src/type-generator.cpp
2010-11-16 10:18:08 -07:00
Joel Dice
44f55673d6 fix handle leaks in Windows Process implementation 2010-11-09 14:56:26 -07:00
Joel Dice
2d60398e63 fix bug which caused Runtime.exec to block until process exits 2010-11-09 12:38:23 -07:00
Joel Dice
ababc5748d fix regression in last commit
My last commit unintentionally changed the return type of Runtime.exec
to Runtime.MyProcess instead of Process.
2010-11-09 11:21:55 -07:00
Joel Dice
3d18f88ad9 fix Runtime.exec bugs
The first bug affected POSIX systems: if the app never called
Process.waitFor, we'd never call waitpid on the child and thus leak a
zombie process.  This patch ensures that we always call waitpid by
spawning a thread to handle it.

The second bug affected Windows systems: we weren't closing the
child's ends of the stdin, stdout, and stderr pipes after process
creation, which lead to us blocking forever while reading from the
child's stdout or stderr.
2010-11-09 10:22:23 -07:00
Joel Dice
580e7e1b3f remove @Overload annotation since Java 1.5.0_19 chokes on it 2010-11-07 12:57:42 -07: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
5ade8d1cf6 use GetSystemTimeAsFileTime instead of _ftime on Windows
It seems that _ftime has devolved to only giving 1-second resolution
on Windows 7.  GetSystemTimeAsFileTime does better, so that's what
we'll use.
2010-10-28 20:30:49 -06:00
Joel Dice
5cbfee467c fix Runtime.exec on Posix
Due to a silly cut-and-paste error, we were incorrectly passing the
stdout and stderr file descriptors back from native code to Java,
which prevented reading the output of the child process.
2010-10-22 14:39:38 -06:00
Joel Dice
b3accf1b30 ServerSocketChannel throws IOException, not Exception 2010-10-13 13:38:31 -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
268d2de175 cache array class lookups in element class; misc. bugfixes 2010-09-25 15:54:01 -06:00
Joel Dice
c939d16687 formatting tweak in Classes.java 2010-09-25 15:51:30 -06:00
Joel Dice
0456a9fd49 define user.dir property in Java_java_lang_System_getProperty 2010-09-20 17:28:42 -06:00
Joel Dice
64e42da348 implement avian.Handler.ResourceInputStream.available 2010-09-17 16:11:04 -06:00
Joel Dice
7fffba29e6 Keep reading in BufferedInputStream.read until in.available() <= 0
This corresponds to the documented behavior of OpenJDK's version.
2010-09-17 16:08:42 -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
76132bec90 set wsaInitialized to true on success in Java_java_net_Socket_init 2010-09-13 19:50:24 -06:00
Joel Dice
74a87a7f4f use _waccess on windows to implement File.can{Read|Write} 2010-09-12 14:46:14 -06:00
Joel Dice
345c7d38a9 Merge http://github.com/gzsombor/avian into gzsombor 2010-09-12 14:33:02 -06:00
Joel Dice
522f8ca1a5 javadoc grammar correction in Continuations.java 2010-09-12 14:29:27 -06:00
Zsombor Gegesy
6752505cb8 add File.canRead()/File.canWrite() implementation 2010-09-11 21:23:46 +02:00
Zsombor Gegesy
7376425b24 dummy SecurityManager and related classes added 2010-09-11 21:23:46 +02:00
Zsombor Gegesy
6985e81503 add Properties.load(Reader) implementation 2010-09-11 21:23:46 +02:00
Zsombor Gegesy
5dadac2cb8 API additions for compatibility with harmony's java.util package 2010-09-11 21:23:46 +02:00
Zsombor Gegesy
fc2c6d5100 implement toLowerCase(Locale) in the default case 2010-09-11 21:23:46 +02: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
250a77dc13 handle empty strings properly in Pattern.split
We were incorrectly returning an empty array when the input was empty,
whereas we ought to return an array containing a single empty string.
When the pattern to match was empty, we went into a loop to create an
infinite list of empty strings, only to crash once we've run out of
memory.  This commit addresses both problems.
2010-09-06 11:16:27 -06:00
Eric Scharff
a26eb1b2b9 Fix missing flush in PrintStream 2010-09-05 09:07:18 -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
4273ff834c remove uncessary parentheses from Enum.java 2010-09-01 10:10:11 -06:00
Zsombor Gegesy
4169425307 add error classes 2010-08-16 09:23:48 -06:00
Zsombor Gegesy
a50fda1a5e add ClassLoader.getResources calls 2010-08-16 09:23:48 -06:00
Zsombor Gegesy
03b66375f4 add Collections.enumeration(Collection<T> c) 2010-08-16 09:23:48 -06:00
Zsombor Gegesy
4dc05844df add java.util.Properties.propertyNames() method 2010-08-16 09:23:48 -06:00
Zsombor Gegesy
1daa93d3c4 add ability to append to files 2010-08-16 09:23:48 -06:00
Joel Dice
f0f35a920f return a useful value from InflaterInputStream.available
Note the following excerpt from PNGFileFormat.java in SWT:

     /*
     * InflaterInputStream does not consume all bytes in the stream
     * when it is closed. This may leave unread IDAT chunks. The fix
     * is to read all available bytes before closing it.
     */
     while (stream.available() > 0) stream.read();
     stream.close();

This code relies on the documented behavior of
InflaterInputStream.available, which must return "0 after EOF has been
reached, otherwise always return 1".  This is unlike
InputStream.available, which is documented to return "the number of
bytes that can be read (or skipped over) from this input stream
without blocking by the next caller of a method for this input
stream", and says nothing about how many bytes are left until the end
of stream.

This commit modifies InflaterInputStream.available to behave according
to Sun's documentation.
2010-08-04 18:54:47 -06:00
Joel Dice
f0129665c6 fix corruption of old revisioins in PersistentSet
In PersistentSet.remove, we were modifying the child node in place
instead of making a copy to update, which would corrupt older
revisions.  This commit ensures that we always create a copy if
necessary.
2010-07-30 12:23:41 -06:00
Joel Dice
b3da635b63 add java.nio.channels.Channels implementation 2010-07-13 18:03:25 -06:00
Joel Dice
a3daeee1f6 Merge branch 'dns' 2010-07-02 12:39:41 -06:00
Joel Dice
5e7e539c2a fix non-windows java-net.cpp build 2010-07-02 09:36:55 -06:00
Joel Dice
cdc48da493 grammar tweaks to Continuations.java JavaDoc 2010-06-15 18:40:12 -06:00
Joel Dice
1b31fb67e1 Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2010-06-15 18:27:51 -06:00
Joel Dice
47d9039b69 switch from gethostbyname to getaddrinfo on POSIX systems
gethostbyname may return any combination of IPv4 and IPv6 addresses,
and it's not safe to assume the first address is IPv4, which is all
our code is currently prepared to handle.  In contrast, getaddrinfo
allows us to specify whether we want IPv4, IPv6, or both.

We should eventually make this switch on Windows as well, but the
status of getaddrinfo in Windows 2000 is not clear, and MinGW's
ws2tcpip.h only declares it for XP and above.

This commit also adds InetAddress.getByName for explicit DNS lookups.
2010-06-14 16:09:56 -06:00
Joel Dice
f3a1c3253e use closesocket instead of close on Windows
MinGW's close apparently does nothing, and MSVC's headers don't even
declare it, so closesocket is the way to go.
2010-06-04 18:45:13 -06:00