1 /* 2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any questions. 22 * 23 */ 24 25 class compiledVFrame: public javaVFrame { 26 public: 27 // JVM state 28 methodOop method() const; 29 int bci() const; 30 StackValueCollection* locals() const; 31 StackValueCollection* expressions() const; 32 GrowableArray<MonitorInfo*>* monitors() const; 33 34 void set_locals(StackValueCollection* values) const; 35 36 // Virtuals defined in vframe 37 bool is_compiled_frame() const { return true; } 38 vframe* sender() const; 39 bool is_top() const; 40 41 // Casting 42 static compiledVFrame* cast(vframe* vf) { 43 assert(vf == NULL || vf->is_compiled_frame(), "must be compiled frame"); 44 return (compiledVFrame*) vf; 45 } 46 47 public: 48 // Constructors 49 compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm); 50 51 // Update a local in a compiled frame. Update happens when deopt occurs 52 void update_local(BasicType type, int index, jvalue value); 53 54 // Returns the active nmethod 55 nmethod* code() const; 56 57 // Returns the scopeDesc 58 ScopeDesc* scope() const { return _scope; } 59 60 // Returns SynchronizationEntryBCI or bci() (used for synchronization) 61 int raw_bci() const; 62 63 protected: 64 ScopeDesc* _scope; 65 66 67 //StackValue resolve(ScopeValue* sv) const; 68 BasicLock* resolve_monitor_lock(Location location) const; 69 StackValue *create_stack_value(ScopeValue *sv) const; 70 71 private: 72 compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope); 73 74 #ifndef PRODUCT 75 public: 76 void verify() const; 77 #endif 78 }; 79 80 // In order to implement set_locals for compiled vframes we must 81 // store updated locals in a data structure that contains enough 82 // information to recognize equality with a vframe and to store 83 // any updated locals. 84 85 class jvmtiDeferredLocalVariable; 86 class jvmtiDeferredLocalVariableSet : public CHeapObj { 87 private: 88 89 methodOop _method; // must be GC'd 90 int _bci; 91 intptr_t* _id; 92 GrowableArray<jvmtiDeferredLocalVariable*>* _locals; 93 94 public: 95 // JVM state 96 methodOop method() const { return _method; } 97 int bci() const { return _bci; } 98 intptr_t* id() const { return _id; } 99 GrowableArray<jvmtiDeferredLocalVariable*>* locals() const { return _locals; } 100 void set_local_at(int idx, BasicType typ, jvalue val); 101 102 // Does the vframe match this jvmtiDeferredLocalVariableSet 103 bool matches(vframe* vf); 104 // GC 105 void oops_do(OopClosure* f); 106 107 // constructor 108 jvmtiDeferredLocalVariableSet(methodOop method, int bci, intptr_t* id); 109 110 // destructor 111 ~jvmtiDeferredLocalVariableSet(); 112 113 114 }; 115 116 class jvmtiDeferredLocalVariable : public CHeapObj { 117 public: 118 119 jvmtiDeferredLocalVariable(int index, BasicType type, jvalue value); 120 121 BasicType type(void) { return _type; } 122 int index(void) { return _index; } 123 jvalue value(void) { return _value; } 124 // Only mutator is for value as only it can change 125 void set_value(jvalue value) { _value = value; } 126 // For gc 127 oop* oop_addr(void) { return (oop*) &_value.l; } 128 129 private: 130 131 BasicType _type; 132 jvalue _value; 133 int _index; 134 135 };