Skip to content

8349945: Implement strict static fields (proposed JVM feature) #1443

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

Draft
wants to merge 14 commits into
base: lworld
Choose a base branch
from

Conversation

matias9927
Copy link
Contributor

@matias9927 matias9927 commented Apr 24, 2025

This patch enables and implements fields with the ACC_STATIC and ACC_STRICT modifiers. To enforce strictness on static fields, the reads and writes on the field are tracked dynamically to ensure that the field is written before being read and written to before .


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8349945: Implement strict static fields (proposed JVM feature) (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1443/head:pull/1443
$ git checkout pull/1443

Update a local copy of the PR:
$ git checkout pull/1443
$ git pull https://git.openjdk.org/valhalla.git pull/1443/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1443

View PR using the GUI difftool:
$ git pr show -t 1443

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1443.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 24, 2025

👋 Welcome back matsaave! A progress list of the required criteria for merging this PR into lworld will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 24, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Apr 24, 2025

@matias9927 this pull request can not be integrated into lworld due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout strict_static_8349945
git fetch https://git.openjdk.org/valhalla.git lworld
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge lworld"
git push

InstanceKlass* ik = InstanceKlass::cast(klass);
fieldDescriptor fd;
if (ik->find_local_field_from_offset((int)sfoffset, true, &fd)) {
// Note: The Unsafe API takes an OFFSET, but the InstanceKlass wants the INDEX.
Copy link
Member

@liach liach Apr 25, 2025

Choose a reason for hiding this comment

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

Is the index available for MethodHandles::init_field_MemberName? Should we pass it there?

A counterargument may be that this only happens in the class initializer so the overhead shouldn't be that hefty.

@openjdk openjdk bot removed the merge-conflict label May 7, 2025
@matias9927 matias9927 changed the title Strict static 8349945 8349945: implement strict static fields (proposed JVM feature) May 15, 2025
@matias9927 matias9927 changed the title 8349945: implement strict static fields (proposed JVM feature) 8349945: Implement strict static fields (proposed JVM feature) May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants