mirror of
https://github.com/corda/corda.git
synced 2025-03-01 12:21:49 +00:00
Merge branch 'master' of oss.readytalk.com:/var/local/git/avian
This commit is contained in:
commit
71972fd1b5
@ -87,7 +87,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
|||||||
object method = tripleFirst(t, calls);
|
object method = tripleFirst(t, calls);
|
||||||
uintptr_t address;
|
uintptr_t address;
|
||||||
if (methodFlags(t, method) & ACC_NATIVE) {
|
if (methodFlags(t, method) & ACC_NATIVE) {
|
||||||
address = reinterpret_cast<uintptr_t>(code + image->nativeThunk);
|
address = reinterpret_cast<uintptr_t>(code + image->thunks.native.start);
|
||||||
} else {
|
} else {
|
||||||
address = methodCompiled(t, method);
|
address = methodCompiled(t, method);
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ main(int ac, const char** av)
|
|||||||
Processor* p = makeProcessor(s, h, false);
|
Processor* p = makeProcessor(s, h, false);
|
||||||
|
|
||||||
BootImage image;
|
BootImage image;
|
||||||
const unsigned CodeCapacity = 32 * 1024 * 1024;
|
const unsigned CodeCapacity = 16 * 1024 * 1024;
|
||||||
uint8_t* code = static_cast<uint8_t*>(h->allocate(CodeCapacity));
|
uint8_t* code = static_cast<uint8_t*>(h->allocate(CodeCapacity));
|
||||||
p->initialize(&image, code, CodeCapacity);
|
p->initialize(&image, code, CodeCapacity);
|
||||||
|
|
||||||
|
@ -24,6 +24,30 @@ const unsigned BootHeapOffset = 1 << (BootShift + 1);
|
|||||||
|
|
||||||
class BootImage {
|
class BootImage {
|
||||||
public:
|
public:
|
||||||
|
class Thunk {
|
||||||
|
public:
|
||||||
|
Thunk():
|
||||||
|
start(0), frameSavedOffset(0), length(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
Thunk(unsigned start, unsigned frameSavedOffset, unsigned length):
|
||||||
|
start(start), frameSavedOffset(frameSavedOffset), length(length)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
unsigned start;
|
||||||
|
unsigned frameSavedOffset;
|
||||||
|
unsigned length;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ThunkCollection {
|
||||||
|
public:
|
||||||
|
Thunk default_;
|
||||||
|
Thunk defaultVirtual;
|
||||||
|
Thunk native;
|
||||||
|
Thunk aioob;
|
||||||
|
Thunk table;
|
||||||
|
};
|
||||||
|
|
||||||
static const unsigned Magic = 0x22377322;
|
static const unsigned Magic = 0x22377322;
|
||||||
|
|
||||||
unsigned magic;
|
unsigned magic;
|
||||||
@ -43,13 +67,7 @@ class BootImage {
|
|||||||
|
|
||||||
uintptr_t codeBase;
|
uintptr_t codeBase;
|
||||||
|
|
||||||
unsigned defaultThunk;
|
ThunkCollection thunks;
|
||||||
unsigned defaultVirtualThunk;
|
|
||||||
unsigned nativeThunk;
|
|
||||||
unsigned aioobThunk;
|
|
||||||
|
|
||||||
unsigned thunkTable;
|
|
||||||
unsigned thunkSize;
|
|
||||||
|
|
||||||
unsigned compileMethodCall;
|
unsigned compileMethodCall;
|
||||||
unsigned compileVirtualMethodCall;
|
unsigned compileVirtualMethodCall;
|
||||||
|
@ -24,11 +24,12 @@
|
|||||||
# define GLOBAL(x) x
|
# define GLOBAL(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define THREAD_CONTINUATION 112
|
#define THREAD_STACK 2152
|
||||||
|
#define THREAD_CONTINUATION 2156
|
||||||
#define THREAD_EXCEPTION 44
|
#define THREAD_EXCEPTION 44
|
||||||
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 116
|
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 2160
|
||||||
#define THREAD_EXCEPTION_OFFSET 120
|
#define THREAD_EXCEPTION_OFFSET 2164
|
||||||
#define THREAD_EXCEPTION_HANDLER 124
|
#define THREAD_EXCEPTION_HANDLER 2168
|
||||||
|
|
||||||
#define CONTINUATION_NEXT 4
|
#define CONTINUATION_NEXT 4
|
||||||
#define CONTINUATION_ADDRESS 16
|
#define CONTINUATION_ADDRESS 16
|
||||||
@ -103,10 +104,22 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
mtctr r4
|
mtctr r4
|
||||||
bctrl
|
bctrl
|
||||||
|
|
||||||
LOCAL(vmInvoke_returnAddress):
|
.globl GLOBAL(vmInvoke_returnAddress)
|
||||||
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
lwz r1,0(r1)
|
lwz r1,0(r1)
|
||||||
|
|
||||||
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
|
// any point in its execution.
|
||||||
|
li r5,0
|
||||||
|
stw r5,THREAD_STACK(r13)
|
||||||
|
|
||||||
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
|
GLOBAL(vmInvoke_safeStack):
|
||||||
|
|
||||||
#ifdef AVIAN_CONTINUATIONS
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
// call the next continuation, if any
|
// call the next continuation, if any
|
||||||
lwz r5,THREAD_CONTINUATION(r13)
|
lwz r5,THREAD_CONTINUATION(r13)
|
||||||
@ -138,7 +151,7 @@ LOCAL(vmInvoke_continuationTest):
|
|||||||
|
|
||||||
LOCAL(vmInvoke_getPC):
|
LOCAL(vmInvoke_getPC):
|
||||||
mflr r10
|
mflr r10
|
||||||
la r10,lo16(LOCAL(vmInvoke_returnAddress)-LOCAL(vmInvoke_getPC))(r10)
|
la r10,lo16(GLOBAL(vmInvoke_returnAddress)-LOCAL(vmInvoke_getPC))(r10)
|
||||||
stwx r10,r1,r7
|
stwx r10,r1,r7
|
||||||
|
|
||||||
lwz r7,CONTINUATION_FRAME_POINTER_OFFSET(r5)
|
lwz r7,CONTINUATION_FRAME_POINTER_OFFSET(r5)
|
||||||
@ -271,7 +284,7 @@ LOCAL(vmJumpAndInvoke_argumentTest):
|
|||||||
|
|
||||||
LOCAL(vmJumpAndInvoke_getPC):
|
LOCAL(vmJumpAndInvoke_getPC):
|
||||||
mflr r10
|
mflr r10
|
||||||
la r10,lo16(LOCAL(vmInvoke_returnAddress)-LOCAL(vmJumpAndInvoke_getPC))(r10)
|
la r10,lo16(GLOBAL(vmInvoke_returnAddress)-LOCAL(vmJumpAndInvoke_getPC))(r10)
|
||||||
mtlr r10
|
mtlr r10
|
||||||
|
|
||||||
mtctr r4
|
mtctr r4
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
|
#define THREAD_STACK 2216
|
||||||
|
|
||||||
#if defined __MINGW32__ || defined __CYGWIN32__
|
#if defined __MINGW32__ || defined __CYGWIN32__
|
||||||
|
|
||||||
#define CALLEE_SAVED_REGISTER_FOOTPRINT 64
|
#define CALLEE_SAVED_REGISTER_FOOTPRINT 64
|
||||||
@ -79,6 +81,16 @@ GLOBAL(vmInvoke_returnAddress):
|
|||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
movq %rbp,%rsp
|
movq %rbp,%rsp
|
||||||
|
|
||||||
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
|
// any point in its execution.
|
||||||
|
movq $0,THREAD_STACK(%rbx)
|
||||||
|
|
||||||
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
|
GLOBAL(vmInvoke_safeStack):
|
||||||
|
|
||||||
#ifdef AVIAN_CONTINUATIONS
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
# include "continuations-x86.S"
|
# include "continuations-x86.S"
|
||||||
#endif // AVIAN_CONTINUATIONS
|
#endif // AVIAN_CONTINUATIONS
|
||||||
@ -208,6 +220,16 @@ GLOBAL(vmInvoke_returnAddress):
|
|||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
movq %rbp,%rsp
|
movq %rbp,%rsp
|
||||||
|
|
||||||
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
|
// any point in its execution.
|
||||||
|
movq $0,THREAD_STACK(%rbx)
|
||||||
|
|
||||||
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
|
GLOBAL(vmInvoke_safeStack):
|
||||||
|
|
||||||
#ifdef AVIAN_CONTINUATIONS
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
# include "continuations-x86.S"
|
# include "continuations-x86.S"
|
||||||
#endif // AVIAN_CONTINUATIONS
|
#endif // AVIAN_CONTINUATIONS
|
||||||
@ -283,6 +305,8 @@ LOCAL(vmJumpAndInvoke_argumentTest):
|
|||||||
|
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
|
|
||||||
|
#define THREAD_STACK 2144
|
||||||
|
|
||||||
#define CALLEE_SAVED_REGISTER_FOOTPRINT 16
|
#define CALLEE_SAVED_REGISTER_FOOTPRINT 16
|
||||||
|
|
||||||
.globl GLOBAL(vmInvoke)
|
.globl GLOBAL(vmInvoke)
|
||||||
@ -329,14 +353,24 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
// call function
|
// call function
|
||||||
call *12(%ebp)
|
call *12(%ebp)
|
||||||
|
|
||||||
.globl vmInvoke_returnAddress
|
.globl GLOBAL(vmInvoke_returnAddress)
|
||||||
vmInvoke_returnAddress:
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer, preserving the area containing saved
|
// restore stack pointer, preserving the area containing saved
|
||||||
// registers
|
// registers
|
||||||
movl %ebp,%ecx
|
movl %ebp,%ecx
|
||||||
subl $CALLEE_SAVED_REGISTER_FOOTPRINT,%ecx
|
subl $CALLEE_SAVED_REGISTER_FOOTPRINT,%ecx
|
||||||
movl %ecx,%esp
|
movl %ecx,%esp
|
||||||
|
|
||||||
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
|
// any point in its execution.
|
||||||
|
movl $0,THREAD_STACK(%ebx)
|
||||||
|
|
||||||
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
|
GLOBAL(vmInvoke_safeStack):
|
||||||
|
|
||||||
#ifdef AVIAN_CONTINUATIONS
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
# include "continuations-x86.S"
|
# include "continuations-x86.S"
|
||||||
#endif // AVIAN_CONTINUATIONS
|
#endif // AVIAN_CONTINUATIONS
|
||||||
@ -397,15 +431,15 @@ GLOBAL(vmJumpAndInvoke):
|
|||||||
|
|
||||||
// set return address
|
// set return address
|
||||||
#if defined __MINGW32__ || defined __CYGWIN32__
|
#if defined __MINGW32__ || defined __CYGWIN32__
|
||||||
movl $vmInvoke_returnAddress,%esi
|
movl $GLOBAL(vmInvoke_returnAddress),%esi
|
||||||
#else
|
#else
|
||||||
call LOCAL(getPC)
|
call LOCAL(getPC)
|
||||||
# if defined __APPLE__
|
# if defined __APPLE__
|
||||||
LOCAL(vmJumpAndInvoke_offset):
|
LOCAL(vmJumpAndInvoke_offset):
|
||||||
leal vmInvoke_returnAddress-LOCAL(vmJumpAndInvoke_offset)(%esi),%esi
|
leal GLOBAL(vmInvoke_returnAddress)-LOCAL(vmJumpAndInvoke_offset)(%esi),%esi
|
||||||
# else
|
# else
|
||||||
addl $_GLOBAL_OFFSET_TABLE_,%esi
|
addl $_GLOBAL_OFFSET_TABLE_,%esi
|
||||||
movl vmInvoke_returnAddress@GOT(%esi),%esi
|
movl GLOBAL(vmInvoke_returnAddress)@GOT(%esi),%esi
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
movl %esi,(%ecx)
|
movl %esi,(%ecx)
|
||||||
|
652
src/compile.cpp
652
src/compile.cpp
File diff suppressed because it is too large
Load Diff
@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
#define THREAD_CONTINUATION 192
|
#define THREAD_CONTINUATION 2224
|
||||||
#define THREAD_EXCEPTION 80
|
#define THREAD_EXCEPTION 80
|
||||||
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 200
|
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 2232
|
||||||
#define THREAD_EXCEPTION_OFFSET 208
|
#define THREAD_EXCEPTION_OFFSET 2240
|
||||||
#define THREAD_EXCEPTION_HANDLER 216
|
#define THREAD_EXCEPTION_HANDLER 2248
|
||||||
|
|
||||||
#define CONTINUATION_NEXT 8
|
#define CONTINUATION_NEXT 8
|
||||||
#define CONTINUATION_ADDRESS 32
|
#define CONTINUATION_ADDRESS 32
|
||||||
@ -89,11 +89,11 @@ LOCAL(vmInvoke_exit):
|
|||||||
|
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
|
|
||||||
#define THREAD_CONTINUATION 108
|
#define THREAD_CONTINUATION 2148
|
||||||
#define THREAD_EXCEPTION 44
|
#define THREAD_EXCEPTION 44
|
||||||
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 112
|
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 2152
|
||||||
#define THREAD_EXCEPTION_OFFSET 116
|
#define THREAD_EXCEPTION_OFFSET 2156
|
||||||
#define THREAD_EXCEPTION_HANDLER 120
|
#define THREAD_EXCEPTION_HANDLER 2160
|
||||||
|
|
||||||
#define CONTINUATION_NEXT 4
|
#define CONTINUATION_NEXT 4
|
||||||
#define CONTINUATION_ADDRESS 16
|
#define CONTINUATION_ADDRESS 16
|
||||||
@ -138,15 +138,15 @@ LOCAL(vmInvoke_continuationTest):
|
|||||||
// set the return address to vmInvoke_returnAddress
|
// set the return address to vmInvoke_returnAddress
|
||||||
movl CONTINUATION_RETURN_ADDRESS_OFFSET(%ecx),%edi
|
movl CONTINUATION_RETURN_ADDRESS_OFFSET(%ecx),%edi
|
||||||
#if defined __MINGW32__ || defined __CYGWIN32__
|
#if defined __MINGW32__ || defined __CYGWIN32__
|
||||||
movl $vmInvoke_returnAddress,%esi
|
movl $GLOBAL(vmInvoke_returnAddress),%esi
|
||||||
#else
|
#else
|
||||||
call LOCAL(getPC)
|
call LOCAL(getPC)
|
||||||
# if defined __APPLE__
|
# if defined __APPLE__
|
||||||
LOCAL(vmInvoke_offset):
|
LOCAL(vmInvoke_offset):
|
||||||
leal vmInvoke_returnAddress-LOCAL(vmInvoke_offset)(%esi),%esi
|
leal GLOBAL(vmInvoke_returnAddress)-LOCAL(vmInvoke_offset)(%esi),%esi
|
||||||
# else
|
# else
|
||||||
addl $_GLOBAL_OFFSET_TABLE_,%esi
|
addl $_GLOBAL_OFFSET_TABLE_,%esi
|
||||||
movl vmInvoke_returnAddress@GOT(%esi),%esi
|
movl GLOBAL(vmInvoke_returnAddress)@GOT(%esi),%esi
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
movl %esi,(%esp,%edi,1)
|
movl %esi,(%esp,%edi,1)
|
||||||
|
@ -570,12 +570,11 @@ postCollect(Thread* t)
|
|||||||
t->heapOffset = 0;
|
t->heapOffset = 0;
|
||||||
t->heapIndex = 0;
|
t->heapIndex = 0;
|
||||||
|
|
||||||
if (t->backupHeap) {
|
if (t->useBackupHeap) {
|
||||||
t->m->heap->free
|
memset(t->backupHeap, 0, ThreadBackupHeapSizeInBytes);
|
||||||
(t->backupHeap, t->backupHeapSizeInWords * BytesPerWord);
|
|
||||||
t->backupHeap = 0;
|
t->useBackupHeap = false;
|
||||||
t->backupHeapIndex = 0;
|
t->backupHeapIndex = 0;
|
||||||
t->backupHeapSizeInWords = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Thread* c = t->child; c; c = c->peer) {
|
for (Thread* c = t->child; c; c = c->peer) {
|
||||||
@ -1978,7 +1977,6 @@ boot(Thread* t)
|
|||||||
m->bootstrapClassMap = makeHashMap(t, 0, 0);
|
m->bootstrapClassMap = makeHashMap(t, 0, 0);
|
||||||
|
|
||||||
m->stringMap = makeWeakHashMap(t, 0, 0);
|
m->stringMap = makeWeakHashMap(t, 0, 0);
|
||||||
|
|
||||||
m->processor->boot(t, 0);
|
m->processor->boot(t, 0);
|
||||||
|
|
||||||
{ object bootCode = makeCode(t, 0, 0, 0, 0, 0, 1);
|
{ object bootCode = makeCode(t, 0, 0, 0, 0, 0, 1);
|
||||||
@ -2123,6 +2121,8 @@ Machine::Machine(System* system, Heap* heap, Finder* finder,
|
|||||||
tenuredWeakReferences(0),
|
tenuredWeakReferences(0),
|
||||||
shutdownHooks(0),
|
shutdownHooks(0),
|
||||||
objectsToFinalize(0),
|
objectsToFinalize(0),
|
||||||
|
nullPointerException(0),
|
||||||
|
arrayIndexOutOfBoundsException(0),
|
||||||
unsafe(false),
|
unsafe(false),
|
||||||
triedBuiltinOnLoad(false),
|
triedBuiltinOnLoad(false),
|
||||||
heapPoolIndex(0)
|
heapPoolIndex(0)
|
||||||
@ -2196,9 +2196,8 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
|
|||||||
defaultHeap(static_cast<uintptr_t*>
|
defaultHeap(static_cast<uintptr_t*>
|
||||||
(m->heap->allocate(ThreadHeapSizeInBytes))),
|
(m->heap->allocate(ThreadHeapSizeInBytes))),
|
||||||
heap(defaultHeap),
|
heap(defaultHeap),
|
||||||
backupHeap(0),
|
|
||||||
backupHeapIndex(0),
|
backupHeapIndex(0),
|
||||||
backupHeapSizeInWords(0),
|
useBackupHeap(false),
|
||||||
waiting(false),
|
waiting(false),
|
||||||
tracing(false)
|
tracing(false)
|
||||||
#ifdef VM_STRESS
|
#ifdef VM_STRESS
|
||||||
@ -2210,6 +2209,7 @@ void
|
|||||||
Thread::init()
|
Thread::init()
|
||||||
{
|
{
|
||||||
memset(defaultHeap, 0, ThreadHeapSizeInBytes);
|
memset(defaultHeap, 0, ThreadHeapSizeInBytes);
|
||||||
|
memset(backupHeap, 0, ThreadBackupHeapSizeInBytes);
|
||||||
|
|
||||||
if (parent == 0) {
|
if (parent == 0) {
|
||||||
assert(this, m->rootThread == 0);
|
assert(this, m->rootThread == 0);
|
||||||
@ -2248,6 +2248,11 @@ Thread::init()
|
|||||||
|
|
||||||
m->jniMethodTable = makeVector(this, 0, 0);
|
m->jniMethodTable = makeVector(this, 0, 0);
|
||||||
|
|
||||||
|
m->nullPointerException = makeNullPointerException(this);
|
||||||
|
|
||||||
|
m->arrayIndexOutOfBoundsException
|
||||||
|
= makeArrayIndexOutOfBoundsException(this, 0);
|
||||||
|
|
||||||
m->localThread->set(this);
|
m->localThread->set(this);
|
||||||
} else {
|
} else {
|
||||||
peer = parent->child;
|
peer = parent->child;
|
||||||
@ -2539,15 +2544,15 @@ object
|
|||||||
allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type,
|
allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type,
|
||||||
unsigned sizeInBytes, bool objectMask)
|
unsigned sizeInBytes, bool objectMask)
|
||||||
{
|
{
|
||||||
if (t->backupHeap) {
|
if (UNLIKELY(t->useBackupHeap)) {
|
||||||
expect(t, t->backupHeapIndex + ceiling(sizeInBytes, BytesPerWord)
|
expect(t, t->backupHeapIndex + ceiling(sizeInBytes, BytesPerWord)
|
||||||
<= t->backupHeapSizeInWords);
|
<= ThreadBackupHeapSizeInWords);
|
||||||
|
|
||||||
object o = reinterpret_cast<object>(t->backupHeap + t->backupHeapIndex);
|
object o = reinterpret_cast<object>(t->backupHeap + t->backupHeapIndex);
|
||||||
t->backupHeapIndex += ceiling(sizeInBytes, BytesPerWord);
|
t->backupHeapIndex += ceiling(sizeInBytes, BytesPerWord);
|
||||||
cast<object>(o, 0) = 0;
|
cast<object>(o, 0) = 0;
|
||||||
return o;
|
return o;
|
||||||
} else if (t->tracing) {
|
} else if (UNLIKELY(t->tracing)) {
|
||||||
expect(t, t->heapIndex + ceiling(sizeInBytes, BytesPerWord)
|
expect(t, t->heapIndex + ceiling(sizeInBytes, BytesPerWord)
|
||||||
<= ThreadHeapSizeInWords);
|
<= ThreadHeapSizeInWords);
|
||||||
return allocateSmall(t, sizeInBytes);
|
return allocateSmall(t, sizeInBytes);
|
||||||
@ -3676,6 +3681,8 @@ visitRoots(Machine* m, Heap::Visitor* v)
|
|||||||
v->visit(&(m->jniMethodTable));
|
v->visit(&(m->jniMethodTable));
|
||||||
v->visit(&(m->shutdownHooks));
|
v->visit(&(m->shutdownHooks));
|
||||||
v->visit(&(m->objectsToFinalize));
|
v->visit(&(m->objectsToFinalize));
|
||||||
|
v->visit(&(m->nullPointerException));
|
||||||
|
v->visit(&(m->arrayIndexOutOfBoundsException));
|
||||||
|
|
||||||
for (Thread* t = m->rootThread; t; t = t->peer) {
|
for (Thread* t = m->rootThread; t; t = t->peer) {
|
||||||
::visitRoots(t, v);
|
::visitRoots(t, v);
|
||||||
|
@ -49,6 +49,10 @@ const uintptr_t FixedMark = 3;
|
|||||||
const unsigned ThreadHeapSizeInBytes = 64 * 1024;
|
const unsigned ThreadHeapSizeInBytes = 64 * 1024;
|
||||||
const unsigned ThreadHeapSizeInWords = ThreadHeapSizeInBytes / BytesPerWord;
|
const unsigned ThreadHeapSizeInWords = ThreadHeapSizeInBytes / BytesPerWord;
|
||||||
|
|
||||||
|
const unsigned ThreadBackupHeapSizeInBytes = 2 * 1024;
|
||||||
|
const unsigned ThreadBackupHeapSizeInWords
|
||||||
|
= ThreadBackupHeapSizeInBytes / BytesPerWord;
|
||||||
|
|
||||||
const unsigned ThreadHeapPoolSize = 64;
|
const unsigned ThreadHeapPoolSize = 64;
|
||||||
|
|
||||||
const unsigned FixedFootprintThresholdInBytes
|
const unsigned FixedFootprintThresholdInBytes
|
||||||
@ -1207,6 +1211,8 @@ class Machine {
|
|||||||
object tenuredWeakReferences;
|
object tenuredWeakReferences;
|
||||||
object shutdownHooks;
|
object shutdownHooks;
|
||||||
object objectsToFinalize;
|
object objectsToFinalize;
|
||||||
|
object nullPointerException;
|
||||||
|
object arrayIndexOutOfBoundsException;
|
||||||
bool unsafe;
|
bool unsafe;
|
||||||
bool triedBuiltinOnLoad;
|
bool triedBuiltinOnLoad;
|
||||||
JavaVMVTable javaVMVTable;
|
JavaVMVTable javaVMVTable;
|
||||||
@ -1360,9 +1366,9 @@ class Thread {
|
|||||||
Runnable runnable;
|
Runnable runnable;
|
||||||
uintptr_t* defaultHeap;
|
uintptr_t* defaultHeap;
|
||||||
uintptr_t* heap;
|
uintptr_t* heap;
|
||||||
uintptr_t* backupHeap;
|
uintptr_t backupHeap[ThreadBackupHeapSizeInWords];
|
||||||
unsigned backupHeapIndex;
|
unsigned backupHeapIndex;
|
||||||
unsigned backupHeapSizeInWords;
|
bool useBackupHeap;
|
||||||
bool waiting;
|
bool waiting;
|
||||||
bool tracing;
|
bool tracing;
|
||||||
#ifdef VM_STRESS
|
#ifdef VM_STRESS
|
||||||
@ -1550,20 +1556,23 @@ class FixedAllocator: public Allocator {
|
|||||||
unsigned capacity;
|
unsigned capacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void
|
inline bool
|
||||||
ensure(Thread* t, unsigned sizeInBytes)
|
ensure(Thread* t, unsigned sizeInBytes)
|
||||||
{
|
{
|
||||||
if (t->heapIndex + ceiling(sizeInBytes, BytesPerWord)
|
if (t->heapIndex + ceiling(sizeInBytes, BytesPerWord)
|
||||||
> ThreadHeapSizeInWords)
|
> ThreadHeapSizeInWords)
|
||||||
{
|
{
|
||||||
expect(t, t->backupHeap == 0);
|
if (sizeInBytes <= ThreadBackupHeapSizeInBytes) {
|
||||||
t->backupHeap = static_cast<uintptr_t*>
|
expect(t, not t->useBackupHeap);
|
||||||
(t->m->heap->allocate(pad(sizeInBytes)));
|
|
||||||
|
|
||||||
memset(t->backupHeap, 0, sizeInBytes);
|
t->useBackupHeap = true;
|
||||||
|
|
||||||
t->backupHeapIndex = 0;
|
return true;
|
||||||
t->backupHeapSizeInWords = ceiling(sizeInBytes, BytesPerWord);
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2421,7 +2421,7 @@ class MyAssembler: public Assembler {
|
|||||||
|
|
||||||
for (ConstantPoolEntry* e = c.constantPool; e; e = e->next) {
|
for (ConstantPoolEntry* e = c.constantPool; e; e = e->next) {
|
||||||
*static_cast<uint32_t*>(e->address) = e->constant->value();
|
*static_cast<uint32_t*>(e->address) = e->constant->value();
|
||||||
fprintf(stderr, "constant %p at %p\n", reinterpret_cast<void*>(e->constant->value()), e->address);
|
// fprintf(stderr, "constant %p at %p\n", reinterpret_cast<void*>(e->constant->value()), e->address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user