Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to get stack start of generator? #43

Open
playXE opened this issue Jun 7, 2023 · 7 comments
Open

Any way to get stack start of generator? #43

playXE opened this issue Jun 7, 2023 · 7 comments

Comments

@playXE
Copy link

playXE commented Jun 7, 2023

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

@Xudong-Huang
Copy link
Owner

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

@playXE
Copy link
Author

playXE commented Jun 12, 2023

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

@Xudong-Huang
Copy link
Owner

Xudong-Huang commented Jun 12, 2023

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

@playXE
Copy link
Author

playXE commented Jun 15, 2023

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?

@Xudong-Huang
Copy link
Owner

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.

@playXE
Copy link
Author

playXE commented Jun 25, 2023

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
Copy link
Author

playXE commented Jun 25, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants