annotate src/share/vm/runtime/handles.inline.hpp @ 4731:1f114331df92

8023730: new hotspot build - hs24-b57 Reviewed-by: jcoomes
author amurillo
date Mon, 26 Aug 2013 12:06:09 -0700
parents d2a62e0f25eb
children
rev   line source
duke@0 1 /*
stefank@1869 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1489 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1489 20 * or visit www.oracle.com if you need additional information or have any
trims@1489 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1869 25 #ifndef SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
stefank@1869 26 #define SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
stefank@1869 27
stefank@1869 28 #include "runtime/handles.hpp"
stefank@1869 29 #ifdef TARGET_OS_FAMILY_linux
stefank@1869 30 # include "thread_linux.inline.hpp"
stefank@1869 31 #endif
stefank@1869 32 #ifdef TARGET_OS_FAMILY_solaris
stefank@1869 33 # include "thread_solaris.inline.hpp"
stefank@1869 34 #endif
stefank@1869 35 #ifdef TARGET_OS_FAMILY_windows
stefank@1869 36 # include "thread_windows.inline.hpp"
stefank@1869 37 #endif
never@2719 38 #ifdef TARGET_OS_FAMILY_bsd
never@2719 39 # include "thread_bsd.inline.hpp"
never@2719 40 #endif
stefank@1869 41
duke@0 42 // these inline functions are in a separate file to break an include cycle
duke@0 43 // between Thread and Handle
duke@0 44
duke@0 45 inline Handle::Handle(oop obj) {
duke@0 46 if (obj == NULL) {
duke@0 47 _handle = NULL;
duke@0 48 } else {
duke@0 49 _handle = Thread::current()->handle_area()->allocate_handle(obj);
duke@0 50 }
duke@0 51 }
duke@0 52
duke@0 53
duke@0 54 #ifndef ASSERT
duke@0 55 inline Handle::Handle(Thread* thread, oop obj) {
duke@0 56 assert(thread == Thread::current(), "sanity check");
duke@0 57 if (obj == NULL) {
duke@0 58 _handle = NULL;
duke@0 59 } else {
duke@0 60 _handle = thread->handle_area()->allocate_handle(obj);
duke@0 61 }
duke@0 62 }
duke@0 63 #endif // ASSERT
duke@0 64
duke@0 65
duke@0 66 inline HandleMark::HandleMark() {
duke@0 67 initialize(Thread::current());
duke@0 68 }
duke@0 69
duke@0 70
duke@0 71 inline void HandleMark::push() {
duke@0 72 // This is intentionally a NOP. pop_and_restore will reset
duke@0 73 // values to the HandleMark further down the stack, typically
duke@0 74 // in JavaCalls::call_helper.
duke@0 75 debug_only(_area->_handle_mark_nesting++);
duke@0 76 }
duke@0 77
duke@0 78 inline void HandleMark::pop_and_restore() {
duke@0 79 HandleArea* area = _area; // help compilers with poor alias analysis
duke@0 80 // Delete later chunks
duke@0 81 if( _chunk->next() ) {
zgu@4062 82 // reset arena size before delete chunks. Otherwise, the total
zgu@4062 83 // arena size could exceed total chunk size
zgu@4062 84 assert(area->size_in_bytes() > size_in_bytes(), "Sanity check");
zgu@4062 85 area->set_size_in_bytes(size_in_bytes());
duke@0 86 _chunk->next_chop();
zgu@4062 87 } else {
zgu@4062 88 assert(area->size_in_bytes() == size_in_bytes(), "Sanity check");
duke@0 89 }
duke@0 90 // Roll back arena to saved top markers
duke@0 91 area->_chunk = _chunk;
duke@0 92 area->_hwm = _hwm;
duke@0 93 area->_max = _max;
duke@0 94 debug_only(area->_handle_mark_nesting--);
duke@0 95 }
stefank@1869 96
stefank@1869 97 #endif // SHARE_VM_RUNTIME_HANDLES_INLINE_HPP