Hacker News new | past | comments | ask | show | jobs | submit login

Thank you for your ideas and thoughts.

This might be relevant - I've been playing around with some assembly to unwind the stack, but it occurred to me I don't need to pop the stack to scan through it. So like C++ exception handling (I learned about it in the Itanium C++ ABI) or algebraic effects, you can scan memory if you have access to the stack start in memory (I do that by storing the rsp somewhere in .global main) in theory it's just data.

I need to generate sections of lookup data for range information for associating .text code section addresses with function names.

In theory this would also be useful for coroutines since a coroutine position/state is just a program counter position of code that you can JMP to in your yield function (that isn't a call but an offset)

To move a coroutine from one thread to another or another machine over the network or persist to disk, let me think. We could do what C++ coroutines does and have a promise struct object that is presumably on the stack when a coroutine resumes by jumping to that coroutines location.

I think the hard part is being stackless and persisting the current coroutine state. You could mov $CURRENT_POSITION_COMPILER_DETERMINED_OFFSET into -10(%rbp) that promise object and then when the coroutine resumes it does a JMP COROUTINE_BODY(%rip) + -10(%rbp) in a label before the coroutine body.

I am a beginner to assembly programming but here is my program: https://github.com/samsquire/assembly/blob/main/stackunwind....




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: