twisti@1572: /* trims@1907: * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. twisti@1572: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. twisti@1572: * twisti@1572: * This code is free software; you can redistribute it and/or modify it twisti@1572: * under the terms of the GNU General Public License version 2 only, as twisti@1572: * published by the Free Software Foundation. twisti@1572: * twisti@1572: * This code is distributed in the hope that it will be useful, but WITHOUT twisti@1572: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or twisti@1572: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License twisti@1572: * version 2 for more details (a copy is included in the LICENSE file that twisti@1572: * accompanied this code). twisti@1572: * twisti@1572: * You should have received a copy of the GNU General Public License version twisti@1572: * 2 along with this work; if not, write to the Free Software Foundation, twisti@1572: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. twisti@1572: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. twisti@1572: * twisti@1572: */ twisti@1572: stefank@2314: #ifndef SHARE_VM_CI_CICPCACHE_HPP stefank@2314: #define SHARE_VM_CI_CICPCACHE_HPP stefank@2314: stefank@2314: #include "ci/ciClassList.hpp" stefank@2314: #include "ci/ciObject.hpp" stefank@2314: #include "oops/cpCacheOop.hpp" stefank@2314: twisti@1572: // ciCPCache twisti@1572: // twisti@1572: // This class represents a constant pool cache. twisti@1572: // twisti@1572: // Note: This class is called ciCPCache as ciConstantPoolCache is used twisti@1572: // for something different. twisti@1572: class ciCPCache : public ciObject { jrose@1957: private: jrose@1957: constantPoolCacheOop get_cpCacheOop() { // must be called inside a VM_ENTRY_MARK jrose@1957: return (constantPoolCacheOop) get_oop(); jrose@1957: } jrose@1957: jrose@1957: ConstantPoolCacheEntry* entry_at(int i) { jrose@1957: int raw_index = i; jrose@1957: if (constantPoolCacheOopDesc::is_secondary_index(i)) jrose@1957: raw_index = constantPoolCacheOopDesc::decode_secondary_index(i); jrose@1957: return get_cpCacheOop()->entry_at(raw_index); jrose@1957: } jrose@1957: twisti@1572: public: twisti@1572: ciCPCache(constantPoolCacheHandle cpcache) : ciObject(cpcache) {} twisti@1572: twisti@1572: // What kind of ciObject is this? twisti@1572: bool is_cpcache() const { return true; } twisti@1572: twisti@1572: // Get the offset in bytes from the oop to the f1 field of the twisti@1572: // requested entry. twisti@1572: size_t get_f1_offset(int index); twisti@1572: twisti@1730: bool is_f1_null_at(int index); twisti@1730: jrose@1957: int get_pool_index(int index); jrose@1957: twisti@1572: void print(); twisti@1572: }; stefank@2314: stefank@2314: #endif // SHARE_VM_CI_CICPCACHE_HPP