On Wed, 19 Feb 2025 02:08:28 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

> There is a lot of subclassing of CodeBlob types done in SA to mimic hotspot, 
> but most of it is unnecessary. The generic CodeBlob class can handle all 
> support needed by most of the subclasses. The only subclasses we need to keep 
> around around NMethod, RuntimeStub, and UpcallStub, since they all have 
> special support in SA. I also kept around RuntimeBlob so RuntimeStub can 
> continue to inherit from it and be consistent with hotspot, but it's not 
> actually necessary, and I'm more than happy to remove it also.
> 
> I also cleaned up the PStack support for CodeBlobs. It can just use 
> CodeBlob.getName() rather than trying to figure out the type of the CodeBlob 
> instance to print out type name. This allows us to get rid of most isXXX() 
> APIs. It also provides more useful output in some cases. 
> 
> There is some minor loss of functionality in some of the CodeBlob subtypes I 
> removed. For example this is what AdapterBlob.getName() looked like (it is 
> now gone):
> 
> 
>   public String getName() {
>     return "AdapterBlob: " + super.getName();
>   }
> 
> 
> So now we just use the default CodeBlob.getName(), which is what 
> super.getName() would up execute. I think for AdapterBlob this always returns 
> "I2C/C2I adapters", so now you only get this rather than "AdapterBlob: 
> I2C/C2I adapters". We have a similar loss of getName() detail with 
> MethodHandlesAdapterBlob (now returns "MethodHandles adapters") and 
> VtableBlob (now returns "vtable chunks"). Basically for these 3 CodeBlob 
> types getName() will no longer include the CodeBlob type.  I could special 
> case them in CodeBlob.getName() by fetching the kind to determine what the 
> proper name should be. Let me know if you think it is worth it.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeStub.java line 
47:

> 45:   private static void initialize(TypeDataBase db) {
> 46:     Type type = db.lookupType("RuntimeStub");
> 47:     callerMustGCArgumentsField = 
> type.getCIntegerField("_caller_must_gc_arguments");

This field is in `CodeBlob` since JDK 23 
[JDK-8329433](https://bugs.openjdk.org/browse/JDK-8329433) 
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/codeBlob.hpp#L126

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23684#discussion_r1960893284

Reply via email to