@@ -217,6 +217,7 @@ class JVMState : public ResourceObj {
217217 int _bci; // Byte Code Index of this JVM point
218218 ReexecuteState _reexecute; // Whether this bytecode need to be re-executed
219219 ciMethod* _method; // Method Pointer
220+ ciInstance* _receiver_info; // Constant receiver instance for compiled lambda forms
220221 SafePointNode* _map; // Map node associated with this scope
221222public:
222223 friend class Compile ;
@@ -259,6 +260,7 @@ class JVMState : public ResourceObj {
259260 bool is_reexecute_undefined () const { return _reexecute==Reexecute_Undefined; }
260261 bool has_method () const { return _method != nullptr ; }
261262 ciMethod* method () const { assert (has_method (), " " ); return _method; }
263+ ciInstance* receiver_info () const { assert (has_method (), " " ); return _receiver_info; }
262264 JVMState* caller () const { return _caller; }
263265 SafePointNode* map () const { return _map; }
264266 uint depth () const { return _depth; }
@@ -304,13 +306,15 @@ class JVMState : public ResourceObj {
304306 // _reexecute is initialized to "undefined" for a new bci
305307 void set_bci (int bci) {if (_bci != bci)_reexecute=Reexecute_Undefined; _bci = bci; }
306308 void set_should_reexecute (bool reexec) {_reexecute = reexec ? Reexecute_True : Reexecute_False;}
309+ void set_receiver_info (ciInstance* recv) { assert (has_method () || recv == nullptr , " " ); _receiver_info = recv; }
307310
308311 // Miscellaneous utility functions
309312 JVMState* clone_deep (Compile* C) const ; // recursively clones caller chain
310313 JVMState* clone_shallow (Compile* C) const ; // retains uncloned caller
311314 void set_map_deep (SafePointNode *map);// reset map for all callers
312315 void adapt_position (int delta); // Adapt offsets in in-array after adding an edge.
313316 int interpreter_frame_size () const ;
317+ ciInstance* compute_receiver_info (ciMethod* callee) const ;
314318
315319#ifndef PRODUCT
316320 void print_method_with_lineno (outputStream* st, bool show_name) const ;
@@ -374,7 +378,7 @@ class SafePointNode : public MultiNode {
374378 }
375379
376380 private:
377- void verify_input (JVMState* jvms, uint idx) const {
381+ void verify_input (const JVMState* jvms, uint idx) const {
378382 assert (verify_jvms (jvms), " jvms must match" );
379383 Node* n = in (idx);
380384 assert ((!n->bottom_type ()->isa_long () && !n->bottom_type ()->isa_double ()) ||
@@ -383,34 +387,44 @@ class SafePointNode : public MultiNode {
383387
384388 public:
385389 // Functionality from old debug nodes which has changed
386- Node *local (JVMState* jvms, uint idx) const {
387- verify_input (jvms, jvms->locoff () + idx);
388- return in (jvms->locoff () + idx);
390+ Node* local (const JVMState* jvms, uint idx) const {
391+ uint loc_idx = jvms->locoff () + idx;
392+ assert (jvms->is_loc (loc_idx), " not a local slot" );
393+ verify_input (jvms, loc_idx);
394+ return in (loc_idx);
389395 }
390- Node *stack (JVMState* jvms, uint idx) const {
391- verify_input (jvms, jvms->stkoff () + idx);
392- return in (jvms->stkoff () + idx);
396+ Node* stack (const JVMState* jvms, uint idx) const {
397+ uint stk_idx = jvms->stkoff () + idx;
398+ assert (jvms->is_stk (stk_idx), " not a stack slot" );
399+ verify_input (jvms, stk_idx);
400+ return in (stk_idx);
393401 }
394- Node *argument (JVMState* jvms, uint idx) const {
395- verify_input (jvms, jvms->argoff () + idx);
402+ Node* argument (const JVMState* jvms, uint idx) const {
403+ uint arg_idx = jvms->argoff () + idx;
404+ assert (jvms->is_stk (arg_idx), " not an argument slot" );
405+ verify_input (jvms, arg_idx);
396406 return in (jvms->argoff () + idx);
397407 }
398- Node * monitor_box (JVMState* jvms, uint idx) const {
408+ Node* monitor_box (const JVMState* jvms, uint idx) const {
399409 assert (verify_jvms (jvms), " jvms must match" );
400- return in (jvms->monitor_box_offset (idx));
410+ uint mon_box_idx = jvms->monitor_box_offset (idx);
411+ assert (jvms->is_monitor_box (mon_box_idx), " not a monitor box offset" );
412+ return in (mon_box_idx);
401413 }
402- Node * monitor_obj (JVMState* jvms, uint idx) const {
414+ Node* monitor_obj (const JVMState* jvms, uint idx) const {
403415 assert (verify_jvms (jvms), " jvms must match" );
404- return in (jvms->monitor_obj_offset (idx));
416+ uint mon_obj_idx = jvms->monitor_obj_offset (idx);
417+ assert (jvms->is_mon (mon_obj_idx) && !jvms->is_monitor_box (mon_obj_idx), " not a monitor obj offset" );
418+ return in (mon_obj_idx);
405419 }
406420
407- void set_local (JVMState* jvms, uint idx, Node *c);
421+ void set_local (const JVMState* jvms, uint idx, Node *c);
408422
409- void set_stack (JVMState* jvms, uint idx, Node *c) {
423+ void set_stack (const JVMState* jvms, uint idx, Node *c) {
410424 assert (verify_jvms (jvms), " jvms must match" );
411425 set_req (jvms->stkoff () + idx, c);
412426 }
413- void set_argument (JVMState* jvms, uint idx, Node *c) {
427+ void set_argument (const JVMState* jvms, uint idx, Node *c) {
414428 assert (verify_jvms (jvms), " jvms must match" );
415429 set_req (jvms->argoff () + idx, c);
416430 }
0 commit comments