RFR: 8301136: Improve unlink() and unlink_all() of ResourceHashtableBase [v3]
Ioi Lam
iklam at openjdk.org
Fri Jan 27 18:42:17 UTC 2023
On Fri, 27 Jan 2023 17:33:13 GMT, Xin Liu <xliu at openjdk.org> wrote:
>> Or rather, first have a patch to add unlink that takes a lambda and convert the uses to that. I don't see the motivation for this change.
>
> hi, @coleenp
>
> My primary goal is 'unlink_all()'. I can create a Simple Iterator and use unlink() to implement that, but it would be sub-optimal(eg. [jvmtiTagMapTable::clear](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/prims/jvmtiTagMapTable.cpp#L71)). When I roll it, I just realize that there are common logic among unlink(), unlink_all() and dtor. 'unlink_impl' is a template. It's not an API here.
>
> We can provide a lambda version of 'unlink()' in a new JBS issue, but I don't think we need to replace it with unlink(Iter*) completely. Functor and Lambda have different advantages. Functor is more formal and can be stateful. eg.
> `PurgeUnloadedConstraints` is big and deserve indents and comments. 'ResolutionErrorDeleteIterate' captures 'ConstantPool* p' for do_entry(). Can we do this is a separate JBS?
My request is to make the unlink APIs use the same design pattern as the iterate APIs. You should be able to use either lambda or a function object for doing the unlink. There should be no performance penalty either way because the C++ compiler can optimize all the noise out.
-------------
PR: https://git.openjdk.org/jdk/pull/12213
More information about the hotspot-dev
mailing list