< prev index next >

src/share/vm/c1/c1_LIRGenerator.cpp

Print this page




 377 // This is where the tree-walk starts; instr must be root;
 378 void LIRGenerator::do_root(Value instr) {
 379   CHECK_BAILOUT();
 380 
 381   InstructionMark im(compilation(), instr);
 382 
 383   assert(instr->is_pinned(), "use only with roots");
 384   assert(instr->subst() == instr, "shouldn't have missed substitution");
 385 
 386   instr->visit(this);
 387 
 388   assert(!instr->has_uses() || instr->operand()->is_valid() ||
 389          instr->as_Constant() != NULL || bailed_out(), "invalid item set");
 390 }
 391 
 392 
 393 // This is called for each node in tree; the walk stops if a root is reached
 394 void LIRGenerator::walk(Value instr) {
 395   InstructionMark im(compilation(), instr);
 396   //stop walk when encounter a root
 397   if (instr->is_pinned() && instr->as_Phi() == NULL || instr->operand()->is_valid()) {
 398     assert(instr->operand() != LIR_OprFact::illegalOpr || instr->as_Constant() != NULL, "this root has not yet been visited");
 399   } else {
 400     assert(instr->subst() == instr, "shouldn't have missed substitution");
 401     instr->visit(this);
 402     // assert(instr->use_count() > 0 || instr->as_Phi() != NULL, "leaf instruction must have a use");
 403   }
 404 }
 405 
 406 
 407 CodeEmitInfo* LIRGenerator::state_for(Instruction* x, ValueStack* state, bool ignore_xhandler) {
 408   assert(state != NULL, "state must be defined");
 409 
 410 #ifndef PRODUCT
 411   state->verify();
 412 #endif
 413 
 414   ValueStack* s = state;
 415   for_each_state(s) {
 416     if (s->kind() == ValueStack::EmptyExceptionState) {
 417       assert(s->stack_size() == 0 && s->locals_size() == 0 && (s->locks_size() == 0 || s->locks_size() == 1), "state must be empty");


1417 
1418 
1419 LIR_Opr LIRGenerator::load_constant(LIR_Const* c) {
1420   BasicType t = c->type();
1421   for (int i = 0; i < _constants.length(); i++) {
1422     LIR_Const* other = _constants.at(i);
1423     if (t == other->type()) {
1424       switch (t) {
1425       case T_INT:
1426       case T_FLOAT:
1427         if (c->as_jint_bits() != other->as_jint_bits()) continue;
1428         break;
1429       case T_LONG:
1430       case T_DOUBLE:
1431         if (c->as_jint_hi_bits() != other->as_jint_hi_bits()) continue;
1432         if (c->as_jint_lo_bits() != other->as_jint_lo_bits()) continue;
1433         break;
1434       case T_OBJECT:
1435         if (c->as_jobject() != other->as_jobject()) continue;
1436         break;


1437       }
1438       return _reg_for_constants.at(i);
1439     }
1440   }
1441 
1442   LIR_Opr result = new_register(t);
1443   __ move((LIR_Opr)c, result);
1444   _constants.append(c);
1445   _reg_for_constants.append(result);
1446   return result;
1447 }
1448 
1449 // Various barriers
1450 
1451 void LIRGenerator::pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
1452                                bool do_load, bool patch, CodeEmitInfo* info) {
1453   // Do the pre-write barrier, if any.
1454   switch (_bs->kind()) {
1455 #if INCLUDE_ALL_GCS
1456     case BarrierSet::G1SATBCTLogging:


2787 void LIRGenerator::do_Base(Base* x) {
2788   __ std_entry(LIR_OprFact::illegalOpr);
2789   // Emit moves from physical registers / stack slots to virtual registers
2790   CallingConvention* args = compilation()->frame_map()->incoming_arguments();
2791   IRScope* irScope = compilation()->hir()->top_scope();
2792   int java_index = 0;
2793   for (int i = 0; i < args->length(); i++) {
2794     LIR_Opr src = args->at(i);
2795     assert(!src->is_illegal(), "check");
2796     BasicType t = src->type();
2797 
2798     // Types which are smaller than int are passed as int, so
2799     // correct the type which passed.
2800     switch (t) {
2801     case T_BYTE:
2802     case T_BOOLEAN:
2803     case T_SHORT:
2804     case T_CHAR:
2805       t = T_INT;
2806       break;


2807     }
2808 
2809     LIR_Opr dest = new_register(t);
2810     __ move(src, dest);
2811 
2812     // Assign new location to Local instruction for this local
2813     Local* local = x->state()->local_at(java_index)->as_Local();
2814     assert(local != NULL, "Locals for incoming arguments must have been created");
2815 #ifndef __SOFTFP__
2816     // The java calling convention passes double as long and float as int.
2817     assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
2818 #endif // __SOFTFP__
2819     local->set_operand(dest);
2820     _instruction_for_operand.at_put_grow(dest->vreg_number(), local, NULL);
2821     java_index += type2size[t];
2822   }
2823 
2824   if (compilation()->env()->dtrace_method_probes()) {
2825     BasicTypeList signature;
2826     signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT));    // thread




 377 // This is where the tree-walk starts; instr must be root;
 378 void LIRGenerator::do_root(Value instr) {
 379   CHECK_BAILOUT();
 380 
 381   InstructionMark im(compilation(), instr);
 382 
 383   assert(instr->is_pinned(), "use only with roots");
 384   assert(instr->subst() == instr, "shouldn't have missed substitution");
 385 
 386   instr->visit(this);
 387 
 388   assert(!instr->has_uses() || instr->operand()->is_valid() ||
 389          instr->as_Constant() != NULL || bailed_out(), "invalid item set");
 390 }
 391 
 392 
 393 // This is called for each node in tree; the walk stops if a root is reached
 394 void LIRGenerator::walk(Value instr) {
 395   InstructionMark im(compilation(), instr);
 396   //stop walk when encounter a root
 397   if ((instr->is_pinned() && instr->as_Phi() == NULL) || instr->operand()->is_valid()) {
 398     assert(instr->operand() != LIR_OprFact::illegalOpr || instr->as_Constant() != NULL, "this root has not yet been visited");
 399   } else {
 400     assert(instr->subst() == instr, "shouldn't have missed substitution");
 401     instr->visit(this);
 402     // assert(instr->use_count() > 0 || instr->as_Phi() != NULL, "leaf instruction must have a use");
 403   }
 404 }
 405 
 406 
 407 CodeEmitInfo* LIRGenerator::state_for(Instruction* x, ValueStack* state, bool ignore_xhandler) {
 408   assert(state != NULL, "state must be defined");
 409 
 410 #ifndef PRODUCT
 411   state->verify();
 412 #endif
 413 
 414   ValueStack* s = state;
 415   for_each_state(s) {
 416     if (s->kind() == ValueStack::EmptyExceptionState) {
 417       assert(s->stack_size() == 0 && s->locals_size() == 0 && (s->locks_size() == 0 || s->locks_size() == 1), "state must be empty");


1417 
1418 
1419 LIR_Opr LIRGenerator::load_constant(LIR_Const* c) {
1420   BasicType t = c->type();
1421   for (int i = 0; i < _constants.length(); i++) {
1422     LIR_Const* other = _constants.at(i);
1423     if (t == other->type()) {
1424       switch (t) {
1425       case T_INT:
1426       case T_FLOAT:
1427         if (c->as_jint_bits() != other->as_jint_bits()) continue;
1428         break;
1429       case T_LONG:
1430       case T_DOUBLE:
1431         if (c->as_jint_hi_bits() != other->as_jint_hi_bits()) continue;
1432         if (c->as_jint_lo_bits() != other->as_jint_lo_bits()) continue;
1433         break;
1434       case T_OBJECT:
1435         if (c->as_jobject() != other->as_jobject()) continue;
1436         break;
1437       default:
1438         break;
1439       }
1440       return _reg_for_constants.at(i);
1441     }
1442   }
1443 
1444   LIR_Opr result = new_register(t);
1445   __ move((LIR_Opr)c, result);
1446   _constants.append(c);
1447   _reg_for_constants.append(result);
1448   return result;
1449 }
1450 
1451 // Various barriers
1452 
1453 void LIRGenerator::pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
1454                                bool do_load, bool patch, CodeEmitInfo* info) {
1455   // Do the pre-write barrier, if any.
1456   switch (_bs->kind()) {
1457 #if INCLUDE_ALL_GCS
1458     case BarrierSet::G1SATBCTLogging:


2789 void LIRGenerator::do_Base(Base* x) {
2790   __ std_entry(LIR_OprFact::illegalOpr);
2791   // Emit moves from physical registers / stack slots to virtual registers
2792   CallingConvention* args = compilation()->frame_map()->incoming_arguments();
2793   IRScope* irScope = compilation()->hir()->top_scope();
2794   int java_index = 0;
2795   for (int i = 0; i < args->length(); i++) {
2796     LIR_Opr src = args->at(i);
2797     assert(!src->is_illegal(), "check");
2798     BasicType t = src->type();
2799 
2800     // Types which are smaller than int are passed as int, so
2801     // correct the type which passed.
2802     switch (t) {
2803     case T_BYTE:
2804     case T_BOOLEAN:
2805     case T_SHORT:
2806     case T_CHAR:
2807       t = T_INT;
2808       break;
2809     default:
2810       break;
2811     }
2812 
2813     LIR_Opr dest = new_register(t);
2814     __ move(src, dest);
2815 
2816     // Assign new location to Local instruction for this local
2817     Local* local = x->state()->local_at(java_index)->as_Local();
2818     assert(local != NULL, "Locals for incoming arguments must have been created");
2819 #ifndef __SOFTFP__
2820     // The java calling convention passes double as long and float as int.
2821     assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
2822 #endif // __SOFTFP__
2823     local->set_operand(dest);
2824     _instruction_for_operand.at_put_grow(dest->vreg_number(), local, NULL);
2825     java_index += type2size[t];
2826   }
2827 
2828   if (compilation()->env()->dtrace_method_probes()) {
2829     BasicTypeList signature;
2830     signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT));    // thread


< prev index next >