Skip to content

Commit

Permalink
Revert "fix: Emit acquire fence before loading final field (scala…
Browse files Browse the repository at this point in the history
…-native#3699)"

This reverts commit 6cc47a3.
  • Loading branch information
WojciechMazur committed Jan 24, 2024
1 parent eafe667 commit 700c254
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tools/src/main/scala/scala/scalanative/codegen/Lower.scala
Original file line number Diff line number Diff line change
Expand Up @@ -594,15 +594,10 @@ object Lower {
throw new LinkingException(s"Metadata for field '$name' not found")
}

// No explicit memory order for load of final field,
// all final fields are loaded after a acquire fence
val memoryOrder =
if (field.attrs.isVolatile) nir.MemoryOrder.SeqCst
else if (field.attrs.isFinal) nir.MemoryOrder.Acquire
else nir.MemoryOrder.Unordered

// Acquire memory fence before loading a final field
if (field.attrs.isFinal) buf.fence(nir.MemoryOrder.Acquire)

val elem = genFieldElemOp(buf, genVal(buf, obj), name)
genLoadOp(buf, n, nir.Op.Load(ty, elem, Some(memoryOrder)))
}
Expand Down

0 comments on commit 700c254

Please sign in to comment.