提交 60b0d183 编写于 作者: T twisti

6865583: Verbose CIPrintMethodCodes asserts when ldc an empty String

Summary: ldc seems to load an empty String and that leads to an assert on offset < length, which are both zero.
Reviewed-by: kvn, never
上级 986a5553
...@@ -252,7 +252,7 @@ symbolHandle java_lang_String::as_symbol(Handle java_string, TRAPS) { ...@@ -252,7 +252,7 @@ symbolHandle java_lang_String::as_symbol(Handle java_string, TRAPS) {
typeArrayOop value = java_lang_String::value(obj); typeArrayOop value = java_lang_String::value(obj);
int offset = java_lang_String::offset(obj); int offset = java_lang_String::offset(obj);
int length = java_lang_String::length(obj); int length = java_lang_String::length(obj);
jchar* base = value->char_at_addr(offset); jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
symbolOop sym = SymbolTable::lookup_unicode(base, length, THREAD); symbolOop sym = SymbolTable::lookup_unicode(base, length, THREAD);
return symbolHandle(THREAD, sym); return symbolHandle(THREAD, sym);
} }
...@@ -261,7 +261,7 @@ symbolOop java_lang_String::as_symbol_or_null(oop java_string) { ...@@ -261,7 +261,7 @@ symbolOop java_lang_String::as_symbol_or_null(oop java_string) {
typeArrayOop value = java_lang_String::value(java_string); typeArrayOop value = java_lang_String::value(java_string);
int offset = java_lang_String::offset(java_string); int offset = java_lang_String::offset(java_string);
int length = java_lang_String::length(java_string); int length = java_lang_String::length(java_string);
jchar* base = value->char_at_addr(offset); jchar* base = (length == 0) ? NULL : value->char_at_addr(offset);
return SymbolTable::probe_unicode(base, length); return SymbolTable::probe_unicode(base, length);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册