8146518: Zero interpreter broken with better byte behaviours
Summary: replaced Method::_result_type_index with Method::_result_type for better byte behaviours should be used for Zero also.
Reviewed-by: roland, kvn, bdelsart, kevinw
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Tue Oct 13 18:13:34 2015 -0400
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu Jan 07 13:59:49 2016 -0500
@@ -94,6 +94,7 @@
case T_SHORT:
return (intptr_t)(jshort)result;
case T_OBJECT: // nothing to do fall through
+ case T_ARRAY:
case T_LONG:
case T_INT:
case T_FLOAT:
@@ -184,7 +185,7 @@
}
else if (istate->msg() == BytecodeInterpreter::return_from_method) {
// Copy the result into the caller's frame
- result_slots = type2size[result_type_of(method)];
+ result_slots = type2size[method->result_type()];
assert(result_slots >= 0 && result_slots <= 2, "what?");
result = istate->stack() + result_slots;
break;
@@ -222,7 +223,7 @@
// Adjust result to smaller
intptr_t res = result[-i];
if (result_slots == 1) {
- res = narrow(result_type_of(method), res);
+ res = narrow(method->result_type(), res);
}
stack->push(res);
}
@@ -436,7 +437,7 @@
// Push our result
if (!HAS_PENDING_EXCEPTION) {
- BasicType type = result_type_of(method);
+ BasicType type = method->result_type();
stack->set_sp(stack->sp() - type2size[type]);
switch (type) {
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp Tue Oct 13 18:13:34 2015 -0400
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp Thu Jan 07 13:59:49 2016 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -49,8 +49,4 @@
static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle);
static void throw_exception(JavaThread* thread, Symbol* name,char *msg=NULL);
- private:
- // Fast result type determination
- static BasicType result_type_of(Method* method);
-
#endif // CPU_ZERO_VM_CPPINTERPRETER_ZERO_HPP
--- a/hotspot/src/share/vm/oops/method.cpp Tue Oct 13 18:13:34 2015 -0400
+++ b/hotspot/src/share/vm/oops/method.cpp Thu Jan 07 13:59:49 2016 -0500
@@ -84,9 +84,6 @@
NoSafepointVerifier no_safepoint;
set_constMethod(xconst);
set_access_flags(access_flags);
-#ifdef CC_INTERP
- set_result_index(T_VOID);
-#endif
set_intrinsic_id(vmIntrinsics::_none);
set_jfr_towrite(false);
set_force_inline(false);
@@ -445,12 +442,6 @@
set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
}
-#ifdef CC_INTERP
-void Method::set_result_index(BasicType type) {
- _result_index = Interpreter::BasicType_as_index(type);
-}
-#endif
-
BasicType Method::result_type() const {
ResultTypeFinder rtf(signature());
return rtf.type();
--- a/hotspot/src/share/vm/oops/method.hpp Tue Oct 13 18:13:34 2015 -0400
+++ b/hotspot/src/share/vm/oops/method.hpp Thu Jan 07 13:59:49 2016 -0500
@@ -69,9 +69,6 @@
AccessFlags _access_flags; // Access flags
int _vtable_index; // vtable index of this method (see VtableIndexFlag)
// note: can have vtables with >2**16 elements (because of inheritance)
-#ifdef CC_INTERP
- int _result_index; // C++ interpreter needs for converting results to/from stack
-#endif
u2 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
// Flags
@@ -171,11 +168,6 @@
return constMethod()->type_annotations();
}
-#ifdef CC_INTERP
- void set_result_index(BasicType type);
- int result_index() { return _result_index; }
-#endif
-
// Helper routine: get klass name + "." + method name + signature as
// C string, for the purpose of providing more useful NoSuchMethodErrors
// and fatal error handling. The string is allocated in resource
@@ -552,7 +544,6 @@
void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
Symbol* klass_name() const; // returns the name of the method holder
BasicType result_type() const; // type of the method result
- int result_type_index() const; // type index of the method result
bool is_returning_oop() const { BasicType r = result_type(); return (r == T_OBJECT || r == T_ARRAY); }
bool is_returning_fp() const { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }
@@ -653,9 +644,6 @@
// interpreter support
static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); }
static ByteSize access_flags_offset() { return byte_offset_of(Method, _access_flags ); }
-#ifdef CC_INTERP
- static ByteSize result_index_offset() { return byte_offset_of(Method, _result_index ); }
-#endif /* CC_INTERP */
static ByteSize from_compiled_offset() { return byte_offset_of(Method, _from_compiled_entry); }
static ByteSize code_offset() { return byte_offset_of(Method, _code); }
static ByteSize method_data_offset() {