mirror of
https://github.com/corda/corda.git
synced 2025-01-01 02:36:44 +00:00
fix native Windows GCC 3.4 OpenJDK build
This commit is contained in:
parent
26a59612bb
commit
0ca6c3ed53
21
makefile
21
makefile
@ -54,6 +54,18 @@ test-executable = $(executable)
|
||||
boot-classpath = $(classpath-build)
|
||||
embed-prefix = /avian-embedded
|
||||
|
||||
native-path = echo
|
||||
|
||||
ifeq ($(build-platform),cygwin)
|
||||
native-path = cygpath -m
|
||||
endif
|
||||
|
||||
path-separator = :
|
||||
|
||||
ifneq (,$(filter mingw32 cygwin,$(build-platform)))
|
||||
path-separator = ;
|
||||
endif
|
||||
|
||||
ifdef openjdk
|
||||
ifdef openjdk-src
|
||||
include openjdk-src.mk
|
||||
@ -72,11 +84,11 @@ ifdef openjdk
|
||||
options := $(options)-openjdk
|
||||
test-executable = $(executable-dynamic)
|
||||
library-path = LD_LIBRARY_PATH=$(build)
|
||||
javahome = $(openjdk)/jre
|
||||
javahome = "$$($(native-path) "$(openjdk)/jre")"
|
||||
endif
|
||||
|
||||
classpath = openjdk
|
||||
boot-classpath := $(boot-classpath):$(openjdk)/jre/lib/rt.jar
|
||||
boot-classpath := "$(boot-classpath)$(path-separator)$$($(native-path) "$(openjdk)/jre/lib/rt.jar")"
|
||||
build-javahome = $(openjdk)/jre
|
||||
endif
|
||||
|
||||
@ -127,7 +139,7 @@ warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self \
|
||||
common-cflags = $(warnings) -fno-rtti -fno-exceptions -fno-omit-frame-pointer \
|
||||
"-I$(JAVA_HOME)/include" -idirafter $(src) -I$(build) $(classpath-cflags) \
|
||||
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
|
||||
-DUSE_ATOMIC_OPERATIONS "-DAVIAN_JAVA_HOME=\"$(javahome)\"" \
|
||||
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
|
||||
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\"
|
||||
|
||||
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
||||
@ -157,8 +169,6 @@ so-suffix = .so
|
||||
|
||||
shared = -shared
|
||||
|
||||
native-path = echo
|
||||
|
||||
ifeq ($(arch),i386)
|
||||
pointer-size = 4
|
||||
endif
|
||||
@ -241,7 +251,6 @@ ifeq ($(platform),windows)
|
||||
build-cflags += -mno-cygwin
|
||||
lflags += -mno-cygwin
|
||||
cflags += -mno-cygwin
|
||||
native-path = cygpath -m
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -1528,11 +1528,11 @@ Avian_sun_misc_Unsafe_compareAndSwapInt
|
||||
{
|
||||
object target = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int32_t expect = arguments[4];
|
||||
int32_t update = arguments[5];
|
||||
uint32_t expect = arguments[4];
|
||||
uint32_t update = arguments[5];
|
||||
|
||||
return __sync_bool_compare_and_swap
|
||||
(&cast<int32_t>(target, offset), expect, update);
|
||||
return atomicCompareAndSwap32
|
||||
(&cast<uint32_t>(target, offset), expect, update);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
@ -1541,11 +1541,11 @@ Avian_sun_misc_Unsafe_compareAndSwapObject
|
||||
{
|
||||
object target = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
intptr_t expect = arguments[4];
|
||||
intptr_t update = arguments[5];
|
||||
uintptr_t expect = arguments[4];
|
||||
uintptr_t update = arguments[5];
|
||||
|
||||
bool success = __sync_bool_compare_and_swap
|
||||
(&cast<intptr_t>(target, offset), expect, update);
|
||||
bool success = atomicCompareAndSwap
|
||||
(&cast<uintptr_t>(target, offset), expect, update);
|
||||
|
||||
if (success) {
|
||||
mark(t, target, offset);
|
||||
@ -1560,11 +1560,11 @@ Avian_sun_misc_Unsafe_compareAndSwapLong
|
||||
{
|
||||
object target = reinterpret_cast<object>(arguments[1]);
|
||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||
int64_t expect; memcpy(&expect, arguments + 4, 8);
|
||||
int64_t update; memcpy(&update, arguments + 6, 8);
|
||||
uint64_t expect; memcpy(&expect, arguments + 4, 8);
|
||||
uint64_t update; memcpy(&update, arguments + 6, 8);
|
||||
|
||||
return __sync_bool_compare_and_swap
|
||||
(&cast<int64_t>(target, offset), expect, update);
|
||||
return atomicCompareAndSwap64
|
||||
(&cast<uint64_t>(target, offset), expect, update);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
|
13
src/x86.h
13
src/x86.h
@ -223,6 +223,19 @@ atomicCompareAndSwap64(uint64_t* p, uint64_t old, uint64_t new_)
|
||||
(reinterpret_cast<LONGLONG*>(p), new_, old);
|
||||
#elif (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 1)
|
||||
return __sync_bool_compare_and_swap(p, old, new_);
|
||||
#elif defined ARCH_x86_32
|
||||
uint8_t result;
|
||||
|
||||
__asm__ __volatile__("lock; cmpxchg8b %0; setz %1"
|
||||
: "=m"(*p), "=q"(result)
|
||||
: "a"(static_cast<uint32_t>(old)),
|
||||
"d"(static_cast<uint32_t>(old >> 32)),
|
||||
"b"(static_cast<uint32_t>(new_)),
|
||||
"c"(static_cast<uint32_t>(new_ >> 32)),
|
||||
"m"(*p)
|
||||
: "memory");
|
||||
|
||||
return result != 0;
|
||||
#else
|
||||
uint8_t result;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user