@@ -91,7 +91,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
91
91
text: IterableToList; url: sec-iterabletolist
92
92
type: abstract-op
93
93
text: CreateMethodProperty; url: sec-createmethodproperty
94
- urlPrefix: https://webassembly.github.io/spec /core/; spec: WebAssembly; type: dfn
94
+ urlPrefix: https://webassembly.github.io/reference-types /core/; spec: WebAssembly; type: dfn
95
95
url: valid/modules.html#valid-module
96
96
text: valid
97
97
text: WebAssembly module validation
@@ -110,6 +110,7 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df
110
110
text: f64.const
111
111
text: ref.null
112
112
text: ref.func
113
+ text: ref.extern
113
114
text: function index; url: syntax/modules.html#syntax-funcidx
114
115
text: function instance; url: exec/runtime.html#function-instances
115
116
text: store_init; url: appendix/embedding.html#embed-store-init
@@ -145,6 +146,7 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df
145
146
text: function address; url: exec/runtime.html#syntax-funcaddr
146
147
text: memory address; url: exec/runtime.html#syntax-memaddr
147
148
text: global address; url: exec/runtime.html#syntax-globaladdr
149
+ text: extern address; url: exec/runtime.html#syntax-externaddr
148
150
url: syntax/types.html#syntax-numtype
149
151
text: i32
150
152
text: i64
@@ -254,7 +256,7 @@ Each [=agent=] is associated with the following [=ordered map=]s:
254
256
* The <dfn>Table object cache</dfn> , mapping [=table address=] es to {{Table}} objects.
255
257
* The <dfn>Exported Function cache</dfn> , mapping [=function address=] es to [=Exported Function=] objects.
256
258
* The <dfn>Global object cache</dfn> , mapping [=global address=] es to {{Global}} objects.
257
- * The <dfn>Host value cache</dfn> , mapping [=host address=] es to values.
259
+ * The <dfn>Extern value cache</dfn> , mapping [=extern address=] es to values.
258
260
259
261
<h2 id="webassembly-namespace">The WebAssembly Namespace</h2>
260
262
@@ -754,15 +756,15 @@ Each {{Table}} object has the following internal slots:
754
756
755
757
<div algorithm>
756
758
The <dfn constructor for="Table">Table(|descriptor|, |value|)</dfn> constructor, when invoked, performs the following steps:
757
- 1. Let |elementType| be ToValueType( descriptor|["element"] ).
759
+ 1. Let |elementType| be [= ToValueType=] (| descriptor|["element"] ).
758
760
1. let |initial| be |descriptor|["initial"] .
759
761
1. If |descriptor|["maximum"] [=map/exists=] , let |maximum| be |descriptor|["maximum"] ; otherwise, let |maximum| be empty.
760
762
1. If |maximum| is not empty and |maximum| < |initial|, throw a {{RangeError}} exception.
761
763
1. If |value| is missing,
762
764
1. Let |ref| be [=DefaultValue=] (|elementType|).
763
765
1. Otherwise,
764
766
1. Let |ref| be ? [=ToWebAssemblyValue=] (|value|, |elementType|).
765
- 1. Let |type| be the [=table type=] {[=table type|min=] |initial|, [=table type|ma𝗑=] |maximum|} [=table type|an𝗒func=] .
767
+ 1. Let |type| be the [=table type=] {[=table type|min=] |initial|, [=table type|ma𝗑=] |maximum|} |elementType| .
766
768
1. Let |store| be the [=surrounding agent=] 's [=associated store=] .
767
769
1. Let (|store|, |tableaddr|) be [=table_alloc=] (|store|, |type|, |ref|). <!-- TODO(littledan): Report allocation failure https://github.com/WebAssembly/spec/issues/584 -->
768
770
1. Set the [=surrounding agent=] 's [=associated store=] to |store|.
@@ -1065,20 +1067,20 @@ The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a Jav
1065
1067
1. If |w| is of the form [=i32.const=] |i32|, return [=the Number value=] for [=signed_32=] (|i32|).
1066
1068
1. If |w| is of the form [=f32.const=] |f32|, return [=the Number value=] for |f32|.
1067
1069
1. If |w| is of the form [=f64.const=] |f64|, return [=the Number value=] for |f64|.
1068
- 1. If |w| is of the form [=ref.null=] , return null.
1070
+ 1. If |w| is of the form [=ref.null=] <var ignore> t </var> , return null.
1069
1071
1. If |w| is of the form [=ref.func=] |funcaddr|, return the result of creating [=a new Exported Function=] from |funcaddr|.
1070
- 1. If |w| is of the form [=ref.host =] |hostaddr |, return the result of [=retrieving a host value=] from |hostaddr |.
1072
+ 1. If |w| is of the form [=ref.extern =] |externaddr |, return the result of [=retrieving an extern value=] from |externaddr |.
1071
1073
1072
1074
<!-- If the WebAssembly value is optional, then given `None`, return JavaScript value `undefined`. -->
1073
1075
1074
1076
Note: Number values which are equal to NaN may have various observable NaN payloads; see [=NumberToRawBytes=] for details.
1075
1077
</div>
1076
1078
1077
1079
<div algorithm>
1078
- For <dfn>retrieving a host value</dfn> from a [=host address=] |hostaddr |, perform the following steps:
1079
- 1. Let |map| be the [=surrounding agent=] 's associated [=host value cache=] .
1080
- 1. Assert: |map|[|hostaddr |] [=map/exists=] .
1081
- 1. Return |map|[|hostaddr |] .
1080
+ For <dfn>retrieving an extern value</dfn> from a [=extern address=] |externaddr |, perform the following steps:
1081
+ 1. Let |map| be the [=surrounding agent=] 's associated [=extern value cache=] .
1082
+ 1. Assert: |map|[|externaddr |] [=map/exists=] .
1083
+ 1. Return |map|[|externaddr |] .
1082
1084
</div>
1083
1085
1084
1086
<div algorithm>
@@ -1095,28 +1097,24 @@ The algorithm <dfn>ToWebAssemblyValue</dfn>(|v|, |type|) coerces a JavaScript va
1095
1097
1. If |type| is [=f64=] ,
1096
1098
1. Let |f64| be ? [=ToNumber=] (|v|).
1097
1099
1. Return [=f64.const=] |f64|.
1098
- 1. Assert: |type| is a reference type.
1099
- 1. If |type| is [=externref=] ,
1100
- 1. Do nothing.
1101
1100
1. If |type| is [=funcref=] ,
1102
- 1. If |v| is not an [=Exported function=] or null, throw a {{TypeError}} .
1103
- 1. Return the result of [=allocating a host address=] for |v|.
1104
-
1105
- </div>
1106
-
1107
- <div algorithm>
1108
- For <dfn>allocating a host address</dfn> for a value |v|, perform the following steps:
1109
1101
1. If |v| is null,
1110
- 1. Return [=ref.null=] .
1102
+ 1. Return [=ref.null=] [=funcref=] .
1111
1103
1. If |v| is an [=Exported Function=] ,
1112
1104
1. Let |funcaddr| be the value of |v|'s \[[FunctionAddress]] internal slot.
1113
1105
1. Return [=ref.func=] |funcaddr|.
1114
- 1. Let |map| be the [=surrounding agent=] 's associated [=host value cache=] .
1115
- 1. If a [=host address=] |hostaddr| exists such that |map|[|hostaddr|] is the same as |v|,
1116
- 1. Return [=ref.host=] |hostaddr|.
1117
- 1. Let [=host address=] |hostaddr| be the smallest address such that |map|[|hostaddr|] [=map/exists=] is false.
1118
- 1. [=map/Set=] |map|[|hostaddr|] to |v|.
1119
- 1. Return [=ref.host=] |hostaddr|.
1106
+ 1. Throw a {{TypeError}} .
1107
+ 1. If |type| is [=externref=] ,
1108
+ 1. If |v| is null,
1109
+ 1. Return [=ref.null=] [=externref=] .
1110
+ 1. Let |map| be the [=surrounding agent=] 's associated [=extern value cache=] .
1111
+ 1. If a [=extern address=] |externaddr| exists such that |map|[|externaddr|] is the same as |v|,
1112
+ 1. Return [=ref.extern=] |externaddr|.
1113
+ 1. Let [=extern address=] |externaddr| be the smallest address such that |map|[|externaddr|] [=map/exists=] is false.
1114
+ 1. [=map/Set=] |map|[|externaddr|] to |v|.
1115
+ 1. Return [=ref.extern=] |externaddr|.
1116
+ 1. Assert: This step is not reached.
1117
+
1120
1118
</div>
1121
1119
1122
1120
0 commit comments