2166 to_fill->_stack_base = stack_base;
2167 // Need +1 here because stack_base points to the word just above the first expr stack entry
2168 // and stack_limit is supposed to point to the word just below the last expr stack entry.
2169 // See generate_compute_interpreter_state.
2170 to_fill->_stack_limit = stack_base - (method->max_stack() + 1);
2171 to_fill->_monitor_base = (BasicObjectLock*) monitor_base;
2172
2173 // sparc specific
2174 to_fill->_frame_bottom = frame_bottom;
2175 to_fill->_self_link = to_fill;
2176 #ifdef ASSERT
2177 to_fill->_native_fresult = 123456.789;
2178 to_fill->_native_lresult = CONST64(0xdeadcafedeafcafe);
2179 #endif
2180 }
2181
2182 void BytecodeInterpreter::pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp) {
2183 istate->_last_Java_pc = (intptr_t*) last_Java_pc;
2184 }
2185
2186
2187 int AbstractInterpreter::layout_activation(Method* method,
2188 int tempcount, // Number of slots on java expression stack in use
2189 int popframe_extra_args,
2190 int moncount, // Number of active monitors
2191 int caller_actual_parameters,
2192 int callee_param_size,
2193 int callee_locals_size,
2194 frame* caller,
2195 frame* interpreter_frame,
2196 bool is_top_frame,
2197 bool is_bottom_frame) {
2198
2199 assert(popframe_extra_args == 0, "NEED TO FIX");
2200 // NOTE this code must exactly mimic what InterpreterGenerator::generate_compute_interpreter_state()
2201 // does as far as allocating an interpreter frame.
2202 // If interpreter_frame!=NULL, set up the method, locals, and monitors.
2203 // The frame interpreter_frame, if not NULL, is guaranteed to be the right size,
2204 // as determined by a previous call to this method.
2205 // It is also guaranteed to be walkable even though it is in a skeletal state
2206 // NOTE: return size is in words not bytes
2207 // NOTE: tempcount is the current size of the java expression stack. For top most
2208 // frames we will allocate a full sized expression stack and not the curback
2209 // version that non-top frames have.
2210
2211 // Calculate the amount our frame will be adjust by the callee. For top frame
2212 // this is zero.
2213
2214 // NOTE: ia64 seems to do this wrong (or at least backwards) in that it
2215 // calculates the extra locals based on itself. Not what the callee does
2216 // to it. So it ignores last_frame_adjust value. Seems suspicious as far
2217 // as getting sender_sp correct.
2218
2219 int extra_locals_size = callee_locals_size - callee_param_size;
2220 int monitor_size = (sizeof(BasicObjectLock) * moncount) / wordSize;
2221 int full_frame_words = size_activation_helper(extra_locals_size, method->max_stack(), monitor_size);
2222 int short_frame_words = size_activation_helper(extra_locals_size, method->max_stack(), monitor_size);
2223 int frame_words = is_top_frame ? full_frame_words : short_frame_words;
2224
2225
2226 /*
2227 if we actually have a frame to layout we must now fill in all the pieces. This means both
2228 the interpreterState and the registers.
2229 */
2230 if (interpreter_frame != NULL) {
2231
2232 // MUCHO HACK
2233
2234 intptr_t* frame_bottom = interpreter_frame->sp() - (full_frame_words - frame_words);
2235 // 'interpreter_frame->sp()' is unbiased while 'frame_bottom' must be a biased value in 64bit mode.
2236 assert(((intptr_t)frame_bottom & 0xf) == 0, "SP biased in layout_activation");
2237 frame_bottom = (intptr_t*)((intptr_t)frame_bottom - STACK_BIAS);
2238
2239 /* Now fillin the interpreterState object */
2240
2241 interpreterState cur_state = (interpreterState) ((intptr_t)interpreter_frame->fp() - sizeof(BytecodeInterpreter));
2242
2243
2244 intptr_t* locals;
2245
2246 // Calculate the postion of locals[0]. This is painful because of
2247 // stack alignment (same as ia64). The problem is that we can
2248 // not compute the location of locals from fp(). fp() will account
2249 // for the extra locals but it also accounts for aligning the stack
2250 // and we can't determine if the locals[0] was misaligned but max_locals
2277 // END MUCHO HACK
2278
2279 intptr_t* monitor_base = (intptr_t*) cur_state;
2280 intptr_t* stack_base = monitor_base - monitor_size;
2281 /* +1 because stack is always prepushed */
2282 intptr_t* stack = stack_base - (tempcount + 1);
2283
2284
2285 BytecodeInterpreter::layout_interpreterState(cur_state,
2286 caller,
2287 interpreter_frame,
2288 method,
2289 locals,
2290 stack,
2291 stack_base,
2292 monitor_base,
2293 frame_bottom,
2294 is_top_frame);
2295
2296 BytecodeInterpreter::pd_layout_interpreterState(cur_state, interpreter_return_address, interpreter_frame->fp());
2297
2298 }
2299 return frame_words;
2300 }
2301
2302 #endif // CC_INTERP
|
2166 to_fill->_stack_base = stack_base;
2167 // Need +1 here because stack_base points to the word just above the first expr stack entry
2168 // and stack_limit is supposed to point to the word just below the last expr stack entry.
2169 // See generate_compute_interpreter_state.
2170 to_fill->_stack_limit = stack_base - (method->max_stack() + 1);
2171 to_fill->_monitor_base = (BasicObjectLock*) monitor_base;
2172
2173 // sparc specific
2174 to_fill->_frame_bottom = frame_bottom;
2175 to_fill->_self_link = to_fill;
2176 #ifdef ASSERT
2177 to_fill->_native_fresult = 123456.789;
2178 to_fill->_native_lresult = CONST64(0xdeadcafedeafcafe);
2179 #endif
2180 }
2181
2182 void BytecodeInterpreter::pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp) {
2183 istate->_last_Java_pc = (intptr_t*) last_Java_pc;
2184 }
2185
2186 static int frame_size_helper(int max_stack,
2187 int moncount,
2188 int callee_param_size,
2189 int callee_locals_size,
2190 bool is_top_frame,
2191 int& monitor_size,
2192 int& full_frame_words) {
2193 int extra_locals_size = callee_locals_size - callee_param_size;
2194 monitor_size = (sizeof(BasicObjectLock) * moncount) / wordSize;
2195 full_frame_words = size_activation_helper(extra_locals_size, max_stack, monitor_size);
2196 int short_frame_words = size_activation_helper(extra_locals_size, max_stack, monitor_size);
2197 int frame_words = is_top_frame ? full_frame_words : short_frame_words;
2198
2199 return frame_words;
2200 }
2201
2202 int AbstractInterpreter::size_activation(int max_stack,
2203 int tempcount,
2204 int popframe_extra_args,
2205 int moncount,
2206 int callee_param_size,
2207 int callee_locals_size,
2208 bool is_top_frame) {
2209 assert(popframe_extra_args == 0, "NEED TO FIX");
2210 // NOTE: return size is in words not bytes
2211 // Calculate the amount our frame will be adjust by the callee. For top frame
2212 // this is zero.
2213
2214 // NOTE: ia64 seems to do this wrong (or at least backwards) in that it
2215 // calculates the extra locals based on itself. Not what the callee does
2216 // to it. So it ignores last_frame_adjust value. Seems suspicious as far
2217 // as getting sender_sp correct.
2218
2219 int unused_monitor_size = 0;
2220 int unused_full_frame_words = 0;
2221 return frame_size_helper(max_stack, moncount, callee_param_size, callee_locals_size, is_top_frame,
2222 unused_monitor_size, unused_full_frame_words);
2223 }
2224 void AbstractInterpreter::layout_activation(Method* method,
2225 int tempcount, // Number of slots on java expression stack in use
2226 int popframe_extra_args,
2227 int moncount, // Number of active monitors
2228 int caller_actual_parameters,
2229 int callee_param_size,
2230 int callee_locals_size,
2231 frame* caller,
2232 frame* interpreter_frame,
2233 bool is_top_frame,
2234 bool is_bottom_frame) {
2235 assert(popframe_extra_args == 0, "NEED TO FIX");
2236 // NOTE this code must exactly mimic what InterpreterGenerator::generate_compute_interpreter_state()
2237 // does as far as allocating an interpreter frame.
2238 // Set up the method, locals, and monitors.
2239 // The frame interpreter_frame is guaranteed to be the right size,
2240 // as determined by a previous call to the size_activation() method.
2241 // It is also guaranteed to be walkable even though it is in a skeletal state
2242 // NOTE: tempcount is the current size of the java expression stack. For top most
2243 // frames we will allocate a full sized expression stack and not the curback
2244 // version that non-top frames have.
2245
2246 int monitor_size = 0;
2247 int full_frame_words = 0;
2248 int frame_words = frame_size_helper(method->max_stack(), moncount, callee_param_size, callee_locals_size,
2249 is_top_frame, monitor_size, full_frame_words);
2250
2251 /*
2252 We must now fill in all the pieces of the frame. This means both
2253 the interpreterState and the registers.
2254 */
2255
2256 // MUCHO HACK
2257
2258 intptr_t* frame_bottom = interpreter_frame->sp() - (full_frame_words - frame_words);
2259 // 'interpreter_frame->sp()' is unbiased while 'frame_bottom' must be a biased value in 64bit mode.
2260 assert(((intptr_t)frame_bottom & 0xf) == 0, "SP biased in layout_activation");
2261 frame_bottom = (intptr_t*)((intptr_t)frame_bottom - STACK_BIAS);
2262
2263 /* Now fillin the interpreterState object */
2264
2265 interpreterState cur_state = (interpreterState) ((intptr_t)interpreter_frame->fp() - sizeof(BytecodeInterpreter));
2266
2267
2268 intptr_t* locals;
2269
2270 // Calculate the postion of locals[0]. This is painful because of
2271 // stack alignment (same as ia64). The problem is that we can
2272 // not compute the location of locals from fp(). fp() will account
2273 // for the extra locals but it also accounts for aligning the stack
2274 // and we can't determine if the locals[0] was misaligned but max_locals
2301 // END MUCHO HACK
2302
2303 intptr_t* monitor_base = (intptr_t*) cur_state;
2304 intptr_t* stack_base = monitor_base - monitor_size;
2305 /* +1 because stack is always prepushed */
2306 intptr_t* stack = stack_base - (tempcount + 1);
2307
2308
2309 BytecodeInterpreter::layout_interpreterState(cur_state,
2310 caller,
2311 interpreter_frame,
2312 method,
2313 locals,
2314 stack,
2315 stack_base,
2316 monitor_base,
2317 frame_bottom,
2318 is_top_frame);
2319
2320 BytecodeInterpreter::pd_layout_interpreterState(cur_state, interpreter_return_address, interpreter_frame->fp());
2321 }
2322
2323 #endif // CC_INTERP
|