Mon, 02 Jun 2014 14:32:29 -0400
8029381: assert(is_method_type()) failed: bad cast
Summary: Access to method_type and appendix from constant pool (cpcache) needs to be guarded by is_f1_null() because of racy update/initialization.
Reviewed-by: kvn, coleenp, jrose
src/share/vm/oops/cpCache.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/oops/cpCache.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/oops/cpCache.cpp Wed Jun 11 10:46:47 2014 +0200 1.2 +++ b/src/share/vm/oops/cpCache.cpp Mon Jun 02 14:32:29 2014 -0400 1.3 @@ -406,7 +406,7 @@ 1.4 1.5 1.6 oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) { 1.7 - if (is_f1_null() || !has_appendix()) 1.8 + if (!has_appendix()) 1.9 return NULL; 1.10 const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset; 1.11 objArrayOop resolved_references = cpool->resolved_references(); 1.12 @@ -415,7 +415,7 @@ 1.13 1.14 1.15 oop ConstantPoolCacheEntry::method_type_if_resolved(constantPoolHandle cpool) { 1.16 - if (is_f1_null() || !has_method_type()) 1.17 + if (!has_method_type()) 1.18 return NULL; 1.19 const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset; 1.20 objArrayOop resolved_references = cpool->resolved_references();
2.1 --- a/src/share/vm/oops/cpCache.hpp Wed Jun 11 10:46:47 2014 +0200 2.2 +++ b/src/share/vm/oops/cpCache.hpp Mon Jun 02 14:32:29 2014 -0400 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -346,8 +346,8 @@ 2.11 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } 2.12 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; } 2.13 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; } 2.14 - bool has_appendix() const { return (_flags & (1 << has_appendix_shift)) != 0; } 2.15 - bool has_method_type() const { return (_flags & (1 << has_method_type_shift)) != 0; } 2.16 + bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; } 2.17 + bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; } 2.18 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; } 2.19 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; } 2.20 bool is_byte() const { return flag_state() == btos; }