RFR: 8014021: TreeMaker.Params behaves inconsistently when the owning method has the same number of parameters as the number of parameter types requested [v2]

Archie L. Cobbs duke at openjdk.org
Sat Feb 18 16:39:34 UTC 2023


> The method `TreeMaker.Params` has what appears to be strange behavior: normally it creates parameters of the types passed in. However, if the given owner is a method, and the method happens to have the same number of parameters as the number of parameters requested, then the types of the owner method's parameters are used instead. This is weird and confusing.
> 
> What's really going on is that a method owner is _always_ being passed in, and when that method has parameters defined, there are _always_ exactly as many of them as there are types provided.
> 
> So what this method is really doing is just reusing the same symbols for the methods parameters if the method has them defined, otherwise creating the same number of placeholder parameters `x0`, `x1`, `x2`, etc.
> 
> This patch refactors this method and clarifies its usage to eliminate the confusion.

Archie L. Cobbs has updated the pull request incrementally with one additional commit since the last revision:

  Create two variants of TreeMaker.Params() for the two different use cases.

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/12627/files
  - new: https://git.openjdk.org/jdk/pull/12627/files/8a74f794..8a08b187

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12627&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12627&range=00-01

  Stats: 26 lines in 2 files changed: 12 ins; 6 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/12627.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12627/head:pull/12627

PR: https://git.openjdk.org/jdk/pull/12627


More information about the compiler-dev mailing list