Commit Graph

360 Commits

Author SHA1 Message Date
Joel Dice
9ba7c504da Merge remote branch 'origin/SWT3.7_UrlUpdates' into oss-master 2011-12-29 11:00:59 -07:00
Ben Limmer
b3850ac76d Initial attempt at resolving SWT3.7 missing operatons in Avian. Everything seems to be working except floatToIntBits, hence the test case failing. 2011-12-28 15:52:53 -07:00
Joel Dice
b29db7fece fix OpenJDK 7 build error
OpenJDK 7's javac doesn't seem to like that we're accessing
Enum.ordinal in compareTo when it's private.
2011-11-19 19:22:34 -07:00
Ben Limmer
89cdd9d0d2 Fixed bug where calling Process.destroy() on a PID that no longer exist kills all processes in Pgroup. 2011-11-09 13:26:36 -07:00
Ben Limmer
f1b0d995a8 Fixed bug where calling Process.destroy() on a PID that no longer exist kills all processes in Pgroup. 2011-11-09 13:18:04 -07:00
Joshua Warner
90dc552463 implement Process.destroy 2011-11-03 12:30:51 -06:00
Anonymous
16aa5c3d59 improve IOException message in the case of a Runtime.exec() failure
We now properly forward the errno value from the child when execvp()
fails, which the parent then uses to for the errno message as well as
including the failed command's name in the message.
2011-08-15 07:12:52 -06:00
Topher Lamey
10183a9870 Added AbstractMap for protobuf, and String getByte encoding for Latin-1 2011-08-12 13:30:51 -06:00
Joel Dice
c3824c6844 fix crash when encountering invokespecial call to abstract method
We must throw an AbstractMethodError when such a call is executed (not
when the call is compiled), so we compile this case as a call to a
thunk which throws such an error.
2011-07-17 19:54:55 -06:00
Joel Dice
c3fa08c430 fix Thread.interrupt and Thread.interrupted
These were both totally broken; the latter wasn't even implemented.
This commit fixes/implements them and adds a simple test to exercise
them.
2011-07-12 14:15:43 -06:00
Anonymous
794a45cb79 fix various ObjectOutputStream/ObjectInputStream bugs 2011-07-01 08:43:43 -06:00
Joel Dice
c0f39fbe0c implement System.nanoTime
This is a quick and coarse, but servicable, implementation.
2011-04-08 20:32:33 -06:00
Marcel van den Boer
76fa43548d Implementation of String.replace(CharSequence, CharSequence) 2011-04-08 20:31:33 -06:00
Joel Dice
16a8777fd2 override getResource(s) in SystemClassLoader
OpenJDK's java.lang.ClassLoader.getResource makes use of
sun.misc.Launcher to load bootstrap resources, which is not
appropriate for the Avian build, so we override it to ensure we get
the behavior we want.
2011-03-26 18:24:17 -06:00
Joel Dice
c743140e08 add new subroutine test
This test covers the case where a local stack slot is first used to
store an object reference and later to store a subroutine return
address.  Unfortunately, this confuses the VM's stack mapping code;
I'll be working on a fix for that next.

The new test requires generating bytecode from scratch, since there's
no reliable way to get javac to generate the code we want.  Since we
already had primitive bytecode construction code in Proxy.java, I
factored it out so we can reuse it in Subroutine.java.
2011-02-16 11:41:33 -07:00
Joel Dice
0ca7ed8c67 add Package.getName 2011-01-20 09:35:34 -07:00
Joel Dice
b57e734ceb implement Character.forDigit 2011-01-20 09:33:50 -07:00
Joel Dice
69dc2026a1 provide default implementation for ClassLoader.reallyFindLoadedClass
This is a non-standard method, so we shouldn't expect subclasses to
implement it.
2011-01-13 08:57:39 -07:00
Joel Dice
3d49173b0b avoid inifinite recursion if java.lang.Object is missing; refactoring
When trying to create an array class, we try to resolve
java.lang.Object so we can use its vtable in the array class.
However, if Object is missing, we'll try to create and throw a
ClassNotFoundException, which requires creating an array to store the
stack trace, which requires creating an array class, which requires
resolving Object, etc..  This commit short-circuits this process by
telling resolveClass not to create and throw an exception if it can't
find Object.

While doing the above work, I noticed that the implementations of
Classpath::makeThrowable in classpath-avian.cpp and
classpath-openjdk.cpp were identical, so I made makeThrowable a
top-level function.

Finally, I discovered that Thread.setDaemon can only be called before
the target thread has been started, which allowed me to simplify the
code to track daemon threads in the VM.
2010-12-09 19:38:12 -07:00
Joel Dice
a5742f5985 update copyright years 2010-12-05 20:21:09 -07:00
Joel Dice
1271678d41 various fixes for embedded resource loading in OpenJDK build 2010-12-05 17:40:50 -07:00
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
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
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
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
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
Zsombor Gegesy
7376425b24 dummy SecurityManager and related classes added 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
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
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
Joel Dice
1b31fb67e1 Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2010-06-15 18:27:51 -06:00
JET
b2f5e71d22 ARM and UTF-8 work 2010-04-14 09:26:50 -06:00
Joel Dice
a650f1affa provide more useful message when throwing exception from Field.set 2010-03-07 12:03:17 -07:00
Joel Dice
5d781a0584 declare Long.MAX_VALUE and Long.MIN_VALUE as longs, not Longs 2010-02-02 09:33:10 -07:00
Joel Dice
f588a62ae3 fix Classpath 0.98 compatibility issues 2009-12-22 21:34:04 -07:00
Joel Dice
70da0df46b add Class.getExceptionTypes method 2009-12-15 10:04:51 -07:00
Joel Dice
6118792ffd update copyright years 2009-12-02 19:08:29 -07:00
jent
f39469e71c Changes for better memory managment 2009-12-01 09:54:36 -07:00
Joel Dice
2efff818ea Merge commit 'origin/master' into wip 2009-10-27 09:17:54 -06:00
Joel Dice
a68742200b return empty stack trace for thread which isn't running 2009-10-26 11:44:29 -06:00
Joel Dice
5967246b37 Merge commit 'origin/master' into wip 2009-10-20 14:15:35 -06:00
Joel Dice
53588b94f3 compare lengths first in String.equals[IgnoreCase] for efficiency 2009-10-19 10:36:48 -06:00
Joel Dice
1faf93c163 fix typo in Proxy.makeInvokeCode 2009-09-19 16:27:28 -06:00
Joel Dice
953cb69e5e move proxy and annotation code from C++ to Java
This allows code shrinkers to remove it if it's not used by the application.
2009-09-19 16:21:15 -06:00
Joel Dice
7aa906d97b support runtime-visible annotations and java.lang.reflect.Proxy 2009-09-18 18:01:54 -06:00
Joel Dice
987330fed5 Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2009-08-28 16:18:36 -06:00
Joel Dice
cd41751912 ensure primitive names are zero-terminated in Class.getName 2009-08-28 16:17:23 -06:00
Joel Dice
73dc058c14 implement StackTraceElement.getFileName properly 2009-08-27 16:28:44 -06:00
Joel Dice
77ae259e41 throw ClassCastException if asked to compare Enums of different types 2009-08-21 16:06:12 -06:00
Joel Dice
71f1efc4cb add a couple of StringBuffer.append overloads 2009-08-20 08:59:22 -06:00
Joel Dice
c4b5ecec90 implement Runtime.addShutdownHook and Thread.setDaemon; avoid segfaults due to an application calling e.g. CallStaticBooleanMethod when it really meant CallStaticVoidMethod 2009-08-19 14:27:03 -06:00
Joel Dice
c4edabdc02 implement ClassLoader.resolveClass and ensure class is linked in e.g. Class.getMethods; minor bugfixes 2009-08-18 14:26:28 -06:00
Joel Dice
6d54b6cec8 add classes which I meant to add in earlier commits 2009-08-14 08:51:10 -06:00
Joel Dice
9553d56977 add AccessibleObject.setAccessible(AccessibleObject[],boolean) 2009-08-13 09:03:44 -06:00
Joel Dice
f96fa82607 add methods to Throwable 2009-08-13 09:03:04 -06:00
Joel Dice
017116d060 add ThreadGroup(String) constructor 2009-08-13 09:02:32 -06:00
Joel Dice
0d7a2fa2bc add methods to StringBuilder and fix logic error in getChars 2009-08-13 09:02:00 -06:00
Joel Dice
ae02212dd9 add a few methods to String; support ISO-8859-1 charset 2009-08-13 09:00:07 -06:00
Joel Dice
864a28f2ce throw IllegalArgumentException from Enum.valueOf if name does not match any value 2009-08-13 08:57:58 -06:00
Joel Dice
fb37f48237 add various methods to Class and fix getComponentType for primitive arrays 2009-08-13 08:57:06 -06:00
Joel Dice
0544ab381f fix Class.isArray for case this == Class.class 2009-08-12 19:40:52 -06:00
Joel Dice
dd82b58dad add String.lastIndexOf(String,int); defer to Pattern.split in String.split 2009-08-12 19:39:29 -06:00
Joel Dice
df1aee5981 replace slashes with dots in class name passed to Class.forName in Method.getParameterTypes 2009-08-11 09:25:05 -06:00
Joel Dice
d868815737 put thread into runnable state in Thread.start 2009-08-10 17:36:11 -06:00
Joel Dice
001000364d add classloader parameter to functions which may directly or indirectly load classes; include methods inherited from interfaces (but not explicitly declared) in method tables and virtual tables of abstract classes 2009-08-10 07:56:16 -06:00
Joel Dice
58c3a37277 specify classloader when calling Class.forCanonicalName in Field and Method; tolerate null argument array in Method.invoke 2009-08-10 07:48:44 -06:00
Joel Dice
5c72746d2c inherit thread group from current thread 2009-08-10 07:46:59 -06:00
Joel Dice
97ea23e3bb optionally specify classloader to Class.forCanonicalName 2009-08-10 07:46:05 -06:00
Joel Dice
1a2deff97d Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2009-08-09 14:43:53 -06:00
Joel Dice
6d27274aea update Class.PrimitiveFlag value to reflect change in machine.h; make Class.getName work for primitive types 2009-08-05 15:57:51 +00:00
Joel Dice
2de750768b add java.lang.reflect.Modifier.isInterface 2009-08-05 14:14:45 +00:00
Joel Dice
7050448ec5 implement Class.{get|set}Signers 2009-08-04 18:31:14 -06:00
Joel Dice
e18ab49f4d always pass null instance to native version of Method.invoke when invoking static methods 2009-08-04 18:30:16 -06:00
Joel Dice
54ceb80116 implement stub versions of java.security classes 2009-08-03 08:56:19 -06:00
Joel Dice
8c18f27e89 avoid NPE in String.equalsIgnoreCase 2009-07-28 17:00:11 -06:00
Joel Dice
27d863790c Merge branch 'win64' into gnu
Conflicts:

	makefile
	src/compile-x86.S
	src/x86.S
	src/x86.cpp
2009-07-25 20:48:36 -06:00
Joel Dice
70eedcdf97 replace slashes with dots in value returned by StackTraceElement.getClassName to make Classpath's java.util.logging.Logger happy 2009-06-06 21:08:36 -06:00
Joel Dice
4fca1d64ba fix thinko in String.regionMatches; ignore case when checking charsetName in String ctor 2009-06-06 20:30:58 -06:00
Joel Dice
a201d28e5c handle null loader parameter properly in Class.forName 2009-06-06 20:29:15 -06:00
Josh warner
bcad89dc17 handle null parameter types in various class methods 2009-06-05 14:28:55 -06:00
Joel Dice
16537a32bc fix logic in Thread.join(long) (second try) 2009-06-04 18:08:51 -06:00
Joel Dice
a064c744f4 fix logic in Thread.join(long) 2009-06-04 18:07:00 -06:00
Joel Dice
44e3ee5bd7 fix misspelling in comment 2009-06-04 18:03:09 -06:00
Joel Dice
0857f53651 more progress on GNU Classpath compatibility 2009-06-04 17:21:42 -06:00
Joel Dice
98be5c509e more progress towards GNU Classpath compatibility 2009-06-03 16:17:55 -06:00
Joel Dice
0615b8a09f add classes and methods needed for GNU Classpath compatibility
Most of these methods are stubs which throw
UnsupportedOperationExceptions for now.
2009-06-02 17:14:38 -06:00
Joel Dice
31d9700c9b move SystemClassLoader and Runtime.dumpHeap to avian package 2009-05-25 21:36:29 -06:00
Joel Dice
605ddffa31 avoid unecessary array copy in Long.toString 2009-04-26 12:46:55 -06:00
Eric Scharff
ed4c24c7f6 Removed temp files 2009-04-22 16:27:58 -06:00
mweaver
6b89ecd0ee Like a noob, I missed some things... broke the compilation. 2009-04-22 15:24:26 -06:00
Joel Dice
d1018bf078 update copyright years 2009-03-15 12:02:36 -06:00
J. Treadwell
8150d4a3b6 added toHexString() to java.lang.Long 2009-03-09 14:54:31 -06:00
Zsombor
8411cfbe8f add new constructor to the String :
public String(byte bytes[], int offset, int length, String
charsetName)
throws UnsupportedEncodingException;
2009-02-16 18:15:41 -07:00
Joel Dice
25ade1484a lots of bugfixes and refactoring 2008-12-01 19:38:00 -07:00
Joel Dice
20cf42c5e4 more work on boot image creation 2008-11-23 16:58:01 -07:00
J. Treadwell
3001c2067c changed String(byte[] bytes, String charsetName) to support only UTF-8 2008-11-12 10:19:21 -07:00
J. Treadwell
1f7f9319c3 Added UTF-8 support (still absent with string literals)! 2008-11-11 17:43:11 -07:00
Joel Dice
6a5116e7a7 implement primitive heap dump facility for memory profiling, accessible via Runtime.dumpHeap
The proper way to do this is to implement a subset of JVMTI, but this
will do the job for now.
2008-10-21 17:38:20 -06:00
Joel Dice
96d7bf571d implement a few methods to make SWT 3.4 happy 2008-10-10 11:49:28 -06:00
dain
4aa731bacf implemented getDeclaredConstructor method 2008-10-09 18:29:53 -06:00
dain
b19ce6378a Add Integer valueOf(String) method 2008-10-08 13:51:19 -06:00
J. Treadwell
8e79618392 added StringBuffer/Builder methods 2008-09-22 09:31:10 -06:00
Joel Dice
e0e827596e make Long.parseLong more efficient 2008-08-29 11:37:53 -06:00
Joel Dice
c8cc7d931b maintain a table to look up methods called via JNI
This simplifies the JNI implementation for looking up methods.  It also
fixes a bug where an applications calls GetStaticMethodID with class A
and then calls CallStatic<Type>Method with class B which extends A.  The
old code would look in the wrong method table and thus call the wrong
method.
2008-08-15 12:32:33 -06:00
Matt Weaver
56e708aab0 Added the final method "name()", not being used presently, but useful if toString() is overridden. 2008-08-12 16:21:39 -06:00
Eric Scharff
e45b1f68c7 prepend copyright notice and license to source files 2008-08-05 14:15:10 -06:00
Eric Scharff
7e0941f6fb Added java.lang.AssertionError 2008-08-05 14:06:37 -06:00
Eric Scharff
f601897d9e Accept uppercase letters as digits, per the spec for Character.digit 2008-08-05 14:05:36 -06:00
Matt Weaver
0bd29069f4 Added override, soley for documentation purposes (mark methods overriding parent) 2008-07-22 11:33:55 -06:00
Matt Weaver
244393430d Merge branch 'master' of git://oss.readytalk.com/avian 2008-07-16 11:26:29 -06:00
Matt Weaver
f81e9f7f5d Added for compliance. This makes IDEs happy, as certain types of "warning" casts are somewhat unavoidable. As it is small and potentially useful, I threw it in. 2008-07-14 11:05:33 -06:00
Zsombor
17a42c5611 add a few String methods 2008-07-13 20:34:13 -06:00
Zsombor
0ffba474fa implement additional Unicode support in Character 2008-07-13 20:33:26 -06:00
Zsombor
99fa6d1495 add StringBuilder.indexOf 2008-07-13 18:59:30 -06:00
Zsombor
2fe571c461 add StringBuffer.append(char[]) 2008-07-13 18:55:05 -06:00
Joel Dice
4ecce8286f fix recursive invocation of Thread constructor 2008-07-13 18:34:59 -06:00
Zsombor
e507a26081 add System.getProperties 2008-07-13 18:27:05 -06:00
Zsombor
0e539615e7 add Thread.name field 2008-07-13 18:21:04 -06:00
Joel Dice
a016eeaba0 fix Long.toString for Long.MIN_VALUE case 2008-07-13 17:54:44 -06:00
Eric Scharff
bba4f75c2f Tweaked code indentation and formatting to match existing style 2008-07-03 10:49:08 -06:00
Joel Dice
befdfa4e9e add copyright header to CharSequence.java 2008-07-03 09:36:55 -06:00
Zsombor
e3fd0d9c7d add a few classes and methods to the classpath
Add java.lang.CharSequence, java.util.AbstractSet,
java.util.AbstractCollection, Collections.unmodifiableSet,
 System.getProperty(String,String), etc.
2008-07-03 09:16:32 -06:00
Joel Dice
24d0ea0d9b use StackTraceElement.toString in Throwable.printStackTrace 2008-04-21 16:31:50 -06:00
Joel Dice
819588546e implement a few StackTraceElement methods 2008-04-21 16:30:41 -06:00
Joel Dice
d9ec8e20bf implement Thread.getStackTrace, activeCount, and enumerate 2008-04-11 16:48:39 -06:00
Joel Dice
e9eacd900d add Class.isInterface 2008-04-01 16:48:58 -06:00
Joel Dice
c9ef443944 add Modifier.isNative and isAbstract 2008-04-01 16:42:50 -06:00
Joel Dice
1b098c9267 implement ArithmeticException 2008-03-21 13:48:42 -06:00
Joel Dice
7dd9b96717 add additional methods and fields to class library 2008-03-20 18:40:18 -06:00
Joel Dice
8e1ec5794f implement java.util.Random and java.lang.Math.random in Java 2008-03-20 18:39:25 -06:00
Eric Scharff
89bc3bc4e7 Fix bug in StringBuilder.insert() 2008-03-05 12:10:59 -07:00
Eric Scharff
0d5b7bd126 Support for floating point conversions and tests
Floats and doubles can now be read from strings, using the C standard library
functions for this purpose (strtof and strtod).  The code also relies on
standard library functions to implement isNaN() and isInfinite()
2008-02-28 08:35:16 -07:00
Joel Dice
2edaa82801 prepend copyright notice and license to all source files; add license.txt and readme.txt 2008-02-19 11:06:52 -07:00
Dain
8a0ffe186f Adds appending of doubles to a StringBuffer 2008-01-30 16:26:30 -07:00
Joel Dice
7a262d0578 add java.lang.OutOfMemoryError 2008-01-29 08:18:23 -07:00
Joel Dice
bb701f309c implement StringBuffer.append(boolean) 2008-01-18 16:16:24 -07:00
Joel Dice
86704591e7 Throwable.initCause should return 'this' 2008-01-03 10:08:33 -07:00
Joel Dice
be5600d79d fix Integer.toHexString to treat its argument as unsigned 2007-12-26 12:17:52 -07:00
Joel Dice
f116225933 fix 64-bit arithmetic support on x86-32 2007-12-22 17:00:35 -07:00
Joel Dice
a867e4d587 snapshot 2007-12-21 17:26:55 -07:00
Eric Scharff
5af58548b7 Removed unused variable in StringBuilder. 2007-12-14 16:16:40 -07:00