Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/klass.cpp @ 14518:d8041d695d19
Merged with jdk9/dev/hotspot changeset 3812c088b945
author | twisti |
---|---|
date | Tue, 11 Mar 2014 18:45:59 -0700 |
parents | cefad50507d8 7f0e0366ec81 |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14141:f97c5ec83832 | 14518:d8041d695d19 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 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. |
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 | |
381 #ifdef ASSERT | 379 #ifdef ASSERT |
382 // The class is alive iff the class loader is alive. | 380 // The class is alive iff the class loader is alive. |
383 oop loader = class_loader(); | 381 oop loader = class_loader(); |
384 bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); | 382 bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); |
385 #endif // ASSERT | 383 #endif // ASSERT |
638 } | 636 } |
639 #endif // INCLUDE_SERVICES | 637 #endif // INCLUDE_SERVICES |
640 | 638 |
641 // Verification | 639 // Verification |
642 | 640 |
643 void Klass::verify_on(outputStream* st, bool check_dictionary) { | 641 void Klass::verify_on(outputStream* st) { |
644 | 642 |
645 // This can be expensive, but it is worth checking that this klass is actually | 643 // This can be expensive, but it is worth checking that this klass is actually |
646 // in the CLD graph but not in production. | 644 // in the CLD graph but not in production. |
647 assert(ClassLoaderDataGraph::contains((address)this), "Should be"); | 645 assert(ClassLoaderDataGraph::contains((address)this), "Should be"); |
648 | 646 |
692 assert(i >= 0 && i < method_count, "index out of bounds"); | 690 assert(i >= 0 && i < method_count, "index out of bounds"); |
693 return true; | 691 return true; |
694 } | 692 } |
695 | 693 |
696 #endif | 694 #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 |