Mercurial > hg > truffle
comparison src/share/vm/oops/klass.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | d8041d695d19 |
children | 52b4284cb496 |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, 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. |
374 super->set_subklass(this); | 374 super->set_subklass(this); |
375 debug_only(verify();) | 375 debug_only(verify();) |
376 } | 376 } |
377 | 377 |
378 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { | 378 bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { |
379 assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); | |
380 | |
379 #ifdef ASSERT | 381 #ifdef ASSERT |
380 // The class is alive iff the class loader is alive. | 382 // The class is alive iff the class loader is alive. |
381 oop loader = class_loader(); | 383 oop loader = class_loader(); |
382 bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); | 384 bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); |
383 #endif // ASSERT | 385 #endif // ASSERT |
636 } | 638 } |
637 #endif // INCLUDE_SERVICES | 639 #endif // INCLUDE_SERVICES |
638 | 640 |
639 // Verification | 641 // Verification |
640 | 642 |
641 void Klass::verify_on(outputStream* st) { | 643 void Klass::verify_on(outputStream* st, bool check_dictionary) { |
642 | 644 |
643 // This can be expensive, but it is worth checking that this klass is actually | 645 // This can be expensive, but it is worth checking that this klass is actually |
644 // in the CLD graph but not in production. | 646 // in the CLD graph but not in production. |
645 assert(ClassLoaderDataGraph::contains((address)this), "Should be"); | 647 assert(ClassLoaderDataGraph::contains((address)this), "Should be"); |
646 | 648 |
690 assert(i >= 0 && i < method_count, "index out of bounds"); | 692 assert(i >= 0 && i < method_count, "index out of bounds"); |
691 return true; | 693 return true; |
692 } | 694 } |
693 | 695 |
694 #endif | 696 #endif |
695 | |
696 /////////////// Unit tests /////////////// | |
697 | |
698 #ifndef PRODUCT | |
699 | |
700 class TestKlass { | |
701 public: | |
702 static void test_oop_is_instanceClassLoader() { | |
703 assert(SystemDictionary::ClassLoader_klass()->oop_is_instanceClassLoader(), "assert"); | |
704 assert(!SystemDictionary::String_klass()->oop_is_instanceClassLoader(), "assert"); | |
705 } | |
706 }; | |
707 | |
708 void TestKlass_test() { | |
709 TestKlass::test_oop_is_instanceClassLoader(); | |
710 } | |
711 | |
712 #endif |