comparison src/share/vm/runtime/jniHandles.cpp @ 22877:d68158e12cea

8043224: -Xcheck:jni improvements to exception checking and excessive local refs Summary: Warning when not checking exceptions from function that require so, also when local refs expand beyond capacity. Reviewed-by: dsimms
author poonam
date Wed, 11 Mar 2015 13:36:57 -0700
parents 78bbf4d43a14
children dd9cc155639c
comparison
equal deleted inserted replaced
22876:364f6c28effb 22877:d68158e12cea
1 /* 1 /*
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2015, 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.
294 } 294 }
295 } 295 }
296 block->_top = 0; 296 block->_top = 0;
297 block->_next = NULL; 297 block->_next = NULL;
298 block->_pop_frame_link = NULL; 298 block->_pop_frame_link = NULL;
299 block->_planned_capacity = block_size_in_oops;
299 // _last, _free_list & _allocate_before_rebuild initialized in allocate_handle 300 // _last, _free_list & _allocate_before_rebuild initialized in allocate_handle
300 debug_only(block->_last = NULL); 301 debug_only(block->_last = NULL);
301 debug_only(block->_free_list = NULL); 302 debug_only(block->_free_list = NULL);
302 debug_only(block->_allocate_before_rebuild = -1); 303 debug_only(block->_allocate_before_rebuild = -1);
303 return block; 304 return block;
527 result++; 528 result++;
528 } 529 }
529 return result; 530 return result;
530 } 531 }
531 532
533 const size_t JNIHandleBlock::get_number_of_live_handles() {
534 CountHandleClosure counter;
535 oops_do(&counter);
536 return counter.count();
537 }
538
532 // This method is not thread-safe, i.e., must be called whule holding a lock on the 539 // This method is not thread-safe, i.e., must be called whule holding a lock on the
533 // structure. 540 // structure.
534 long JNIHandleBlock::memory_usage() const { 541 long JNIHandleBlock::memory_usage() const {
535 return length() * sizeof(JNIHandleBlock); 542 return length() * sizeof(JNIHandleBlock);
536 } 543 }