equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2010, 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. |
84 assert(c == 0 || c == code || code == 0, "update must be consistent"); |
84 assert(c == 0 || c == code || code == 0, "update must be consistent"); |
85 #endif |
85 #endif |
86 // Need to flush pending stores here before bytecode is written. |
86 // Need to flush pending stores here before bytecode is written. |
87 OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << 24)); |
87 OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << 24)); |
88 } |
88 } |
|
89 |
|
90 // Atomically sets f1 if it is still NULL, otherwise it keeps the |
|
91 // current value. |
|
92 void ConstantPoolCacheEntry::set_f1_if_null_atomic(oop f1) { |
|
93 // Use barriers as in oop_store |
|
94 HeapWord* f1_addr = (HeapWord*) &_f1; |
|
95 update_barrier_set_pre(f1_addr, f1); |
|
96 void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL); |
|
97 bool success = (result == NULL); |
|
98 if (success) { |
|
99 update_barrier_set((void*) f1_addr, f1); |
|
100 } |
|
101 } |
89 |
102 |
90 #ifdef ASSERT |
103 #ifdef ASSERT |
91 // It is possible to have two different dummy methodOops created |
104 // It is possible to have two different dummy methodOops created |
92 // when the resolve code for invoke interface executes concurrently |
105 // when the resolve code for invoke interface executes concurrently |
93 // Hence the assertion below is weakened a bit for the invokeinterface |
106 // Hence the assertion below is weakened a bit for the invokeinterface |
163 method->print(); |
176 method->print(); |
164 this->print(tty, 0); |
177 this->print(tty, 0); |
165 } |
178 } |
166 assert(method->can_be_statically_bound(), "must be a MH invoker method"); |
179 assert(method->can_be_statically_bound(), "must be a MH invoker method"); |
167 assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized"); |
180 assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized"); |
168 set_f1(method()); |
181 // SystemDictionary::find_method_handle_invoke only caches |
|
182 // methods which signature classes are on the boot classpath, |
|
183 // otherwise the newly created method is returned. To avoid |
|
184 // races in that case we store the first one coming in into the |
|
185 // cp-cache atomically if it's still unset. |
|
186 set_f1_if_null_atomic(method()); |
169 needs_vfinal_flag = false; // _f2 is not an oop |
187 needs_vfinal_flag = false; // _f2 is not an oop |
170 assert(!is_vfinal(), "f2 not an oop"); |
188 assert(!is_vfinal(), "f2 not an oop"); |
171 byte_no = 1; // coordinate this with bytecode_number & is_resolved |
189 byte_no = 1; // coordinate this with bytecode_number & is_resolved |
172 break; |
190 break; |
173 |
191 |