comparison src/share/vm/runtime/handles.hpp @ 10135:5a9fa2ba85f0

8012907: anti-delta fix for 8010992 Summary: anti-delta fix for 8010992 until 8012902 can be fixed Reviewed-by: acorn, minqi, rdurbin
author dcubed
date Sun, 21 Apr 2013 20:41:04 -0700
parents 6f817ce50129
children f9be75d21404
comparison
equal deleted inserted replaced
10130:6f817ce50129 10135:5a9fa2ba85f0
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 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.
278 // h()->print(); // WRONG, h destroyed by HandleMark destructor. 278 // h()->print(); // WRONG, h destroyed by HandleMark destructor.
279 // 279 //
280 // If h has to be preserved, it can be converted to an oop or a local JNI handle 280 // If h has to be preserved, it can be converted to an oop or a local JNI handle
281 // across the HandleMark boundary. 281 // across the HandleMark boundary.
282 282
283 // The only special case for HandleMark is when a Thread is created, the first 283 // The base class of HandleMark should have been StackObj but we also heap allocate
284 // HandleMark of the Thread is allocated in heap. 284 // a HandleMark when a thread is created.
285 285
286 class HandleMark : public StackObj { 286 class HandleMark {
287 private: 287 private:
288 Thread *_thread; // thread that owns this mark 288 Thread *_thread; // thread that owns this mark
289 HandleArea *_area; // saved handle area 289 HandleArea *_area; // saved handle area
290 Chunk *_chunk; // saved arena chunk 290 Chunk *_chunk; // saved arena chunk
291 char *_hwm, *_max; // saved arena info 291 char *_hwm, *_max; // saved arena info
292 size_t _size_in_bytes; // size of handle area 292 size_t _size_in_bytes; // size of handle area
293 // Link to previous active HandleMark in thread 293 // Link to previous active HandleMark in thread
294 HandleMark* _previous_handle_mark; 294 HandleMark* _previous_handle_mark;
295 295
296 void initialize(Thread* thread); // common code for constructors
296 void set_previous_handle_mark(HandleMark* mark) { _previous_handle_mark = mark; } 297 void set_previous_handle_mark(HandleMark* mark) { _previous_handle_mark = mark; }
297 HandleMark* previous_handle_mark() const { return _previous_handle_mark; } 298 HandleMark* previous_handle_mark() const { return _previous_handle_mark; }
298 299
299 size_t size_in_bytes() const { return _size_in_bytes; } 300 size_t size_in_bytes() const { return _size_in_bytes; }
300 public: 301 public:
301 HandleMark(); // see handles_inline.hpp 302 HandleMark(); // see handles_inline.hpp
302 HandleMark(Thread* thread) { initialize(thread); } 303 HandleMark(Thread* thread) { initialize(thread); }
303 ~HandleMark(); 304 ~HandleMark();
304 305
305 void initialize(Thread* thread); // common code for constructors
306 // Functions used by HandleMarkCleaner 306 // Functions used by HandleMarkCleaner
307 // called in the constructor of HandleMarkCleaner 307 // called in the constructor of HandleMarkCleaner
308 void push(); 308 void push();
309 // called in the destructor of HandleMarkCleaner 309 // called in the destructor of HandleMarkCleaner
310 void pop_and_restore(); 310 void pop_and_restore();