Mercurial > hg > truffle
comparison src/share/vm/code/codeCache.cpp @ 2491:0654ee04b214
Merge with OpenJDK.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 22 Apr 2011 15:30:53 +0200 |
parents | dbccacb79c63 |
children | 167b70ff3abc |
comparison
equal
deleted
inserted
replaced
2490:29246b1d2d3c | 2491:0654ee04b214 |
---|---|
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. |
335 } | 335 } |
336 #endif //PRODUCT | 336 #endif //PRODUCT |
337 if (is_live) { | 337 if (is_live) { |
338 // Perform cur->oops_do(f), maybe just once per nmethod. | 338 // Perform cur->oops_do(f), maybe just once per nmethod. |
339 f->do_code_blob(cur); | 339 f->do_code_blob(cur); |
340 cur->fix_oop_relocations(); | |
341 } | 340 } |
342 } | 341 } |
343 | 342 |
344 // Check for stray marks. | 343 // Check for stray marks. |
345 debug_only(verify_perm_nmethods(NULL)); | 344 debug_only(verify_perm_nmethods(NULL)); |
547 } | 546 } |
548 } | 547 } |
549 set_needs_cache_clean(false); | 548 set_needs_cache_clean(false); |
550 prune_scavenge_root_nmethods(); | 549 prune_scavenge_root_nmethods(); |
551 assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called"); | 550 assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called"); |
551 } | |
552 | |
553 | |
554 void CodeCache::verify_oops() { | |
555 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
556 VerifyOopClosure voc; | |
557 FOR_ALL_ALIVE_BLOBS(cb) { | |
558 if (cb->is_nmethod()) { | |
559 nmethod *nm = (nmethod*)cb; | |
560 nm->oops_do(&voc); | |
561 nm->verify_oop_relocations(); | |
562 } | |
563 } | |
552 } | 564 } |
553 | 565 |
554 | 566 |
555 address CodeCache::first_address() { | 567 address CodeCache::first_address() { |
556 assert_locked_or_safepoint(CodeCache_lock); | 568 assert_locked_or_safepoint(CodeCache_lock); |
937 st->print_cr("Code Cache [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", | 949 st->print_cr("Code Cache [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", |
938 _heap->low_boundary(), | 950 _heap->low_boundary(), |
939 _heap->high(), | 951 _heap->high(), |
940 _heap->high_boundary()); | 952 _heap->high_boundary()); |
941 st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT | 953 st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT |
942 " adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT | 954 " adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT "Kb" |
943 " largest_free_block=" SIZE_FORMAT, | 955 " largest_free_block=" SIZE_FORMAT, |
944 CodeCache::nof_blobs(), CodeCache::nof_nmethods(), | 956 nof_blobs(), nof_nmethods(), nof_adapters(), |
945 CodeCache::nof_adapters(), CodeCache::unallocated_capacity(), | 957 unallocated_capacity()/K, largest_free_block()); |
946 CodeCache::largest_free_block()); | 958 } |
947 } | 959 |
960 void CodeCache::log_state(outputStream* st) { | |
961 st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'" | |
962 " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'" | |
963 " largest_free_block='" SIZE_FORMAT "'", | |
964 nof_blobs(), nof_nmethods(), nof_adapters(), | |
965 unallocated_capacity(), largest_free_block()); | |
966 } | |
967 | |
968 size_t CodeCache::largest_free_block() { | |
969 // This is called both with and without CodeCache_lock held so | |
970 // handle both cases. | |
971 if (CodeCache_lock->owned_by_self()) { | |
972 return _heap->largest_free_block(); | |
973 } else { | |
974 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
975 return _heap->largest_free_block(); | |
976 } | |
977 } |