flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > RSP usage by Menuet |
Author |
|
f0dder 11 Dec 2012, 07:24
Hm,
why do such a scheme? Fair enough if it's just for the heck of playing around... but it's going to be slow & bulky compared to other solutions. |
|||
11 Dec 2012, 07:24 |
|
Hugh Aguilar 12 Dec 2012, 02:49
f0dder wrote: Hm, Well, it seemed pretty cool when I first heard about it (I've been programming in Forth for a long time, but I had never heard of stack-threading before, which I thought was remarkable). I have my doubts about it now though, which is why I went with a more traditional approach (using RSI as the IP) instead. The advantage is that NEXT is just a single RET instruction, which is very fast. That is faster than subroutine-threading, in which NEXT is essentially a CALL and a RET. These are the disadvantages: 1.) Like all DTC (direct-threaded-code) system, the docolon code is scattered all over the place, so it will almost never be in the code cache when it gets jumped to. By comparison, with ITC (indirect-threaded-code), which I switched to instead, there is only one docolon function --- the whole VM can fit inside of the 32KB code cache. 2.) The threaded code is bulky because all of the pointers are 64-bit (in 64-bit mode, this is required by RET). With any other approach (other than subroutine-threading), the pointers can be 32-bit even in 64-bit mode, which halves the program size. We want the colon words to fit in a single 64 byte page if possible, to reduce cache thrashing. 3.) The pointers are all absolute addresses, so we can't have binary overlays. #3 is really why I dropped the idea of stack-threading for my current project, as I want to have overlays --- primarily so the users can distribute libraries of code without also distributing the source-code. What do you suggest for a threading scheme? Also, if I did experiment with stack-threading, can I be sure that the OS won't clobber memory under RSP? I don't want to start with stack-threading at all, unless I can be sure of this, so I don't get the rug pulled out from under me. The whole point of this project is for it to be a cross-compiler. This is for micro-controllers such as the PIC24. After I get the cross-compiler to work though, I might try targeting the x86 itself --- I could experiment with different threading schemes fairly easily at that time, as the whole cross-compiler framework would already be there. |
|||
12 Dec 2012, 02:49 |
|
Ville 13 Dec 2012, 09:21
Menuet uses separate stack and address space for interrupts and system calls, which doesn't interfere with application memory and stack.
|
|||
13 Dec 2012, 09:21 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.