-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[VM][Code cache v2] Some improvements in code cache #15537
Conversation
⏱️ 5h 52m total CI duration on this PR
🚨 2 jobs on the last run were significantly faster/slower than expected
|
|
||
if prev_idx.is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this as it can never happen - the Some(idx)
case is dealt with under the same write lock!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more of a paranoid check, but yes, tis is unreachable so removing should be ok
module: module_id, | ||
name: struct_name.to_owned(), | ||
})?); | ||
}; | ||
struct_names.push(struct_name_index_map.struct_name_to_idx(&struct_name)?); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit wasteful passing by ref here, but I guess we do not expect miss es to happen often in any case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By reference should actually be more efficient, but compiler optimizations would probably make them the same, or similar.
let idx = index_map.backward_map.len(); | ||
let prev_idx = index_map.forward_map.insert(struct_name.clone(), idx); | ||
index_map.backward_map.push(Arc::new(struct_name)); | ||
// Possibly need to insert, so make the copies outside of the lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: . in the end of a sentence?
) -> PartialVMResult<&'a Arc<StructIdentifier>> { | ||
index_map.backward_map.get(idx.0).ok_or_else(|| { | ||
let msg = format!( | ||
"Index out of bounds when accessing struct name reference \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of hthe other messages were "when constructing a struct tag" and "when accessing struct name at index". Not sure if we should support custom error messages for use-cases, it's beautiful with the helper - but maybe we can make the error message more generic.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
* some improvements in code cache * more refactoring * fixed comments
Some small code optimizations (weaker lock in to avoid readers to wait)
How Has This Been Tested?
Existing tests
Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist