RFR: 8272107: Removal of Unsafe::defineAnonymousClass left a dangling C++ class
Ioi Lam
iklam at openjdk.java.net
Tue Aug 10 17:22:52 UTC 2021
On Tue, 10 Aug 2021 16:37:44 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Please review this change to remove the now unused CPSlot class. Uses of CPSlot have been replaced with Symbol*. The change was tested by running JCK lang and VM tests, Mach5 tiers 1-2 on Linux, Mac OS, and WIndows and Macn5 tiers 3-5 on Linux x64.
>>
>> Thanks, Harold
>
> src/hotspot/share/oops/constantPool.inline.hpp line 39:
>
>> 37: intptr_t adr = Atomic::load_acquire(obj_at_addr(which));
>> 38: assert(adr != 0 || which == 0, "cp entry for klass should not be zero");
>> 39: return (Symbol*)adr;
>
> I think you can get rid of all slot_at* and replace them with symbol_at(). Since the symbols don't change after the constant pool is initialized, all this volatile isn't needed. Used to be used to replace Symbol* with Klass* also. @iklam can confirm.
`ConstantPool` objects are no modified after the class is linked, and linking is done single threaded. So there's no need to use the `Atomic::load_acquire` in the above code. I agree with Coleen that the above function can be replaced with symbol_at().
-------------
PR: https://git.openjdk.java.net/jdk/pull/5070
More information about the hotspot-dev
mailing list