Wed, 02 Mar 2016 19:16:30 +0000
8146518: Zero interpreter broken with better byte behaviour
Reviewed-by: coleenp
1.1 --- a/src/cpu/zero/vm/cppInterpreter_zero.cpp Mon Feb 29 10:30:03 2016 -0800 1.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Wed Mar 02 19:16:30 2016 +0000 1.3 @@ -93,6 +93,7 @@ 1.4 case T_SHORT: 1.5 return (intptr_t)(jshort)result; 1.6 case T_OBJECT: // nothing to do fall through 1.7 + case T_ARRAY: 1.8 case T_LONG: 1.9 case T_INT: 1.10 case T_FLOAT: 1.11 @@ -183,7 +184,7 @@ 1.12 } 1.13 else if (istate->msg() == BytecodeInterpreter::return_from_method) { 1.14 // Copy the result into the caller's frame 1.15 - result_slots = type2size[result_type_of(method)]; 1.16 + result_slots = type2size[method->result_type()]; 1.17 assert(result_slots >= 0 && result_slots <= 2, "what?"); 1.18 result = istate->stack() + result_slots; 1.19 break; 1.20 @@ -221,7 +222,7 @@ 1.21 // Adjust result to smaller 1.22 intptr_t res = result[-i]; 1.23 if (result_slots == 1) { 1.24 - res = narrow(result_type_of(method), res); 1.25 + res = narrow(method->result_type(), res); 1.26 } 1.27 stack->push(res); 1.28 } 1.29 @@ -435,7 +436,7 @@ 1.30 1.31 // Push our result 1.32 if (!HAS_PENDING_EXCEPTION) { 1.33 - BasicType type = result_type_of(method); 1.34 + BasicType type = method->result_type(); 1.35 stack->set_sp(stack->sp() - type2size[type]); 1.36 1.37 switch (type) { 1.38 @@ -795,26 +796,6 @@ 1.39 return i; 1.40 } 1.41 1.42 -BasicType CppInterpreter::result_type_of(Method* method) { 1.43 - BasicType t; 1.44 - switch (method->result_index()) { 1.45 - case 0 : t = T_BOOLEAN; break; 1.46 - case 1 : t = T_CHAR; break; 1.47 - case 2 : t = T_BYTE; break; 1.48 - case 3 : t = T_SHORT; break; 1.49 - case 4 : t = T_INT; break; 1.50 - case 5 : t = T_LONG; break; 1.51 - case 6 : t = T_VOID; break; 1.52 - case 7 : t = T_FLOAT; break; 1.53 - case 8 : t = T_DOUBLE; break; 1.54 - case 9 : t = T_OBJECT; break; 1.55 - default: ShouldNotReachHere(); 1.56 - } 1.57 - assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(), 1.58 - "out of step with AbstractInterpreter::BasicType_as_index"); 1.59 - return t; 1.60 -} 1.61 - 1.62 address InterpreterGenerator::generate_empty_entry() { 1.63 if (!UseFastEmptyMethods) 1.64 return NULL;
2.1 --- a/src/cpu/zero/vm/cppInterpreter_zero.hpp Mon Feb 29 10:30:03 2016 -0800 2.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.hpp Wed Mar 02 19:16:30 2016 +0000 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 2.7 * Copyright 2007, 2008, 2010, 2011 Red Hat, Inc. 2.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.9 * 2.10 @@ -49,8 +49,4 @@ 2.11 static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle); 2.12 static void throw_exception(JavaThread* thread, Symbol* name,char *msg=NULL); 2.13 2.14 - private: 2.15 - // Fast result type determination 2.16 - static BasicType result_type_of(Method* method); 2.17 - 2.18 #endif // CPU_ZERO_VM_CPPINTERPRETER_ZERO_HPP
3.1 --- a/src/share/vm/oops/method.cpp Mon Feb 29 10:30:03 2016 -0800 3.2 +++ b/src/share/vm/oops/method.cpp Wed Mar 02 19:16:30 2016 +0000 3.3 @@ -84,9 +84,6 @@ 3.4 set_constMethod(xconst); 3.5 set_access_flags(access_flags); 3.6 set_method_size(size); 3.7 -#ifdef CC_INTERP 3.8 - set_result_index(T_VOID); 3.9 -#endif 3.10 set_intrinsic_id(vmIntrinsics::_none); 3.11 set_jfr_towrite(false); 3.12 set_force_inline(false); 3.13 @@ -412,12 +409,6 @@ 3.14 set_size_of_parameters(asc.size() + (is_static() ? 0 : 1)); 3.15 } 3.16 3.17 -#ifdef CC_INTERP 3.18 -void Method::set_result_index(BasicType type) { 3.19 - _result_index = Interpreter::BasicType_as_index(type); 3.20 -} 3.21 -#endif 3.22 - 3.23 BasicType Method::result_type() const { 3.24 ResultTypeFinder rtf(signature()); 3.25 return rtf.type();
4.1 --- a/src/share/vm/oops/method.hpp Mon Feb 29 10:30:03 2016 -0800 4.2 +++ b/src/share/vm/oops/method.hpp Wed Mar 02 19:16:30 2016 +0000 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -105,9 +105,6 @@ 4.11 AccessFlags _access_flags; // Access flags 4.12 int _vtable_index; // vtable index of this method (see VtableIndexFlag) 4.13 // note: can have vtables with >2**16 elements (because of inheritance) 4.14 -#ifdef CC_INTERP 4.15 - int _result_index; // C++ interpreter needs for converting results to/from stack 4.16 -#endif 4.17 u2 _method_size; // size of this object 4.18 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) 4.19 u1 _jfr_towrite : 1, // Flags 4.20 @@ -202,11 +199,6 @@ 4.21 return constMethod()->type_annotations(); 4.22 } 4.23 4.24 -#ifdef CC_INTERP 4.25 - void set_result_index(BasicType type); 4.26 - int result_index() { return _result_index; } 4.27 -#endif 4.28 - 4.29 // Helper routine: get klass name + "." + method name + signature as 4.30 // C string, for the purpose of providing more useful NoSuchMethodErrors 4.31 // and fatal error handling. The string is allocated in resource 4.32 @@ -559,7 +551,6 @@ 4.33 void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments) 4.34 Symbol* klass_name() const; // returns the name of the method holder 4.35 BasicType result_type() const; // type of the method result 4.36 - int result_type_index() const; // type index of the method result 4.37 bool is_returning_oop() const { BasicType r = result_type(); return (r == T_OBJECT || r == T_ARRAY); } 4.38 bool is_returning_fp() const { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); } 4.39 4.40 @@ -652,9 +643,6 @@ 4.41 // interpreter support 4.42 static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); } 4.43 static ByteSize access_flags_offset() { return byte_offset_of(Method, _access_flags ); } 4.44 -#ifdef CC_INTERP 4.45 - static ByteSize result_index_offset() { return byte_offset_of(Method, _result_index ); } 4.46 -#endif /* CC_INTERP */ 4.47 static ByteSize from_compiled_offset() { return byte_offset_of(Method, _from_compiled_entry); } 4.48 static ByteSize code_offset() { return byte_offset_of(Method, _code); } 4.49 static ByteSize method_data_offset() {