duke@435: /* coleenp@4037: * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * 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. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef SHARE_VM_RUNTIME_VFRAME_HP_HPP stefank@2314: #define SHARE_VM_RUNTIME_VFRAME_HP_HPP stefank@2314: stefank@2314: #include "runtime/vframe.hpp" stefank@2314: duke@435: class compiledVFrame: public javaVFrame { duke@435: public: duke@435: // JVM state coleenp@4037: Method* method() const; cfang@1335: int bci() const; cfang@1335: bool should_reexecute() const; cfang@1335: StackValueCollection* locals() const; cfang@1335: StackValueCollection* expressions() const; cfang@1335: GrowableArray* monitors() const; duke@435: duke@435: void set_locals(StackValueCollection* values) const; duke@435: duke@435: // Virtuals defined in vframe duke@435: bool is_compiled_frame() const { return true; } duke@435: vframe* sender() const; duke@435: bool is_top() const; duke@435: duke@435: // Casting duke@435: static compiledVFrame* cast(vframe* vf) { duke@435: assert(vf == NULL || vf->is_compiled_frame(), "must be compiled frame"); duke@435: return (compiledVFrame*) vf; duke@435: } duke@435: duke@435: public: duke@435: // Constructors duke@435: compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm); duke@435: duke@435: // Update a local in a compiled frame. Update happens when deopt occurs duke@435: void update_local(BasicType type, int index, jvalue value); duke@435: duke@435: // Returns the active nmethod duke@435: nmethod* code() const; duke@435: duke@435: // Returns the scopeDesc duke@435: ScopeDesc* scope() const { return _scope; } duke@435: duke@435: // Returns SynchronizationEntryBCI or bci() (used for synchronization) duke@435: int raw_bci() const; duke@435: duke@435: protected: duke@435: ScopeDesc* _scope; duke@435: duke@435: duke@435: //StackValue resolve(ScopeValue* sv) const; duke@435: BasicLock* resolve_monitor_lock(Location location) const; duke@435: StackValue *create_stack_value(ScopeValue *sv) const; duke@435: duke@435: private: duke@435: compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope); duke@435: duke@435: #ifndef PRODUCT duke@435: public: duke@435: void verify() const; duke@435: #endif duke@435: }; duke@435: duke@435: // In order to implement set_locals for compiled vframes we must duke@435: // store updated locals in a data structure that contains enough duke@435: // information to recognize equality with a vframe and to store duke@435: // any updated locals. duke@435: duke@435: class jvmtiDeferredLocalVariable; zgu@3900: class jvmtiDeferredLocalVariableSet : public CHeapObj { duke@435: private: duke@435: coleenp@4037: Method* _method; duke@435: int _bci; duke@435: intptr_t* _id; duke@435: GrowableArray* _locals; duke@435: duke@435: public: duke@435: // JVM state coleenp@4037: Method* method() const { return _method; } duke@435: int bci() const { return _bci; } duke@435: intptr_t* id() const { return _id; } duke@435: GrowableArray* locals() const { return _locals; } duke@435: void set_local_at(int idx, BasicType typ, jvalue val); duke@435: duke@435: // Does the vframe match this jvmtiDeferredLocalVariableSet duke@435: bool matches(vframe* vf); duke@435: // GC duke@435: void oops_do(OopClosure* f); duke@435: duke@435: // constructor coleenp@4037: jvmtiDeferredLocalVariableSet(Method* method, int bci, intptr_t* id); duke@435: duke@435: // destructor duke@435: ~jvmtiDeferredLocalVariableSet(); duke@435: duke@435: duke@435: }; duke@435: zgu@3900: class jvmtiDeferredLocalVariable : public CHeapObj { duke@435: public: duke@435: duke@435: jvmtiDeferredLocalVariable(int index, BasicType type, jvalue value); duke@435: duke@435: BasicType type(void) { return _type; } duke@435: int index(void) { return _index; } duke@435: jvalue value(void) { return _value; } duke@435: // Only mutator is for value as only it can change duke@435: void set_value(jvalue value) { _value = value; } duke@435: // For gc duke@435: oop* oop_addr(void) { return (oop*) &_value.l; } duke@435: duke@435: private: duke@435: duke@435: BasicType _type; duke@435: jvalue _value; duke@435: int _index; duke@435: duke@435: }; stefank@2314: stefank@2314: #endif // SHARE_VM_RUNTIME_VFRAME_HP_HPP