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