Exclusive Monitor: Rework exclusive monitor interface.

This commit is contained in:
Fernando Sahmkow 2020-03-10 18:07:44 -04:00 committed by MerryMage
parent b5d8b24a3c
commit 97b9d3e058
15 changed files with 278 additions and 151 deletions

View file

@ -99,6 +99,20 @@ bool Inst::IsSharedMemoryReadOrWrite() const {
return IsSharedMemoryRead() || IsSharedMemoryWrite();
}
bool Inst::IsExclusiveMemoryRead() const {
switch (op) {
case Opcode::A64ExclusiveReadMemory8:
case Opcode::A64ExclusiveReadMemory16:
case Opcode::A64ExclusiveReadMemory32:
case Opcode::A64ExclusiveReadMemory64:
case Opcode::A64ExclusiveReadMemory128:
return true;
default:
return false;
}
}
bool Inst::IsExclusiveMemoryWrite() const {
switch (op) {
case Opcode::A32ExclusiveWriteMemory8:
@ -118,7 +132,7 @@ bool Inst::IsExclusiveMemoryWrite() const {
}
bool Inst::IsMemoryRead() const {
return IsSharedMemoryRead();
return IsSharedMemoryRead() || IsExclusiveMemoryRead();
}
bool Inst::IsMemoryWrite() const {
@ -457,7 +471,7 @@ bool Inst::AltersExclusiveState() const {
return op == Opcode::A32ClearExclusive ||
op == Opcode::A32SetExclusive ||
op == Opcode::A64ClearExclusive ||
op == Opcode::A64SetExclusive ||
IsExclusiveMemoryRead() ||
IsExclusiveMemoryWrite();
}