Merge commit '752d02e7786b807185e3f4cd254ee988c01f830f' into HEAD

Conflicts:
	classpath/java-io.cpp
	makefile
	src/bootimage.cpp
	src/interpret.cpp
	src/machine.cpp
	src/windows.cpp
This commit is contained in:
Joel Dice 2013-02-12 10:47:28 -07:00
commit 86c92e26cb
6 changed files with 44 additions and 38 deletions

View File

@ -803,9 +803,9 @@ Java_java_io_RandomAccessFile_open(JNIEnv* e, jclass, jstring path,
jlong length = 0;
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#if defined(PLATFORM_WINDOWS)
int fd = ::_wopen(chars, O_RDONLY);
int fd = ::_wopen(chars, O_RDONLY | OPEN_MASK);
#else
int fd = ::open((const char*)chars, O_RDONLY);
int fd = ::open((const char*)chars, O_RDONLY | OPEN_MASK);
#endif
releaseChars(e, path, chars);
if (fd == -1) {

View File

@ -179,7 +179,7 @@ dlltool = dlltool
vg = nice valgrind --num-callers=32 --db-attach=yes --freelist-vol=100000000
vg += --leak-check=full --suppressions=valgrind.supp
db = gdb --args
javac = "$(JAVA_HOME)/bin/javac"
javac = "$(JAVA_HOME)/bin/javac" -encoding UTF-8
javah = "$(JAVA_HOME)/bin/javah"
jar = "$(JAVA_HOME)/bin/jar"
strip = strip
@ -435,7 +435,7 @@ ifeq ($(platform),android)
lflags = "-L$(sysroot)/usr/lib" $(common-lflags) -llog
target-format = elf
use-lto = false
ifeq ($(arch),arm)
cflags += -marm -march=$(android-arm-arch) -ftree-vectorize -ffast-math -mfloat-abi=softfp
endif
@ -1245,6 +1245,11 @@ javadoc:
-header "Avian v$(version)" \
-bottom "<a href=\"http://oss.readytalk.com/avian/\">http://oss.readytalk.com/avian</a>"
.PHONY: clean-current
clean-current:
@echo "removing $(build)"
rm -rf $(build)
.PHONY: clean
clean:
@echo "removing $(build)"
@ -1475,7 +1480,8 @@ else
$(ranlib) $(@)
endif
$(bootimage-object) $(codeimage-object): $(bootimage-generator)
$(bootimage-object) $(codeimage-object): $(bootimage-generator) \
$(openjdk-jar-dep)
@echo "generating bootimage and codeimage binaries from $(classpath-build) using $(<)"
$(<) -cp $(classpath-build) -bootimage $(bootimage-object) -codeimage $(codeimage-object) \
-bootimage-symbols $(bootimage-symbols) \

View File

@ -342,7 +342,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
unsigned count = s.read2() - 1;
if (count) {
RUNTIME_ARRAY(Type, types, count + 2);
THREAD_RUNTIME_ARRAY(t, Type, types, count + 2);
types[0] = Type_object;
types[1] = Type_intptr_t;
@ -420,7 +420,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
object fields = allFields(t, typeMaps, c, &count, &array);
PROTECT(t, fields);
RUNTIME_ARRAY(Field, memberFields, count + 1);
THREAD_RUNTIME_ARRAY(t, Field, memberFields, count + 1);
unsigned memberIndex;
unsigned buildMemberOffset;
@ -454,7 +454,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
const unsigned StaticHeader = 3;
RUNTIME_ARRAY(Field, staticFields, count + StaticHeader);
THREAD_RUNTIME_ARRAY(t, Field, staticFields, count + StaticHeader);
init(new (&staticFields[0]) Field, Type_object, 0, BytesPerWord, 0,
TargetBytesPerWord);
@ -1334,7 +1334,7 @@ writeBootImage2(Thread* t, OutputStream* bootimageOutput, OutputStream* codeOutp
}
++ count;
RUNTIME_ARRAY(Field, fields, count);
THREAD_RUNTIME_ARRAY(t, Field, fields, count);
init(new (&fields[0]) Field, Type_object, 0, BytesPerWord, 0,
TargetBytesPerWord);

View File

@ -647,7 +647,7 @@ invokeNative(Thread* t, object method)
{ THREAD_RESOURCE0(t, popFrame(static_cast<Thread*>(t)));
unsigned footprint = methodParameterFootprint(t, method);
RUNTIME_ARRAY(uintptr_t, args, footprint);
THREAD_RUNTIME_ARRAY(t, uintptr_t, args, footprint);
unsigned sp = frameBase(t, t->frame);
unsigned argOffset = 0;
if ((methodFlags(t, method) & ACC_STATIC) == 0) {
@ -2321,7 +2321,7 @@ interpret3(Thread* t, const int base)
object class_ = resolveClassInPool(t, frameMethod(t, frame), index - 1);
PROTECT(t, class_);
RUNTIME_ARRAY(int32_t, counts, dimensions);
THREAD_RUNTIME_ARRAY(t, int32_t, counts, dimensions);
for (int i = dimensions - 1; i >= 0; --i) {
counts[i] = popInt(t);
if (UNLIKELY(counts[i] < 0)) {

View File

@ -4769,11 +4769,14 @@ logTrace(FILE* f, const char* fmt, ...)
#else
const unsigned length = vsnprintf(0, 0, fmt, a);
#endif
RUNTIME_ARRAY(char, buffer, length + 1);
vsnprintf(&buffer[0], length, fmt, a);
buffer[length] = 0;
va_end(a);
RUNTIME_ARRAY(char, buffer, length + 1);
va_start(a, fmt);
vsnprintf(&buffer[0], length + 1, fmt, a);
va_end(a);
buffer[length] = 0;
::fprintf(f, "%s", &buffer[0]);
#ifdef PLATFORM_WINDOWS
::OutputDebugStringA(&buffer[0]);

View File

@ -803,17 +803,15 @@ class MySystem: public System {
virtual Status map(System::Region** region, const char* name) {
Status status = 1;
size_t nameLen = strlen(name) * 2;
RUNTIME_ARRAY(wchar_t, wideName, nameLen + 1);
MultiByteToWideChar(CP_UTF8, 0, name, -1, wideName, nameLen + 1);
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
HANDLE file = CreateFile(name, FILE_READ_DATA, FILE_SHARE_READ, 0,
OPEN_EXISTING, 0, 0);
HANDLE file = CreateFileW(wideName, FILE_READ_DATA, FILE_SHARE_READ, 0,
OPEN_EXISTING, 0, 0);
#else
size_t nameLen = strlen(name);
wchar_t* wideName = new wchar_t[nameLen + 1];
size_t convertedChars = 0;
mbstowcs_s(&convertedChars, wideName, nameLen + 1, name, nameLen);
HANDLE file = CreateFile2(wideName, GENERIC_READ, FILE_SHARE_READ,
OPEN_EXISTING, 0);
delete[] wideName;
#endif
if (file != INVALID_HANDLE_VALUE) {
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
@ -882,21 +880,21 @@ class MySystem: public System {
}
virtual FileType stat(const char* name, unsigned* length) {
struct _stat s;
int r = _stat(name, &s);
if (r == 0) {
if (S_ISREG(s.st_mode)) {
*length = s.st_size;
return TypeFile;
} else if (S_ISDIR(s.st_mode)) {
*length = 0;
size_t nameLen = strlen(name) * 2;
RUNTIME_ARRAY(wchar_t, wideName, nameLen + 1);
MultiByteToWideChar(CP_UTF8, 0, name, -1, wideName, nameLen + 1);
WIN32_FILE_ATTRIBUTE_DATA data;
if (GetFileAttributesExW
(wideName, GetFileExInfoStandard, &data))
{
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
return TypeDirectory;
} else {
*length = 0;
return TypeUnknown;
*length = (data.nFileSizeHigh * static_cast<int64_t>(MAXDWORD + 1))
+ data.nFileSizeLow;
return TypeFile;
}
} else {
*length = 0;
return TypeDoesNotExist;
}
}
@ -934,15 +932,14 @@ class MySystem: public System {
HMODULE handle;
unsigned nameLength = (name ? strlen(name) : 0);
if (name) {
size_t nameLen = nameLength * 2;
RUNTIME_ARRAY(wchar_t, wideName, nameLen + 1);
MultiByteToWideChar(CP_UTF8, 0, name, -1, wideName, nameLen + 1);
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
handle = LoadLibrary(name);
handle = LoadLibraryW(wideName);
#else
size_t nameLen = strlen(name);
wchar_t* wideName = new wchar_t[nameLen + 1];
size_t convertedChars = 0;
mbstowcs_s(&convertedChars, wideName, nameLen + 1, name, nameLen);
handle = LoadPackagedLibrary(wideName, 0);
delete[] wideName;
#endif
} else {
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)