1 /* 2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_RUNTIME_VFRAME_HP_HPP 26 #define SHARE_RUNTIME_VFRAME_HP_HPP 27 28 #include "runtime/vframe.hpp" 29 30 class compiledVFrame: public javaVFrame { 31 32 friend class EscapeBarrier; 33 34 public: 35 // JVM state 36 Method* method() const; 37 int bci() const; 38 bool should_reexecute() const; 39 StackValueCollection* locals() const; 40 StackValueCollection* expressions() const; 41 GrowableArray<MonitorInfo*>* monitors() const; vframe_id() const42 int vframe_id() const { return _vframe_id; } 43 bool has_ea_local_in_scope() const; 44 bool arg_escape() const; // at call with arg escape in parameter list 45 46 void set_locals(StackValueCollection* values) const; 47 48 // Virtuals defined in vframe is_compiled_frame() const49 bool is_compiled_frame() const { return true; } 50 vframe* sender() const; 51 bool is_top() const; 52 53 // Casting cast(vframe * vf)54 static compiledVFrame* cast(vframe* vf) { 55 assert(vf == NULL || vf->is_compiled_frame(), "must be compiled frame"); 56 return (compiledVFrame*) vf; 57 } 58 59 void update_deferred_value(BasicType type, int index, jvalue value); 60 61 // After object deoptimization, that is object reallocation and relocking, we 62 // create deferred updates for all objects in scope. No new update will be 63 // created if a deferred update already exists. 64 void create_deferred_updates_after_object_deoptimization(); 65 66 public: 67 // Constructors 68 compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm); 69 70 // Update a local in a compiled frame. Update happens when deopt occurs 71 void update_local(BasicType type, int index, jvalue value); 72 73 // Update an expression stack value in a compiled frame. Update happens when deopt occurs 74 void update_stack(BasicType type, int index, jvalue value); 75 76 // Update a lock value in a compiled frame. Update happens when deopt occurs 77 void update_monitor(int index, MonitorInfo* value); 78 79 // Returns the active nmethod 80 CompiledMethod* code() const; 81 82 // Returns the scopeDesc scope() const83 ScopeDesc* scope() const { return _scope; } 84 85 // Return the compiledVFrame for the desired scope 86 compiledVFrame* at_scope(int decode_offset, int vframe_id); 87 88 // Returns SynchronizationEntryBCI or bci() (used for synchronization) 89 int raw_bci() const; 90 91 protected: 92 ScopeDesc* _scope; 93 int _vframe_id; 94 95 //StackValue resolve(ScopeValue* sv) const; 96 BasicLock* resolve_monitor_lock(Location location) const; 97 StackValue *create_stack_value(ScopeValue *sv) const; 98 99 private: 100 compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope, int vframe_id); 101 102 #ifndef PRODUCT 103 public: 104 void verify() const; 105 #endif 106 }; 107 108 #endif // SHARE_RUNTIME_VFRAME_HP_HPP 109