-
Notifications
You must be signed in to change notification settings - Fork 729
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
wip Stable and unique Lambda and LambdaForm class names #19763
base: master
Are you sure you want to change the base?
Conversation
@babsingh @hangshao0 Could you guys take a look? My main point of concern here is "uniqueness" of the I am also using Another minor issue is that I've created the I am open to any suggestions. |
I am also concerned about potential problems from collisions. Considering the large number of applications running on our JVM, if the wrong class is being used, it will result in unexpected behaviours. It could be very hard for our service and VM engineers to debug and trace back the cause to the collision. I see the uniqueID is an int. Is there a reason to restrict that to 4 bytes int ? I see you are relying on String.hashCode() for the hashcode, which has much higher collision possibility that algorithms like SHA-256. |
You may also consider taking advantage of |
@hangshao0 There is no reason for this restriction. I was just using what I had there. With something like SHA-256, are you comfortable with the collision probability such that we can ignore collisions in practice? If so, do you have any suggestions for what to take the SHA-256 of? |
I guess the unqinueness of the class comes from the strings that you used to calculate the hash code ? Before discussing about switching to things like SHA-256, I take a look at #19371 (comment). Maybe we can concatenating those strings and store it within the romClass. If we have Another possibility that I can think of is https://github.com/eclipse-openj9/openj9/blob/master/jcl/src/openj9.sharedclasses/share/classes/com/ibm/oti/shared/SharedClassTokenHelperImpl.java. The 2 public APIs there associate the class with a string token. After the class is stored with a string token, |
Ok, if this were the case then what I think what we would do is just check in the Java code with API you mentioned, continue to ignore LambdaForm classes in And the token I guess could be the stringified SHA hash of the concatenated string of the input parameters. |
Is there any reason preventing from simply doing a string concat of string tokens as the unique id (which use suffix of the lambda classname)? any hashing of the tokens cannot guarantee the uniqueness. As the target is to only do a name/id check and remove the need for class byte comparison, then having a slightly long name comparison to prevent collision is reasonable.
|
We can do the string concatenation and avoid hashing. But we still have two options here: Or just edit this current patch to use the concatenated string rather than the hash. |
This is an easier solution. |
This is fine for the LambdaForms, except for the stringified For parameter strings that may contain those characters, what are your proposals? I was thinking we could still take the edit: Actually, we can just string replace the invalid characters with |
This seem to be the simplest solution, any hashcode we use could result in a collision which will complicate the cache/lookup logic. |
8d34c85
to
f17e8a7
Compare
In the extensions patch, I've replaced all occurrences of If we are happy on a high level with using the stringified version rather than the hash based version, what about the use of |
You can add a new API like |
b391468
to
8771e92
Compare
8771e92
to
2b46b6c
Compare
This WIP patch accompanies ibmruntimes/openj9-openjdk-jdk11#791 and:
LambdaForm
SCC cachingfindInSCC
procedure for looking upLambda
andLambdaForm
classesLambdas
when creating ROM classesLambdas
due to the addition of a stable class nameOnly currently tested for Java versions < 21 due to the index number removal on
Lambdas
in 21.Signed-off-by: Nathan Henderson [email protected]