8214917: CTW testlibrary shouldn't ignore errors raised by the library itself
authoriignatyev
Mon, 10 Dec 2018 11:04:55 -0800
changeset 52934 8deeb7bba516
parent 52933 13173122094f
child 52935 4aa8fe00ace9
child 57069 b8385a806d2b
8214917: CTW testlibrary shouldn't ignore errors raised by the library itself Reviewed-by: kvn, roland
src/hotspot/share/ci/ciMethod.cpp
src/hotspot/share/classfile/classLoader.cpp
src/hotspot/share/classfile/classLoader.hpp
src/hotspot/share/compiler/compileBroker.cpp
src/hotspot/share/compiler/compilerDefinitions.cpp
src/hotspot/share/jvmci/jvmciCompiler.cpp
src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp
src/hotspot/share/oops/constantPool.cpp
src/hotspot/share/oops/constantPool.hpp
src/hotspot/share/opto/bytecodeInfo.cpp
src/hotspot/share/opto/castnode.cpp
src/hotspot/share/opto/connode.cpp
src/hotspot/share/prims/jni.cpp
src/hotspot/share/runtime/compilationPolicy.cpp
src/hotspot/share/runtime/globals.hpp
src/hotspot/share/runtime/tieredThresholdPolicy.cpp
test/hotspot/jtreg/testlibrary/ctw/Makefile
--- a/src/hotspot/share/ci/ciMethod.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/ci/ciMethod.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -403,7 +403,7 @@
 // information.
 MethodLivenessResult ciMethod::liveness_at_bci(int bci) {
   MethodLivenessResult result = raw_liveness_at_bci(bci);
-  if (CURRENT_ENV->should_retain_local_variables() || DeoptimizeALot || CompileTheWorld) {
+  if (CURRENT_ENV->should_retain_local_variables() || DeoptimizeALot) {
     // Keep all locals live for the user's edification and amusement.
     result.at_put_range(0, result.size(), true);
   }
@@ -1210,7 +1210,7 @@
 // ciMethod::check_call
 bool ciMethod::check_call(int refinfo_index, bool is_static) const {
   // This method is used only in C2 from InlineTree::ok_to_inline,
-  // and is only used under -Xcomp or -XX:CompileTheWorld.
+  // and is only used under -Xcomp.
   // It appears to fail when applied to an invokeinterface call site.
   // FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points.
   VM_ENTRY_MARK;
--- a/src/hotspot/share/classfile/classLoader.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/classfile/classLoader.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -453,37 +453,6 @@
   return ((*JImageFindResource)(jf, module_name, get_jimage_version_string(), file_name, &size));
 }
 
-#ifndef PRODUCT
-bool ctw_visitor(JImageFile* jimage,
-        const char* module_name, const char* version, const char* package,
-        const char* name, const char* extension, void* arg) {
-  if (strcmp(extension, "class") == 0) {
-    Thread* THREAD = Thread::current();
-    ResourceMark rm(THREAD);
-    char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JIMAGE_MAX_PATH);
-    jio_snprintf(path, JIMAGE_MAX_PATH - 1, "%s/%s.class", package, name);
-    ClassLoader::compile_the_world_in(path, *(Handle*)arg, THREAD);
-    return !HAS_PENDING_EXCEPTION;
-  }
-  return true;
-}
-
-void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
-  tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
-  tty->cr();
-  (*JImageResourceIterator)(_jimage, (JImageResourceVisitor_t)ctw_visitor, (void *)&loader);
-  if (HAS_PENDING_EXCEPTION) {
-    if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
-      CLEAR_PENDING_EXCEPTION;
-      tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
-      tty->print_cr("Increase class metadata storage if a limit was set");
-    } else {
-      tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
-    }
-  }
-}
-#endif
-
 bool ClassPathImageEntry::is_modules_image() const {
   return ClassLoader::is_modules_image(name());
 }
@@ -1751,247 +1720,6 @@
   }
 }
 
-#ifndef PRODUCT
-
-// CompileTheWorld
-//
-// Iterates over all class path entries and forces compilation of all methods
-// in all classes found. Currently, only zip/jar archives are searched.
-//
-// The classes are loaded by the Java level bootstrap class loader, and the
-// initializer is called. If DelayCompilationDuringStartup is true (default),
-// the interpreter will run the initialization code. Note that forcing
-// initialization in this way could potentially lead to initialization order
-// problems, in which case we could just force the initialization bit to be set.
-
-
-// We need to iterate over the contents of a zip/jar file, so we replicate the
-// jzcell and jzfile definitions from zip_util.h but rename jzfile to real_jzfile,
-// since jzfile already has a void* definition.
-//
-// Note that this is only used in debug mode.
-//
-// HotSpot integration note:
-// Matches zip_util.h 1.14 99/06/01 from jdk1.3 beta H build
-
-
-// JDK 1.3 version
-typedef struct real_jzentry {         /* Zip file entry */
-    char *name;                 /* entry name */
-    jint time;                  /* modification time */
-    jint size;                  /* size of uncompressed data */
-    jint csize;                 /* size of compressed data (zero if uncompressed) */
-    jint crc;                   /* crc of uncompressed data */
-    char *comment;              /* optional zip file comment */
-    jbyte *extra;               /* optional extra data */
-    jint pos;                   /* position of LOC header (if negative) or data */
-} real_jzentry;
-
-typedef struct real_jzfile {  /* Zip file */
-    char *name;                 /* zip file name */
-    jint refs;                  /* number of active references */
-    jint fd;                    /* open file descriptor */
-    void *lock;                 /* read lock */
-    char *comment;              /* zip file comment */
-    char *msg;                  /* zip error message */
-    void *entries;              /* array of hash cells */
-    jint total;                 /* total number of entries */
-    unsigned short *table;      /* Hash chain heads: indexes into entries */
-    jint tablelen;              /* number of hash eads */
-    real_jzfile *next;        /* next zip file in search list */
-    jzentry *cache;             /* we cache the most recently freed jzentry */
-    /* Information on metadata names in META-INF directory */
-    char **metanames;           /* array of meta names (may have null names) */
-    jint metacount;             /* number of slots in metanames array */
-    /* If there are any per-entry comments, they are in the comments array */
-    char **comments;
-} real_jzfile;
-
-void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
-  // For now we only compile all methods in all classes in zip/jar files
-  tty->print_cr("CompileTheWorld : Skipped classes in %s", _dir);
-  tty->cr();
-}
-
-void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
-  real_jzfile* zip = (real_jzfile*) _zip;
-  tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name);
-  tty->cr();
-  // Iterate over all entries in zip file
-  for (int n = 0; ; n++) {
-    real_jzentry * ze = (real_jzentry *)((*GetNextEntry)(_zip, n));
-    if (ze == NULL) break;
-    ClassLoader::compile_the_world_in(ze->name, loader, CHECK);
-  }
-  if (HAS_PENDING_EXCEPTION) {
-    if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
-      CLEAR_PENDING_EXCEPTION;
-      tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
-      tty->print_cr("Increase class metadata storage if a limit was set");
-    } else {
-      tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
-    }
-  }
-}
-
-void ClassLoader::compile_the_world() {
-  EXCEPTION_MARK;
-  HandleMark hm(THREAD);
-  ResourceMark rm(THREAD);
-
-  assert(has_jrt_entry(), "Compile The World not supported with exploded module build");
-
-  // Find bootstrap loader
-  Handle system_class_loader (THREAD, SystemDictionary::java_system_loader());
-  jlong start = os::javaTimeMillis();
-
-  // Compile the world for the modular java runtime image
-  _jrt_entry->compile_the_world(system_class_loader, CATCH);
-
-  // Iterate over all bootstrap class path appended entries
-  ClassPathEntry* e = _first_append_entry;
-  while (e != NULL) {
-    assert(!e->is_modules_image(), "A modular java runtime image is present on the list of appended entries");
-    e->compile_the_world(system_class_loader, CATCH);
-    e = e->next();
-  }
-  jlong end = os::javaTimeMillis();
-  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, " JLONG_FORMAT " ms)",
-                _compile_the_world_class_counter, _compile_the_world_method_counter, (end - start));
-  {
-    // Print statistics as if before normal exit:
-    extern void print_statistics();
-    print_statistics();
-  }
-  vm_exit(0);
-}
-
-int ClassLoader::_compile_the_world_class_counter = 0;
-int ClassLoader::_compile_the_world_method_counter = 0;
-static int _codecache_sweep_counter = 0;
-
-// Filter out all exceptions except OOMs
-static void clear_pending_exception_if_not_oom(TRAPS) {
-  if (HAS_PENDING_EXCEPTION &&
-      !PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
-    CLEAR_PENDING_EXCEPTION;
-  }
-  // The CHECK at the caller will propagate the exception out
-}
-
-/**
- * Returns if the given method should be compiled when doing compile-the-world.
- *
- * TODO:  This should be a private method in a CompileTheWorld class.
- */
-static bool can_be_compiled(const methodHandle& m, int comp_level) {
-  assert(CompileTheWorld, "must be");
-
-  // It's not valid to compile a native wrapper for MethodHandle methods
-  // that take a MemberName appendix since the bytecode signature is not
-  // correct.
-  vmIntrinsics::ID iid = m->intrinsic_id();
-  if (MethodHandles::is_signature_polymorphic(iid) && MethodHandles::has_member_arg(iid)) {
-    return false;
-  }
-
-  return CompilationPolicy::can_be_compiled(m, comp_level);
-}
-
-void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
-  if (string_ends_with(name, ".class")) {
-    // We have a .class file
-    int len = (int)strlen(name);
-    char buffer[2048];
-    strncpy(buffer, name, len - 6);
-    buffer[len-6] = 0;
-    // If the file has a period after removing .class, it's not really a
-    // valid class file.  The class loader will check everything else.
-    if (strchr(buffer, '.') == NULL) {
-      _compile_the_world_class_counter++;
-      if (_compile_the_world_class_counter > CompileTheWorldStopAt) return;
-
-      // Construct name without extension
-      TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK);
-      // Use loader to load and initialize class
-      Klass* k = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
-      if (k != NULL && !HAS_PENDING_EXCEPTION) {
-        k->initialize(THREAD);
-      }
-      bool exception_occurred = HAS_PENDING_EXCEPTION;
-      clear_pending_exception_if_not_oom(CHECK);
-      if (CompileTheWorldPreloadClasses && k != NULL) {
-        InstanceKlass* ik = InstanceKlass::cast(k);
-        ConstantPool::preload_and_initialize_all_classes(ik->constants(), THREAD);
-        if (HAS_PENDING_EXCEPTION) {
-          // If something went wrong in preloading we just ignore it
-          clear_pending_exception_if_not_oom(CHECK);
-          tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_class_counter, buffer);
-        }
-      }
-
-      if (_compile_the_world_class_counter >= CompileTheWorldStartAt) {
-        if (k == NULL || exception_occurred) {
-          // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
-          tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_class_counter, buffer);
-        } else {
-          tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_class_counter, buffer);
-          // Preload all classes to get around uncommon traps
-          // Iterate over all methods in class
-          int comp_level = CompilationPolicy::policy()->initial_compile_level();
-          InstanceKlass* ik = InstanceKlass::cast(k);
-          for (int n = 0; n < ik->methods()->length(); n++) {
-            methodHandle m (THREAD, ik->methods()->at(n));
-            if (can_be_compiled(m, comp_level)) {
-              if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
-                // Give sweeper a chance to keep up with CTW
-                VM_CTWThreshold op;
-                VMThread::execute(&op);
-                _codecache_sweep_counter = 0;
-              }
-              // Force compilation
-              CompileBroker::compile_method(m, InvocationEntryBci, comp_level,
-                                            methodHandle(), 0, CompileTask::Reason_CTW, THREAD);
-              if (HAS_PENDING_EXCEPTION) {
-                clear_pending_exception_if_not_oom(CHECK);
-                tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
-              } else {
-                _compile_the_world_method_counter++;
-              }
-              if (TieredCompilation && TieredStopAtLevel >= CompLevel_full_optimization) {
-                // Clobber the first compile and force second tier compilation
-                CompiledMethod* nm = m->code();
-                if (nm != NULL && !m->is_method_handle_intrinsic()) {
-                  // Throw out the code so that the code cache doesn't fill up
-                  nm->make_not_entrant();
-                }
-                CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
-                                              methodHandle(), 0, CompileTask::Reason_CTW, THREAD);
-                if (HAS_PENDING_EXCEPTION) {
-                  clear_pending_exception_if_not_oom(CHECK);
-                  tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
-                } else {
-                  _compile_the_world_method_counter++;
-                }
-              }
-            } else {
-              tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
-            }
-
-            CompiledMethod* nm = m->code();
-            if (nm != NULL && !m->is_method_handle_intrinsic()) {
-              // Throw out the code so that the code cache doesn't fill up
-              nm->make_not_entrant();
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-#endif //PRODUCT
-
 // Please keep following two functions at end of this file. With them placed at top or in middle of the file,
 // they could get inlined by agressive compiler, an unknown trick, see bug 6966589.
 void PerfClassTraceTime::initialize() {
--- a/src/hotspot/share/classfile/classLoader.hpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/classfile/classLoader.hpp	Mon Dec 10 11:04:55 2018 -0800
@@ -60,8 +60,6 @@
   // Attempt to locate file_name through this class path entry.
   // Returns a class file parsing stream if successfull.
   virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
-  // Debugging
-  NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
 };
 
 class ClassPathDirEntry: public ClassPathEntry {
@@ -75,8 +73,6 @@
   ClassPathDirEntry(const char* dir);
   virtual ~ClassPathDirEntry() {}
   ClassFileStream* open_stream(const char* name, TRAPS);
-  // Debugging
-  NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 };
 
 
@@ -107,8 +103,6 @@
   u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
   ClassFileStream* open_stream(const char* name, TRAPS);
   void contents_do(void f(const char* name, void* context), void* context);
-  // Debugging
-  NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 };
 
 
@@ -126,9 +120,6 @@
   ClassPathImageEntry(JImageFile* jimage, const char* name);
   virtual ~ClassPathImageEntry();
   ClassFileStream* open_stream(const char* name, TRAPS);
-
-  // Debugging
-  NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 };
 
 // ModuleClassPathList contains a linked list of ClassPathEntry's
@@ -447,17 +438,6 @@
 
   // Debugging
   static void verify()              PRODUCT_RETURN;
-
-  // Force compilation of all methods in all classes in bootstrap class path (stress test)
-#ifndef PRODUCT
- protected:
-  static int _compile_the_world_class_counter;
-  static int _compile_the_world_method_counter;
- public:
-  static void compile_the_world();
-  static void compile_the_world_in(char* name, Handle loader, TRAPS);
-  static int  compile_the_world_counter() { return _compile_the_world_class_counter; }
-#endif //PRODUCT
 };
 
 // PerfClassTraceTime is used to measure time for class loading related events.
--- a/src/hotspot/share/compiler/compileBroker.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -1306,7 +1306,7 @@
       CompilationPolicy::policy()->delay_compilation(method());
       return NULL;
     }
-    bool is_blocking = !directive->BackgroundCompilationOption || CompileTheWorld || ReplayCompiles;
+    bool is_blocking = !directive->BackgroundCompilationOption || ReplayCompiles;
     compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, is_blocking, THREAD);
   }
 
@@ -2247,11 +2247,11 @@
     }
 
 #ifndef PRODUCT
-    if (CompileTheWorld || ExitOnFullCodeCache) {
+    if (ExitOnFullCodeCache) {
       codecache_print(/* detailed= */ true);
       before_exit(JavaThread::current());
       exit_globals(); // will delete tty
-      vm_direct_exit(CompileTheWorld ? 0 : 1);
+      vm_direct_exit(1);
     }
 #endif
     if (UseCodeCacheFlushing) {
--- a/src/hotspot/share/compiler/compilerDefinitions.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/compiler/compilerDefinitions.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -314,9 +314,9 @@
   }
 #endif
 
-  if (BackgroundCompilation && (CompileTheWorld || ReplayCompiles)) {
+  if (BackgroundCompilation && ReplayCompiles) {
     if (!FLAG_IS_DEFAULT(BackgroundCompilation)) {
-      warning("BackgroundCompilation disabled due to CompileTheWorld or ReplayCompiles options.");
+      warning("BackgroundCompilation disabled due to ReplayCompiles option.");
     }
     FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
   }
--- a/src/hotspot/share/jvmci/jvmciCompiler.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -65,12 +65,6 @@
     // Nothing to do in -Xint mode
     return;
   }
-#ifndef PRODUCT
-  // We turn off CompileTheWorld so that compilation requests are not
-  // ignored during bootstrap or that JVMCI can be compiled by C1/C2.
-  FlagSetting ctwOff(CompileTheWorld, false);
-#endif
-
   _bootstrapping = true;
   ResourceMark rm;
   HandleMark hm;
--- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -206,8 +206,6 @@
   do_uintx_flag(CodeCacheSegmentSize)                                      \
   do_intx_flag(CodeEntryAlignment)                                         \
   do_bool_flag(CompactFields)                                              \
-  NOT_PRODUCT(do_intx_flag(CompileTheWorldStartAt))                        \
-  NOT_PRODUCT(do_intx_flag(CompileTheWorldStopAt))                         \
   do_intx_flag(ContendedPaddingWidth)                                      \
   do_bool_flag(DontCompileHugeMethods)                                     \
   do_bool_flag(EagerJVMCI)                                                 \
--- a/src/hotspot/share/oops/constantPool.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/oops/constantPool.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -2326,29 +2326,6 @@
 #endif // ASSERT
 }
 
-#ifndef PRODUCT
-
-// CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
-void ConstantPool::preload_and_initialize_all_classes(ConstantPool* obj, TRAPS) {
-  guarantee(obj->is_constantPool(), "object must be constant pool");
-  constantPoolHandle cp(THREAD, (ConstantPool*)obj);
-  guarantee(cp->pool_holder() != NULL, "must be fully loaded");
-
-  for (int i = 0; i< cp->length();  i++) {
-    if (cp->tag_at(i).is_unresolved_klass()) {
-      // This will force loading of the class
-      Klass* klass = cp->klass_at(i, CHECK);
-      if (klass->is_instance_klass()) {
-        // Force initialization of class
-        InstanceKlass::cast(klass)->initialize(CHECK);
-      }
-    }
-  }
-}
-
-#endif
-
-
 // Printing
 
 void ConstantPool::print_on(outputStream* st) const {
--- a/src/hotspot/share/oops/constantPool.hpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/oops/constantPool.hpp	Mon Dec 10 11:04:55 2018 -0800
@@ -938,11 +938,6 @@
   void print_entry_on(int index, outputStream* st);
 
   const char* internal_name() const { return "{constant pool}"; }
-
-#ifndef PRODUCT
-  // Compile the world support
-  static void preload_and_initialize_all_classes(ConstantPool* constant_pool, TRAPS);
-#endif
 };
 
 class SymbolHashMapEntry : public CHeapObj<mtSymbol> {
--- a/src/hotspot/share/opto/bytecodeInfo.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/opto/bytecodeInfo.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -288,8 +288,8 @@
     return false;
   }
 
-  // don't use counts with -Xcomp or CTW
-  if (UseInterpreter && !CompileTheWorld) {
+  // don't use counts with -Xcomp
+  if (UseInterpreter) {
 
     if (!callee_method->has_compiled_code() &&
         !callee_method->was_executed_more_than(0)) {
@@ -364,9 +364,9 @@
       }
     }
 
-    if ((!UseInterpreter || CompileTheWorld) &&
+    if (!UseInterpreter &&
         is_init_with_ea(callee_method, caller_method, C)) {
-      // Escape Analysis stress testing when running Xcomp or CTW:
+      // Escape Analysis stress testing when running Xcomp:
       // inline constructors even if they are not reached.
     } else if (forced_inline()) {
       // Inlining was forced by CompilerOracle, ciReplay or annotation
@@ -453,7 +453,7 @@
   // Check if klass of callee_method is loaded
   if( !callee_holder->is_loaded() )      return false;
   if( !callee_holder->is_initialized() ) return false;
-  if( !UseInterpreter || CompileTheWorld /* running Xcomp or CTW */ ) {
+  if( !UseInterpreter ) /* running Xcomp */ {
     // Checks that constant pool's call site has been visited
     // stricter than callee_holder->is_initialized()
     ciBytecodeStream iter(caller_method);
--- a/src/hotspot/share/opto/castnode.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/opto/castnode.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -291,7 +291,7 @@
     return this;
   }
   // Toned down to rescue meeting at a Phi 3 different oops all implementing
-  // the same interface.  CompileTheWorld starting at 502, kd12rc1.zip.
+  // the same interface.
   return (phase->type(in(1)) == phase->type(this)) ? in(1) : this;
 }
 
--- a/src/hotspot/share/opto/connode.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/opto/connode.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -57,8 +57,7 @@
   case T_NARROWKLASS: return new ConNKlassNode( t->is_narrowklass() );
   case T_METADATA:    return new ConPNode( t->is_ptr() );
     // Expected cases:  TypePtr::NULL_PTR, any is_rawptr()
-    // Also seen: AnyPtr(TopPTR *+top); from command line:
-    //   r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660
+    // Also seen: AnyPtr(TopPTR *+top);
     // %%%% Stop using TypePtr::NULL_PTR to represent nulls:  use either TypeRawPtr::NULL_PTR
     // or else TypeOopPtr::NULL_PTR.  Then set Type::_basic_type[AnyPtr] = T_ILLEGAL
   default:
--- a/src/hotspot/share/prims/jni.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/prims/jni.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -437,8 +437,9 @@
   // 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 && !CompileTheWorld)
+  if (first_time) {
     CompilationPolicy::completed_vm_startup();
+  }
 
   return result;
 JNI_END
@@ -3969,8 +3970,6 @@
     post_thread_start_event(thread);
 
 #ifndef PRODUCT
-    // Check if we should compile all classes on bootclasspath
-    if (CompileTheWorld) ClassLoader::compile_the_world();
     if (ReplayCompiles) ciReplay::replay(thread);
 
     // Some platforms (like Win*) need a wrapper around these test
--- a/src/hotspot/share/runtime/compilationPolicy.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/runtime/compilationPolicy.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -420,7 +420,7 @@
       return NULL;
     }
   }
-  if (CompileTheWorld || ReplayCompiles) {
+  if (ReplayCompiles) {
     // Don't trigger other compiles in testing mode
     if (bci == InvocationEntryBci) {
       reset_counter_for_invocation_event(method);
--- a/src/hotspot/share/runtime/globals.hpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/runtime/globals.hpp	Mon Dec 10 11:04:55 2018 -0800
@@ -1320,16 +1320,6 @@
           "Delay invoking the compiler until main application class is "    \
           "loaded")                                                         \
                                                                             \
-  develop(bool, CompileTheWorld, false,                                     \
-          "Compile all methods in all classes in bootstrap class path "     \
-            "(stress test)")                                                \
-                                                                            \
-  develop(bool, CompileTheWorldPreloadClasses, true,                        \
-          "Preload all classes used by a class before start loading")       \
-                                                                            \
-  notproduct(intx, CompileTheWorldSafepointInterval, 100,                   \
-          "Force a safepoint every n compiles so sweeper can keep up")      \
-                                                                            \
   develop(bool, FillDelaySlots, true,                                       \
           "Fill delay slots (on SPARC only)")                               \
                                                                             \
@@ -2111,13 +2101,6 @@
   experimental(bool, UseCriticalCMSThreadPriority, false,                   \
           "ConcurrentMarkSweep thread runs at critical scheduling priority")\
                                                                             \
-  /* compiler debugging */                                                  \
-  notproduct(intx, CompileTheWorldStartAt,     1,                           \
-          "First class to consider when using +CompileTheWorld")            \
-                                                                            \
-  notproduct(intx, CompileTheWorldStopAt, max_jint,                         \
-          "Last class to consider when using +CompileTheWorld")             \
-                                                                            \
   develop(intx, NewCodeParameter,      0,                                   \
           "Testing Only: Create a dedicated integer parameter before "      \
           "putback")                                                        \
--- a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Mon Dec 10 13:45:12 2018 -0500
+++ b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp	Mon Dec 10 11:04:55 2018 -0800
@@ -386,7 +386,7 @@
       thread->is_interp_only_mode()) {
     return NULL;
   }
-  if (CompileTheWorld || ReplayCompiles) {
+  if (ReplayCompiles) {
     // Don't trigger other compiles in testing mode
     return NULL;
   }
--- a/test/hotspot/jtreg/testlibrary/ctw/Makefile	Mon Dec 10 13:45:12 2018 -0500
+++ b/test/hotspot/jtreg/testlibrary/ctw/Makefile	Mon Dec 10 11:04:55 2018 -0800
@@ -45,7 +45,7 @@
 LIB_FILES = $(shell find $(TESTLIBRARY_DIR)/jdk/test/lib/ \
     $(TESTLIBRARY_DIR)/jdk/test/lib/process \
     $(TESTLIBRARY_DIR)/jdk/test/lib/util \
-    -depth 1 -name '*.java')
+    -maxdepth 1 -name '*.java')
 WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/sun/hotspot -name '*.java')
 EXPORTS=--add-exports java.base/jdk.internal.jimage=ALL-UNNAMED \
 	--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
@@ -69,7 +69,7 @@
 	@mkdir -p $@
 
 $(DST_DIR)/ctw.sh: $(DST_DIR)
-	echo '$${JAVA_HOME}/bin/java $${JAVA_OPTIONS} $(EXPORTS) -jar -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar $$@' > $@
+	echo '$${JAVA_HOME}/bin/java $${JAVA_OPTIONS} $(EXPORTS) -XX:-UseCounterDecay -Xbatch "-XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.*" -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar $$@' > $@
 	chmod a+x $@
 
 $(DST_DIR)/ctw.jar: filelist $(DST_DIR)/wb.jar