fix msvc build

This commit is contained in:
Joel Dice 2013-03-04 11:09:59 -07:00
parent a142a46d41
commit b3978c0a0a
8 changed files with 29 additions and 37 deletions

View File

@ -859,7 +859,7 @@ Java_java_io_RandomAccessFile_readBytes(JNIEnv* e, jclass, jlong peer,
uint8_t* dst = reinterpret_cast<uint8_t*>
(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) {

View File

@ -11,6 +11,9 @@
#ifndef AVIAN_UTIL_MATH_H
#define AVIAN_UTIL_MATH_H
#undef max
#undef min
namespace avian {
namespace util {

View File

@ -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"

View File

@ -16,6 +16,9 @@
#include <avian/util/math.h>
#undef max
#undef min
namespace vm {
class Vector {

View File

@ -26,6 +26,7 @@
#ifdef _MSC_VER
#include "float.h"
#include <stdint.h>
#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

View File

@ -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);

View File

@ -1,7 +1,7 @@
const unsigned NAME(BootMask) = (~static_cast<unsigned>(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);

View File

@ -11,6 +11,7 @@
#include <stdio.h>
#include <string.h>
#include <avian/common.h>
#include <avian/util/arg-parser.h>
namespace avian {