?
u
/
p
1-9
We extend the JS language with fixed-layout objects both for unshared and shared uses, unsafe blocks to syntactically limit the scope of where racy accesses may be performed, and high-level synchronization primitive APIs. This spec draft is organized by logical feature.
Structs are fixed-layout objects. They are constructed with the integrity level
A struct definition is always
The abstract operation DefineStructField takes arguments receiver (an Object) and fieldRecord (a
The abstract operation InitializeStructInstanceFieldsAndBrand takes arguments receiver (an Object) and constructor (an ECMAScript
The abstract operation RunFieldInitializer takes arguments receiver (an Object) and fieldRecord (a
The abstract operation RunStructInstanceFieldInitializers takes arguments receiver (an Object) and constructor (an ECMAScript
The
The
A
An object is a struct method exotic object if its [[Call]] internal method uses the following implementation, and its other essential internal methods use the definitions found in
Internal Slot | Type | Description |
---|---|---|
[[BoundTargetMethod]] | a callable Object | The wrapped method object. |
The [[Call]] internal method of a
The abstract operation StructMethodCreate takes argument targetMethod (a
The
An object is a Shared Struct if its [[GetOwnProperty]], [[DefineOwnProperty]], [[HasProperty]], [[Get]], [[Set]], and [[Delete]] internal methods use the definitions in this section, and its other essential internal methods use the definitions found in
The abstract operation EnterSharedStructCreationCriticalSection takes no arguments and returns
The abstract operation LeaveSharedStructCreationCriticalSection takes no arguments and returns
This
This
In implementations, this
The abstract operation SharedStructCreate takes argument initializer (an
The abstract operation ReadSharedStructField takes arguments struct (a
The abstract operation WriteSharedStructField takes arguments struct (a
The [[GetOwnProperty]] internal method of a
The [[DefineOwnProperty]] internal method of a
The [[HasProperty]] internal method of a
The [[Get]] internal method of a shared Struct O takes arguments P (a
The [[Set]] internal method of a
The [[Delete]] internal method of a
A shared struct definition is always
The
The
EDITOR'S NOTE: Per-
The abstract operation CanBeSharedAcrossAgents takes argument val (an
Returns whether ECMAScript language language values can be shared across
It performs the following steps when called:
The abstract operation DefineSharedStructField takes arguments receiver (a
The
The abstract operation AtomicCompareExchangeInSharedStruct takes arguments struct (a
The abstract operation AtomicReadModifyWriteInSharedStruct takes arguments struct (a
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
Shared memory accesses (reads and writes) are divided into two groups, atomic accesses and data accesses, defined below. Atomic accesses are sequentially consistent, i.e., there is a strict total ordering of events agreed upon by all
No orderings weaker than sequentially consistent and stronger than unordered, such as release-acquire, are supported.
A Shared Memory Storage Record is either a SharedBlockStorage or SharedStructStorage
Field Name | Value | Meaning |
---|---|---|
[[Block]] | a |
The block the event operates on. |
[[ByteIndex]] | a non-negative |
The byte address of the access in [[Block]]. |
[[ElementSize]] | a non-negative |
The size of the access. |
Field Name | Value | Meaning |
---|---|---|
[[Struct]] | a |
The shared struct the event operates on. |
[[Field]] | a |
The field that is accessed in [[Struct]]. |
A Shared Data Block event is either a ReadSharedMemory, WriteSharedMemory, or ReadModifyWriteSharedMemory
Field Name | Value | Meaning |
---|---|---|
[[Order]] | The weakest ordering guaranteed by the |
|
[[NoTear]] | a Boolean | Whether this event is allowed to read from multiple write events with equal range as this event. |
[[Storage]] | a |
The storage of memory that is read. |
Field Name | Value | Meaning |
---|---|---|
[[Order]] | The weakest ordering guaranteed by the |
|
[[NoTear]] | a Boolean | Whether this event is allowed to be read from multiple read events with equal range as this event. |
[[Storage]] | a |
The storage of memory that is written. |
[[Payload]] | a |
The |
Field Name | Value | Meaning |
---|---|---|
[[Order]] | Read-modify-write events are always sequentially consistent. | |
[[NoTear]] | Read-modify-write events cannot tear. | |
[[Storage]] | a |
The storage of memory of the read-modify-write. |
[[Payload]] | a |
The |
[[ModifyOp]] | a |
An abstract closure that returns a modified |
These events are introduced by
Some operations may also introduce Synchronize events. A Synchronize event has no fields, and exists purely to directly constrain the permitted orderings of other events.
In addition to
If the [[Storage]] field of a ReadSharedMemory, WriteSharedMemory, or ReadModifyWriteSharedMemory event is a SharedBlockStorage, then Llet theits range of a ReadSharedMemory, WriteSharedMemory, or ReadModifyWriteSharedMemory event be the Set of contiguous
If the [[Storage]] field of a ReadSharedMemory, WriteSharedMemory, or ReadModifyWriteSharedMemory event is a SharedStructStorage, then let its range be the value of the [[Storage]] field. Two events' ranges are equal when the events have a SharedStructStorage in their [[Storage]] field, have the same [[Storage]].[[Struct]] and the same [[Storage]].[[Field]]. Two events' ranges that both have a SharedStructStorage in their [[Storage]] field are never overlapping. Two events' ranges are disjoint when the events do not both have a SharedStructStorage in their [[Storage]] Field, or do not have the same [[Storage]].[[Struct]] or the same [[Storage]].[[Field]].
For brevity, the refactoring of the
Shared Arrays are a special case of
The SharedArray
The abstract operation SharedArrayCreate takes argument length (an non-negative
This function performs the following steps when called:
unsafe
BlockThe abstract operation IsUnsafe takes argument node (a
The Reference Record type is used to explain the behaviour of such operators as delete
, typeof
, the assignment operators, the super
A Reference Record is a resolved name or property binding; its fields are defined by
Field Name | Value | Meaning |
---|---|---|
[[Base]] | an |
The value or |
[[ReferencedName]] | a String, a Symbol, or a |
The name of the binding. Always a String if [[Base]] value is an |
[[Strict]] | a Boolean | |
[[Unsafe]] | a Boolean | |
[[ThisValue]] | an |
If not super |
The following
The abstract operation GetValue takes argument V (a
The object that may be created in step
The abstract operation PutValue takes arguments V (a
The object that may be created in step
Internal Method | Signature | Description |
---|---|---|
[[Get]] | (propertyKey, Receiver, unsafe) → any |
Return the value of the property whose key is propertyKey from this object. If any ECMAScript code must be executed to retrieve the property value, Receiver is used as the unsafe block, unsafe will be |
[[Set]] | (propertyKey, value, Receiver, unsafe) → Boolean |
Set the value of the property whose key is propertyKey to value. If any ECMAScript code must be executed to set the property value, Receiver is used as the unsafe block, unsafe will be |
DRAFT NOTE: Except where specified, it is assumed that existing invocations of [[Get]] or [[Set]] that do not currently pass a value for the unsafe parameter are assumed to pass
The [[Get]] internal method of an
The abstract operation OrdinaryGet takes arguments O (an Object), P (a
The [[Set]] internal method of an
The abstract operation OrdinarySet takes arguments O (an Object), P (a
The abstract operation OrdinarySetWithOwnDescriptor takes arguments O (an Object), P (a
The [[Get]] internal method of an
The [[Set]] internal method of an
The [[Get]] internal method of a
The [[Set]] internal method of a
The [[Get]] internal method of a
ResolveExport is side-effect free. Each time this operation is called with a specific exportName, resolveSet pair as arguments it must return the same result. An implementation might choose to pre-compute or cache the ResolveExport results for the [[Exports]] of each
The [[Set]] internal method of a
The [[Get]] internal method of a
[[Get]] for Proxy objects enforces the following invariants:
Proxies are always unsafe and permit reading from fields on unsafe {}
block.
The [[Set]] internal method of a
[[Set]] for Proxy objects enforces the following invariants:
Proxies are always unsafe and permit writing to fields on unsafe {}
block.
The abstract operation EvaluatePropertyAccessWithExpressionKey takes arguments baseValue (an
The abstract operation EvaluatePropertyAccessWithIdentifierKey takes arguments baseValue (an
The
This function performs the following steps when called:
This function performs the following steps when called:
Mutexes and condition variables are provided as higher level abstractions, as an easier to use alternative to user-built abstractions on top of Atomics.wait and Atomics.notify. They are
The abstract operation UnlockTokenCreateIfNeeded takes arguments token (an Object or
The abstract operation LockMutex takes arguments mutex (an Object) and tMillis (a
The abstract operation UnlockMutex takes argument mutex (an Object) and returns
The Mutex
This function performs the following steps when called:
The Mutex
See
This function puts the
It performs the following steps when called:
This function puts the
It performs the following steps when called:
using
syntax.An UnlockToken is the unlock capability returned when a Mutex's lock is acquired. It can be reused. An uninitialized UnlockToken can be created by using the Atomics.Mutex.UnlockToken
The UnlockToken
This function performs the following steps when called:
The UnlockToken
The initial value of Atomics.Mutex.UnlockToken.prototype
is the
This property has the attributes { [[Writable]]:
The UnlockToken prototype object:
Atomics.Mutex.UnlockToken.locked
is an
This function performs the following steps when called:
This function performs the following steps when called:
The Condition
This function performs the following steps when called:
The Condition
This function atomically unlocks mutexUnlockToken and puts the
It performs the following steps when called:
If predicate is
If a predicate is passed and calling it returns
It performs the following steps when called:
It performs the following steps when called:
© 2024 Shu-yu Guo
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.