Mercurial > hg > truffle
comparison src/share/vm/gc_interface/collectedHeap.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 | 270d7cb38f40 |
children | 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
17876:9c3dc501b5eb | 17883:9428a0b94204 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 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. |
580 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); | 580 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); |
581 inspector.doit(); | 581 inspector.doit(); |
582 } | 582 } |
583 } | 583 } |
584 | 584 |
585 oop CollectedHeap::Class_obj_allocate(KlassHandle klass, int size, KlassHandle real_klass, TRAPS) { | |
586 debug_only(check_for_valid_allocation_state()); | |
587 assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed"); | |
588 assert(size >= 0, "int won't convert to size_t"); | |
589 HeapWord* obj; | |
590 assert(ScavengeRootsInCode > 0, "must be"); | |
591 obj = common_mem_allocate_init(real_klass, size, CHECK_NULL); | |
592 post_allocation_setup_common(klass, obj); | |
593 assert(Universe::is_bootstrapping() || | |
594 !((oop)obj)->is_array(), "must not be an array"); | |
595 NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value(obj, size)); | |
596 oop mirror = (oop)obj; | |
597 | |
598 java_lang_Class::set_oop_size(mirror, size); | |
599 | |
600 // Setup indirections | |
601 if (!real_klass.is_null()) { | |
602 java_lang_Class::set_klass(mirror, real_klass()); | |
603 real_klass->set_java_mirror(mirror); | |
604 } | |
605 | |
606 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast(mirror->klass()); | |
607 assert(size == mk->instance_size(real_klass), "should have been set"); | |
608 | |
609 // notify jvmti and dtrace | |
610 post_allocation_notify(klass, (oop)obj); | |
611 | |
612 return mirror; | |
613 } | |
614 | |
615 /////////////// Unit tests /////////////// | 585 /////////////// Unit tests /////////////// |
616 | 586 |
617 #ifndef PRODUCT | 587 #ifndef PRODUCT |
618 void CollectedHeap::test_is_in() { | 588 void CollectedHeap::test_is_in() { |
619 CollectedHeap* heap = Universe::heap(); | 589 CollectedHeap* heap = Universe::heap(); |