[PING] Re: RFR: 8264565: Templatize num_arguments() functions of DCmd subclasses
Ioi Lam
ioi.lam at oracle.com
Mon Apr 5 17:01:19 UTC 2021
Hi, could I have one more review for this?
Thanks
- Ioi
On 4/1/21 11:11 AM, Ioi Lam wrote:
> We have many version of `num_arguments()` for the `DCmd` subclasses. They all have identical structure. We should templatize them to reduce duplicated code and avoid cut-and-paste errors.
>
> It's still possible to write a customized `num_arguments()` function (although none of the existing cases needs to do that). The rules are described here:
>
> class DCmd : public ResourceObj {
> ...
> // num_arguments() is used by the DCmdFactoryImpl::get_num_arguments() template functions.
> // - For subclasses of DCmdWithParser, it's calculated by DCmdParser::num_arguments().
> // - Other subclasses of DCmd have zero arguments by default. You can change this
> // by defining your own version of MyDCmd::num_arguments().
> static int num_arguments() { return 0; }
>
> -------------
>
> Commit messages:
> - removed remaining boilerplate num_arguments() functions
> - DebugOnCmdStartDCmd does not need to subclass from DCmdWithParser
> - 8264565: Templatize num_arguments() functions of DCmd subclasses
>
> Changes: https://git.openjdk.java.net/jdk/pull/3312/files
> Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3312&range=00
> Issue: https://bugs.openjdk.java.net/browse/JDK-8264565
> Stats: 277 lines in 8 files changed: 27 ins; 241 del; 9 mod
> Patch: https://git.openjdk.java.net/jdk/pull/3312.diff
> Fetch: git fetch https://git.openjdk.java.net/jdk pull/3312/head:pull/3312
>
> PR: https://git.openjdk.java.net/jdk/pull/3312
More information about the hotspot-dev
mailing list