Mercurial > hg > truffle
comparison src/share/vm/oops/generateOopMap.hpp @ 0:a61af66fc99e jdk7-b24
Initial load
author | duke |
---|---|
date | Sat, 01 Dec 2007 00:00:00 +0000 |
parents | |
children | 37f87013dfd8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a61af66fc99e |
---|---|
1 /* | |
2 * Copyright 1997-2005 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // Forward definition | |
26 class MethodOopMap; | |
27 class GenerateOopMap; | |
28 class BasicBlock; | |
29 class CellTypeState; | |
30 class StackMap; | |
31 | |
32 // These two should be removed. But requires som code to be cleaned up | |
33 #define MAXARGSIZE 256 // This should be enough | |
34 #define MAX_LOCAL_VARS 65536 // 16-bit entry | |
35 | |
36 typedef void (*jmpFct_t)(GenerateOopMap *c, int bcpDelta, int* data); | |
37 | |
38 | |
39 // RetTable | |
40 // | |
41 // Contains maping between jsr targets and there return addresses. One-to-many mapping | |
42 // | |
43 class RetTableEntry : public ResourceObj { | |
44 private: | |
45 static int _init_nof_jsrs; // Default size of jsrs list | |
46 int _target_bci; // Target PC address of jump (bytecode index) | |
47 GrowableArray<intptr_t> * _jsrs; // List of return addresses (bytecode index) | |
48 RetTableEntry *_next; // Link to next entry | |
49 public: | |
50 RetTableEntry(int target, RetTableEntry *next) { _target_bci=target; _jsrs = new GrowableArray<intptr_t>(_init_nof_jsrs); _next = next; } | |
51 | |
52 // Query | |
53 int target_bci() const { return _target_bci; } | |
54 int nof_jsrs() const { return _jsrs->length(); } | |
55 int jsrs(int i) const { assert(i>=0 && i<nof_jsrs(), "Index out of bounds"); return _jsrs->at(i); } | |
56 | |
57 // Update entry | |
58 void add_jsr (int return_bci) { _jsrs->append(return_bci); } | |
59 void add_delta (int bci, int delta); | |
60 RetTableEntry * next() const { return _next; } | |
61 }; | |
62 | |
63 | |
64 class RetTable VALUE_OBJ_CLASS_SPEC { | |
65 private: | |
66 RetTableEntry *_first; | |
67 static int _init_nof_entries; | |
68 | |
69 void add_jsr(int return_bci, int target_bci); // Adds entry to list | |
70 public: | |
71 RetTable() { _first = NULL; } | |
72 void compute_ret_table(methodHandle method); | |
73 void update_ret_table(int bci, int delta); | |
74 RetTableEntry* find_jsrs_for_target(int targBci); | |
75 }; | |
76 | |
77 // | |
78 // CellTypeState | |
79 // | |
80 class CellTypeState VALUE_OBJ_CLASS_SPEC { | |
81 private: | |
82 unsigned int _state; | |
83 | |
84 // Masks for separating the BITS and INFO portions of a CellTypeState | |
85 enum { info_mask = right_n_bits(28), | |
86 bits_mask = (int)(~info_mask) }; | |
87 | |
88 // These constant are used for manipulating the BITS portion of a | |
89 // CellTypeState | |
90 enum { uninit_bit = (int)(nth_bit(31)), | |
91 ref_bit = nth_bit(30), | |
92 val_bit = nth_bit(29), | |
93 addr_bit = nth_bit(28), | |
94 live_bits_mask = (int)(bits_mask & ~uninit_bit) }; | |
95 | |
96 // These constants are used for manipulating the INFO portion of a | |
97 // CellTypeState | |
98 enum { top_info_bit = nth_bit(27), | |
99 not_bottom_info_bit = nth_bit(26), | |
100 info_data_mask = right_n_bits(26), | |
101 info_conflict = info_mask }; | |
102 | |
103 // Within the INFO data, these values are used to distinguish different | |
104 // kinds of references. | |
105 enum { ref_not_lock_bit = nth_bit(25), // 0 if this reference is locked as a monitor | |
106 ref_slot_bit = nth_bit(24), // 1 if this reference is a "slot" reference, | |
107 // 0 if it is a "line" reference. | |
108 ref_data_mask = right_n_bits(24) }; | |
109 | |
110 | |
111 // These values are used to initialize commonly used CellTypeState | |
112 // constants. | |
113 enum { bottom_value = 0, | |
114 uninit_value = (int)(uninit_bit | info_conflict), | |
115 ref_value = ref_bit, | |
116 ref_conflict = ref_bit | info_conflict, | |
117 val_value = val_bit | info_conflict, | |
118 addr_value = addr_bit, | |
119 addr_conflict = addr_bit | info_conflict }; | |
120 | |
121 public: | |
122 | |
123 // Since some C++ constructors generate poor code for declarations of the | |
124 // form... | |
125 // | |
126 // CellTypeState vector[length]; | |
127 // | |
128 // ...we avoid making a constructor for this class. CellTypeState values | |
129 // should be constructed using one of the make_* methods: | |
130 | |
131 static CellTypeState make_any(int state) { | |
132 CellTypeState s; | |
133 s._state = state; | |
134 // Causes SS10 warning. | |
135 // assert(s.is_valid_state(), "check to see if CellTypeState is valid"); | |
136 return s; | |
137 } | |
138 | |
139 static CellTypeState make_bottom() { | |
140 return make_any(0); | |
141 } | |
142 | |
143 static CellTypeState make_top() { | |
144 return make_any(AllBits); | |
145 } | |
146 | |
147 static CellTypeState make_addr(int bci) { | |
148 assert((bci >= 0) && (bci < info_data_mask), "check to see if ret addr is valid"); | |
149 return make_any(addr_bit | not_bottom_info_bit | (bci & info_data_mask)); | |
150 } | |
151 | |
152 static CellTypeState make_slot_ref(int slot_num) { | |
153 assert(slot_num >= 0 && slot_num < ref_data_mask, "slot out of range"); | |
154 return make_any(ref_bit | not_bottom_info_bit | ref_not_lock_bit | ref_slot_bit | | |
155 (slot_num & ref_data_mask)); | |
156 } | |
157 | |
158 static CellTypeState make_line_ref(int bci) { | |
159 assert(bci >= 0 && bci < ref_data_mask, "line out of range"); | |
160 return make_any(ref_bit | not_bottom_info_bit | ref_not_lock_bit | | |
161 (bci & ref_data_mask)); | |
162 } | |
163 | |
164 static CellTypeState make_lock_ref(int bci) { | |
165 assert(bci >= 0 && bci < ref_data_mask, "line out of range"); | |
166 return make_any(ref_bit | not_bottom_info_bit | (bci & ref_data_mask)); | |
167 } | |
168 | |
169 // Query methods: | |
170 bool is_bottom() const { return _state == 0; } | |
171 bool is_live() const { return ((_state & live_bits_mask) != 0); } | |
172 bool is_valid_state() const { | |
173 // Uninitialized and value cells must contain no data in their info field: | |
174 if ((can_be_uninit() || can_be_value()) && !is_info_top()) { | |
175 return false; | |
176 } | |
177 // The top bit is only set when all info bits are set: | |
178 if (is_info_top() && ((_state & info_mask) != info_mask)) { | |
179 return false; | |
180 } | |
181 // The not_bottom_bit must be set when any other info bit is set: | |
182 if (is_info_bottom() && ((_state & info_mask) != 0)) { | |
183 return false; | |
184 } | |
185 return true; | |
186 } | |
187 | |
188 bool is_address() const { return ((_state & bits_mask) == addr_bit); } | |
189 bool is_reference() const { return ((_state & bits_mask) == ref_bit); } | |
190 bool is_value() const { return ((_state & bits_mask) == val_bit); } | |
191 bool is_uninit() const { return ((_state & bits_mask) == (uint)uninit_bit); } | |
192 | |
193 bool can_be_address() const { return ((_state & addr_bit) != 0); } | |
194 bool can_be_reference() const { return ((_state & ref_bit) != 0); } | |
195 bool can_be_value() const { return ((_state & val_bit) != 0); } | |
196 bool can_be_uninit() const { return ((_state & uninit_bit) != 0); } | |
197 | |
198 bool is_info_bottom() const { return ((_state & not_bottom_info_bit) == 0); } | |
199 bool is_info_top() const { return ((_state & top_info_bit) != 0); } | |
200 int get_info() const { | |
201 assert((!is_info_top() && !is_info_bottom()), | |
202 "check to make sure top/bottom info is not used"); | |
203 return (_state & info_data_mask); | |
204 } | |
205 | |
206 bool is_good_address() const { return is_address() && !is_info_top(); } | |
207 bool is_lock_reference() const { | |
208 return ((_state & (bits_mask | top_info_bit | ref_not_lock_bit)) == ref_bit); | |
209 } | |
210 bool is_nonlock_reference() const { | |
211 return ((_state & (bits_mask | top_info_bit | ref_not_lock_bit)) == (ref_bit | ref_not_lock_bit)); | |
212 } | |
213 | |
214 bool equal(CellTypeState a) const { return _state == a._state; } | |
215 bool equal_kind(CellTypeState a) const { | |
216 return (_state & bits_mask) == (a._state & bits_mask); | |
217 } | |
218 | |
219 char to_char() const; | |
220 | |
221 // Merge | |
222 CellTypeState merge (CellTypeState cts, int slot) const; | |
223 | |
224 // Debugging output | |
225 void print(outputStream *os); | |
226 | |
227 // Default values of common values | |
228 static CellTypeState bottom; | |
229 static CellTypeState uninit; | |
230 static CellTypeState ref; | |
231 static CellTypeState value; | |
232 static CellTypeState refUninit; | |
233 static CellTypeState varUninit; | |
234 static CellTypeState top; | |
235 static CellTypeState addr; | |
236 }; | |
237 | |
238 | |
239 // | |
240 // BasicBlockStruct | |
241 // | |
242 class BasicBlock: ResourceObj { | |
243 private: | |
244 bool _changed; // Reached a fixpoint or not | |
245 public: | |
246 enum Constants { | |
247 _dead_basic_block = -2, | |
248 _unreached = -1 // Alive but not yet reached by analysis | |
249 // >=0 // Alive and has a merged state | |
250 }; | |
251 | |
252 int _bci; // Start of basic block | |
253 int _end_bci; // Bci of last instruction in basicblock | |
254 int _max_locals; // Determines split between vars and stack | |
255 int _max_stack; // Determines split between stack and monitors | |
256 CellTypeState* _state; // State (vars, stack) at entry. | |
257 int _stack_top; // -1 indicates bottom stack value. | |
258 int _monitor_top; // -1 indicates bottom monitor stack value. | |
259 | |
260 CellTypeState* vars() { return _state; } | |
261 CellTypeState* stack() { return _state + _max_locals; } | |
262 | |
263 bool changed() { return _changed; } | |
264 void set_changed(bool s) { _changed = s; } | |
265 | |
266 bool is_reachable() const { return _stack_top >= 0; } // Analysis has reached this basicblock | |
267 | |
268 // All basicblocks that are unreachable are going to have a _stack_top == _dead_basic_block. | |
269 // This info. is setup in a pre-parse before the real abstract interpretation starts. | |
270 bool is_dead() const { return _stack_top == _dead_basic_block; } | |
271 bool is_alive() const { return _stack_top != _dead_basic_block; } | |
272 void mark_as_alive() { assert(is_dead(), "must be dead"); _stack_top = _unreached; } | |
273 }; | |
274 | |
275 | |
276 // | |
277 // GenerateOopMap | |
278 // | |
279 // Main class used to compute the pointer-maps in a MethodOop | |
280 // | |
281 class GenerateOopMap VALUE_OBJ_CLASS_SPEC { | |
282 protected: | |
283 | |
284 // _monitor_top is set to this constant to indicate that a monitor matching | |
285 // problem was encountered prior to this point in control flow. | |
286 enum { bad_monitors = -1 }; | |
287 | |
288 // Main variables | |
289 methodHandle _method; // The method we are examine | |
290 RetTable _rt; // Contains the return address mappings | |
291 int _max_locals; // Cached value of no. of locals | |
292 int _max_stack; // Cached value of max. stack depth | |
293 int _max_monitors; // Cached value of max. monitor stack depth | |
294 int _has_exceptions; // True, if exceptions exist for method | |
295 bool _got_error; // True, if an error occured during interpretation. | |
296 Handle _exception; // Exception if got_error is true. | |
297 bool _did_rewriting; // was bytecodes rewritten | |
298 bool _did_relocation; // was relocation neccessary | |
299 bool _monitor_safe; // The monitors in this method have been determined | |
300 // to be safe. | |
301 | |
302 // Working Cell type state | |
303 int _state_len; // Size of states | |
304 CellTypeState *_state; // list of states | |
305 char *_state_vec_buf; // Buffer used to print a readable version of a state | |
306 int _stack_top; | |
307 int _monitor_top; | |
308 | |
309 // Timing and statistics | |
310 static elapsedTimer _total_oopmap_time; // Holds cumulative oopmap generation time | |
311 static long _total_byte_count; // Holds cumulative number of bytes inspected | |
312 | |
313 // Cell type methods | |
314 void init_state(); | |
315 void make_context_uninitialized (); | |
316 int methodsig_to_effect (symbolOop signature, bool isStatic, CellTypeState* effect); | |
317 bool merge_local_state_vectors (CellTypeState* cts, CellTypeState* bbts); | |
318 bool merge_monitor_state_vectors(CellTypeState* cts, CellTypeState* bbts); | |
319 void copy_state (CellTypeState *dst, CellTypeState *src); | |
320 void merge_state_into_bb (BasicBlock *bb); | |
321 static void merge_state (GenerateOopMap *gom, int bcidelta, int* data); | |
322 void set_var (int localNo, CellTypeState cts); | |
323 CellTypeState get_var (int localNo); | |
324 CellTypeState pop (); | |
325 void push (CellTypeState cts); | |
326 CellTypeState monitor_pop (); | |
327 void monitor_push (CellTypeState cts); | |
328 CellTypeState * vars () { return _state; } | |
329 CellTypeState * stack () { return _state+_max_locals; } | |
330 CellTypeState * monitors () { return _state+_max_locals+_max_stack; } | |
331 | |
332 void replace_all_CTS_matches (CellTypeState match, | |
333 CellTypeState replace); | |
334 void print_states (outputStream *os, CellTypeState *vector, int num); | |
335 void print_current_state (outputStream *os, | |
336 BytecodeStream *itr, | |
337 bool detailed); | |
338 void report_monitor_mismatch (const char *msg); | |
339 | |
340 // Basicblock info | |
341 BasicBlock * _basic_blocks; // Array of basicblock info | |
342 int _gc_points; | |
343 int _bb_count; | |
344 uintptr_t * _bb_hdr_bits; | |
345 | |
346 // Basicblocks methods | |
347 void initialize_bb (); | |
348 void mark_bbheaders_and_count_gc_points(); | |
349 bool is_bb_header (int bci) const { return (_bb_hdr_bits[bci >> LogBitsPerWord] & ((uintptr_t)1 << (bci & (BitsPerWord-1)))) != 0; } | |
350 int gc_points () const { return _gc_points; } | |
351 int bb_count () const { return _bb_count; } | |
352 void set_bbmark_bit (int bci); | |
353 void clear_bbmark_bit (int bci); | |
354 BasicBlock * get_basic_block_at (int bci) const; | |
355 BasicBlock * get_basic_block_containing (int bci) const; | |
356 void interp_bb (BasicBlock *bb); | |
357 void restore_state (BasicBlock *bb); | |
358 int next_bb_start_pc (BasicBlock *bb); | |
359 void update_basic_blocks (int bci, int delta, int new_method_size); | |
360 static void bb_mark_fct (GenerateOopMap *c, int deltaBci, int *data); | |
361 | |
362 // Dead code detection | |
363 void mark_reachable_code(); | |
364 static void reachable_basicblock (GenerateOopMap *c, int deltaBci, int *data); | |
365 | |
366 // Interpretation methods (primary) | |
367 void do_interpretation (); | |
368 void init_basic_blocks (); | |
369 void setup_method_entry_state (); | |
370 void interp_all (); | |
371 | |
372 // Interpretation methods (secondary) | |
373 void interp1 (BytecodeStream *itr); | |
374 void do_exception_edge (BytecodeStream *itr); | |
375 void check_type (CellTypeState expected, CellTypeState actual); | |
376 void ppstore (CellTypeState *in, int loc_no); | |
377 void ppload (CellTypeState *out, int loc_no); | |
378 void ppush1 (CellTypeState in); | |
379 void ppush (CellTypeState *in); | |
380 void ppop1 (CellTypeState out); | |
381 void ppop (CellTypeState *out); | |
382 void ppop_any (int poplen); | |
383 void pp (CellTypeState *in, CellTypeState *out); | |
384 void pp_new_ref (CellTypeState *in, int bci); | |
385 void ppdupswap (int poplen, const char *out); | |
386 void do_ldc (int idx, int bci); | |
387 void do_astore (int idx); | |
388 void do_jsr (int delta); | |
389 void do_field (int is_get, int is_static, int idx, int bci); | |
390 void do_method (int is_static, int is_interface, int idx, int bci); | |
391 void do_multianewarray (int dims, int bci); | |
392 void do_monitorenter (int bci); | |
393 void do_monitorexit (int bci); | |
394 void do_return_monitor_check (); | |
395 void do_checkcast (); | |
396 CellTypeState *sigchar_to_effect (char sigch, int bci, CellTypeState *out); | |
397 int copy_cts (CellTypeState *dst, CellTypeState *src); | |
398 | |
399 // Error handling | |
400 void error_work (const char *format, va_list ap); | |
401 void report_error (const char *format, ...); | |
402 void verify_error (const char *format, ...); | |
403 bool got_error() { return _got_error; } | |
404 | |
405 // Create result set | |
406 bool _report_result; | |
407 bool _report_result_for_send; // Unfortunatly, stackmaps for sends are special, so we need some extra | |
408 BytecodeStream *_itr_send; // variables to handle them properly. | |
409 | |
410 void report_result (); | |
411 | |
412 // Initvars | |
413 GrowableArray<intptr_t> * _init_vars; | |
414 | |
415 void initialize_vars (); | |
416 void add_to_ref_init_set (int localNo); | |
417 | |
418 // Conflicts rewrite logic | |
419 bool _conflict; // True, if a conflict occured during interpretation | |
420 int _nof_refval_conflicts; // No. of conflicts that require rewrites | |
421 int * _new_var_map; | |
422 | |
423 void record_refval_conflict (int varNo); | |
424 void rewrite_refval_conflicts (); | |
425 void rewrite_refval_conflict (int from, int to); | |
426 bool rewrite_refval_conflict_inst (BytecodeStream *i, int from, int to); | |
427 bool rewrite_load_or_store (BytecodeStream *i, Bytecodes::Code bc, Bytecodes::Code bc0, unsigned int varNo); | |
428 | |
429 void expand_current_instr (int bci, int ilen, int newIlen, u_char inst_buffer[]); | |
430 bool is_astore (BytecodeStream *itr, int *index); | |
431 bool is_aload (BytecodeStream *itr, int *index); | |
432 | |
433 // List of bci's where a return address is on top of the stack | |
434 GrowableArray<intptr_t> *_ret_adr_tos; | |
435 | |
436 bool stack_top_holds_ret_addr (int bci); | |
437 void compute_ret_adr_at_TOS (); | |
438 void update_ret_adr_at_TOS (int bci, int delta); | |
439 | |
440 int binsToHold (int no) { return ((no+(BitsPerWord-1))/BitsPerWord); } | |
441 char *state_vec_to_string (CellTypeState* vec, int len); | |
442 | |
443 // Helper method. Can be used in subclasses to fx. calculate gc_points. If the current instuction | |
444 // is a control transfer, then calls the jmpFct all possible destinations. | |
445 void ret_jump_targets_do (BytecodeStream *bcs, jmpFct_t jmpFct, int varNo,int *data); | |
446 bool jump_targets_do (BytecodeStream *bcs, jmpFct_t jmpFct, int *data); | |
447 | |
448 friend class RelocCallback; | |
449 public: | |
450 GenerateOopMap(methodHandle method); | |
451 | |
452 // Compute the map. | |
453 void compute_map(TRAPS); | |
454 void result_for_basicblock(int bci); // Do a callback on fill_stackmap_for_opcodes for basicblock containing bci | |
455 | |
456 // Query | |
457 int max_locals() const { return _max_locals; } | |
458 methodOop method() const { return _method(); } | |
459 methodHandle method_as_handle() const { return _method; } | |
460 | |
461 bool did_rewriting() { return _did_rewriting; } | |
462 bool did_relocation() { return _did_relocation; } | |
463 | |
464 static void print_time(); | |
465 | |
466 // Monitor query | |
467 bool monitor_safe() { return _monitor_safe; } | |
468 | |
469 // Specialization methods. Intended use: | |
470 // - possible_gc_point must return true for every bci for which the stackmaps must be returned | |
471 // - fill_stackmap_prolog is called just before the result is reported. The arguments tells the estimated | |
472 // number of gc points | |
473 // - fill_stackmap_for_opcodes is called once for each bytecode index in order (0...code_length-1) | |
474 // - fill_stackmap_epilog is called after all results has been reported. Note: Since the algorithm does not report | |
475 // stackmaps for deadcode, fewer gc_points might have been encounted than assumed during the epilog. It is the | |
476 // responsibility of the subclass to count the correct number. | |
477 // - fill_init_vars are called once with the result of the init_vars computation | |
478 // | |
479 // All these methods are used during a call to: compute_map. Note: Non of the return results are valid | |
480 // after compute_map returns, since all values are allocated as resource objects. | |
481 // | |
482 // All virtual method must be implemented in subclasses | |
483 virtual bool allow_rewrites () const { return false; } | |
484 virtual bool report_results () const { return true; } | |
485 virtual bool report_init_vars () const { return true; } | |
486 virtual bool possible_gc_point (BytecodeStream *bcs) { ShouldNotReachHere(); return false; } | |
487 virtual void fill_stackmap_prolog (int nof_gc_points) { ShouldNotReachHere(); } | |
488 virtual void fill_stackmap_epilog () { ShouldNotReachHere(); } | |
489 virtual void fill_stackmap_for_opcodes (BytecodeStream *bcs, | |
490 CellTypeState* vars, | |
491 CellTypeState* stack, | |
492 int stackTop) { ShouldNotReachHere(); } | |
493 virtual void fill_init_vars (GrowableArray<intptr_t> *init_vars) { ShouldNotReachHere();; } | |
494 }; | |
495 | |
496 // | |
497 // Subclass of the GenerateOopMap Class that just do rewrites of the method, if needed. | |
498 // It does not store any oopmaps. | |
499 // | |
500 class ResolveOopMapConflicts: public GenerateOopMap { | |
501 private: | |
502 | |
503 bool _must_clear_locals; | |
504 | |
505 virtual bool report_results() const { return false; } | |
506 virtual bool report_init_vars() const { return true; } | |
507 virtual bool allow_rewrites() const { return true; } | |
508 virtual bool possible_gc_point (BytecodeStream *bcs) { return false; } | |
509 virtual void fill_stackmap_prolog (int nof_gc_points) {} | |
510 virtual void fill_stackmap_epilog () {} | |
511 virtual void fill_stackmap_for_opcodes (BytecodeStream *bcs, | |
512 CellTypeState* vars, | |
513 CellTypeState* stack, | |
514 int stack_top) {} | |
515 virtual void fill_init_vars (GrowableArray<intptr_t> *init_vars) { _must_clear_locals = init_vars->length() > 0; } | |
516 | |
517 #ifndef PRODUCT | |
518 // Statistics | |
519 static int _nof_invocations; | |
520 static int _nof_rewrites; | |
521 static int _nof_relocations; | |
522 #endif | |
523 | |
524 public: | |
525 ResolveOopMapConflicts(methodHandle method) : GenerateOopMap(method) { _must_clear_locals = false; }; | |
526 | |
527 methodHandle do_potential_rewrite(TRAPS); | |
528 bool must_clear_locals() const { return _must_clear_locals; } | |
529 }; | |
530 | |
531 | |
532 // | |
533 // Subclass used by the compiler to generate pairing infomation | |
534 // | |
535 class GeneratePairingInfo: public GenerateOopMap { | |
536 private: | |
537 | |
538 virtual bool report_results() const { return false; } | |
539 virtual bool report_init_vars() const { return false; } | |
540 virtual bool allow_rewrites() const { return false; } | |
541 virtual bool possible_gc_point (BytecodeStream *bcs) { return false; } | |
542 virtual void fill_stackmap_prolog (int nof_gc_points) {} | |
543 virtual void fill_stackmap_epilog () {} | |
544 virtual void fill_stackmap_for_opcodes (BytecodeStream *bcs, | |
545 CellTypeState* vars, | |
546 CellTypeState* stack, | |
547 int stack_top) {} | |
548 virtual void fill_init_vars (GrowableArray<intptr_t> *init_vars) {} | |
549 public: | |
550 GeneratePairingInfo(methodHandle method) : GenerateOopMap(method) {}; | |
551 | |
552 // Call compute_map(CHECK) to generate info. | |
553 }; |