RFR: 8302670: use-after-free related to PhaseIterGVN interaction with Unique_Node_List and Node_Stack [v2]
Emanuel Peter
epeter at openjdk.org
Wed May 10 12:47:27 UTC 2023
On Wed, 10 May 2023 11:15:53 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> update copyright years
>
> src/hotspot/share/libadt/vectset.hpp line 57:
>
>> 55: VectorSet(Arena* arena);
>> 56:
>> 57: // Allow move constructor for && (eg. capture return of function)
>
> It's not completely clear yet to me why this is required and how it correlates with `NONCOPYABLE` but I leave this to the experts :)
I took this from @jcking . From what I understand:
`NONCOPYABLE` disables the copy constructor (`&`) and move operator. Somehow, this also disables the move constructor (`&&`). Re-enabling that one allows things like returning local containers, and capturing them via that move constructor.
Unique_Node_List some_function() {
Unique_Node_List local_worklist;
// do stuff
return local_worklist;
}
void other_function() {
Unique_Node_List capture_worklist = some_function();
// capture_worklist has its scope widened to this function
}
But if someone has a more detailed explanation, I'm glad to hear it ;)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13833#discussion_r1189856118
More information about the hotspot-dev
mailing list