RFR: 8295893: Improve printing of Constant Pool Cache Entries [v11]

Matias Saavedra Silva matsaave at openjdk.org
Fri Nov 4 19:07:29 UTC 2022


> As an extension of [JDK-8292699](https://bugs.openjdk.org/browse/JDK-8292699), this aims to further improve the printing of Constant Pool Cache entries. The contents and flag are decoded into human readable text with an appendix printed as before.
> 
> The text format and contents are tentative, please review.
> 
> Here is an example output when using `findmethod()`:
> 
> "Executing findmethod"
> flags (bitmask):
>    0x01  - print names of methods
>    0x02  - print bytecodes
>    0x04  - print the address of bytecodes
>    0x08  - print info for invokedynamic
>    0x10  - print info for invokehandle
> 
> [  0] 0x0000000801000800 class Concat0 loader data: 0x00007ffff02ddeb0 for instance a 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0x00000007fef59110}
> 0x00007fffa0400368 static method main : ([Ljava/lang/String;)V
>    0 iconst_0
>    1 istore_1
>    2 iload_1
>    3 iconst_2
>    4 if_icmpge 24
>    7 getstatic 7 <Concat0.s/Ljava/lang/String;> 
>   10 invokedynamic bsm=31 13 <makeConcatWithConstants(Ljava/lang/String;)Ljava/lang/String;>
>   BSM: REF_invokeStatic 32 <java/lang/invoke/StringConcatFactory.makeConcatWithConstants(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;> 
>   arguments[1] = {
>      000
>   }
>   ConstantPoolCacheEntry:   4
>  - this: 0x00007fffa0400570
>  - bytecode 1: invokedynamic ba
>  - bytecode 2: nop 00
>  - cp index:    13
>  - F1:  [   0x00000008000c8658]
>  - F2:  [   0x0000000000000003]
>  -     Method: 0x00000008000c8658 java.lang.Object java.lang.invoke.Invokers$Holder.linkToTargetMethod(java.lang.Object, java.lang.Object)
>  - flag values: [08|0|0|1|1|0|1|0|0|0|00|00|02]
>  - tos: object
>  - local signature: 1
>  - has appendix: 1
>  - forced virtual: 0
>  - final: 1
>  - virtual Final: 0
>  - resolution Failed: 0
>  - num Parameters: 02
>   Method: 0x00000008000c8658 java/lang/invoke/Invokers$Holder.linkToTargetMethod(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
>   appendix: java.lang.invoke.BoundMethodHandle$Species_LL 
> {0x000000011f021360} - klass: 'java/lang/invoke/BoundMethodHandle$Species_LL'
>  - ---- fields (total size 5 words):
>  - private 'customizationCount' 'B' @12  0 (0x00)
>  - private volatile 'updateInProgress' 'Z' @13  false (0x00)
>  - private final 'type' 'Ljava/lang/invoke/MethodType;' @16  a 'java/lang/invoke/MethodType'{0x000000011f0185b0} = (Ljava/lang/String;)Ljava/lang/String; (0x23e030b6)
>  - final 'form' 'Ljava/lang/invoke/LambdaForm;' @20  a 'java/lang/invoke/LambdaForm'{0x000000011f01df40} => a 'java/lang/invoke/MemberName'{0x000000011f0211e8} = {method} {0x00007fffa04012a8} 'invoke' '(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' in 'java/lang/invoke/LambdaForm$MH+0x0000000801000400' (0x23e03be8)
>  - private 'asTypeCache' 'Ljava/lang/invoke/MethodHandle;' @24  NULL (0x00000000)
>  - private 'asTypeSoftCache' 'Ljava/lang/ref/SoftReference;' @28  NULL (0x00000000)
>  - final 'argL0' 'Ljava/lang/Object;' @32  a 'java/lang/invoke/DirectMethodHandle'{0x000000011f019b70} (0x23e0336e)
>  - final 'argL1' 'Ljava/lang/Object;' @36  "000"{0x000000011f0193d0} (0x23e0327a)
>                  -------------
>   15 putstatic 17 <Concat0.d/Ljava/lang/String;> 
>   18 iinc #1 1
>   21 goto 2
>   24 return

Matias Saavedra Silva has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:

 - Merge branch 'master' into invokeDynamicPrinter
 - Fixed copyright
 - Fixed gtest
 - Fixed code formatting
 - Improved formatting
 - Added gtest
 - changed NULL to nullptr
 - Added null check and resource mark
 - fixed last trailing whitespace
 - Removed trailing whitespace
 - ... and 2 more: https://git.openjdk.org/jdk/compare/ba76c801...5e324d55

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10860/files
  - new: https://git.openjdk.org/jdk/pull/10860/files/d716d2e3..5e324d55

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10860&range=10
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10860&range=09-10

  Stats: 75177 lines in 949 files changed: 16590 ins; 55737 del; 2850 mod
  Patch: https://git.openjdk.org/jdk/pull/10860.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10860/head:pull/10860

PR: https://git.openjdk.org/jdk/pull/10860


More information about the hotspot-dev mailing list