Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/ci/ciMethodBlocks.hpp
32285 views
/*1* Copyright (c) 2006, 2010, 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_VM_CI_CIMETHODBLOCKS_HPP25#define SHARE_VM_CI_CIMETHODBLOCKS_HPP2627#include "ci/ciMethod.hpp"28#include "memory/resourceArea.hpp"29#include "utilities/growableArray.hpp"303132class ciBlock;3334typedef short ciBlockIndex;3536class ciMethodBlocks : public ResourceObj {37private:38ciMethod *_method;39Arena *_arena;40GrowableArray<ciBlock *> *_blocks;41ciBlock **_bci_to_block;42int _num_blocks;43int _code_size;4445void do_analysis();46public:47ciMethodBlocks(Arena *arena, ciMethod *meth);4849ciBlock *block_containing(int bci);50ciBlock *block(int index) { return _blocks->at(index); }51ciBlock *make_block_at(int bci);52ciBlock *split_block_at(int bci);53bool is_block_start(int bci);54int num_blocks() { return _num_blocks;}55void clear_processed();5657ciBlock *make_dummy_block(); // a block not associated with a bci5859#ifndef PRODUCT60void dump();61#endif62};6364class ciBlock : public ResourceObj {65private:66int _idx;67int _start_bci;68int _limit_bci;69int _control_bci;70uint _flags;71int _ex_start_bci;72int _ex_limit_bci;73#ifndef PRODUCT74ciMethod *_method;75#endif76enum {77Processed = (1 << 0),78Handler = (1 << 1),79MayThrow = (1 << 2),80DoesJsr = (1 << 3),81DoesRet = (1 << 4),82RetTarget = (1 << 5),83HasHandler = (1 << 6)84};858687public:88enum {89fall_through_bci = -190};9192ciBlock(ciMethod *method, int index, int start_bci);93int start_bci() const { return _start_bci; }94int limit_bci() const { return _limit_bci; }95int control_bci() const { return _control_bci; }96int index() const { return _idx; }97void set_start_bci(int bci) { _start_bci = bci; }98void set_limit_bci(int bci) { _limit_bci = bci; }99void set_control_bci(int bci) { _control_bci = bci;}100void set_exception_range(int start_bci, int limit_bci);101int ex_start_bci() const { return _ex_start_bci; }102int ex_limit_bci() const { return _ex_limit_bci; }103bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); }104105// flag handling106bool processed() const { return (_flags & Processed) != 0; }107bool is_handler() const { return (_flags & Handler) != 0; }108bool may_throw() const { return (_flags & MayThrow) != 0; }109bool does_jsr() const { return (_flags & DoesJsr) != 0; }110bool does_ret() const { return (_flags & DoesRet) != 0; }111bool has_handler() const { return (_flags & HasHandler) != 0; }112bool is_ret_target() const { return (_flags & RetTarget) != 0; }113void set_processed() { _flags |= Processed; }114void clear_processed() { _flags &= ~Processed; }115void set_handler() { _flags |= Handler; }116void set_may_throw() { _flags |= MayThrow; }117void set_does_jsr() { _flags |= DoesJsr; }118void clear_does_jsr() { _flags &= ~DoesJsr; }119void set_does_ret() { _flags |= DoesRet; }120void clear_does_ret() { _flags &= ~DoesRet; }121void set_is_ret_target() { _flags |= RetTarget; }122void set_has_handler() { _flags |= HasHandler; }123void clear_exception_handler() { _flags &= ~Handler; _ex_start_bci = -1; _ex_limit_bci = -1; }124#ifndef PRODUCT125ciMethod *method() const { return _method; }126void dump();127void print_on(outputStream* st) const PRODUCT_RETURN;128#endif129};130131#endif // SHARE_VM_CI_CIMETHODBLOCKS_HPP132133134