@@ -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 ;
@@ -373,7 +377,7 @@ class SafePointNode : public MultiNode {
373377 }
374378
375379 private:
376- void verify_input (JVMState* jvms, uint idx) const {
380+ void verify_input (const JVMState* jvms, uint idx) const {
377381 assert (verify_jvms (jvms), " jvms must match" );
378382 Node* n = in (idx);
379383 assert ((!n->bottom_type ()->isa_long () && !n->bottom_type ()->isa_double ()) ||
@@ -382,34 +386,44 @@ class SafePointNode : public MultiNode {
382386
383387 public:
384388 // Functionality from old debug nodes which has changed
385- Node *local (JVMState* jvms, uint idx) const {
386- verify_input (jvms, jvms->locoff () + idx);
387- return in (jvms->locoff () + idx);
389+ Node* local (const JVMState* jvms, uint idx) const {
390+ uint loc_idx = jvms->locoff () + idx;
391+ assert (jvms->is_loc (loc_idx), " not a local slot" );
392+ verify_input (jvms, loc_idx);
393+ return in (loc_idx);
388394 }
389- Node *stack (JVMState* jvms, uint idx) const {
390- verify_input (jvms, jvms->stkoff () + idx);
391- return in (jvms->stkoff () + idx);
395+ Node* stack (const JVMState* jvms, uint idx) const {
396+ uint stk_idx = jvms->stkoff () + idx;
397+ assert (jvms->is_stk (stk_idx), " not a stack slot" );
398+ verify_input (jvms, stk_idx);
399+ return in (stk_idx);
392400 }
393- Node *argument (JVMState* jvms, uint idx) const {
394- verify_input (jvms, jvms->argoff () + idx);
401+ Node* argument (const JVMState* jvms, uint idx) const {
402+ uint arg_idx = jvms->argoff () + idx;
403+ assert (jvms->is_stk (arg_idx), " not an argument slot" );
404+ verify_input (jvms, arg_idx);
395405 return in (jvms->argoff () + idx);
396406 }
397- Node * monitor_box (JVMState* jvms, uint idx) const {
407+ Node* monitor_box (const JVMState* jvms, uint idx) const {
398408 assert (verify_jvms (jvms), " jvms must match" );
399- return in (jvms->monitor_box_offset (idx));
409+ uint mon_box_idx = jvms->monitor_box_offset (idx);
410+ assert (jvms->is_monitor_box (mon_box_idx), " not a monitor box offset" );
411+ return in (mon_box_idx);
400412 }
401- Node * monitor_obj (JVMState* jvms, uint idx) const {
413+ Node* monitor_obj (const JVMState* jvms, uint idx) const {
402414 assert (verify_jvms (jvms), " jvms must match" );
403- return in (jvms->monitor_obj_offset (idx));
415+ uint mon_obj_idx = jvms->monitor_obj_offset (idx);
416+ assert (jvms->is_mon (mon_obj_idx) && !jvms->is_monitor_box (mon_obj_idx), " not a monitor obj offset" );
417+ return in (mon_obj_idx);
404418 }
405419
406- void set_local (JVMState* jvms, uint idx, Node *c);
420+ void set_local (const JVMState* jvms, uint idx, Node *c);
407421
408- void set_stack (JVMState* jvms, uint idx, Node *c) {
422+ void set_stack (const JVMState* jvms, uint idx, Node *c) {
409423 assert (verify_jvms (jvms), " jvms must match" );
410424 set_req (jvms->stkoff () + idx, c);
411425 }
412- void set_argument (JVMState* jvms, uint idx, Node *c) {
426+ void set_argument (const JVMState* jvms, uint idx, Node *c) {
413427 assert (verify_jvms (jvms), " jvms must match" );
414428 set_req (jvms->argoff () + idx, c);
415429 }
0 commit comments