RFR: 8211028 jdb "eval" should allow to create a new value type instance with specified fields

David Simms david.simms at oracle.com
Fri Oct 25 08:38:56 UTC 2019


Hi Frederic,

Thanks for the explanation on the signature handling. Obviously we may 
still be making changes, so this kind of documentation doubly important.

Thanks for adding a extra sanity test. A good start to be able to expand 
upon, once we get more certainty.

Looks good for my part.

/David Simms


On 24/10/19 8:46 PM, Frederic Parain wrote:
> Greetings,
>
> Please review this patch allowing the creation of new values of inline types
> from the jdb command line.
>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8211028
>
> Webrev:
> http://cr.openjdk.java.net/~fparain/8211028/webrev.00/index.html
>
> The patch includes modifications in JNI implementation: NewObject,
> NewObjectV and NewObjectA now return a ‘new’ value if the class
> passed in arguments is an inline type. This value is initialized
> with the arguments passed to the JNI method. The creation is
> performed by calling the static factory instead of doing the
> new/<init> sequence of identity classes.
>
> Another modification is in the behavior of the JDI method
> VirtualMachine.classesByName(String className). The method
> now does sometime a second request to the target VM in case
> the className could be the name of an inline type. This is an area
> which is likely to require some rework at the spec/API level.
>
> The main issue is that, when an user types this command in jdb:
>
> main[1] eval new Foo(1,2,3)
>
> jdb doesn’t know if Foo is the name of an identity class (and
> has a L-type signature) or of an inline type (which has a Q-type
> signature). The methodclassesByName() takes in argument a type
> name as defined in the Java language: “int”, “boolean”, “Foo”
> so it is also lacking a key information to generate the right
> signature. This is why the temporary hack is to detect if the
> legacy transformation from type name to signature includes a
> L-type signature (either directly or as an array element) and
> in this case, perform a second request with a Q-signature
> replacing the L-signature.
>
> Testing:
> jdk/com/sun/jdi tests + new unit test
>
> Thank you,
>
> Fred
>
>
>



More information about the valhalla-dev mailing list