1.1 --- a/src/cpu/ppc/vm/cppInterpreter_ppc.cpp Mon Jun 09 15:42:31 2014 -0700 1.2 +++ b/src/cpu/ppc/vm/cppInterpreter_ppc.cpp Tue Apr 01 09:36:49 2014 +0200 1.3 @@ -1,7 +1,7 @@ 1.4 1.5 /* 1.6 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 - * Copyright 2012, 2013 SAP AG. All rights reserved. 1.8 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 1.9 + * Copyright 2012, 2014 SAP AG. All rights reserved. 1.10 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.11 * 1.12 * This code is free software; you can redistribute it and/or modify it 1.13 @@ -2948,17 +2948,60 @@ 1.14 istate->_last_Java_fp = last_Java_fp; 1.15 } 1.16 1.17 -int AbstractInterpreter::layout_activation(Method* method, 1.18 - int temps, // Number of slots on java expression stack in use. 1.19 - int popframe_args, 1.20 - int monitors, // Number of active monitors. 1.21 - int caller_actual_parameters, 1.22 - int callee_params,// Number of slots for callee parameters. 1.23 - int callee_locals,// Number of slots for locals. 1.24 - frame* caller, 1.25 - frame* interpreter_frame, 1.26 - bool is_top_frame, 1.27 - bool is_bottom_frame) { 1.28 +// Computes monitor_size and top_frame_size in bytes. 1.29 +static void frame_size_helper(int max_stack, 1.30 + int monitors, 1.31 + int& monitor_size, 1.32 + int& top_frame_size) { 1.33 + monitor_size = frame::interpreter_frame_monitor_size_in_bytes() * monitors; 1.34 + top_frame_size = round_to(frame::interpreter_frame_cinterpreterstate_size_in_bytes() 1.35 + + monitor_size 1.36 + + max_stack * Interpreter::stackElementSize 1.37 + + 2 * Interpreter::stackElementSize, 1.38 + frame::alignment_in_bytes) 1.39 + + frame::top_ijava_frame_abi_size; 1.40 +} 1.41 + 1.42 +// Returns number of stackElementWords needed for the interpreter frame with the 1.43 +// given sections. 1.44 +int AbstractInterpreter::size_activation(int max_stack, 1.45 + int temps, 1.46 + int extra_args, 1.47 + int monitors, 1.48 + int callee_params, 1.49 + int callee_locals, 1.50 + bool is_top_frame) { 1.51 + int monitor_size = 0; 1.52 + int top_frame_size = 0; 1.53 + frame_size_helper(max_stack, monitors, monitor_size, top_frame_size); 1.54 + 1.55 + int frame_size; 1.56 + if (is_top_frame) { 1.57 + frame_size = top_frame_size; 1.58 + } else { 1.59 + frame_size = round_to(frame::interpreter_frame_cinterpreterstate_size_in_bytes() 1.60 + + monitor_size 1.61 + + (temps - callee_params + callee_locals) * Interpreter::stackElementSize 1.62 + + 2 * Interpreter::stackElementSize, 1.63 + frame::alignment_in_bytes) 1.64 + + frame::parent_ijava_frame_abi_size; 1.65 + assert(extra_args == 0, "non-zero for top_frame only"); 1.66 + } 1.67 + 1.68 + return frame_size / Interpreter::stackElementSize; 1.69 +} 1.70 + 1.71 +void AbstractInterpreter::layout_activation(Method* method, 1.72 + int temps, // Number of slots on java expression stack in use. 1.73 + int popframe_args, 1.74 + int monitors, // Number of active monitors. 1.75 + int caller_actual_parameters, 1.76 + int callee_params,// Number of slots for callee parameters. 1.77 + int callee_locals,// Number of slots for locals. 1.78 + frame* caller, 1.79 + frame* interpreter_frame, 1.80 + bool is_top_frame, 1.81 + bool is_bottom_frame) { 1.82 1.83 // NOTE this code must exactly mimic what 1.84 // InterpreterGenerator::generate_compute_interpreter_state() does 1.85 @@ -2968,86 +3011,64 @@ 1.86 // both the abi scratch area and a place to hold a result from a 1.87 // callee on its way to the callers stack. 1.88 1.89 - int monitor_size = frame::interpreter_frame_monitor_size_in_bytes() * monitors; 1.90 - int frame_size; 1.91 - int top_frame_size = round_to(frame::interpreter_frame_cinterpreterstate_size_in_bytes() 1.92 - + monitor_size 1.93 - + (method->max_stack() *Interpreter::stackElementWords * BytesPerWord) 1.94 - + 2*BytesPerWord, 1.95 - frame::alignment_in_bytes) 1.96 - + frame::top_ijava_frame_abi_size; 1.97 - if (is_top_frame) { 1.98 - frame_size = top_frame_size; 1.99 + int monitor_size = 0; 1.100 + int top_frame_size = 0; 1.101 + frame_size_helper(method->max_stack(), monitors, monitor_size, top_frame_size); 1.102 + 1.103 + intptr_t sp = (intptr_t)interpreter_frame->sp(); 1.104 + intptr_t fp = *(intptr_t *)sp; 1.105 + assert(fp == (intptr_t)caller->sp(), "fp must match"); 1.106 + interpreterState cur_state = 1.107 + (interpreterState)(fp - frame::interpreter_frame_cinterpreterstate_size_in_bytes()); 1.108 + 1.109 + // Now fill in the interpreterState object. 1.110 + 1.111 + intptr_t* locals; 1.112 + if (caller->is_interpreted_frame()) { 1.113 + // Locals must agree with the caller because it will be used to set the 1.114 + // caller's tos when we return. 1.115 + interpreterState prev = caller->get_interpreterState(); 1.116 + // Calculate start of "locals" for MH calls. For MH calls, the 1.117 + // current method() (= MH target) and prev->callee() (= 1.118 + // MH.invoke*()) are different and especially have different 1.119 + // signatures. To pop the argumentsof the caller, we must use 1.120 + // the prev->callee()->size_of_arguments() because that's what 1.121 + // the caller actually pushed. Currently, for synthetic MH 1.122 + // calls (deoptimized from inlined MH calls), detected by 1.123 + // is_method_handle_invoke(), we use the callee's arguments 1.124 + // because here, the caller's and callee's signature match. 1.125 + if (true /*!caller->is_at_mh_callsite()*/) { 1.126 + locals = prev->stack() + method->size_of_parameters(); 1.127 + } else { 1.128 + // Normal MH call. 1.129 + locals = prev->stack() + prev->callee()->size_of_parameters(); 1.130 + } 1.131 } else { 1.132 - frame_size = round_to(frame::interpreter_frame_cinterpreterstate_size_in_bytes() 1.133 - + monitor_size 1.134 - + ((temps - callee_params + callee_locals) * 1.135 - Interpreter::stackElementWords * BytesPerWord) 1.136 - + 2*BytesPerWord, 1.137 - frame::alignment_in_bytes) 1.138 - + frame::parent_ijava_frame_abi_size; 1.139 - assert(popframe_args==0, "non-zero for top_frame only"); 1.140 + bool is_deopted; 1.141 + locals = (intptr_t*) (fp + ((method->max_locals() - 1) * BytesPerWord) + 1.142 + frame::parent_ijava_frame_abi_size); 1.143 } 1.144 1.145 - // If we actually have a frame to layout we must now fill in all the pieces. 1.146 - if (interpreter_frame != NULL) { 1.147 - 1.148 - intptr_t sp = (intptr_t)interpreter_frame->sp(); 1.149 - intptr_t fp = *(intptr_t *)sp; 1.150 - assert(fp == (intptr_t)caller->sp(), "fp must match"); 1.151 - interpreterState cur_state = 1.152 - (interpreterState)(fp - frame::interpreter_frame_cinterpreterstate_size_in_bytes()); 1.153 - 1.154 - // Now fill in the interpreterState object. 1.155 - 1.156 - intptr_t* locals; 1.157 - if (caller->is_interpreted_frame()) { 1.158 - // Locals must agree with the caller because it will be used to set the 1.159 - // caller's tos when we return. 1.160 - interpreterState prev = caller->get_interpreterState(); 1.161 - // Calculate start of "locals" for MH calls. For MH calls, the 1.162 - // current method() (= MH target) and prev->callee() (= 1.163 - // MH.invoke*()) are different and especially have different 1.164 - // signatures. To pop the argumentsof the caller, we must use 1.165 - // the prev->callee()->size_of_arguments() because that's what 1.166 - // the caller actually pushed. Currently, for synthetic MH 1.167 - // calls (deoptimized from inlined MH calls), detected by 1.168 - // is_method_handle_invoke(), we use the callee's arguments 1.169 - // because here, the caller's and callee's signature match. 1.170 - if (true /*!caller->is_at_mh_callsite()*/) { 1.171 - locals = prev->stack() + method->size_of_parameters(); 1.172 - } else { 1.173 - // Normal MH call. 1.174 - locals = prev->stack() + prev->callee()->size_of_parameters(); 1.175 - } 1.176 - } else { 1.177 - bool is_deopted; 1.178 - locals = (intptr_t*) (fp + ((method->max_locals() - 1) * BytesPerWord) + 1.179 - frame::parent_ijava_frame_abi_size); 1.180 - } 1.181 - 1.182 - intptr_t* monitor_base = (intptr_t*) cur_state; 1.183 - intptr_t* stack_base = (intptr_t*) ((intptr_t) monitor_base - monitor_size); 1.184 - 1.185 - // Provide pop_frame capability on PPC64, add popframe_args. 1.186 - // +1 because stack is always prepushed. 1.187 - intptr_t* stack = (intptr_t*) ((intptr_t) stack_base - (temps + popframe_args + 1) * BytesPerWord); 1.188 - 1.189 - BytecodeInterpreter::layout_interpreterState(cur_state, 1.190 - caller, 1.191 - interpreter_frame, 1.192 - method, 1.193 - locals, 1.194 - stack, 1.195 - stack_base, 1.196 - monitor_base, 1.197 - (intptr_t*)(((intptr_t)fp)-top_frame_size), 1.198 - is_top_frame); 1.199 - 1.200 - BytecodeInterpreter::pd_layout_interpreterState(cur_state, interpreter_return_address, 1.201 - interpreter_frame->fp()); 1.202 - } 1.203 - return frame_size/BytesPerWord; 1.204 + intptr_t* monitor_base = (intptr_t*) cur_state; 1.205 + intptr_t* stack_base = (intptr_t*) ((intptr_t) monitor_base - monitor_size); 1.206 + 1.207 + // Provide pop_frame capability on PPC64, add popframe_args. 1.208 + // +1 because stack is always prepushed. 1.209 + intptr_t* stack = (intptr_t*) ((intptr_t) stack_base - (temps + popframe_args + 1) * BytesPerWord); 1.210 + 1.211 + BytecodeInterpreter::layout_interpreterState(cur_state, 1.212 + caller, 1.213 + interpreter_frame, 1.214 + method, 1.215 + locals, 1.216 + stack, 1.217 + stack_base, 1.218 + monitor_base, 1.219 + (intptr_t*)(((intptr_t)fp) - top_frame_size), 1.220 + is_top_frame); 1.221 + 1.222 + BytecodeInterpreter::pd_layout_interpreterState(cur_state, interpreter_return_address, 1.223 + interpreter_frame->fp()); 1.224 } 1.225 1.226 #endif // CC_INTERP