mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
fix iinc instruction to use set() instead of direct assignment; add Thread::HeapSizeInWords and Thread::StackSizeInWords
This commit is contained in:
parent
3a6da507ec
commit
4d202e4945
@ -18,7 +18,7 @@ const unsigned MinimumGen2SizeInBytes = 128 * 1024;
|
|||||||
const unsigned Top = ~static_cast<unsigned>(0);
|
const unsigned Top = ~static_cast<unsigned>(0);
|
||||||
|
|
||||||
const bool Verbose = true;
|
const bool Verbose = true;
|
||||||
const bool Debug = true;
|
const bool Debug = false;
|
||||||
|
|
||||||
class Context;
|
class Context;
|
||||||
|
|
||||||
|
17
src/vm.cpp
17
src/vm.cpp
@ -94,6 +94,9 @@ class Thread {
|
|||||||
static const unsigned HeapSizeInBytes = 64 * 1024;
|
static const unsigned HeapSizeInBytes = 64 * 1024;
|
||||||
static const unsigned StackSizeInBytes = 64 * 1024;
|
static const unsigned StackSizeInBytes = 64 * 1024;
|
||||||
|
|
||||||
|
static const unsigned HeapSizeInWords = HeapSizeInBytes / BytesPerWord;
|
||||||
|
static const unsigned StackSizeInWords = StackSizeInBytes / BytesPerWord;
|
||||||
|
|
||||||
Thread(Machine* m);
|
Thread(Machine* m);
|
||||||
|
|
||||||
Machine* vm;
|
Machine* vm;
|
||||||
@ -107,8 +110,8 @@ class Thread {
|
|||||||
unsigned ip;
|
unsigned ip;
|
||||||
unsigned sp;
|
unsigned sp;
|
||||||
unsigned heapIndex;
|
unsigned heapIndex;
|
||||||
object stack[StackSizeInBytes / BytesPerWord];
|
object stack[StackSizeInWords];
|
||||||
object heap[HeapSizeInBytes / BytesPerWord];
|
object heap[HeapSizeInWords];
|
||||||
Protector* protector;
|
Protector* protector;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -466,7 +469,7 @@ maybeYieldAndMaybeCollect(Thread* t, unsigned sizeInBytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (t->heapIndex + divide(sizeInBytes, BytesPerWord)
|
if (t->heapIndex + divide(sizeInBytes, BytesPerWord)
|
||||||
>= (Thread::HeapSizeInBytes / BytesPerWord))
|
>= Thread::HeapSizeInWords)
|
||||||
{
|
{
|
||||||
enter(t, Thread::ExclusiveState);
|
enter(t, Thread::ExclusiveState);
|
||||||
collect(t->vm, Heap::MinorCollection);
|
collect(t->vm, Heap::MinorCollection);
|
||||||
@ -478,7 +481,7 @@ inline object
|
|||||||
allocate(Thread* t, unsigned sizeInBytes)
|
allocate(Thread* t, unsigned sizeInBytes)
|
||||||
{
|
{
|
||||||
if (UNLIKELY(t->heapIndex + divide(sizeInBytes, BytesPerWord)
|
if (UNLIKELY(t->heapIndex + divide(sizeInBytes, BytesPerWord)
|
||||||
>= (Thread::HeapSizeInBytes / BytesPerWord)
|
>= Thread::HeapSizeInWords
|
||||||
or t->vm->exclusive))
|
or t->vm->exclusive))
|
||||||
{
|
{
|
||||||
maybeYieldAndMaybeCollect(t, sizeInBytes);
|
maybeYieldAndMaybeCollect(t, sizeInBytes);
|
||||||
@ -2429,7 +2432,7 @@ run(Thread* t)
|
|||||||
int8_t c = codeBody(t, code, ip++);
|
int8_t c = codeBody(t, code, ip++);
|
||||||
|
|
||||||
int32_t v = intValue(t, frameLocals(t, frame, index));
|
int32_t v = intValue(t, frameLocals(t, frame, index));
|
||||||
frameLocals(t, frame, index) = makeInt(t, v + c);
|
set(t, frameLocals(t, frame, index), makeInt(t, v + c));
|
||||||
} goto loop;
|
} goto loop;
|
||||||
|
|
||||||
case imul: {
|
case imul: {
|
||||||
@ -3021,7 +3024,7 @@ run(Thread* t)
|
|||||||
uint16_t count = (count1 << 8) | count2;
|
uint16_t count = (count1 << 8) | count2;
|
||||||
|
|
||||||
int32_t v = intValue(t, frameLocals(t, frame, index));
|
int32_t v = intValue(t, frameLocals(t, frame, index));
|
||||||
frameLocals(t, frame, index) = makeInt(t, v + count);
|
set(t, frameLocals(t, frame, index), makeInt(t, v + count));
|
||||||
} goto loop;
|
} goto loop;
|
||||||
|
|
||||||
case ret: {
|
case ret: {
|
||||||
@ -3036,7 +3039,7 @@ run(Thread* t)
|
|||||||
|
|
||||||
invoke:
|
invoke:
|
||||||
if (UNLIKELY(codeMaxStack(t, methodCode(t, code)) + sp - parameterCount
|
if (UNLIKELY(codeMaxStack(t, methodCode(t, code)) + sp - parameterCount
|
||||||
> (Thread::StackSizeInBytes / BytesPerWord)))
|
> Thread::StackSizeInWords))
|
||||||
{
|
{
|
||||||
exception = makeStackOverflowError(t);
|
exception = makeStackOverflowError(t);
|
||||||
goto throw_;
|
goto throw_;
|
||||||
|
Loading…
Reference in New Issue
Block a user