RFR: 8264565: Templatize num_arguments() functions of DCmd subclasses [v2]
Ioi Lam
iklam at openjdk.java.net
Mon Apr 5 22:50:55 UTC 2021
> 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; }
Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge branch 'master' into 8264565-templatize-dcmd-num-arguments
- removed remaining boilerplate num_arguments() functions
- DebugOnCmdStartDCmd does not need to subclass from DCmdWithParser
- 8264565: Templatize num_arguments() functions of DCmd subclasses
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/3312/files
- new: https://git.openjdk.java.net/jdk/pull/3312/files/ec38f55e..373b1c11
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3312&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3312&range=00-01
Stats: 17290 lines in 172 files changed: 13403 ins; 2198 del; 1689 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