2462 } |
2462 } |
2463 } |
2463 } |
2464 |
2464 |
2465 |
2465 |
2466 // frequently used constants |
2466 // frequently used constants |
2467 ConstantOopWriteValue LinearScan::_oop_null_scope_value = ConstantOopWriteValue(NULL); |
2467 // Allocate them with new so they are never destroyed (otherwise, a |
2468 ConstantIntValue LinearScan::_int_m1_scope_value = ConstantIntValue(-1); |
2468 // forced exit could destroy these objects while they are still in |
2469 ConstantIntValue LinearScan::_int_0_scope_value = ConstantIntValue(0); |
2469 // use). |
2470 ConstantIntValue LinearScan::_int_1_scope_value = ConstantIntValue(1); |
2470 ConstantOopWriteValue* LinearScan::_oop_null_scope_value = new (ResourceObj::C_HEAP) ConstantOopWriteValue(NULL); |
2471 ConstantIntValue LinearScan::_int_2_scope_value = ConstantIntValue(2); |
2471 ConstantIntValue* LinearScan::_int_m1_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(-1); |
2472 LocationValue _illegal_value = LocationValue(Location()); |
2472 ConstantIntValue* LinearScan::_int_0_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(0); |
|
2473 ConstantIntValue* LinearScan::_int_1_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(1); |
|
2474 ConstantIntValue* LinearScan::_int_2_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(2); |
|
2475 LocationValue* _illegal_value = new (ResourceObj::C_HEAP) LocationValue(Location()); |
2473 |
2476 |
2474 void LinearScan::init_compute_debug_info() { |
2477 void LinearScan::init_compute_debug_info() { |
2475 // cache for frequently used scope values |
2478 // cache for frequently used scope values |
2476 // (cpu registers and stack slots) |
2479 // (cpu registers and stack slots) |
2477 _scope_value_cache = ScopeValueArray((LinearScan::nof_cpu_regs + frame_map()->argcount() + max_spills()) * 2, NULL); |
2480 _scope_value_cache = ScopeValueArray((LinearScan::nof_cpu_regs + frame_map()->argcount() + max_spills()) * 2, NULL); |
2506 BasicType t = c->type(); |
2509 BasicType t = c->type(); |
2507 switch (t) { |
2510 switch (t) { |
2508 case T_OBJECT: { |
2511 case T_OBJECT: { |
2509 jobject value = c->as_jobject(); |
2512 jobject value = c->as_jobject(); |
2510 if (value == NULL) { |
2513 if (value == NULL) { |
2511 scope_values->append(&_oop_null_scope_value); |
2514 scope_values->append(_oop_null_scope_value); |
2512 } else { |
2515 } else { |
2513 scope_values->append(new ConstantOopWriteValue(c->as_jobject())); |
2516 scope_values->append(new ConstantOopWriteValue(c->as_jobject())); |
2514 } |
2517 } |
2515 return 1; |
2518 return 1; |
2516 } |
2519 } |
2517 |
2520 |
2518 case T_INT: // fall through |
2521 case T_INT: // fall through |
2519 case T_FLOAT: { |
2522 case T_FLOAT: { |
2520 int value = c->as_jint_bits(); |
2523 int value = c->as_jint_bits(); |
2521 switch (value) { |
2524 switch (value) { |
2522 case -1: scope_values->append(&_int_m1_scope_value); break; |
2525 case -1: scope_values->append(_int_m1_scope_value); break; |
2523 case 0: scope_values->append(&_int_0_scope_value); break; |
2526 case 0: scope_values->append(_int_0_scope_value); break; |
2524 case 1: scope_values->append(&_int_1_scope_value); break; |
2527 case 1: scope_values->append(_int_1_scope_value); break; |
2525 case 2: scope_values->append(&_int_2_scope_value); break; |
2528 case 2: scope_values->append(_int_2_scope_value); break; |
2526 default: scope_values->append(new ConstantIntValue(c->as_jint_bits())); break; |
2529 default: scope_values->append(new ConstantIntValue(c->as_jint_bits())); break; |
2527 } |
2530 } |
2528 return 1; |
2531 return 1; |
2529 } |
2532 } |
2530 |
2533 |
2531 case T_LONG: // fall through |
2534 case T_LONG: // fall through |
2532 case T_DOUBLE: { |
2535 case T_DOUBLE: { |
2533 #ifdef _LP64 |
2536 #ifdef _LP64 |
2534 scope_values->append(&_int_0_scope_value); |
2537 scope_values->append(_int_0_scope_value); |
2535 scope_values->append(new ConstantLongValue(c->as_jlong_bits())); |
2538 scope_values->append(new ConstantLongValue(c->as_jlong_bits())); |
2536 #else |
2539 #else |
2537 if (hi_word_offset_in_bytes > lo_word_offset_in_bytes) { |
2540 if (hi_word_offset_in_bytes > lo_word_offset_in_bytes) { |
2538 scope_values->append(new ConstantIntValue(c->as_jint_hi_bits())); |
2541 scope_values->append(new ConstantIntValue(c->as_jint_hi_bits())); |
2539 scope_values->append(new ConstantIntValue(c->as_jint_lo_bits())); |
2542 scope_values->append(new ConstantIntValue(c->as_jint_lo_bits())); |
2655 if (!frame_map()->locations_for_slot(opr->double_stack_ix(), loc_type, &loc1, NULL)) { |
2658 if (!frame_map()->locations_for_slot(opr->double_stack_ix(), loc_type, &loc1, NULL)) { |
2656 bailout("too large frame"); |
2659 bailout("too large frame"); |
2657 } |
2660 } |
2658 // Does this reverse on x86 vs. sparc? |
2661 // Does this reverse on x86 vs. sparc? |
2659 first = new LocationValue(loc1); |
2662 first = new LocationValue(loc1); |
2660 second = &_int_0_scope_value; |
2663 second = _int_0_scope_value; |
2661 #else |
2664 #else |
2662 Location loc1, loc2; |
2665 Location loc1, loc2; |
2663 if (!frame_map()->locations_for_slot(opr->double_stack_ix(), Location::normal, &loc1, &loc2)) { |
2666 if (!frame_map()->locations_for_slot(opr->double_stack_ix(), Location::normal, &loc1, &loc2)) { |
2664 bailout("too large frame"); |
2667 bailout("too large frame"); |
2665 } |
2668 } |
2669 |
2672 |
2670 } else if (opr->is_double_cpu()) { |
2673 } else if (opr->is_double_cpu()) { |
2671 #ifdef _LP64 |
2674 #ifdef _LP64 |
2672 VMReg rname_first = opr->as_register_lo()->as_VMReg(); |
2675 VMReg rname_first = opr->as_register_lo()->as_VMReg(); |
2673 first = new LocationValue(Location::new_reg_loc(Location::lng, rname_first)); |
2676 first = new LocationValue(Location::new_reg_loc(Location::lng, rname_first)); |
2674 second = &_int_0_scope_value; |
2677 second = _int_0_scope_value; |
2675 #else |
2678 #else |
2676 VMReg rname_first = opr->as_register_lo()->as_VMReg(); |
2679 VMReg rname_first = opr->as_register_lo()->as_VMReg(); |
2677 VMReg rname_second = opr->as_register_hi()->as_VMReg(); |
2680 VMReg rname_second = opr->as_register_hi()->as_VMReg(); |
2678 |
2681 |
2679 if (hi_word_offset_in_bytes < lo_word_offset_in_bytes) { |
2682 if (hi_word_offset_in_bytes < lo_word_offset_in_bytes) { |
2692 } else if (opr->is_double_xmm()) { |
2695 } else if (opr->is_double_xmm()) { |
2693 assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation"); |
2696 assert(opr->fpu_regnrLo() == opr->fpu_regnrHi(), "assumed in calculation"); |
2694 VMReg rname_first = opr->as_xmm_double_reg()->as_VMReg(); |
2697 VMReg rname_first = opr->as_xmm_double_reg()->as_VMReg(); |
2695 # ifdef _LP64 |
2698 # ifdef _LP64 |
2696 first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first)); |
2699 first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first)); |
2697 second = &_int_0_scope_value; |
2700 second = _int_0_scope_value; |
2698 # else |
2701 # else |
2699 first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first)); |
2702 first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first)); |
2700 // %%% This is probably a waste but we'll keep things as they were for now |
2703 // %%% This is probably a waste but we'll keep things as they were for now |
2701 if (true) { |
2704 if (true) { |
2702 VMReg rname_second = rname_first->next(); |
2705 VMReg rname_second = rname_first->next(); |
2739 VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi()); |
2742 VMReg rname_first = frame_map()->fpu_regname(opr->fpu_regnrHi()); |
2740 #endif |
2743 #endif |
2741 |
2744 |
2742 #ifdef _LP64 |
2745 #ifdef _LP64 |
2743 first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first)); |
2746 first = new LocationValue(Location::new_reg_loc(Location::dbl, rname_first)); |
2744 second = &_int_0_scope_value; |
2747 second = _int_0_scope_value; |
2745 #else |
2748 #else |
2746 first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first)); |
2749 first = new LocationValue(Location::new_reg_loc(Location::normal, rname_first)); |
2747 // %%% This is probably a waste but we'll keep things as they were for now |
2750 // %%% This is probably a waste but we'll keep things as they were for now |
2748 if (true) { |
2751 if (true) { |
2749 VMReg rname_second = rname_first->next(); |
2752 VMReg rname_second = rname_first->next(); |
2863 } else if (cur_scope->method()->max_locals() > 0) { |
2866 } else if (cur_scope->method()->max_locals() > 0) { |
2864 assert(cur_state->kind() == ValueStack::EmptyExceptionState, "should be"); |
2867 assert(cur_state->kind() == ValueStack::EmptyExceptionState, "should be"); |
2865 nof_locals = cur_scope->method()->max_locals(); |
2868 nof_locals = cur_scope->method()->max_locals(); |
2866 locals = new GrowableArray<ScopeValue*>(nof_locals); |
2869 locals = new GrowableArray<ScopeValue*>(nof_locals); |
2867 for(int i = 0; i < nof_locals; i++) { |
2870 for(int i = 0; i < nof_locals; i++) { |
2868 locals->append(&_illegal_value); |
2871 locals->append(_illegal_value); |
2869 } |
2872 } |
2870 } |
2873 } |
2871 |
2874 |
2872 // describe expression stack |
2875 // describe expression stack |
2873 int nof_stack = cur_state->stack_size(); |
2876 int nof_stack = cur_state->stack_size(); |