Skip to content

Commit

Permalink
8041676: remove the java.compiler system property
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, alanb, rriggs, iris
  • Loading branch information
jaikiran committed Apr 20, 2023
1 parent 781d6d7 commit b8f0a66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
31 changes: 8 additions & 23 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ char* Arguments::_java_command = nullptr;
SystemProperty* Arguments::_system_properties = nullptr;
size_t Arguments::_conservative_max_heap_alignment = 0;
Arguments::Mode Arguments::_mode = _mixed;
bool Arguments::_java_compiler = false;
bool Arguments::_xdebug_mode = false;
const char* Arguments::_java_vendor_url_bug = nullptr;
const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
Expand Down Expand Up @@ -1266,8 +1265,14 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop
#endif

if (strcmp(key, "java.compiler") == 0) {
process_java_compiler_argument(value);
// Record value in Arguments, but let it get passed to Java.
// we no longer support java.compiler system property, log a warning and let it get
// passed to Java, like any other system property
if (strlen(value) == 0 || strcasecmp(value, "NONE") == 0) {
// for applications using NONE or empty value, log a more informative message
warning("The java.compiler system property is obsolete and no longer supported, use -Xint");
} else {
warning("The java.compiler system property is obsolete and no longer supported.");
}
} else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
// sun.java.launcher.is_altjvm property is
// private and is processed in process_sun_java_launcher_properties();
Expand Down Expand Up @@ -1372,7 +1377,6 @@ void Arguments::set_mode_flags(Mode mode) {
// Set up default values for all flags.
// If you add a flag to any of the branches below,
// add a default value for it here.
set_java_compiler(false);
_mode = mode;

// Ensure Agent_OnLoad has the correct initial values.
Expand Down Expand Up @@ -1862,16 +1866,6 @@ jint Arguments::set_aggressive_opts_flags() {
}

//===========================================================================================================
// Parsing of java.compiler property

void Arguments::process_java_compiler_argument(const char* arg) {
// For backwards compatibility, Djava.compiler=NONE or ""
// causes us to switch to -Xint mode UNLESS -Xdebug
// is also specified.
if (strlen(arg) == 0 || strcasecmp(arg, "NONE") == 0) {
set_java_compiler(true); // "-Djava.compiler[=...]" most recently seen.
}
}

void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
if (_sun_java_launcher != _default_java_launcher) {
Expand Down Expand Up @@ -3004,15 +2998,6 @@ jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) {
}
}

// This must be done after all arguments have been processed.
// java_compiler() true means set to "NONE" or empty.
if (java_compiler() && !xdebug_mode()) {
// For backwards compatibility, we switch to interpreted mode if
// -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was
// not specified.
set_mode_flags(_int);
}

// CompileThresholdScaling == 0.0 is same as -Xint: Disable compilation (enable interpreter-only mode),
// but like -Xint, leave compilation thresholds unaffected.
// With tiered compilation disabled, setting CompileThreshold to 0 disables compilation as well.
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/runtime/arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ class Arguments : AllStatic {
// Operation modi
static Mode _mode;
static void set_mode_flags(Mode mode);
static bool _java_compiler;
static void set_java_compiler(bool arg) { _java_compiler = arg; }
static bool java_compiler() { return _java_compiler; }

// -Xdebug flag
static bool _xdebug_mode;
Expand Down Expand Up @@ -302,7 +299,6 @@ class Arguments : AllStatic {
static bool parse_argument(const char* arg, JVMFlagOrigin origin);
static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);
static void process_java_launcher_argument(const char*, void*);
static void process_java_compiler_argument(const char* arg);
static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
Expand Down
2 changes: 0 additions & 2 deletions src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,6 @@ public static native void arraycopy(Object src, int srcPos,
* <td>List of paths to search when loading libraries</td></tr>
* <tr><th scope="row">{@systemProperty java.io.tmpdir}</th>
* <td>Default temp file path</td></tr>
* <tr><th scope="row">{@systemProperty java.compiler}</th>
* <td>Name of JIT compiler to use</td></tr>
* <tr><th scope="row">{@systemProperty os.name}</th>
* <td>Operating system name</td></tr>
* <tr><th scope="row">{@systemProperty os.arch}</th>
Expand Down

1 comment on commit b8f0a66

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.