8216262: Remove develop flag DelayCompilationDuringStartup
authorredestad
Tue, 08 Jan 2019 11:23:19 +0100
changeset 53193 184c51e48260
parent 53192 0042eb88035b
child 53194 c4a64760b1b0
child 53195 9fff411880fb
child 57100 489b1afd0ec8
8216262: Remove develop flag DelayCompilationDuringStartup Reviewed-by: kvn, thartmann
src/hotspot/share/interpreter/abstractInterpreter.cpp
src/hotspot/share/interpreter/invocationCounter.cpp
src/hotspot/share/interpreter/invocationCounter.hpp
src/hotspot/share/jvmci/jvmciCompiler.cpp
src/hotspot/share/prims/jni.cpp
src/hotspot/share/runtime/compilationPolicy.cpp
src/hotspot/share/runtime/compilationPolicy.hpp
src/hotspot/share/runtime/globals.hpp
src/hotspot/share/runtime/tieredThresholdPolicy.cpp
--- a/src/hotspot/share/interpreter/abstractInterpreter.cpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@
   if (PrintBytecodeHistogram)                                BytecodeHistogram::reset();
   if (PrintBytecodePairHistogram)                            BytecodePairHistogram::reset();
 
-  InvocationCounter::reinitialize(DelayCompilationDuringStartup);
+  InvocationCounter::reinitialize();
 
 }
 
--- a/src/hotspot/share/interpreter/invocationCounter.cpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/interpreter/invocationCounter.cpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -130,20 +130,11 @@
   _action[state] = action;
 }
 
-address dummy_invocation_counter_overflow(const methodHandle& m, TRAPS) {
-  ShouldNotReachHere();
-  return NULL;
-}
-
-void InvocationCounter::reinitialize(bool delay_overflow) {
+void InvocationCounter::reinitialize() {
   // define states
   guarantee((int)number_of_states <= (int)state_limit, "adjust number_of_state_bits");
   def(wait_for_nothing, 0, do_nothing);
-  if (delay_overflow) {
-    def(wait_for_compile, 0, do_decay);
-  } else {
-    def(wait_for_compile, 0, dummy_invocation_counter_overflow);
-  }
+  def(wait_for_compile, 0, do_decay);
 
   InterpreterInvocationLimit = CompileThreshold << number_of_noncount_bits;
   InterpreterProfileLimit = ((CompileThreshold * InterpreterProfilePercentage) / 100)<< number_of_noncount_bits;
@@ -167,5 +158,5 @@
 }
 
 void invocationCounter_init() {
-  InvocationCounter::reinitialize(DelayCompilationDuringStartup);
+  InvocationCounter::reinitialize();
 }
--- a/src/hotspot/share/interpreter/invocationCounter.hpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/interpreter/invocationCounter.hpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,7 +127,7 @@
 
   // Miscellaneous
   static ByteSize counter_offset()               { return byte_offset_of(InvocationCounter, _counter); }
-  static void reinitialize(bool delay_overflow);
+  static void reinitialize();
 
  private:
   static int         _init  [number_of_states];  // the counter limits
--- a/src/hotspot/share/jvmci/jvmciCompiler.cpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,10 +54,6 @@
   }
 
   set_state(initialized);
-
-  // JVMCI is considered as application code so we need to
-  // stop the VM deferring compilation now.
-  CompilationPolicy::completed_vm_startup();
 }
 
 void JVMCICompiler::bootstrap(TRAPS) {
--- a/src/hotspot/share/prims/jni.cpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/prims/jni.cpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -365,8 +365,6 @@
 
 
 
-static bool first_time_FindClass = true;
-
 DT_RETURN_MARK_DECL(FindClass, jclass
                     , HOTSPOT_JNI_FINDCLASS_RETURN(_ret_ref));
 
@@ -378,10 +376,6 @@
   jclass result = NULL;
   DT_RETURN_MARK(FindClass, jclass, (const jclass&)result);
 
-  // Remember if we are the first invocation of jni_FindClass
-  bool first_time = first_time_FindClass;
-  first_time_FindClass = false;
-
   // Sanity check the name:  it cannot be null or larger than the maximum size
   // name we can fit in the constant pool.
   if (name == NULL) {
@@ -434,13 +428,6 @@
     trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
   }
 
-  // If we were the first invocation of jni_FindClass, we enable compilation again
-  // rather than just allowing invocation counter to overflow and decay.
-  // Controlled by flag DelayCompilationDuringStartup.
-  if (first_time) {
-    CompilationPolicy::completed_vm_startup();
-  }
-
   return result;
 JNI_END
 
--- a/src/hotspot/share/runtime/compilationPolicy.cpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/runtime/compilationPolicy.cpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,12 +55,9 @@
 
 CompilationPolicy* CompilationPolicy::_policy;
 elapsedTimer       CompilationPolicy::_accumulated_time;
-bool               CompilationPolicy::_in_vm_startup;
 
 // Determine compilation policy based on command line argument
 void compilationPolicy_init() {
-  CompilationPolicy::set_in_vm_startup(DelayCompilationDuringStartup);
-
   switch(CompilationPolicyChoice) {
   case 0:
     CompilationPolicy::set_policy(new SimpleCompPolicy());
@@ -86,13 +83,6 @@
   CompilationPolicy::policy()->initialize();
 }
 
-void CompilationPolicy::completed_vm_startup() {
-  if (TraceCompilationPolicy) {
-    tty->print("CompilationPolicy: completed vm startup.\n");
-  }
-  _in_vm_startup = false;
-}
-
 // Returns true if m must be compiled before executing it
 // This is intended to force compiles for methods (usually for
 // debugging) that would otherwise be interpreted for some reason.
@@ -184,7 +174,7 @@
 
 bool CompilationPolicy::is_compilation_enabled() {
   // NOTE: CompileBroker::should_compile_new_jobs() checks for UseCompiler
-  return !delay_compilation_during_startup() && CompileBroker::should_compile_new_jobs();
+  return CompileBroker::should_compile_new_jobs();
 }
 
 CompileTask* CompilationPolicy::select_task_helper(CompileQueue* compile_queue) {
--- a/src/hotspot/share/runtime/compilationPolicy.hpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/runtime/compilationPolicy.hpp	Tue Jan 08 11:23:19 2019 +0100
@@ -49,10 +49,6 @@
   static bool must_be_compiled(const methodHandle& m, int comp_level = CompLevel_all);
 
 public:
-  static  void set_in_vm_startup(bool in_vm_startup) { _in_vm_startup = in_vm_startup; }
-  static  void completed_vm_startup();
-  static  bool delay_compilation_during_startup()    { return _in_vm_startup; }
-
   // If m must_be_compiled then request a compilation from the CompileBroker.
   // This supports the -Xcomp option.
   static void compile_if_required(const methodHandle& m, TRAPS);
--- a/src/hotspot/share/runtime/globals.hpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/runtime/globals.hpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1330,10 +1330,6 @@
   develop(bool, TypeProfileCasts,  true,                                    \
           "treat casts like calls for purposes of type profiling")          \
                                                                             \
-  develop(bool, DelayCompilationDuringStartup, true,                        \
-          "Delay invoking the compiler until main application class is "    \
-          "loaded")                                                         \
-                                                                            \
   develop(bool, FillDelaySlots, true,                                       \
           "Fill delay slots (on SPARC only)")                               \
                                                                             \
--- a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Tue Jan 08 11:02:26 2019 +0100
+++ b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Tue Jan 08 11:23:19 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -872,7 +872,7 @@
 }
 
 bool TieredThresholdPolicy::maybe_switch_to_aot(const methodHandle& mh, CompLevel cur_level, CompLevel next_level, JavaThread* thread) {
-  if (UseAOT && !delay_compilation_during_startup()) {
+  if (UseAOT) {
     if (cur_level == CompLevel_full_profile || cur_level == CompLevel_none) {
       // If the current level is full profile or interpreter and we're switching to any other level,
       // activate the AOT code back first so that we won't waste time overprofiling.