aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/opto/stringopts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/opto/stringopts.cpp')
-rw-r--r--src/share/vm/opto/stringopts.cpp45
1 files changed, 12 insertions, 33 deletions
diff --git a/src/share/vm/opto/stringopts.cpp b/src/share/vm/opto/stringopts.cpp
index 496e7a883..99498ea95 100644
--- a/src/share/vm/opto/stringopts.cpp
+++ b/src/share/vm/opto/stringopts.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2012, 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
@@ -528,16 +528,6 @@ PhaseStringOpts::PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List*):
}
// Collect the types needed to talk about the various slices of memory
- const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
- false, NULL, 0);
-
- const TypePtr* value_field_type = string_type->add_offset(java_lang_String::value_offset_in_bytes());
- const TypePtr* offset_field_type = string_type->add_offset(java_lang_String::offset_offset_in_bytes());
- const TypePtr* count_field_type = string_type->add_offset(java_lang_String::count_offset_in_bytes());
-
- value_field_idx = C->get_alias_index(value_field_type);
- count_field_idx = C->get_alias_index(count_field_type);
- offset_field_idx = C->get_alias_index(offset_field_type);
char_adr_idx = C->get_alias_index(TypeAryPtr::CHARS);
// For each locally allocated StringBuffer see if the usages can be
@@ -1174,18 +1164,9 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N
Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* char_array, Node* start) {
Node* string = str;
- Node* offset = kit.make_load(kit.control(),
- kit.basic_plus_adr(string, string, java_lang_String::offset_offset_in_bytes()),
- TypeInt::INT, T_INT, offset_field_idx);
- Node* count = kit.make_load(kit.control(),
- kit.basic_plus_adr(string, string, java_lang_String::count_offset_in_bytes()),
- TypeInt::INT, T_INT, count_field_idx);
- const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
- TypeAry::make(TypeInt::CHAR,TypeInt::POS),
- ciTypeArrayKlass::make(T_CHAR), true, 0);
- Node* value = kit.make_load(kit.control(),
- kit.basic_plus_adr(string, string, java_lang_String::value_offset_in_bytes()),
- value_type, T_OBJECT, value_field_idx);
+ Node* offset = kit.load_String_offset(kit.control(), string);
+ Node* count = kit.load_String_length(kit.control(), string);
+ Node* value = kit.load_String_value (kit.control(), string);
// copy the contents
if (offset->is_Con() && count->is_Con() && value->is_Con() && count->get_int() < unroll_string_copy_length) {
@@ -1342,10 +1323,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
arg = phi;
sc->set_argument(argi, arg);
}
- // Node* offset = kit.make_load(NULL, kit.basic_plus_adr(arg, arg, offset_offset),
- // TypeInt::INT, T_INT, offset_field_idx);
- Node* count = kit.make_load(kit.control(), kit.basic_plus_adr(arg, arg, java_lang_String::count_offset_in_bytes()),
- TypeInt::INT, T_INT, count_field_idx);
+
+ Node* count = kit.load_String_length(kit.control(), arg);
+
length = __ AddI(length, count);
string_sizes->init_req(argi, NULL);
break;
@@ -1436,12 +1416,11 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
}
// Intialize the string
- kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::offset_offset_in_bytes()),
- __ intcon(0), T_INT, offset_field_idx);
- kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::count_offset_in_bytes()),
- length, T_INT, count_field_idx);
- kit.store_to_memory(kit.control(), kit.basic_plus_adr(result, java_lang_String::value_offset_in_bytes()),
- char_array, T_OBJECT, value_field_idx);
+ if (java_lang_String::has_offset_field()) {
+ kit.store_String_offset(kit.control(), result, __ intcon(0));
+ kit.store_String_length(kit.control(), result, length);
+ }
+ kit.store_String_value(kit.control(), result, char_array);
// hook up the outgoing control and result
kit.replace_call(sc->end(), result);