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

Loom: Basic continuation entry and yield support #15177

Closed
tajila opened this issue Jun 1, 2022 · 0 comments · Fixed by #15434
Closed

Loom: Basic continuation entry and yield support #15177

tajila opened this issue Jun 1, 2022 · 0 comments · Fixed by #15434
Assignees
Labels
comp:vm project:loom Used to track Project Loom related work
Milestone

Comments

@tajila
Copy link
Contributor

tajila commented Jun 1, 2022

Depends on #15172 and #15176

Create a J9VMContinuation

  • allocate J9VMContinuation, perhaps out of pool
    • optionally add deadContinuationThreadList and use recycled ones 
  • allocate java stack for J9VMContinuation
    • optionally allocate from pool as well
  • add to continuation continuationlist
  • assign J9VMContinuation to continuationObject->vmref
  • register j9vmcontinuation with GC
  • initialize J9VMContinuation interpreter fields

Enter operation

  • set bit on j9vmthread->privateFlags to indicate running VirtualThread
  • build call-in frame (if not started)
  • swap carrierthread interpreter state with continuation
  • set currentContinuation on carrier thread to new Continuation
  • call into Continuation entry, if starting new
    • resume state otherwise
  • once complete set continuation to finished
  • unset vmref in Continuation instance and free/recycle j9VMcontinuation
  • unset bit on j9vmthread->privateFlags

Yield operation

  • check if pinned, posssibly assert if true (JCL should not attempt unmount if pinned)
  • swap continuation interpreter state with saved carrier thread state
  • unset currentContinuation in j9vmthread
  • unset bit on j9vmthread->privateFlags
  • resume carrier thread
class Continuation {
        //should be cINL
	private native boolean enter();
	
        //should be cINL
	private static native boolean yield();

	private native boolean createContinuationImpl();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm project:loom Used to track Project Loom related work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants