Commit Graph

1084 Commits

Author SHA1 Message Date
Jasper Siepkes
c918f2c2e0 Added basic support for the Runtime.maxFree() method. Some applications (BouncyCastle
for example) expect to be able to call this method.
2016-12-16 10:44:11 +01:00
Joel Dice
befa410714 fix jdk-test build 2016-12-07 11:20:43 -07:00
Joel Dice
678d7debda fix bootimage build
We now detect both metafactory and altMetafactory lambdas when
bootimage-compiling invokedynamic instructions, as well as make
allowance for the same lambda being invoked by multiple invokedynamic
instructions (as is the case for Serializable lambdas).
2016-12-05 17:43:17 -07:00
Joel Dice
138699e203 fix build regression and add copyright headers 2016-12-04 21:27:38 -07:00
Joel Dice
69426b9945 fix some lambda bugs
For lambdas that implement java.io.Serializable, the compiler emits
calls to LambdaMetaFactory.altMetafactory, not
LambdaMetaFactory.metafactory, so I've provided a stub implementation
that ignores that currently ignores the extra parameters it receives.

This also fixes a bug in compiling lambda glue code for lambdas that
take longs and/or doubles.
2016-12-04 21:06:07 -07:00
Joel Dice
212e1977aa override write(byte[]) in DeflaterOutputStream
Otherwise, it will inherit the version from FilterOutputStream, which
is not consistent with the write(byte[],int,int) or write(int)
implementations.
2016-08-23 22:39:30 -06:00
Joel Dice
a538f54033 add sun.misc.Unsafe.putDouble(Object,long,double) 2016-03-01 18:28:04 -07:00
Luke Wahlmeier
62a03898c3 Merge remote-tracking branch 'rt/master' 2016-01-10 12:10:47 -07:00
Luke Wahlmeier
9d87e3b2a7 added get/put float/double to ByteBuffers, as well as duplicate 2016-01-10 03:03:03 -07:00
keinhaar
524f034bac Added support for HTTP URL connections, and fixed SocketInputStream and BufferedInputStream.
Did some cleanup as proposed by the main developers.
- Bigger HTTP Header Buffer
- Exception if Header is anyway exceeded.
- Linebreaks on HTTP Request fixed to standard.
- Only stop header reading on \r\n\r\n and no longer on \n\n\n\n
- Simplyfied the code to stop if buffer could not be filled.
- Handle special case if buffer has length 0, like specified in the Java API
- Socket will no longer fill the buffer completely
2015-12-26 11:58:40 +01:00
Joel Dice
9abba8fe24 add bootimage-test option to makefile
This option specifies that the test classes should be AOT-compiled
along with the class library, which allows us to test that everything
works in AOT-compiled form as well as JIT-compiled form.  This is
primarily motivated by the need to test d906db6 (support for
AOT-compilation of Java 8 lambda expressions).

Note that I had to tweak Misc because it tested something that
couldn't be done in an AOT build without a lot of extra work, and
SystemClassLoader.getPackage because it was returning null when the
requested package could not be populated with JAR manifest metadata.
Technically, we probably *should* return null for packages that don't
exist at all (in the sense that no classes have been loaded from such
a package), but tracking that kind of thing seems like more trouble
than it's worth unless someone complains about it.
2015-10-19 15:10:53 -06:00
Joshua Warner
d906db633c Merge pull request #454 from dicej/aot-lambda
support AOT-compilation of Java 8 lambda expressions
2015-09-28 07:44:51 -06:00
Joel Dice
d5a5b5309a support AOT-compilation of Java 8 lambda expressions
These expressions are tricky because they rely on invokedynamic, which
normally implies runtime code generation.  However, since lambdas
don't actually use the "dynamicness" of invokedynamic, we can convert
them into static calls to synthetic classes at compile time.

Since I had already written code to synthesize such classes in Java
and I didn't want to rewrite it in C++, I needed to add support for
running Java code to the bootimage generator.  And since the primary
VM used by the generator is purpose-built to generate AOT-compiled
code for a specific target architecture and is not capable of
generating or running JIT-compiled code for the host architecture, I
added support for loading a second, independent, host-specific VM for
running Java code.

The rest of the patch handles the fact that each method compilation
might cause new, synthetic classes to be created, so we need to make
sure those classes and their methods are included in the final heap
and code images.  This required breaking some giant code blocks out of
makeCodeImage into their own methods, which makes the diff look
scarier than it really is.
2015-09-13 14:21:24 -06:00
Joel Dice
9b2a02e92b avoid calling unrelated JNI methods during class initialization
The main goal here is to avoid making JNI calls from code that really
shouldn't need JNI (e.g. before this patch, ArrayList.add called
Math.max, which called Math.<clinit>, which called Random.<init>,
which called System.currentTimeMillis).

Besides following the "pay for only what you need" principle, this
change ensures we can call LambdaMetaFactory methods during AOT
compilation with a minimal VM (i.e. without compiling in JNI methods
we don't need).
2015-09-12 19:58:50 -06:00
Joshua Warner
e2f2ed68f0 ignore leading / for files on Windows (fixes #452) 2015-09-02 08:31:30 -06:00
Joel Dice
8a7944d25c add support for openjdk=$JDK8_HOME
All tests pass for the process=compile build.  Next step: process=interpret.
2015-08-06 13:30:18 -06:00
Joel Dice
2465459079 implement basic Java 8 lambda support
The two big pieces here are basic invokedynamic support and a working
version of LambdaMetaFactory.metafactory.  The latter works by
dynamically building a synthetic class with three methods: a static
factory method, a constructor for the factory method to call, and a
method to satisfy the requested interface which defers to the
specified MethodHandle.

This work relies heavily on Avian's specific MethodType and
MethodHandle implementations, which provide extra, non-standard
features to make code generation easier.  That means we'll probably
need to use Avian's versions of java.lang.invoke.* even when building
with the OpenJDK or Android class libraries.
2015-08-06 13:30:18 -06:00
joshuawarner32@gmail.com
792684b935 first pass at minimal invokedynamic support for Java 8 lambdas
This is a bunch of commits squashed into one per Josh's request.

add dynamicTable field

add invokedynamic instruction

add defaultDynamic bootimage field

add dummy invokedynamic support in bootimage-generator

add defaultDynamic thunk

check dynamicTable offset

comment defaultDynamicThunk to fix unused function

comment defaultDynamicThunk to fix unused function

add dynamicTable / dynamicIndex stuff

comment dynamicIndex and dynamicTable

add invokedynamic instruction impl

stub out addDynamic

unstub addDynamic

don't allow tail calls in invokedynamic

implement stub JVM_GetTemporaryDirectory method

(build broken) begin add InvokeDynamicTest

Revert "(build broken) begin add InvokeDynamicTest"

This reverts commit 77f9c54e32ac66d0803eeab93e4a10d3541987a8.

add InternalError

add URLClassPath.c for openjdk-src builds

implement stub JVM_KnownToNotExist and JVM_GetResourceLookupCache methods

intercept open0 / open for openjdk

add basic java/lang/invoke stubs

remove non-public java/lang/invoke classes

fix invokedynamic example building

<wip debugging>
2015-08-06 13:30:05 -06:00
BCG
4093036e6f Closeable extends AutoCloseable; RandomAccessFile implements DataInput 2015-08-06 13:28:47 -06:00
BCG
b766193966 Fixed method signatures on format() methods to return PrintStream as in OpenJDK 2015-07-28 22:41:40 -04:00
BCG
a8bed52097 Added java.util.Formatter implementation. Basic/common formats work,
such as %s, %d, %x... also width, left justify, zerofill flags are
implemented. Many of the other formats do not work, see the comments in
avian.FormatString javadoc and look for FIXME and TODO items for more
information on features that are known to not work correctly.
2015-03-17 01:08:07 -04:00
Joel Dice
cbde34620c update copyright years 2015-03-13 12:52:59 -06:00
Brandon Craig
9928597543 repatch windows file delete 2015-03-06 14:37:06 -07:00
Brandon Craig
a188b15f2e fix java.io.File.delete() implementation for windows 2015-02-19 14:55:48 -07:00
Marcin Olawski
a5ff62fbad Swap the directionality of the links in Cell. 2015-02-08 22:38:56 +01:00
Marcin Olawski
0537cb4775 Add ByteArrayOutputStream.writeTo(OutputStream), UTFDataFormatException and Modifier.isTransient(int). 2015-02-08 16:09:08 +01:00
Marcin Olawski
ff17455baa Add Arrays.fill(* a,int start,int stop,* value). 2015-02-07 21:12:48 +01:00
Marcin Olawski
6462c159aa Add ArrayIndexOutOfBoundsException(int) and ClassNotFoundException.getException(). 2015-02-07 21:12:04 +01:00
Marcin Olawski
6f8a8b9436 Added Character.isJavaIdentifierStart(int), isJavaIdentifierPart(int) and made isJavaIdentifierStart(char), isJavaIdentifierPart(char) more compact. 2015-02-06 20:07:51 +01:00
Marcin Olawski
ab3ee4c6e2 Add Character.isJavaIdentifierStart(char ch) and isJavaIdentifierPart(char ch) 2015-02-06 15:26:40 +01:00
Joel Dice
c2a0210c7b fix ARM64 iOS JNI crashes
As documented at
https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html,
the ARM64 iOS ABI differs from the generic ABI in a few important
ways.  Specifically, arguments passed via the stack are aligned
according to their natural alignment instead of 8 bytes.  The VM's
dynamic call code was aligning each argument to 8 bytes, so native JNI
code couldn't find them in their expected places.

Also, we weren't setting the "os.arch" system property on ARM64, so I
fixed that too.
2015-02-05 17:20:53 -07:00
Joel Dice
d37cb93d50 remove redundant class qualifiers from Classes.java 2014-12-29 10:00:51 -07:00
Mike Jensen
ee0ad22415 Undo my collections changes, as I was wrong here 2014-12-15 17:15:00 -07:00
Mike Jensen
32a1fb21f2 Some small classpath tweaks to be compatible with openJDK's api 2014-12-15 16:26:41 -07:00
Mike Jensen
7baa5243b0 Add Collections.synchronizedList to classpath 2014-12-12 11:35:39 -07:00
Joel Dice
66f1b7cf8f Merge pull request #370 from lostdj/patch-8
Added missing MIX/MAX_VALUE for basic types.
2014-11-19 08:15:16 -07:00
lostdj
0ec230497b Added missing MIX/MAX_VALUE for basic types. 2014-11-19 14:27:11 +03:00
Timofey Lagutin
e657863656 String.equalsIgnoreCase(): fix nullptrex.
It's logical and conforms OpenJDK..
2014-11-19 14:06:31 +03:00
Joel Dice
78a0e207c0 Merge pull request #367 from lostdj/patch-6
Fix some native and managed function signatures.
2014-11-11 14:33:51 -07:00
lostdj
3cff81da8d Fix some native and managed function signatures. 2014-11-08 14:06:11 +03:00
Joel Dice
4fd8396ba3 fix WSA error 10093 when openning a ServerSocketChannel
We need to call Socket.init before trying to use the Windows Socket
library.  We were already doing this in SocketChannel.open, but not in
ServerSocketChannel.open.
2014-11-07 11:31:19 -07:00
Joel Dice
8ac58b7d77 add minimal NavigableMap interface 2014-11-05 14:27:24 -07:00
Joel Dice
2776e98bf5 use .dylib instead of .jnilib as OS X library suffix
This matches the behavior of System.mapLibraryName on
JDK 7 and later.
2014-10-28 14:53:43 -06:00
Joel Dice
f25d5921a5 implement StringWriter.getBuffer
This is used by json.org's JSON library.
2014-10-28 14:52:02 -06:00
Joshua Warner
331c635814 Merge pull request #357 from lostdj/patch-2
Added missing cp/avian/Math.atan2(double,double)
2014-10-11 20:47:17 -06:00
Ilya Mizus
75dda14691 Fixed small bug in getClassType() function. 2014-10-11 23:36:14 +04:00
Timofey Lagutin
d4d31af740 Added missing cp/avian/Math.atan2(double,double)
It was implemented as native function, but wasn't added to java.lang.Math.
2014-10-11 14:33:48 +04:00
Timofey Lagutin
a820370cb2 cp/avian/java-net.cpp: fix segfault
In Java_java_net_InetAddress_ipv4AddressForName:
  Throw nullptrex on hostname = null.
2014-10-10 19:06:36 +04:00
Ilya Mizus
85fec988d5 Added Class.getGenericSuperclass() and improved Member subclasses. Fixed Makefile on OS X 2014-10-09 02:32:56 +04:00
Joel Dice
998f99af44 Merge remote-tracking branch 'bfbc/avian-pack'
Conflicts:
	makefile
2014-10-08 14:04:00 -06:00