提交 290c90c2 编写于 作者: K kevinw

8146518: Zero interpreter broken with better byte behaviour

Reviewed-by: coleenp
上级 6433561e
...@@ -93,6 +93,7 @@ intptr_t narrow(BasicType type, intptr_t result) { ...@@ -93,6 +93,7 @@ intptr_t narrow(BasicType type, intptr_t result) {
case T_SHORT: case T_SHORT:
return (intptr_t)(jshort)result; return (intptr_t)(jshort)result;
case T_OBJECT: // nothing to do fall through case T_OBJECT: // nothing to do fall through
case T_ARRAY:
case T_LONG: case T_LONG:
case T_INT: case T_INT:
case T_FLOAT: case T_FLOAT:
...@@ -183,7 +184,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) { ...@@ -183,7 +184,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
} }
else if (istate->msg() == BytecodeInterpreter::return_from_method) { else if (istate->msg() == BytecodeInterpreter::return_from_method) {
// Copy the result into the caller's frame // 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?"); assert(result_slots >= 0 && result_slots <= 2, "what?");
result = istate->stack() + result_slots; result = istate->stack() + result_slots;
break; break;
...@@ -221,7 +222,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) { ...@@ -221,7 +222,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) {
// Adjust result to smaller // Adjust result to smaller
intptr_t res = result[-i]; intptr_t res = result[-i];
if (result_slots == 1) { if (result_slots == 1) {
res = narrow(result_type_of(method), res); res = narrow(method->result_type(), res);
} }
stack->push(res); stack->push(res);
} }
...@@ -435,7 +436,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) { ...@@ -435,7 +436,7 @@ int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
// Push our result // Push our result
if (!HAS_PENDING_EXCEPTION) { if (!HAS_PENDING_EXCEPTION) {
BasicType type = result_type_of(method); BasicType type = method->result_type();
stack->set_sp(stack->sp() - type2size[type]); stack->set_sp(stack->sp() - type2size[type]);
switch (type) { switch (type) {
...@@ -795,26 +796,6 @@ int AbstractInterpreter::BasicType_as_index(BasicType type) { ...@@ -795,26 +796,6 @@ int AbstractInterpreter::BasicType_as_index(BasicType type) {
return i; return i;
} }
BasicType CppInterpreter::result_type_of(Method* method) {
BasicType t;
switch (method->result_index()) {
case 0 : t = T_BOOLEAN; break;
case 1 : t = T_CHAR; break;
case 2 : t = T_BYTE; break;
case 3 : t = T_SHORT; break;
case 4 : t = T_INT; break;
case 5 : t = T_LONG; break;
case 6 : t = T_VOID; break;
case 7 : t = T_FLOAT; break;
case 8 : t = T_DOUBLE; break;
case 9 : t = T_OBJECT; break;
default: ShouldNotReachHere();
}
assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(),
"out of step with AbstractInterpreter::BasicType_as_index");
return t;
}
address InterpreterGenerator::generate_empty_entry() { address InterpreterGenerator::generate_empty_entry() {
if (!UseFastEmptyMethods) if (!UseFastEmptyMethods)
return NULL; return NULL;
......
/* /*
* 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. * Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
...@@ -49,8 +49,4 @@ ...@@ -49,8 +49,4 @@
static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle); static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle);
static void throw_exception(JavaThread* thread, Symbol* name,char *msg=NULL); 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 #endif // CPU_ZERO_VM_CPPINTERPRETER_ZERO_HPP
...@@ -84,9 +84,6 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) { ...@@ -84,9 +84,6 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) {
set_constMethod(xconst); set_constMethod(xconst);
set_access_flags(access_flags); set_access_flags(access_flags);
set_method_size(size); set_method_size(size);
#ifdef CC_INTERP
set_result_index(T_VOID);
#endif
set_intrinsic_id(vmIntrinsics::_none); set_intrinsic_id(vmIntrinsics::_none);
set_jfr_towrite(false); set_jfr_towrite(false);
set_force_inline(false); set_force_inline(false);
...@@ -412,12 +409,6 @@ void Method::compute_size_of_parameters(Thread *thread) { ...@@ -412,12 +409,6 @@ void Method::compute_size_of_parameters(Thread *thread) {
set_size_of_parameters(asc.size() + (is_static() ? 0 : 1)); 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 { BasicType Method::result_type() const {
ResultTypeFinder rtf(signature()); ResultTypeFinder rtf(signature());
return rtf.type(); return rtf.type();
......
/* /*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -105,9 +105,6 @@ class Method : public Metadata { ...@@ -105,9 +105,6 @@ class Method : public Metadata {
AccessFlags _access_flags; // Access flags AccessFlags _access_flags; // Access flags
int _vtable_index; // vtable index of this method (see VtableIndexFlag) int _vtable_index; // vtable index of this method (see VtableIndexFlag)
// note: can have vtables with >2**16 elements (because of inheritance) // 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 _method_size; // size of this object u2 _method_size; // size of this object
u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
u1 _jfr_towrite : 1, // Flags u1 _jfr_towrite : 1, // Flags
...@@ -202,11 +199,6 @@ class Method : public Metadata { ...@@ -202,11 +199,6 @@ class Method : public Metadata {
return constMethod()->type_annotations(); 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 // Helper routine: get klass name + "." + method name + signature as
// C string, for the purpose of providing more useful NoSuchMethodErrors // C string, for the purpose of providing more useful NoSuchMethodErrors
// and fatal error handling. The string is allocated in resource // and fatal error handling. The string is allocated in resource
...@@ -559,7 +551,6 @@ class Method : public Metadata { ...@@ -559,7 +551,6 @@ class Method : public Metadata {
void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments) 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 Symbol* klass_name() const; // returns the name of the method holder
BasicType result_type() const; // type of the method result 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_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); } bool is_returning_fp() const { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }
...@@ -652,9 +643,6 @@ class Method : public Metadata { ...@@ -652,9 +643,6 @@ class Method : public Metadata {
// interpreter support // interpreter support
static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); } static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); }
static ByteSize access_flags_offset() { return byte_offset_of(Method, _access_flags ); } 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 from_compiled_offset() { return byte_offset_of(Method, _from_compiled_entry); }
static ByteSize code_offset() { return byte_offset_of(Method, _code); } static ByteSize code_offset() { return byte_offset_of(Method, _code); }
static ByteSize method_data_offset() { static ByteSize method_data_offset() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册