Check for duplicate class definitions when creating rom class - #15322
Conversation
|
@gacholio can you take a look at this? I'm not sure if putting the check in during rom class creation causes us any issues anywhere else, but it seemed the best place to bail out as early as possible. |
|
At a glance, I dislike this being in the ROM code since it's calling out to hashClassTableAt. The new code also only comes into play if no name is provided from defineClass - is the case already handled when the name is provided? |
I am also not crazy about putting this in the rom code, however the other option is to do the check after the rom class is created, but that means wasting time creating a rom class which is just going to be thrown away. In the case where a name is provided the check is performed early in the jcl before attempting to load the class ( openj9/runtime/jcl/common/jcldefine.c Line 161 in cddb8bf |
|
Although I would consider this to be an error situation that really shouldn't come up in production, we've seen some pretty bad java code in the past, so avoiding creating ROM classes that never go away is probably a good idea (ROM classes are never discarded until the loader is unloaded). |
|
@tajila Are you OK with this (the change is appealingly simple where it is). The NULL check on the javaVM should allow cfdump to continue working. |
|
While you're here, the formatting here is off: https://github.com/eclipse-openj9/openj9/blob/master/runtime/jcl/common/jcldefine.c#L136-L137 In the case where a name is not specified, this code appears to call the hash code with NULLs which should crash (nothing to do with your change): openj9/runtime/jcl/common/jcldefine.c Line 157 in cddb8bf |
tajila
left a comment
There was a problem hiding this comment.
I think we need to do something like this to avoid throwing the linkage error after creating the ROM class in cases where no name is passed in. I can't see any alternative that doesn't involve some kind of class file parsing.
|
PR updated |
Fixes eclipse-openj9#15166 Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
|
fixed |
|
jenkins test sanity zlinux jdk11 |
@tajila Are you still concerned about anything? If not, I'll merge after testing completes. |
LGTM |
Fixes #15166
Signed-off-by: Devin Nakamura devinn@ca.ibm.com