1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/ci/ciArray.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,79 @@ 1.4 +/* 1.5 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_CI_CIARRAY_HPP 1.29 +#define SHARE_VM_CI_CIARRAY_HPP 1.30 + 1.31 +#include "ci/ciArrayKlass.hpp" 1.32 +#include "ci/ciConstant.hpp" 1.33 +#include "ci/ciObject.hpp" 1.34 +#include "oops/arrayOop.hpp" 1.35 +#include "oops/objArrayOop.hpp" 1.36 +#include "oops/typeArrayOop.hpp" 1.37 + 1.38 +// ciArray 1.39 +// 1.40 +// This class represents an arrayOop in the HotSpot virtual 1.41 +// machine. 1.42 +class ciArray : public ciObject { 1.43 +private: 1.44 + int _length; 1.45 + 1.46 +protected: 1.47 + ciArray( arrayHandle h_a) : ciObject(h_a), _length(h_a()->length()) {} 1.48 + ciArray( objArrayHandle h_a) : ciObject(h_a), _length(h_a()->length()) {} 1.49 + ciArray(typeArrayHandle h_a) : ciObject(h_a), _length(h_a()->length()) {} 1.50 + 1.51 + ciArray(ciKlass* klass, int len) : ciObject(klass), _length(len) {} 1.52 + 1.53 + arrayOop get_arrayOop() const { return (arrayOop)get_oop(); } 1.54 + 1.55 + const char* type_string() { return "ciArray"; } 1.56 + 1.57 + void print_impl(outputStream* st); 1.58 + 1.59 + ciConstant element_value_impl(BasicType elembt, arrayOop ary, int index); 1.60 + 1.61 +public: 1.62 + int length() { return _length; } 1.63 + 1.64 + // Convenience routines. 1.65 + ciArrayKlass* array_type() { return klass()->as_array_klass(); } 1.66 + ciType* element_type() { return array_type()->element_type(); } 1.67 + BasicType element_basic_type() { return element_type()->basic_type(); } 1.68 + 1.69 + // Current value of an element. 1.70 + // Returns T_ILLEGAL if there is no element at the given index. 1.71 + ciConstant element_value(int index); 1.72 + 1.73 + // Current value of an element at the specified offset. 1.74 + // Returns T_ILLEGAL if there is no element at the given offset. 1.75 + ciConstant element_value_by_offset(intptr_t element_offset); 1.76 + 1.77 + // What kind of ciObject is this? 1.78 + bool is_array() { return true; } 1.79 + bool is_java_object() { return true; } 1.80 +}; 1.81 + 1.82 +#endif // SHARE_VM_CI_CIARRAY_HPP