> On Sep 25, 2020, at 6:22 AM, Lutz Schmidt <l...@openjdk.java.net> wrote: > > On Fri, 25 Sep 2020 05:46:08 GMT, Kim Barrett <kbarr...@openjdk.org> wrote: > > Another note, actually, it's more like a question: > Has anyone had an eye on what happens in initialize_shared_locs(relocInfo* > buf, int length)? To my understanding, > "buf", which is passed in as "locs_buf", is stored into CodeBuffer fields. Is > that a good idea? "locs_buf" points into > the stack. This pointer becomes invalid at the end of the "locs_buf" scope. > Did I get something wrong here?
It’s “odd” but I think it’s more or less okay. Here and in other uses we seem to be allocating dynamically scoped storage for temporary use by the CodeBuffer. I think a more normal formulation might be to allocate the buffer, then pass it to the CodeBuffer constructor as a non-transfer of ownership. But I haven’t looked at all the places where this is used, and that’s perhaps out of scope for the problem at hand. > ------------- > > PR: https://git.openjdk.java.net/jdk/pull/348