[foreign-memaccess] on shared segments

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Sep 27 11:54:47 UTC 2019


On 27/09/2019 11:46, Jorn Vernee wrote:
> Reading through the code, there is one caveat that doesn't seem to be 
> addressed yet; only the owning thread can call asShared() or 
> asConfined() (not being checked currently), and, at least for 
> asConfined(), I think the owning thread has to submit to a full fence 
> before transferring the segment to make sure no accesses 'spill over' 
> into the new state. 

Right, I should add the checks.

Not sure about the fence - I thought about that. We are creating a _new_ 
object, and invalidating an old one. Only the old thread has access to 
the old one, so it cannot possibly perform access on the old segment 
AFTER it is closed. And, the new thread cannot access the segment before 
the old thread is actually inside the transfer code (which means he's 
done with the segment already).

If we were modifying the ownership in place, I'd agree a fence would be 
in order - but here?

Maurizio



More information about the panama-dev mailing list