changeset 54881:ee45b48c9e4a

8218738: Remove dead code in Symbol and friends Reviewed-by: coleenp, lfoltan, dholmes
author redestad
date Tue, 12 Feb 2019 19:22:19 +0100
parents 1d942423516c
children d667de4734ac
files src/hotspot/share/oops/symbol.cpp src/hotspot/share/oops/symbol.hpp src/hotspot/share/utilities/utf8.cpp src/hotspot/share/utilities/utf8.hpp
diffstat 4 files changed, 7 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/oops/symbol.cpp	Tue Feb 05 17:40:15 2019 +0100
+++ b/src/hotspot/share/oops/symbol.cpp	Tue Feb 12 19:22:19 2019 +0100
@@ -131,19 +131,6 @@
   return as_C_string(str, len + 1);
 }
 
-char* Symbol::as_C_string_flexible_buffer(Thread* t,
-                                                 char* buf, int size) const {
-  char* str;
-  int len = utf8_length();
-  int buf_len = len + 1;
-  if (size < buf_len) {
-    str = NEW_RESOURCE_ARRAY(char, buf_len);
-  } else {
-    str = buf;
-  }
-  return as_C_string(str, buf_len);
-}
-
 void Symbol::print_utf8_on(outputStream* st) const {
   st->print("%s", as_C_string());
 }
--- a/src/hotspot/share/oops/symbol.hpp	Tue Feb 05 17:40:15 2019 +0100
+++ b/src/hotspot/share/oops/symbol.hpp	Tue Feb 12 19:22:19 2019 +0100
@@ -104,7 +104,6 @@
 class Symbol : public MetaspaceObj {
   friend class VMStructs;
   friend class SymbolTable;
-  friend class MoveSymbols;
 
  private:
 
@@ -136,7 +135,6 @@
   Symbol(const u1* name, int length, int refcount);
   void* operator new(size_t size, int len, TRAPS) throw();
   void* operator new(size_t size, int len, Arena* arena, TRAPS) throw();
-  void* operator new(size_t size, int len, ClassLoaderData* loader_data, TRAPS) throw();
 
   void  operator delete(void* p);
 
@@ -207,9 +205,6 @@
 
   // Tests if the symbol starts with the given prefix.
   int index_of_at(int i, const char* str, int len) const;
-  int index_of_at(int i, const char* str) const {
-    return index_of_at(i, str, (int) strlen(str));
-  }
 
   // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
   // note that the ordering is not alfabetical
@@ -219,17 +214,12 @@
   // allocated in resource area, or in the char buffer provided by caller.
   char* as_C_string() const;
   char* as_C_string(char* buf, int size) const;
-  // Use buf if needed buffer length is <= size.
-  char* as_C_string_flexible_buffer(Thread* t, char* buf, int size) const;
 
   // Returns an escaped form of a Java string.
   char* as_quoted_ascii() const;
 
   // Returns a null terminated utf8 string in a resource array
   char* as_utf8() const { return as_C_string(); }
-  char* as_utf8_flexible_buffer(Thread* t, char* buf, int size) const {
-    return as_C_string_flexible_buffer(t, buf, size);
-  }
 
   jchar* as_unicode(int& length) const;
 
--- a/src/hotspot/share/utilities/utf8.cpp	Tue Feb 05 17:40:15 2019 +0100
+++ b/src/hotspot/share/utilities/utf8.cpp	Tue Feb 12 19:22: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
@@ -228,7 +228,9 @@
   *p = '\0';
 }
 
-
+#ifndef PRODUCT
+// converts a quoted ascii string back to utf8
+// no longer used, but could be useful to test output of UTF8::as_quoted_ascii
 const char* UTF8::from_quoted_ascii(const char* quoted_ascii_str) {
   const char *ptr = quoted_ascii_str;
   char* result = NULL;
@@ -302,7 +304,7 @@
   }
   return buffer;
 }
-
+#endif // !PRODUCT
 
 // Returns NULL if 'c' it not found. This only works as long
 // as 'c' is an ASCII character
@@ -468,7 +470,6 @@
 
 char* UNICODE::as_utf8(const jbyte* base, int length, char* buf, int buflen) {
   u_char* p = (u_char*)buf;
-  u_char* end = (u_char*)buf + buflen;
   for (int index = 0; index < length; index++) {
     jbyte c = base[index];
     int sz = utf8_size(c);
--- a/src/hotspot/share/utilities/utf8.hpp	Tue Feb 05 17:40:15 2019 +0100
+++ b/src/hotspot/share/utilities/utf8.hpp	Tue Feb 12 19:22:19 2019 +0100
@@ -54,9 +54,11 @@
   // converts a utf8 string to quoted ascii
   static void as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen);
 
+#ifndef PRODUCT
   // converts a quoted ascii string to utf8 string.  returns the original
   // string unchanged if nothing needs to be done.
   static const char* from_quoted_ascii(const char* quoted_ascii_string);
+#endif
 
   // decodes the current utf8 character, stores the result in value,
   // and returns the end of the current utf8 chararacter.