return_stack placed on stack, this allows for reentry and no TLS switch for threads; makes more sense
This commit is contained in:
parent
d97dcff494
commit
0d5bd46412
@ -31,8 +31,6 @@ const int = @import("../../interpreter.zig");
|
|||||||
const Word = int.Word;
|
const Word = int.Word;
|
||||||
pub const RecursionLimit = int.RecursionLimit;
|
pub const RecursionLimit = int.RecursionLimit;
|
||||||
|
|
||||||
threadlocal var return_stack: [RecursionLimit + 1]Word = undefined;
|
|
||||||
|
|
||||||
// todo: Variant that pushes array of words.
|
// todo: Variant that pushes array of words.
|
||||||
/// (iw | -- iw)
|
/// (iw | -- iw)
|
||||||
pub fn opPushWord() callconv(.Naked) noreturn {
|
pub fn opPushWord() callconv(.Naked) noreturn {
|
||||||
@ -117,7 +115,6 @@ pub fn opReturn() callconv(.Naked) noreturn {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: Make sure it's non reentry in one given thread.
|
|
||||||
// todo: Allow passing initial stack via array of words.
|
// todo: Allow passing initial stack via array of words.
|
||||||
// todo: Ensure correctness.
|
// todo: Ensure correctness.
|
||||||
// todo: Use remaining stack as return.
|
// todo: Use remaining stack as return.
|
||||||
@ -127,6 +124,8 @@ pub fn execute(binary: []const Word, entry_addr: usize) void {
|
|||||||
// https://wiki.osdev.org/System_V_ABI
|
// https://wiki.osdev.org/System_V_ABI
|
||||||
@setCold(true);
|
@setCold(true);
|
||||||
|
|
||||||
|
var return_stack: [RecursionLimit + 1]Word = undefined;
|
||||||
|
|
||||||
// Such device is used so that opReturn could be used for return.
|
// Such device is used so that opReturn could be used for return.
|
||||||
asm volatile (
|
asm volatile (
|
||||||
\\ movq $0f, 8(%%r13)
|
\\ movq $0f, 8(%%r13)
|
||||||
|
Loading…
Reference in New Issue
Block a user