< prev index next >

src/hotspot/share/prims/jvmtiImpl.hpp

Print this page

  1 /*
  2  * Copyright (c) 1999, 2025, 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  *

163 // only safely be done by the VM thread
164 //
165 // I'm told that in 1.5 oop maps are now protected by a lock and
166 // we could get rid of the VM op
167 // However if the VM op is removed then the target thread must
168 // be suspended AND a lock will be needed to prevent concurrent
169 // setting of locals to the same java thread. This lock is needed
170 // to prevent compiledVFrames from trying to add deferred updates
171 // to the thread simultaneously.
172 //
173 class VM_BaseGetOrSetLocal : public VM_Operation {
174  protected:
175   JavaThread* _calling_thread;
176   jint        _depth;
177   jint        _index;
178   BasicType   _type;
179   jvalue      _value;
180   javaVFrame* _jvf;
181   bool        _set;
182   bool        _self;

183 
184   static const jvalue _DEFAULT_VALUE;
185 
186   // It is possible to get the receiver out of a non-static native wrapper
187   // frame.  Use VM_GetReceiver to do this.
188   virtual bool getting_receiver() const { return false; }
189 
190   jvmtiError  _result;
191 
192   virtual javaVFrame* get_java_vframe() = 0;
193   bool check_slot_type_lvt(javaVFrame* vf);
194   bool check_slot_type_no_lvt(javaVFrame* vf);

195 
196 public:
197   VM_BaseGetOrSetLocal(JavaThread* calling_thread, jint depth, jint index,
198                        BasicType type, jvalue value, bool set, bool self);
199 
200   jvalue value()         { return _value; }
201   jvmtiError result()    { return _result; }
202 
203   void doit();

204   bool allow_nested_vm_operations() const;
205   virtual const char* name() const = 0;
206 
207   // Check that the klass is assignable to a type with the given signature.
208   static bool is_assignable(const char* ty_sign, Klass* klass, Thread* thread);
209 };
210 
211 
212 class VM_GetOrSetLocal : public VM_BaseGetOrSetLocal {
213  protected:
214   JavaThread* _thread;
215   EscapeBarrier _eb;
216 
217   vframe* get_vframe();
218   javaVFrame* get_java_vframe();
219 
220 public:
221   // Constructor for non-object getter
222   VM_GetOrSetLocal(JavaThread* thread, jint depth, jint index, BasicType type, bool self);
223 

  1 /*
  2  * Copyright (c) 1999, 2026, 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  *

163 // only safely be done by the VM thread
164 //
165 // I'm told that in 1.5 oop maps are now protected by a lock and
166 // we could get rid of the VM op
167 // However if the VM op is removed then the target thread must
168 // be suspended AND a lock will be needed to prevent concurrent
169 // setting of locals to the same java thread. This lock is needed
170 // to prevent compiledVFrames from trying to add deferred updates
171 // to the thread simultaneously.
172 //
173 class VM_BaseGetOrSetLocal : public VM_Operation {
174  protected:
175   JavaThread* _calling_thread;
176   jint        _depth;
177   jint        _index;
178   BasicType   _type;
179   jvalue      _value;
180   javaVFrame* _jvf;
181   bool        _set;
182   bool        _self;
183   bool        _need_clone; // THIS object is in a value object constructor
184 
185   static const jvalue _DEFAULT_VALUE;
186 
187   // It is possible to get the receiver out of a non-static native wrapper
188   // frame.  Use VM_GetReceiver to do this.
189   virtual bool getting_receiver() const { return false; }
190 
191   jvmtiError  _result;
192 
193   virtual javaVFrame* get_java_vframe() = 0;
194   bool check_slot_type_lvt(javaVFrame* vf);
195   bool check_slot_type_no_lvt(javaVFrame* vf);
196   void check_and_clone_this_value_object();
197 
198 public:
199   VM_BaseGetOrSetLocal(JavaThread* calling_thread, jint depth, jint index,
200                        BasicType type, jvalue value, bool set, bool self);
201 
202   jvalue value()         { return _value; }
203   jvmtiError result()    { return _result; }
204 
205   void doit();
206   void doit_epilogue();
207   bool allow_nested_vm_operations() const;
208   virtual const char* name() const = 0;
209 
210   // Check that the klass is assignable to a type with the given signature.
211   static bool is_assignable(const char* ty_sign, Klass* klass, Thread* thread);
212 };
213 
214 
215 class VM_GetOrSetLocal : public VM_BaseGetOrSetLocal {
216  protected:
217   JavaThread* _thread;
218   EscapeBarrier _eb;
219 
220   vframe* get_vframe();
221   javaVFrame* get_java_vframe();
222 
223 public:
224   // Constructor for non-object getter
225   VM_GetOrSetLocal(JavaThread* thread, jint depth, jint index, BasicType type, bool self);
226 
< prev index next >