Skip to content

Commit

Permalink
Rename anyref to externref to match proposal change
Browse files Browse the repository at this point in the history
  • Loading branch information
jayphelps committed Jun 9, 2020
1 parent 6ec03c5 commit 2fd7464
Show file tree
Hide file tree
Showing 72 changed files with 469 additions and 464 deletions.
2 changes: 1 addition & 1 deletion scripts/gen-s-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
("f64.pop", "makePop(Type::f64)"),
("v128.pop", "makePop(Type::v128)"),
("funcref.pop", "makePop(Type::funcref)"),
("anyref.pop", "makePop(Type::anyref)"),
("externref.pop", "makePop(Type::externref)"),
("nullref.pop", "makePop(Type::nullref)"),
("exnref.pop", "makePop(Type::exnref)"),
("i32.load", "makeLoad(s, Type::i32, /*isAtomic=*/false)"),
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def has_shell_timeout():
'--wasm-staging',
'--experimental-wasm-eh',
'--experimental-wasm-simd',
'--experimental-wasm-anyref',
'--experimental-wasm-externref',
'--experimental-wasm-compilation-hints',
'--experimental-wasm-return-call'
]
Expand Down
8 changes: 4 additions & 4 deletions scripts/wasm2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ var asmLibraryArg = {
console.log('get_f64 ' + [loc, index, value]);
return value;
},
get_anyref: function(loc, index, value) {
console.log('get_anyref ' + [loc, index, value]);
get_externref: function(loc, index, value) {
console.log('get_externref ' + [loc, index, value]);
return value;
},
get_exnref: function(loc, index, value) {
Expand All @@ -155,8 +155,8 @@ var asmLibraryArg = {
console.log('set_f64 ' + [loc, index, value]);
return value;
},
set_anyref: function(loc, index, value) {
console.log('set_anyref ' + [loc, index, value]);
set_externref: function(loc, index, value) {
console.log('set_externref ' + [loc, index, value]);
return value;
},
set_exnref: function(loc, index, value) {
Expand Down
4 changes: 2 additions & 2 deletions src/asmjs/asm_v_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ AsmType wasmToAsmType(Type type) {
case Type::v128:
assert(false && "v128 not implemented yet");
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref:
assert(false && "reference types are not supported by asm2wasm");
Expand All @@ -80,7 +80,7 @@ char getSig(Type type) {
return 'V';
case Type::funcref:
return 'F';
case Type::anyref:
case Type::externref:
return 'A';
case Type::nullref:
return 'N';
Expand Down
6 changes: 3 additions & 3 deletions src/binaryen-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ BinaryenLiteral toBinaryenLiteral(Literal x) {
break;
case Type::nullref:
break;
case Type::anyref:
case Type::externref:
case Type::exnref:
case Type::none:
case Type::unreachable:
Expand All @@ -97,7 +97,7 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) {
return Literal::makeFuncref(x.func);
case Type::nullref:
return Literal::makeNullref();
case Type::anyref:
case Type::externref:
case Type::exnref:
case Type::none:
case Type::unreachable:
Expand Down Expand Up @@ -131,7 +131,7 @@ BinaryenType BinaryenTypeFloat32(void) { return Type::f32; }
BinaryenType BinaryenTypeFloat64(void) { return Type::f64; }
BinaryenType BinaryenTypeVec128(void) { return Type::v128; }
BinaryenType BinaryenTypeFuncref(void) { return Type::funcref; }
BinaryenType BinaryenTypeAnyref(void) { return Type::anyref; }
BinaryenType BinaryenTypeExternref(void) { return Type::externref; }
BinaryenType BinaryenTypeNullref(void) { return Type::nullref; }
BinaryenType BinaryenTypeExnref(void) { return Type::exnref; }
BinaryenType BinaryenTypeUnreachable(void) { return Type::unreachable; }
Expand Down
2 changes: 1 addition & 1 deletion src/binaryen-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ BINARYEN_API BinaryenType BinaryenTypeFloat32(void);
BINARYEN_API BinaryenType BinaryenTypeFloat64(void);
BINARYEN_API BinaryenType BinaryenTypeVec128(void);
BINARYEN_API BinaryenType BinaryenTypeFuncref(void);
BINARYEN_API BinaryenType BinaryenTypeAnyref(void);
BINARYEN_API BinaryenType BinaryenTypeExternref(void);
BINARYEN_API BinaryenType BinaryenTypeNullref(void);
BINARYEN_API BinaryenType BinaryenTypeExnref(void);
BINARYEN_API BinaryenType BinaryenTypeUnreachable(void);
Expand Down
2 changes: 1 addition & 1 deletion src/gen-s-parser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ switch (op[0]) {
case 'a': {
switch (op[1]) {
case 'n':
if (strcmp(op, "anyref.pop") == 0) { return makePop(Type::anyref); }
if (strcmp(op, "externref.pop") == 0) { return makePop(Type::externref); }
goto parse_error;
case 't': {
switch (op[7]) {
Expand Down
4 changes: 2 additions & 2 deletions src/ir/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ inline UnaryOp getUnary(Type type, Op op) {
WASM_UNREACHABLE("v128 not implemented yet");
}
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref:
case Type::none:
Expand Down Expand Up @@ -214,7 +214,7 @@ inline BinaryOp getBinary(Type type, Op op) {
WASM_UNREACHABLE("v128 not implemented yet");
}
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref:
case Type::none:
Expand Down
6 changes: 3 additions & 3 deletions src/js/binaryen.js-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function initializeConstants() {
['f64', 'Float64'],
['v128', 'Vec128'],
['funcref', 'Funcref'],
['anyref', 'Anyref'],
['externref', 'Externref'],
['nullref', 'Nullref'],
['exnref', 'Exnref'],
['unreachable', 'Unreachable'],
Expand Down Expand Up @@ -2071,9 +2071,9 @@ function wrapModule(module, self) {
}
};

self['anyref'] = {
self['externref'] = {
'pop': function() {
return Module['_BinaryenPop'](module, Module['anyref']);
return Module['_BinaryenPop'](module, Module['externref']);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/literal.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Literal {
Literal(int32_t(0)),
Literal(int32_t(0))}});
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref:
case Type::none:
Expand Down Expand Up @@ -562,7 +562,7 @@ template<> struct less<wasm::Literal> {
case wasm::Type::v128:
return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0;
case wasm::Type::funcref:
case wasm::Type::anyref:
case wasm::Type::externref:
case wasm::Type::nullref:
case wasm::Type::exnref:
case wasm::Type::none:
Expand Down
2 changes: 1 addition & 1 deletion src/parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ parseConst(cashew::IString s, Type type, MixedArena& allocator) {
}
case Type::v128:
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref:
WASM_UNREACHABLE("unexpected const type");
Expand Down
2 changes: 1 addition & 1 deletion src/passes/ConstHoisting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct ConstHoisting : public WalkerPass<PostWalker<ConstHoisting>> {
// not implemented yet
case Type::v128:
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref: {
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/passes/Flatten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct Flatten
// the return type of the block this branch is targetting, which may
// not be the same with the innermost block's return type. For
// example,
// (block $any (result anyref)
// (block $any (result externref)
// (block (result nullref)
// (local.tee $0
// (br_if $any
Expand All @@ -222,7 +222,7 @@ struct Flatten
// )
// )
// In this case we need two locals to store (ref.null); one with
// anyref type that's for the target block ($label0) and one more
// externref type that's for the target block ($label0) and one more
// with nullref type in case for flowing out. Here we create the
// second 'flowing out' local in case two block's types are
// different.
Expand Down
4 changes: 2 additions & 2 deletions src/passes/FuncCastEmulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static Expression* toABI(Expression* value, Module* module) {
WASM_UNREACHABLE("v128 not implemented yet");
}
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref: {
WASM_UNREACHABLE("reference types cannot be converted to i64");
Expand Down Expand Up @@ -110,7 +110,7 @@ static Expression* fromABI(Expression* value, Type type, Module* module) {
WASM_UNREACHABLE("v128 not implemented yet");
}
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref: {
WASM_UNREACHABLE("reference types cannot be converted from i64");
Expand Down
24 changes: 14 additions & 10 deletions src/passes/InstrumentLocals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Name get_i64("get_i64");
Name get_f32("get_f32");
Name get_f64("get_f64");
Name get_funcref("get_funcref");
Name get_anyref("get_anyref");
Name get_externref("get_externref");
Name get_nullref("get_nullref");
Name get_exnref("get_exnref");

Expand All @@ -66,7 +66,7 @@ Name set_i64("set_i64");
Name set_f32("set_f32");
Name set_f64("set_f64");
Name set_funcref("set_funcref");
Name set_anyref("set_anyref");
Name set_externref("set_externref");
Name set_nullref("set_nullref");
Name set_exnref("set_exnref");

Expand All @@ -91,8 +91,8 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case Type::funcref:
import = get_funcref;
break;
case Type::anyref:
import = get_anyref;
case Type::externref:
import = get_externref;
break;
case Type::nullref:
import = get_nullref;
Expand Down Expand Up @@ -139,8 +139,8 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case Type::funcref:
import = set_funcref;
break;
case Type::anyref:
import = set_anyref;
case Type::externref:
import = set_externref;
break;
case Type::nullref:
import = set_nullref;
Expand Down Expand Up @@ -180,10 +180,14 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
set_funcref,
{Type::i32, Type::i32, Type::funcref},
Type::funcref);
addImport(
curr, get_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref);
addImport(
curr, set_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref);
addImport(curr,
get_externref,
{Type::i32, Type::i32, Type::externref},
Type::externref);
addImport(curr,
set_externref,
{Type::i32, Type::i32, Type::externref},
Type::externref);
addImport(curr,
get_nullref,
{Type::i32, Type::i32, Type::nullref},
Expand Down
2 changes: 1 addition & 1 deletion src/shell-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
case Type::v128:
assert(false && "v128 not implemented yet");
case Type::funcref:
case Type::anyref:
case Type::externref:
case Type::nullref:
case Type::exnref:
globals[import->name] = {Literal::makeNullref()};
Expand Down
Loading

0 comments on commit 2fd7464

Please sign in to comment.