-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store J9VMThread->scopedValueCache in the Continuation object
When a virtual thread is mounted, the corresponding carrier thread unmounts and no longer runs. Similarly, when a virtual thread is unmounted, the corresponding carrier thread mounts and resumes its operations. When a virtual thread is mounted, the scopedValueCache for the carrier thread is stored in the Continuation object's scopedValueCache field. When a virtual thread is unmounted, the carrier thread's scopedValueCache, which is stored in the Continuation object's scopedValueCache field, is swapped with J9VMThread->scopedValueCache. This assures a one to one mapping between a java.lang.Thread and scopedValueCache. The live thread's scopedValueCache is always kept in J9VMThread->scopedValueCache whereas the unmounted thread's scopedValueCache is stored in the corresponding Continuation object's scopedValueCache field. Signed-off-by: Babneet Singh <[email protected]>
- Loading branch information
Showing
4 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ class VM_ContinuationHelpers { | |
public: | ||
|
||
static VMINLINE void | ||
swapFieldsWithContinuation(J9VMThread *vmThread, J9VMContinuation *continuation, bool swapJ9VMthreadSavedRegisters = true) | ||
swapFieldsWithContinuation(J9VMThread *vmThread, J9VMContinuation *continuation, j9object_t continuationObject, bool swapJ9VMthreadSavedRegisters = true) | ||
{ | ||
/* Helper macro to swap fields between the two J9Class structs. */ | ||
#define SWAP_MEMBER(fieldName, fieldType, class1, class2) \ | ||
|
@@ -84,6 +84,10 @@ class VM_ContinuationHelpers { | |
} | ||
threadELS->i2jState = tempI2J; | ||
SWAP_MEMBER(oldEntryLocalStorage, J9VMEntryLocalStorage*, threadELS, continuation); | ||
|
||
j9object_t scopedValueCache = J9VMJDKINTERNALVMCONTINUATION_SCOPEDVALUECACHE(vmThread, continuationObject); | ||
J9VMJDKINTERNALVMCONTINUATION_SET_SCOPEDVALUECACHE(vmThread, continuationObject, vmThread->scopedValueCache); | ||
vmThread->scopedValueCache = scopedValueCache; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dmitripivkine
Contributor
|
||
} | ||
|
||
static VMINLINE ContinuationState volatile * | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dmitripivkine do we need to use a barrier for this write to j9vmthread?