diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 035a6ecc1c..22a480cc77 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -405,14 +405,21 @@ Java_java_io_File_openDir(JNIEnv* e, jclass, jstring path) { const char* chars = e->GetStringUTFChars(path, 0); if (chars) { + unsigned length = strlen(chars); + + RUNTIME_ARRAY(char, buffer, length + 3); + memcpy(RUNTIME_ARRAY_BODY(buffer), chars, length); + memcpy(RUNTIME_ARRAY_BODY(buffer) + length, "\\*", 3); + + e->ReleaseStringUTFChars(path, chars); + Directory* d = new (malloc(sizeof(Directory))) Directory; - d->handle = FindFirstFile(chars, &(d->data)); + d->handle = FindFirstFile(RUNTIME_ARRAY_BODY(buffer), &(d->data)); if (d->handle == INVALID_HANDLE_VALUE) { d->dispose(); d = 0; } - e->ReleaseStringUTFChars(path, chars); return reinterpret_cast(d); } else { return 0; diff --git a/makefile b/makefile index 009abe1f94..c55c082ef1 100644 --- a/makefile +++ b/makefile @@ -3,12 +3,12 @@ MAKEFLAGS = -s name = avian version = 0.2 -build-arch = $(shell uname -m | sed 's/^i.86$$/i386/') +build-arch := $(shell uname -m | sed 's/^i.86$$/i386/') ifeq (Power,$(filter Power,$(build-arch))) build-arch = powerpc endif -build-platform = \ +build-platform := \ $(shell uname -s | tr [:upper:] [:lower:] \ | sed 's/^mingw32.*$$/mingw32/' \ | sed 's/^cygwin.*$$/cygwin/') @@ -54,10 +54,10 @@ ifdef gnu gnu-object-dep = $(build)/gnu-object.dep gnu-cflags = -DBOOT_BUILTINS=\"javaio,javalang,javalangreflect,javamath,javanet,javanio,javautil\" -DAVIAN_GNU gnu-lflags = -lgmp - gnu-objects = $(shell find $(build)/gnu-objects -name "*.o") + gnu-objects := $(shell find $(build)/gnu-objects -name "*.o") endif -root = $(shell (cd .. && pwd)) +root := $(shell (cd .. && pwd)) build = build native-build = $(build)/$(platform)-$(arch)$(options) classpath-build = $(build)/classpath @@ -247,8 +247,8 @@ ld := $(cc) build-ld := $(build-cc) ifdef msvc - windows-java-home = $(shell cygpath -m "$(JAVA_HOME)") - zlib = $(shell cygpath -m "$(root)/win32/msvc") + windows-java-home := $(shell cygpath -m "$(JAVA_HOME)") + zlib := $(shell cygpath -m "$(root)/win32/msvc") cxx = "$(msvc)/BIN/cl.exe" cc = $(cxx) ld = "$(msvc)/BIN/link.exe" @@ -286,7 +286,7 @@ cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(3)/%.o,$(x))) asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.S,$(3)/%-asm.o,$(x))) java-classes = $(foreach x,$(1),$(patsubst $(2)/%.java,$(3)/%.class,$(x))) -jni-sources = $(shell find $(classpath) -name '*.cpp') +jni-sources := $(shell find $(classpath) -name '*.cpp') jni-objects = $(call cpp-objects,$(jni-sources),$(classpath),$(native-build)) generated-code = \ @@ -405,7 +405,7 @@ executable = $(native-build)/$(name)${exe-suffix} dynamic-library = $(native-build)/$(so-prefix)$(name)$(so-suffix) executable-dynamic = $(native-build)/$(name)-dynamic${exe-suffix} -classpath-sources = $(shell find $(classpath) -name '*.java') +classpath-sources := $(shell find $(classpath) -name '*.java') classpath-classes = \ $(call java-classes,$(classpath-sources),$(classpath),$(classpath-build)) classpath-object = $(native-build)/classpath-jar.o @@ -464,7 +464,9 @@ args = $(flags) $(input) build: $(static-library) $(executable) $(dynamic-library) \ $(executable-dynamic) $(classpath-dep) $(test-dep) $(test-extra-dep) -$(test-classes): $(classpath-dep) +$(test-dep): $(classpath-dep) + +$(test-extra-dep): $(classpath-dep) .PHONY: run run: build @@ -676,18 +678,13 @@ else endif $(strip) $(strip-all) $(@) -$(bootimage-generator): make-bootimage-generator - -make-bootimage-generator: - (unset MAKEFLAGS && \ - make mode=$(mode) \ +$(bootimage-generator): + $(MAKE) mode=$(mode) \ arch=$(build-arch) \ platform=$(bootimage-platform) \ - bootimage=$(bootimage) \ - heapdump=$(heapdump) \ bootimage-generator= \ build-bootimage-generator=$(bootimage-generator) \ - $(bootimage-generator)) + $(bootimage-generator) $(build-bootimage-generator): \ $(vm-objects) $(classpath-object) $(jni-objects) $(heapwalk-objects) \ diff --git a/src/compile.cpp b/src/compile.cpp index a7e67b7e9a..ac87bfa8d8 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -6351,7 +6351,9 @@ class SegFaultHandler: public System::SignalHandler { void* oldBase = t->base; void* oldStack = t->stack; - t->ip = *ip; + // add one to the IP since findLineNumber will subtract one + // when we make the trace: + t->ip = static_cast(*ip) + 1; t->base = *base; t->stack = static_cast(*stack) - t->arch->frameReturnAddressSize(); diff --git a/src/windows.cpp b/src/windows.cpp index 74aa32b498..f15c2996d2 100644 --- a/src/windows.cpp +++ b/src/windows.cpp @@ -678,8 +678,13 @@ class MySystem: public System { virtual Status open(System::Directory** directory, const char* name) { Status status = 1; + unsigned length = strlen(name); + RUNTIME_ARRAY(char, buffer, length + 3); + memcpy(RUNTIME_ARRAY_BODY(buffer), name, length); + memcpy(RUNTIME_ARRAY_BODY(buffer) + length, "\\*", 3); + Directory* d = new (allocate(this, sizeof(Directory))) Directory(this); - d->handle = FindFirstFile(name, &(d->data)); + d->handle = FindFirstFile(RUNTIME_ARRAY_BODY(buffer), &(d->data)); if (d->handle == INVALID_HANDLE_VALUE) { d->dispose(); } else {