8219554: Redundant lookup_common in SymbolTable::add
authorredestad
Fri, 22 Feb 2019 16:41:01 +0100
changeset 53898 853b82a25d53
parent 53897 0abec72a3ac2
child 53899 bae1944fc279
8219554: Redundant lookup_common in SymbolTable::add Reviewed-by: iklam, coleenp, mikael
src/hotspot/share/classfile/symbolTable.cpp
src/hotspot/share/classfile/symbolTable.hpp
--- a/src/hotspot/share/classfile/symbolTable.cpp	Fri Feb 22 17:30:07 2019 +0300
+++ b/src/hotspot/share/classfile/symbolTable.cpp	Fri Feb 22 16:41:01 2019 +0100
@@ -436,18 +436,16 @@
   }
 }
 
-void SymbolTable::add(ClassLoaderData* loader_data, const constantPoolHandle& cp,
-                      int names_count, const char** names, int* lengths,
-                      int* cp_indices, unsigned int* hashValues, TRAPS) {
+void SymbolTable::new_symbols(ClassLoaderData* loader_data, const constantPoolHandle& cp,
+                              int names_count, const char** names, int* lengths,
+                              int* cp_indices, unsigned int* hashValues, TRAPS) {
   bool c_heap = !loader_data->is_the_null_class_loader_data();
   for (int i = 0; i < names_count; i++) {
     const char *name = names[i];
     int len = lengths[i];
     unsigned int hash = hashValues[i];
-    Symbol* sym = SymbolTable::the_table()->lookup_common(name, len, hash);
-    if (sym == NULL) {
-      sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK);
-    }
+    assert(SymbolTable::the_table()->lookup_shared(name, len, hash) == NULL, "must have checked already");
+    Symbol* sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK);
     assert(sym->refcount() != 0, "lookup should have incremented the count");
     cp->symbol_at_put(cp_indices[i], sym);
   }
--- a/src/hotspot/share/classfile/symbolTable.hpp	Fri Feb 22 17:30:07 2019 +0300
+++ b/src/hotspot/share/classfile/symbolTable.hpp	Fri Feb 22 16:41:01 2019 +0100
@@ -144,18 +144,11 @@
   Symbol* do_add_if_needed(const char* name, int len, uintx hash, bool heap, TRAPS);
 
   // Adding elements
-  static void add(ClassLoaderData* loader_data,
-                  const constantPoolHandle& cp, int names_count,
-                  const char** names, int* lengths, int* cp_indices,
-                  unsigned int* hashValues, TRAPS);
-
   static void new_symbols(ClassLoaderData* loader_data,
                           const constantPoolHandle& cp, int names_count,
                           const char** name, int* lengths,
                           int* cp_indices, unsigned int* hashValues,
-                          TRAPS) {
-    add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
-  }
+                          TRAPS);
 
   static Symbol* lookup_shared(const char* name, int len, unsigned int hash);
   Symbol* lookup_dynamic(const char* name, int len, unsigned int hash);