-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
dev backend: roc panic #5699
dev backend: roc panic #5699
Conversation
1dd8b8a
to
f65a2db
Compare
Here are the results of that test running on my Windows machine.
|
ah yes it's probably a good idea to give a status update here:
On linux we can use the two return registers to send this information over to the |
// a *const RocStr | ||
let roc_str_ptr = R11; | ||
ASM::mov_reg64_imm64(buf, roc_str_ptr, 16 + 24); // 24 is width of a rocstr | ||
ASM::add_reg64_reg64_reg64(buf, roc_str_ptr, roc_str_ptr, RSP); |
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.
can you shed a light on the constants here? maybe it is related to
argument_offset: X86_64WindowsFastcall::SHADOW_SPACE_SIZE as i32 + 16,
?
// move the first argument to roc_panic (a *RocStr) into r8 | ||
ASM::add_reg64_reg64_imm32(buf, R8, RSP, 8); |
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.
the 8
is kind of a magic constant here...
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.
Skips over the return address on the stack?
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.
Looks great! exciting to see this working.
&mut backend, | ||
&mut output, | ||
"roc_getppid".into(), | ||
"malloc".into(), |
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.
wrapping malloc?
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.
yeah, roc_getppid
was used somehow in the builtins (I think)? so we needed to provide the symbol. I'll dig into this a bit, because it should not be required
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 suspect it is these functions from expect.zig
extern fn roc_shm_open(name: *const i8, oflag: c_int, mode: c_uint) c_int;
extern fn roc_mmap(addr: ?*anyopaque, length: c_uint, prot: c_int, flags: c_int, fd: c_int, offset: c_uint) *anyopaque;
extern fn roc_getppid() c_int;
// move the first argument to roc_panic (a *RocStr) into r8 | ||
ASM::add_reg64_reg64_imm32(buf, R8, RSP, 8); |
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.
Skips over the return address on the stack?
proof of concept of roc_panic. I think a
crash
is the only thing that panics at the moment though, so still some work left to do after this to really get parity.