diff options
author | Alon Zakai <azakai@google.com> | 2021-02-02 00:47:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 16:47:46 -0800 |
commit | a4837c095275b465005841616ff10bcd0b0d7996 (patch) | |
tree | fef7ce382071dd9d0aef74ab8b3ee1219367728d /src/wasm/literal.cpp | |
parent | eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc (diff) | |
download | binaryen-a4837c095275b465005841616ff10bcd0b0d7996.tar.gz binaryen-a4837c095275b465005841616ff10bcd0b0d7996.tar.bz2 binaryen-a4837c095275b465005841616ff10bcd0b0d7996.zip |
[GC] isGCData => isData (#3534)
We added isGCData() before we had dataref. But now there is a clear
parallel of Function vs Data. This PR makes us more consistent there,
renaming isGCData to isData and using that throughout.
This also fixes a bug where the old isGCData just checked if the input
was an Array or a Struct, and ignored the data heap type itself. It is not
possible to test that, however, due to other bugs, so that is deferred.
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index dc6d90ef9..54e817189 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -35,7 +35,7 @@ Literal::Literal(Type type) : type(type) { i32 = 0; } else { assert(type != Type::unreachable && (!type.isRef() || type.isNullable())); - if (isGCData()) { + if (isData()) { new (&gcData) std::shared_ptr<GCData>(); } else if (type.isRtt()) { // Allocate a new RttSupers (with no data). @@ -55,7 +55,7 @@ Literal::Literal(std::shared_ptr<GCData> gcData, Type type) // Null data is only allowed if nullable. assert(gcData || type.isNullable()); // The type must be a proper type for GC data. - assert(isGCData()); + assert(isData()); } Literal::Literal(std::unique_ptr<RttSupers>&& rttSupers, Type type) @@ -64,7 +64,7 @@ Literal::Literal(std::unique_ptr<RttSupers>&& rttSupers, Type type) } Literal::Literal(const Literal& other) : type(other.type) { - if (other.isGCData()) { + if (other.isData()) { new (&gcData) std::shared_ptr<GCData>(other.gcData); return; } @@ -121,7 +121,7 @@ Literal::Literal(const Literal& other) : type(other.type) { } Literal::~Literal() { - if (isGCData()) { + if (isData()) { gcData.~shared_ptr(); } else if (type.isRtt()) { rttSupers.~unique_ptr(); @@ -241,7 +241,7 @@ std::array<uint8_t, 16> Literal::getv128() const { } std::shared_ptr<GCData> Literal::getGCData() const { - assert(isGCData()); + assert(isData()); return gcData; } @@ -486,7 +486,7 @@ std::ostream& operator<<(std::ostream& o, Literal literal) { o << "funcref(" << literal.getFunc() << ")"; } } else if (literal.type.isRef()) { - if (literal.isGCData()) { + if (literal.isData()) { auto data = literal.getGCData(); if (data) { o << "[ref " << data->rtt << ' ' << data->values << ']'; |