Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3b1fc52
Update basic reference types
dcodeIO Aug 29, 2020
6800818
fix equality, fix test, make Literal::type immutable, don't use smart…
dcodeIO Aug 30, 2020
28a042a
revert ExceptionPackage
dcodeIO Aug 31, 2020
f7efeb6
add TODO for s33 encoding
dcodeIO Aug 31, 2020
043c87b
fix fuzzing
dcodeIO Aug 31, 2020
83fe597
update translate-to-fuzz test
dcodeIO Sep 1, 2020
794a11b
fix it like a pro
dcodeIO Sep 1, 2020
b5a6ad0
tidy
dcodeIO Sep 1, 2020
0ef68e6
fuzzer not quite happy, so
dcodeIO Sep 1, 2020
8e53478
simplify, revert getSingleValue by ref
dcodeIO Sep 1, 2020
dfaa112
prepare for clean merge
dcodeIO Sep 1, 2020
9de7293
Merge branch 'master' into gc-xref
dcodeIO Sep 2, 2020
3607ef6
Merge branch 'master' into gc-xref
dcodeIO Sep 3, 2020
4bae64e
revert GC-only functionality
dcodeIO Sep 3, 2020
c5e11db
update js kitchen-sink test
dcodeIO Sep 4, 2020
83e336c
fix left-over TranslateToFuzzReader::getSubType
dcodeIO Sep 4, 2020
97ebb0c
update and disable two more subtyping tests
dcodeIO Sep 4, 2020
05ce530
fix ExpressionManipulator::refNull not applying the type
dcodeIO Sep 4, 2020
c24f90c
address comments
dcodeIO Sep 7, 2020
cfc4ca2
rm -r gc
dcodeIO Sep 7, 2020
b335c64
update TODO comment
dcodeIO Sep 7, 2020
ad384ba
make sure to initialize BinaryenLiteral::func
dcodeIO Sep 7, 2020
4a0465e
provide type explicitly when manipulating an expression to RefNull
dcodeIO Sep 7, 2020
2bd5976
replace unnecessary getSubType code with a TODO in the fuzzer
dcodeIO Sep 7, 2020
47dd183
make check for null `exn` more obvious
dcodeIO Sep 7, 2020
d2009e4
add assertion message when trying to print non-null externref literal
dcodeIO Sep 7, 2020
d3cf93e
add TODO to Type::isSubType just reimplementing equality currently
dcodeIO Sep 7, 2020
395067b
add trailing newline to reference-types.wast
dcodeIO Sep 7, 2020
121abe3
remove unused allowError in s-parser
dcodeIO Sep 7, 2020
2506877
add a TODO to Literal::getBits when dealing with reference types
dcodeIO Sep 7, 2020
0596965
revert removing allowError in s-parser stringToType, is actually used
dcodeIO Sep 7, 2020
b89ec05
Merge branch 'master' into gc-xref
dcodeIO Sep 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/gen-s-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
("v128.pop", "makePop(Type::v128)"),
("funcref.pop", "makePop(Type::funcref)"),
("externref.pop", "makePop(Type::externref)"),
("nullref.pop", "makePop(Type::nullref)"),
("anyref.pop", "makePop(Type::anyref)"),
("eqref.pop", "makePop(Type::eqref)"),
("i31ref.pop", "makePop(Type::i31ref)"),
("exnref.pop", "makePop(Type::exnref)"),
("i32.load", "makeLoad(s, Type::i32, /*isAtomic=*/false)"),
("i64.load", "makeLoad(s, Type::i64, /*isAtomic=*/false)"),
Expand Down
12 changes: 9 additions & 3 deletions src/asmjs/asm_v_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ AsmType wasmToAsmType(Type type) {
assert(false && "v128 not implemented yet");
case Type::funcref:
case Type::externref:
case Type::nullref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
case Type::exnref:
assert(false && "reference types are not supported by asm2wasm");
case Type::none:
Expand Down Expand Up @@ -84,8 +86,12 @@ char getSig(Type type) {
return 'F';
case Type::externref:
return 'X';
case Type::nullref:
return 'N';
case Type::anyref:
return 'A';
case Type::eqref:
return 'Q';
case Type::i31ref:
return 'I';
case Type::exnref:
return 'E';
case Type::none:
Expand Down
31 changes: 23 additions & 8 deletions src/binaryen-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,17 @@ BinaryenLiteral toBinaryenLiteral(Literal x) {
memcpy(&ret.v128, x.getv128Ptr(), 16);
break;
case Type::funcref:
ret.func = x.getFunc().c_str();
break;
case Type::nullref:
if (!x.isNull()) {
ret.func = x.getFunc().c_str();
}
break;
case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::exnref:
assert(x.isNull());
break;
case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
Expand All @@ -96,10 +101,12 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) {
return Literal(x.v128);
case Type::funcref:
return Literal::makeFuncref(x.func);
case Type::nullref:
return Literal::makeNullref();
case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::exnref:
return Literal::makeNull(Type(x.type));
case Type::i31ref:
case Type::none:
case Type::unreachable:
WASM_UNREACHABLE("unexpected type");
Expand Down Expand Up @@ -133,7 +140,9 @@ BinaryenType BinaryenTypeFloat64(void) { return Type::f64; }
BinaryenType BinaryenTypeVec128(void) { return Type::v128; }
BinaryenType BinaryenTypeFuncref(void) { return Type::funcref; }
BinaryenType BinaryenTypeExternref(void) { return Type::externref; }
BinaryenType BinaryenTypeNullref(void) { return Type::nullref; }
BinaryenType BinaryenTypeAnyref(void) { return Type::anyref; }
BinaryenType BinaryenTypeEqref(void) { return Type::eqref; }
BinaryenType BinaryenTypeI31ref(void) { return Type::i31ref; }
BinaryenType BinaryenTypeExnref(void) { return Type::exnref; }
BinaryenType BinaryenTypeUnreachable(void) { return Type::unreachable; }
BinaryenType BinaryenTypeAuto(void) { return uintptr_t(-1); }
Expand Down Expand Up @@ -326,6 +335,9 @@ BinaryenFeatures BinaryenFeatureReferenceTypes(void) {
BinaryenFeatures BinaryenFeatureMultivalue(void) {
return static_cast<BinaryenFeatures>(FeatureSet::Multivalue);
}
BinaryenFeatures BinaryenFeatureGC(void) {
return static_cast<BinaryenFeatures>(FeatureSet::GC);
}
BinaryenFeatures BinaryenFeatureAll(void) {
return static_cast<BinaryenFeatures>(FeatureSet::All);
}
Expand Down Expand Up @@ -1264,8 +1276,11 @@ BinaryenExpressionRef BinaryenPop(BinaryenModuleRef module, BinaryenType type) {
Builder(*(Module*)module).makePop(Type(type)));
}

BinaryenExpressionRef BinaryenRefNull(BinaryenModuleRef module) {
return static_cast<Expression*>(Builder(*(Module*)module).makeRefNull());
BinaryenExpressionRef BinaryenRefNull(BinaryenModuleRef module,
BinaryenType type) {
Type type_(type);
assert(type_.isNullable());
return static_cast<Expression*>(Builder(*(Module*)module).makeRefNull(type_));
}

BinaryenExpressionRef BinaryenRefIsNull(BinaryenModuleRef module,
Expand Down
8 changes: 6 additions & 2 deletions src/binaryen-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ BINARYEN_API BinaryenType BinaryenTypeFloat64(void);
BINARYEN_API BinaryenType BinaryenTypeVec128(void);
BINARYEN_API BinaryenType BinaryenTypeFuncref(void);
BINARYEN_API BinaryenType BinaryenTypeExternref(void);
BINARYEN_API BinaryenType BinaryenTypeNullref(void);
BINARYEN_API BinaryenType BinaryenTypeAnyref(void);
BINARYEN_API BinaryenType BinaryenTypeEqref(void);
BINARYEN_API BinaryenType BinaryenTypeI31ref(void);
BINARYEN_API BinaryenType BinaryenTypeExnref(void);
BINARYEN_API BinaryenType BinaryenTypeUnreachable(void);
// Not a real type. Used as the last parameter to BinaryenBlock to let
Expand Down Expand Up @@ -197,6 +199,7 @@ BINARYEN_API BinaryenFeatures BinaryenFeatureExceptionHandling(void);
BINARYEN_API BinaryenFeatures BinaryenFeatureTailCall(void);
BINARYEN_API BinaryenFeatures BinaryenFeatureReferenceTypes(void);
BINARYEN_API BinaryenFeatures BinaryenFeatureMultivalue(void);
BINARYEN_API BinaryenFeatures BinaryenFeatureGC(void);
BINARYEN_API BinaryenFeatures BinaryenFeatureAll(void);

// Modules
Expand Down Expand Up @@ -826,7 +829,8 @@ BinaryenMemoryFill(BinaryenModuleRef module,
BinaryenExpressionRef dest,
BinaryenExpressionRef value,
BinaryenExpressionRef size);
BINARYEN_API BinaryenExpressionRef BinaryenRefNull(BinaryenModuleRef module);
BINARYEN_API BinaryenExpressionRef BinaryenRefNull(BinaryenModuleRef module,
BinaryenType type);
BINARYEN_API BinaryenExpressionRef
BinaryenRefIsNull(BinaryenModuleRef module, BinaryenExpressionRef value);
BINARYEN_API BinaryenExpressionRef BinaryenRefFunc(BinaryenModuleRef module,
Expand Down
Loading