equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
78 void do_oop(oop* p) { |
78 void do_oop(oop* p) { |
79 if (p != NULL) { |
79 if (p != NULL) { |
80 oop obj = *p; |
80 oop obj = *p; |
81 if (obj->klass() == SystemDictionary::String_klass()) { |
81 if (obj->klass() == SystemDictionary::String_klass()) { |
82 |
82 |
83 int hash; |
83 int hash = java_lang_String::hash_string(obj); |
84 typeArrayOop value = java_lang_String::value(obj); |
|
85 int length = java_lang_String::length(obj); |
|
86 if (length == 0) { |
|
87 hash = 0; |
|
88 } else { |
|
89 int offset = java_lang_String::offset(obj); |
|
90 jchar* s = value->char_at_addr(offset); |
|
91 hash = StringTable::hash_string(s, length); |
|
92 } |
|
93 obj->int_field_put(hash_offset, hash); |
84 obj->int_field_put(hash_offset, hash); |
94 } |
85 } |
95 } |
86 } |
96 } |
87 } |
97 void do_oop(narrowOop* p) { ShouldNotReachHere(); } |
88 void do_oop(narrowOop* p) { ShouldNotReachHere(); } |