hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
changeset 4897 d5dd3852bf8d
parent 4568 d18b14983811
child 5229 54a4606c7383
equal deleted inserted replaced
4896:88b4193b82b0 4897:d5dd3852bf8d
     1 /*
     1 /*
     2  * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
     3  * Copyright 2007, 2008, 2009 Red Hat, Inc.
     3  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5  *
     5  *
     6  * This code is free software; you can redistribute it and/or modify it
     6  * This code is free software; you can redistribute it and/or modify it
     7  * under the terms of the GNU General Public License version 2 only, as
     7  * under the terms of the GNU General Public License version 2 only, as
     8  * published by the Free Software Foundation.
     8  * published by the Free Software Foundation.
   143       // Resume the interpreter
   143       // Resume the interpreter
   144       istate->set_msg(BytecodeInterpreter::got_monitors);
   144       istate->set_msg(BytecodeInterpreter::got_monitors);
   145     }
   145     }
   146     else if (istate->msg() == BytecodeInterpreter::return_from_method) {
   146     else if (istate->msg() == BytecodeInterpreter::return_from_method) {
   147       // Copy the result into the caller's frame
   147       // Copy the result into the caller's frame
   148       result_slots = type2size[method->result_type()];
   148       result_slots = type2size[result_type_of(method)];
   149       assert(result_slots >= 0 && result_slots <= 2, "what?");
   149       assert(result_slots >= 0 && result_slots <= 2, "what?");
   150       result = istate->stack() + result_slots;
   150       result = istate->stack() + result_slots;
   151       break;
   151       break;
   152     }
   152     }
   153     else if (istate->msg() == BytecodeInterpreter::throwing_exception) {
   153     else if (istate->msg() == BytecodeInterpreter::throwing_exception) {
   392   // Pop our parameters
   392   // Pop our parameters
   393   stack->set_sp(stack->sp() + method->size_of_parameters());
   393   stack->set_sp(stack->sp() + method->size_of_parameters());
   394 
   394 
   395   // Push our result
   395   // Push our result
   396   if (!HAS_PENDING_EXCEPTION) {
   396   if (!HAS_PENDING_EXCEPTION) {
   397     stack->set_sp(stack->sp() - type2size[method->result_type()]);
   397     BasicType type = result_type_of(method);
   398 
   398     stack->set_sp(stack->sp() - type2size[type]);
   399     switch (method->result_type()) {
   399 
       
   400     switch (type) {
   400     case T_VOID:
   401     case T_VOID:
   401       break;
   402       break;
   402 
   403 
   403     case T_BOOLEAN:
   404     case T_BOOLEAN:
   404 #ifndef VM_LITTLE_ENDIAN
   405 #ifndef VM_LITTLE_ENDIAN
   703     default       : ShouldNotReachHere();
   704     default       : ShouldNotReachHere();
   704   }
   705   }
   705   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
   706   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
   706          "index out of bounds");
   707          "index out of bounds");
   707   return i;
   708   return i;
       
   709 }
       
   710 
       
   711 BasicType CppInterpreter::result_type_of(methodOop method) {
       
   712   BasicType t;
       
   713   switch (method->result_index()) {
       
   714     case 0 : t = T_BOOLEAN; break;
       
   715     case 1 : t = T_CHAR;    break;
       
   716     case 2 : t = T_BYTE;    break;
       
   717     case 3 : t = T_SHORT;   break;
       
   718     case 4 : t = T_INT;     break;
       
   719     case 5 : t = T_LONG;    break;
       
   720     case 6 : t = T_VOID;    break;
       
   721     case 7 : t = T_FLOAT;   break;
       
   722     case 8 : t = T_DOUBLE;  break;
       
   723     case 9 : t = T_OBJECT;  break;
       
   724     default: ShouldNotReachHere();
       
   725   }
       
   726   assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(),
       
   727          "out of step with AbstractInterpreter::BasicType_as_index");
       
   728   return t;
   708 }
   729 }
   709 
   730 
   710 address InterpreterGenerator::generate_empty_entry() {
   731 address InterpreterGenerator::generate_empty_entry() {
   711   if (!UseFastEmptyMethods)
   732   if (!UseFastEmptyMethods)
   712     return NULL;
   733     return NULL;