comparison src/share/vm/oops/objArrayKlass.cpp @ 2119:d4fca0a6abde

7011386: race in objArrayKlass::array_klass_impl Summary: Move _lower_dimension field initialization before _higher_dimension and add storestore barrier. Reviewed-by: dholmes, iveresov, never
author kvn
date Tue, 11 Jan 2011 20:26:13 -0800
parents f95d63e2154a
children 3582bf76420e
comparison
equal deleted inserted replaced
2118:dd031b2226de 2119:d4fca0a6abde
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 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.
233 // Create multi-dim klass object and link them together 233 // Create multi-dim klass object and link them together
234 klassOop new_klass = 234 klassOop new_klass =
235 objArrayKlassKlass::cast(Universe::objArrayKlassKlassObj())-> 235 objArrayKlassKlass::cast(Universe::objArrayKlassKlassObj())->
236 allocate_objArray_klass(dimension + 1, this_oop, CHECK_NULL); 236 allocate_objArray_klass(dimension + 1, this_oop, CHECK_NULL);
237 ak = objArrayKlassHandle(THREAD, new_klass); 237 ak = objArrayKlassHandle(THREAD, new_klass);
238 ak->set_lower_dimension(this_oop());
239 OrderAccess::storestore();
238 this_oop->set_higher_dimension(ak()); 240 this_oop->set_higher_dimension(ak());
239 ak->set_lower_dimension(this_oop());
240 assert(ak->oop_is_objArray(), "incorrect initialization of objArrayKlass"); 241 assert(ak->oop_is_objArray(), "incorrect initialization of objArrayKlass");
241 } 242 }
242 } 243 }
243 } else { 244 } else {
244 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); 245 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());