-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whamm intrinsification baseline (wasm to wasm call) #222
Changes from 2 commits
669fcb7
efd42e6
68b4d8a
bbf412f
356d761
99b4168
b903e24
fa1e130
71b9eb2
58d63d0
9fbfdb4
35312bb
214b783
e4ee322
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,19 @@ class X86_64MacroAssembler extends MacroAssembler { | |
var jump_tables: Vector<(int, Array<X86_64Label>)>; | ||
var offsets: V3Offsets; | ||
var trap_stubs: X86_64SpcTrapsStub; | ||
var last_code_print_at = 0; | ||
|
||
new(w, regConfig: RegConfig) super(Target.tagging, regConfig) { | ||
scratch = G(regConfig.scratch); | ||
} | ||
|
||
def printCodeBytes(sb: StringBuilder) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a little more local state; how about keeping track of the offset of the bytecode start in the SPC? Partially because we should consider saving that for use at runtime, e.g. to compute the PC at frame walking instead of storing it as is done now. |
||
var w_offset = w.end(); | ||
while (last_code_print_at < w_offset) { | ||
sb.put1("%x ", w.data[last_code_print_at]); | ||
last_code_print_at++; | ||
} | ||
sb.ln(); | ||
} | ||
def curCodeBytes() -> u64 { | ||
return u64.!(w.end()); | ||
} | ||
|
@@ -761,6 +769,9 @@ class X86_64MacroAssembler extends MacroAssembler { | |
def emit_call_runtime_Probe_instr() { | ||
emit_call_runtime(RT.runtime_PROBE_instr); | ||
} | ||
def emit_call_runtime_materialize_frame_accessor() { | ||
emit_call_runtime(RT.runtime_materialize_frame_accessor); | ||
} | ||
private def emit_call_runtime<P, R>(closure: P -> R) { | ||
var ptr = CiRuntime.unpackClosure<X86_64Interpreter, P, R>(closure).0; | ||
// Do an absolute call into the runtime | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,11 @@ component X86_64Runtime { | |
if (ret != null) return stack.throw(ret); | ||
return ret; | ||
} | ||
def runtime_materialize_frame_accessor() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about calling this |
||
var rsp = CiRuntime.callerSp(); | ||
var frame = TargetFrame(rsp); | ||
frame.getFrameAccessor().getMetaRef(); | ||
} | ||
def runtime_TRAP(func: WasmFunction, pc: int, reason: TrapReason) -> Throwable { | ||
var rsp = CiRuntime.callerSp(); | ||
var stack = curStack.setRsp(rsp); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,13 @@ component Target { | |
if (Trace.compiler) { | ||
Trace.OUT.put2("func[%d].target_code: break *0x%x", f.func_index, addr - Pointer.NULL) | ||
.put2(" disass 0x%x, 0x%x", addr - Pointer.NULL, end - Pointer.NULL).ln(); | ||
var cur_byte = addr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about guarding this behind a new trace flag |
||
Trace.OUT.puts("JIT code: "); | ||
while (cur_byte < end) { | ||
Trace.OUT.put1("%x ", cur_byte.load<u8>()); | ||
cur_byte++; | ||
} | ||
Trace.OUT.ln(); | ||
} | ||
f.target_code = TargetCode(addr); | ||
Debug.afterCompile(f, u64.view(addr - Pointer.NULL)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes debugging easier, since we can see the exact assembly generated for each opcode