8218738: Remove dead code in Symbol and friends

Reviewed-by: coleenp, lfoltan, dholmes
This commit is contained in:
Claes Redestad 2019-02-12 19:22:19 +01:00
parent 8218872024
commit 61882ce51f
4 changed files with 7 additions and 27 deletions

View File

@ -131,19 +131,6 @@ char* Symbol::as_C_string() const {
return as_C_string(str, len + 1); 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 { void Symbol::print_utf8_on(outputStream* st) const {
st->print("%s", as_C_string()); st->print("%s", as_C_string());
} }

View File

@ -104,7 +104,6 @@ class ClassLoaderData;
class Symbol : public MetaspaceObj { class Symbol : public MetaspaceObj {
friend class VMStructs; friend class VMStructs;
friend class SymbolTable; friend class SymbolTable;
friend class MoveSymbols;
private: private:
@ -136,7 +135,6 @@ class Symbol : public MetaspaceObj {
Symbol(const u1* name, int length, int refcount); 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, TRAPS) throw();
void* operator new(size_t size, int len, Arena* arena, 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); void operator delete(void* p);
@ -207,9 +205,6 @@ class Symbol : public MetaspaceObj {
// Tests if the symbol starts with the given prefix. // 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, 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 // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
// note that the ordering is not alfabetical // note that the ordering is not alfabetical
@ -219,17 +214,12 @@ class Symbol : public MetaspaceObj {
// allocated in resource area, or in the char buffer provided by caller. // allocated in resource area, or in the char buffer provided by caller.
char* as_C_string() const; char* as_C_string() const;
char* as_C_string(char* buf, int size) 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. // Returns an escaped form of a Java string.
char* as_quoted_ascii() const; char* as_quoted_ascii() const;
// Returns a null terminated utf8 string in a resource array // Returns a null terminated utf8 string in a resource array
char* as_utf8() const { return as_C_string(); } 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; jchar* as_unicode(int& length) const;

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -228,7 +228,9 @@ void UTF8::as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int
*p = '\0'; *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* UTF8::from_quoted_ascii(const char* quoted_ascii_str) {
const char *ptr = quoted_ascii_str; const char *ptr = quoted_ascii_str;
char* result = NULL; char* result = NULL;
@ -302,7 +304,7 @@ const char* UTF8::from_quoted_ascii(const char* quoted_ascii_str) {
} }
return buffer; return buffer;
} }
#endif // !PRODUCT
// Returns NULL if 'c' it not found. This only works as long // Returns NULL if 'c' it not found. This only works as long
// as 'c' is an ASCII character // as 'c' is an ASCII character
@ -468,7 +470,6 @@ char* UNICODE::as_utf8(const jchar* base, int length, char* buf, int buflen) {
char* UNICODE::as_utf8(const jbyte* base, int length, char* buf, int buflen) { char* UNICODE::as_utf8(const jbyte* base, int length, char* buf, int buflen) {
u_char* p = (u_char*)buf; u_char* p = (u_char*)buf;
u_char* end = (u_char*)buf + buflen;
for (int index = 0; index < length; index++) { for (int index = 0; index < length; index++) {
jbyte c = base[index]; jbyte c = base[index];
int sz = utf8_size(c); int sz = utf8_size(c);

View File

@ -54,9 +54,11 @@ class UTF8 : AllStatic {
// converts a utf8 string to quoted ascii // converts a utf8 string to quoted ascii
static void as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen); 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 // converts a quoted ascii string to utf8 string. returns the original
// string unchanged if nothing needs to be done. // string unchanged if nothing needs to be done.
static const char* from_quoted_ascii(const char* quoted_ascii_string); static const char* from_quoted_ascii(const char* quoted_ascii_string);
#endif
// decodes the current utf8 character, stores the result in value, // decodes the current utf8 character, stores the result in value,
// and returns the end of the current utf8 chararacter. // and returns the end of the current utf8 chararacter.