Mirror IP and RSP regs in memory
This will allow the profiler to sample the current return stack and instruction pointer. It can't just use the ip and rsp globals directly, as I had initially planned, since these cannot be sent in between threads.
This commit is contained in:
10
wipforth.ws
10
wipforth.ws
@@ -9,6 +9,9 @@
|
|||||||
.def RXHEAD 48h
|
.def RXHEAD 48h
|
||||||
.def RXTAIL 4Ch
|
.def RXTAIL 4Ch
|
||||||
|
|
||||||
|
;; Mirror of registers for profiler to sample
|
||||||
|
.def PROF_DATA 58h
|
||||||
|
|
||||||
.def DICT_START 0200h
|
.def DICT_START 0200h
|
||||||
|
|
||||||
.def RSP_INIT 10000h
|
.def RSP_INIT 10000h
|
||||||
@@ -2073,6 +2076,13 @@ KERNEL_DEFS_END:
|
|||||||
.func trampoline
|
.func trampoline
|
||||||
loop iter
|
loop iter
|
||||||
global.get fn call_indirect codeword codewords
|
global.get fn call_indirect codeword codewords
|
||||||
|
|
||||||
|
i32.const PROF_DATA
|
||||||
|
global.get ip i64.extend_i32_u
|
||||||
|
global.get rsp i64.extend_i32_u
|
||||||
|
i64.const 32 i64.shl i64.or
|
||||||
|
i64.atomic.store 3 0
|
||||||
|
|
||||||
global.get run br_if iter
|
global.get run br_if iter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user