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

AST-33: bit-testing of words #239

Merged
merged 4 commits into from
Mar 16, 2019
Merged

AST-33: bit-testing of words #239

merged 4 commits into from
Mar 16, 2019

Conversation

ggreif
Copy link
Contributor

@ggreif ggreif commented Mar 14, 2019

AST-63 calls for these btstWord* operations.

AST-33 deals with primitive datatypes and their ops.

Do we need further: bsetWord*, bclrWord*? They are not primitives in WASM, but are non-trivial to get right, esp. for Word8/16. Please comment here or in the AST.

src/compile.ml Outdated
| "btst64" -> compile_kernel_as SR.UnboxedInt64 (
let (set_b, get_b) = new_local64 env "b"
in set_b ^^ compile_const_64 1L ^^ get_b ^^ G.i (Binary (Wasm.Values.I64 I64Op.Shl)) ^^
G.i (Binary (Wasm.Values.I64 I64Op.And)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

At some point I think it would make sense to move the arguments to compile_kernel_as out of compile_exp (which is a pretty central function, and not great if it grows too big) and move them into functions in some appropriate module NumericOps. Same with probably much other code that is currently spread in the AST-related part of the file. But this is not a regression in this PR, so no need to do it here.

Copy link
Contributor Author

@ggreif ggreif Mar 16, 2019

Choose a reason for hiding this comment

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

Yes, I did some of these in (the latter part of) #245, ideally all of these operations should be one-liners. The moved kernels are UnboxedSmallWord-related, we can move the others too, as need arises.

@ggreif ggreif merged commit a41754a into master Mar 16, 2019
@nomeata nomeata deleted the gabor/conversions branch April 2, 2019 15:28
@ggreif ggreif restored the gabor/conversions branch November 19, 2021 20:52
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.

2 participants