This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC.
ClosedPublic

Authored by wingo on Mar 23 2021, 7:03 AM.

Details

Summary

This patch renames the "Initial" member of WasmLimits to the name used
in the spec, "Minimum".

In the core WebAssembly specification, the Limits data type has one
required "min" member and one optional "max" member, indicating the
minimum required size of the corresponding table or memory, and the
maximum size, if any.

Although the WebAssembly spec does instantiate locally-defined tables
and memories with the initial size being equal to the minimum size, it
can't impose such a requirement for imports. It doesn't make sense to
require an initial size for a memory import, for example. The compiler
can only sensibly express the minimum and maximum sizes.

See
https://github.com/WebAssembly/js-types/blob/master/proposals/js-types/Overview.md#naming-of-size-limits
for a related discussion that agrees that the right name of "initial" is
"minimum" when querying the type of a table or memory from JavaScript.
(Of course it still makes sense for JS to speak in terms of an initial
size when it explicitly instantiates memories and tables.)

Diff Detail

Event Timeline

wingo created this revision.Mar 23 2021, 7:03 AM
wingo requested review of this revision.Mar 23 2021, 7:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 7:03 AM

Commit log says it all. Sam feel free to pass this one off to someone else, or to tell me this is a terrible idea!

wingo updated this revision to Diff 332682.Mar 23 2021, 8:17 AM

Add missing rename from Initial to Minimum

sbc100 accepted this revision.Mar 23 2021, 8:44 AM
This revision is now accepted and ready to land.Mar 23 2021, 8:44 AM
wingo updated this revision to Diff 332887.Mar 24 2021, 1:10 AM

Fix missing test adaptations

This revision was landed with ongoing or failed builds.Mar 24 2021, 1:11 AM
This revision was automatically updated to reflect the committed changes.