From 0d5bd46412ad1b9203c50fea1bbfa824b35c3615 Mon Sep 17 00:00:00 2001 From: veclav talica Date: Tue, 19 Sep 2023 11:57:53 +0500 Subject: [PATCH] return_stack placed on stack, this allows for reentry and no TLS switch for threads; makes more sense --- src/arch/x86-64/jedino-jedro.zig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/arch/x86-64/jedino-jedro.zig b/src/arch/x86-64/jedino-jedro.zig index 9b5b15d..b9095a6 100644 --- a/src/arch/x86-64/jedino-jedro.zig +++ b/src/arch/x86-64/jedino-jedro.zig @@ -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)