1 /* |
1 /* |
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 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. |
96 } |
96 } |
97 |
97 |
98 // Atomically sets f1 if it is still NULL, otherwise it keeps the |
98 // Atomically sets f1 if it is still NULL, otherwise it keeps the |
99 // current value. |
99 // current value. |
100 void ConstantPoolCacheEntry::set_f1_if_null_atomic(oop f1) { |
100 void ConstantPoolCacheEntry::set_f1_if_null_atomic(oop f1) { |
101 // Use barriers as in oop_store |
101 // Use barriers as in oop_store |
102 HeapWord* f1_addr = (HeapWord*) &_f1; |
102 oop* f1_addr = (oop*) &_f1; |
103 update_barrier_set_pre(f1_addr, f1); |
103 update_barrier_set_pre(f1_addr, f1); |
104 void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL); |
104 void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL); |
105 bool success = (result == NULL); |
105 bool success = (result == NULL); |
106 if (success) { |
106 if (success) { |
107 update_barrier_set((void*) f1_addr, f1); |
107 update_barrier_set(f1_addr, f1); |
108 } |
108 } |
109 } |
109 } |
110 |
110 |
111 #ifdef ASSERT |
111 #ifdef ASSERT |
112 // It is possible to have two different dummy methodOops created |
112 // It is possible to have two different dummy methodOops created |
113 // when the resolve code for invoke interface executes concurrently |
113 // when the resolve code for invoke interface executes concurrently |
114 // Hence the assertion below is weakened a bit for the invokeinterface |
114 // Hence the assertion below is weakened a bit for the invokeinterface |