Path: blob/master/src/hotspot/share/runtime/monitorChunk.hpp
40951 views
/*1* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_RUNTIME_MONITORCHUNK_HPP25#define SHARE_RUNTIME_MONITORCHUNK_HPP2627#include "runtime/synchronizer.hpp"2829// Data structure for holding monitors for one activation during30// deoptimization.3132class MonitorChunk: public CHeapObj<mtSynchronizer> {33private:34int _number_of_monitors;35BasicObjectLock* _monitors;36BasicObjectLock* monitors() const { return _monitors; }37MonitorChunk* _next;38public:39// Constructor40MonitorChunk(int number_on_monitors);41~MonitorChunk();4243// link operations44MonitorChunk* next() const { return _next; }45void set_next(MonitorChunk* next) { _next = next; }4647// Tells whether the monitor chunk is linked into the JavaThread48bool is_linked() const { return next() != NULL; }4950// Returns the number of monitors51int number_of_monitors() const { return _number_of_monitors; }5253// Returns the index'th monitor54BasicObjectLock* at(int index) { assert(index >= 0 && index < number_of_monitors(), "out of bounds check"); return &monitors()[index]; }555657// Memory management58void oops_do(OopClosure* f);5960// Tells whether the addr point into the monitors.61bool contains(void* addr) const { return (addr >= (void*) monitors()) && (addr < (void*) (monitors() + number_of_monitors())); }62};6364#endif // SHARE_RUNTIME_MONITORCHUNK_HPP656667