Mercurial > hg > graal-jvmci-8
comparison src/cpu/zero/vm/cppInterpreter_zero.cpp @ 23648:cc78c97abff8 jdk8u75-b12
8146518: Zero interpreter broken with better byte behaviour
Reviewed-by: coleenp
author | kevinw |
---|---|
date | Wed, 02 Mar 2016 19:16:30 +0000 |
parents | 32b682649973 |
children | b5f3a471e646 8f58998958ca |
comparison
equal
deleted
inserted
replaced
23643:352f1b2573b0 | 23648:cc78c97abff8 |
---|---|
91 case T_CHAR: | 91 case T_CHAR: |
92 return (intptr_t)(uintptr_t)(jchar)result; | 92 return (intptr_t)(uintptr_t)(jchar)result; |
93 case T_SHORT: | 93 case T_SHORT: |
94 return (intptr_t)(jshort)result; | 94 return (intptr_t)(jshort)result; |
95 case T_OBJECT: // nothing to do fall through | 95 case T_OBJECT: // nothing to do fall through |
96 case T_ARRAY: | |
96 case T_LONG: | 97 case T_LONG: |
97 case T_INT: | 98 case T_INT: |
98 case T_FLOAT: | 99 case T_FLOAT: |
99 case T_DOUBLE: | 100 case T_DOUBLE: |
100 case T_VOID: | 101 case T_VOID: |
181 // Resume the interpreter | 182 // Resume the interpreter |
182 istate->set_msg(BytecodeInterpreter::got_monitors); | 183 istate->set_msg(BytecodeInterpreter::got_monitors); |
183 } | 184 } |
184 else if (istate->msg() == BytecodeInterpreter::return_from_method) { | 185 else if (istate->msg() == BytecodeInterpreter::return_from_method) { |
185 // Copy the result into the caller's frame | 186 // Copy the result into the caller's frame |
186 result_slots = type2size[result_type_of(method)]; | 187 result_slots = type2size[method->result_type()]; |
187 assert(result_slots >= 0 && result_slots <= 2, "what?"); | 188 assert(result_slots >= 0 && result_slots <= 2, "what?"); |
188 result = istate->stack() + result_slots; | 189 result = istate->stack() + result_slots; |
189 break; | 190 break; |
190 } | 191 } |
191 else if (istate->msg() == BytecodeInterpreter::throwing_exception) { | 192 else if (istate->msg() == BytecodeInterpreter::throwing_exception) { |
219 // Push our result | 220 // Push our result |
220 for (int i = 0; i < result_slots; i++) { | 221 for (int i = 0; i < result_slots; i++) { |
221 // Adjust result to smaller | 222 // Adjust result to smaller |
222 intptr_t res = result[-i]; | 223 intptr_t res = result[-i]; |
223 if (result_slots == 1) { | 224 if (result_slots == 1) { |
224 res = narrow(result_type_of(method), res); | 225 res = narrow(method->result_type(), res); |
225 } | 226 } |
226 stack->push(res); | 227 stack->push(res); |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
433 // Pop our parameters | 434 // Pop our parameters |
434 stack->set_sp(stack->sp() + method->size_of_parameters()); | 435 stack->set_sp(stack->sp() + method->size_of_parameters()); |
435 | 436 |
436 // Push our result | 437 // Push our result |
437 if (!HAS_PENDING_EXCEPTION) { | 438 if (!HAS_PENDING_EXCEPTION) { |
438 BasicType type = result_type_of(method); | 439 BasicType type = method->result_type(); |
439 stack->set_sp(stack->sp() - type2size[type]); | 440 stack->set_sp(stack->sp() - type2size[type]); |
440 | 441 |
441 switch (type) { | 442 switch (type) { |
442 case T_VOID: | 443 case T_VOID: |
443 break; | 444 break; |
791 default : ShouldNotReachHere(); | 792 default : ShouldNotReachHere(); |
792 } | 793 } |
793 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, | 794 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, |
794 "index out of bounds"); | 795 "index out of bounds"); |
795 return i; | 796 return i; |
796 } | |
797 | |
798 BasicType CppInterpreter::result_type_of(Method* method) { | |
799 BasicType t; | |
800 switch (method->result_index()) { | |
801 case 0 : t = T_BOOLEAN; break; | |
802 case 1 : t = T_CHAR; break; | |
803 case 2 : t = T_BYTE; break; | |
804 case 3 : t = T_SHORT; break; | |
805 case 4 : t = T_INT; break; | |
806 case 5 : t = T_LONG; break; | |
807 case 6 : t = T_VOID; break; | |
808 case 7 : t = T_FLOAT; break; | |
809 case 8 : t = T_DOUBLE; break; | |
810 case 9 : t = T_OBJECT; break; | |
811 default: ShouldNotReachHere(); | |
812 } | |
813 assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(), | |
814 "out of step with AbstractInterpreter::BasicType_as_index"); | |
815 return t; | |
816 } | 797 } |
817 | 798 |
818 address InterpreterGenerator::generate_empty_entry() { | 799 address InterpreterGenerator::generate_empty_entry() { |
819 if (!UseFastEmptyMethods) | 800 if (!UseFastEmptyMethods) |
820 return NULL; | 801 return NULL; |