diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index f2e9fd3c18..ff6bc8fffc 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -859,7 +859,7 @@ Java_java_io_RandomAccessFile_readBytes(JNIEnv* e, jclass, jlong peer, uint8_t* dst = reinterpret_cast (e->GetPrimitiveArrayCritical(buffer, 0)); - ssize_t bytesRead = ::read(fd, dst + offset, length); + int64_t bytesRead = ::read(fd, dst + offset, length); e->ReleasePrimitiveArrayCritical(buffer, dst, 0); if(bytesRead == -1) { diff --git a/include/avian/util/math.h b/include/avian/util/math.h index ecd4f18fc5..25337abb47 100644 --- a/include/avian/util/math.h +++ b/include/avian/util/math.h @@ -11,6 +11,9 @@ #ifndef AVIAN_UTIL_MATH_H #define AVIAN_UTIL_MATH_H +#undef max +#undef min + namespace avian { namespace util { diff --git a/makefile b/makefile index 964768539c..912a2c1886 100755 --- a/makefile +++ b/makefile @@ -873,20 +873,23 @@ endif ifdef msvc no-error = + target-format = pe windows-path = $(native-path) windows-java-home := $(shell $(windows-path) "$(JAVA_HOME)") zlib := $(shell $(windows-path) "$(win32)/msvc") ms_cl_compiler = regular + as = $(build-cc) cxx = "$(msvc)/BIN/cl.exe" cc = $(cxx) ld = "$(msvc)/BIN/link.exe" mt = "mt.exe" + ar = "$(msvc)/BIN/lib.exe" manifest-flags = -MANIFEST -MANIFESTFILE:$(@).manifest cflags = -nologo -DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \ -DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \ -DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" \ -Fd$(build)/$(name).pdb -I"$(zlib)/include" -I$(src) -I$(classpath-src) \ - -I"$(build)" \ + -I"$(build)" -Iinclude \ -I"$(windows-java-home)/include" -I"$(windows-java-home)/include/win32" \ -DTARGET_BYTES_PER_WORD=$(pointer-size) @@ -899,21 +902,18 @@ ifdef msvc -DEFAULTLIB:zlib -DEFAULTLIB:user32 -MANIFEST -debug output = -Fo$(1) - ifeq ($(mode),debug) - cflags += -Od -Zi -MDd - endif - ifeq ($(mode),debug-fast) - cflags += -Od -Zi -DNDEBUG - endif + cflags_debug = -Od -Zi -MDd + cflags_debug_fast = -Od -Zi -DNDEBUG + cflags_fast = -O2 -GL -Zi -DNDEBUG + cflags_small = -O1s -Zi -GL -DNDEBUG ifeq ($(mode),fast) - cflags += -O2 -GL -Zi -DNDEBUG lflags += -LTCG endif ifeq ($(mode),small) - cflags += -O1s -Zi -GL -DNDEBUG lflags += -LTCG endif + use-lto = false strip = : endif @@ -1026,19 +1026,15 @@ compiler-sources = \ $(src)/codegen/registers.cpp \ $(src)/codegen/targets.cpp compiler-objects = $(call cpp-objects,$(compiler-sources),$(src),$(build)) -$(compiler-objects): $(wildcard $(src)/codegen/compiler/*.h) $(vm-depends) x86-assembler-sources = $(wildcard $(src)/codegen/target/x86/*.cpp) x86-assembler-objects = $(call cpp-objects,$(x86-assembler-sources),$(src),$(build)) -$(x86-assembler-objects): $(wildcard $(src)/codegen/target/x86/*.h) $(vm-depends) arm-assembler-sources = $(wildcard $(src)/codegen/target/arm/*.cpp) arm-assembler-objects = $(call cpp-objects,$(arm-assembler-sources),$(src),$(build)) -$(arm-assembler-objects): $(wildcard $(src)/codegen/target/arm/*.h) $(vm-depends) powerpc-assembler-sources = $(wildcard $(src)/codegen/target/powerpc/*.cpp) powerpc-assembler-objects = $(call cpp-objects,$(powerpc-assembler-sources),$(src),$(build)) -$(powerpc-assembler-objects): $(wildcard $(src)/codegen/target/powerpc/*.h) $(vm-depends) all-assembler-sources = \ $(x86-assembler-sources) \ @@ -1352,6 +1348,14 @@ $(test-dep): $(classpath-dep) $(test-extra-dep): $(classpath-dep) +$(compiler-objects): $(wildcard $(src)/codegen/compiler/*.h) $(vm-depends) + +$(x86-assembler-objects): $(wildcard $(src)/codegen/target/x86/*.h) $(vm-depends) + +$(arm-assembler-objects): $(wildcard $(src)/codegen/target/arm/*.h) $(vm-depends) + +$(powerpc-assembler-objects): $(wildcard $(src)/codegen/target/powerpc/*.h) $(vm-depends) + .PHONY: run run: build $(library-path) $(test-executable) $(test-args) @@ -1507,7 +1511,7 @@ endef define compile-unittest-object @echo "compiling $(@)" @mkdir -p $(dir $(@)) - $(cxx) $(cflags) -c $$($(windows-path) -I$(unittest) $(<)) $(call output,$(@)) + $(cxx) $(cflags) -c $$($(windows-path) $(<)) -I$(unittest) $(call output,$(@)) endef $(vm-cpp-objects): $(build)/%.o: $(src)/%.cpp $(vm-depends) @@ -1814,7 +1818,7 @@ $(executable-dynamic): $(driver-dynamic-objects) $(dynamic-library) @echo "linking $(@)" ifdef ms_cl_compiler $(ld) $(lflags) -LIBPATH:$(build) -DEFAULTLIB:$(name) \ - -debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) + -debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) \ $(driver-dynamic-objects) -out:$(@) $(manifest-flags) ifdef mt $(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1" diff --git a/src/avian/alloc-vector.h b/src/avian/alloc-vector.h index 8b47a055db..940f978bd2 100644 --- a/src/avian/alloc-vector.h +++ b/src/avian/alloc-vector.h @@ -16,6 +16,9 @@ #include +#undef max +#undef min + namespace vm { class Vector { diff --git a/src/avian/common.h b/src/avian/common.h index f8a0e22168..f3618a8e83 100644 --- a/src/avian/common.h +++ b/src/avian/common.h @@ -26,6 +26,7 @@ #ifdef _MSC_VER #include "float.h" +#include #ifdef powerpc # undef powerpc @@ -38,15 +39,6 @@ // don't complain about using 'this' in member initializers: # pragma warning(disable:4355) -typedef char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; - #define strncasecmp _strnicmp #define FP_NAN 0 @@ -66,11 +58,6 @@ inline int fpclassify(double d) { return FP_UNDEF; } -#define INT32_MIN ((int32_t) _I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t) _I64_MIN) -#define INT64_MAX _I64_MAX - inline int signbit(double d) { return _copysign(1.0, d) < 0; } @@ -94,19 +81,16 @@ inline int signbit(double d) { # ifdef _M_IX86 typedef int32_t intptr_t; typedef uint32_t uintptr_t; -# define UINT64_C(x) x##LL # define ARCH_x86_32 # define BYTES_PER_WORD 4 # elif defined _M_X64 typedef int64_t intptr_t; typedef uint64_t uintptr_t; -# define UINT64_C(x) x##L # define ARCH_x86_64 # define BYTES_PER_WORD 8 # elif defined _M_ARM_FP typedef int32_t intptr_t; typedef uint32_t uintptr_t; -# define UINT64_C(x) x##LL # define ARCH_arm # define BYTES_PER_WORD 4 # else diff --git a/src/avian/machine.h b/src/avian/machine.h index ec0257491d..fca793c055 100644 --- a/src/avian/machine.h +++ b/src/avian/machine.h @@ -1329,9 +1329,6 @@ checkDaemon(Thread* t); object& root(Thread* t, Machine::Root root); -#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) -# define vmRun vmRun_ -#endif extern "C" uint64_t vmRun(uint64_t (*function)(Thread*, uintptr_t*), uintptr_t* arguments, void* checkpoint); diff --git a/src/bootimage-template.cpp b/src/bootimage-template.cpp index 86df096777..bf32267ece 100644 --- a/src/bootimage-template.cpp +++ b/src/bootimage-template.cpp @@ -1,7 +1,7 @@ const unsigned NAME(BootMask) = (~static_cast(0)) / NAME(BytesPerWord); -const unsigned NAME(BootShift) = 32 - log(NAME(BytesPerWord)); +const unsigned NAME(BootShift) = 32 - avian::util::log(NAME(BytesPerWord)); const unsigned NAME(BootFlatConstant) = 1 << NAME(BootShift); const unsigned NAME(BootHeapOffset) = 1 << (NAME(BootShift) + 1); diff --git a/src/util/arg-parser.cpp b/src/util/arg-parser.cpp index cefc221532..1d87051819 100644 --- a/src/util/arg-parser.cpp +++ b/src/util/arg-parser.cpp @@ -11,6 +11,7 @@ #include #include +#include #include namespace avian {