?um/p1-90`memory consistency model, 즉 memory model은 SharedArrayBuffer로 backed된
memory model은 SharedArrayBuffer에 대한
이 section은 SharedArrayBuffers에 대한
Shared memory accesses(reads와 writes)는 아래에 defined된 atomic accesses와 data accesses라는 두 groups로 divided됩니다. Atomic accesses는 sequentially consistent합니다. 즉,
release-acquire와 같이 sequentially consistent보다 약하고 unordered보다 강한 orderings는 supported되지 않습니다.
Shared Data Block event는 ReadSharedMemory, WriteSharedMemory, 또는 ReadModifyWriteSharedMemory
| Field Name | Value | Meaning |
|---|---|---|
| [[Order]] | ||
| [[NoTear]] | Boolean | 이 event가 이 event와 equal |
| [[Block]] | event가 operate하는 block. | |
| [[ByteIndex]] | non-negative |
[[Block]]에서 read의 byte address. |
| [[ElementSize]] | non-negative |
read의 size. |
| Field Name | Value | Meaning |
|---|---|---|
| [[Order]] | ||
| [[NoTear]] | Boolean | 이 event가 이 event와 equal |
| [[Block]] | event가 operate하는 block. | |
| [[ByteIndex]] | non-negative |
[[Block]]에서 write의 byte address. |
| [[ElementSize]] | non-negative |
write의 size. |
| [[Payload]] | 다른 events가 read할 |
| Field Name | Value | Meaning |
|---|---|---|
| [[Order]] | Read-modify- |
|
| [[NoTear]] | Read-modify- |
|
| [[Block]] | event가 operate하는 block. | |
| [[ByteIndex]] | non-negative |
[[Block]]에서 read-modify-write의 byte address. |
| [[ElementSize]] | non-negative |
read-modify-write의 size. |
| [[Payload]] | [[ModifyOp]]에 passed될 |
|
| [[ModifyOp]] | read |
Shared Data Block events는
Shared Data Block event e의 memory range를 e.[[ByteIndex]](inclusive)에서 e.[[ByteIndex]] + e.[[ElementSize]](exclusive)까지
accounted for되어야 하는 postMessage),
Events는 아래에 defined된 relations에 의해
Agent Events Record는 다음 fields를 가진
| Field Name | Value | Meaning |
|---|---|---|
| [[AgentSignifier]] | evaluation이 이 ordering을 result한 |
|
| [[EventList]] | Events는 evaluation 중 list에 appended됩니다. | |
| [[AgentSynchronizesWith]] | operational semantics에 의해 introduced된 |
Chosen Value Record는 다음 fields를 가진
| Field Name | Value | Meaning |
|---|---|---|
| [[Event]] | 이 chosen value에 대해 introduced된 |
|
| [[ChosenValue]] | evaluation 중 nondeterministically chosen된 bytes. |
| Field Name | Value | Meaning |
|---|---|---|
| [[EventsRecords]] | ||
| [[ChosenValues]] |
empty candidate execution은 fields가 empty
The abstract operation EventSet takes argument execution (a
The abstract operation SharedDataBlockEventSet takes argument execution (a
The abstract operation HostEventSet takes argument execution (a
The abstract operation ComposeWriteEventBytes takes arguments execution (a
read-modify-write modification [[ModifyOp]]는
이 abstract operation은
The abstract operation ValueOfReadEvent takes arguments execution (a
다음 relations와 mathematical functions는 particular
각
events eventA 및 eventB에 대해, 다음 conditions 중 any가 true이면 eventA는 execution에서 eventB보다 happens-before입니다.
happens-before는
직관적으로, 이 requirement는
execution에서 readEvent가 writeEvent로부터
이 clause는 equal
이 clause는
is-memory-order-before가
모든 programs는 적어도 하나의 valid execution을 가집니다.
execution execution과
execution execution과
execution execution은
program은 all its executions가 data race free이면 data race free입니다.
다음은 shared memory로 작업하는 ECMAScript programmers를 위한 guidelines입니다.
programs는
더 일반적으로, program이
다음은 shared memory를 사용하는 programs에 대한 compiler transformations를 작성하는 ECMAScript implementers를 위한 guidelines입니다.
multi-
agent-order slice를 single
shared memory가 없는 경우 valid한 agent-order slice의 any transformation은 shared memory가 있는 경우에도 valid하며, 다음 exceptions가 있습니다.
Atomics are carved in stone: Program transformations는 [[Order]]가
(In practice, reorderings에 대한 prohibition은 compiler가 inter-
Reads must be stable: Any given shared memory read는 execution 안에서 single value만 observe해야 합니다.
(예를 들어, program에서 semantically single read인 것이 multiple times executed되면, program은 subsequently read된 values 중 하나만 observe하도록 allowed됩니다. rematerialization으로 known된 transformation은 이 rule을 violate할 수 있습니다.)
Writes must be stable: shared memory에 대한 모든 observable writes는 execution 안의 program semantics로부터 follow해야 합니다.
(예를 들어, transformation은 larger location에 대한 read-modify-write operations를 사용해 smaller datum을 write하거나, program이 write할 수 없었던 value를 memory에 write하거나, read한 location이 read 후 다른
Possible read values must be non-empty: Program transformations는 shared memory read의 possible read values가 empty가 되도록 할 수 없습니다.
(Counterintuitively, 이 rule은 effect적으로 writes에 대한 transformations를 restrict합니다. 왜냐하면 writes는
valid로 remain하는 transformations의 examples는 다음과 같습니다: 같은 location으로부터 multiple non-atomic reads를 merging하는 것, non-atomic reads를 reordering하는 것, speculative non-atomic reads를 introducing하는 것, 같은 location에 대한 multiple non-atomic writes를 merging하는 것, different locations에 대한 non-atomic writes를 reordering하는 것, 그리고 termination에 영향을 미치더라도 non-atomic reads를 loops 밖으로 hoisting하는 것. 일반적으로 aliased
다음은 shared memory accesses에 대한 machine code를 generating하는 ECMAScript implementers를 위한 guidelines입니다.
ARM 또는 Power의 memory models보다 no weaker인 memory models를 가진 architectures에서는, non-atomic stores와 loads가 target architecture의 bare stores와 loads로 compiled될 수 있습니다. Atomic stores와 loads는 sequential consistency를 guarantee하는 instructions로 compiled down될 수 있습니다. such instructions가 없으면, bare store 또는 load의 양쪽에 barriers를 placing하는 것과 같은 memory barriers가 employed되어야 합니다. Read-modify-write operations는 x86의 LOCK-prefixed instructions, ARM의 load-exclusive/store-exclusive instructions, Power의 load-link/store-conditional instructions와 같은 target architecture의 read-modify-write instructions로 compiled될 수 있습니다.
Specifically,
Naive code generation은 다음 patterns를 사용합니다:
그 mapping은
those basic patterns에 대한 local improvements도
LOCK-prefixed instructions를 사용하기 때문입니다. many platforms에는 several strengths의 fences가 있고, certain contexts에서는 sequential consistency를 destroying하지 않고 weaker fences가 사용될 수 있습니다.