-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Explicitly cast IP index to Int32 #12054
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
base: master
Are you sure you want to change the base?
Explicitly cast IP index to Int32 #12054
Conversation
If I remember correctly,
No, it was the first thing that came to my mind. How would |
I printed some stats for the programs in
So the instructions are usually size 10, but some may be different. |
Subtracting pointers returns `Int64`, but the difference, the `call_frame_index`, is within `Int32` b/c this is the key type of `CompiledInstructions#nodes`.
06b6530
to
0efcf9a
Compare
Subtracting pointers returns
Int64
, but the key type ofCompiledInstructions#nodes
isInt32
.I think we could probably make this an unchecked cast with
.to_i32!
.@asterite I'm wondering about the reasons to use
Hash(Int32, ASTNode)
forCompiledInstructions#nodes
. I suppose it could as well use the pointer address type (Int64
) as key type?Did you make an informed decision about using
Hash
instead of anArray
? Lookup for a specific would be much faster. I'm not sure about the effect on memory allocation, but it might not be too bad... From some random samplings it looks like 10% unused entries. We could perhaps improve that by skipping odd indices because instruction sizes should always (?) be even numbers.