comparison src/share/vm/runtime/jniHandles.cpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents 2c95095271e9
children 89152779163c
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1 /* 1 /*
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2012, 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.
193 class CountHandleClosure: public OopClosure { 193 class CountHandleClosure: public OopClosure {
194 private: 194 private:
195 int _count; 195 int _count;
196 public: 196 public:
197 CountHandleClosure(): _count(0) {} 197 CountHandleClosure(): _count(0) {}
198 virtual void do_oop(oop* ooph) { 198 virtual void do_oop(oop* unused) {
199 if (*ooph != JNIHandles::deleted_handle()) { 199 _count++;
200 _count++;
201 }
202 } 200 }
203 virtual void do_oop(narrowOop* unused) { ShouldNotReachHere(); } 201 virtual void do_oop(narrowOop* unused) { ShouldNotReachHere(); }
204 int count() { return _count; } 202 int count() { return _count; }
205 }; 203 };
206 204
461 rebuild_free_list(); // updates _allocate_before_rebuild counter 459 rebuild_free_list(); // updates _allocate_before_rebuild counter
462 } else { 460 } else {
463 // Append new block 461 // Append new block
464 Thread* thread = Thread::current(); 462 Thread* thread = Thread::current();
465 Handle obj_handle(thread, obj); 463 Handle obj_handle(thread, obj);
466 // This can block, so we need to preserve obj across call. 464 // This can block, so we need to preserve obj accross call.
467 _last->_next = JNIHandleBlock::allocate_block(thread); 465 _last->_next = JNIHandleBlock::allocate_block(thread);
468 _last = _last->_next; 466 _last = _last->_next;
469 _allocate_before_rebuild--; 467 _allocate_before_rebuild--;
470 obj = obj_handle(); 468 obj = obj_handle();
471 } 469 }
528 result++; 526 result++;
529 } 527 }
530 return result; 528 return result;
531 } 529 }
532 530
533 // This method is not thread-safe, i.e., must be called while holding a lock on the 531 // This method is not thread-safe, i.e., must be called whule holding a lock on the
534 // structure. 532 // structure.
535 long JNIHandleBlock::memory_usage() const { 533 long JNIHandleBlock::memory_usage() const {
536 return length() * sizeof(JNIHandleBlock); 534 return length() * sizeof(JNIHandleBlock);
537 } 535 }
538 536