RFR: 8255384: Remove special_runtime_exit_condition() check from SS::block() [v5]

David Holmes david.holmes at oracle.com
Mon Nov 9 00:55:48 UTC 2020


Hi Robbin,

On 6/11/2020 6:39 pm, Robbin Ehn wrote:
 > David wrote:
>> {
>> ThreadInVMfromJava tivm;
>> }
>>
>> which transitions from Java to VM and back, for absolutely no reason
>> other than to get the side-effects of doing those transitions.
> 
> As I see it, if you have an oop map and are executing in VM, you are technically in VM.
> But here we skip going to VM since SS:block used to need to know where you are going back to due to suspend flag is handle inside SS:block().
> And the safepoint synchronizer will treat java/vm the same thus we can cheat.
> 
> If the thread is in Java it is not guaranteed that it will have an oop map and it's not certain that it can be made walkable.
> Being blocked requires you to be walkable, thus going from java->blocked cannot be done as general rule.
> Instead of having a ton of special rules which no one can remember, the rule is you can only block in VM where we know you can be made walkable.

Sorry but I don't understand the point you are making here. The 
transition from Java to VM does nothing except change the thread-state 
and so has no affect on whether a thread can be made walkable or not. 
And SS:block() makes the thread walkable in any case.

> Polling page exception handling can thus been seen as a cheat avoiding setting in vm since it will actually have no effect on the safepoint synchronizer.
> 
> So no we are not looking for side-effects, we need to be in VM (at minimum technically) to become blocked.

But that is simply not true - we end up being blocked for 
safepoints/handshakes from a wide-range of thread states.

> Thus the rules for going from VM to Java applies, and we should deliver e.g. async exceptions.
> 
> {
>    ThreadInVMfromJava tivm;
>    SS:block()
> }
> 
> Would be the preferred way of doing it.

??? Why would you call SS::block explicitly there - the transition back 
to VM would do that.

David
-----

>>
>> David
>> -----
> 
> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/913
> 


More information about the hotspot-runtime-dev mailing list