1.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri May 11 14:54:35 2012 -0700 1.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Mon May 14 09:36:00 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -238,9 +238,12 @@ 1.11 1.12 Register result = dst->as_register(); 1.13 { 1.14 - // Get a pointer to the first character of string0 in tmp0 and get string0.count in str0 1.15 - // Get a pointer to the first character of string1 in tmp1 and get string1.count in str1 1.16 - // Also, get string0.count-string1.count in o7 and get the condition code set 1.17 + // Get a pointer to the first character of string0 in tmp0 1.18 + // and get string0.length() in str0 1.19 + // Get a pointer to the first character of string1 in tmp1 1.20 + // and get string1.length() in str1 1.21 + // Also, get string0.length()-string1.length() in 1.22 + // o7 and get the condition code set 1.23 // Note: some instructions have been hoisted for better instruction scheduling 1.24 1.25 Register tmp0 = L0; 1.26 @@ -248,27 +251,40 @@ 1.27 Register tmp2 = L2; 1.28 1.29 int value_offset = java_lang_String:: value_offset_in_bytes(); // char array 1.30 - int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position 1.31 - int count_offset = java_lang_String:: count_offset_in_bytes(); 1.32 - 1.33 - __ load_heap_oop(str0, value_offset, tmp0); 1.34 - __ ld(str0, offset_offset, tmp2); 1.35 - __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); 1.36 - __ ld(str0, count_offset, str0); 1.37 - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); 1.38 + if (java_lang_String::has_offset_field()) { 1.39 + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position 1.40 + int count_offset = java_lang_String:: count_offset_in_bytes(); 1.41 + __ load_heap_oop(str0, value_offset, tmp0); 1.42 + __ ld(str0, offset_offset, tmp2); 1.43 + __ add(tmp0, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); 1.44 + __ ld(str0, count_offset, str0); 1.45 + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); 1.46 + } else { 1.47 + __ load_heap_oop(str0, value_offset, tmp1); 1.48 + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp0); 1.49 + __ ld(tmp1, arrayOopDesc::length_offset_in_bytes(), str0); 1.50 + } 1.51 1.52 // str1 may be null 1.53 add_debug_info_for_null_check_here(info); 1.54 1.55 - __ load_heap_oop(str1, value_offset, tmp1); 1.56 - __ add(tmp0, tmp2, tmp0); 1.57 - 1.58 - __ ld(str1, offset_offset, tmp2); 1.59 - __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); 1.60 - __ ld(str1, count_offset, str1); 1.61 - __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); 1.62 + if (java_lang_String::has_offset_field()) { 1.63 + int offset_offset = java_lang_String::offset_offset_in_bytes(); // first character position 1.64 + int count_offset = java_lang_String:: count_offset_in_bytes(); 1.65 + __ load_heap_oop(str1, value_offset, tmp1); 1.66 + __ add(tmp0, tmp2, tmp0); 1.67 + 1.68 + __ ld(str1, offset_offset, tmp2); 1.69 + __ add(tmp1, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); 1.70 + __ ld(str1, count_offset, str1); 1.71 + __ sll(tmp2, exact_log2(sizeof(jchar)), tmp2); 1.72 + __ add(tmp1, tmp2, tmp1); 1.73 + } else { 1.74 + __ load_heap_oop(str1, value_offset, tmp2); 1.75 + __ add(tmp2, arrayOopDesc::base_offset_in_bytes(T_CHAR), tmp1); 1.76 + __ ld(tmp2, arrayOopDesc::length_offset_in_bytes(), str1); 1.77 + } 1.78 __ subcc(str0, str1, O7); 1.79 - __ add(tmp1, tmp2, tmp1); 1.80 } 1.81 1.82 { 1.83 @@ -302,7 +318,7 @@ 1.84 // Shift base0 and base1 to the end of the arrays, negate limit 1.85 __ add(base0, limit, base0); 1.86 __ add(base1, limit, base1); 1.87 - __ neg(limit); // limit = -min{string0.count, strin1.count} 1.88 + __ neg(limit); // limit = -min{string0.length(), string1.length()} 1.89 1.90 __ lduh(base0, limit, chr0); 1.91 __ bind(Lloop);