mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Merge branch 'master' of github.com:ReadyTalk/avian
This commit is contained in:
commit
a96f34709c
2
makefile
2
makefile
@ -192,6 +192,8 @@ common-cflags = $(warnings) -fno-rtti -fno-exceptions \
|
|||||||
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
|
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
|
||||||
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" $(target-cflags)
|
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" $(target-cflags)
|
||||||
|
|
||||||
|
asmflags = $(target-cflags)
|
||||||
|
|
||||||
ifneq (,$(filter i386 x86_64,$(arch)))
|
ifneq (,$(filter i386 x86_64,$(arch)))
|
||||||
ifeq ($(use-frame-pointer),true)
|
ifeq ($(use-frame-pointer),true)
|
||||||
common-cflags += -fno-omit-frame-pointer -DAVIAN_USE_FRAME_POINTER
|
common-cflags += -fno-omit-frame-pointer -DAVIAN_USE_FRAME_POINTER
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "target-fields.h"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
@ -22,14 +23,6 @@
|
|||||||
# define GLOBAL(x) x
|
# define GLOBAL(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define THREAD_STACK 2148
|
|
||||||
#define THREAD_SCRATCH 2156
|
|
||||||
#define THREAD_CONTINUATION 2160
|
|
||||||
#define THREAD_EXCEPTION 44
|
|
||||||
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 2164
|
|
||||||
#define THREAD_EXCEPTION_OFFSET 2168
|
|
||||||
#define THREAD_EXCEPTION_HANDLER 2172
|
|
||||||
|
|
||||||
#define CONTINUATION_NEXT 4
|
#define CONTINUATION_NEXT 4
|
||||||
#define CONTINUATION_ADDRESS 16
|
#define CONTINUATION_ADDRESS 16
|
||||||
#define CONTINUATION_RETURN_ADDRESS_OFFSET 20
|
#define CONTINUATION_RETURN_ADDRESS_OFFSET 20
|
||||||
@ -57,7 +50,7 @@ GLOBAL(vmInvoke):
|
|||||||
ldr r4, [sp, #4]
|
ldr r4, [sp, #4]
|
||||||
str r4, [sp, #-4]!
|
str r4, [sp, #-4]!
|
||||||
|
|
||||||
str sp, [r0, #THREAD_SCRATCH]
|
str sp, [r0, #TARGET_THREAD_SCRATCH]
|
||||||
|
|
||||||
// align stack, if necessary
|
// align stack, if necessary
|
||||||
eor r4, sp, r3
|
eor r4, sp, r3
|
||||||
@ -88,7 +81,7 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
.align 2
|
.align 2
|
||||||
GLOBAL(vmInvoke_returnAddress):
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
ldr sp, [r8, #THREAD_SCRATCH]
|
ldr sp, [r8, #TARGET_THREAD_SCRATCH]
|
||||||
|
|
||||||
// clear MyThread::stack to avoid confusing another thread calling
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
// java.lang.Thread.getStackTrace on this one. See
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
@ -96,7 +89,7 @@ GLOBAL(vmInvoke_returnAddress):
|
|||||||
// a reliable stack trace from a thread that might be interrupted at
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
// any point in its execution.
|
// any point in its execution.
|
||||||
mov r5, #0
|
mov r5, #0
|
||||||
str r5, [r8, #THREAD_STACK]
|
str r5, [r8, #TARGET_THREAD_STACK]
|
||||||
|
|
||||||
.globl GLOBAL(vmInvoke_safeStack)
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
.align 2
|
.align 2
|
||||||
@ -104,7 +97,7 @@ GLOBAL(vmInvoke_safeStack):
|
|||||||
|
|
||||||
#ifdef AVIAN_CONTINUATIONS
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
// call the next continuation, if any
|
// call the next continuation, if any
|
||||||
ldr r5,[r8,#THREAD_CONTINUATION]
|
ldr r5,[r8,#TARGET_THREAD_CONTINUATION]
|
||||||
cmp r5,#0
|
cmp r5,#0
|
||||||
beq LOCAL(vmInvoke_exit)
|
beq LOCAL(vmInvoke_exit)
|
||||||
|
|
||||||
@ -138,10 +131,10 @@ LOCAL(vmInvoke_getAddress):
|
|||||||
str r11,[sp,r7]
|
str r11,[sp,r7]
|
||||||
|
|
||||||
ldr r7,[r5,#CONTINUATION_NEXT]
|
ldr r7,[r5,#CONTINUATION_NEXT]
|
||||||
str r7,[r8,#THREAD_CONTINUATION]
|
str r7,[r8,#TARGET_THREAD_CONTINUATION]
|
||||||
|
|
||||||
// call the continuation unless we're handling an exception
|
// call the continuation unless we're handling an exception
|
||||||
ldr r7,[r8,#THREAD_EXCEPTION]
|
ldr r7,[r8,#TARGET_THREAD_EXCEPTION]
|
||||||
cmp r7,#0
|
cmp r7,#0
|
||||||
bne LOCAL(vmInvoke_handleException)
|
bne LOCAL(vmInvoke_handleException)
|
||||||
ldr r7,[r5,#CONTINUATION_ADDRESS]
|
ldr r7,[r5,#CONTINUATION_ADDRESS]
|
||||||
@ -150,22 +143,22 @@ LOCAL(vmInvoke_getAddress):
|
|||||||
LOCAL(vmInvoke_handleException):
|
LOCAL(vmInvoke_handleException):
|
||||||
// we're handling an exception - call the exception handler instead
|
// we're handling an exception - call the exception handler instead
|
||||||
mov r11,#0
|
mov r11,#0
|
||||||
str r11,[r8,#THREAD_EXCEPTION]
|
str r11,[r8,#TARGET_THREAD_EXCEPTION]
|
||||||
ldr r11,[r8,#THREAD_EXCEPTION_STACK_ADJUSTMENT]
|
ldr r11,[r8,#TARGET_THREAD_EXCEPTIONSTACKADJUSTMENT]
|
||||||
ldr r9,[sp]
|
ldr r9,[sp]
|
||||||
neg r11,r11
|
neg r11,r11
|
||||||
str r9,[sp,r11]!
|
str r9,[sp,r11]!
|
||||||
ldr r11,[r8,#THREAD_EXCEPTION_OFFSET]
|
ldr r11,[r8,#TARGET_THREAD_EXCEPTIONOFFSET]
|
||||||
str r7,[sp,r11]
|
str r7,[sp,r11]
|
||||||
|
|
||||||
ldr r7,[r8,#THREAD_EXCEPTION_HANDLER]
|
ldr r7,[r8,#TARGET_THREAD_EXCEPTIONHANDLER]
|
||||||
bx r7
|
bx r7
|
||||||
|
|
||||||
LOCAL(vmInvoke_exit):
|
LOCAL(vmInvoke_exit):
|
||||||
#endif // AVIAN_CONTINUATIONS
|
#endif // AVIAN_CONTINUATIONS
|
||||||
|
|
||||||
mov ip, #0
|
mov ip, #0
|
||||||
str ip, [r8, #THREAD_STACK]
|
str ip, [r8, #TARGET_THREAD_STACK]
|
||||||
|
|
||||||
// restore return type
|
// restore return type
|
||||||
ldr ip, [sp], #4
|
ldr ip, [sp], #4
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "target-fields.h"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
@ -28,13 +29,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ARGUMENT_BASE BYTES_PER_WORD * LINKAGE_AREA
|
#define ARGUMENT_BASE BYTES_PER_WORD * LINKAGE_AREA
|
||||||
|
|
||||||
#define THREAD_STACK 2148
|
|
||||||
#define THREAD_CONTINUATION 2160
|
|
||||||
#define THREAD_EXCEPTION 44
|
|
||||||
#define THREAD_EXCEPTION_STACK_ADJUSTMENT 2164
|
|
||||||
#define THREAD_EXCEPTION_OFFSET 2168
|
|
||||||
#define THREAD_EXCEPTION_HANDLER 2172
|
|
||||||
|
|
||||||
#define CONTINUATION_NEXT 4
|
#define CONTINUATION_NEXT 4
|
||||||
#define CONTINUATION_ADDRESS 16
|
#define CONTINUATION_ADDRESS 16
|
||||||
@ -121,14 +115,14 @@ GLOBAL(vmInvoke_returnAddress):
|
|||||||
// a reliable stack trace from a thread that might be interrupted at
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
// any point in its execution.
|
// any point in its execution.
|
||||||
li r5,0
|
li r5,0
|
||||||
stw r5,THREAD_STACK(r13)
|
stw r5,TARGET_THREAD_STACK(r13)
|
||||||
|
|
||||||
.globl GLOBAL(vmInvoke_safeStack)
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
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,TARGET_THREAD_CONTINUATION(r13)
|
||||||
cmplwi r5,0
|
cmplwi r5,0
|
||||||
beq LOCAL(vmInvoke_exit)
|
beq LOCAL(vmInvoke_exit)
|
||||||
|
|
||||||
@ -171,10 +165,10 @@ LOCAL(vmInvoke_getPC):
|
|||||||
stw r7,0(r1)
|
stw r7,0(r1)
|
||||||
|
|
||||||
lwz r7,CONTINUATION_NEXT(r5)
|
lwz r7,CONTINUATION_NEXT(r5)
|
||||||
stw r7,THREAD_CONTINUATION(r13)
|
stw r7,TARGET_THREAD_CONTINUATION(r13)
|
||||||
|
|
||||||
// call the continuation unless we're handling an exception
|
// call the continuation unless we're handling an exception
|
||||||
lwz r7,THREAD_EXCEPTION(r13)
|
lwz r7,TARGET_THREAD_EXCEPTION(r13)
|
||||||
cmpwi r7,0
|
cmpwi r7,0
|
||||||
bne LOCAL(vmInvoke_handleException)
|
bne LOCAL(vmInvoke_handleException)
|
||||||
lwz r7,CONTINUATION_ADDRESS(r5)
|
lwz r7,CONTINUATION_ADDRESS(r5)
|
||||||
@ -184,15 +178,15 @@ LOCAL(vmInvoke_getPC):
|
|||||||
LOCAL(vmInvoke_handleException):
|
LOCAL(vmInvoke_handleException):
|
||||||
// we're handling an exception - call the exception handler instead
|
// we're handling an exception - call the exception handler instead
|
||||||
li r8,0
|
li r8,0
|
||||||
stw r8,THREAD_EXCEPTION(r13)
|
stw r8,TARGET_THREAD_EXCEPTION(r13)
|
||||||
lwz r8,THREAD_EXCEPTION_STACK_ADJUSTMENT(r13)
|
lwz r8,TARGET_THREAD_EXCEPTIONSTACKADJUSTMENT(r13)
|
||||||
lwz r9,0(r1)
|
lwz r9,0(r1)
|
||||||
subfic r8,r8,0
|
subfic r8,r8,0
|
||||||
stwux r9,r1,r8
|
stwux r9,r1,r8
|
||||||
lwz r8,THREAD_EXCEPTION_OFFSET(r13)
|
lwz r8,TARGET_THREAD_EXCEPTIONOFFSET(r13)
|
||||||
stwx r7,r1,r8
|
stwx r7,r1,r8
|
||||||
|
|
||||||
lwz r7,THREAD_EXCEPTION_HANDLER(r13)
|
lwz r7,TARGET_THREAD_EXCEPTIONHANDLER(r13)
|
||||||
mtctr r7
|
mtctr r7
|
||||||
bctr
|
bctr
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "target-fields.h"
|
||||||
|
|
||||||
#define LOCAL(x) .L##x
|
#define LOCAL(x) .L##x
|
||||||
|
|
||||||
@ -23,9 +24,6 @@
|
|||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|
||||||
#define THREAD_STACK 2224
|
|
||||||
#define THREAD_SCRATCH 2240
|
|
||||||
|
|
||||||
#ifdef AVIAN_USE_FRAME_POINTER
|
#ifdef AVIAN_USE_FRAME_POINTER
|
||||||
# define ALIGNMENT_ADJUSTMENT 0
|
# define ALIGNMENT_ADJUSTMENT 0
|
||||||
#else
|
#else
|
||||||
@ -53,7 +51,7 @@ GLOBAL(vmInvoke):
|
|||||||
|
|
||||||
// remember this stack position, since we won't be able to rely on
|
// remember this stack position, since we won't be able to rely on
|
||||||
// %rbp being restored when the call returns
|
// %rbp being restored when the call returns
|
||||||
movq %rsp,THREAD_SCRATCH(%rcx)
|
movq %rsp,TARGET_THREAD_SCRATCH(%rcx)
|
||||||
|
|
||||||
// save callee-saved registers
|
// save callee-saved registers
|
||||||
movq %rbx,0(%rsp)
|
movq %rbx,0(%rsp)
|
||||||
@ -90,14 +88,14 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
.globl GLOBAL(vmInvoke_returnAddress)
|
.globl GLOBAL(vmInvoke_returnAddress)
|
||||||
GLOBAL(vmInvoke_returnAddress):
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
movq THREAD_SCRATCH(%rbx),%rsp
|
movq TARGET_THREAD_SCRATCH(%rbx),%rsp
|
||||||
|
|
||||||
// clear MyThread::stack to avoid confusing another thread calling
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
// java.lang.Thread.getStackTrace on this one. See
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
// a reliable stack trace from a thread that might be interrupted at
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
// any point in its execution.
|
// any point in its execution.
|
||||||
movq $0,THREAD_STACK(%rbx)
|
movq $0,TARGET_THREAD_STACK(%rbx)
|
||||||
|
|
||||||
.globl GLOBAL(vmInvoke_safeStack)
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
GLOBAL(vmInvoke_safeStack):
|
GLOBAL(vmInvoke_safeStack):
|
||||||
@ -188,7 +186,7 @@ GLOBAL(vmInvoke):
|
|||||||
|
|
||||||
// remember this stack position, since we won't be able to rely on
|
// remember this stack position, since we won't be able to rely on
|
||||||
// %rbp being restored when the call returns
|
// %rbp being restored when the call returns
|
||||||
movq %rsp,THREAD_SCRATCH(%rdi)
|
movq %rsp,TARGET_THREAD_SCRATCH(%rdi)
|
||||||
|
|
||||||
// save callee-saved registers
|
// save callee-saved registers
|
||||||
movq %rbx,0(%rsp)
|
movq %rbx,0(%rsp)
|
||||||
@ -222,14 +220,14 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
.globl GLOBAL(vmInvoke_returnAddress)
|
.globl GLOBAL(vmInvoke_returnAddress)
|
||||||
GLOBAL(vmInvoke_returnAddress):
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
movq THREAD_SCRATCH(%rbx),%rsp
|
movq TARGET_THREAD_SCRATCH(%rbx),%rsp
|
||||||
|
|
||||||
// clear MyThread::stack to avoid confusing another thread calling
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
// java.lang.Thread.getStackTrace on this one. See
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
// a reliable stack trace from a thread that might be interrupted at
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
// any point in its execution.
|
// any point in its execution.
|
||||||
movq $0,THREAD_STACK(%rbx)
|
movq $0,TARGET_THREAD_STACK(%rbx)
|
||||||
|
|
||||||
.globl GLOBAL(vmInvoke_safeStack)
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
GLOBAL(vmInvoke_safeStack):
|
GLOBAL(vmInvoke_safeStack):
|
||||||
@ -299,9 +297,6 @@ LOCAL(vmJumpAndInvoke_argumentTest):
|
|||||||
|
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
|
|
||||||
#define THREAD_STACK 2148
|
|
||||||
#define THREAD_SCRATCH 2156
|
|
||||||
|
|
||||||
#ifdef AVIAN_USE_FRAME_POINTER
|
#ifdef AVIAN_USE_FRAME_POINTER
|
||||||
# define ALIGNMENT_ADJUSTMENT 0
|
# define ALIGNMENT_ADJUSTMENT 0
|
||||||
#else
|
#else
|
||||||
@ -328,7 +323,7 @@ GLOBAL(vmInvoke):
|
|||||||
// remember this stack position, since we won't be able to rely on
|
// remember this stack position, since we won't be able to rely on
|
||||||
// %rbp being restored when the call returns
|
// %rbp being restored when the call returns
|
||||||
movl 8(%ebp),%eax
|
movl 8(%ebp),%eax
|
||||||
movl %esp,THREAD_SCRATCH(%eax)
|
movl %esp,TARGET_THREAD_SCRATCH(%eax)
|
||||||
|
|
||||||
movl %ebx,0(%esp)
|
movl %ebx,0(%esp)
|
||||||
movl %esi,4(%esp)
|
movl %esi,4(%esp)
|
||||||
@ -360,14 +355,14 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
.globl GLOBAL(vmInvoke_returnAddress)
|
.globl GLOBAL(vmInvoke_returnAddress)
|
||||||
GLOBAL(vmInvoke_returnAddress):
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
movl THREAD_SCRATCH(%ebx),%esp
|
movl TARGET_THREAD_SCRATCH(%ebx),%esp
|
||||||
|
|
||||||
// clear MyThread::stack to avoid confusing another thread calling
|
// clear MyThread::stack to avoid confusing another thread calling
|
||||||
// java.lang.Thread.getStackTrace on this one. See
|
// java.lang.Thread.getStackTrace on this one. See
|
||||||
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
// MyProcess::getStackTrace in compile.cpp for details on how we get
|
||||||
// a reliable stack trace from a thread that might be interrupted at
|
// a reliable stack trace from a thread that might be interrupted at
|
||||||
// any point in its execution.
|
// any point in its execution.
|
||||||
movl $0,THREAD_STACK(%ebx)
|
movl $0,TARGET_THREAD_STACK(%ebx)
|
||||||
|
|
||||||
.globl GLOBAL(vmInvoke_safeStack)
|
.globl GLOBAL(vmInvoke_safeStack)
|
||||||
GLOBAL(vmInvoke_safeStack):
|
GLOBAL(vmInvoke_safeStack):
|
||||||
|
@ -1392,7 +1392,7 @@ class Frame {
|
|||||||
return c->add
|
return c->add
|
||||||
(TargetBytesPerWord, c->memory
|
(TargetBytesPerWord, c->memory
|
||||||
(c->register_(t->arch->thread()), Compiler::AddressType,
|
(c->register_(t->arch->thread()), Compiler::AddressType,
|
||||||
TargetThreadHeapImage), c->promiseConstant
|
TARGET_THREAD_HEAPIMAGE), c->promiseConstant
|
||||||
(p, Compiler::AddressType));
|
(p, Compiler::AddressType));
|
||||||
} else {
|
} else {
|
||||||
for (PoolElement* e = context->objectPool; e; e = e->next) {
|
for (PoolElement* e = context->objectPool; e; e = e->next) {
|
||||||
@ -1622,7 +1622,7 @@ class Frame {
|
|||||||
? c->add
|
? c->add
|
||||||
(TargetBytesPerWord, c->memory
|
(TargetBytesPerWord, c->memory
|
||||||
(c->register_(t->arch->thread()), Compiler::AddressType,
|
(c->register_(t->arch->thread()), Compiler::AddressType,
|
||||||
TargetThreadCodeImage), c->promiseConstant
|
TARGET_THREAD_CODEIMAGE), c->promiseConstant
|
||||||
(new(&context->zone)
|
(new(&context->zone)
|
||||||
OffsetPromise
|
OffsetPromise
|
||||||
(p, - reinterpret_cast<intptr_t>(codeAllocator(t)->base)),
|
(p, - reinterpret_cast<intptr_t>(codeAllocator(t)->base)),
|
||||||
@ -1932,8 +1932,7 @@ class Frame {
|
|||||||
subroutine->handle = c->startSubroutine();
|
subroutine->handle = c->startSubroutine();
|
||||||
this->subroutine = subroutine;
|
this->subroutine = subroutine;
|
||||||
|
|
||||||
SubroutineCall* call = new
|
SubroutineCall* call = new(&context->zone)
|
||||||
(context->zone.allocate(sizeof(SubroutineCall)))
|
|
||||||
SubroutineCall(subroutine, returnAddress);
|
SubroutineCall(subroutine, returnAddress);
|
||||||
|
|
||||||
context->eventLog.append(PushSubroutineEvent);
|
context->eventLog.append(PushSubroutineEvent);
|
||||||
@ -3380,7 +3379,7 @@ compileDirectInvoke(MyThread* t, Frame* frame, object target, bool tailCall,
|
|||||||
frame->absoluteAddressOperand(returnAddressPromise),
|
frame->absoluteAddressOperand(returnAddressPromise),
|
||||||
TargetBytesPerWord, c->memory
|
TargetBytesPerWord, c->memory
|
||||||
(c->register_(t->arch->thread()), Compiler::AddressType,
|
(c->register_(t->arch->thread()), Compiler::AddressType,
|
||||||
TargetThreadTailAddress));
|
TARGET_THREAD_TAILADDRESS));
|
||||||
|
|
||||||
c->exit
|
c->exit
|
||||||
(c->constant
|
(c->constant
|
||||||
@ -5563,7 +5562,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
(context->bootContext ? c->add
|
(context->bootContext ? c->add
|
||||||
(TargetBytesPerWord, c->memory
|
(TargetBytesPerWord, c->memory
|
||||||
(c->register_(t->arch->thread()), Compiler::AddressType,
|
(c->register_(t->arch->thread()), Compiler::AddressType,
|
||||||
TargetThreadCodeImage), address)
|
TARGET_THREAD_CODEIMAGE), address)
|
||||||
: address);
|
: address);
|
||||||
|
|
||||||
Compiler::State* state = c->saveState();
|
Compiler::State* state = c->saveState();
|
||||||
@ -6110,7 +6109,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
|||||||
? c->add
|
? c->add
|
||||||
(TargetBytesPerWord, c->memory
|
(TargetBytesPerWord, c->memory
|
||||||
(c->register_(t->arch->thread()), Compiler::AddressType,
|
(c->register_(t->arch->thread()), Compiler::AddressType,
|
||||||
TargetThreadCodeImage), entry)
|
TARGET_THREAD_CODEIMAGE), entry)
|
||||||
: entry,
|
: entry,
|
||||||
TargetBytesPerWord));
|
TargetBytesPerWord));
|
||||||
|
|
||||||
@ -7033,7 +7032,7 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
|
|||||||
// of cycles if another thread compiles the same method in parallel,
|
// of cycles if another thread compiles the same method in parallel,
|
||||||
// which might be mitigated by fine-grained, per-method locking):
|
// which might be mitigated by fine-grained, per-method locking):
|
||||||
c->compile(context->leaf ? 0 : stackOverflowThunk(t),
|
c->compile(context->leaf ? 0 : stackOverflowThunk(t),
|
||||||
TargetThreadStackLimit);
|
TARGET_THREAD_STACKLIMIT);
|
||||||
|
|
||||||
// we must acquire the class lock here at the latest
|
// we must acquire the class lock here at the latest
|
||||||
|
|
||||||
@ -8529,6 +8528,16 @@ public:
|
|||||||
Processor::CompilationHandler* handler;
|
Processor::CompilationHandler* handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T, class C>
|
||||||
|
int checkConstant(MyThread* t, size_t expected, T C::* field, const char* name) {
|
||||||
|
size_t actual = reinterpret_cast<uint8_t*>(&(t->*field)) - reinterpret_cast<uint8_t*>(t);
|
||||||
|
if(expected != actual) {
|
||||||
|
fprintf(stderr, "constant mismatch (%s): \n\tconstant says: %d\n\tc++ compiler says: %d\n", name, (unsigned) expected, (unsigned) actual);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
class MyProcessor: public Processor {
|
class MyProcessor: public Processor {
|
||||||
public:
|
public:
|
||||||
class Thunk {
|
class Thunk {
|
||||||
@ -8605,38 +8614,25 @@ class MyProcessor: public Processor {
|
|||||||
t->codeImage = codeImage;
|
t->codeImage = codeImage;
|
||||||
t->thunkTable = thunkTable;
|
t->thunkTable = thunkTable;
|
||||||
|
|
||||||
if (false) {
|
int mismatches =
|
||||||
fprintf(stderr, "stack %d\n",
|
checkConstant(t, TARGET_THREAD_EXCEPTION, &Thread::exception, "TARGET_THREAD_EXCEPTION") +
|
||||||
difference(&(t->stack), t));
|
checkConstant(t, TARGET_THREAD_EXCEPTIONSTACKADJUSTMENT, &MyThread::exceptionStackAdjustment, "TARGET_THREAD_EXCEPTIONSTACKADJUSTMENT") +
|
||||||
fprintf(stderr, "scratch %d\n",
|
checkConstant(t, TARGET_THREAD_EXCEPTIONOFFSET, &MyThread::exceptionOffset, "TARGET_THREAD_EXCEPTIONOFFSET") +
|
||||||
difference(&(t->scratch), t));
|
checkConstant(t, TARGET_THREAD_EXCEPTIONHANDLER, &MyThread::exceptionHandler, "TARGET_THREAD_EXCEPTIONHANDLER") +
|
||||||
fprintf(stderr, "continuation %d\n",
|
checkConstant(t, TARGET_THREAD_IP, &MyThread::ip, "TARGET_THREAD_IP") +
|
||||||
difference(&(t->continuation), t));
|
checkConstant(t, TARGET_THREAD_STACK, &MyThread::stack, "TARGET_THREAD_STACK") +
|
||||||
fprintf(stderr, "exception %d\n",
|
checkConstant(t, TARGET_THREAD_NEWSTACK, &MyThread::newStack, "TARGET_THREAD_NEWSTACK") +
|
||||||
difference(&(t->exception), t));
|
checkConstant(t, TARGET_THREAD_TAILADDRESS, &MyThread::tailAddress, "TARGET_THREAD_TAILADDRESS") +
|
||||||
fprintf(stderr, "exceptionStackAdjustment %d\n",
|
checkConstant(t, TARGET_THREAD_VIRTUALCALLTARGET, &MyThread::virtualCallTarget, "TARGET_THREAD_VIRTUALCALLTARGET") +
|
||||||
difference(&(t->exceptionStackAdjustment), t));
|
checkConstant(t, TARGET_THREAD_VIRTUALCALLINDEX, &MyThread::virtualCallIndex, "TARGET_THREAD_VIRTUALCALLINDEX") +
|
||||||
fprintf(stderr, "exceptionOffset %d\n",
|
checkConstant(t, TARGET_THREAD_HEAPIMAGE, &MyThread::heapImage, "TARGET_THREAD_HEAPIMAGE") +
|
||||||
difference(&(t->exceptionOffset), t));
|
checkConstant(t, TARGET_THREAD_CODEIMAGE, &MyThread::codeImage, "TARGET_THREAD_CODEIMAGE") +
|
||||||
fprintf(stderr, "exceptionHandler %d\n",
|
checkConstant(t, TARGET_THREAD_THUNKTABLE, &MyThread::thunkTable, "TARGET_THREAD_THUNKTABLE") +
|
||||||
difference(&(t->exceptionHandler), t));
|
checkConstant(t, TARGET_THREAD_STACKLIMIT, &MyThread::stackLimit, "TARGET_THREAD_STACKLIMIT");
|
||||||
fprintf(stderr, "tailAddress %d\n",
|
|
||||||
difference(&(t->tailAddress), t));
|
if(mismatches > 0) {
|
||||||
fprintf(stderr, "stackLimit %d\n",
|
fprintf(stderr, "%d constant mismatches\n", mismatches);
|
||||||
difference(&(t->stackLimit), t));
|
abort(t);
|
||||||
fprintf(stderr, "ip %d\n",
|
|
||||||
difference(&(t->ip), t));
|
|
||||||
fprintf(stderr, "virtualCallTarget %d\n",
|
|
||||||
difference(&(t->virtualCallTarget), t));
|
|
||||||
fprintf(stderr, "virtualCallIndex %d\n",
|
|
||||||
difference(&(t->virtualCallIndex), t));
|
|
||||||
fprintf(stderr, "heapImage %d\n",
|
|
||||||
difference(&(t->heapImage), t));
|
|
||||||
fprintf(stderr, "codeImage %d\n",
|
|
||||||
difference(&(t->codeImage), t));
|
|
||||||
fprintf(stderr, "thunkTable %d\n",
|
|
||||||
difference(&(t->thunkTable), t));
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t->init();
|
t->init();
|
||||||
@ -9801,7 +9797,7 @@ compileCall(MyThread* t, Context* c, ThunkIndex index, bool call = true)
|
|||||||
Assembler* a = c->assembler;
|
Assembler* a = c->assembler;
|
||||||
|
|
||||||
if (processor(t)->bootImage) {
|
if (processor(t)->bootImage) {
|
||||||
Assembler::Memory table(t->arch->thread(), TargetThreadThunkTable);
|
Assembler::Memory table(t->arch->thread(), TARGET_THREAD_THUNKTABLE);
|
||||||
Assembler::Register scratch(t->arch->scratch());
|
Assembler::Register scratch(t->arch->scratch());
|
||||||
a->apply(Move, TargetBytesPerWord, MemoryOperand, &table,
|
a->apply(Move, TargetBytesPerWord, MemoryOperand, &table,
|
||||||
TargetBytesPerWord, RegisterOperand, &scratch);
|
TargetBytesPerWord, RegisterOperand, &scratch);
|
||||||
@ -9827,7 +9823,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
{ Context context(t);
|
{ Context context(t);
|
||||||
Assembler* a = context.assembler;
|
Assembler* a = context.assembler;
|
||||||
|
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.default_.frameSavedOffset = a->length();
|
p->thunks.default_.frameSavedOffset = a->length();
|
||||||
|
|
||||||
@ -9860,19 +9856,19 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
TargetBytesPerWord, RegisterOperand, &class_);
|
TargetBytesPerWord, RegisterOperand, &class_);
|
||||||
|
|
||||||
Assembler::Memory virtualCallTargetDst
|
Assembler::Memory virtualCallTargetDst
|
||||||
(t->arch->thread(), TargetThreadVirtualCallTarget);
|
(t->arch->thread(), TARGET_THREAD_VIRTUALCALLTARGET);
|
||||||
|
|
||||||
a->apply(Move, TargetBytesPerWord, RegisterOperand, &class_,
|
a->apply(Move, TargetBytesPerWord, RegisterOperand, &class_,
|
||||||
TargetBytesPerWord, MemoryOperand, &virtualCallTargetDst);
|
TargetBytesPerWord, MemoryOperand, &virtualCallTargetDst);
|
||||||
|
|
||||||
Assembler::Register index(t->arch->virtualCallIndex());
|
Assembler::Register index(t->arch->virtualCallIndex());
|
||||||
Assembler::Memory virtualCallIndex
|
Assembler::Memory virtualCallIndex
|
||||||
(t->arch->thread(), TargetThreadVirtualCallIndex);
|
(t->arch->thread(), TARGET_THREAD_VIRTUALCALLINDEX);
|
||||||
|
|
||||||
a->apply(Move, TargetBytesPerWord, RegisterOperand, &index,
|
a->apply(Move, TargetBytesPerWord, RegisterOperand, &index,
|
||||||
TargetBytesPerWord, MemoryOperand, &virtualCallIndex);
|
TargetBytesPerWord, MemoryOperand, &virtualCallIndex);
|
||||||
|
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.defaultVirtual.frameSavedOffset = a->length();
|
p->thunks.defaultVirtual.frameSavedOffset = a->length();
|
||||||
|
|
||||||
@ -9895,7 +9891,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
{ Context context(t);
|
{ Context context(t);
|
||||||
Assembler* a = context.assembler;
|
Assembler* a = context.assembler;
|
||||||
|
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.native.frameSavedOffset = a->length();
|
p->thunks.native.frameSavedOffset = a->length();
|
||||||
|
|
||||||
@ -9905,7 +9901,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
compileCall(t, &context, invokeNativeIndex);
|
compileCall(t, &context, invokeNativeIndex);
|
||||||
|
|
||||||
a->popFrameAndUpdateStackAndReturn
|
a->popFrameAndUpdateStackAndReturn
|
||||||
(t->arch->alignFrameSize(1), TargetThreadNewStack);
|
(t->arch->alignFrameSize(1), TARGET_THREAD_NEWSTACK);
|
||||||
|
|
||||||
p->thunks.native.length = a->endBlock(false)->resolve(0, 0);
|
p->thunks.native.length = a->endBlock(false)->resolve(0, 0);
|
||||||
|
|
||||||
@ -9916,7 +9912,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
{ Context context(t);
|
{ Context context(t);
|
||||||
Assembler* a = context.assembler;
|
Assembler* a = context.assembler;
|
||||||
|
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.aioob.frameSavedOffset = a->length();
|
p->thunks.aioob.frameSavedOffset = a->length();
|
||||||
|
|
||||||
@ -9934,7 +9930,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
{ Context context(t);
|
{ Context context(t);
|
||||||
Assembler* a = context.assembler;
|
Assembler* a = context.assembler;
|
||||||
|
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.stackOverflow.frameSavedOffset = a->length();
|
p->thunks.stackOverflow.frameSavedOffset = a->length();
|
||||||
|
|
||||||
@ -9952,7 +9948,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
{ { Context context(t);
|
{ { Context context(t);
|
||||||
Assembler* a = context.assembler;
|
Assembler* a = context.assembler;
|
||||||
|
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.table.frameSavedOffset = a->length();
|
p->thunks.table.frameSavedOffset = a->length();
|
||||||
|
|
||||||
@ -9971,7 +9967,7 @@ compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
Context context(t); \
|
Context context(t); \
|
||||||
Assembler* a = context.assembler; \
|
Assembler* a = context.assembler; \
|
||||||
\
|
\
|
||||||
a->saveFrame(TargetThreadStack, TargetThreadIp); \
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP); \
|
||||||
\
|
\
|
||||||
p->thunks.table.frameSavedOffset = a->length(); \
|
p->thunks.table.frameSavedOffset = a->length(); \
|
||||||
\
|
\
|
||||||
|
63
src/target-fields.h
Normal file
63
src/target-fields.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/* Copyright (c) 2011, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
#ifndef AVIAN_TARGET_FIELDS_H
|
||||||
|
#define AVIAN_TARGET_FIELDS_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef TARGET_BYTES_PER_WORD
|
||||||
|
# if (TARGET_BYTES_PER_WORD == 8)
|
||||||
|
|
||||||
|
#define TARGET_THREAD_EXCEPTION 80
|
||||||
|
#define TARGET_THREAD_EXCEPTIONSTACKADJUSTMENT 2256
|
||||||
|
#define TARGET_THREAD_EXCEPTIONOFFSET 2264
|
||||||
|
#define TARGET_THREAD_EXCEPTIONHANDLER 2272
|
||||||
|
|
||||||
|
#define TARGET_THREAD_IP 2216
|
||||||
|
#define TARGET_THREAD_STACK 2224
|
||||||
|
#define TARGET_THREAD_NEWSTACK 2232
|
||||||
|
#define TARGET_THREAD_SCRATCH 2240
|
||||||
|
#define TARGET_THREAD_CONTINUATION 2248
|
||||||
|
#define TARGET_THREAD_TAILADDRESS 2280
|
||||||
|
#define TARGET_THREAD_VIRTUALCALLTARGET 2288
|
||||||
|
#define TARGET_THREAD_VIRTUALCALLINDEX 2296
|
||||||
|
#define TARGET_THREAD_HEAPIMAGE 2304
|
||||||
|
#define TARGET_THREAD_CODEIMAGE 2312
|
||||||
|
#define TARGET_THREAD_THUNKTABLE 2320
|
||||||
|
#define TARGET_THREAD_STACKLIMIT 2368
|
||||||
|
|
||||||
|
# elif (TARGET_BYTES_PER_WORD == 4)
|
||||||
|
|
||||||
|
#define TARGET_THREAD_EXCEPTION 44
|
||||||
|
#define TARGET_THREAD_EXCEPTIONSTACKADJUSTMENT 2164
|
||||||
|
#define TARGET_THREAD_EXCEPTIONOFFSET 2168
|
||||||
|
#define TARGET_THREAD_EXCEPTIONHANDLER 2172
|
||||||
|
|
||||||
|
#define TARGET_THREAD_IP 2144
|
||||||
|
#define TARGET_THREAD_STACK 2148
|
||||||
|
#define TARGET_THREAD_NEWSTACK 2152
|
||||||
|
#define TARGET_THREAD_SCRATCH 2156
|
||||||
|
#define TARGET_THREAD_CONTINUATION 2160
|
||||||
|
#define TARGET_THREAD_TAILADDRESS 2176
|
||||||
|
#define TARGET_THREAD_VIRTUALCALLTARGET 2180
|
||||||
|
#define TARGET_THREAD_VIRTUALCALLINDEX 2184
|
||||||
|
#define TARGET_THREAD_HEAPIMAGE 2188
|
||||||
|
#define TARGET_THREAD_CODEIMAGE 2192
|
||||||
|
#define TARGET_THREAD_THUNKTABLE 2196
|
||||||
|
#define TARGET_THREAD_STACKLIMIT 2220
|
||||||
|
|
||||||
|
# else
|
||||||
|
# error
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# error
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
30
src/target.h
30
src/target.h
@ -11,6 +11,8 @@
|
|||||||
#ifndef TARGET_H
|
#ifndef TARGET_H
|
||||||
#define TARGET_H
|
#define TARGET_H
|
||||||
|
|
||||||
|
#include "target-fields.h"
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -90,19 +92,6 @@ targetVW(T v)
|
|||||||
typedef uint64_t target_uintptr_t;
|
typedef uint64_t target_uintptr_t;
|
||||||
typedef int64_t target_intptr_t;
|
typedef int64_t target_intptr_t;
|
||||||
|
|
||||||
const unsigned TargetBytesPerWord = 8;
|
|
||||||
|
|
||||||
const unsigned TargetThreadIp = 2216;
|
|
||||||
const unsigned TargetThreadStack = 2224;
|
|
||||||
const unsigned TargetThreadNewStack = 2232;
|
|
||||||
const unsigned TargetThreadTailAddress = 2280;
|
|
||||||
const unsigned TargetThreadVirtualCallTarget = 2288;
|
|
||||||
const unsigned TargetThreadVirtualCallIndex = 2296;
|
|
||||||
const unsigned TargetThreadHeapImage = 2304;
|
|
||||||
const unsigned TargetThreadCodeImage = 2312;
|
|
||||||
const unsigned TargetThreadThunkTable = 2320;
|
|
||||||
const unsigned TargetThreadStackLimit = 2368;
|
|
||||||
|
|
||||||
const unsigned TargetClassFixedSize = 12;
|
const unsigned TargetClassFixedSize = 12;
|
||||||
const unsigned TargetClassArrayElementSize = 14;
|
const unsigned TargetClassArrayElementSize = 14;
|
||||||
const unsigned TargetClassVtable = 128;
|
const unsigned TargetClassVtable = 128;
|
||||||
@ -121,19 +110,6 @@ targetVW(T v)
|
|||||||
typedef uint32_t target_uintptr_t;
|
typedef uint32_t target_uintptr_t;
|
||||||
typedef int32_t target_intptr_t;
|
typedef int32_t target_intptr_t;
|
||||||
|
|
||||||
const unsigned TargetBytesPerWord = 4;
|
|
||||||
|
|
||||||
const unsigned TargetThreadIp = 2144;
|
|
||||||
const unsigned TargetThreadStack = 2148;
|
|
||||||
const unsigned TargetThreadNewStack = 2152;
|
|
||||||
const unsigned TargetThreadTailAddress = 2176;
|
|
||||||
const unsigned TargetThreadVirtualCallTarget = 2180;
|
|
||||||
const unsigned TargetThreadVirtualCallIndex = 2184;
|
|
||||||
const unsigned TargetThreadHeapImage = 2188;
|
|
||||||
const unsigned TargetThreadCodeImage = 2192;
|
|
||||||
const unsigned TargetThreadThunkTable = 2196;
|
|
||||||
const unsigned TargetThreadStackLimit = 2220;
|
|
||||||
|
|
||||||
const unsigned TargetClassFixedSize = 8;
|
const unsigned TargetClassFixedSize = 8;
|
||||||
const unsigned TargetClassArrayElementSize = 10;
|
const unsigned TargetClassArrayElementSize = 10;
|
||||||
const unsigned TargetClassVtable = 68;
|
const unsigned TargetClassVtable = 68;
|
||||||
@ -147,6 +123,8 @@ const unsigned TargetFieldOffset = 8;
|
|||||||
# error
|
# error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const unsigned TargetBytesPerWord = TARGET_BYTES_PER_WORD;
|
||||||
|
|
||||||
const unsigned TargetBitsPerWord = TargetBytesPerWord * 8;
|
const unsigned TargetBitsPerWord = TargetBytesPerWord * 8;
|
||||||
|
|
||||||
const target_uintptr_t TargetPointerMask
|
const target_uintptr_t TargetPointerMask
|
||||||
|
Loading…
Reference in New Issue
Block a user