Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 2938:c7783b6773ea
fixed graph start frame state
new option: DeoptALot
lots of fixes to debug info handling in graalCodeInstaller
fix to uncommon trap stub
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 10 Jun 2011 19:50:16 +0200 |
parents | d577d07cedec |
children | 0c0e407faa39 |
comparison
equal
deleted
inserted
replaced
2936:3fa0e12d524a | 2938:c7783b6773ea |
---|---|
104 | 104 |
105 return map; | 105 return map; |
106 } | 106 } |
107 | 107 |
108 // TODO: finish this - graal doesn't provide any scope values at the moment | 108 // TODO: finish this - graal doesn't provide any scope values at the moment |
109 static ScopeValue* get_hotspot_value(oop value, int frame_size) { | 109 static ScopeValue* get_hotspot_value(oop value, int frame_size, ScopeValue* &second) { |
110 second = NULL; | |
110 if (value == CiValue::IllegalValue()) { | 111 if (value == CiValue::IllegalValue()) { |
111 return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); | 112 return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); |
112 } | 113 } |
113 | 114 |
114 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(CiValue::kind(value))); | 115 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(CiValue::kind(value))); |
115 Location::Type locationType = Location::normal; | 116 Location::Type locationType = Location::normal; |
116 if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop; | 117 if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop; |
118 | |
117 if (value->is_a(CiRegisterValue::klass())) { | 119 if (value->is_a(CiRegisterValue::klass())) { |
118 jint number = CiRegister::number(CiRegisterValue::reg(value)); | 120 jint number = CiRegister::number(CiRegisterValue::reg(value)); |
119 if (number < 16) { | 121 if (number < 16) { |
120 return new LocationValue(Location::new_reg_loc(locationType, as_Register(number)->as_VMReg())); | 122 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { |
123 locationType = Location::int_in_long; | |
124 } else if (type == T_LONG) { | |
125 locationType = Location::lng; | |
126 } else { | |
127 assert(type == T_OBJECT || type == T_ARRAY, "unexpected type in cpu register"); | |
128 } | |
129 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_Register(number)->as_VMReg())); | |
130 if (type == T_LONG) { | |
131 second = value; | |
132 } | |
133 return value; | |
121 } else { | 134 } else { |
122 return new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg())); | 135 assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register"); |
136 if (type == T_FLOAT) { | |
137 // this seems weird, but the same value is used in c1_LinearScan | |
138 locationType = Location::normal; | |
139 } else { | |
140 locationType = Location::dbl; | |
141 } | |
142 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg())); | |
143 if (type == T_DOUBLE) { | |
144 second = value; | |
145 } | |
146 return value; | |
123 } | 147 } |
124 } else if (value->is_a(CiStackSlot::klass())) { | 148 } else if (value->is_a(CiStackSlot::klass())) { |
149 if (type == T_DOUBLE) { | |
150 locationType = Location::dbl; | |
151 } else if (type == T_LONG) { | |
152 locationType = Location::lng; | |
153 } | |
125 jint index = CiStackSlot::index(value); | 154 jint index = CiStackSlot::index(value); |
155 ScopeValue* value; | |
126 if (index >= 0) { | 156 if (index >= 0) { |
127 return new LocationValue(Location::new_stk_loc(locationType, index * HeapWordSize)); | 157 value = new LocationValue(Location::new_stk_loc(locationType, index * HeapWordSize)); |
128 } else { | 158 } else { |
129 int frame_size_bytes = frame_size + 2 * HeapWordSize; | 159 int frame_size_bytes = frame_size + 2 * HeapWordSize; |
130 return new LocationValue(Location::new_stk_loc(locationType, -(index * HeapWordSize) + frame_size_bytes)); | 160 value = new LocationValue(Location::new_stk_loc(locationType, -(index * HeapWordSize) + frame_size_bytes)); |
131 } | 161 } |
162 if (type == T_DOUBLE || type == T_LONG) { | |
163 second = value; | |
164 } | |
165 return value; | |
132 } else if (value->is_a(CiConstant::klass())){ | 166 } else if (value->is_a(CiConstant::klass())){ |
133 oop obj = CiConstant::object(value); | 167 oop obj = CiConstant::object(value); |
134 jlong prim = CiConstant::primitive(value); | 168 jlong prim = CiConstant::primitive(value); |
135 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { | 169 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { |
136 return new ConstantIntValue(*(jint*)&prim); | 170 return new ConstantIntValue(*(jint*)&prim); |
137 } else if (type == T_LONG || type == T_DOUBLE) { | 171 } else if (type == T_LONG || type == T_DOUBLE) { |
172 second = new ConstantIntValue(0); | |
138 return new ConstantLongValue(prim); | 173 return new ConstantLongValue(prim); |
139 } else if (type == T_OBJECT) { | 174 } else if (type == T_OBJECT) { |
140 oop obj = CiConstant::object(value); | 175 oop obj = CiConstant::object(value); |
141 if (obj == NULL) { | 176 if (obj == NULL) { |
142 return new ConstantOopWriteValue(NULL); | 177 return new ConstantOopWriteValue(NULL); |
431 tty->print_cr("Scope at bci %d with %d values", bci, values->length()); | 466 tty->print_cr("Scope at bci %d with %d values", bci, values->length()); |
432 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); | 467 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); |
433 } | 468 } |
434 | 469 |
435 for (jint i = 0; i < values->length(); i++) { | 470 for (jint i = 0; i < values->length(); i++) { |
436 ScopeValue* value = get_hotspot_value(((oop*) values->base(T_OBJECT))[i], _frame_size); | 471 ScopeValue* second = NULL; |
472 ScopeValue* value = get_hotspot_value(((oop*) values->base(T_OBJECT))[i], _frame_size, second); | |
437 | 473 |
438 if (i < local_count) { | 474 if (i < local_count) { |
475 if (second != NULL) { | |
476 locals->append(second); | |
477 } | |
439 locals->append(value); | 478 locals->append(value); |
440 } else if (i < local_count + expression_count) { | 479 } else if (i < local_count + expression_count) { |
480 if (second != NULL) { | |
481 expressions->append(value); | |
482 } | |
441 expressions->append(value); | 483 expressions->append(value); |
442 } else { | 484 } else { |
485 assert(second == NULL, "monitor cannot occupy two stack slots"); | |
443 assert(value->is_location(), "invalid monitor location"); | 486 assert(value->is_location(), "invalid monitor location"); |
444 LocationValue* loc = (LocationValue*)value; | 487 LocationValue* loc = (LocationValue*)value; |
445 int monitor_offset = loc->location().stack_offset(); | 488 int monitor_offset = loc->location().stack_offset(); |
446 LocationValue* obj = new LocationValue(Location::new_stk_loc(Location::oop, monitor_offset + BasicObjectLock::obj_offset_in_bytes())); | 489 LocationValue* obj = new LocationValue(Location::new_stk_loc(Location::oop, monitor_offset + BasicObjectLock::obj_offset_in_bytes())); |
447 monitors->append(new MonitorValue(obj, Location::new_stk_loc(Location::normal, monitor_offset + BasicObjectLock::lock_offset_in_bytes()))); | 490 monitors->append(new MonitorValue(obj, Location::new_stk_loc(Location::normal, monitor_offset + BasicObjectLock::lock_offset_in_bytes()))); |
491 } | |
492 if (second != NULL) { | |
493 i++; | |
494 assert(i < values->length(), "double-slot value not followed by CiValue.IllegalValue"); | |
495 assert(((oop*) values->base(T_OBJECT))[i] == CiValue::IllegalValue(), "double-slot value not followed by CiValue.IllegalValue"); | |
448 } | 496 } |
449 } | 497 } |
450 DebugToken* locals_token = _debug_recorder->create_scope_values(locals); | 498 DebugToken* locals_token = _debug_recorder->create_scope_values(locals); |
451 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions); | 499 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions); |
452 DebugToken* monitors_token = _debug_recorder->create_monitor_values(monitors); | 500 DebugToken* monitors_token = _debug_recorder->create_monitor_values(monitors); |