331 return is_set_nth_bit(_nonnull_state, i);
332 }
333 return true;
334 }
335
336 // Set whether argument number i needs a null check or not
337 void set_arg_needs_null_check(int i, bool check) {
338 if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
339 if (check) {
340 _nonnull_state |= nth_bit(i);
341 } else {
342 _nonnull_state &= ~(nth_bit(i));
343 }
344 }
345 }
346 };
347
348 public:
349 void* operator new(size_t size) throw() {
350 Compilation* c = Compilation::current();
351 void* res = c->arena()->Amalloc(size);
352 ((Instruction*)res)->_id = c->get_next_id();
353 return res;
354 }
355
356 static const int no_bci = -99;
357
358 enum InstructionFlag {
359 NeedsNullCheckFlag = 0,
360 CanTrapFlag,
361 DirectCompareFlag,
362 IsEliminatedFlag,
363 IsSafepointFlag,
364 IsStaticFlag,
365 IsStrictfpFlag,
366 NeedsStoreCheckFlag,
367 NeedsWriteBarrierFlag,
368 PreservesStateFlag,
369 TargetIsFinalFlag,
370 TargetIsLoadedFlag,
371 TargetIsStrictfpFlag,
372 UnorderedIsTrueFlag,
373 NeedsPatchingFlag,
409
410 // creation
411 Instruction(ValueType* type, ValueStack* state_before = NULL, bool type_is_constant = false)
412 : _use_count(0)
413 #ifndef PRODUCT
414 , _printable_bci(-99)
415 #endif
416 , _pin_state(0)
417 , _type(type)
418 , _next(NULL)
419 , _block(NULL)
420 , _subst(NULL)
421 , _flags(0)
422 , _operand(LIR_OprFact::illegalOpr)
423 , _state_before(state_before)
424 , _exception_handlers(NULL)
425 {
426 check_state(state_before);
427 assert(type != NULL && (!type->is_constant() || type_is_constant), "type must exist");
428 update_exception_state(_state_before);
429 }
430
431 // accessors
432 int id() const { return _id; }
433 #ifndef PRODUCT
434 bool has_printable_bci() const { return _printable_bci != -99; }
435 int printable_bci() const { assert(has_printable_bci(), "_printable_bci should have been set"); return _printable_bci; }
436 void set_printable_bci(int bci) { _printable_bci = bci; }
437 #endif
438 int dominator_depth();
439 int use_count() const { return _use_count; }
440 int pin_state() const { return _pin_state; }
441 bool is_pinned() const { return _pin_state != 0 || PinAllInstructions; }
442 ValueType* type() const { return _type; }
443 BlockBegin *block() const { return _block; }
444 Instruction* prev(); // use carefully, expensive operation
445 Instruction* next() const { return _next; }
446 bool has_subst() const { return _subst != NULL; }
447 Instruction* subst() { return _subst == NULL ? this : _subst->subst(); }
448 LIR_Opr operand() const { return _operand; }
1664 , _exception_handlers(1)
1665 , _exception_states(NULL)
1666 , _exception_handler_pco(-1)
1667 , _lir(NULL)
1668 , _loop_index(-1)
1669 , _live_in()
1670 , _live_out()
1671 , _live_gen()
1672 , _live_kill()
1673 , _fpu_register_usage()
1674 , _fpu_stack_state(NULL)
1675 , _first_lir_instruction_id(-1)
1676 , _last_lir_instruction_id(-1)
1677 , _total_preds(0)
1678 , _stores_to_locals()
1679 {
1680 _block = this;
1681 #ifndef PRODUCT
1682 set_printable_bci(bci);
1683 #endif
1684 }
1685
1686 // accessors
1687 int block_id() const { return _block_id; }
1688 int bci() const { return _bci; }
1689 BlockList* successors() { return &_successors; }
1690 BlockList* dominates() { return &_dominates; }
1691 BlockBegin* dominator() const { return _dominator; }
1692 int loop_depth() const { return _loop_depth; }
1693 int dominator_depth() const { return _dominator_depth; }
1694 int depth_first_number() const { return _depth_first_number; }
1695 int linear_scan_number() const { return _linear_scan_number; }
1696 BlockEnd* end() const { return _end; }
1697 Label* label() { return &_label; }
1698 LIR_List* lir() const { return _lir; }
1699 int exception_handler_pco() const { return _exception_handler_pco; }
1700 ResourceBitMap& live_in() { return _live_in; }
1701 ResourceBitMap& live_out() { return _live_out; }
1702 ResourceBitMap& live_gen() { return _live_gen; }
1703 ResourceBitMap& live_kill() { return _live_kill; }
|
331 return is_set_nth_bit(_nonnull_state, i);
332 }
333 return true;
334 }
335
336 // Set whether argument number i needs a null check or not
337 void set_arg_needs_null_check(int i, bool check) {
338 if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
339 if (check) {
340 _nonnull_state |= nth_bit(i);
341 } else {
342 _nonnull_state &= ~(nth_bit(i));
343 }
344 }
345 }
346 };
347
348 public:
349 void* operator new(size_t size) throw() {
350 Compilation* c = Compilation::current();
351 return c->arena()->Amalloc(size);
352 }
353
354 static const int no_bci = -99;
355
356 enum InstructionFlag {
357 NeedsNullCheckFlag = 0,
358 CanTrapFlag,
359 DirectCompareFlag,
360 IsEliminatedFlag,
361 IsSafepointFlag,
362 IsStaticFlag,
363 IsStrictfpFlag,
364 NeedsStoreCheckFlag,
365 NeedsWriteBarrierFlag,
366 PreservesStateFlag,
367 TargetIsFinalFlag,
368 TargetIsLoadedFlag,
369 TargetIsStrictfpFlag,
370 UnorderedIsTrueFlag,
371 NeedsPatchingFlag,
407
408 // creation
409 Instruction(ValueType* type, ValueStack* state_before = NULL, bool type_is_constant = false)
410 : _use_count(0)
411 #ifndef PRODUCT
412 , _printable_bci(-99)
413 #endif
414 , _pin_state(0)
415 , _type(type)
416 , _next(NULL)
417 , _block(NULL)
418 , _subst(NULL)
419 , _flags(0)
420 , _operand(LIR_OprFact::illegalOpr)
421 , _state_before(state_before)
422 , _exception_handlers(NULL)
423 {
424 check_state(state_before);
425 assert(type != NULL && (!type->is_constant() || type_is_constant), "type must exist");
426 update_exception_state(_state_before);
427 _id = Compilation::current()->get_next_id();
428 }
429
430 // accessors
431 int id() const { return _id; }
432 #ifndef PRODUCT
433 bool has_printable_bci() const { return _printable_bci != -99; }
434 int printable_bci() const { assert(has_printable_bci(), "_printable_bci should have been set"); return _printable_bci; }
435 void set_printable_bci(int bci) { _printable_bci = bci; }
436 #endif
437 int dominator_depth();
438 int use_count() const { return _use_count; }
439 int pin_state() const { return _pin_state; }
440 bool is_pinned() const { return _pin_state != 0 || PinAllInstructions; }
441 ValueType* type() const { return _type; }
442 BlockBegin *block() const { return _block; }
443 Instruction* prev(); // use carefully, expensive operation
444 Instruction* next() const { return _next; }
445 bool has_subst() const { return _subst != NULL; }
446 Instruction* subst() { return _subst == NULL ? this : _subst->subst(); }
447 LIR_Opr operand() const { return _operand; }
1663 , _exception_handlers(1)
1664 , _exception_states(NULL)
1665 , _exception_handler_pco(-1)
1666 , _lir(NULL)
1667 , _loop_index(-1)
1668 , _live_in()
1669 , _live_out()
1670 , _live_gen()
1671 , _live_kill()
1672 , _fpu_register_usage()
1673 , _fpu_stack_state(NULL)
1674 , _first_lir_instruction_id(-1)
1675 , _last_lir_instruction_id(-1)
1676 , _total_preds(0)
1677 , _stores_to_locals()
1678 {
1679 _block = this;
1680 #ifndef PRODUCT
1681 set_printable_bci(bci);
1682 #endif
1683 Compilation* c = Compilation::current();
1684 _id = c->get_next_id();
1685 _block_id = c->get_next_block_id();
1686 }
1687
1688 // accessors
1689 int block_id() const { return _block_id; }
1690 int bci() const { return _bci; }
1691 BlockList* successors() { return &_successors; }
1692 BlockList* dominates() { return &_dominates; }
1693 BlockBegin* dominator() const { return _dominator; }
1694 int loop_depth() const { return _loop_depth; }
1695 int dominator_depth() const { return _dominator_depth; }
1696 int depth_first_number() const { return _depth_first_number; }
1697 int linear_scan_number() const { return _linear_scan_number; }
1698 BlockEnd* end() const { return _end; }
1699 Label* label() { return &_label; }
1700 LIR_List* lir() const { return _lir; }
1701 int exception_handler_pco() const { return _exception_handler_pco; }
1702 ResourceBitMap& live_in() { return _live_in; }
1703 ResourceBitMap& live_out() { return _live_out; }
1704 ResourceBitMap& live_gen() { return _live_gen; }
1705 ResourceBitMap& live_kill() { return _live_kill; }
|