mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
more windows port fixes
This commit is contained in:
parent
f2f453cf75
commit
eaf1d205cd
@ -8,11 +8,9 @@
|
||||
#include "jni.h"
|
||||
#include "jni-util.h"
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
|
||||
# define OPEN _open
|
||||
# define CLOSE _close
|
||||
# define READ _read
|
||||
@ -25,6 +23,7 @@
|
||||
# define OPEN_MASK O_BINARY
|
||||
#else
|
||||
# include <unistd.h>
|
||||
|
||||
# define OPEN open
|
||||
# define CLOSE close
|
||||
# define READ read
|
||||
@ -35,6 +34,9 @@
|
||||
# define CREAT creat
|
||||
# define UNLINK unlink
|
||||
# define OPEN_MASK 0
|
||||
|
||||
# undef JNIEXPORT
|
||||
# define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
@ -11,9 +11,12 @@
|
||||
|
||||
#ifdef WIN32
|
||||
# include "windows.h"
|
||||
#else
|
||||
# undef JNIEXPORT
|
||||
# define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef WIN32
|
||||
# define SO_PREFIX ""
|
||||
#else
|
||||
# define SO_PREFIX "lib"
|
||||
@ -27,9 +30,6 @@
|
||||
# define SO_SUFFIX ".so"
|
||||
#endif
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
|
||||
extern "C" JNIEXPORT jstring JNICALL
|
||||
Java_java_lang_System_getProperty(JNIEnv* e, jclass, jint code)
|
||||
{
|
||||
@ -55,7 +55,6 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jint code)
|
||||
case JavaIoTmpdir: {
|
||||
TCHAR buffer[MAX_PATH];
|
||||
GetTempPath(MAX_PATH, buffer);
|
||||
fprintf(stderr, "tmpdir: %s\n", buffer);
|
||||
return e->NewStringUTF(buffer);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni-util.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <errno.h>
|
||||
@ -12,14 +15,11 @@
|
||||
# include <errno.h>
|
||||
# include <netdb.h>
|
||||
# include <sys/select.h>
|
||||
|
||||
# undef JNIEXPORT
|
||||
# define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni-util.h"
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
|
||||
#define java_nio_channels_SelectionKey_OP_READ 1L
|
||||
#define java_nio_channels_SelectionKey_OP_WRITE 4L
|
||||
#define java_nio_channels_SelectionKey_OP_ACCEPT 16L
|
||||
|
@ -5,8 +5,10 @@
|
||||
#include "jni.h"
|
||||
#include "jni-util.h"
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#ifndef WIN32
|
||||
# undef JNIEXPORT
|
||||
# define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
extern "C" JNIEXPORT jlong JNICALL
|
||||
Java_java_util_zip_Inflater_make
|
||||
|
4
makefile
4
makefile
@ -80,7 +80,7 @@ ifeq ($(platform),windows)
|
||||
ranlib = i586-mingw32msvc-ranlib
|
||||
|
||||
rdynamic = -Wl,--export-dynamic
|
||||
lflags = -L$(lib) -lm -lz -lws2_32 -Wl,--kill-at
|
||||
lflags = -L$(lib) -lm -lz -lws2_32 -Wl,--kill-at -mwindows -mconsole
|
||||
cflags = $(common-cflags) -I$(inc)
|
||||
endif
|
||||
|
||||
@ -262,7 +262,7 @@ $(jni-objects): $(bld)/%.o: $(classpath)/%.cpp
|
||||
ifeq ($(platform),windows)
|
||||
$(archive): $(interpreter-objects) $(jni-objects)
|
||||
@echo "creating $(@)"
|
||||
$(dlltool) --export-all-symbols -z $(@).def $(^)
|
||||
$(dlltool) -z $(@).def $(^)
|
||||
$(dlltool) -k -d $(@).def -e $(@).exp
|
||||
$(ar) cru $(@) $(@).exp $(^)
|
||||
$(ranlib) $(@)
|
||||
|
@ -2,8 +2,11 @@
|
||||
#include "constants.h"
|
||||
#include "processor.h"
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#ifdef __MINGW32__
|
||||
# define JNIEXPORT __declspec(dllexport)
|
||||
#else
|
||||
# define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
using namespace vm;
|
||||
|
||||
@ -520,8 +523,6 @@ Java_java_lang_Runtime_load(Thread* t, jclass, jstring name, jboolean mapName)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "load %s; map name: %d\n", n, mapName);
|
||||
|
||||
System::Library* lib;
|
||||
if (LIKELY(t->m->system->success
|
||||
(t->m->system->load(&lib, n, mapName, t->m->libraries))))
|
||||
|
@ -7,7 +7,11 @@
|
||||
#include "finder.h"
|
||||
#include "processor.h"
|
||||
|
||||
#define JNICALL
|
||||
#ifdef __MINGW32__
|
||||
# define JNICALL __stdcall
|
||||
#else
|
||||
# define JNICALL
|
||||
#endif
|
||||
|
||||
#define PROTECT(thread, name) \
|
||||
Thread::SingleProtector MAKE_NAME(protector_) (thread, &name);
|
||||
|
@ -140,6 +140,28 @@ resolveNativeMethod(Thread* t, object method)
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
#ifdef __MINGW32__
|
||||
else {
|
||||
// on windows, we also try the _%s@%d variant, since the SWT
|
||||
// libraries use it.
|
||||
|
||||
unsigned footprint = methodParameterFootprint(t, method) + 1;
|
||||
if (methodFlags(t, method) & ACC_STATIC) {
|
||||
++ footprint;
|
||||
}
|
||||
|
||||
unsigned size = byteArrayLength(t, methodCode(t, method)) + 5;
|
||||
char buffer[size];
|
||||
snprintf(buffer, size, "_%s@%d",
|
||||
&byteArrayBody(t, methodCode(t, method), 0),
|
||||
footprint * BytesPerWord);
|
||||
|
||||
p = lib->resolve(buffer);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
24
src/x86.S
24
src/x86.S
@ -4,8 +4,8 @@
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
.globl amd64Call
|
||||
amd64Call:
|
||||
.globl vmNativeCall
|
||||
vmNativeCall:
|
||||
pushq %rbp
|
||||
|
||||
// %rdi aka 0(%rbp): function
|
||||
@ -104,14 +104,14 @@ exit:
|
||||
ret
|
||||
|
||||
#elif defined __i386__
|
||||
|
||||
#if defined __APPLE__ || defined __MINGW32__
|
||||
.globl _cdeclCall
|
||||
_cdeclCall:
|
||||
#else
|
||||
.globl cdeclCall
|
||||
cdeclCall:
|
||||
#endif
|
||||
|
||||
# if defined __APPLE__ || defined __MINGW32__
|
||||
.globl _vmNativeCall
|
||||
_vmNativeCall:
|
||||
# else
|
||||
.globl vmNativeCall
|
||||
vmNativeCall:
|
||||
# endif
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
|
||||
@ -125,10 +125,10 @@ cdeclCall:
|
||||
|
||||
subl %ecx,%esp
|
||||
|
||||
#ifdef __APPLE__
|
||||
# ifdef __APPLE__
|
||||
// align to a 16 byte boundary on Darwin
|
||||
andl $0xFFFFFFF0,%esp
|
||||
#endif
|
||||
# endif
|
||||
|
||||
// copy arguments into place
|
||||
movl $0,%ecx
|
||||
|
15
src/x86.h
15
src/x86.h
@ -7,8 +7,8 @@
|
||||
#ifdef __i386__
|
||||
|
||||
extern "C" uint64_t
|
||||
cdeclCall(void* function, void* stack, unsigned stackSize,
|
||||
unsigned returnType);
|
||||
vmNativeCall(void* function, void* stack, unsigned stackSize,
|
||||
unsigned returnType);
|
||||
|
||||
namespace vm {
|
||||
|
||||
@ -16,7 +16,7 @@ inline uint64_t
|
||||
dynamicCall(void* function, uintptr_t* arguments, uint8_t*,
|
||||
unsigned, unsigned argumentsSize, unsigned returnType)
|
||||
{
|
||||
return cdeclCall(function, arguments, argumentsSize, returnType);
|
||||
return vmNativeCall(function, arguments, argumentsSize, returnType);
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
@ -24,8 +24,8 @@ dynamicCall(void* function, uintptr_t* arguments, uint8_t*,
|
||||
#elif defined __x86_64__
|
||||
|
||||
extern "C" uint64_t
|
||||
amd64Call(void* function, void* stack, unsigned stackSize,
|
||||
void* gprTable, void* sseTable, unsigned returnType);
|
||||
vmNativeCall(void* function, void* stack, unsigned stackSize,
|
||||
void* gprTable, void* sseTable, unsigned returnType);
|
||||
|
||||
namespace vm {
|
||||
|
||||
@ -65,8 +65,9 @@ dynamicCall(void* function, uint64_t* arguments, uint8_t* argumentTypes,
|
||||
}
|
||||
}
|
||||
|
||||
return amd64Call(function, stack, stackIndex * 8, (gprIndex ? gprTable : 0),
|
||||
(sseIndex ? sseTable : 0), returnType);
|
||||
return vmNativeCall(function, stack, stackIndex * 8,
|
||||
(gprIndex ? gprTable : 0),
|
||||
(sseIndex ? sseTable : 0), returnType);
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
|
Loading…
Reference in New Issue
Block a user