RFR (T): 8241852: Cleanup error message generation in LinkResolver::resolve_field

David Holmes david.holmes at oracle.com
Wed Apr 1 02:58:58 UTC 2020


On 1/04/2020 12:58 am, Claes Redestad wrote:
> Hi Goetz,
> 
> On 2020-03-31 16:28, Lindenmaier, Goetz wrote:
>> Hi,
>>
>> I think you can remove the ResourceMark altogether.
>> Instead of ss.as_string() use ss.base().
>> The char* is allocated with malloc (this was changed previously).
>>   The internal string is zero terminated.
>> The StringStream object itself is on the stack.
> 
> yes, if we think it's cleaner we could go that route. While these
> ResourceMarks and stringStreams are all off the hot path, compilers
> might generate more compact code if we removed the ResourceMarks and
> used ss.base().

I don't think the ability to use ss.base() is widely realized. People 
tend to just copy existing usages. And base() is not a very informative 
name.

> I've already pushed this enhancement, though, but such an cleanup
> sounds like something that should be evaluated and applied in more
> places as a standalone RFE.

Agreed. With some additional usage documentation. :)

Cheers,
David

> Thanks!
> 
> /Claes
> 
>>
>> Best regards,
>>    Goetz.
>>
>>> -----Original Message-----
>>> From: hotspot-runtime-dev <hotspot-runtime-dev-
>>> bounces at openjdk.java.net> On Behalf Of Claes Redestad
>>> Sent: Monday, March 30, 2020 6:45 PM
>>> To: daniel.daugherty at oracle.com; Hotspot dev runtime <hotspot-runtime-
>>> dev at openjdk.java.net>
>>> Subject: Re: RFR (T): 8241852: Cleanup error message generation in
>>> LinkResolver::resolve_field
>>>
>>> On 2020-03-30 18:34, Daniel D. Daugherty wrote:
>>>> On 3/30/20 12:27 PM, Claes Redestad wrote:
>>>>> Hi,
>>>>>
>>>>> a couple of places in LinkResolver::resolve_field where we allocate
>>>>> ResourceMark and stringStream in a wider scope than necessary.
>>> Narrowing
>>>>> down the scope where they are declared in a similar way as done
>>>>> consistently in all other places in LinkResolver is a small and 
>>>>> trivial
>>>>> optimization:
>>>>>
>>>>> http://cr.openjdk.java.net/~redestad/8241852/open.00/
>>>>
>>>> src/hotspot/share/interpreter/linkResolver.cpp
>>>>       Please update the copyright year before you push.
>>>>
>>>
>>> Will do.
>>>
>>>>
>>>> Thumbs up! I concur that this is a trivial fix.
>>>
>>> Thanks!
>>>
>>> /Claes


More information about the hotspot-runtime-dev mailing list