Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/c1/c1_ValueSet.hpp
32285 views
/*1* Copyright (c) 2001, 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_C1_C1_VALUESET_HPP25#define SHARE_VM_C1_C1_VALUESET_HPP2627#include "c1/c1_Instruction.hpp"28#include "memory/allocation.hpp"29#include "utilities/bitMap.inline.hpp"3031// A ValueSet is a simple abstraction on top of a BitMap representing32// a set of Instructions. Currently it assumes that the number of33// instructions is fixed during its lifetime; should make it34// automatically resizable.3536class ValueSet: public CompilationResourceObj {37private:38BitMap _map;3940public:41ValueSet();4243ValueSet* copy();44bool contains(Value x);45void put (Value x);46void remove (Value x);47bool set_intersect(ValueSet* other);48void set_union(ValueSet* other);49void clear ();50void set_from(ValueSet* other);51bool equals (ValueSet* other);52};5354inline ValueSet::ValueSet() : _map(Instruction::number_of_instructions()) {55_map.clear();56}575859inline ValueSet* ValueSet::copy() {60ValueSet* res = new ValueSet();61res->_map.set_from(_map);62return res;63}646566inline bool ValueSet::contains(Value x) {67return _map.at(x->id());68}697071inline void ValueSet::put(Value x) {72_map.set_bit(x->id());73}747576inline void ValueSet::remove(Value x) {77_map.clear_bit(x->id());78}798081inline bool ValueSet::set_intersect(ValueSet* other) {82return _map.set_intersection_with_result(other->_map);83}848586inline void ValueSet::set_union(ValueSet* other) {87_map.set_union(other->_map);88}899091inline void ValueSet::clear() {92_map.clear();93}9495inline void ValueSet::set_from(ValueSet* other) {96_map.set_from(other->_map);97}9899inline bool ValueSet::equals(ValueSet* other) {100return _map.is_same(other->_map);101}102103#endif // SHARE_VM_C1_C1_VALUESET_HPP104105106