RFR: 8276571: C2: pass compilation options as structure
Aleksey Shipilev
shade at openjdk.java.net
Thu Nov 4 09:40:11 UTC 2021
On Wed, 3 Nov 2021 18:49:47 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> Currently we pass several compilation options as separate arguments to `Compile`:
>
> Compile C(env, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, do_locks_coarsening, install_code, directive);
>
> Originally we had only `subsume_loads` option but we added few since then and we may add more.
>
> I suggest to add new `Options` class to pass these values into `Compile`.
I like the way it is going, but unfortunately I find the list of unnamed boolean arguments as confusing and error-prone as before... Could we use "named parameters idiom" here, or some other way to name these parameters?
Something like:
class Options {
Options() : _subsume_loads(false), _do_escape_analysis(false) {};
Options& subsume_loads() { _subsume_loads = true; return *this; }
Options& do_escape_analysis() { _do_escape_analysis = true; return *this; }
}
src/hotspot/share/opto/compile.cpp line 490:
> 488: #ifndef PRODUCT
> 489: // Check if recompiling
> 490: if ((subsume_loads() == false) && PrintOpto) {
Suggestion:
if (!subsume_loads() && PrintOpto) {
-------------
PR: https://git.openjdk.java.net/jdk/pull/6237
More information about the hotspot-dev
mailing list