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. |
49 #include "oops/constantPoolKlass.hpp" |
49 #include "oops/constantPoolKlass.hpp" |
50 #include "oops/constantPoolOop.hpp" |
50 #include "oops/constantPoolOop.hpp" |
51 #include "oops/cpCacheKlass.hpp" |
51 #include "oops/cpCacheKlass.hpp" |
52 #include "oops/cpCacheOop.hpp" |
52 #include "oops/cpCacheOop.hpp" |
53 #include "oops/instanceKlass.hpp" |
53 #include "oops/instanceKlass.hpp" |
|
54 #include "oops/instanceMirrorKlass.hpp" |
54 #include "oops/instanceKlassKlass.hpp" |
55 #include "oops/instanceKlassKlass.hpp" |
55 #include "oops/instanceRefKlass.hpp" |
56 #include "oops/instanceRefKlass.hpp" |
56 #include "oops/klassKlass.hpp" |
57 #include "oops/klassKlass.hpp" |
57 #include "oops/klassOop.hpp" |
58 #include "oops/klassOop.hpp" |
58 #include "oops/methodDataKlass.hpp" |
59 #include "oops/methodDataKlass.hpp" |
519 { klassKlass o; add_vtable(list, &n, &o, count); } |
520 { klassKlass o; add_vtable(list, &n, &o, count); } |
520 { arrayKlassKlass o; add_vtable(list, &n, &o, count); } |
521 { arrayKlassKlass o; add_vtable(list, &n, &o, count); } |
521 { objArrayKlassKlass o; add_vtable(list, &n, &o, count); } |
522 { objArrayKlassKlass o; add_vtable(list, &n, &o, count); } |
522 { instanceKlassKlass o; add_vtable(list, &n, &o, count); } |
523 { instanceKlassKlass o; add_vtable(list, &n, &o, count); } |
523 { instanceKlass o; add_vtable(list, &n, &o, count); } |
524 { instanceKlass o; add_vtable(list, &n, &o, count); } |
|
525 { instanceMirrorKlass o; add_vtable(list, &n, &o, count); } |
524 { instanceRefKlass o; add_vtable(list, &n, &o, count); } |
526 { instanceRefKlass o; add_vtable(list, &n, &o, count); } |
525 { typeArrayKlassKlass o; add_vtable(list, &n, &o, count); } |
527 { typeArrayKlassKlass o; add_vtable(list, &n, &o, count); } |
526 { typeArrayKlass o; add_vtable(list, &n, &o, count); } |
528 { typeArrayKlass o; add_vtable(list, &n, &o, count); } |
527 { methodKlass o; add_vtable(list, &n, &o, count); } |
529 { methodKlass o; add_vtable(list, &n, &o, count); } |
528 { constMethodKlass o; add_vtable(list, &n, &o, count); } |
530 { constMethodKlass o; add_vtable(list, &n, &o, count); } |
545 if (obj->is_klass()) { |
547 if (obj->is_klass()) { |
546 EXCEPTION_MARK; |
548 EXCEPTION_MARK; |
547 KlassHandle k(THREAD, klassOop(obj)); |
549 KlassHandle k(THREAD, klassOop(obj)); |
548 // We will never reach the CATCH below since Exceptions::_throw will cause |
550 // We will never reach the CATCH below since Exceptions::_throw will cause |
549 // the VM to exit if an exception is thrown during initialization |
551 // the VM to exit if an exception is thrown during initialization |
550 java_lang_Class::create_mirror(k, CATCH); |
552 java_lang_Class::fixup_mirror(k, CATCH); |
551 // This call unconditionally creates a new mirror for k, |
553 // This call unconditionally creates a new mirror for k, |
552 // and links in k's component_mirror field if k is an array. |
554 // and links in k's component_mirror field if k is an array. |
553 // If k is an objArray, k's element type must already have |
555 // If k is an objArray, k's element type must already have |
554 // a mirror. In other words, this closure must process |
556 // a mirror. In other words, this closure must process |
555 // the component type of an objArray k before it processes k. |
557 // the component type of an objArray k before it processes k. |
603 // Bootstrap problem: all classes gets a mirror (java.lang.Class instance) assigned eagerly, |
605 // Bootstrap problem: all classes gets a mirror (java.lang.Class instance) assigned eagerly, |
604 // but we cannot do that for classes created before java.lang.Class is loaded. Here we simply |
606 // but we cannot do that for classes created before java.lang.Class is loaded. Here we simply |
605 // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note |
607 // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note |
606 // that the number of objects allocated at this point is very small. |
608 // that the number of objects allocated at this point is very small. |
607 assert(SystemDictionary::Class_klass_loaded(), "java.lang.Class should be loaded"); |
609 assert(SystemDictionary::Class_klass_loaded(), "java.lang.Class should be loaded"); |
|
610 |
|
611 // Cache the start of the static fields |
|
612 instanceMirrorKlass::init_offset_of_static_fields(); |
|
613 |
608 FixupMirrorClosure blk; |
614 FixupMirrorClosure blk; |
609 Universe::heap()->permanent_object_iterate(&blk); |
615 Universe::heap()->permanent_object_iterate(&blk); |
610 } |
616 } |
611 |
617 |
612 |
618 |