74 private:
75 RetTableEntry *_first;
76 static int _init_nof_entries;
77
78 void add_jsr(int return_bci, int target_bci); // Adds entry to list
79 public:
80 RetTable() { _first = nullptr; }
81 void compute_ret_table(const methodHandle& method);
82 void update_ret_table(int bci, int delta);
83 RetTableEntry* find_jsrs_for_target(int targBci);
84 };
85
86 //
87 // CellTypeState
88 //
89 class CellTypeState {
90 private:
91 unsigned int _state;
92
93 // Masks for separating the BITS and INFO portions of a CellTypeState
94 enum { info_mask = right_n_bits(28),
95 bits_mask = (int)(~info_mask) };
96
97 // These constant are used for manipulating the BITS portion of a
98 // CellTypeState
99 enum { uninit_bit = (int)(nth_bit(31)),
100 ref_bit = nth_bit(30),
101 val_bit = nth_bit(29),
102 addr_bit = nth_bit(28),
103 live_bits_mask = (int)(bits_mask & ~uninit_bit) };
104
105 // These constants are used for manipulating the INFO portion of a
106 // CellTypeState
107 enum { top_info_bit = nth_bit(27),
108 not_bottom_info_bit = nth_bit(26),
109 info_data_mask = right_n_bits(26),
110 info_conflict = info_mask };
111
112 // Within the INFO data, these values are used to distinguish different
113 // kinds of references.
114 enum { ref_not_lock_bit = nth_bit(25), // 0 if this reference is locked as a monitor
115 ref_slot_bit = nth_bit(24), // 1 if this reference is a "slot" reference,
116 // 0 if it is a "line" reference.
117 ref_data_mask = right_n_bits(24) };
118
119
120 // These values are used to initialize commonly used CellTypeState
121 // constants.
122 enum { bottom_value = 0,
123 uninit_value = (int)(uninit_bit | info_conflict),
124 ref_value = ref_bit,
125 ref_conflict = ref_bit | info_conflict,
126 val_value = val_bit | info_conflict,
127 addr_value = addr_bit,
128 addr_conflict = addr_bit | info_conflict };
129
130 public:
131
132 // Since some C++ constructors generate poor code for declarations of the
133 // form...
134 //
135 // CellTypeState vector[length];
136 //
137 // ...we avoid making a constructor for this class. CellTypeState values
138 // should be constructed using one of the make_* methods:
380 void interp_all ();
381
382 // Interpretation methods (secondary)
383 void interp1 (BytecodeStream *itr);
384 void do_exception_edge (BytecodeStream *itr);
385 void check_type (CellTypeState expected, CellTypeState actual);
386 void ppstore (CellTypeState *in, int loc_no);
387 void ppload (CellTypeState *out, int loc_no);
388 void ppush1 (CellTypeState in);
389 void ppush (CellTypeState *in);
390 void ppop1 (CellTypeState out);
391 void ppop (CellTypeState *out);
392 void ppop_any (int poplen);
393 void pp (CellTypeState *in, CellTypeState *out);
394 void pp_new_ref (CellTypeState *in, int bci);
395 void ppdupswap (int poplen, const char *out);
396 void do_ldc (int bci);
397 void do_astore (int idx);
398 void do_jsr (int delta);
399 void do_field (int is_get, int is_static, int idx, int bci, Bytecodes::Code bc);
400 void do_method (int is_static, int is_interface, int idx, int bci, Bytecodes::Code bc);
401 void do_multianewarray (int dims, int bci);
402 void do_monitorenter (int bci);
403 void do_monitorexit (int bci);
404 void do_return_monitor_check ();
405 void do_checkcast ();
406 CellTypeState *signature_to_effect (const Symbol* sig, int bci, CellTypeState *out);
407 int copy_cts (CellTypeState *dst, CellTypeState *src);
408
409 // Error handling
410 void error_work (const char *format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
411 void report_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
412 void verify_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
413 bool got_error() { return _got_error; }
414
415 // Create result set
416 bool _report_result;
417 bool _report_result_for_send; // Unfortunately, stackmaps for sends are special, so we need some extra
418 BytecodeStream *_itr_send; // variables to handle them properly.
419
420 void report_result ();
|
74 private:
75 RetTableEntry *_first;
76 static int _init_nof_entries;
77
78 void add_jsr(int return_bci, int target_bci); // Adds entry to list
79 public:
80 RetTable() { _first = nullptr; }
81 void compute_ret_table(const methodHandle& method);
82 void update_ret_table(int bci, int delta);
83 RetTableEntry* find_jsrs_for_target(int targBci);
84 };
85
86 //
87 // CellTypeState
88 //
89 class CellTypeState {
90 private:
91 unsigned int _state;
92
93 // Masks for separating the BITS and INFO portions of a CellTypeState
94 enum { info_mask = right_n_bits(27),
95 bits_mask = (int)(~info_mask) };
96
97 // These constant are used for manipulating the BITS portion of a
98 // CellTypeState
99 enum { uninit_bit = (int)(nth_bit(31)),
100 ref_bit = nth_bit(30),
101 val_bit = nth_bit(29),
102 addr_bit = nth_bit(28),
103 live_bits_mask = (int)(bits_mask & ~uninit_bit) };
104
105 // These constants are used for manipulating the INFO portion of a
106 // CellTypeState
107 enum { top_info_bit = nth_bit(26),
108 not_bottom_info_bit = nth_bit(25),
109 info_data_mask = right_n_bits(25),
110 info_conflict = info_mask };
111
112 // Within the INFO data, these values are used to distinguish different
113 // kinds of references.
114 enum { ref_not_lock_bit = nth_bit(24), // 0 if this reference is locked as a monitor
115 ref_slot_bit = nth_bit(23), // 1 if this reference is a "slot" reference,
116 // 0 if it is a "line" reference.
117 ref_data_mask = right_n_bits(23) };
118
119 // Within the INFO data, these values are used to distinguish different
120 // kinds of value types.
121 enum { valuetype_slot_bit = nth_bit(24), // 1 if this reference is a "slot" value type,
122 // 0 if it is a "line" value type.
123 valuetype_data_mask = right_n_bits(24) };
124
125 // These values are used to initialize commonly used CellTypeState
126 // constants.
127 enum { bottom_value = 0,
128 uninit_value = (int)(uninit_bit | info_conflict),
129 ref_value = ref_bit,
130 ref_conflict = ref_bit | info_conflict,
131 val_value = val_bit | info_conflict,
132 addr_value = addr_bit,
133 addr_conflict = addr_bit | info_conflict };
134
135 public:
136
137 // Since some C++ constructors generate poor code for declarations of the
138 // form...
139 //
140 // CellTypeState vector[length];
141 //
142 // ...we avoid making a constructor for this class. CellTypeState values
143 // should be constructed using one of the make_* methods:
385 void interp_all ();
386
387 // Interpretation methods (secondary)
388 void interp1 (BytecodeStream *itr);
389 void do_exception_edge (BytecodeStream *itr);
390 void check_type (CellTypeState expected, CellTypeState actual);
391 void ppstore (CellTypeState *in, int loc_no);
392 void ppload (CellTypeState *out, int loc_no);
393 void ppush1 (CellTypeState in);
394 void ppush (CellTypeState *in);
395 void ppop1 (CellTypeState out);
396 void ppop (CellTypeState *out);
397 void ppop_any (int poplen);
398 void pp (CellTypeState *in, CellTypeState *out);
399 void pp_new_ref (CellTypeState *in, int bci);
400 void ppdupswap (int poplen, const char *out);
401 void do_ldc (int bci);
402 void do_astore (int idx);
403 void do_jsr (int delta);
404 void do_field (int is_get, int is_static, int idx, int bci, Bytecodes::Code bc);
405 void do_method (int is_static, int idx, int bci, Bytecodes::Code bc);
406 void do_multianewarray (int dims, int bci);
407 void do_monitorenter (int bci);
408 void do_monitorexit (int bci);
409 void do_return_monitor_check ();
410 void do_checkcast ();
411 CellTypeState *signature_to_effect (const Symbol* sig, int bci, CellTypeState *out);
412 int copy_cts (CellTypeState *dst, CellTypeState *src);
413
414 // Error handling
415 void error_work (const char *format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
416 void report_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
417 void verify_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
418 bool got_error() { return _got_error; }
419
420 // Create result set
421 bool _report_result;
422 bool _report_result_for_send; // Unfortunately, stackmaps for sends are special, so we need some extra
423 BytecodeStream *_itr_send; // variables to handle them properly.
424
425 void report_result ();
|