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