提交 182f10ae 编写于 作者: K kvn

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
上级 bb190c23
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -36,8 +36,8 @@ class arrayKlass: public Klass { ...@@ -36,8 +36,8 @@ class arrayKlass: public Klass {
friend class VMStructs; friend class VMStructs;
private: private:
int _dimension; // This is n'th-dimensional array. int _dimension; // This is n'th-dimensional array.
klassOop _higher_dimension; // Refers the (n+1)'th-dimensional array (if present). volatile klassOop _higher_dimension; // Refers the (n+1)'th-dimensional array (if present).
klassOop _lower_dimension; // Refers the (n-1)'th-dimensional array (if present). volatile klassOop _lower_dimension; // Refers the (n-1)'th-dimensional array (if present).
int _vtable_len; // size of vtable for this klass int _vtable_len; // size of vtable for this klass
juint _alloc_size; // allocation profiling support juint _alloc_size; // allocation profiling support
oop _component_mirror; // component type, as a java/lang/Class oop _component_mirror; // component type, as a java/lang/Class
......
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -235,8 +235,9 @@ klassOop objArrayKlass::array_klass_impl(objArrayKlassHandle this_oop, bool or_n ...@@ -235,8 +235,9 @@ klassOop objArrayKlass::array_klass_impl(objArrayKlassHandle this_oop, bool or_n
objArrayKlassKlass::cast(Universe::objArrayKlassKlassObj())-> objArrayKlassKlass::cast(Universe::objArrayKlassKlassObj())->
allocate_objArray_klass(dimension + 1, this_oop, CHECK_NULL); allocate_objArray_klass(dimension + 1, this_oop, CHECK_NULL);
ak = objArrayKlassHandle(THREAD, new_klass); ak = objArrayKlassHandle(THREAD, new_klass);
this_oop->set_higher_dimension(ak());
ak->set_lower_dimension(this_oop()); ak->set_lower_dimension(this_oop());
OrderAccess::storestore();
this_oop->set_higher_dimension(ak());
assert(ak->oop_is_objArray(), "incorrect initialization of objArrayKlass"); assert(ak->oop_is_objArray(), "incorrect initialization of objArrayKlass");
} }
} }
......
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -179,6 +179,7 @@ klassOop typeArrayKlass::array_klass_impl(typeArrayKlassHandle h_this, bool or_n ...@@ -179,6 +179,7 @@ klassOop typeArrayKlass::array_klass_impl(typeArrayKlassHandle h_this, bool or_n
dimension + 1, h_this, CHECK_NULL); dimension + 1, h_this, CHECK_NULL);
h_ak = objArrayKlassHandle(THREAD, oak); h_ak = objArrayKlassHandle(THREAD, oak);
h_ak->set_lower_dimension(h_this()); h_ak->set_lower_dimension(h_this());
OrderAccess::storestore();
h_this->set_higher_dimension(h_ak()); h_this->set_higher_dimension(h_ak());
assert(h_ak->oop_is_objArray(), "incorrect initialization of objArrayKlass"); assert(h_ak->oop_is_objArray(), "incorrect initialization of objArrayKlass");
} }
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -219,8 +219,8 @@ static inline uint64_t cast_uint64_t(size_t x) ...@@ -219,8 +219,8 @@ static inline uint64_t cast_uint64_t(size_t x)
volatile_nonstatic_field(oopDesc, _metadata._compressed_klass, narrowOop) \ volatile_nonstatic_field(oopDesc, _metadata._compressed_klass, narrowOop) \
static_field(oopDesc, _bs, BarrierSet*) \ static_field(oopDesc, _bs, BarrierSet*) \
nonstatic_field(arrayKlass, _dimension, int) \ nonstatic_field(arrayKlass, _dimension, int) \
nonstatic_field(arrayKlass, _higher_dimension, klassOop) \ volatile_nonstatic_field(arrayKlass, _higher_dimension, klassOop) \
nonstatic_field(arrayKlass, _lower_dimension, klassOop) \ volatile_nonstatic_field(arrayKlass, _lower_dimension, klassOop) \
nonstatic_field(arrayKlass, _vtable_len, int) \ nonstatic_field(arrayKlass, _vtable_len, int) \
nonstatic_field(arrayKlass, _alloc_size, juint) \ nonstatic_field(arrayKlass, _alloc_size, juint) \
nonstatic_field(arrayKlass, _component_mirror, oop) \ nonstatic_field(arrayKlass, _component_mirror, oop) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册