提交 d6d88011 编写于 作者: K kvn

6926048: Improve Zero performance

Summary: Make Zero figure out result types in a similar way to C++ interpreter implementation.
Reviewed-by: kvn
Contributed-by: gbenson@redhat.com
上级 1030e3b5
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008, 2009 Red Hat, Inc. * Copyright 2007, 2008, 2009, 2010 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.
* *
* 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
...@@ -145,7 +145,7 @@ void CppInterpreter::main_loop(int recurse, TRAPS) { ...@@ -145,7 +145,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[method->result_type()]; result_slots = type2size[result_type_of(method)];
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;
...@@ -394,9 +394,10 @@ void CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) { ...@@ -394,9 +394,10 @@ void CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) {
// Push our result // Push our result
if (!HAS_PENDING_EXCEPTION) { if (!HAS_PENDING_EXCEPTION) {
stack->set_sp(stack->sp() - type2size[method->result_type()]); BasicType type = result_type_of(method);
stack->set_sp(stack->sp() - type2size[type]);
switch (method->result_type()) { switch (type) {
case T_VOID: case T_VOID:
break; break;
...@@ -707,6 +708,26 @@ int AbstractInterpreter::BasicType_as_index(BasicType type) { ...@@ -707,6 +708,26 @@ int AbstractInterpreter::BasicType_as_index(BasicType type) {
return i; return i;
} }
BasicType CppInterpreter::result_type_of(methodOop 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 1997-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007, 2008 Red Hat, Inc. * Copyright 2007, 2008, 2010 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.
* *
* 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
...@@ -41,3 +41,7 @@ ...@@ -41,3 +41,7 @@
private: private:
// Stack overflow checks // Stack overflow checks
static bool stack_overflow_imminent(JavaThread *thread); static bool stack_overflow_imminent(JavaThread *thread);
private:
// Fast result type determination
static BasicType result_type_of(methodOop method);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册