Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: cleanup Backend and CompilerType functions, make minor performance adjustments #21389

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Apr 30, 2024

The PR does a cleanup and makes minor adjustments. E.g., sorting match arms for more relevant matches first, adding a gcc arm instead of using it only in the fallback.

@@ -846,13 +846,12 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
b := backend_from_string(sbackend) or {
eprintln_exit('Unknown V backend: ${sbackend}\nValid -backend choices are: c, go, interpret, js, js_node, js_browser, js_freestanding, native, wasm')
}
if b.is_js() {
res.output_cross_c = true
}
if b == .wasm {
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a b.is_wasm() to align with the other backends.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay checking, it's correct as it is. For the backends there only is .wasm. For the oses there is:

		.wasm32,
		.wasm32_emscripten,
		.wasm32_wasi,
		// Native wasm options:
		.wasi,
		.browser,

Copy link
Contributor

Choose a reason for hiding this comment

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

There are several js output variations as well...

Note that `js` defaults to the `node` codegen backend but it's also possible to
pick another:

* `js_browser`        - V outputs JS source code ready for the browser.
* `js_node`           - V outputs JS source code to run with nodejs.
* `js_freestanding`   - V outputs JS source code with no hard runtime dependency.

wasm is definitely set up different from the others, if it differentiates via os rather than backend.

vlib/v/pref/pref.v Outdated Show resolved Hide resolved
Co-authored-by: Delyan Angelov <[email protected]>
@spytheman spytheman merged commit 927cc01 into vlang:master Apr 30, 2024
53 checks passed
@ttytm ttytm deleted the pref/bakend-ct-perf branch April 30, 2024 19:56
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