RFR: 8211028 jdb "eval" should allow to create a new value type instance with specified fields
Frederic Parain
frederic.parain at oracle.com
Fri Oct 25 19:49:42 UTC 2019
David,
Thank you for reviewing.
I’ve added a link to this discussion in the CR.
Fred
> On Oct 25, 2019, at 04:38, David Simms <david.simms at oracle.com> wrote:
>
> 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