Merge
authormockner
Wed, 08 Jun 2016 18:09:04 +0200
changeset 39222 cf2d48fdf795
parent 39221 4249544a9196 (current diff)
parent 39220 f08faf525113 (diff)
child 39223 af5506aae343
child 39224 7c26725c0813
Merge
--- a/hotspot/make/lib/JvmOverrideFiles.gmk	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/make/lib/JvmOverrideFiles.gmk	Wed Jun 08 18:09:04 2016 +0200
@@ -153,6 +153,13 @@
   # mode, so don't optimize sharedRuntimeTrig.cpp at all.
   BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
 
+  ifneq ($(DEBUG_LEVEL),slowdebug)
+    # Compiling jvmtiEnterTrace.cpp with full optimization needs more than 30min
+    # (mostly because of '-qhot=level=1' and the more than 1300 'log_trace' calls
+    # which cause a lot of template expansion).
+    BUILD_LIBJVM_jvmtiEnterTrace.cpp_OPTIMIZATION := LOW
+  endif
+
   # Disable ELF decoder on AIX (AIX uses XCOFF).
   JVM_EXCLUDE_PATTERNS += elf
 
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -68,7 +68,6 @@
       if (b->number_of_preds() > 1) {
         int id = b->first_lir_instruction_id();
         ResourceBitMap regs(FrameMap::nof_fpu_regs);
-        regs.clear();
 
         iw.walk_to(id);   // walk after the first instruction (always a label) of the block
         assert(iw.current_position() == id, "did not walk completely to id");
--- a/hotspot/src/share/vm/c1/c1_IR.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/c1/c1_IR.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -147,10 +147,8 @@
   _wrote_volatile     = false;
   _start              = NULL;
 
-  if (osr_bci == -1) {
-    _requires_phi_function.clear();
-  } else {
-        // selective creation of phi functions is not possibel in osr-methods
+  if (osr_bci != -1) {
+    // selective creation of phi functions is not possibel in osr-methods
     _requires_phi_function.set_range(0, method->max_locals());
   }
 
@@ -540,7 +538,6 @@
 {
   TRACE_LINEAR_SCAN(2, tty->print_cr("***** computing linear-scan block order"));
 
-  init_visited();
   count_edges(start_block, NULL);
 
   if (compilation()->is_profiling()) {
@@ -646,7 +643,6 @@
   TRACE_LINEAR_SCAN(3, tty->print_cr("----- marking loops"));
 
   _loop_map = BitMap2D(_num_loops, _max_block_id);
-  _loop_map.clear();
 
   for (int i = _loop_end_blocks.length() - 1; i >= 0; i--) {
     BlockBegin* loop_end   = _loop_end_blocks.at(i);
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -1387,7 +1387,6 @@
 void LIRGenerator::set_vreg_flag(int vreg_num, VregFlag f) {
   if (_vreg_flags.size_in_bits() == 0) {
     BitMap2D temp(100, num_vreg_flags);
-    temp.clear();
     _vreg_flags = temp;
   }
   _vreg_flags.at_put_grow(vreg_num, f, true);
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -562,14 +562,13 @@
   LIR_OpVisitState visitor;
 
   BitMap2D local_interval_in_loop = BitMap2D(_num_virtual_regs, num_loops());
-  local_interval_in_loop.clear();
 
   // iterate all blocks
   for (int i = 0; i < num_blocks; i++) {
     BlockBegin* block = block_at(i);
 
-    ResourceBitMap live_gen(live_size);  live_gen.clear();
-    ResourceBitMap live_kill(live_size); live_kill.clear();
+    ResourceBitMap live_gen(live_size);
+    ResourceBitMap live_kill(live_size);
 
     if (block->is_set(BlockBegin::exception_entry_flag)) {
       // Phi functions at the begin of an exception handler are
@@ -715,8 +714,8 @@
 
     block->set_live_gen (live_gen);
     block->set_live_kill(live_kill);
-    block->set_live_in  (ResourceBitMap(live_size)); block->live_in().clear();
-    block->set_live_out (ResourceBitMap(live_size)); block->live_out().clear();
+    block->set_live_in  (ResourceBitMap(live_size));
+    block->set_live_out (ResourceBitMap(live_size));
 
     TRACE_LINEAR_SCAN(4, tty->print("live_gen  B%d ", block->block_id()); print_bitmap(block->live_gen()));
     TRACE_LINEAR_SCAN(4, tty->print("live_kill B%d ", block->block_id()); print_bitmap(block->live_kill()));
@@ -741,7 +740,7 @@
   bool change_occurred;
   bool change_occurred_in_block;
   int  iteration_count = 0;
-  ResourceBitMap live_out(live_set_size()); live_out.clear(); // scratch set for calculations
+  ResourceBitMap live_out(live_set_size()); // scratch set for calculations
 
   // Perform a backward dataflow analysis to compute live_out and live_in for each block.
   // The loop is executed until a fixpoint is reached (no changes in an iteration)
@@ -827,7 +826,6 @@
 
   // check that the live_in set of the first block is empty
   ResourceBitMap live_in_args(ir()->start()->live_in().size());
-  live_in_args.clear();
   if (!ir()->start()->live_in().is_same(live_in_args)) {
 #ifdef ASSERT
     tty->print_cr("Error: live_in set of first block must be empty (when this fails, virtual registers are used before they are defined)");
@@ -1774,8 +1772,8 @@
 
   int num_blocks = block_count();
   MoveResolver move_resolver(this);
-  ResourceBitMap block_completed(num_blocks);  block_completed.clear();
-  ResourceBitMap already_resolved(num_blocks); already_resolved.clear();
+  ResourceBitMap block_completed(num_blocks);
+  ResourceBitMap already_resolved(num_blocks);
 
   int i;
   for (i = 0; i < num_blocks; i++) {
@@ -3750,7 +3748,6 @@
 
 
   ResourceBitMap used_regs(LinearScan::nof_regs + allocator()->frame_map()->argcount() + allocator()->max_spills());
-  used_regs.clear();
   if (!_multiple_reads_allowed) {
     for (i = 0; i < _mapping_from.length(); i++) {
       Interval* it = _mapping_from.at(i);
@@ -6319,7 +6316,6 @@
 void ControlFlowOptimizer::delete_jumps_to_return(BlockList* code) {
 #ifdef ASSERT
   ResourceBitMap return_converted(BlockBegin::number_of_blocks());
-  return_converted.clear();
 #endif
 
   for (int i = code->length() - 1; i >= 0; i--) {
--- a/hotspot/src/share/vm/c1/c1_ValueSet.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/c1/c1_ValueSet.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -53,7 +53,6 @@
 };
 
 inline ValueSet::ValueSet() : _map(Instruction::number_of_instructions()) {
-  _map.clear();
 }
 
 
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -449,7 +449,6 @@
   OopMapCache::compute_one_oop_map(get_Method(), bci, &mask);
   int mask_size = max_locals();
   ResourceBitMap result(mask_size);
-  result.clear();
   int i;
   for (i = 0; i < mask_size ; i++ ) {
     if (mask.is_oop(i)) result.set_bit(i);
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -4673,6 +4673,7 @@
 }
 
 // Unqualified names may not contain the characters '.', ';', '[', or '/'.
+// In class names, '/' separates unqualified names.  This is verified in this function also.
 // Method names also may not contain the characters '<' or '>', unless <init>
 // or <clinit>.  Note that method names may not be <init> or <clinit> in this
 // method.  Because these names have been checked as special cases before
@@ -4698,8 +4699,16 @@
       if (ch == ';' || ch == '[' ) {
         return false;   // do not permit '.', ';', or '['
       }
-      if (type != ClassFileParser::LegalClass && ch == '/') {
-        return false;   // do not permit '/' unless it's class name
+      if (ch == '/') {
+        // check for '//' or leading or trailing '/' which are not legal
+        // unqualified name must not be empty
+        if (type == ClassFileParser::LegalClass) {
+          if (p == name || p+1 >= name+length || *(p+1) == '/') {
+           return false;
+          }
+        } else {
+          return false;   // do not permit '/' unless it's class name
+        }
       }
       if (type == ClassFileParser::LegalMethod && (ch == '<' || ch == '>')) {
         return false;   // do not permit '<' or '>' in method names
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -181,26 +181,59 @@
 }
 
 // Used to obtain the package name from a fully qualified class name.
-// It is the responsibility of the caller to establish ResourceMark.
-const char* ClassLoader::package_from_name(const char* class_name) {
-  const char* last_slash = strrchr(class_name, '/');
+// It is the responsibility of the caller to establish a ResourceMark.
+const char* ClassLoader::package_from_name(const char* const class_name, bool* bad_class_name) {
+  if (class_name == NULL) {
+    if (bad_class_name != NULL) {
+      *bad_class_name = true;
+    }
+    return NULL;
+  }
+
+  if (bad_class_name != NULL) {
+    *bad_class_name = false;
+  }
+
+  const char* const last_slash = strrchr(class_name, '/');
   if (last_slash == NULL) {
     // No package name
     return NULL;
   }
-  int length = last_slash - class_name;
+
+  char* class_name_ptr = (char*) class_name;
+  // Skip over '['s
+  if (*class_name_ptr == '[') {
+    do {
+      class_name_ptr++;
+    } while (*class_name_ptr == '[');
 
-  // A class name could have just the slash character in the name,
-  // resulting in a negative length.
+    // Fully qualified class names should not contain a 'L'.
+    // Set bad_class_name to true to indicate that the package name
+    // could not be obtained due to an error condition.
+    // In this situation, is_same_class_package returns false.
+    if (*class_name_ptr == 'L') {
+      if (bad_class_name != NULL) {
+        *bad_class_name = true;
+      }
+      return NULL;
+    }
+  }
+
+  int length = last_slash - class_name_ptr;
+
+  // A class name could have just the slash character in the name.
   if (length <= 0) {
     // No package name
+    if (bad_class_name != NULL) {
+      *bad_class_name = true;
+    }
     return NULL;
   }
 
   // drop name after last slash (including slash)
   // Ex., "java/lang/String.class" => "java/lang"
   char* pkg_name = NEW_RESOURCE_ARRAY(char, length + 1);
-  strncpy(pkg_name, class_name, length);
+  strncpy(pkg_name, class_name_ptr, length);
   *(pkg_name+length) = '\0';
 
   return (const char *)pkg_name;
@@ -1117,13 +1150,11 @@
   assert(fullq_class_name != NULL, "just checking");
 
   // Get package name from fully qualified class name.
-  const char *cp = strrchr(fullq_class_name, '/');
+  ResourceMark rm;
+  const char *cp = package_from_name(fullq_class_name);
   if (cp != NULL) {
-    int len = cp - fullq_class_name;
-    PackageEntryTable* pkg_entry_tbl =
-      ClassLoaderData::the_null_class_loader_data()->packages();
-    TempNewSymbol pkg_symbol =
-      SymbolTable::new_symbol(fullq_class_name, len, CHECK_false);
+    PackageEntryTable* pkg_entry_tbl = ClassLoaderData::the_null_class_loader_data()->packages();
+    TempNewSymbol pkg_symbol = SymbolTable::new_symbol(cp, CHECK_false);
     PackageEntry* pkg_entry = pkg_entry_tbl->lookup_only(pkg_symbol);
     if (pkg_entry != NULL) {
       assert(classpath_index != -1, "Unexpected classpath_index");
@@ -1231,11 +1262,9 @@
   // jimage, it is determined by the class path entry.
   jshort loader_type = ClassLoader::APP_LOADER;
   if (e->is_jrt()) {
-    int length = 0;
-    const jbyte* pkg_string = InstanceKlass::package_from_name(class_name, length);
-    if (pkg_string != NULL) {
-      ResourceMark rm;
-      TempNewSymbol pkg_name = SymbolTable::new_symbol((const char*)pkg_string, length, THREAD);
+    ResourceMark rm;
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_0);
+    if (pkg_name != NULL) {
       const char* pkg_name_C_string = (const char*)(pkg_name->as_C_string());
       ClassPathImageEntry* cpie = (ClassPathImageEntry*)e;
       JImageFile* jimage = cpie->jimage();
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -444,7 +444,9 @@
   static bool string_ends_with(const char* str, const char* str_to_find);
 
   // obtain package name from a fully qualified class name
-  static const char* package_from_name(const char* class_name);
+  // *bad_class_name is set to true if there's a problem with parsing class_name, to
+  // distinguish from a class_name with no package name, as both cases have a NULL return value
+  static const char* package_from_name(const char* const class_name, bool* bad_class_name = NULL);
 
   static bool is_jrt(const char* name) { return string_ends_with(name, MODULES_IMAGE_NAME); }
 
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -70,6 +70,7 @@
 #include "services/threadService.hpp"
 #include "trace/traceMacros.hpp"
 #include "utilities/macros.hpp"
+#include "utilities/stringUtils.hpp"
 #include "utilities/ticks.hpp"
 #if INCLUDE_CDS
 #include "classfile/sharedClassUtil.hpp"
@@ -1154,12 +1155,10 @@
     // It is illegal to define classes in the "java." package from
     // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
     ResourceMark rm(THREAD);
-    char* name = parsed_name->as_C_string();
-    char* index = strrchr(name, '/');
-    *index = '\0'; // chop to just the package name
-    while ((index = strchr(name, '/')) != NULL) {
-      *index = '.'; // replace '/' with '.' in package name
-    }
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(parsed_name, CHECK_NULL);
+    assert(pkg_name != NULL, "Error in parsing package name starting with 'java/'");
+    char* name = pkg_name->as_C_string();
+    StringUtils::replace_no_expand(name, "/", ".");
     const char* msg_text = "Prohibited package name: ";
     size_t len = strlen(msg_text) + strlen(name) + 1;
     char* message = NEW_RESOURCE_ARRAY(char, len);
@@ -1257,6 +1256,7 @@
 bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
                                                instanceKlassHandle ik,
                                                Handle class_loader, TRAPS) {
+  ResourceMark rm;
   int path_index = ik->shared_classpath_index();
   SharedClassPathEntry* ent =
             (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
@@ -1270,12 +1270,11 @@
   TempNewSymbol pkg_name = NULL;
   PackageEntry* pkg_entry = NULL;
   ModuleEntry* mod_entry = NULL;
-  int length = 0;
+  const char* pkg_string = NULL;
   ClassLoaderData* loader_data = class_loader_data(class_loader);
-  const jbyte* pkg_string = InstanceKlass::package_from_name(class_name, length);
-  if (pkg_string != NULL) {
-    pkg_name = SymbolTable::new_symbol((const char*)pkg_string,
-                                       length, CHECK_(false));
+  pkg_name = InstanceKlass::package_from_name(class_name, CHECK_false);
+  if (pkg_name != NULL) {
+    pkg_string = pkg_name->as_C_string();
     if (loader_data != NULL) {
       pkg_entry = loader_data->packages()->lookup_only(pkg_name);
     }
@@ -1432,15 +1431,14 @@
   instanceKlassHandle nh = instanceKlassHandle(); // null Handle
 
   if (class_loader.is_null()) {
-    int length = 0;
+    ResourceMark rm;
     PackageEntry* pkg_entry = NULL;
     bool search_only_bootloader_append = false;
     ClassLoaderData *loader_data = class_loader_data(class_loader);
 
     // Find the package in the boot loader's package entry table.
-    const jbyte* pkg_string = InstanceKlass::package_from_name(class_name, length);
-    if (pkg_string != NULL) {
-      TempNewSymbol pkg_name = SymbolTable::new_symbol((const char*)pkg_string, length, CHECK_(nh));
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_NULL);
+    if (pkg_name != NULL) {
       pkg_entry = loader_data->packages()->lookup_only(pkg_name);
     }
 
@@ -1477,7 +1475,7 @@
       assert(!DumpSharedSpaces, "Archive dumped after module system initialization");
       // After the module system has been initialized, check if the class'
       // package is in a module defined to the boot loader.
-      if (pkg_string == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
+      if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
         // Class is either in the unnamed package, in a named package
         // within a module not defined to the boot loader or in a
         // a named package within the unnamed module.  In all cases,
--- a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -48,7 +48,7 @@
   static bool is_shared_class_visible_for_classloader(
                                       instanceKlassHandle ik,
                                       Handle class_loader,
-                                      const jbyte* pkg_string,
+                                      const char* pkg_string,
                                       Symbol* pkg_name,
                                       PackageEntry* pkg_entry,
                                       ModuleEntry* mod_entry,
--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -137,11 +137,6 @@
   _arena = arena;
   _method = method;
   _bit_map_size_bits = method->max_locals();
-
-
-#ifdef COMPILER1
-  _bci_block_start.clear();
-#endif
 }
 
 void MethodLiveness::compute_liveness() {
@@ -587,14 +582,6 @@
     new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, NULL);
   _exception_predecessors =
     new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, NULL);
-  _normal_exit.clear();
-  _exception_exit.clear();
-  _entry.clear();
-
-  // this initialization is not strictly necessary.
-  // _gen and _kill are cleared at the beginning of compute_gen_kill_range()
-  _gen.clear();
-  _kill.clear();
 }
 
 
@@ -1020,7 +1007,6 @@
     _last_bci = bci;
   }
 
-  answer.clear();
   answer.set_union(_normal_exit);
   answer.set_difference(_kill);
   answer.set_union(_gen);
--- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -110,6 +110,7 @@
 
   static const size_t min_size()                 { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
   static const size_t max_size()                 { assert(_max_size != 0, "max_size not set up"); return _max_size; }
+  static const size_t max_size_in_bytes()        { return max_size() * BytesPerWord; }
   static void set_max_size(size_t max_size)      { _max_size = max_size; }
 
   HeapWord* start() const                        { return _start; }
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -2182,39 +2182,21 @@
   return dest;
 }
 
-const jbyte* InstanceKlass::package_from_name(const Symbol* name, int& length) {
-  ResourceMark rm;
-  length = 0;
+// Used to obtain the package name from a fully qualified class name.
+Symbol* InstanceKlass::package_from_name(const Symbol* name, TRAPS) {
   if (name == NULL) {
     return NULL;
   } else {
-    const jbyte* base_name = name->base();
-    const jbyte* last_slash = UTF8::strrchr(base_name, name->utf8_length(), '/');
-
-    if (last_slash == NULL) {
-      // No package name
+    if (name->utf8_length() <= 0) {
       return NULL;
-    } else {
-      // Skip over '['s
-      if (*base_name == '[') {
-        do {
-          base_name++;
-        } while (*base_name == '[');
-        if (*base_name != 'L') {
-          // Fully qualified class names should not contain a 'L'.
-          // Set length to -1 to indicate that the package name
-          // could not be obtained due to an error condition.
-          // In this situtation, is_same_class_package returns false.
-          length = -1;
-          return NULL;
-        }
-      }
-
-      // Found the package name, look it up in the symbol table.
-      length = last_slash - base_name;
-      assert(length > 0, "Bad length for package name");
-      return base_name;
     }
+    ResourceMark rm;
+    const char* package_name = ClassLoader::package_from_name((const char*) name->as_C_string());
+    if (package_name == NULL) {
+      return NULL;
+    }
+    Symbol* pkg_name = SymbolTable::new_symbol(package_name, THREAD);
+    return pkg_name;
   }
 }
 
@@ -2230,12 +2212,9 @@
 }
 
 void InstanceKlass::set_package(ClassLoaderData* loader_data, TRAPS) {
-  int length = 0;
-  const jbyte* base_name = package_from_name(name(), length);
-
-  if (base_name != NULL && loader_data != NULL) {
-    TempNewSymbol pkg_name = SymbolTable::new_symbol((const char*)base_name, length, CHECK);
-
+  TempNewSymbol pkg_name = package_from_name(name(), CHECK);
+
+  if (pkg_name != NULL && loader_data != NULL) {
     // Find in class loader's package entry table.
     _package_entry = loader_data->packages()->lookup_only(pkg_name);
 
@@ -2331,20 +2310,18 @@
   if (class_loader1 != class_loader2) {
     return false;
   } else if (class_name1 == class_name2) {
-    return true;                // skip painful bytewise comparison
+    return true;
   } else {
     ResourceMark rm;
 
-    // The Symbol*'s are in UTF8 encoding. Since we only need to check explicitly
-    // for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding.
-    // Otherwise, we just compare jbyte values between the strings.
-    int length1 = 0;
-    int length2 = 0;
-    const jbyte *name1 = package_from_name(class_name1, length1);
-    const jbyte *name2 = package_from_name(class_name2, length2);
-
-    if ((length1 < 0) || (length2 < 0)) {
-      // error occurred parsing package name.
+    bool bad_class_name = false;
+    const char* name1 = ClassLoader::package_from_name((const char*) class_name1->as_C_string(), &bad_class_name);
+    if (bad_class_name) {
+      return false;
+    }
+
+    const char* name2 = ClassLoader::package_from_name((const char*) class_name2->as_C_string(), &bad_class_name);
+    if (bad_class_name) {
       return false;
     }
 
@@ -2354,13 +2331,13 @@
       return name1 == name2;
     }
 
-    // Check that package part is identical
-    return UTF8::equal(name1, length1, name2, length2);
+    // Check that package is identical
+    return (strcmp(name1, name2) == 0);
   }
 }
 
 // Returns true iff super_method can be overridden by a method in targetclassname
-// See JSL 3rd edition 8.4.6.1
+// See JLS 3rd edition 8.4.6.1
 // Assumes name-signature match
 // "this" is InstanceKlass of super_method which must exist
 // note that the InstanceKlass of the method in the targetclassname has not always been created yet
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -1108,7 +1108,7 @@
 
   // Naming
   const char* signature_name() const;
-  static const jbyte* package_from_name(const Symbol* name, int& length);
+  static Symbol* package_from_name(const Symbol* name, TRAPS);
 
   // GC specific object visitors
   //
--- a/hotspot/src/share/vm/oops/method.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/oops/method.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -246,7 +246,7 @@
   int code_size() const                  { return constMethod()->code_size(); }
 
   // method size in words
-  int method_size() const                { return sizeof(Method)/wordSize + is_native() ? 2 : 0; }
+  int method_size() const                { return sizeof(Method)/wordSize + ( is_native() ? 2 : 0 ); }
 
   // constant pool for Klass* holding this method
   ConstantPool* constants() const              { return constMethod()->constants(); }
--- a/hotspot/src/share/vm/runtime/thread.inline.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/runtime/thread.inline.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -71,9 +71,12 @@
   jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
   if (UseTLAB) {
     size_t used_bytes = tlab().used_bytes();
-    if ((ssize_t)used_bytes > 0) {
-      // More-or-less valid tlab. The load_acquire above should ensure
-      // that the result of the add is <= the instantaneous value.
+    if (used_bytes <= ThreadLocalAllocBuffer::max_size_in_bytes()) {
+      // Comparing used_bytes with the maximum allowed size will ensure
+      // that we don't add the used bytes from a semi-initialized TLAB
+      // ending up with incorrect values. There is still a race between
+      // incrementing _allocated_bytes and clearing the TLAB, that might
+      // cause double counting in rare cases.
       return allocated_bytes + used_bytes;
     }
   }
--- a/hotspot/src/share/vm/utilities/bitMap.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -435,7 +435,6 @@
   void clear_bit(idx_t slot_index, idx_t bit_within_slot_index);
   void at_put(idx_t slot_index, idx_t bit_within_slot_index, bool value);
   void at_put_grow(idx_t slot_index, idx_t bit_within_slot_index, bool value);
-  void clear();
 };
 
 // Closure for iterating over BitMaps
--- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Wed Jun 08 18:09:04 2016 +0200
@@ -367,8 +367,4 @@
   _map.at_put(bit, value);
 }
 
-inline void BitMap2D::clear() {
-  _map.clear();
-}
-
 #endif // SHARE_VM_UTILITIES_BITMAP_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/runtime/test_classLoader.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "classfile/classLoader.hpp"
+#include "memory/resourceArea.hpp"
+#include "unittest.hpp"
+
+// Tests ClassLoader::package_from_name()
+TEST_VM(classLoader, null_class_name) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval= ClassLoader::package_from_name(NULL, &bad_class_name);
+  ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with NULL class name";
+  ASSERT_STREQ(retval, NULL) << "Wrong package for NULL class name pointer";
+}
+
+TEST_VM(classLoader, empty_class_name) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("");
+  ASSERT_STREQ(retval, NULL) << "Wrong package for empty string";
+}
+
+TEST_VM(classLoader, no_slash) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("L");
+  ASSERT_STREQ(retval, NULL) << "Wrong package for class with no slashes";
+}
+
+TEST_VM(classLoader, just_slash) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval = ClassLoader::package_from_name("/", &bad_class_name);
+  ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with package of length 0";
+  ASSERT_STREQ(retval, NULL) << "Wrong package for class with just slash";
+}
+
+TEST_VM(classLoader, multiple_slashes) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("///");
+  ASSERT_STREQ(retval, "//") << "Wrong package for class with just slashes";
+}
+
+TEST_VM(classLoader, standard_case_1) {
+  ResourceMark rm;
+  bool bad_class_name = true;
+  const char* retval = ClassLoader::package_from_name("package/class", &bad_class_name);
+  ASSERT_FALSE(bad_class_name) << "Function did not reset bad_class_name";
+  ASSERT_STREQ(retval, "package") << "Wrong package for class with one slash";
+}
+
+TEST_VM(classLoader, standard_case_2) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("package/folder/class");
+  ASSERT_STREQ(retval, "package/folder") << "Wrong package for class with multiple slashes";
+}
+
+TEST_VM(classLoader, class_array) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval = ClassLoader::package_from_name("[package/class", &bad_class_name);
+  ASSERT_FALSE(bad_class_name) << "Function set bad_class_name with class array";
+  ASSERT_STREQ(retval, "package") << "Wrong package for class with leading bracket";
+}
+
+TEST_VM(classLoader, class_object_array) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval = ClassLoader::package_from_name("[Lpackage/class", &bad_class_name);
+  ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with array of class objects";
+  ASSERT_STREQ(retval, NULL) << "Wrong package for class with leading '[L'";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/runtime/test_instanceKlass.cpp	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "classfile/symbolTable.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/instanceKlass.hpp"
+#include "unittest.hpp"
+
+// Tests InstanceKlass::package_from_name()
+TEST_VM(instanceKlass, null_symbol) {
+  ResourceMark rm;
+  TempNewSymbol package_sym = InstanceKlass::package_from_name(NULL, NULL);
+  ASSERT_TRUE(package_sym == NULL) << "Wrong package for NULL symbol";
+}
--- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Tue Jun 07 16:08:25 2016 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Wed Jun 08 18:09:04 2016 +0200
@@ -27,6 +27,7 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @ignore 8154204
  * @run main DefaultUseWithClient
  * @bug 8032224
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/TestBadClassName.java	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8158297
+ * @summary Constant pool utf8 entry for class name cannot have empty qualified name '//'
+ * @compile p1/BadInterface1.jcod
+ * @compile p1/BadInterface2.jcod
+ * @compile UseBadInterface1.jcod
+ * @compile UseBadInterface2.jcod
+ * @run main/othervm -Xverify:all TestBadClassName
+ */
+
+public class TestBadClassName {
+    public static void main(String args[]) throws Throwable {
+
+        System.out.println("Regression test for bug 8042660");
+
+        // Test class name with p1//BadInterface2
+        try {
+            Class newClass = Class.forName("UseBadInterface1");
+            throw new RuntimeException("Expected ClassFormatError exception not thrown");
+        } catch (java.lang.ClassFormatError e) {
+            System.out.println("Test UseBadInterface1 passed test case with illegal class name");
+        }
+
+        // Test class name with p1/BadInterface2/
+        try {
+            Class newClass = Class.forName("UseBadInterface2");
+            throw new RuntimeException("Expected ClassFormatError exception not thrown");
+        } catch (java.lang.ClassFormatError e) {
+            System.out.println("Test UseBadInterface1 passed test case with illegal class name");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/UseBadInterface1.jcod	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+// jcod file for UseBadInterface1.java
+// class UseBadInterface1 implements p1.BadInterface1 {
+//     int i;
+//     UseBadInterface1() {}
+//     public static void main(java.lang.String[] unused) { }
+// }
+
+class UseBadInterface1 {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #10; // #1    
+    Utf8 "UseBadInterface1.java"; // #2    
+    class #4; // #3    
+    Utf8 "java/lang/Object"; // #4    
+    class #8; // #5    
+    Utf8 "([Ljava/lang/String;)V"; // #6    
+    class #11; // #7    
+    Utf8 "UseBadInterface1"; // #8    
+    Utf8 "main"; // #9    
+    NameAndType #17 #13; // #10    
+    Utf8 "p1//BadInterface1"; // #11    
+    Utf8 "SourceFile"; // #12    
+    Utf8 "()V"; // #13    
+    Utf8 "I"; // #14    
+    Utf8 "Code"; // #15    
+    Utf8 "i"; // #16    
+    Utf8 "<init>"; // #17    
+  } // Constant Pool
+
+  0x0020; // access
+  #5;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+    #7;
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0000; // access
+      #16; // name_cpx
+      #14; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #17; // name_cpx
+      #13; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #9; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          0; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#12) { // SourceFile
+      #2;
+    } // end SourceFile
+  } // Attributes
+} // end class UseBadInterface1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/UseBadInterface2.jcod	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+// jcod file for UseBadInterface2.java
+// class UseBadInterface2 implements p1.BadInterface2 {
+//     int i;
+//     UseBadInterface2() {}
+//     public static void main(java.lang.String[] unused) { }
+// }
+
+class UseBadInterface2 {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #10; // #1    
+    Utf8 "UseBadInterface2.java"; // #2    
+    class #4; // #3    
+    Utf8 "java/lang/Object"; // #4    
+    class #8; // #5    
+    Utf8 "([Ljava/lang/String;)V"; // #6    
+    class #11; // #7    
+    Utf8 "UseBadInterface2"; // #8    
+    Utf8 "main"; // #9    
+    NameAndType #17 #13; // #10    
+    Utf8 "p1/BadInterface2/"; // #11    
+    Utf8 "SourceFile"; // #12    
+    Utf8 "()V"; // #13    
+    Utf8 "I"; // #14    
+    Utf8 "Code"; // #15    
+    Utf8 "i"; // #16    
+    Utf8 "<init>"; // #17    
+  } // Constant Pool
+
+  0x0020; // access
+  #5;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+    #7;
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0000; // access
+      #16; // name_cpx
+      #14; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #17; // name_cpx
+      #13; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #9; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          0; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#12) { // SourceFile
+      #2;
+    } // end SourceFile
+  } // Attributes
+} // end class UseBadInterface2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/p1/BadInterface1.jcod	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+// Interface that should get a ClassFormatException for the "//" in the name
+
+// package p1;
+// public interface cls1 {}
+
+class p1//BadInterface1 {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    class #5; // #1    
+    class #6; // #2    
+    Utf8 "SourceFile"; // #3    
+    Utf8 "BadInterface1.java"; // #4    
+    Utf8 "p1//BadInterface1"; // #5    
+    Utf8 "java/lang/Object"; // #6    
+  } // Constant Pool
+
+  0x0601; // access
+  #1;// this_cpx
+  #2;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+  } // methods
+
+  [] { // Attributes
+    Attr(#3) { // SourceFile
+      #4;
+    } // end SourceFile
+  } // Attributes
+} // end class p1//BadInterface1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/p1/BadInterface2.jcod	Wed Jun 08 18:09:04 2016 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+// Interface that should get a ClassFormatException for the trailing "/" in the name
+
+// package p1;
+// public interface cls1 {}
+
+class p1/BadInterface2/ {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    class #5; // #1    
+    class #6; // #2    
+    Utf8 "SourceFile"; // #3    
+    Utf8 "BadInterface2.java"; // #4    
+    Utf8 "p1/BadInterface2/"; // #5    
+    Utf8 "java/lang/Object"; // #6    
+  } // Constant Pool
+
+  0x0601; // access
+  #1;// this_cpx
+  #2;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+  } // methods
+
+  [] { // Attributes
+    Attr(#3) { // SourceFile
+      #4;
+    } // end SourceFile
+  } // Attributes
+} // end class p1/BadInterface2