generator-rs icon indicating copy to clipboard operation
generator-rs copied to clipboard

Any way to get stack start of generator?

Open playXE opened this issue 1 year ago • 7 comments

Hello! How do I get stack start of generator? I need this for conservative roots in my GC

playXE avatar Jun 07 '23 14:06 playXE

The Generator::into_raw API would return the internal stack memory pointer.

The Generator::from_raw API would convert from stack pointer back to Generator

Xudong-Huang avatar Jun 10 '23 13:06 Xudong-Huang

Thanks! Would it also be possible to get saved context registers?

playXE avatar Jun 12 '23 07:06 playXE

Actually the start of the stack memory is the saved context.

Xudong-Huang avatar Jun 12 '23 08:06 Xudong-Huang

Actually the start of the stack memory is the saved context.

I am a little bit confused about this? Should I still use into_raw? Also, does the pointer returned by into_raw contain registers that are saved during context switch?

playXE avatar Jun 15 '23 05:06 playXE

The memory looks like this: fixed size context memory(including saved registers) + real generator function stack. Yes, you should use into_raw, the pointer of the memory contains every thing needed to save.

Xudong-Huang avatar Jun 24 '23 08:06 Xudong-Huang

The memory looks like this: fixed size context memory(including saved registers) + real generator function stack. Yes, you should use into_raw, the pointer of the memory contains every thing needed to save.

Alright, but how do I get the size of that pointer as well? I need to tell my GC the size for proper processing

playXE avatar Jun 25 '23 19:06 playXE

The memory looks like this: fixed size context memory(including saved registers) + real generator function stack. Yes, you should use into_raw, the pointer of the memory contains every thing needed to save.

Alright, but how do I get the size of that pointer as well? I need to tell my GC the size for proper processing. Looking at what it returns it does not look like it actually provides full access to full context information, I actually need to calculate offsets into GeneratorImpl?

playXE avatar Jun 25 '23 19:06 playXE