@@ -3257,7 +3257,10 @@ bool LibraryCallKit::inline_native_getEventWriter() {
32573257 set_all_memory (input_memory_state);
32583258 Node* input_io_state = i_o ();
32593259
3260- Node* excluded_mask = _gvn.intcon (32768 );
3260+ // The most significant bit of the u2 is used to denote thread exclusion
3261+ Node* excluded_shift = _gvn.intcon (15 );
3262+ Node* excluded_mask = _gvn.intcon (1 << 15 );
3263+ // The epoch generation is the range [1-32767]
32613264 Node* epoch_mask = _gvn.intcon (32767 );
32623265
32633266 // TLS
@@ -3411,7 +3414,7 @@ bool LibraryCallKit::inline_native_getEventWriter() {
34113414 record_for_igvn (vthread_compare_io);
34123415 PhiNode* tid = new PhiNode (vthread_compare_rgn, TypeLong::LONG);
34133416 record_for_igvn (tid);
3414- PhiNode* exclusion = new PhiNode (vthread_compare_rgn, TypeInt::BOOL );
3417+ PhiNode* exclusion = new PhiNode (vthread_compare_rgn, TypeInt::CHAR );
34153418 record_for_igvn (exclusion);
34163419 PhiNode* pinVirtualThread = new PhiNode (vthread_compare_rgn, TypeInt::BOOL);
34173420 record_for_igvn (pinVirtualThread);
@@ -3476,7 +3479,8 @@ bool LibraryCallKit::inline_native_getEventWriter() {
34763479 store_to_memory (tid_is_not_equal, event_writer_pin_field, _gvn.transform (pinVirtualThread), T_BOOLEAN, MemNode::unordered);
34773480
34783481 // Store the exclusion state to the event writer.
3479- store_to_memory (tid_is_not_equal, event_writer_excluded_field, _gvn.transform (exclusion), T_BOOLEAN, MemNode::unordered);
3482+ Node* excluded_bool = _gvn.transform (new URShiftINode (_gvn.transform (exclusion), excluded_shift));
3483+ store_to_memory (tid_is_not_equal, event_writer_excluded_field, excluded_bool, T_BOOLEAN, MemNode::unordered);
34803484
34813485 // Store the tid to the event writer.
34823486 store_to_memory (tid_is_not_equal, event_writer_tid_field, tid, T_LONG, MemNode::unordered);
@@ -3543,7 +3547,9 @@ void LibraryCallKit::extend_setCurrentThread(Node* jt, Node* thread) {
35433547 Node* input_memory_state = reset_memory ();
35443548 set_all_memory (input_memory_state);
35453549
3546- Node* excluded_mask = _gvn.intcon (32768 );
3550+ // The most significant bit of the u2 is used to denote thread exclusion
3551+ Node* excluded_mask = _gvn.intcon (1 << 15 );
3552+ // The epoch generation is the range [1-32767]
35473553 Node* epoch_mask = _gvn.intcon (32767 );
35483554
35493555 Node* const carrierThread = generate_current_thread (jt);
0 commit comments