changeset 1005:489a4f8dcd0f

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
author twisti
date Thu, 27 Aug 2009 06:17:23 -0700
parents aba04734b61e
children 8fe1963e3964
files src/share/vm/classfile/javaClasses.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/javaClasses.cpp	Tue Aug 25 13:08:40 2009 -0700
+++ b/src/share/vm/classfile/javaClasses.cpp	Thu Aug 27 06:17:23 2009 -0700
@@ -252,7 +252,7 @@
   typeArrayOop value  = java_lang_String::value(obj);
   int          offset = java_lang_String::offset(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);
   return symbolHandle(THREAD, sym);
 }
@@ -261,7 +261,7 @@
   typeArrayOop value  = java_lang_String::value(java_string);
   int          offset = java_lang_String::offset(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);
 }