Path: blob/master/src/hotspot/share/ci/ciArray.hpp
40930 views
/*1* Copyright (c) 1999, 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_CI_CIARRAY_HPP25#define SHARE_CI_CIARRAY_HPP2627#include "ci/ciArrayKlass.hpp"28#include "ci/ciConstant.hpp"29#include "ci/ciObject.hpp"30#include "oops/arrayOop.hpp"31#include "oops/objArrayOop.hpp"32#include "oops/typeArrayOop.hpp"3334// ciArray35//36// This class represents an arrayOop in the HotSpot virtual37// machine.38class ciArray : public ciObject {39private:40int _length;4142protected:43ciArray( objArrayHandle h_a) : ciObject(h_a), _length(h_a()->length()) {}44ciArray(typeArrayHandle h_a) : ciObject(h_a), _length(h_a()->length()) {}4546arrayOop get_arrayOop() const { return (arrayOop)get_oop(); }4748const char* type_string() { return "ciArray"; }4950void print_impl(outputStream* st);5152ciConstant element_value_impl(BasicType elembt, arrayOop ary, int index);5354public:55int length() { return _length; }5657// Convenience routines.58ciArrayKlass* array_type() { return klass()->as_array_klass(); }59ciType* element_type() { return array_type()->element_type(); }60BasicType element_basic_type() { return element_type()->basic_type(); }6162// Current value of an element.63// Returns T_ILLEGAL if there is no element at the given index.64ciConstant element_value(int index);6566// Current value of an element at the specified offset.67// Returns T_ILLEGAL if there is no element at the given offset.68ciConstant element_value_by_offset(intptr_t element_offset);6970// What kind of ciObject is this?71bool is_array() { return true; }72};7374#endif // SHARE_CI_CIARRAY_HPP757677