Skip to content

Move features from passOptions to Module#2001

Merged
tlively merged 7 commits intoWebAssembly:masterfrom
tlively:features-on-module
Apr 13, 2019
Merged

Move features from passOptions to Module#2001
tlively merged 7 commits intoWebAssembly:masterfrom
tlively:features-on-module

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Apr 11, 2019

This allowing us to emit a (potentially modified) target features
section and conditionally emit other sections such as the DataCount
section based on the presence of features.

This allowing us to emit a (potentially modified) target features
section and conditionally emit other sections such as the DataCount
section based on the presence of features.
@tlively tlively requested a review from kripken April 11, 2019 22:51
@tlively
Copy link
Copy Markdown
Member Author

tlively commented Apr 11, 2019

This is essentially #1993 without the controversial parts.

Copy link
Copy Markdown
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

lgtm aside from the questions below, plus: why did the .map files change?

Comment thread scripts/test/shared.py Outdated
assert os.path.exists('a.wast')
subprocess.check_call(
WASM_OPT + ['a.wast', '--print-minified'],
WASM_OPT + ['a.wast', '--print-minified', '-all'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems like this may be unnecessary in this PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done.

Comment thread src/tools/tool-options.h Outdated
bool wasmHasFeatures =
ModuleUtils::readFeaturesSection(module, wasmFeatures);

void calculateFeatures(Module& module) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how about "applyFeatures"? I think that makes it clear it applies them to the module.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done.

Comment thread src/wasm.h Outdated
std::vector<std::string> debugInfoFileNames;

// `features` are the features allowed to be used in this module and should be
// respected regardless of the value of `hasFeaturesSection`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe also add that hasFeaturesSection means that we read one, and will write one (unless told not to)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done.

Comment thread src/wasm/wasm-binary.cpp Outdated
if (debug) std::cerr << "getInt8: " << (int)(uint8_t)input[pos] << " (at " << pos << ")" << std::endl;
return input[pos++];
if (debug) std::cerr << "getInt8: " << (int)(uint8_t)input.at(pos) << " (at " << pos << ")" << std::endl;
return input.at(pos++);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

were these changes intended? i don't think we need them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

true, reverted.

@tlively
Copy link
Copy Markdown
Member Author

tlively commented Apr 11, 2019

.map files changed because I changed FeatureSet::iterFeatures to match the alphabetical order of feature names (using the better feature names used by LLVM, which we should eventually switch to in Binaryen as well).

@kripken
Copy link
Copy Markdown
Member

kripken commented Apr 11, 2019

Sounds good, lgtm.

@tlively
Copy link
Copy Markdown
Member Author

tlively commented Apr 12, 2019

@kripken I just want to make sure you don't have an issue with the last two commits before merging. Apparently one of the spec tests expects an exported mutable global to fail validation, so I had to disable mutable globals for the spect tests and that meant adding feature options to wasm-shell. I'm surprised the spec test does not expect mutable globals to be enabled.

@kripken
Copy link
Copy Markdown
Member

kripken commented Apr 12, 2019

The spec test is probably just quite old. How about simply removing the silly spec test?

@kripken
Copy link
Copy Markdown
Member

kripken commented Apr 12, 2019

(Eventually it would be nice if the spec test files specified which features they use, or something like that, maybe...)

@tlively tlively merged commit 9495b33 into WebAssembly:master Apr 13, 2019
@sbc100
Copy link
Copy Markdown
Member

sbc100 commented Apr 16, 2019

Somehow this broke at least the other.test_zeroinit test. Seems that zeros are no longer being compressed in memory segments? Does that make any sense?

Comment thread src/ir/memory-utils.h
}

// Conservatively refuse to change segments if there might be memory.init
// and data.drop instructions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks like the problem

@tlively
Copy link
Copy Markdown
Member Author

tlively commented Apr 16, 2019

Yes, --detect-features is not properly defaulting to MVP in the absence of a features section. I'm working on a fix now.

@tlively tlively deleted the features-on-module branch April 24, 2020 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants