8180763: Improve inlining of Symbol::equals(char*,int) into CompactHashtable
authorredestad
Wed, 24 May 2017 12:42:44 +0200
changeset 46492 5848b57c9dc5
parent 46491 e43953993af3
child 46493 a5084703aa8a
8180763: Improve inlining of Symbol::equals(char*,int) into CompactHashtable Reviewed-by: iklam, jiangli
hotspot/src/share/vm/oops/symbol.cpp
hotspot/src/share/vm/oops/symbol.hpp
--- a/hotspot/src/share/vm/oops/symbol.cpp	Tue May 23 20:14:52 2017 -0700
+++ b/hotspot/src/share/vm/oops/symbol.cpp	Wed May 24 12:42:44 2017 +0200
@@ -66,22 +66,6 @@
 }
 
 // ------------------------------------------------------------------
-// Symbol::equals
-//
-// Compares the symbol with a string of the given length.
-bool Symbol::equals(const char* str, int len) const {
-  int l = utf8_length();
-  if (l != len) return false;
-  while (l-- > 0) {
-    if (str[l] != (char) byte_at(l))
-      return false;
-  }
-  assert(l == -1, "we should be at the beginning");
-  return true;
-}
-
-
-// ------------------------------------------------------------------
 // Symbol::starts_with
 //
 // Tests if the symbol starts with the specified prefix of the given
--- a/hotspot/src/share/vm/oops/symbol.hpp	Tue May 23 20:14:52 2017 -0700
+++ b/hotspot/src/share/vm/oops/symbol.hpp	Wed May 24 12:42:44 2017 +0200
@@ -175,7 +175,16 @@
   int utf8_length() const { return _length; }
 
   // Compares the symbol with a string.
-  bool equals(const char* str, int len) const;
+  bool equals(const char* str, int len) const {
+    int l = utf8_length();
+    if (l != len) return false;
+    while (l-- > 0) {
+      if (str[l] != (char) byte_at(l))
+        return false;
+    }
+    assert(l == -1, "we should be at the beginning");
+    return true;
+  }
   bool equals(const char* str) const { return equals(str, (int) strlen(str)); }
 
   // Tests if the symbol starts with the given prefix.