diff 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
line wrap: on
line diff
--- a/src/share/vm/runtime/jniHandles.cpp	Mon Mar 02 13:40:40 2015 +0100
+++ b/src/share/vm/runtime/jniHandles.cpp	Wed Mar 11 13:36:57 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -296,6 +296,7 @@
   block->_top  = 0;
   block->_next = NULL;
   block->_pop_frame_link = NULL;
+  block->_planned_capacity = block_size_in_oops;
   // _last, _free_list & _allocate_before_rebuild initialized in allocate_handle
   debug_only(block->_last = NULL);
   debug_only(block->_free_list = NULL);
@@ -529,6 +530,12 @@
   return result;
 }
 
+const size_t JNIHandleBlock::get_number_of_live_handles() {
+  CountHandleClosure counter;
+  oops_do(&counter);
+  return counter.count();
+}
+
 // This method is not thread-safe, i.e., must be called whule holding a lock on the
 // structure.
 long JNIHandleBlock::memory_usage() const {