Skip to content
Merged
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions src/tools/fuzzing/fuzzing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,13 @@ void TranslateToFuzzReader::setupGlobals() {
// initializer.
auto* init = makeTrivial(type);

if (type.isTuple() && !init->is<TupleMake>()) {
// For now we disallow anything but tuple.make at the top level of tuple
// globals (see details in wasm-binary.cpp). In the future we may allow
// global.get or other things here.
init = makeConst(type);
assert(init->is<TupleMake>());
}
if (!FindAll<RefAs>(init).list.empty() ||
!FindAll<ContNew>(init).list.empty()) {
// When creating this initial value we ended up emitting a RefAs, which
Expand All @@ -695,12 +702,6 @@ void TranslateToFuzzReader::setupGlobals() {
// if a nested struct we create has a continuation field, for example.
type = getMVPType();
init = makeConst(type);
} else if (type.isTuple() && !init->is<TupleMake>()) {
// For now we disallow anything but tuple.make at the top level of tuple
// globals (see details in wasm-binary.cpp). In the future we may allow
// global.get or other things here.
init = makeConst(type);
assert(init->is<TupleMake>());
}
auto global = builder.makeGlobal(
Names::getValidGlobalName(wasm, "global$"), type, init, mutability);
Expand Down Expand Up @@ -3445,7 +3446,6 @@ Expression* TranslateToFuzzReader::makeBasicRef(Type type) {
// TODO: support actual non-nullable externrefs via imported globals or
// similar.
if (!type.isNullable()) {
assert(funcContext);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to add a comment about why we can't assert we're in a funcContext here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is the general case, actually. We shouldn't be asserting on this. The other similar places need updating as well.

return builder.makeRefAs(RefAsNonNull, null);
}
return null;
Expand Down
Loading