return_stack placed on stack, this allows for reentry and no TLS switch for threads; makes more sense

This commit is contained in:
veclav talica 2023-09-19 11:57:53 +05:00
parent d97dcff494
commit 0d5bd46412

View File

@ -31,8 +31,6 @@ const int = @import("../../interpreter.zig");
const Word = int.Word;
pub const RecursionLimit = int.RecursionLimit;
threadlocal var return_stack: [RecursionLimit + 1]Word = undefined;
// todo: Variant that pushes array of words.
/// (iw | -- iw)
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: Ensure correctness.
// 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
@setCold(true);
var return_stack: [RecursionLimit + 1]Word = undefined;
// Such device is used so that opReturn could be used for return.
asm volatile (
\\ movq $0f, 8(%%r13)