RFR: JDK-8254889: name_and_sig_as_C_string usages in frame coding without ResourceMark
Matthias Baesken
mbaesken at openjdk.java.net
Fri Oct 16 13:18:09 UTC 2020
On Fri, 16 Oct 2020 12:46:32 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Hello, seems we have some usages of name_and_sig_as_C_string() in frame related HS coding without using a ResourceMark.
>> Please review.
>> Thanks, Matthias
>
> src/hotspot/share/runtime/frame.cpp line 1145:
>
>> 1143: #ifndef PRODUCT
>> 1144: void frame::describe(FrameValues& values, int frame_no) {
>> 1145: ResourceMark rm;
>
> Not sure this works. RA allocated memory escapes the function in FrameValues::describe() (via FrameValue::description):
>
> void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) {
> FrameValue fv;
> fv.location = location;
> fv.owner = owner;
> fv.priority = priority;
> fv.description = NEW_RESOURCE_ARRAY(char, strlen(description) + 1);
> strcpy(fv.description, description);
> _values.append(fv);
> }
Okay thanks , we have to take escaping memory indeed into consideration .
I think I should omit the frame_zero.cpp change.
In frame.cpp I could use a local buffer (any idea how large?) and the name_and_sig_as_C_string-version taking a
pre-allocated buffer : name_and_sig_as_C_string(buffer, buf_len) . Then there is not need to add the ResourceMark
, correct ?
-------------
PR: https://git.openjdk.java.net/jdk/pull/698
More information about the hotspot-dev
mailing list