mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
Merge commit '66f1b7cf8fb45a25323198ad0f95ccb74721e26d' into avian-pack
This commit is contained in:
commit
8bcdf63b92
@ -603,8 +603,8 @@ __on Linux:__
|
||||
|
||||
__on Mac OS X:__
|
||||
|
||||
$ g++ -I$JAVA_HOME/include -D_JNI_IMPLEMENTATION_ -c embedded-jar-main.cpp \
|
||||
-o main.o
|
||||
$ g++ -I$JAVA_HOME/include -I$JAVA_HOME/include/darwin \
|
||||
-D_JNI_IMPLEMENTATION_ -c embedded-jar-main.cpp -o main.o
|
||||
|
||||
__on Windows:__
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#define SO_PREFIX "lib"
|
||||
#ifdef __APPLE__
|
||||
#define SO_SUFFIX ".jnilib"
|
||||
#define SO_SUFFIX ".dylib"
|
||||
#include <TargetConditionals.h>
|
||||
#if !TARGET_IPHONE_SIMULATOR && !TARGET_OS_IPHONE
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
@ -28,44 +28,44 @@ extern "C" JNIEXPORT SOCKET JNICALL
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_java_net_Socket_connect(JNIEnv* e,
|
||||
jclass,
|
||||
SOCKET sock,
|
||||
long addr,
|
||||
short port)
|
||||
jlong sock,
|
||||
jlong addr,
|
||||
jshort port)
|
||||
{
|
||||
connect(e, sock, addr, port);
|
||||
connect(e, static_cast<SOCKET>(sock), addr, port);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_java_net_Socket_bind(JNIEnv* e,
|
||||
jclass,
|
||||
SOCKET sock,
|
||||
long addr,
|
||||
short port)
|
||||
jlong sock,
|
||||
jlong addr,
|
||||
jshort port)
|
||||
{
|
||||
bind(e, sock, addr, port);
|
||||
bind(e, static_cast<SOCKET>(sock), addr, port);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_java_net_Socket_abort(JNIEnv* e, jclass, SOCKET sock)
|
||||
Java_java_net_Socket_abort(JNIEnv* e, jclass, jlong sock)
|
||||
{
|
||||
abort(e, sock);
|
||||
abort(e, static_cast<SOCKET>(sock));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_java_net_Socket_close(JNIEnv* e, jclass, SOCKET sock)
|
||||
Java_java_net_Socket_close(JNIEnv* e, jclass, jlong sock)
|
||||
{
|
||||
close(e, sock);
|
||||
close(e, static_cast<SOCKET>(sock));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_java_net_Socket_closeOutput(JNIEnv* e, jclass, SOCKET sock)
|
||||
Java_java_net_Socket_closeOutput(JNIEnv* e, jclass, jlong sock)
|
||||
{
|
||||
close_output(e, sock);
|
||||
close_output(e, static_cast<SOCKET>(sock));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_java_net_Socket_closeInput(JNIEnv* e, jclass, SOCKET sock)
|
||||
Java_java_net_Socket_closeInput(JNIEnv* e, jclass, jlong sock)
|
||||
{
|
||||
close_input(e, sock);
|
||||
close_input(e, static_cast<SOCKET>(sock));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
|
@ -307,7 +307,7 @@ public class File implements Serializable {
|
||||
|
||||
private static native String readDir(long handle);
|
||||
|
||||
private static native long closeDir(long handle);
|
||||
private static native void closeDir(long handle);
|
||||
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
package java.io;
|
||||
|
||||
public class StringWriter extends Writer {
|
||||
private final StringBuilder out = new StringBuilder();
|
||||
private final StringBuffer out = new StringBuffer();
|
||||
|
||||
public void write(char[] b, int offset, int length) throws IOException {
|
||||
out.append(b, offset, length);
|
||||
@ -24,4 +24,8 @@ public class StringWriter extends Writer {
|
||||
public void flush() throws IOException { }
|
||||
|
||||
public void close() throws IOException { }
|
||||
|
||||
public StringBuffer getBuffer() {
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,9 @@ package java.lang;
|
||||
public final class Byte extends Number implements Comparable<Byte> {
|
||||
public static final Class TYPE = avian.Classes.forCanonicalName("B");
|
||||
|
||||
public static final byte MIN_VALUE = -128;
|
||||
public static final byte MAX_VALUE = 127;
|
||||
|
||||
private final byte value;
|
||||
|
||||
public Byte(byte value) {
|
||||
|
@ -17,6 +17,9 @@ public final class Double extends Number {
|
||||
public static final double POSITIVE_INFINITY = 1.0 / 0.0;
|
||||
public static final double NaN = 0.0 / 0.0;
|
||||
|
||||
public static final double MIN_VALUE = 2.22507385850720138309e-308;
|
||||
public static final double MAX_VALUE = 1.79769313486231570815e+308;
|
||||
|
||||
private final double value;
|
||||
|
||||
public Double(String value) {
|
||||
|
@ -18,7 +18,10 @@ public final class Float extends Number {
|
||||
public static final float NEGATIVE_INFINITY = -1.0f / 0.0f;
|
||||
public static final float POSITIVE_INFINITY = 1.0f / 0.0f;
|
||||
public static final float NaN = 0.0f / 0.0f;
|
||||
|
||||
|
||||
public static final float MIN_VALUE = 1.17549435082228750797e-38f;
|
||||
public static final float MAX_VALUE = 3.40282346638528859812e+38f;
|
||||
|
||||
private final float value;
|
||||
|
||||
public Float(String value) {
|
||||
|
@ -113,6 +113,8 @@ public final class Math {
|
||||
|
||||
public static native double atan(double v);
|
||||
|
||||
public static native double atan2(double y, double x);
|
||||
|
||||
public static native double sqrt(double v);
|
||||
|
||||
public static native double pow(double v, double e);
|
||||
|
@ -12,6 +12,8 @@ package java.lang;
|
||||
|
||||
public final class Short extends Number implements Comparable<Short> {
|
||||
public static final Class TYPE = avian.Classes.forCanonicalName("S");
|
||||
|
||||
public static final short MIN_VALUE = -32768;
|
||||
public static final short MAX_VALUE = 32767;
|
||||
|
||||
private final short value;
|
||||
|
@ -186,7 +186,7 @@ public final class String
|
||||
if (this == s) {
|
||||
return true;
|
||||
} else {
|
||||
return s.length == length && compareToIgnoreCase(s) == 0;
|
||||
return s != null && s.length == length && compareToIgnoreCase(s) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@ public class ServerSocketChannel extends SelectableChannel {
|
||||
}
|
||||
|
||||
public static ServerSocketChannel open() throws IOException {
|
||||
Socket.init();
|
||||
|
||||
return new ServerSocketChannel();
|
||||
}
|
||||
|
||||
|
6
classpath/java/util/NavigableMap.java
Normal file
6
classpath/java/util/NavigableMap.java
Normal file
@ -0,0 +1,6 @@
|
||||
package java.util;
|
||||
|
||||
public interface NavigableMap<K, V> extends SortedMap<K, V> {
|
||||
Map.Entry<K,V> firstEntry();
|
||||
Map.Entry<K,V> lastEntry();
|
||||
}
|
@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
public class TreeMap<K,V> implements SortedMap<K,V> {
|
||||
public class TreeMap<K,V> implements NavigableMap<K,V> {
|
||||
private final Comparator<K> comparator;
|
||||
private transient TreeSet<MyEntry<K,V>> set;
|
||||
|
||||
@ -50,6 +50,16 @@ public class TreeMap<K,V> implements SortedMap<K,V> {
|
||||
return comparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<K,V> firstEntry() {
|
||||
return set.first();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<K,V> lastEntry() {
|
||||
return set.last();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K firstKey() {
|
||||
return set.first().key;
|
||||
|
8
makefile
8
makefile
@ -67,7 +67,7 @@ ifeq ($(filter x86_64 i386 arm,$(arch)),)
|
||||
endif
|
||||
|
||||
ifeq ($(platform),darwin)
|
||||
x := $(error "please use 'platform=macosx' or 'platform=ios' instead of 'platform=$platform'")
|
||||
x := $(error "please use 'platform=macosx' or 'platform=ios' instead of 'platform=$(platform)'")
|
||||
endif
|
||||
|
||||
ifneq ($(ios),)
|
||||
@ -240,7 +240,6 @@ ifneq ($(android),)
|
||||
-g3 \
|
||||
-Werror \
|
||||
-Wno-shift-count-overflow
|
||||
|
||||
|
||||
# on Windows (in MinGW-based build) there are neither __BEGIN_DECLS nor __END_DECLS
|
||||
# defines; we don't want to patch every file that uses them, so we stub them in
|
||||
@ -837,7 +836,7 @@ ifeq ($(platform),windows)
|
||||
rpath =
|
||||
|
||||
lflags = -L$(lib) $(common-lflags) -lws2_32 -liphlpapi -mconsole
|
||||
cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500
|
||||
cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500 -U__STRICT_ANSI__
|
||||
|
||||
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
|
||||
openjdk-extra-cflags += -I$(src)/openjdk/caseSensitive
|
||||
@ -853,7 +852,8 @@ ifeq ($(platform),windows)
|
||||
build-system = windows
|
||||
static-on-windows = -static
|
||||
common-cflags += "-I$(JAVA_HOME)/include/win32"
|
||||
build-cflags = $(common-cflags) -I$(src) -I$(inc) -mthreads
|
||||
build-cflags = $(common-cflags) -I$(src) -I$(inc) -mthreads \
|
||||
-D_WIN32_WINNT=0x0500
|
||||
openjdk-extra-cflags =
|
||||
build-lflags = -L$(lib) $(common-lflags)
|
||||
ifeq ($(build-platform),cygwin)
|
||||
|
@ -88,6 +88,7 @@ SUNWprivate_1.1 {
|
||||
JVM_EnableCompiler;
|
||||
JVM_Exit;
|
||||
JVM_FillInStackTrace;
|
||||
JVM_FindClassFromCaller;
|
||||
JVM_FindClassFromClass;
|
||||
JVM_FindClassFromClassLoader;
|
||||
JVM_FindClassFromBootLoader;
|
||||
|
@ -15,15 +15,20 @@
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "stdarg.h"
|
||||
#include "stddef.h"
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "avian/types.h"
|
||||
#include "math.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef UNUSED
|
||||
#undef UNUSED
|
||||
@ -31,7 +36,7 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include "float.h"
|
||||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef linux
|
||||
@ -132,10 +137,16 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t;
|
||||
#define PATH_SEPARATOR ':'
|
||||
#endif // not PLATFORM_WINDOWS
|
||||
|
||||
#ifdef PRId64
|
||||
#define LLD PRId64
|
||||
#define ULD PRIu64
|
||||
#define LD PRIdPTR
|
||||
#define LX PRIxPTR
|
||||
#else
|
||||
#if (defined ARCH_x86_32) || (defined ARCH_arm)
|
||||
#define LD "ld"
|
||||
#if (defined _MSC_VER) || ((defined __MINGW32__) && __GNUC__ >= 4)
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)
|
||||
#define LLD "I64d"
|
||||
#else
|
||||
#define LLD "lld"
|
||||
@ -154,7 +165,7 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t;
|
||||
#define LD "ld"
|
||||
#define LX "lx"
|
||||
#if (defined _MSC_VER) || (defined __MINGW32__)
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)
|
||||
#define LLD "I64d"
|
||||
#define ULD "I64x"
|
||||
#else
|
||||
@ -172,7 +183,8 @@ typedef intptr_t __attribute__((__may_alias__)) intptr_alias_t;
|
||||
#else
|
||||
#error "Unsupported architecture"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#define SO_PREFIX ""
|
||||
#else
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define BOOTCLASSPATH_PREPEND_OPTION "bootclasspath/p"
|
||||
#define BOOTCLASSPATH_OPTION "bootclasspath"
|
||||
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
|
||||
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
|
||||
|
||||
namespace vm {
|
||||
|
||||
|
@ -1441,6 +1441,7 @@ Classpath* makeClasspath(System* system,
|
||||
const char* embedPrefix);
|
||||
|
||||
typedef uint64_t(JNICALL* FastNativeFunction)(Thread*, GcMethod*, uintptr_t*);
|
||||
typedef void(JNICALL* FastVoidNativeFunction)(Thread*, GcMethod*, uintptr_t*);
|
||||
|
||||
inline GcClass* objectClass(Thread*, object o)
|
||||
{
|
||||
|
@ -1255,15 +1255,6 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
return reinterpret_cast<int64_t>(primitiveClass(t, arguments[0]));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
Avian_java_lang_Class_getDeclaringClass(Thread* t,
|
||||
object,
|
||||
uintptr_t* arguments)
|
||||
{
|
||||
return reinterpret_cast<intptr_t>(getDeclaringClass(
|
||||
t, cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]))->vmClass()));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||
Avian_java_lang_Class_getEnclosingMethod(Thread* t,
|
||||
object,
|
||||
|
@ -4237,6 +4237,49 @@ extern "C" AVIAN_EXPORT void JNICALL
|
||||
run(t, jvmResolveClass, arguments);
|
||||
}
|
||||
|
||||
uint64_t jvmFindClassFromCaller(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
const char* name = reinterpret_cast<const char*>(arguments[0]);
|
||||
jboolean init = arguments[1];
|
||||
jobject loader = reinterpret_cast<jobject>(arguments[2]);
|
||||
// jclass caller = reinterpret_cast<jclass>(arguments[3]);
|
||||
|
||||
/* XXX The caller's protection domain should be used during
|
||||
the resolveClass but there is no specification or
|
||||
unit-test in OpenJDK documenting the desired effect */
|
||||
|
||||
GcClass* c = resolveClass(
|
||||
t,
|
||||
loader ? cast<GcClassLoader>(t, *loader) : roots(t)->bootLoader(),
|
||||
name,
|
||||
true,
|
||||
static_cast<Gc::Type>(GcClassNotFoundException::Type));
|
||||
|
||||
if (init) {
|
||||
PROTECT(t, c);
|
||||
|
||||
initClass(t, c);
|
||||
}
|
||||
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, getJClass(t, c)));
|
||||
}
|
||||
|
||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||
EXPORT(JVM_FindClassFromCaller)(Thread* t,
|
||||
const char* name,
|
||||
jboolean init,
|
||||
jobject loader,
|
||||
jclass caller)
|
||||
{
|
||||
uintptr_t arguments[] = {reinterpret_cast<uintptr_t>(name),
|
||||
init,
|
||||
reinterpret_cast<uintptr_t>(loader),
|
||||
reinterpret_cast<uintptr_t>(caller)};
|
||||
|
||||
return reinterpret_cast<jclass>(
|
||||
run(t, jvmFindClassFromCaller, arguments));
|
||||
}
|
||||
|
||||
uint64_t jvmFindClassFromClassLoader(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
const char* name = reinterpret_cast<const char*>(arguments[0]);
|
||||
|
@ -114,7 +114,7 @@ inline uint32_t popInt(Thread* t)
|
||||
{
|
||||
if (DebugStack) {
|
||||
fprintf(stderr,
|
||||
"pop int %" ULD " at %d\n",
|
||||
"pop int %" LD " at %d\n",
|
||||
t->stack[((t->sp - 1) * 2) + 1],
|
||||
t->sp - 1);
|
||||
}
|
||||
@ -167,7 +167,7 @@ inline uint32_t peekInt(Thread* t, unsigned index)
|
||||
{
|
||||
if (DebugStack) {
|
||||
fprintf(
|
||||
stderr, "peek int %" ULD " at %d\n", t->stack[(index * 2) + 1], index);
|
||||
stderr, "peek int %" LD " at %d\n", t->stack[(index * 2) + 1], index);
|
||||
}
|
||||
|
||||
assertT(t, index < stackSizeInWords(t) / 2);
|
||||
@ -641,8 +641,15 @@ unsigned invokeNative(Thread* t, GcMethod* method)
|
||||
marshalArguments(
|
||||
t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, true);
|
||||
|
||||
result = reinterpret_cast<FastNativeFunction>(native->function())(
|
||||
if(method->returnCode() != VoidField) {
|
||||
result = reinterpret_cast<FastNativeFunction>(native->function())(
|
||||
t, method, RUNTIME_ARRAY_BODY(args));
|
||||
}
|
||||
else {
|
||||
result = 0;
|
||||
reinterpret_cast<FastVoidNativeFunction>(native->function())(
|
||||
t, method, RUNTIME_ARRAY_BODY(args));
|
||||
}
|
||||
}
|
||||
|
||||
pushResult(t, method->returnCode(), result, false);
|
||||
|
Loading…
Reference in New Issue
Block a user