mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
snapshot
This commit is contained in:
parent
65f9f3583c
commit
23043d140f
@ -161,6 +161,8 @@ class Assembler {
|
|||||||
virtual unsigned argumentRegisterCount() = 0;
|
virtual unsigned argumentRegisterCount() = 0;
|
||||||
virtual int argumentRegister(unsigned index) = 0;
|
virtual int argumentRegister(unsigned index) = 0;
|
||||||
|
|
||||||
|
virtual unsigned stackAlignment() = 0;
|
||||||
|
|
||||||
virtual void plan(UnaryOperation op, unsigned size, uint8_t* typeMask,
|
virtual void plan(UnaryOperation op, unsigned size, uint8_t* typeMask,
|
||||||
uint64_t* registerMask, bool* thunk) = 0;
|
uint64_t* registerMask, bool* thunk) = 0;
|
||||||
|
|
||||||
|
@ -60,12 +60,6 @@
|
|||||||
# define SO_SUFFIX ".so"
|
# define SO_SUFFIX ".so"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined __APPLE__) && (defined __i386__)
|
|
||||||
# define FORCE_ALIGN __attribute__((force_align_arg_pointer))
|
|
||||||
#else
|
|
||||||
# define FORCE_ALIGN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NO_RETURN __attribute__((noreturn))
|
#define NO_RETURN __attribute__((noreturn))
|
||||||
|
|
||||||
#define LIKELY(v) __builtin_expect((v) != 0, true)
|
#define LIKELY(v) __builtin_expect((v) != 0, true)
|
||||||
|
373
src/compile.cpp
373
src/compile.cpp
@ -386,6 +386,8 @@ class TraceElement: public TraceHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum Event {
|
enum Event {
|
||||||
|
PushContextEvent,
|
||||||
|
PopContextEvent,
|
||||||
PushEvent,
|
PushEvent,
|
||||||
PopEvent,
|
PopEvent,
|
||||||
IpEvent,
|
IpEvent,
|
||||||
@ -407,15 +409,16 @@ localSize(MyThread* t, object method)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
frameSize(MyThread* t, object method)
|
alignedFrameSize(MyThread* t, object method)
|
||||||
{
|
{
|
||||||
return localSize(t, method) + codeMaxStack(t, methodCode(t, method));
|
return Assembler::alignFrameSize
|
||||||
|
(localSize(t, method) + codeMaxStack(t, methodCode(t, method)));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
frameMapSizeInWords(MyThread* t, object method)
|
frameMapSizeInWords(MyThread* t, object method)
|
||||||
{
|
{
|
||||||
return ceiling(frameSize(t, method), BitsPerWord) * BytesPerWord;
|
return ceiling(alignedFrameSize(t, method), BitsPerWord) * BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t*
|
uint16_t*
|
||||||
@ -591,7 +594,7 @@ class Frame {
|
|||||||
(t, methodCode(t, context->method)));
|
(t, methodCode(t, context->method)));
|
||||||
|
|
||||||
if (level > 1) {
|
if (level > 1) {
|
||||||
context->eventLog.append(PushEvent);
|
context->eventLog.append(PushContextEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +607,7 @@ class Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (level > 1) {
|
if (level > 1) {
|
||||||
context->eventLog.append(PopEvent);
|
context->eventLog.append(PopContextEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -830,54 +833,82 @@ class Frame {
|
|||||||
this->ip = ip;
|
this->ip = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pushQuiet(unsigned size, Compiler::Operand* o) {
|
||||||
|
if (size == 8 and BytesPerWord == 8) {
|
||||||
|
c->push(8);
|
||||||
|
|
||||||
|
context->eventLog.append(PushEvent);
|
||||||
|
context->eventLog.appendAddress(c->top());
|
||||||
|
}
|
||||||
|
|
||||||
|
c->push(size, o);
|
||||||
|
|
||||||
|
context->eventLog.append(PushEvent);
|
||||||
|
context->eventLog.appendAddress(c->top());
|
||||||
|
}
|
||||||
|
|
||||||
|
Compiler::Operand* popQuiet(unsigned size) {
|
||||||
|
context->eventLog.append(PopEvent);
|
||||||
|
context->eventLog.appendAddress(c->top());
|
||||||
|
|
||||||
|
Compiler::Operand* r = c->pop(8);
|
||||||
|
|
||||||
|
if (size == 8 and BytesPerWord == 8) {
|
||||||
|
context->eventLog.append(PopEvent);
|
||||||
|
context->eventLog.appendAddress(c->top());
|
||||||
|
|
||||||
|
c->pop(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
void pushInt(Compiler::Operand* o) {
|
void pushInt(Compiler::Operand* o) {
|
||||||
c->push(4, o);
|
pushQuiet(4, o);
|
||||||
pushedInt();
|
pushedInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushAddress(Compiler::Operand* o) {
|
void pushAddress(Compiler::Operand* o) {
|
||||||
c->push(BytesPerWord, o);
|
pushQuiet(BytesPerWord, o);
|
||||||
pushedInt();
|
pushedInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushObject(Compiler::Operand* o) {
|
void pushObject(Compiler::Operand* o) {
|
||||||
c->push(BytesPerWord, o);
|
pushQuiet(BytesPerWord, o);
|
||||||
pushedObject();
|
pushedObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushObject() {
|
void pushObject() {
|
||||||
c->pushed(1);
|
c->pushed();
|
||||||
|
|
||||||
|
context->eventLog.append(PushEvent);
|
||||||
|
context->eventLog.appendAddress(c->top());
|
||||||
|
|
||||||
pushedObject();
|
pushedObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushLongQuiet(Compiler::Operand* o) {
|
|
||||||
if (BytesPerWord == 8) {
|
|
||||||
c->push(8);
|
|
||||||
}
|
|
||||||
c->push(8, o);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pushLong(Compiler::Operand* o) {
|
void pushLong(Compiler::Operand* o) {
|
||||||
pushLongQuiet(o);
|
pushQuiet(8, o);
|
||||||
pushedLong();
|
pushedLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop(unsigned count) {
|
void pop(unsigned count) {
|
||||||
popped(count);
|
popped(count);
|
||||||
c->popped(count);
|
|
||||||
|
for (unsigned i = count; i;) {
|
||||||
|
Compiler::StackElement* s = c->top();
|
||||||
|
|
||||||
|
context->eventLog.append(PopEvent);
|
||||||
|
context->eventLog.appendAddress(s);
|
||||||
|
|
||||||
|
c->popped();
|
||||||
|
i -= c->size(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Compiler::Operand* popInt() {
|
Compiler::Operand* popInt() {
|
||||||
poppedInt();
|
poppedInt();
|
||||||
return c->pop(4);
|
return popQuiet(4);
|
||||||
}
|
|
||||||
|
|
||||||
Compiler::Operand* popLongQuiet() {
|
|
||||||
Compiler::Operand* r = c->pop(8);
|
|
||||||
if (BytesPerWord == 8) {
|
|
||||||
c->pop(8);
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Compiler::Operand* peekLong(unsigned index) {
|
Compiler::Operand* peekLong(unsigned index) {
|
||||||
@ -886,12 +917,12 @@ class Frame {
|
|||||||
|
|
||||||
Compiler::Operand* popLong() {
|
Compiler::Operand* popLong() {
|
||||||
poppedLong();
|
poppedLong();
|
||||||
return popLongQuiet();
|
return popQuiet(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
Compiler::Operand* popObject() {
|
Compiler::Operand* popObject() {
|
||||||
poppedObject();
|
poppedObject();
|
||||||
return c->pop(BytesPerWord);
|
return popQuiet(BytesPerWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadInt(unsigned index) {
|
void loadInt(unsigned index) {
|
||||||
@ -925,7 +956,7 @@ class Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void storeObjectOrAddress(unsigned index) {
|
void storeObjectOrAddress(unsigned index) {
|
||||||
c->storeLocal(BytesPerWord, c->pop(BytesPerWord), index);
|
c->storeLocal(BytesPerWord, popQuiet(BytesPerWord), index);
|
||||||
|
|
||||||
assert(t, sp >= 1);
|
assert(t, sp >= 1);
|
||||||
assert(t, sp - 1 >= localSize());
|
assert(t, sp - 1 >= localSize());
|
||||||
@ -939,39 +970,39 @@ class Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dup() {
|
void dup() {
|
||||||
c->push(BytesPerWord, c->peek(BytesPerWord, 0));
|
pushQuiet(BytesPerWord, c->peek(BytesPerWord, 0));
|
||||||
|
|
||||||
dupped();
|
dupped();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dupX1() {
|
void dupX1() {
|
||||||
Compiler::Operand* s0 = c->pop(BytesPerWord);
|
Compiler::Operand* s0 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
|
|
||||||
duppedX1();
|
duppedX1();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dupX2() {
|
void dupX2() {
|
||||||
Compiler::Operand* s0 = c->pop(BytesPerWord);
|
Compiler::Operand* s0 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
if (get(sp - 2) == Long) {
|
if (get(sp - 2) == Long) {
|
||||||
Compiler::Operand* s1 = popLongQuiet();
|
Compiler::Operand* s1 = popQuiet(8);
|
||||||
|
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
pushLongQuiet(s1);
|
pushQuiet(8, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
} else {
|
} else {
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s2 = c->pop(BytesPerWord);
|
Compiler::Operand* s2 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
c->push(BytesPerWord, s2);
|
pushQuiet(BytesPerWord, s2);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
}
|
}
|
||||||
|
|
||||||
duppedX2();
|
duppedX2();
|
||||||
@ -979,15 +1010,15 @@ class Frame {
|
|||||||
|
|
||||||
void dup2() {
|
void dup2() {
|
||||||
if (get(sp - 1) == Long) {
|
if (get(sp - 1) == Long) {
|
||||||
pushLongQuiet(peekLong(0));
|
pushQuiet(8, peekLong(0));
|
||||||
} else {
|
} else {
|
||||||
Compiler::Operand* s0 = c->pop(BytesPerWord);
|
Compiler::Operand* s0 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
}
|
}
|
||||||
|
|
||||||
dupped2();
|
dupped2();
|
||||||
@ -995,22 +1026,22 @@ class Frame {
|
|||||||
|
|
||||||
void dup2X1() {
|
void dup2X1() {
|
||||||
if (get(sp - 1) == Long) {
|
if (get(sp - 1) == Long) {
|
||||||
Compiler::Operand* s0 = popLongQuiet();
|
Compiler::Operand* s0 = popQuiet(8);
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
pushLongQuiet(s0);
|
pushQuiet(8, s0);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
pushLongQuiet(s0);
|
pushQuiet(8, s0);
|
||||||
} else {
|
} else {
|
||||||
Compiler::Operand* s0 = c->pop(BytesPerWord);
|
Compiler::Operand* s0 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s2 = c->pop(BytesPerWord);
|
Compiler::Operand* s2 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
c->push(BytesPerWord, s2);
|
pushQuiet(BytesPerWord, s2);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
}
|
}
|
||||||
|
|
||||||
dupped2X1();
|
dupped2X1();
|
||||||
@ -1018,46 +1049,46 @@ class Frame {
|
|||||||
|
|
||||||
void dup2X2() {
|
void dup2X2() {
|
||||||
if (get(sp - 1) == Long) {
|
if (get(sp - 1) == Long) {
|
||||||
Compiler::Operand* s0 = popLongQuiet();
|
Compiler::Operand* s0 = popQuiet(8);
|
||||||
|
|
||||||
if (get(sp - 3) == Long) {
|
if (get(sp - 3) == Long) {
|
||||||
Compiler::Operand* s1 = popLongQuiet();
|
Compiler::Operand* s1 = popQuiet(8);
|
||||||
|
|
||||||
pushLongQuiet(s0);
|
pushQuiet(8, s0);
|
||||||
pushLongQuiet(s1);
|
pushQuiet(8, s1);
|
||||||
pushLongQuiet(s0);
|
pushQuiet(8, s0);
|
||||||
} else {
|
} else {
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s2 = c->pop(BytesPerWord);
|
Compiler::Operand* s2 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
pushLongQuiet(s0);
|
pushQuiet(8, s0);
|
||||||
c->push(BytesPerWord, s2);
|
pushQuiet(BytesPerWord, s2);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
pushLongQuiet(s0);
|
pushQuiet(8, s0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Compiler::Operand* s0 = c->pop(BytesPerWord);
|
Compiler::Operand* s0 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s2 = c->pop(BytesPerWord);
|
Compiler::Operand* s2 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s3 = c->pop(BytesPerWord);
|
Compiler::Operand* s3 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
c->push(BytesPerWord, s3);
|
pushQuiet(BytesPerWord, s3);
|
||||||
c->push(BytesPerWord, s2);
|
pushQuiet(BytesPerWord, s2);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
}
|
}
|
||||||
|
|
||||||
dupped2X2();
|
dupped2X2();
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap() {
|
void swap() {
|
||||||
Compiler::Operand* s0 = c->pop(BytesPerWord);
|
Compiler::Operand* s0 = popQuiet(BytesPerWord);
|
||||||
Compiler::Operand* s1 = c->pop(BytesPerWord);
|
Compiler::Operand* s1 = popQuiet(BytesPerWord);
|
||||||
|
|
||||||
c->push(BytesPerWord, s0);
|
pushQuiet(BytesPerWord, s0);
|
||||||
c->push(BytesPerWord, s1);
|
pushQuiet(BytesPerWord, s1);
|
||||||
|
|
||||||
swapped();
|
swapped();
|
||||||
}
|
}
|
||||||
@ -1192,14 +1223,14 @@ unwind(MyThread* t)
|
|||||||
vmJump(ip, base, stack, t);
|
vmJump(ip, base, stack, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FORCE_ALIGN
|
void
|
||||||
tryInitClass(MyThread* t, object class_)
|
tryInitClass(MyThread* t, object class_)
|
||||||
{
|
{
|
||||||
initClass(t, class_);
|
initClass(t, class_);
|
||||||
if (UNLIKELY(t->exception)) unwind(t);
|
if (UNLIKELY(t->exception)) unwind(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* FORCE_ALIGN
|
void*
|
||||||
findInterfaceMethodFromInstance(MyThread* t, object method, object instance)
|
findInterfaceMethodFromInstance(MyThread* t, object method, object instance)
|
||||||
{
|
{
|
||||||
if (instance) {
|
if (instance) {
|
||||||
@ -1212,7 +1243,7 @@ findInterfaceMethodFromInstance(MyThread* t, object method, object instance)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t FORCE_ALIGN
|
intptr_t
|
||||||
compareDoublesG(uint64_t bi, uint64_t ai)
|
compareDoublesG(uint64_t bi, uint64_t ai)
|
||||||
{
|
{
|
||||||
double a = bitsToDouble(ai);
|
double a = bitsToDouble(ai);
|
||||||
@ -1229,7 +1260,7 @@ compareDoublesG(uint64_t bi, uint64_t ai)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t FORCE_ALIGN
|
intptr_t
|
||||||
compareDoublesL(uint64_t bi, uint64_t ai)
|
compareDoublesL(uint64_t bi, uint64_t ai)
|
||||||
{
|
{
|
||||||
double a = bitsToDouble(ai);
|
double a = bitsToDouble(ai);
|
||||||
@ -1246,7 +1277,7 @@ compareDoublesL(uint64_t bi, uint64_t ai)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t FORCE_ALIGN
|
intptr_t
|
||||||
compareFloatsG(uint32_t bi, uint32_t ai)
|
compareFloatsG(uint32_t bi, uint32_t ai)
|
||||||
{
|
{
|
||||||
float a = bitsToFloat(ai);
|
float a = bitsToFloat(ai);
|
||||||
@ -1263,7 +1294,7 @@ compareFloatsG(uint32_t bi, uint32_t ai)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t FORCE_ALIGN
|
intptr_t
|
||||||
compareFloatsL(uint32_t bi, uint32_t ai)
|
compareFloatsL(uint32_t bi, uint32_t ai)
|
||||||
{
|
{
|
||||||
float a = bitsToFloat(ai);
|
float a = bitsToFloat(ai);
|
||||||
@ -1280,151 +1311,151 @@ compareFloatsL(uint32_t bi, uint32_t ai)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
addDouble(uint64_t b, uint64_t a)
|
addDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) + bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) + bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
subtractDouble(uint64_t b, uint64_t a)
|
subtractDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) - bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) - bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
multiplyDouble(uint64_t b, uint64_t a)
|
multiplyDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) * bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) * bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
divideDouble(uint64_t b, uint64_t a)
|
divideDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) / bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) / bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
moduloDouble(uint64_t b, uint64_t a)
|
moduloDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(fmod(bitsToDouble(a), bitsToDouble(b)));
|
return doubleToBits(fmod(bitsToDouble(a), bitsToDouble(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
negateDouble(uint64_t a)
|
negateDouble(uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(- bitsToDouble(a));
|
return doubleToBits(- bitsToDouble(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
doubleToFloat(int64_t a)
|
doubleToFloat(int64_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(static_cast<float>(bitsToDouble(a)));
|
return floatToBits(static_cast<float>(bitsToDouble(a)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t FORCE_ALIGN
|
int32_t
|
||||||
doubleToInt(int64_t a)
|
doubleToInt(int64_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int32_t>(bitsToDouble(a));
|
return static_cast<int32_t>(bitsToDouble(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t FORCE_ALIGN
|
int64_t
|
||||||
doubleToLong(int64_t a)
|
doubleToLong(int64_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int64_t>(bitsToDouble(a));
|
return static_cast<int64_t>(bitsToDouble(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
addFloat(uint32_t b, uint32_t a)
|
addFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) + bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) + bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
subtractFloat(uint32_t b, uint32_t a)
|
subtractFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) - bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) - bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
multiplyFloat(uint32_t b, uint32_t a)
|
multiplyFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) * bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) * bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
divideFloat(uint32_t b, uint32_t a)
|
divideFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) / bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) / bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
moduloFloat(uint32_t b, uint32_t a)
|
moduloFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(fmod(bitsToFloat(a), bitsToFloat(b)));
|
return floatToBits(fmod(bitsToFloat(a), bitsToFloat(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
negateFloat(uint32_t a)
|
negateFloat(uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(- bitsToFloat(a));
|
return floatToBits(- bitsToFloat(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t FORCE_ALIGN
|
int64_t
|
||||||
divideLong(int64_t b, int64_t a)
|
divideLong(int64_t b, int64_t a)
|
||||||
{
|
{
|
||||||
return a / b;
|
return a / b;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t FORCE_ALIGN
|
int64_t
|
||||||
moduloLong(int64_t b, int64_t a)
|
moduloLong(int64_t b, int64_t a)
|
||||||
{
|
{
|
||||||
return a % b;
|
return a % b;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
floatToDouble(int32_t a)
|
floatToDouble(int32_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(static_cast<double>(bitsToFloat(a)));
|
return doubleToBits(static_cast<double>(bitsToFloat(a)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t FORCE_ALIGN
|
int32_t
|
||||||
floatToInt(int32_t a)
|
floatToInt(int32_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int32_t>(bitsToFloat(a));
|
return static_cast<int32_t>(bitsToFloat(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t FORCE_ALIGN
|
int64_t
|
||||||
floatToLong(int32_t a)
|
floatToLong(int32_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int64_t>(bitsToFloat(a));
|
return static_cast<int64_t>(bitsToFloat(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
intToDouble(int32_t a)
|
intToDouble(int32_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(static_cast<double>(a));
|
return doubleToBits(static_cast<double>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
intToFloat(int32_t a)
|
intToFloat(int32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(static_cast<float>(a));
|
return floatToBits(static_cast<float>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
longToDouble(int64_t a)
|
longToDouble(int64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(static_cast<double>(a));
|
return doubleToBits(static_cast<double>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FORCE_ALIGN
|
uint32_t
|
||||||
longToFloat(int64_t a)
|
longToFloat(int64_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(static_cast<float>(a));
|
return floatToBits(static_cast<float>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
object FORCE_ALIGN
|
object
|
||||||
makeBlankObjectArray(MyThread* t, object class_, int32_t length)
|
makeBlankObjectArray(MyThread* t, object class_, int32_t length)
|
||||||
{
|
{
|
||||||
if (length >= 0) {
|
if (length >= 0) {
|
||||||
@ -1436,7 +1467,7 @@ makeBlankObjectArray(MyThread* t, object class_, int32_t length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object FORCE_ALIGN
|
object
|
||||||
makeBlankArray(MyThread* t, object (*constructor)(Thread*, uintptr_t, bool),
|
makeBlankArray(MyThread* t, object (*constructor)(Thread*, uintptr_t, bool),
|
||||||
int32_t length)
|
int32_t length)
|
||||||
{
|
{
|
||||||
@ -1449,7 +1480,7 @@ makeBlankArray(MyThread* t, object (*constructor)(Thread*, uintptr_t, bool),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t FORCE_ALIGN
|
uintptr_t
|
||||||
lookUpAddress(int32_t key, uintptr_t* start, int32_t count,
|
lookUpAddress(int32_t key, uintptr_t* start, int32_t count,
|
||||||
uintptr_t default_)
|
uintptr_t default_)
|
||||||
{
|
{
|
||||||
@ -1472,7 +1503,7 @@ lookUpAddress(int32_t key, uintptr_t* start, int32_t count,
|
|||||||
return default_;
|
return default_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FORCE_ALIGN
|
void
|
||||||
setMaybeNull(MyThread* t, object o, unsigned offset, object value)
|
setMaybeNull(MyThread* t, object o, unsigned offset, object value)
|
||||||
{
|
{
|
||||||
if (LIKELY(o)) {
|
if (LIKELY(o)) {
|
||||||
@ -1483,7 +1514,7 @@ setMaybeNull(MyThread* t, object o, unsigned offset, object value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FORCE_ALIGN
|
void
|
||||||
acquireMonitorForObject(MyThread* t, object o)
|
acquireMonitorForObject(MyThread* t, object o)
|
||||||
{
|
{
|
||||||
if (LIKELY(o)) {
|
if (LIKELY(o)) {
|
||||||
@ -1494,7 +1525,7 @@ acquireMonitorForObject(MyThread* t, object o)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FORCE_ALIGN
|
void
|
||||||
releaseMonitorForObject(MyThread* t, object o)
|
releaseMonitorForObject(MyThread* t, object o)
|
||||||
{
|
{
|
||||||
if (LIKELY(o)) {
|
if (LIKELY(o)) {
|
||||||
@ -1530,7 +1561,7 @@ makeMultidimensionalArray2(MyThread* t, object class_, uintptr_t* stack,
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
object FORCE_ALIGN
|
object
|
||||||
makeMultidimensionalArray(MyThread* t, object class_, int32_t dimensions,
|
makeMultidimensionalArray(MyThread* t, object class_, int32_t dimensions,
|
||||||
uintptr_t* stack)
|
uintptr_t* stack)
|
||||||
{
|
{
|
||||||
@ -1563,7 +1594,7 @@ traceSize(Thread* t)
|
|||||||
+ (counter.count * FixedSizeOfTraceElement);
|
+ (counter.count * FixedSizeOfTraceElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NO_RETURN FORCE_ALIGN
|
void NO_RETURN
|
||||||
throwArrayIndexOutOfBounds(MyThread* t)
|
throwArrayIndexOutOfBounds(MyThread* t)
|
||||||
{
|
{
|
||||||
ensure(t, FixedSizeOfArrayIndexOutOfBoundsException + traceSize(t));
|
ensure(t, FixedSizeOfArrayIndexOutOfBoundsException + traceSize(t));
|
||||||
@ -1575,7 +1606,7 @@ throwArrayIndexOutOfBounds(MyThread* t)
|
|||||||
unwind(t);
|
unwind(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NO_RETURN FORCE_ALIGN
|
void NO_RETURN
|
||||||
throw_(MyThread* t, object o)
|
throw_(MyThread* t, object o)
|
||||||
{
|
{
|
||||||
if (LIKELY(o)) {
|
if (LIKELY(o)) {
|
||||||
@ -1586,7 +1617,7 @@ throw_(MyThread* t, object o)
|
|||||||
unwind(t);
|
unwind(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FORCE_ALIGN
|
void
|
||||||
checkCast(MyThread* t, object class_, object o)
|
checkCast(MyThread* t, object class_, object o)
|
||||||
{
|
{
|
||||||
if (UNLIKELY(o and not isAssignableFrom(t, class_, objectClass(t, o)))) {
|
if (UNLIKELY(o and not isAssignableFrom(t, class_, objectClass(t, o)))) {
|
||||||
@ -1599,7 +1630,7 @@ checkCast(MyThread* t, object class_, object o)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FORCE_ALIGN
|
void
|
||||||
gcIfNecessary(MyThread* t)
|
gcIfNecessary(MyThread* t)
|
||||||
{
|
{
|
||||||
if (UNLIKELY(t->backupHeap)) {
|
if (UNLIKELY(t->backupHeap)) {
|
||||||
@ -1687,32 +1718,32 @@ compileDirectInvoke(MyThread* t, Frame* frame, object target)
|
|||||||
|
|
||||||
if (not emptyMethod(t, target)) {
|
if (not emptyMethod(t, target)) {
|
||||||
if (methodFlags(t, target) & ACC_NATIVE) {
|
if (methodFlags(t, target) & ACC_NATIVE) {
|
||||||
result = c->call
|
result = c->stackCall
|
||||||
(c->constant
|
(c->constant
|
||||||
(reinterpret_cast<intptr_t>
|
(reinterpret_cast<intptr_t>
|
||||||
(&singletonBody(t, nativeThunk(t), 0))),
|
(&singletonBody(t, nativeThunk(t), 0))),
|
||||||
0,
|
0,
|
||||||
frame->trace(target, false),
|
frame->trace(target, false),
|
||||||
rSize,
|
rSize,
|
||||||
0);
|
methodParameterFootprint(t, target));
|
||||||
} else if (methodCompiled(t, target) == defaultThunk(t)) {
|
} else if (methodCompiled(t, target) == defaultThunk(t)) {
|
||||||
result = c->call
|
result = c->stackCall
|
||||||
(c->constant
|
(c->constant
|
||||||
(reinterpret_cast<intptr_t>
|
(reinterpret_cast<intptr_t>
|
||||||
(&singletonBody(t, defaultThunk(t), 0))),
|
(&singletonBody(t, defaultThunk(t), 0))),
|
||||||
Compiler::Aligned,
|
Compiler::Aligned,
|
||||||
frame->trace(target, false),
|
frame->trace(target, false),
|
||||||
rSize,
|
rSize,
|
||||||
0);
|
methodParameterFootprint(t, target));
|
||||||
} else {
|
} else {
|
||||||
result = c->call
|
result = c->stackCall
|
||||||
(c->constant
|
(c->constant
|
||||||
(reinterpret_cast<intptr_t>
|
(reinterpret_cast<intptr_t>
|
||||||
(&singletonBody(t, methodCompiled(t, target), 0))),
|
(&singletonBody(t, methodCompiled(t, target), 0))),
|
||||||
0,
|
0,
|
||||||
frame->trace(0, false),
|
frame->trace(0, false),
|
||||||
rSize,
|
rSize,
|
||||||
0);
|
methodParameterFootprint(t, target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2629,7 +2660,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
|
|
||||||
unsigned rSize = resultSize(t, methodReturnCode(t, target));
|
unsigned rSize = resultSize(t, methodReturnCode(t, target));
|
||||||
|
|
||||||
Compiler::Operand* result = c->call
|
Compiler::Operand* result = c->stackCall
|
||||||
(c->call
|
(c->call
|
||||||
(c->constant
|
(c->constant
|
||||||
(getThunk(t, findInterfaceMethodFromInstanceThunk)),
|
(getThunk(t, findInterfaceMethodFromInstanceThunk)),
|
||||||
@ -2641,7 +2672,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
0,
|
0,
|
||||||
frame->trace(target, true),
|
frame->trace(target, true),
|
||||||
rSize,
|
rSize,
|
||||||
0);
|
parameterFootprint);
|
||||||
|
|
||||||
frame->pop(parameterFootprint);
|
frame->pop(parameterFootprint);
|
||||||
|
|
||||||
@ -2688,7 +2719,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
|
|
||||||
unsigned rSize = resultSize(t, methodReturnCode(t, target));
|
unsigned rSize = resultSize(t, methodReturnCode(t, target));
|
||||||
|
|
||||||
Compiler::Operand* result = c->call
|
Compiler::Operand* result = c->stackCall
|
||||||
(c->memory
|
(c->memory
|
||||||
(c->and_
|
(c->and_
|
||||||
(BytesPerWord, c->constant(PointerMask),
|
(BytesPerWord, c->constant(PointerMask),
|
||||||
@ -2696,7 +2727,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
0,
|
0,
|
||||||
frame->trace(target, true),
|
frame->trace(target, true),
|
||||||
rSize,
|
rSize,
|
||||||
0);
|
parameterFootprint);
|
||||||
|
|
||||||
frame->pop(parameterFootprint);
|
frame->pop(parameterFootprint);
|
||||||
|
|
||||||
@ -3486,7 +3517,7 @@ printSet(uintptr_t m)
|
|||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
||||||
unsigned eventIndex)
|
unsigned stackPadding, unsigned eventIndex)
|
||||||
{
|
{
|
||||||
// for each instruction with more than one predecessor, and for each
|
// for each instruction with more than one predecessor, and for each
|
||||||
// stack position, determine if there exists a path to that
|
// stack position, determine if there exists a path to that
|
||||||
@ -3494,6 +3525,9 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
|||||||
// stack position (i.e. it is uninitialized or contains primitive
|
// stack position (i.e. it is uninitialized or contains primitive
|
||||||
// data).
|
// data).
|
||||||
|
|
||||||
|
Compiler* c = context->compiler;
|
||||||
|
|
||||||
|
unsigned localSize = ::localSize(t, context->method);
|
||||||
unsigned mapSize = frameMapSizeInWords(t, context->method);
|
unsigned mapSize = frameMapSizeInWords(t, context->method);
|
||||||
|
|
||||||
uintptr_t roots[mapSize];
|
uintptr_t roots[mapSize];
|
||||||
@ -3517,13 +3551,30 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
|||||||
while (eventIndex < length) {
|
while (eventIndex < length) {
|
||||||
Event e = static_cast<Event>(context->eventLog.get(eventIndex++));
|
Event e = static_cast<Event>(context->eventLog.get(eventIndex++));
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case PushEvent: {
|
case PushContextEvent: {
|
||||||
eventIndex = calculateFrameMaps(t, context, roots, eventIndex);
|
eventIndex = calculateFrameMaps
|
||||||
|
(t, context, roots, stackPadding, eventIndex);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PopEvent:
|
case PopContextEvent:
|
||||||
return eventIndex;
|
return eventIndex;
|
||||||
|
|
||||||
|
case PushEvent: {
|
||||||
|
Compiler::StackElement* s;
|
||||||
|
context->eventLog.get(eventIndex, &s, BytesPerWord);
|
||||||
|
stackPadding += c->padding(s);
|
||||||
|
|
||||||
|
eventIndex += BytesPerWord;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case PopEvent: {
|
||||||
|
Compiler::StackElement* s;
|
||||||
|
context->eventLog.get(eventIndex, &s, BytesPerWord);
|
||||||
|
stackPadding -= c->padding(s);
|
||||||
|
|
||||||
|
eventIndex += BytesPerWord;
|
||||||
|
} break;
|
||||||
|
|
||||||
case IpEvent: {
|
case IpEvent: {
|
||||||
ip = context->eventLog.get2(eventIndex);
|
ip = context->eventLog.get2(eventIndex);
|
||||||
eventIndex += 2;
|
eventIndex += 2;
|
||||||
@ -3541,7 +3592,7 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
|||||||
uintptr_t newRoots = tableRoots[wi] & roots[wi];
|
uintptr_t newRoots = tableRoots[wi] & roots[wi];
|
||||||
|
|
||||||
if ((eventIndex == length
|
if ((eventIndex == length
|
||||||
or context->eventLog.get(eventIndex) == PopEvent)
|
or context->eventLog.get(eventIndex) == PopContextEvent)
|
||||||
and newRoots != tableRoots[wi])
|
and newRoots != tableRoots[wi])
|
||||||
{
|
{
|
||||||
if (DebugFrameMaps) {
|
if (DebugFrameMaps) {
|
||||||
@ -3569,6 +3620,10 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
|||||||
unsigned i = context->eventLog.get2(eventIndex);
|
unsigned i = context->eventLog.get2(eventIndex);
|
||||||
eventIndex += 2;
|
eventIndex += 2;
|
||||||
|
|
||||||
|
if (i > localSize) {
|
||||||
|
i += stackPadding;
|
||||||
|
}
|
||||||
|
|
||||||
markBit(roots, i);
|
markBit(roots, i);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -3576,6 +3631,10 @@ calculateFrameMaps(MyThread* t, Context* context, uintptr_t* originalRoots,
|
|||||||
unsigned i = context->eventLog.get2(eventIndex);
|
unsigned i = context->eventLog.get2(eventIndex);
|
||||||
eventIndex += 2;
|
eventIndex += 2;
|
||||||
|
|
||||||
|
if (i > localSize) {
|
||||||
|
i += stackPadding;
|
||||||
|
}
|
||||||
|
|
||||||
clearBit(roots, i);
|
clearBit(roots, i);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -3628,7 +3687,7 @@ compareMethodBounds(Thread* t, object a, object b)
|
|||||||
unsigned
|
unsigned
|
||||||
frameObjectMapSize(MyThread* t, object method, object map)
|
frameObjectMapSize(MyThread* t, object method, object map)
|
||||||
{
|
{
|
||||||
int size = frameSize(t, method);
|
int size = alignedFrameSize(t, method);
|
||||||
return ceiling(intArrayLength(t, map) * size, 32 + size);
|
return ceiling(intArrayLength(t, map) * size, 32 + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3719,7 +3778,7 @@ finish(MyThread* t, Context* context)
|
|||||||
qsort(elements, context->traceLogCount, sizeof(TraceElement*),
|
qsort(elements, context->traceLogCount, sizeof(TraceElement*),
|
||||||
compareTraceElementPointers);
|
compareTraceElementPointers);
|
||||||
|
|
||||||
unsigned size = frameSize(t, context->method);
|
unsigned size = alignedFrameSize(t, context->method);
|
||||||
object map = makeIntArray
|
object map = makeIntArray
|
||||||
(t, context->traceLogCount
|
(t, context->traceLogCount
|
||||||
+ ceiling(context->traceLogCount * size, 32),
|
+ ceiling(context->traceLogCount * size, 32),
|
||||||
@ -3835,7 +3894,7 @@ compile(MyThread* t, Context* context)
|
|||||||
if (UNLIKELY(t->exception)) return 0;
|
if (UNLIKELY(t->exception)) return 0;
|
||||||
|
|
||||||
context->dirtyRoots = false;
|
context->dirtyRoots = false;
|
||||||
unsigned eventIndex = calculateFrameMaps(t, context, 0, 0);
|
unsigned eventIndex = calculateFrameMaps(t, context, 0, 0, 0);
|
||||||
|
|
||||||
object eht = codeExceptionHandlerTable(t, methodCode(t, context->method));
|
object eht = codeExceptionHandlerTable(t, methodCode(t, context->method));
|
||||||
if (eht) {
|
if (eht) {
|
||||||
@ -3881,7 +3940,7 @@ compile(MyThread* t, Context* context)
|
|||||||
compile(t, &frame2, exceptionHandlerIp(eh), true);
|
compile(t, &frame2, exceptionHandlerIp(eh), true);
|
||||||
if (UNLIKELY(t->exception)) return 0;
|
if (UNLIKELY(t->exception)) return 0;
|
||||||
|
|
||||||
eventIndex = calculateFrameMaps(t, context, 0, eventIndex);
|
eventIndex = calculateFrameMaps(t, context, 0, 0, eventIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3891,7 +3950,7 @@ compile(MyThread* t, Context* context)
|
|||||||
|
|
||||||
while (context->dirtyRoots) {
|
while (context->dirtyRoots) {
|
||||||
context->dirtyRoots = false;
|
context->dirtyRoots = false;
|
||||||
calculateFrameMaps(t, context, 0, 0);
|
calculateFrameMaps(t, context, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return finish(t, context);
|
return finish(t, context);
|
||||||
@ -3935,7 +3994,7 @@ compileMethod2(MyThread* t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* FORCE_ALIGN
|
void*
|
||||||
compileMethod(MyThread* t)
|
compileMethod(MyThread* t)
|
||||||
{
|
{
|
||||||
void* r = compileMethod2(t);
|
void* r = compileMethod2(t);
|
||||||
@ -4129,7 +4188,7 @@ invokeNative2(MyThread* t, object method)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FORCE_ALIGN
|
uint64_t
|
||||||
invokeNative(MyThread* t)
|
invokeNative(MyThread* t)
|
||||||
{
|
{
|
||||||
if (t->trace->nativeMethod == 0) {
|
if (t->trace->nativeMethod == 0) {
|
||||||
@ -4170,7 +4229,7 @@ frameMapIndex(MyThread* t, object method, int32_t offset)
|
|||||||
int32_t v = intArrayBody(t, map, middle);
|
int32_t v = intArrayBody(t, map, middle);
|
||||||
|
|
||||||
if (offset == v) {
|
if (offset == v) {
|
||||||
return (indexSize * 32) + (frameSize(t, method) * middle);
|
return (indexSize * 32) + (alignedFrameSize(t, method) * middle);
|
||||||
} else if (offset < v) {
|
} else if (offset < v) {
|
||||||
top = middle;
|
top = middle;
|
||||||
} else {
|
} else {
|
||||||
@ -4193,7 +4252,7 @@ visitStackAndLocals(MyThread* t, Heap::Visitor* v, void* base, object method,
|
|||||||
|
|
||||||
count = parameterFootprint + height - argumentFootprint;
|
count = parameterFootprint + height - argumentFootprint;
|
||||||
} else {
|
} else {
|
||||||
count = frameSize(t, method);
|
count = alignedFrameSize(t, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
|
626
src/compiler.cpp
626
src/compiler.cpp
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,7 @@ class Compiler {
|
|||||||
static const unsigned NoReturn = 1 << 1;
|
static const unsigned NoReturn = 1 << 1;
|
||||||
|
|
||||||
class Operand { };
|
class Operand { };
|
||||||
|
class StackElement { };
|
||||||
|
|
||||||
virtual ~Compiler() { }
|
virtual ~Compiler() { }
|
||||||
|
|
||||||
@ -68,8 +69,11 @@ class Compiler {
|
|||||||
virtual void push(unsigned size) = 0;
|
virtual void push(unsigned size) = 0;
|
||||||
virtual void push(unsigned size, Operand* value) = 0;
|
virtual void push(unsigned size, Operand* value) = 0;
|
||||||
virtual Operand* pop(unsigned size) = 0;
|
virtual Operand* pop(unsigned size) = 0;
|
||||||
virtual void pushed(unsigned count) = 0;
|
virtual void pushed() = 0;
|
||||||
virtual void popped(unsigned count) = 0;
|
virtual void popped() = 0;
|
||||||
|
virtual StackElement* top() = 0;
|
||||||
|
virtual unsigned size(StackElement*) = 0;
|
||||||
|
virtual unsigned padding(StackElement*) = 0;
|
||||||
virtual Operand* peek(unsigned size, unsigned index) = 0;
|
virtual Operand* peek(unsigned size, unsigned index) = 0;
|
||||||
|
|
||||||
virtual Operand* call(Operand* address,
|
virtual Operand* call(Operand* address,
|
||||||
@ -79,6 +83,12 @@ class Compiler {
|
|||||||
unsigned argumentCount,
|
unsigned argumentCount,
|
||||||
...) = 0;
|
...) = 0;
|
||||||
|
|
||||||
|
virtual Operand* stackCall(Operand* address,
|
||||||
|
unsigned flags,
|
||||||
|
TraceHandler* traceHandler,
|
||||||
|
unsigned resultSize,
|
||||||
|
unsigned argumentFootprint) = 0;
|
||||||
|
|
||||||
virtual void return_(unsigned size, Operand* value) = 0;
|
virtual void return_(unsigned size, Operand* value) = 0;
|
||||||
|
|
||||||
virtual void storeLocal(unsigned size, Operand* src, unsigned index) = 0;
|
virtual void storeLocal(unsigned size, Operand* src, unsigned index) = 0;
|
||||||
|
@ -2221,7 +2221,7 @@ isAssignableFrom(Thread* t, object a, object b)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FORCE_ALIGN
|
bool
|
||||||
instanceOf(Thread* t, object class_, object o)
|
instanceOf(Thread* t, object class_, object o)
|
||||||
{
|
{
|
||||||
if (o == 0) {
|
if (o == 0) {
|
||||||
|
@ -1507,7 +1507,7 @@ mark(Thread* t, object o, unsigned offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void FORCE_ALIGN
|
inline void
|
||||||
set(Thread* t, object target, unsigned offset, object value)
|
set(Thread* t, object target, unsigned offset, object value)
|
||||||
{
|
{
|
||||||
cast<object>(target, offset) = value;
|
cast<object>(target, offset) = value;
|
||||||
@ -1694,7 +1694,7 @@ makeExceptionInInitializerError(Thread* t, object cause)
|
|||||||
return makeExceptionInInitializerError(t, 0, trace, cause);
|
return makeExceptionInInitializerError(t, 0, trace, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline object FORCE_ALIGN
|
inline object
|
||||||
makeNew(Thread* t, object class_)
|
makeNew(Thread* t, object class_)
|
||||||
{
|
{
|
||||||
assert(t, t->state == Thread::ActiveState);
|
assert(t, t->state == Thread::ActiveState);
|
||||||
@ -1709,7 +1709,7 @@ makeNew(Thread* t, object class_)
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline object FORCE_ALIGN
|
inline object
|
||||||
makeNewWeakReference(Thread* t, object class_)
|
makeNewWeakReference(Thread* t, object class_)
|
||||||
{
|
{
|
||||||
assert(t, t->state == Thread::ActiveState);
|
assert(t, t->state == Thread::ActiveState);
|
||||||
|
@ -2030,6 +2030,15 @@ class MyAssembler: public Assembler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual unsigned stackPadding(unsigned footprint) {
|
||||||
|
#if (defined __APPLE__) || (defined __x86_64__)
|
||||||
|
const unsigned alignment = 16 / BytesPerWord;
|
||||||
|
return (ceiling(footprint, alignment) * alignment) - footprint;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
virtual void plan(UnaryOperation op, unsigned size, uint8_t* typeMask,
|
virtual void plan(UnaryOperation op, unsigned size, uint8_t* typeMask,
|
||||||
uint64_t* registerMask, bool* thunk)
|
uint64_t* registerMask, bool* thunk)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user