-
Notifications
You must be signed in to change notification settings - Fork 53
Store cpu features in AOTCodeCache header #84
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: premain
Are you sure you want to change the base?
Conversation
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
👋 Welcome back asmehra! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
|
||
bool VM_Version::supports_features(void* features_buffer) { | ||
uint64_t features_to_test = *(uint64_t*)features_buffer; | ||
return (_features & features_to_test) == features_to_test; |
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.
Here you test whether the new machine has at least the same CPU features as the old (stored) machine. From our experience from CRaC one should rather compare the features are equal. As some features presence affect ABI of the JIT-compiled code and if the new machine has such CPU features the newly JITted code will be incompatible with ABI of the stored code cache.
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.
Could you provide more detail about your statement "some features presence affect ABI of the JIT-compiled code"?
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.
Simply said if you store the compiled Java code on old CPU (almost no features) and then run it on new CPU (full features) then it will crash. It crashes when a newly compiled code calls the restored code or vice versa. If you disagree I can try to reproduce with Leyden, it was happening with CRaC.
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.
@jankratochvil thanks for sharing your experience. It would be great if you can provide a reproducer.
CRaC project has a similar feature. In comparison here I miss here some command line option to disable this comparison ( |
It can be a future extension but Leyden may also find useful an equivalent of |
This is the initial version of storing cpu features in the AOTCodeCache to verify runtime env has the same cpu capabilities as the assembly env. It covers both x86 and aarch64.
AOTCodeCache header is updated to store the cpu features in arch-dependent form (although its same for currently supported architectures - x86 and aarch64).
It also fixes a bug - the
polling_page_vectors_safepoint_handler_blob
can be null if AVX is not present on a system. This causes crash as this blob's entry point is stored in the address table.I came across this when I did the assembly run with -XX:UseAVX=0 option.
Progress
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/leyden.git pull/84/head:pull/84
$ git checkout pull/84
Update a local copy of the PR:
$ git checkout pull/84
$ git pull https://git.openjdk.org/leyden.git pull/84/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 84
View PR using the GUI difftool:
$ git pr show -t 84
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/84.diff
Using Webrev
Link to Webrev Comment