mirror of
https://github.com/corda/corda.git
synced 2025-01-04 04:04:27 +00:00
SGX specific ifdefs
This commit is contained in:
parent
539af98836
commit
8a03bcee6a
@ -232,6 +232,8 @@ static inline void releaseChars(JNIEnv* e, jstring path, string_t chars)
|
|||||||
e->RELEASE_CHARS(path, chars);
|
e->RELEASE_CHARS(path, chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
|
|
||||||
extern "C" JNIEXPORT jstring JNICALL
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
Java_java_io_File_toCanonicalPath(JNIEnv* /*e*/, jclass, jstring path)
|
Java_java_io_File_toCanonicalPath(JNIEnv* /*e*/, jclass, jstring path)
|
||||||
{
|
{
|
||||||
@ -802,6 +804,8 @@ extern "C" JNIEXPORT jint JNICALL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !SGX
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_java_io_FileOutputStream_write__II(JNIEnv* e, jclass, jint fd, jint c)
|
Java_java_io_FileOutputStream_write__II(JNIEnv* e, jclass, jint fd, jint c)
|
||||||
{
|
{
|
||||||
@ -838,6 +842,8 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
doClose(e, fd);
|
doClose(e, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_java_io_RandomAccessFile_open(JNIEnv* e,
|
Java_java_io_RandomAccessFile_open(JNIEnv* e,
|
||||||
jclass,
|
jclass,
|
||||||
@ -1005,3 +1011,5 @@ extern "C" JNIEXPORT void JNICALL
|
|||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !SGX
|
@ -8,6 +8,8 @@
|
|||||||
There is NO WARRANTY for this software. See license.txt for
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
|
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "avian/machine.h"
|
#include "avian/machine.h"
|
||||||
#include "sockets.h"
|
#include "sockets.h"
|
||||||
@ -139,3 +141,5 @@ extern "C" JNIEXPORT jint JNICALL
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !SGX
|
@ -8,6 +8,8 @@
|
|||||||
There is NO WARRANTY for this software. See license.txt for
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -1096,3 +1098,5 @@ extern "C" JNIEXPORT jboolean JNICALL
|
|||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !SGX
|
@ -13,6 +13,8 @@
|
|||||||
* It is used from different classes of the default Avian classpath
|
* It is used from different classes of the default Avian classpath
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
|
|
||||||
#include "sockets.h"
|
#include "sockets.h"
|
||||||
|
|
||||||
namespace avian {
|
namespace avian {
|
||||||
@ -199,3 +201,5 @@ void close_output(JNIEnv* e, SOCKET sock)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
4
makefile
4
makefile
@ -524,6 +524,10 @@ build-system = posix
|
|||||||
system = posix
|
system = posix
|
||||||
asm = x86
|
asm = x86
|
||||||
|
|
||||||
|
ifeq ($(system),sgx)
|
||||||
|
cflags += -DSGX
|
||||||
|
endif
|
||||||
|
|
||||||
pointer-size = 8
|
pointer-size = 8
|
||||||
|
|
||||||
so-prefix = lib
|
so-prefix = lib
|
||||||
|
@ -1831,6 +1831,15 @@ inline uint64_t runThread(Thread* t, uintptr_t*)
|
|||||||
inline bool startThread(Thread* t, Thread* p)
|
inline bool startThread(Thread* t, Thread* p)
|
||||||
{
|
{
|
||||||
p->setFlag(Thread::JoinFlag);
|
p->setFlag(Thread::JoinFlag);
|
||||||
|
#ifdef SGX
|
||||||
|
static const char16_t *nameToSkip = u"Reference Handler";
|
||||||
|
if (p->javaThread->name()->length(t) == 17) {
|
||||||
|
if (!memcmp(nameToSkip, cast<GcCharArray>(t, p->javaThread->name()->data())->body().begin(), 17 * 2)) {
|
||||||
|
printf("Skipping start of reference handler thread\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return t->m->system->success(t->m->system->start(&(p->runnable)));
|
return t->m->system->success(t->m->system->start(&(p->runnable)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ jint JNICALL DetachCurrentThread(Machine* m)
|
|||||||
|
|
||||||
uint64_t destroyJavaVM(Thread* t, uintptr_t*)
|
uint64_t destroyJavaVM(Thread* t, uintptr_t*)
|
||||||
{
|
{
|
||||||
|
#ifndef SGX
|
||||||
// wait for other non-daemon threads to exit
|
// wait for other non-daemon threads to exit
|
||||||
{
|
{
|
||||||
ACQUIRE(t, t->m->stateLock);
|
ACQUIRE(t, t->m->stateLock);
|
||||||
@ -77,13 +78,13 @@ uint64_t destroyJavaVM(Thread* t, uintptr_t*)
|
|||||||
t->m->stateLock->wait(t->systemThread, 0);
|
t->m->stateLock->wait(t->systemThread, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
t->m->classpath->shutDown(t);
|
t->m->classpath->shutDown(t);
|
||||||
}
|
}
|
||||||
|
#ifndef SGX
|
||||||
// wait again in case the Classpath::shutDown process started new
|
// wait again in case the Classpath::shutDown process started new
|
||||||
// threads:
|
// threads:
|
||||||
{
|
{
|
||||||
@ -94,7 +95,7 @@ uint64_t destroyJavaVM(Thread* t, uintptr_t*)
|
|||||||
|
|
||||||
enter(t, Thread::ExclusiveState);
|
enter(t, Thread::ExclusiveState);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
shutDown(t);
|
shutDown(t);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -3349,11 +3350,12 @@ uint64_t boot(Thread* t, uintptr_t*)
|
|||||||
|
|
||||||
t->javaThread->peer() = reinterpret_cast<jlong>(t);
|
t->javaThread->peer() = reinterpret_cast<jlong>(t);
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
GcThread* jthread = t->m->classpath->makeThread(t, t);
|
GcThread* jthread = t->m->classpath->makeThread(t, t);
|
||||||
// sequence point, for gc (don't recombine statements)
|
// sequence point, for gc (don't recombine statements)
|
||||||
roots(t)->setFinalizerThread(t, jthread);
|
roots(t)->setFinalizerThread(t, jthread);
|
||||||
|
|
||||||
roots(t)->finalizerThread()->daemon() = true;
|
roots(t)->finalizerThread()->daemon() = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
t->m->classpath->boot(t);
|
t->m->classpath->boot(t);
|
||||||
|
|
||||||
|
@ -3541,6 +3541,7 @@ void doCollect(Thread* t, Heap::CollectionType type, int pendingAllocation)
|
|||||||
function(t, finalizeQueue->target());
|
function(t, finalizeQueue->target());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SGX
|
||||||
if ((roots(t)->objectsToFinalize() or roots(t)->objectsToClean())
|
if ((roots(t)->objectsToFinalize() or roots(t)->objectsToClean())
|
||||||
and m->finalizeThread == 0 and t->state != Thread::ExitState) {
|
and m->finalizeThread == 0 and t->state != Thread::ExitState) {
|
||||||
m->finalizeThread = m->processor->makeThread(
|
m->finalizeThread = m->processor->makeThread(
|
||||||
@ -3553,6 +3554,7 @@ void doCollect(Thread* t, Heap::CollectionType type, int pendingAllocation)
|
|||||||
m->finalizeThread = 0;
|
m->finalizeThread = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t invokeLoadClass(Thread* t, uintptr_t* arguments)
|
uint64_t invokeLoadClass(Thread* t, uintptr_t* arguments)
|
||||||
|
Loading…
Reference in New Issue
Block a user