comparison src/share/vm/oops/instanceMirrorKlass.cpp @ 17883:9428a0b94204

8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool) Summary: Keep class in CLD::_klasses list and mirror created for CDS classes if OOM during restore_shareable_info(). This keeps pointers consistent for CMS. Reviewed-by: ehelin, stefank, jmasa, iklam
author coleenp
date Tue, 15 Apr 2014 17:02:20 -0400
parents 55fb97c4c58d
children 52b4284cb496 4c1b88a53c74
comparison
equal deleted inserted replaced
17876:9c3dc501b5eb 17883:9428a0b94204
1 /* 1 /*
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2011, 2014, 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.
365 365
366 instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) { 366 instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
367 // Query before forming handle. 367 // Query before forming handle.
368 int size = instance_size(k); 368 int size = instance_size(k);
369 KlassHandle h_k(THREAD, this); 369 KlassHandle h_k(THREAD, this);
370 instanceOop i = (instanceOop) CollectedHeap::Class_obj_allocate(h_k, size, k, CHECK_NULL); 370 instanceOop i = (instanceOop)CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);
371
372 // Since mirrors can be variable sized because of the static fields, store
373 // the size in the mirror itself.
374 java_lang_Class::set_oop_size(i, size);
375
371 return i; 376 return i;
372 } 377 }
373 378
374 int InstanceMirrorKlass::oop_size(oop obj) const { 379 int InstanceMirrorKlass::oop_size(oop obj) const {
375 return java_lang_Class::oop_size(obj); 380 return java_lang_Class::oop_size(obj);