mirror of
https://github.com/corda/corda.git
synced 2025-06-01 23:20:54 +00:00
Merge remote branch 'oss/master'
This commit is contained in:
commit
3793174bb0
@ -50,7 +50,7 @@ import java.util.concurrent.Callable;
|
|||||||
* frames from within that context.
|
* frames from within that context.
|
||||||
*
|
*
|
||||||
* <p>Calling a continuation (i.e. feeding it a result or exception)
|
* <p>Calling a continuation (i.e. feeding it a result or exception)
|
||||||
* causes the current continuation to be replaced with the calling
|
* causes the current continuation to be replaced with the called
|
||||||
* continuation. When the last method in this new continuation
|
* continuation. When the last method in this new continuation
|
||||||
* returns, it returns to the native frame which created the current
|
* returns, it returns to the native frame which created the current
|
||||||
* context, which may or may not be the same as the context in which
|
* context, which may or may not be the same as the context in which
|
||||||
|
26
classpath/avian/Iso88591.java
Normal file
26
classpath/avian/Iso88591.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
/* Copyright (c) 2011, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package avian;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
public class Iso88591 {
|
||||||
|
|
||||||
|
public static byte[] encode(char[] s16, int offset, int length) {
|
||||||
|
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||||
|
for (int i = offset; i < offset+length; ++i) {
|
||||||
|
// ISO-88591-1/Latin-1 is the same as UTF-16 under 0x100
|
||||||
|
buf.write(s16[i]);
|
||||||
|
}
|
||||||
|
return buf.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -314,10 +314,29 @@ Java_java_io_File_toCanonicalPath(JNIEnv* /*e*/, jclass, jstring path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jstring JNICALL
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
Java_java_io_File_toAbsolutePath(JNIEnv* /*e*/, jclass, jstring path)
|
Java_java_io_File_toAbsolutePath(JNIEnv* e UNUSED, jclass, jstring path)
|
||||||
{
|
{
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
// todo
|
// todo
|
||||||
return path;
|
return path;
|
||||||
|
#else
|
||||||
|
jstring result = path;
|
||||||
|
string_t chars = getChars(e, path);
|
||||||
|
if (chars) {
|
||||||
|
if (chars[0] != '/') {
|
||||||
|
char* cwd = getcwd(NULL, 0);
|
||||||
|
if (cwd) {
|
||||||
|
unsigned size = strlen(cwd) + strlen(chars) + 2;
|
||||||
|
RUNTIME_ARRAY(char, buffer, size);
|
||||||
|
snprintf(RUNTIME_ARRAY_BODY(buffer), size, "%s/%s", cwd, chars);
|
||||||
|
result = e->NewStringUTF(RUNTIME_ARRAY_BODY(buffer));
|
||||||
|
free(cwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
releaseChars(e, path, chars);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -48,6 +48,7 @@
|
|||||||
# define SO_SUFFIX ".so"
|
# define SO_SUFFIX ".so"
|
||||||
# endif
|
# endif
|
||||||
# include "unistd.h"
|
# include "unistd.h"
|
||||||
|
# include "limits.h"
|
||||||
# include "sys/time.h"
|
# include "sys/time.h"
|
||||||
# include "sys/sysctl.h"
|
# include "sys/sysctl.h"
|
||||||
# include "sys/utsname.h"
|
# include "sys/utsname.h"
|
||||||
@ -410,8 +411,8 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass,
|
|||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
|
|
||||||
// Error if here
|
// Error if here
|
||||||
char c = errno;
|
int val = errno;
|
||||||
ssize_t rv UNUSED = write(msg[1], &c, 1);
|
ssize_t rv UNUSED = write(msg[1], &val, sizeof(val));
|
||||||
exit(127);
|
exit(127);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -424,12 +425,13 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass,
|
|||||||
safeClose(err[1]);
|
safeClose(err[1]);
|
||||||
safeClose(msg[1]);
|
safeClose(msg[1]);
|
||||||
|
|
||||||
char c;
|
int val;
|
||||||
int r = read(msg[0], &c, 1);
|
int r = read(msg[0], &val, sizeof(val));
|
||||||
if(r == -1) {
|
if(r == -1) {
|
||||||
throwNewErrno(e, "java/io/IOException");
|
throwNewErrno(e, "java/io/IOException");
|
||||||
return;
|
return;
|
||||||
} else if(r) {
|
} else if(r) {
|
||||||
|
errno = val;
|
||||||
throwNewErrno(e, "java/io/IOException");
|
throwNewErrno(e, "java/io/IOException");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -590,7 +592,8 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
|
|||||||
} else if (strcmp(chars, "java.io.tmpdir") == 0) {
|
} else if (strcmp(chars, "java.io.tmpdir") == 0) {
|
||||||
r = e->NewStringUTF("/tmp");
|
r = e->NewStringUTF("/tmp");
|
||||||
} else if (strcmp(chars, "user.dir") == 0) {
|
} else if (strcmp(chars, "user.dir") == 0) {
|
||||||
r = e->NewStringUTF(getenv("PWD"));
|
char buffer[PATH_MAX];
|
||||||
|
r = e->NewStringUTF(getcwd(buffer, PATH_MAX));
|
||||||
} else if (strcmp(chars, "user.home") == 0) {
|
} else if (strcmp(chars, "user.home") == 0) {
|
||||||
r = e->NewStringUTF(getenv("HOME"));
|
r = e->NewStringUTF(getenv("HOME"));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -120,6 +120,10 @@ public class File implements Serializable {
|
|||||||
return toAbsolutePath(path);
|
return toAbsolutePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getAbsoluteFile() {
|
||||||
|
return new File(getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
private static native long length(String path);
|
private static native long length(String path);
|
||||||
|
|
||||||
public long length() {
|
public long length() {
|
||||||
|
@ -161,7 +161,7 @@ public class ObjectInputStream extends InputStream {
|
|||||||
case 'n':
|
case 'n':
|
||||||
return null;
|
return null;
|
||||||
case 'z':
|
case 'z':
|
||||||
return (readLongToken() == 0);
|
return (readLongToken() != 0);
|
||||||
case 'b':
|
case 'b':
|
||||||
return (byte) readLongToken();
|
return (byte) readLongToken();
|
||||||
case 'c':
|
case 'c':
|
||||||
|
21
classpath/java/lang/AbstractMethodError.java
Normal file
21
classpath/java/lang/AbstractMethodError.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* Copyright (c) 2011, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package java.lang;
|
||||||
|
|
||||||
|
public class AbstractMethodError extends IncompatibleClassChangeError {
|
||||||
|
public AbstractMethodError() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractMethodError(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@ -103,7 +103,8 @@ public class Runtime {
|
|||||||
|
|
||||||
if (exception[0] != null) {
|
if (exception[0] != null) {
|
||||||
if (exception[0] instanceof IOException) {
|
if (exception[0] instanceof IOException) {
|
||||||
throw new IOException(exception[0]);
|
String message = "Failed to run \"" + command[0] + "\": " + exception[0].getMessage();
|
||||||
|
throw new IOException(message);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException(exception[0]);
|
throw new RuntimeException(exception[0]);
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,16 @@ import java.util.Comparator;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import avian.Utf8;
|
import avian.Utf8;
|
||||||
|
import avian.Iso88591;
|
||||||
|
|
||||||
public final class String
|
public final class String
|
||||||
implements Comparable<String>, CharSequence, Serializable
|
implements Comparable<String>, CharSequence, Serializable
|
||||||
{
|
{
|
||||||
|
private static final String UTF_8_ENCODING = "UTF-8";
|
||||||
|
private static final String ISO_8859_1_ENCODING = "ISO-8859-1";
|
||||||
|
private static final String LATIN_1_ENCODING = "LATIN-1";
|
||||||
|
private static final String DEFAULT_ENCODING = UTF_8_ENCODING;
|
||||||
|
|
||||||
public static Comparator<String> CASE_INSENSITIVE_ORDER
|
public static Comparator<String> CASE_INSENSITIVE_ORDER
|
||||||
= new Comparator<String>() {
|
= new Comparator<String>() {
|
||||||
public int compare(String a, String b) {
|
public int compare(String a, String b) {
|
||||||
@ -52,8 +58,8 @@ public final class String
|
|||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
this(bytes, offset, length);
|
this(bytes, offset, length);
|
||||||
if (! (charsetName.equalsIgnoreCase("UTF-8")
|
if (! (charsetName.equalsIgnoreCase(UTF_8_ENCODING)
|
||||||
|| charsetName.equalsIgnoreCase("ISO-8859-1")))
|
|| charsetName.equalsIgnoreCase(ISO_8859_1_ENCODING)))
|
||||||
{
|
{
|
||||||
throw new UnsupportedEncodingException(charsetName);
|
throw new UnsupportedEncodingException(charsetName);
|
||||||
}
|
}
|
||||||
@ -421,18 +427,31 @@ public final class String
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
if(data instanceof byte[]) {
|
try {
|
||||||
byte[] b = new byte[length];
|
return getBytes(DEFAULT_ENCODING);
|
||||||
getBytes(0, length, b, 0);
|
} catch (java.io.UnsupportedEncodingException ex) {
|
||||||
return b;
|
throw new RuntimeException(
|
||||||
|
"Default '" + DEFAULT_ENCODING + "' encoding not handled", ex);
|
||||||
}
|
}
|
||||||
return Utf8.encode((char[])data, offset, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes(String format)
|
public byte[] getBytes(String format)
|
||||||
throws java.io.UnsupportedEncodingException
|
throws java.io.UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
return getBytes();
|
if(data instanceof byte[]) {
|
||||||
|
byte[] b = new byte[length];
|
||||||
|
getBytes(0, length, b, 0);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
String fmt = format.trim().toUpperCase();
|
||||||
|
if (DEFAULT_ENCODING.equals(fmt)) {
|
||||||
|
return Utf8.encode((char[])data, offset, length);
|
||||||
|
} else if (ISO_8859_1_ENCODING.equals(fmt) || LATIN_1_ENCODING.equals(fmt)) {
|
||||||
|
return Iso88591.encode((char[])data, offset, length);
|
||||||
|
} else {
|
||||||
|
throw new java.io.UnsupportedEncodingException(
|
||||||
|
"Encoding " + format + " not supported");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getChars(int srcOffset, int srcEnd,
|
public void getChars(int srcOffset, int srcEnd,
|
||||||
|
@ -12,4 +12,14 @@ package java.util;
|
|||||||
|
|
||||||
public abstract class AbstractList<T> extends AbstractCollection<T>
|
public abstract class AbstractList<T> extends AbstractCollection<T>
|
||||||
implements List<T>
|
implements List<T>
|
||||||
{ }
|
{
|
||||||
|
protected int modCount;
|
||||||
|
|
||||||
|
public Iterator<T> iterator() {
|
||||||
|
return listIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListIterator<T> listIterator() {
|
||||||
|
return new Collections.ArrayListIterator(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
13
classpath/java/util/AbstractMap.java
Normal file
13
classpath/java/util/AbstractMap.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package java.util;
|
||||||
|
|
||||||
|
public abstract class AbstractMap<K,V> extends Object implements Map<K,V> { }
|
@ -74,6 +74,9 @@ public class ZipFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected ZipEntry getEntry(EntryFactory factory, String name) {
|
protected ZipEntry getEntry(EntryFactory factory, String name) {
|
||||||
|
while (name.startsWith("/")) {
|
||||||
|
name = name.substring(1);
|
||||||
|
}
|
||||||
Integer pointer = index.get(name);
|
Integer pointer = index.get(name);
|
||||||
return (pointer == null ? null : factory.makeEntry(window, pointer));
|
return (pointer == null ? null : factory.makeEntry(window, pointer));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2009, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2008-2010, Avian Contributors
|
Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
38
makefile
Normal file → Executable file
38
makefile
Normal file → Executable file
@ -1,7 +1,7 @@
|
|||||||
MAKEFLAGS = -s
|
MAKEFLAGS = -s
|
||||||
|
|
||||||
name = avian
|
name = avian
|
||||||
version = 0.4
|
version = 0.5
|
||||||
|
|
||||||
build-arch := $(shell uname -m \
|
build-arch := $(shell uname -m \
|
||||||
| sed 's/^i.86$$/i386/' \
|
| sed 's/^i.86$$/i386/' \
|
||||||
@ -94,12 +94,12 @@ ifneq ($(openjdk),)
|
|||||||
lib/security/java.policy lib/security/cacerts
|
lib/security/java.policy lib/security/cacerts
|
||||||
|
|
||||||
local-policy = lib/security/local_policy.jar
|
local-policy = lib/security/local_policy.jar
|
||||||
ifeq ($(shell test -e $(openjdk)/$(local-policy) && echo found),found)
|
ifeq ($(shell test -e "$(openjdk)/$(local-policy)" && echo found),found)
|
||||||
javahome-files += $(local-policy)
|
javahome-files += $(local-policy)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export-policy = lib/security/US_export_policy.jar
|
export-policy = lib/security/US_export_policy.jar
|
||||||
ifeq ($(shell test -e $(openjdk)/$(export-policy) && echo found),found)
|
ifeq ($(shell test -e "$(openjdk)/$(export-policy)" && echo found),found)
|
||||||
javahome-files += $(export-policy)
|
javahome-files += $(export-policy)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -181,7 +181,8 @@ endif
|
|||||||
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
||||||
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
|
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
|
||||||
|
|
||||||
converter-cflags = -D__STDC_CONSTANT_MACROS -Isrc/binaryToObject
|
converter-cflags = -D__STDC_CONSTANT_MACROS -Isrc/binaryToObject \
|
||||||
|
-fno-rtti -fno-exceptions
|
||||||
|
|
||||||
cflags = $(build-cflags)
|
cflags = $(build-cflags)
|
||||||
|
|
||||||
@ -333,15 +334,20 @@ ifeq ($(platform),windows)
|
|||||||
openjdk-extra-cflags =
|
openjdk-extra-cflags =
|
||||||
build-lflags = -L$(lib) $(common-lflags)
|
build-lflags = -L$(lib) $(common-lflags)
|
||||||
ifeq ($(build-platform),cygwin)
|
ifeq ($(build-platform),cygwin)
|
||||||
build-lflags += -mno-cygwin
|
build-cxx = i686-w64-mingw32-g++
|
||||||
build-cflags += -mno-cygwin
|
build-cc = i686-w64-mingw32-gcc
|
||||||
openjdk-extra-cflags += -mno-cygwin
|
dlltool = i686-w64-mingw32-dlltool
|
||||||
lflags += -mno-cygwin
|
ar = i686-w64-mingw32-ar
|
||||||
cflags += -mno-cygwin
|
ranlib = i686-w64-mingw32-ranlib
|
||||||
|
strip = i686-w64-mingw32-strip
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(arch),x86_64)
|
ifeq ($(arch),x86_64)
|
||||||
|
ifeq ($(build-platform),cygwin)
|
||||||
|
build-cxx = x86_64-w64-mingw32-g++
|
||||||
|
build-cc = x86_64-w64-mingw32-gcc
|
||||||
|
endif
|
||||||
cxx = x86_64-w64-mingw32-g++ $(mflag)
|
cxx = x86_64-w64-mingw32-g++ $(mflag)
|
||||||
cc = x86_64-w64-mingw32-gcc $(mflag)
|
cc = x86_64-w64-mingw32-gcc $(mflag)
|
||||||
dlltool = x86_64-w64-mingw32-dlltool
|
dlltool = x86_64-w64-mingw32-dlltool
|
||||||
@ -758,7 +764,7 @@ $(boot-javahome-object): $(src)/boot-javahome.cpp
|
|||||||
$(compile-object)
|
$(compile-object)
|
||||||
|
|
||||||
$(build)/binaryToObject-main.o: $(src)/binaryToObject/main.cpp
|
$(build)/binaryToObject-main.o: $(src)/binaryToObject/main.cpp
|
||||||
$(build-cxx) -c $(^) -o $(@)
|
$(build-cxx) $(converter-cflags) -c $(^) -o $(@)
|
||||||
|
|
||||||
$(build)/binaryToObject-elf64.o: $(src)/binaryToObject/elf.cpp
|
$(build)/binaryToObject-elf64.o: $(src)/binaryToObject/elf.cpp
|
||||||
$(build-cxx) $(converter-cflags) -DBITS_PER_WORD=64 -c $(^) -o $(@)
|
$(build-cxx) $(converter-cflags) -DBITS_PER_WORD=64 -c $(^) -o $(@)
|
||||||
@ -776,7 +782,7 @@ $(build)/binaryToObject-pe.o: $(src)/binaryToObject/pe.cpp
|
|||||||
$(build-cxx) $(converter-cflags) -c $(^) -o $(@)
|
$(build-cxx) $(converter-cflags) -c $(^) -o $(@)
|
||||||
|
|
||||||
$(converter): $(converter-objects)
|
$(converter): $(converter-objects)
|
||||||
$(build-cxx) $(^) -o $(@)
|
$(build-cc) $(^) -o $(@)
|
||||||
|
|
||||||
$(build)/classpath.jar: $(classpath-dep) $(classpath-jar-dep)
|
$(build)/classpath.jar: $(classpath-dep) $(classpath-jar-dep)
|
||||||
@echo "creating $(@)"
|
@echo "creating $(@)"
|
||||||
@ -930,8 +936,14 @@ ifeq ($(platform),windows)
|
|||||||
sed 's/^#ifdef _WIN64/#if 1/' \
|
sed 's/^#ifdef _WIN64/#if 1/' \
|
||||||
< "$(openjdk-src)/windows/native/java/net/net_util_md.h" \
|
< "$(openjdk-src)/windows/native/java/net/net_util_md.h" \
|
||||||
> $(build)/openjdk/net_util_md.h
|
> $(build)/openjdk/net_util_md.h
|
||||||
cp "$(openjdk-src)/windows/native/java/net/NetworkInterface.h" \
|
sed \
|
||||||
$(build)/openjdk/NetworkInterface.h
|
-e 's/IpPrefix/hide_IpPrefix/' \
|
||||||
|
-e 's/IpSuffix/hide_IpSuffix/' \
|
||||||
|
-e 's/IpDad/hide_IpDad/' \
|
||||||
|
-e 's/ScopeLevel/hide_ScopeLevel/' \
|
||||||
|
-e 's/SCOPE_LEVEL/hide_SCOPE_LEVEL/' \
|
||||||
|
< "$(openjdk-src)/windows/native/java/net/NetworkInterface.h" \
|
||||||
|
> $(build)/openjdk/NetworkInterface.h
|
||||||
echo 'static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);' >> $(build)/openjdk/NetworkInterface.h
|
echo 'static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);' >> $(build)/openjdk/NetworkInterface.h
|
||||||
endif
|
endif
|
||||||
@touch $(@)
|
@touch $(@)
|
||||||
|
@ -48,6 +48,7 @@ openjdk-sources = \
|
|||||||
$(openjdk-src)/share/native/java/util/zip/ZipEntry.c \
|
$(openjdk-src)/share/native/java/util/zip/ZipEntry.c \
|
||||||
$(openjdk-src)/share/native/java/util/zip/ZipFile.c \
|
$(openjdk-src)/share/native/java/util/zip/ZipFile.c \
|
||||||
$(openjdk-src)/share/native/java/util/zip/zip_util.c \
|
$(openjdk-src)/share/native/java/util/zip/zip_util.c \
|
||||||
|
$(openjdk-src)/share/native/sun/management/VMManagementImpl.c \
|
||||||
$(openjdk-src)/share/native/sun/misc/GC.c \
|
$(openjdk-src)/share/native/sun/misc/GC.c \
|
||||||
$(openjdk-src)/share/native/sun/misc/MessageUtils.c \
|
$(openjdk-src)/share/native/sun/misc/MessageUtils.c \
|
||||||
$(openjdk-src)/share/native/sun/misc/NativeSignalHandler.c \
|
$(openjdk-src)/share/native/sun/misc/NativeSignalHandler.c \
|
||||||
@ -112,6 +113,7 @@ openjdk-headers-classes = \
|
|||||||
java.util.zip.Inflater \
|
java.util.zip.Inflater \
|
||||||
java.util.zip.ZipEntry \
|
java.util.zip.ZipEntry \
|
||||||
java.util.zip.ZipFile \
|
java.util.zip.ZipFile \
|
||||||
|
sun.management.VMManagementImpl \
|
||||||
sun.misc.GC \
|
sun.misc.GC \
|
||||||
sun.misc.MessageUtils \
|
sun.misc.MessageUtils \
|
||||||
sun.misc.NativeSignalHandler \
|
sun.misc.NativeSignalHandler \
|
||||||
@ -151,6 +153,7 @@ openjdk-cflags = \
|
|||||||
"-I$(openjdk-src)/share/native/java/lang/fdlibm/include" \
|
"-I$(openjdk-src)/share/native/java/lang/fdlibm/include" \
|
||||||
"-I$(openjdk-src)/share/native/java/net" \
|
"-I$(openjdk-src)/share/native/java/net" \
|
||||||
"-I$(openjdk-src)/share/native/java/util/zip" \
|
"-I$(openjdk-src)/share/native/java/util/zip" \
|
||||||
|
"-I$(openjdk-src)/share/native/sun/management" \
|
||||||
"-I$(openjdk-src)/share/native/sun/nio/ch" \
|
"-I$(openjdk-src)/share/native/sun/nio/ch" \
|
||||||
"-I$(openjdk-src)/share/javavm/include" \
|
"-I$(openjdk-src)/share/javavm/include" \
|
||||||
-D_LITTLE_ENDIAN \
|
-D_LITTLE_ENDIAN \
|
||||||
@ -184,6 +187,7 @@ ifeq ($(platform),windows)
|
|||||||
$(openjdk-src)/windows/native/java/lang/ProcessEnvironment_md.c \
|
$(openjdk-src)/windows/native/java/lang/ProcessEnvironment_md.c \
|
||||||
$(openjdk-src)/windows/native/java/lang/ProcessImpl_md.c \
|
$(openjdk-src)/windows/native/java/lang/ProcessImpl_md.c \
|
||||||
$(openjdk-src)/windows/native/java/net/net_util_md.c \
|
$(openjdk-src)/windows/native/java/net/net_util_md.c \
|
||||||
|
$(openjdk-src)/windows/native/java/net/DualStackPlainSocketImpl.c \
|
||||||
$(openjdk-src)/windows/native/java/net/InetAddressImplFactory.c \
|
$(openjdk-src)/windows/native/java/net/InetAddressImplFactory.c \
|
||||||
$(openjdk-src)/windows/native/java/net/Inet4AddressImpl.c \
|
$(openjdk-src)/windows/native/java/net/Inet4AddressImpl.c \
|
||||||
$(openjdk-src)/windows/native/java/net/Inet6AddressImpl.c \
|
$(openjdk-src)/windows/native/java/net/Inet6AddressImpl.c \
|
||||||
@ -210,6 +214,7 @@ ifeq ($(platform),windows)
|
|||||||
$(openjdk-src)/windows/native/sun/security/provider/WinCAPISeedGenerator.c
|
$(openjdk-src)/windows/native/sun/security/provider/WinCAPISeedGenerator.c
|
||||||
|
|
||||||
openjdk-headers-classes += \
|
openjdk-headers-classes += \
|
||||||
|
java.net.DualStackPlainSocketImpl \
|
||||||
java.lang.ProcessImpl \
|
java.lang.ProcessImpl \
|
||||||
sun.io.Win32ErrorMode \
|
sun.io.Win32ErrorMode \
|
||||||
sun.nio.ch.WindowsSelectorImpl \
|
sun.nio.ch.WindowsSelectorImpl \
|
||||||
@ -225,7 +230,6 @@ ifeq ($(platform),windows)
|
|||||||
"-I$(root)/win32/include" \
|
"-I$(root)/win32/include" \
|
||||||
-D_JNI_IMPLEMENTATION_ \
|
-D_JNI_IMPLEMENTATION_ \
|
||||||
-D_JAVASOFT_WIN32_TYPEDEF_MD_H_ \
|
-D_JAVASOFT_WIN32_TYPEDEF_MD_H_ \
|
||||||
-D_WINSOCK2API_ \
|
|
||||||
-Ds6_words=_s6_words \
|
-Ds6_words=_s6_words \
|
||||||
-Ds6_bytes=_s6_bytes
|
-Ds6_bytes=_s6_bytes
|
||||||
else
|
else
|
||||||
@ -290,13 +294,15 @@ else
|
|||||||
"-I$(openjdk-src)/solaris/native/java/lang" \
|
"-I$(openjdk-src)/solaris/native/java/lang" \
|
||||||
"-I$(openjdk-src)/solaris/native/java/net" \
|
"-I$(openjdk-src)/solaris/native/java/net" \
|
||||||
"-I$(openjdk-src)/solaris/native/java/util" \
|
"-I$(openjdk-src)/solaris/native/java/util" \
|
||||||
|
"-I$(openjdk-src)/solaris/native/sun/management" \
|
||||||
"-I$(openjdk-src)/solaris/native/sun/nio/ch" \
|
"-I$(openjdk-src)/solaris/native/sun/nio/ch" \
|
||||||
"-I$(openjdk-src)/solaris/javavm/include" \
|
"-I$(openjdk-src)/solaris/javavm/include" \
|
||||||
"-I$(openjdk-src)/solaris/hpi/include"
|
"-I$(openjdk-src)/solaris/hpi/include"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
openjdk-local-sources = \
|
openjdk-local-sources = \
|
||||||
$(src)/openjdk/my_net_util.c
|
$(src)/openjdk/my_net_util.c \
|
||||||
|
$(src)/openjdk/my_management.c
|
||||||
|
|
||||||
c-objects = $(foreach x,$(1),$(patsubst $(2)/%.c,$(3)/%-openjdk.o,$(x)))
|
c-objects = $(foreach x,$(1),$(patsubst $(2)/%.c,$(3)/%-openjdk.o,$(x)))
|
||||||
|
|
||||||
|
@ -162,8 +162,8 @@ Installing MSYS:
|
|||||||
Installing Cygwin:
|
Installing Cygwin:
|
||||||
|
|
||||||
1. Download and run setup.exe from cygwin.com, installing the base
|
1. Download and run setup.exe from cygwin.com, installing the base
|
||||||
system and these packages: make, gcc-mingw-g++, and (optionally)
|
system and these packages: make, gcc-mingw-g++,
|
||||||
git.
|
mingw64-i686-gcc-g++, mingw64-x86_64-gcc-g++, and (optionally) git.
|
||||||
|
|
||||||
You may also find our win32 repository useful: (run this from the
|
You may also find our win32 repository useful: (run this from the
|
||||||
directory containing the avian directory)
|
directory containing the avian directory)
|
||||||
@ -308,7 +308,7 @@ it on various OSes:
|
|||||||
# http://download.java.net/openjdk/jdk6/promoted/, e.g.:
|
# http://download.java.net/openjdk/jdk6/promoted/, e.g.:
|
||||||
wget http://download.java.net/openjdk/jdk6/promoted/b21/openjdk-6-src-b21-20_jan_2011.tar.gz
|
wget http://download.java.net/openjdk/jdk6/promoted/b21/openjdk-6-src-b21-20_jan_2011.tar.gz
|
||||||
mkdir openjdk
|
mkdir openjdk
|
||||||
(cd openjdk && tar xzf openjdk-6-src-b21-20_jan_2011.tar.gz)
|
(cd openjdk && tar xzf ../openjdk-6-src-b21-20_jan_2011.tar.gz)
|
||||||
make openjdk=/cygdrive/c/OpenSCG/openjdk-6.21 \
|
make openjdk=/cygdrive/c/OpenSCG/openjdk-6.21 \
|
||||||
openjdk-src=$(pwd)/openjdk/jdk/src \
|
openjdk-src=$(pwd)/openjdk/jdk/src \
|
||||||
test
|
test
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -22,6 +22,39 @@ class Allocator {
|
|||||||
virtual void free(const void* p, unsigned size) = 0;
|
virtual void free(const void* p, unsigned size) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline const char*
|
||||||
|
append(Allocator* allocator, const char* a, const char* b, const char* c)
|
||||||
|
{
|
||||||
|
unsigned al = strlen(a);
|
||||||
|
unsigned bl = strlen(b);
|
||||||
|
unsigned cl = strlen(c);
|
||||||
|
char* p = static_cast<char*>(allocator->allocate((al + bl + cl) + 1));
|
||||||
|
memcpy(p, a, al);
|
||||||
|
memcpy(p + al, b, bl);
|
||||||
|
memcpy(p + al + bl, c, cl + 1);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char*
|
||||||
|
append(Allocator* allocator, const char* a, const char* b)
|
||||||
|
{
|
||||||
|
unsigned al = strlen(a);
|
||||||
|
unsigned bl = strlen(b);
|
||||||
|
char* p = static_cast<char*>(allocator->allocate((al + bl) + 1));
|
||||||
|
memcpy(p, a, al);
|
||||||
|
memcpy(p + al, b, bl + 1);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char*
|
||||||
|
copy(Allocator* allocator, const char* a)
|
||||||
|
{
|
||||||
|
unsigned al = strlen(a);
|
||||||
|
char* p = static_cast<char*>(allocator->allocate(al + 1));
|
||||||
|
memcpy(p, a, al + 1);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
#endif//ALLOCATOR_H
|
#endif//ALLOCATOR_H
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* arm.S: JNI gluecode for ARM/Linux
|
/* arm.S: JNI gluecode for ARM/Linux
|
||||||
Copyright (c) 2008-2010, Avian Contributors
|
Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2010, Avian Contributors
|
/* Copyright (c) 2010-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2009-2010, Avian Contributors
|
/* Copyright (c) 2009-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2009, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -23,7 +23,7 @@ using namespace vm;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const unsigned HeapCapacity = 128 * 1024 * 1024;
|
const unsigned HeapCapacity = 256 * 1024 * 1024;
|
||||||
|
|
||||||
// Notes on immutable references in the heap image:
|
// Notes on immutable references in the heap image:
|
||||||
//
|
//
|
||||||
@ -572,7 +572,7 @@ main(int ac, const char** av)
|
|||||||
p->initialize(&image, code, CodeCapacity);
|
p->initialize(&image, code, CodeCapacity);
|
||||||
|
|
||||||
Machine* m = new (h->allocate(sizeof(Machine))) Machine
|
Machine* m = new (h->allocate(sizeof(Machine))) Machine
|
||||||
(s, h, f, 0, p, c, 0, 0);
|
(s, h, f, 0, p, c, 0, 0, 0, 0);
|
||||||
Thread* t = p->makeThread(m, 0, 0);
|
Thread* t = p->makeThread(m, 0, 0);
|
||||||
|
|
||||||
enter(t, Thread::ActiveState);
|
enter(t, Thread::ActiveState);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2010, Avian Contributors
|
/* Copyright (c) 2010-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2010, Avian Contributors
|
/* Copyright (c) 2010-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2010, Avian Contributors
|
/* Copyright (c) 2010-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -355,7 +355,7 @@ class MyClasspath : public Classpath {
|
|||||||
|
|
||||||
MyClasspath(System* s, Allocator* allocator, const char* javaHome,
|
MyClasspath(System* s, Allocator* allocator, const char* javaHome,
|
||||||
const char* embedPrefix):
|
const char* embedPrefix):
|
||||||
allocator(allocator), ranNetOnLoad(0)
|
allocator(allocator), ranNetOnLoad(0), ranManagementOnLoad(0)
|
||||||
{
|
{
|
||||||
class StringBuilder {
|
class StringBuilder {
|
||||||
public:
|
public:
|
||||||
@ -613,6 +613,7 @@ class MyClasspath : public Classpath {
|
|||||||
unsigned zipEntryCsizeField;
|
unsigned zipEntryCsizeField;
|
||||||
unsigned zipEntryMethodField;
|
unsigned zipEntryMethodField;
|
||||||
bool ranNetOnLoad;
|
bool ranNetOnLoad;
|
||||||
|
bool ranManagementOnLoad;
|
||||||
char buffer[BufferSize];
|
char buffer[BufferSize];
|
||||||
JmmInterface jmmInterface;
|
JmmInterface jmmInterface;
|
||||||
};
|
};
|
||||||
@ -1615,6 +1616,9 @@ getBootstrapResources(Thread* t, object, uintptr_t* arguments)
|
|||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
net_JNI_OnLoad(JavaVM*, void*);
|
net_JNI_OnLoad(JavaVM*, void*);
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
|
management_JNI_OnLoad(JavaVM*, void*);
|
||||||
|
|
||||||
void JNICALL
|
void JNICALL
|
||||||
loadLibrary(Thread* t, object, uintptr_t* arguments)
|
loadLibrary(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
@ -1643,6 +1647,23 @@ loadLibrary(Thread* t, object, uintptr_t* arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
} else if (strcmp(n, "management") == 0) {
|
||||||
|
bool ran;
|
||||||
|
|
||||||
|
{ ACQUIRE(t, t->m->classLock);
|
||||||
|
|
||||||
|
local::MyClasspath* c = static_cast<local::MyClasspath*>
|
||||||
|
(t->m->classpath);
|
||||||
|
|
||||||
|
ran = c->ranManagementOnLoad;
|
||||||
|
c->ranManagementOnLoad = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not ran) {
|
||||||
|
management_JNI_OnLoad(t->m, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
} else if (strcmp(n, "zip") == 0
|
} else if (strcmp(n, "zip") == 0
|
||||||
or strcmp(n, "nio") == 0)
|
or strcmp(n, "nio") == 0)
|
||||||
{
|
{
|
||||||
@ -5118,6 +5139,27 @@ GetVersion(Thread*)
|
|||||||
return JMM_VERSION_1_0;
|
return JMM_VERSION_1_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t
|
||||||
|
getInputArgumentArray(Thread* t, uintptr_t*)
|
||||||
|
{
|
||||||
|
object array = makeObjectArray
|
||||||
|
(t, type(t, Machine::StringType), t->m->argumentCount);
|
||||||
|
PROTECT(t, array);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < t->m->argumentCount; ++i) {
|
||||||
|
object argument = makeString(t, t->m->arguments[i]);
|
||||||
|
set(t, array, ArrayBody + (i * BytesPerWord), argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
return reinterpret_cast<uintptr_t>(makeLocalReference(t, array));
|
||||||
|
}
|
||||||
|
|
||||||
|
jobjectArray JNICALL
|
||||||
|
GetInputArgumentArray(Thread* t)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<jobjectArray>(run(t, getInputArgumentArray, 0));
|
||||||
|
}
|
||||||
|
|
||||||
jint JNICALL
|
jint JNICALL
|
||||||
GetOptionalSupport(Thread*, jmmOptionalSupport* support)
|
GetOptionalSupport(Thread*, jmmOptionalSupport* support)
|
||||||
{
|
{
|
||||||
@ -5203,6 +5245,7 @@ EXPORT(JVM_GetManagement)(jint version)
|
|||||||
interface->GetBoolAttribute = GetBoolAttribute;
|
interface->GetBoolAttribute = GetBoolAttribute;
|
||||||
interface->GetMemoryManagers = GetMemoryManagers;
|
interface->GetMemoryManagers = GetMemoryManagers;
|
||||||
interface->GetMemoryPools = GetMemoryPools;
|
interface->GetMemoryPools = GetMemoryPools;
|
||||||
|
interface->GetInputArgumentArray = GetInputArgumentArray;
|
||||||
|
|
||||||
return interface;
|
return interface;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2010, Avian Contributors
|
/* Copyright (c) 2010-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2009-2010, Avian Contributors
|
/* Copyright (c) 2009-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -2190,6 +2190,9 @@ unwind(MyThread* t)
|
|||||||
object continuation;
|
object continuation;
|
||||||
findUnwindTarget(t, &ip, &frame, &stack, &continuation);
|
findUnwindTarget(t, &ip, &frame, &stack, &continuation);
|
||||||
|
|
||||||
|
t->trace->targetMethod = 0;
|
||||||
|
t->trace->nativeMethod = 0;
|
||||||
|
|
||||||
transition(t, ip, stack, continuation, t->trace);
|
transition(t, ip, stack, continuation, t->trace);
|
||||||
|
|
||||||
vmJump(ip, frame, stack, t, 0, 0);
|
vmJump(ip, frame, stack, t, 0, 0);
|
||||||
@ -2263,19 +2266,34 @@ resolveMethod(Thread* t, object pair)
|
|||||||
findMethodInClass, Machine::NoSuchMethodErrorType);
|
findMethodInClass, Machine::NoSuchMethodErrorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
methodAbstract(Thread* t, object method)
|
||||||
|
{
|
||||||
|
return methodCode(t, method) == 0
|
||||||
|
and (methodFlags(t, method) & ACC_NATIVE) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
prepareMethodForCall(MyThread* t, object target)
|
prepareMethodForCall(MyThread* t, object target)
|
||||||
{
|
{
|
||||||
if (unresolved(t, methodAddress(t, target))) {
|
if (methodAbstract(t, target)) {
|
||||||
PROTECT(t, target);
|
throwNew(t, Machine::AbstractMethodErrorType, "%s.%s%s",
|
||||||
|
&byteArrayBody(t, className(t, methodClass(t, target)), 0),
|
||||||
|
&byteArrayBody(t, methodName(t, target), 0),
|
||||||
|
&byteArrayBody(t, methodSpec(t, target), 0));
|
||||||
|
} else {
|
||||||
|
if (unresolved(t, methodAddress(t, target))) {
|
||||||
|
PROTECT(t, target);
|
||||||
|
|
||||||
|
compile(t, codeAllocator(t), 0, target);
|
||||||
|
}
|
||||||
|
|
||||||
compile(t, codeAllocator(t), 0, target);
|
if (methodFlags(t, target) & ACC_NATIVE) {
|
||||||
}
|
t->trace->nativeMethod = target;
|
||||||
|
}
|
||||||
|
|
||||||
if (methodFlags(t, target) & ACC_NATIVE) {
|
return methodAddress(t, target);
|
||||||
t->trace->nativeMethod = target;
|
|
||||||
}
|
}
|
||||||
return methodAddress(t, target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
@ -2341,6 +2359,12 @@ findVirtualMethodFromReference(MyThread* t, object pair, object instance)
|
|||||||
return prepareMethodForCall(t, target);
|
return prepareMethodForCall(t, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
getMethodAddress(MyThread* t, object target)
|
||||||
|
{
|
||||||
|
return prepareMethodForCall(t, target);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
getJClassFromReference(MyThread* t, object pair)
|
getJClassFromReference(MyThread* t, object pair)
|
||||||
{
|
{
|
||||||
@ -3437,6 +3461,48 @@ compileDirectReferenceInvoke(MyThread* t, Frame* frame, Thunk thunk,
|
|||||||
reference, isStatic, tailCall);
|
reference, isStatic, tailCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
compileAbstractInvoke(MyThread* t, Frame* frame, Compiler::Operand* method,
|
||||||
|
object target, bool tailCall)
|
||||||
|
{
|
||||||
|
unsigned parameterFootprint = methodParameterFootprint(t, target);
|
||||||
|
|
||||||
|
int returnCode = methodReturnCode(t, target);
|
||||||
|
|
||||||
|
unsigned rSize = resultSize(t, returnCode);
|
||||||
|
|
||||||
|
Compiler::Operand* result = frame->c->stackCall
|
||||||
|
(method,
|
||||||
|
tailCall ? Compiler::TailJump : 0,
|
||||||
|
frame->trace(0, 0),
|
||||||
|
rSize,
|
||||||
|
operandTypeForFieldCode(t, returnCode),
|
||||||
|
parameterFootprint);
|
||||||
|
|
||||||
|
frame->pop(parameterFootprint);
|
||||||
|
|
||||||
|
if (rSize) {
|
||||||
|
pushReturnValue(t, frame, returnCode, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
compileDirectAbstractInvoke(MyThread* t, Frame* frame, Thunk thunk,
|
||||||
|
object target, bool tailCall)
|
||||||
|
{
|
||||||
|
Compiler* c = frame->c;
|
||||||
|
|
||||||
|
compileAbstractInvoke
|
||||||
|
(t, frame, c->call
|
||||||
|
(c->constant(getThunk(t, thunk), Compiler::AddressType),
|
||||||
|
0,
|
||||||
|
frame->trace(0, 0),
|
||||||
|
BytesPerWord,
|
||||||
|
Compiler::AddressType,
|
||||||
|
2, c->register_(t->arch->thread()), frame->append(target)),
|
||||||
|
target, tailCall);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handleMonitorEvent(MyThread* t, Frame* frame, intptr_t function)
|
handleMonitorEvent(MyThread* t, Frame* frame, intptr_t function)
|
||||||
{
|
{
|
||||||
@ -4841,7 +4907,12 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
|
|
||||||
bool tailCall = isTailCall(t, code, ip, context->method, target);
|
bool tailCall = isTailCall(t, code, ip, context->method, target);
|
||||||
|
|
||||||
compileDirectInvoke(t, frame, target, tailCall);
|
if (UNLIKELY(methodAbstract(t, target))) {
|
||||||
|
compileDirectAbstractInvoke
|
||||||
|
(t, frame, getMethodAddressThunk, target, tailCall);
|
||||||
|
} else {
|
||||||
|
compileDirectInvoke(t, frame, target, tailCall);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
compileDirectReferenceInvoke
|
compileDirectReferenceInvoke
|
||||||
(t, frame, findSpecialMethodFromReferenceThunk, reference, false,
|
(t, frame, findSpecialMethodFromReferenceThunk, reference, false,
|
||||||
@ -7328,11 +7399,6 @@ invokeNative(MyThread* t)
|
|||||||
uint64_t result = 0;
|
uint64_t result = 0;
|
||||||
|
|
||||||
t->trace->targetMethod = t->trace->nativeMethod;
|
t->trace->targetMethod = t->trace->nativeMethod;
|
||||||
|
|
||||||
THREAD_RESOURCE0(t, {
|
|
||||||
static_cast<MyThread*>(t)->trace->targetMethod = 0;
|
|
||||||
static_cast<MyThread*>(t)->trace->nativeMethod = 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
t->m->classpath->resolveNative(t, t->trace->nativeMethod);
|
t->m->classpath->resolveNative(t, t->trace->nativeMethod);
|
||||||
|
|
||||||
@ -7355,6 +7421,9 @@ invokeNative(MyThread* t)
|
|||||||
|
|
||||||
transition(t, getIp(t), stack, t->continuation, t->trace);
|
transition(t, getIp(t), stack, t->continuation, t->trace);
|
||||||
|
|
||||||
|
t->trace->targetMethod = 0;
|
||||||
|
t->trace->nativeMethod = 0;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4815,7 +4815,11 @@ class BranchEvent: public Event {
|
|||||||
ConstantSite* secondConstant = findConstantSite(c, second);
|
ConstantSite* secondConstant = findConstantSite(c, second);
|
||||||
|
|
||||||
if (not unreachable(this)) {
|
if (not unreachable(this)) {
|
||||||
if (firstConstant and secondConstant) {
|
if (firstConstant
|
||||||
|
and secondConstant
|
||||||
|
and firstConstant->value->resolved()
|
||||||
|
and secondConstant->value->resolved())
|
||||||
|
{
|
||||||
int64_t firstValue = firstConstant->value->value();
|
int64_t firstValue = firstConstant->value->value();
|
||||||
int64_t secondValue = secondConstant->value->value();
|
int64_t secondValue = secondConstant->value->value();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2009-2010, Avian Contributors
|
/* Copyright (c) 2009-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -18,39 +18,7 @@ using namespace vm;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const bool DebugFind = false;
|
const bool DebugFind = false;
|
||||||
|
const bool DebugStat = false;
|
||||||
const char*
|
|
||||||
append(Allocator* allocator, const char* a, const char* b, const char* c)
|
|
||||||
{
|
|
||||||
unsigned al = strlen(a);
|
|
||||||
unsigned bl = strlen(b);
|
|
||||||
unsigned cl = strlen(c);
|
|
||||||
char* p = static_cast<char*>(allocator->allocate((al + bl + cl) + 1));
|
|
||||||
memcpy(p, a, al);
|
|
||||||
memcpy(p + al, b, bl);
|
|
||||||
memcpy(p + al + bl, c, cl + 1);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char*
|
|
||||||
append(Allocator* allocator, const char* a, const char* b)
|
|
||||||
{
|
|
||||||
unsigned al = strlen(a);
|
|
||||||
unsigned bl = strlen(b);
|
|
||||||
char* p = static_cast<char*>(allocator->allocate((al + bl) + 1));
|
|
||||||
memcpy(p, a, al);
|
|
||||||
memcpy(p + al, b, bl + 1);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char*
|
|
||||||
copy(Allocator* allocator, const char* a)
|
|
||||||
{
|
|
||||||
unsigned al = strlen(a);
|
|
||||||
char* p = static_cast<char*>(allocator->allocate(al + 1));
|
|
||||||
memcpy(p, a, al + 1);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Element {
|
class Element {
|
||||||
public:
|
public:
|
||||||
@ -136,9 +104,12 @@ class DirectoryElement: public Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DirectoryElement(System* s, Allocator* allocator, const char* name):
|
DirectoryElement(System* s, Allocator* allocator, const char* name):
|
||||||
s(s), allocator(allocator), name(name),
|
s(s),
|
||||||
urlPrefix_(append(allocator, "file:", name, "/")),
|
allocator(allocator),
|
||||||
sourceUrl_(append(allocator, "file:", name))
|
originalName(name),
|
||||||
|
name(s->toAbsolutePath(allocator, name)),
|
||||||
|
urlPrefix_(append(allocator, "file:", this->name, "/")),
|
||||||
|
sourceUrl_(append(allocator, "file:", this->name))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual Element::Iterator* iterator() {
|
virtual Element::Iterator* iterator() {
|
||||||
@ -168,6 +139,9 @@ class DirectoryElement: public Element {
|
|||||||
virtual System::FileType stat(const char* name, unsigned* length, bool) {
|
virtual System::FileType stat(const char* name, unsigned* length, bool) {
|
||||||
const char* file = append(allocator, this->name, "/", name);
|
const char* file = append(allocator, this->name, "/", name);
|
||||||
System::FileType type = s->stat(file, length);
|
System::FileType type = s->stat(file, length);
|
||||||
|
if (DebugStat) {
|
||||||
|
fprintf(stderr, "stat %s in %s: %d\n", name, this->name, type);
|
||||||
|
}
|
||||||
allocator->free(file, strlen(file) + 1);
|
allocator->free(file, strlen(file) + 1);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@ -181,6 +155,7 @@ class DirectoryElement: public Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose() {
|
virtual void dispose() {
|
||||||
|
allocator->free(originalName, strlen(originalName) + 1);
|
||||||
allocator->free(name, strlen(name) + 1);
|
allocator->free(name, strlen(name) + 1);
|
||||||
allocator->free(urlPrefix_, strlen(urlPrefix_) + 1);
|
allocator->free(urlPrefix_, strlen(urlPrefix_) + 1);
|
||||||
allocator->free(sourceUrl_, strlen(sourceUrl_) + 1);
|
allocator->free(sourceUrl_, strlen(sourceUrl_) + 1);
|
||||||
@ -189,6 +164,7 @@ class DirectoryElement: public Element {
|
|||||||
|
|
||||||
System* s;
|
System* s;
|
||||||
Allocator* allocator;
|
Allocator* allocator;
|
||||||
|
const char* originalName;
|
||||||
const char* name;
|
const char* name;
|
||||||
const char* urlPrefix_;
|
const char* urlPrefix_;
|
||||||
const char* sourceUrl_;
|
const char* sourceUrl_;
|
||||||
@ -454,10 +430,17 @@ class JarElement: public Element {
|
|||||||
unsigned position;
|
unsigned position;
|
||||||
};
|
};
|
||||||
|
|
||||||
JarElement(System* s, Allocator* allocator, const char* name):
|
JarElement(System* s, Allocator* allocator, const char* name,
|
||||||
s(s), allocator(allocator), name(name),
|
bool canonicalizePath = true):
|
||||||
urlPrefix_(name ? append(allocator, "jar:file:", name, "!/") : 0),
|
s(s),
|
||||||
sourceUrl_(name ? append(allocator, "file:", name) : 0),
|
allocator(allocator),
|
||||||
|
originalName(name),
|
||||||
|
name(name and canonicalizePath
|
||||||
|
? s->toAbsolutePath(allocator, name) : name),
|
||||||
|
urlPrefix_(this->name
|
||||||
|
? append(allocator, "jar:file:", this->name, "!/") : 0),
|
||||||
|
sourceUrl_(this->name
|
||||||
|
? append(allocator, "file:", this->name) : 0),
|
||||||
region(0), index(0)
|
region(0), index(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -513,8 +496,12 @@ class JarElement: public Element {
|
|||||||
|
|
||||||
while (*name == '/') name++;
|
while (*name == '/') name++;
|
||||||
|
|
||||||
return (index ? index->stat(name, length, tryDirectory)
|
System::FileType type = (index ? index->stat(name, length, tryDirectory)
|
||||||
: System::TypeDoesNotExist);
|
: System::TypeDoesNotExist);
|
||||||
|
if (DebugStat) {
|
||||||
|
fprintf(stderr, "stat %s in %s: %d\n", name, this->name, type);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* urlPrefix() {
|
virtual const char* urlPrefix() {
|
||||||
@ -530,6 +517,9 @@ class JarElement: public Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose(unsigned size) {
|
virtual void dispose(unsigned size) {
|
||||||
|
if (originalName != name) {
|
||||||
|
allocator->free(originalName, strlen(originalName) + 1);
|
||||||
|
}
|
||||||
allocator->free(name, strlen(name) + 1);
|
allocator->free(name, strlen(name) + 1);
|
||||||
allocator->free(urlPrefix_, strlen(urlPrefix_) + 1);
|
allocator->free(urlPrefix_, strlen(urlPrefix_) + 1);
|
||||||
allocator->free(sourceUrl_, strlen(sourceUrl_) + 1);
|
allocator->free(sourceUrl_, strlen(sourceUrl_) + 1);
|
||||||
@ -544,6 +534,7 @@ class JarElement: public Element {
|
|||||||
|
|
||||||
System* s;
|
System* s;
|
||||||
Allocator* allocator;
|
Allocator* allocator;
|
||||||
|
const char* originalName;
|
||||||
const char* name;
|
const char* name;
|
||||||
const char* urlPrefix_;
|
const char* urlPrefix_;
|
||||||
const char* sourceUrl_;
|
const char* sourceUrl_;
|
||||||
@ -555,7 +546,7 @@ class BuiltinElement: public JarElement {
|
|||||||
public:
|
public:
|
||||||
BuiltinElement(System* s, Allocator* allocator, const char* name,
|
BuiltinElement(System* s, Allocator* allocator, const char* name,
|
||||||
const char* libraryName):
|
const char* libraryName):
|
||||||
JarElement(s, allocator, name),
|
JarElement(s, allocator, name, false),
|
||||||
libraryName(libraryName ? copy(allocator, libraryName) : 0)
|
libraryName(libraryName ? copy(allocator, libraryName) : 0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010 Avian Contributors
|
/* Copyright (c) 2008-2011 Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -3337,15 +3337,24 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
|
|||||||
|
|
||||||
const char** properties = static_cast<const char**>
|
const char** properties = static_cast<const char**>
|
||||||
(h->allocate(sizeof(const char*) * propertyCount));
|
(h->allocate(sizeof(const char*) * propertyCount));
|
||||||
|
|
||||||
const char** propertyPointer = properties;
|
const char** propertyPointer = properties;
|
||||||
|
|
||||||
|
const char** arguments = static_cast<const char**>
|
||||||
|
(h->allocate(sizeof(const char*) * a->nOptions));
|
||||||
|
|
||||||
|
const char** argumentPointer = arguments;
|
||||||
|
|
||||||
for (int i = 0; i < a->nOptions; ++i) {
|
for (int i = 0; i < a->nOptions; ++i) {
|
||||||
if (strncmp(a->options[i].optionString, "-D", 2) == 0) {
|
if (strncmp(a->options[i].optionString, "-D", 2) == 0) {
|
||||||
*(propertyPointer++) = a->options[i].optionString + 2;
|
*(propertyPointer++) = a->options[i].optionString + 2;
|
||||||
}
|
}
|
||||||
|
*(argumentPointer++) = a->options[i].optionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
*m = new (h->allocate(sizeof(Machine)))
|
*m = new (h->allocate(sizeof(Machine)))
|
||||||
Machine(s, h, bf, af, p, c, properties, propertyCount);
|
Machine
|
||||||
|
(s, h, bf, af, p, c, properties, propertyCount, arguments, a->nOptions);
|
||||||
|
|
||||||
*t = p->makeThread(*m, 0, 0);
|
*t = p->makeThread(*m, 0, 0);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -974,6 +974,8 @@ getClassAddendum(Thread* t, object class_, object pool)
|
|||||||
{
|
{
|
||||||
object addendum = classAddendum(t, class_);
|
object addendum = classAddendum(t, class_);
|
||||||
if (addendum == 0) {
|
if (addendum == 0) {
|
||||||
|
PROTECT(t, class_);
|
||||||
|
|
||||||
addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, 0);
|
addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, 0);
|
||||||
set(t, class_, ClassAddendum, addendum);
|
set(t, class_, ClassAddendum, addendum);
|
||||||
}
|
}
|
||||||
@ -1879,6 +1881,8 @@ makeArrayClass(Thread* t, object loader, unsigned dimensions, object spec,
|
|||||||
loader,
|
loader,
|
||||||
arrayLength(t, vtable));
|
arrayLength(t, vtable));
|
||||||
|
|
||||||
|
PROTECT(t, c);
|
||||||
|
|
||||||
t->m->processor->initVtable(t, c);
|
t->m->processor->initVtable(t, c);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
@ -2395,7 +2399,8 @@ namespace vm {
|
|||||||
|
|
||||||
Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
|
Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
|
||||||
Finder* appFinder, Processor* processor, Classpath* classpath,
|
Finder* appFinder, Processor* processor, Classpath* classpath,
|
||||||
const char** properties, unsigned propertyCount):
|
const char** properties, unsigned propertyCount,
|
||||||
|
const char** arguments, unsigned argumentCount):
|
||||||
vtable(&javaVMVTable),
|
vtable(&javaVMVTable),
|
||||||
system(system),
|
system(system),
|
||||||
heapClient(new (heap->allocate(sizeof(HeapClient)))
|
heapClient(new (heap->allocate(sizeof(HeapClient)))
|
||||||
@ -2411,6 +2416,8 @@ Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
|
|||||||
jniReferences(0),
|
jniReferences(0),
|
||||||
properties(properties),
|
properties(properties),
|
||||||
propertyCount(propertyCount),
|
propertyCount(propertyCount),
|
||||||
|
arguments(arguments),
|
||||||
|
argumentCount(argumentCount),
|
||||||
activeCount(0),
|
activeCount(0),
|
||||||
liveCount(0),
|
liveCount(0),
|
||||||
daemonCount(0),
|
daemonCount(0),
|
||||||
@ -2477,6 +2484,8 @@ Machine::dispose()
|
|||||||
heap->free(heapPool[i], ThreadHeapSizeInBytes);
|
heap->free(heapPool[i], ThreadHeapSizeInBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
heap->free(arguments, sizeof(const char*) * argumentCount);
|
||||||
|
|
||||||
heap->free(properties, sizeof(const char*) * propertyCount);
|
heap->free(properties, sizeof(const char*) * propertyCount);
|
||||||
|
|
||||||
static_cast<HeapClient*>(heapClient)->dispose();
|
static_cast<HeapClient*>(heapClient)->dispose();
|
||||||
@ -3016,16 +3025,20 @@ popResources(Thread* t)
|
|||||||
object
|
object
|
||||||
makeByteArray(Thread* t, const char* format, va_list a)
|
makeByteArray(Thread* t, const char* format, va_list a)
|
||||||
{
|
{
|
||||||
const int Size = 256;
|
int size = 256;
|
||||||
char buffer[Size];
|
while (true) {
|
||||||
|
THREAD_RUNTIME_ARRAY(t, char, buffer, size);
|
||||||
|
|
||||||
int r = vm::vsnprintf(buffer, Size - 1, format, a);
|
int r = vm::vsnprintf(RUNTIME_ARRAY_BODY(buffer), size - 1, format, a);
|
||||||
expect(t, r >= 0 and r < Size - 1);
|
if (r >= 0 and r < size - 1) {
|
||||||
|
object s = makeByteArray(t, strlen(RUNTIME_ARRAY_BODY(buffer)) + 1);
|
||||||
object s = makeByteArray(t, strlen(buffer) + 1);
|
memcpy(&byteArrayBody(t, s, 0), RUNTIME_ARRAY_BODY(buffer),
|
||||||
memcpy(&byteArrayBody(t, s, 0), buffer, byteArrayLength(t, s));
|
byteArrayLength(t, s));
|
||||||
|
return s;
|
||||||
return s;
|
} else {
|
||||||
|
size *= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object
|
object
|
||||||
@ -3215,14 +3228,17 @@ instanceOf(Thread* t, object class_, object o)
|
|||||||
object
|
object
|
||||||
classInitializer(Thread* t, object class_)
|
classInitializer(Thread* t, object class_)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < arrayLength(t, classMethodTable(t, class_)); ++i) {
|
if (classMethodTable(t, class_)) {
|
||||||
object o = arrayBody(t, classMethodTable(t, class_), i);
|
for (unsigned i = 0; i < arrayLength(t, classMethodTable(t, class_)); ++i)
|
||||||
|
|
||||||
if (vm::strcmp(reinterpret_cast<const int8_t*>("<clinit>"),
|
|
||||||
&byteArrayBody(t, methodName(t, o), 0)) == 0)
|
|
||||||
{
|
{
|
||||||
return o;
|
object o = arrayBody(t, classMethodTable(t, class_), i);
|
||||||
}
|
|
||||||
|
if (vm::strcmp(reinterpret_cast<const int8_t*>("<clinit>"),
|
||||||
|
&byteArrayBody(t, methodName(t, o), 0)) == 0)
|
||||||
|
{
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -1273,7 +1273,8 @@ class Machine {
|
|||||||
|
|
||||||
Machine(System* system, Heap* heap, Finder* bootFinder, Finder* appFinder,
|
Machine(System* system, Heap* heap, Finder* bootFinder, Finder* appFinder,
|
||||||
Processor* processor, Classpath* classpath, const char** properties,
|
Processor* processor, Classpath* classpath, const char** properties,
|
||||||
unsigned propertyCount);
|
unsigned propertyCount, const char** arguments,
|
||||||
|
unsigned argumentCount);
|
||||||
|
|
||||||
~Machine() {
|
~Machine() {
|
||||||
dispose();
|
dispose();
|
||||||
@ -1295,6 +1296,8 @@ class Machine {
|
|||||||
Reference* jniReferences;
|
Reference* jniReferences;
|
||||||
const char** properties;
|
const char** properties;
|
||||||
unsigned propertyCount;
|
unsigned propertyCount;
|
||||||
|
const char** arguments;
|
||||||
|
unsigned argumentCount;
|
||||||
unsigned activeCount;
|
unsigned activeCount;
|
||||||
unsigned liveCount;
|
unsigned liveCount;
|
||||||
unsigned daemonCount;
|
unsigned daemonCount;
|
||||||
@ -3036,7 +3039,7 @@ monitorWait(Thread* t, object monitor, int64_t time)
|
|||||||
|
|
||||||
ENTER(t, Thread::IdleState);
|
ENTER(t, Thread::IdleState);
|
||||||
|
|
||||||
interrupted = t->lock->wait(t->systemThread, time);
|
interrupted = t->lock->waitAndClearInterrupted(t->systemThread, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
monitorAcquire(t, monitor, monitorNode);
|
monitorAcquire(t, monitor, monitorNode);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -179,6 +179,10 @@ main(int ac, const char** av)
|
|||||||
or strncmp(av[i], "-D", 2) == 0)
|
or strncmp(av[i], "-D", 2) == 0)
|
||||||
{
|
{
|
||||||
++ vmArgs.nOptions;
|
++ vmArgs.nOptions;
|
||||||
|
} else if (strcmp(av[i], "-client") == 0
|
||||||
|
or strcmp(av[i], "-server") == 0)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
} else {
|
} else {
|
||||||
if (jar == 0) {
|
if (jar == 0) {
|
||||||
class_ = av[i++];
|
class_ = av[i++];
|
||||||
|
2
src/openjdk/my_management.c
Normal file
2
src/openjdk/my_management.c
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#define JNI_OnLoad management_JNI_OnLoad
|
||||||
|
#include "management.c"
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -286,7 +286,16 @@ class MySystem: public System {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool wait(System::Thread* context, int64_t time) {
|
virtual void wait(System::Thread* context, int64_t time) {
|
||||||
|
wait(context, time, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool waitAndClearInterrupted(System::Thread* context, int64_t time)
|
||||||
|
{
|
||||||
|
return wait(context, time, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wait(System::Thread* context, int64_t time, bool clearInterrupted) {
|
||||||
Thread* t = static_cast<Thread*>(context);
|
Thread* t = static_cast<Thread*>(context);
|
||||||
|
|
||||||
if (owner_ == t) {
|
if (owner_ == t) {
|
||||||
@ -298,7 +307,9 @@ class MySystem: public System {
|
|||||||
{ ACQUIRE(t->mutex);
|
{ ACQUIRE(t->mutex);
|
||||||
|
|
||||||
if (t->r->interrupted()) {
|
if (t->r->interrupted()) {
|
||||||
t->r->setInterrupted(false);
|
if (clearInterrupted) {
|
||||||
|
t->r->setInterrupted(false);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +340,7 @@ class MySystem: public System {
|
|||||||
t->flags = 0;
|
t->flags = 0;
|
||||||
|
|
||||||
interrupted = t->r->interrupted();
|
interrupted = t->r->interrupted();
|
||||||
if (interrupted) {
|
if (interrupted and clearInterrupted) {
|
||||||
t->r->setInterrupted(false);
|
t->r->setInterrupted(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -786,6 +797,15 @@ class MySystem: public System {
|
|||||||
return SO_SUFFIX;
|
return SO_SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char* toAbsolutePath(Allocator* allocator, const char* name) {
|
||||||
|
if (name[0] == '/') {
|
||||||
|
return copy(allocator, name);
|
||||||
|
} else {
|
||||||
|
char buffer[PATH_MAX];
|
||||||
|
return append(allocator, getcwd(buffer, PATH_MAX), "/", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual Status load(System::Library** lib,
|
virtual Status load(System::Library** lib,
|
||||||
const char* name)
|
const char* name)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2009, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2009-2010, Avian Contributors
|
/* Copyright (c) 2009-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2009, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -12,6 +12,7 @@
|
|||||||
#define SYSTEM_H
|
#define SYSTEM_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "allocator.h"
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
@ -59,7 +60,8 @@ class System {
|
|||||||
virtual bool tryAcquire(Thread* context) = 0;
|
virtual bool tryAcquire(Thread* context) = 0;
|
||||||
virtual void acquire(Thread* context) = 0;
|
virtual void acquire(Thread* context) = 0;
|
||||||
virtual void release(Thread* context) = 0;
|
virtual void release(Thread* context) = 0;
|
||||||
virtual bool wait(Thread* context, int64_t time) = 0;
|
virtual void wait(Thread* context, int64_t time) = 0;
|
||||||
|
virtual bool waitAndClearInterrupted(Thread* context, int64_t time) = 0;
|
||||||
virtual void notify(Thread* context) = 0;
|
virtual void notify(Thread* context) = 0;
|
||||||
virtual void notifyAll(Thread* context) = 0;
|
virtual void notifyAll(Thread* context) = 0;
|
||||||
virtual Thread* owner() = 0;
|
virtual Thread* owner() = 0;
|
||||||
@ -141,6 +143,8 @@ class System {
|
|||||||
virtual Status load(Library**, const char* name) = 0;
|
virtual Status load(Library**, const char* name) = 0;
|
||||||
virtual char pathSeparator() = 0;
|
virtual char pathSeparator() = 0;
|
||||||
virtual char fileSeparator() = 0;
|
virtual char fileSeparator() = 0;
|
||||||
|
virtual const char* toAbsolutePath(Allocator* allocator,
|
||||||
|
const char* name) = 0;
|
||||||
virtual int64_t now() = 0;
|
virtual int64_t now() = 0;
|
||||||
virtual void yield() = 0;
|
virtual void yield() = 0;
|
||||||
virtual void exit(int code) = 0;
|
virtual void exit(int code) = 0;
|
||||||
|
@ -4,6 +4,7 @@ THUNK(findInterfaceMethodFromInstanceAndReference)
|
|||||||
THUNK(findSpecialMethodFromReference)
|
THUNK(findSpecialMethodFromReference)
|
||||||
THUNK(findStaticMethodFromReference)
|
THUNK(findStaticMethodFromReference)
|
||||||
THUNK(findVirtualMethodFromReference)
|
THUNK(findVirtualMethodFromReference)
|
||||||
|
THUNK(getMethodAddress)
|
||||||
THUNK(compareDoublesG)
|
THUNK(compareDoublesG)
|
||||||
THUNK(compareDoublesL)
|
THUNK(compareDoublesL)
|
||||||
THUNK(compareFloatsG)
|
THUNK(compareFloatsG)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2010, Avian Contributors
|
/* Copyright (c) 2010-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -1911,7 +1911,7 @@ writeConstructors(Output* out, Object* declarations)
|
|||||||
|
|
||||||
out->write(")\n{\n");
|
out->write(")\n{\n");
|
||||||
|
|
||||||
bool hasObjectMask = false;
|
bool hasObjectMask = strcmp(typeName(o), "singleton") == 0;
|
||||||
for (MemberIterator it(o); it.hasMore();) {
|
for (MemberIterator it(o); it.hasMore();) {
|
||||||
Object* m = it.next();
|
Object* m = it.next();
|
||||||
if (m->type == Object::Scalar
|
if (m->type == Object::Scalar
|
||||||
|
@ -249,6 +249,8 @@
|
|||||||
|
|
||||||
(type incompatibleClassChangeError java/lang/IncompatibleClassChangeError)
|
(type incompatibleClassChangeError java/lang/IncompatibleClassChangeError)
|
||||||
|
|
||||||
|
(type abstractMethodError java/lang/AbstractMethodError)
|
||||||
|
|
||||||
(type noSuchFieldError java/lang/NoSuchFieldError)
|
(type noSuchFieldError java/lang/NoSuchFieldError)
|
||||||
|
|
||||||
(type noSuchMethodError java/lang/NoSuchMethodError)
|
(type noSuchMethodError java/lang/NoSuchMethodError)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2009, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -247,7 +247,16 @@ class MySystem: public System {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool wait(System::Thread* context, int64_t time) {
|
virtual void wait(System::Thread* context, int64_t time) {
|
||||||
|
wait(context, time, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool waitAndClearInterrupted(System::Thread* context, int64_t time)
|
||||||
|
{
|
||||||
|
return wait(context, time, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wait(System::Thread* context, int64_t time, bool clearInterrupted) {
|
||||||
Thread* t = static_cast<Thread*>(context);
|
Thread* t = static_cast<Thread*>(context);
|
||||||
assert(s, t);
|
assert(s, t);
|
||||||
|
|
||||||
@ -262,7 +271,9 @@ class MySystem: public System {
|
|||||||
{ ACQUIRE(s, t->mutex);
|
{ ACQUIRE(s, t->mutex);
|
||||||
|
|
||||||
if (t->r->interrupted()) {
|
if (t->r->interrupted()) {
|
||||||
t->r->setInterrupted(false);
|
if (clearInterrupted) {
|
||||||
|
t->r->setInterrupted(false);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +305,7 @@ class MySystem: public System {
|
|||||||
t->flags = 0;
|
t->flags = 0;
|
||||||
|
|
||||||
interrupted = t->r->interrupted();
|
interrupted = t->r->interrupted();
|
||||||
if (interrupted) {
|
if (interrupted and clearInterrupted) {
|
||||||
t->r->setInterrupted(false);
|
t->r->setInterrupted(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -762,6 +773,20 @@ class MySystem: public System {
|
|||||||
return SO_SUFFIX;
|
return SO_SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual const char* toAbsolutePath(Allocator* allocator, const char* name) {
|
||||||
|
if (strncmp(name, "//", 2) == 0
|
||||||
|
or strncmp(name, "\\\\", 2) == 0
|
||||||
|
or strncmp(name + 1, ":/", 2) == 0
|
||||||
|
or strncmp(name + 1, ":\\", 2) == 0)
|
||||||
|
{
|
||||||
|
return copy(allocator, name);
|
||||||
|
} else {
|
||||||
|
TCHAR buffer[MAX_PATH];
|
||||||
|
GetCurrentDirectory(MAX_PATH, buffer);
|
||||||
|
return append(allocator, buffer, "\\", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual Status load(System::Library** lib,
|
virtual Status load(System::Library** lib,
|
||||||
const char* name)
|
const char* name)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2009, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
42
src/x86.cpp
42
src/x86.cpp
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -238,7 +238,7 @@ codePromise(Context* c, unsigned offset)
|
|||||||
class Offset: public Promise {
|
class Offset: public Promise {
|
||||||
public:
|
public:
|
||||||
Offset(Context* c, MyBlock* block, unsigned offset, AlignmentPadding* limit):
|
Offset(Context* c, MyBlock* block, unsigned offset, AlignmentPadding* limit):
|
||||||
c(c), block(block), offset(offset), limit(limit)
|
c(c), block(block), offset(offset), limit(limit), value_(-1)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual bool resolved() {
|
virtual bool resolved() {
|
||||||
@ -248,14 +248,19 @@ class Offset: public Promise {
|
|||||||
virtual int64_t value() {
|
virtual int64_t value() {
|
||||||
assert(c, resolved());
|
assert(c, resolved());
|
||||||
|
|
||||||
return block->start + (offset - block->offset)
|
if (value_ == -1) {
|
||||||
+ padding(block->firstPadding, block->start, block->offset, limit);
|
value_ = block->start + (offset - block->offset)
|
||||||
|
+ padding(block->firstPadding, block->start, block->offset, limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context* c;
|
Context* c;
|
||||||
MyBlock* block;
|
MyBlock* block;
|
||||||
unsigned offset;
|
unsigned offset;
|
||||||
AlignmentPadding* limit;
|
AlignmentPadding* limit;
|
||||||
|
int value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Promise*
|
Promise*
|
||||||
@ -419,7 +424,8 @@ class AlignmentPadding {
|
|||||||
offset(c->code.length()),
|
offset(c->code.length()),
|
||||||
instructionOffset(instructionOffset),
|
instructionOffset(instructionOffset),
|
||||||
alignment(alignment),
|
alignment(alignment),
|
||||||
next(0)
|
next(0),
|
||||||
|
padding(-1)
|
||||||
{
|
{
|
||||||
if (c->lastBlock->firstPadding) {
|
if (c->lastBlock->firstPadding) {
|
||||||
c->lastBlock->lastPadding->next = this;
|
c->lastBlock->lastPadding->next = this;
|
||||||
@ -433,6 +439,7 @@ class AlignmentPadding {
|
|||||||
unsigned instructionOffset;
|
unsigned instructionOffset;
|
||||||
unsigned alignment;
|
unsigned alignment;
|
||||||
AlignmentPadding* next;
|
AlignmentPadding* next;
|
||||||
|
int padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
@ -441,14 +448,25 @@ padding(AlignmentPadding* p, unsigned start, unsigned offset,
|
|||||||
{
|
{
|
||||||
unsigned padding = 0;
|
unsigned padding = 0;
|
||||||
if (limit) {
|
if (limit) {
|
||||||
unsigned index = 0;
|
if (limit->padding == -1) {
|
||||||
for (; p; p = p->next) {
|
for (; p; p = p->next) {
|
||||||
index = p->offset - offset;
|
if (p->padding == -1) {
|
||||||
while ((start + index + padding + p->instructionOffset) % p->alignment) {
|
unsigned index = p->offset - offset;
|
||||||
++ padding;
|
while ((start + index + padding + p->instructionOffset)
|
||||||
}
|
% p->alignment)
|
||||||
|
{
|
||||||
|
++ padding;
|
||||||
|
}
|
||||||
|
|
||||||
if (p == limit) break;
|
p->padding = padding;
|
||||||
|
|
||||||
|
if (p == limit) break;
|
||||||
|
} else {
|
||||||
|
padding = p->padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
padding = limit->padding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return padding;
|
return padding;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008-2010, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2008, Avian Contributors
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
@ -49,8 +49,12 @@ public class Logging {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(r.getLoggerName());
|
sb.append(r.getLoggerName());
|
||||||
indent(sb, NAME_WIDTH - r.getLoggerName().length());
|
indent(sb, NAME_WIDTH - r.getLoggerName().length());
|
||||||
sb.append(r.getSourceMethodName());
|
String methodName = r.getSourceMethodName();
|
||||||
indent(sb, METHOD_WIDTH - r.getSourceMethodName().length());
|
if (methodName == null) {
|
||||||
|
methodName = "<unknown>";
|
||||||
|
}
|
||||||
|
sb.append(methodName);
|
||||||
|
indent(sb, METHOD_WIDTH - methodName.length());
|
||||||
sb.append(r.getLevel().getName());
|
sb.append(r.getLevel().getName());
|
||||||
indent(sb, LEVEL_WIDTH - r.getLevel().getName().length());
|
indent(sb, LEVEL_WIDTH - r.getLevel().getName().length());
|
||||||
sb.append(r.getMessage());
|
sb.append(r.getMessage());
|
||||||
|
1
vm.pro
1
vm.pro
@ -62,6 +62,7 @@
|
|||||||
-keep public class java.lang.StackOverflowError
|
-keep public class java.lang.StackOverflowError
|
||||||
-keep public class java.lang.NoSuchFieldError
|
-keep public class java.lang.NoSuchFieldError
|
||||||
-keep public class java.lang.NoSuchMethodError
|
-keep public class java.lang.NoSuchMethodError
|
||||||
|
-keep public class java.lang.AbstractMethodError
|
||||||
-keep public class java.lang.UnsatisfiedLinkError
|
-keep public class java.lang.UnsatisfiedLinkError
|
||||||
-keep public class java.lang.ExceptionInInitializerError
|
-keep public class java.lang.ExceptionInInitializerError
|
||||||
-keep public class java.lang.OutOfMemoryError
|
-keep public class java.lang.OutOfMemoryError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user