hotspot/src/share/vm/c1/c1_Instruction.cpp
changeset 5707 6c66849ed24e
parent 5547 f4b087cbb361
child 6453 970dc585ab63
equal deleted inserted replaced
5706:0c91076143f9 5707:6c66849ed24e
    27 
    27 
    28 
    28 
    29 // Implementation of Instruction
    29 // Implementation of Instruction
    30 
    30 
    31 
    31 
    32 int Instruction::_next_id = 0;
       
    33 
       
    34 #ifdef ASSERT
    32 #ifdef ASSERT
    35 void Instruction::create_hi_word() {
    33 void Instruction::create_hi_word() {
    36   assert(type()->is_double_word() && _hi_word == NULL, "only double word has high word");
    34   assert(type()->is_double_word() && _hi_word == NULL, "only double word has high word");
    37   _hi_word = new HiWord(this);
    35   _hi_word = new HiWord(this);
    38 }
    36 }
   191   }
   189   }
   192   return NULL;
   190   return NULL;
   193 }
   191 }
   194 
   192 
   195 
   193 
   196 void ArithmeticOp::other_values_do(void f(Value*)) {
   194 void ArithmeticOp::other_values_do(ValueVisitor* f) {
   197   if (lock_stack() != NULL) lock_stack()->values_do(f);
   195   if (lock_stack() != NULL) lock_stack()->values_do(f);
   198 }
   196 }
   199 
   197 
   200 void NullCheck::other_values_do(void f(Value*)) {
   198 void NullCheck::other_values_do(ValueVisitor* f) {
   201   lock_stack()->values_do(f);
   199   lock_stack()->values_do(f);
   202 }
   200 }
   203 
   201 
   204 void AccessArray::other_values_do(void f(Value*)) {
   202 void AccessArray::other_values_do(ValueVisitor* f) {
   205   if (lock_stack() != NULL) lock_stack()->values_do(f);
   203   if (lock_stack() != NULL) lock_stack()->values_do(f);
   206 }
   204 }
   207 
   205 
   208 
   206 
   209 // Implementation of AccessField
   207 // Implementation of AccessField
   210 
   208 
   211 void AccessField::other_values_do(void f(Value*)) {
   209 void AccessField::other_values_do(ValueVisitor* f) {
   212   if (state_before() != NULL) state_before()->values_do(f);
   210   if (state_before() != NULL) state_before()->values_do(f);
   213   if (lock_stack() != NULL) lock_stack()->values_do(f);
   211   if (lock_stack() != NULL) lock_stack()->values_do(f);
   214 }
   212 }
   215 
   213 
   216 
   214 
   268 }
   266 }
   269 
   267 
   270 
   268 
   271 // Implementation of CompareOp
   269 // Implementation of CompareOp
   272 
   270 
   273 void CompareOp::other_values_do(void f(Value*)) {
   271 void CompareOp::other_values_do(ValueVisitor* f) {
   274   if (state_before() != NULL) state_before()->values_do(f);
   272   if (state_before() != NULL) state_before()->values_do(f);
   275 }
   273 }
   276 
   274 
   277 
   275 
   278 // Implementation of IfOp
   276 // Implementation of IfOp
   300 IRScope* StateSplit::scope() const {
   298 IRScope* StateSplit::scope() const {
   301   return _state->scope();
   299   return _state->scope();
   302 }
   300 }
   303 
   301 
   304 
   302 
   305 void StateSplit::state_values_do(void f(Value*)) {
   303 void StateSplit::state_values_do(ValueVisitor* f) {
   306   if (state() != NULL) state()->values_do(f);
   304   if (state() != NULL) state()->values_do(f);
   307 }
   305 }
   308 
   306 
   309 
   307 
   310 void BlockBegin::state_values_do(void f(Value*)) {
   308 void BlockBegin::state_values_do(ValueVisitor* f) {
   311   StateSplit::state_values_do(f);
   309   StateSplit::state_values_do(f);
   312 
   310 
   313   if (is_set(BlockBegin::exception_entry_flag)) {
   311   if (is_set(BlockBegin::exception_entry_flag)) {
   314     for (int i = 0; i < number_of_exception_states(); i++) {
   312     for (int i = 0; i < number_of_exception_states(); i++) {
   315       exception_state_at(i)->values_do(f);
   313       exception_state_at(i)->values_do(f);
   316     }
   314     }
   317   }
   315   }
   318 }
   316 }
   319 
   317 
   320 
   318 
   321 void MonitorEnter::state_values_do(void f(Value*)) {
   319 void MonitorEnter::state_values_do(ValueVisitor* f) {
   322   StateSplit::state_values_do(f);
   320   StateSplit::state_values_do(f);
   323   _lock_stack_before->values_do(f);
   321   _lock_stack_before->values_do(f);
   324 }
   322 }
   325 
   323 
   326 
   324 
   327 void Intrinsic::state_values_do(void f(Value*)) {
   325 void Intrinsic::state_values_do(ValueVisitor* f) {
   328   StateSplit::state_values_do(f);
   326   StateSplit::state_values_do(f);
   329   if (lock_stack() != NULL) lock_stack()->values_do(f);
   327   if (lock_stack() != NULL) lock_stack()->values_do(f);
   330 }
   328 }
   331 
   329 
   332 
   330 
   347   set_flag(TargetIsFinalFlag,    target_is_loaded() && target->is_final_method());
   345   set_flag(TargetIsFinalFlag,    target_is_loaded() && target->is_final_method());
   348   set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict());
   346   set_flag(TargetIsStrictfpFlag, target_is_loaded() && target->is_strict());
   349 
   347 
   350   assert(args != NULL, "args must exist");
   348   assert(args != NULL, "args must exist");
   351 #ifdef ASSERT
   349 #ifdef ASSERT
   352   values_do(assert_value);
   350   AssertValues assert_value;
   353 #endif // ASSERT
   351   values_do(&assert_value);
       
   352 #endif
   354 
   353 
   355   // provide an initial guess of signature size.
   354   // provide an initial guess of signature size.
   356   _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
   355   _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
   357   if (has_receiver()) {
   356   if (has_receiver()) {
   358     _signature->append(as_BasicType(receiver()->type()));
   357     _signature->append(as_BasicType(receiver()->type()));
   366     _signature->append(bt);
   365     _signature->append(bt);
   367   }
   366   }
   368 }
   367 }
   369 
   368 
   370 
   369 
   371 void Invoke::state_values_do(void f(Value*)) {
   370 void Invoke::state_values_do(ValueVisitor* f) {
   372   StateSplit::state_values_do(f);
   371   StateSplit::state_values_do(f);
   373   if (state_before() != NULL) state_before()->values_do(f);
   372   if (state_before() != NULL) state_before()->values_do(f);
   374   if (state()        != NULL) state()->values_do(f);
   373   if (state()        != NULL) state()->values_do(f);
   375 }
   374 }
   376 
   375 
   498   }
   497   }
   499   return NULL;
   498   return NULL;
   500 }
   499 }
   501 
   500 
   502 
   501 
   503 void Constant::other_values_do(void f(Value*)) {
   502 void Constant::other_values_do(ValueVisitor* f) {
   504   if (state() != NULL) state()->values_do(f);
   503   if (state() != NULL) state()->values_do(f);
   505 }
   504 }
   506 
   505 
   507 
   506 
   508 // Implementation of NewArray
   507 // Implementation of NewArray
   509 
   508 
   510 void NewArray::other_values_do(void f(Value*)) {
   509 void NewArray::other_values_do(ValueVisitor* f) {
   511   if (state_before() != NULL) state_before()->values_do(f);
   510   if (state_before() != NULL) state_before()->values_do(f);
   512 }
   511 }
   513 
   512 
   514 
   513 
   515 // Implementation of TypeCheck
   514 // Implementation of TypeCheck
   516 
   515 
   517 void TypeCheck::other_values_do(void f(Value*)) {
   516 void TypeCheck::other_values_do(ValueVisitor* f) {
   518   if (state_before() != NULL) state_before()->values_do(f);
   517   if (state_before() != NULL) state_before()->values_do(f);
   519 }
   518 }
   520 
   519 
   521 
   520 
   522 // Implementation of BlockBegin
   521 // Implementation of BlockBegin
   523 
       
   524 int BlockBegin::_next_block_id = 0;
       
   525 
       
   526 
   522 
   527 void BlockBegin::set_end(BlockEnd* end) {
   523 void BlockBegin::set_end(BlockEnd* end) {
   528   assert(end != NULL, "should not reset block end to NULL");
   524   assert(end != NULL, "should not reset block end to NULL");
   529   BlockEnd* old_end = _end;
   525   BlockEnd* old_end = _end;
   530   if (end == old_end) {
   526   if (end == old_end) {
   736   boolArray mark(number_of_blocks(), false);
   732   boolArray mark(number_of_blocks(), false);
   737   iterate_postorder(mark, closure);
   733   iterate_postorder(mark, closure);
   738 }
   734 }
   739 
   735 
   740 
   736 
   741 void BlockBegin::block_values_do(void f(Value*)) {
   737 void BlockBegin::block_values_do(ValueVisitor* f) {
   742   for (Instruction* n = this; n != NULL; n = n->next()) n->values_do(f);
   738   for (Instruction* n = this; n != NULL; n = n->next()) n->values_do(f);
   743 }
   739 }
   744 
   740 
   745 
   741 
   746 #ifndef PRODUCT
   742 #ifndef PRODUCT
   928 void BlockList::blocks_do(void f(BlockBegin*)) {
   924 void BlockList::blocks_do(void f(BlockBegin*)) {
   929   for (int i = length() - 1; i >= 0; i--) f(at(i));
   925   for (int i = length() - 1; i >= 0; i--) f(at(i));
   930 }
   926 }
   931 
   927 
   932 
   928 
   933 void BlockList::values_do(void f(Value*)) {
   929 void BlockList::values_do(ValueVisitor* f) {
   934   for (int i = length() - 1; i >= 0; i--) at(i)->block_values_do(f);
   930   for (int i = length() - 1; i >= 0; i--) at(i)->block_values_do(f);
   935 }
   931 }
   936 
   932 
   937 
   933 
   938 #ifndef PRODUCT
   934 #ifndef PRODUCT
   971 void BlockEnd::substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux) {
   967 void BlockEnd::substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux) {
   972   substitute(*_sux, old_sux, new_sux);
   968   substitute(*_sux, old_sux, new_sux);
   973 }
   969 }
   974 
   970 
   975 
   971 
   976 void BlockEnd::other_values_do(void f(Value*)) {
   972 void BlockEnd::other_values_do(ValueVisitor* f) {
   977   if (state_before() != NULL) state_before()->values_do(f);
   973   if (state_before() != NULL) state_before()->values_do(f);
   978 }
   974 }
   979 
   975 
   980 
   976 
   981 // Implementation of Phi
   977 // Implementation of Phi
  1010 }
  1006 }
  1011 
  1007 
  1012 
  1008 
  1013 // Implementation of Throw
  1009 // Implementation of Throw
  1014 
  1010 
  1015 void Throw::state_values_do(void f(Value*)) {
  1011 void Throw::state_values_do(ValueVisitor* f) {
  1016   BlockEnd::state_values_do(f);
  1012   BlockEnd::state_values_do(f);
  1017 }
  1013 }