src/cpu/zero/vm/cppInterpreter_zero.cpp

Thu, 05 Sep 2019 18:52:27 +0800

author
aoqi
date
Thu, 05 Sep 2019 18:52:27 +0800
changeset 9703
2fdf635bcf28
parent 8604
04d83ba48607
parent 9669
32bc598624bd
permissions
-rw-r--r--

Merge

never@1445 1 /*
phh@9669 2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
twisti@2762 3 * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
never@1445 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@1445 5 *
never@1445 6 * This code is free software; you can redistribute it and/or modify it
never@1445 7 * under the terms of the GNU General Public License version 2 only, as
never@1445 8 * published by the Free Software Foundation.
never@1445 9 *
never@1445 10 * This code is distributed in the hope that it will be useful, but WITHOUT
never@1445 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@1445 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@1445 13 * version 2 for more details (a copy is included in the LICENSE file that
never@1445 14 * accompanied this code).
never@1445 15 *
never@1445 16 * You should have received a copy of the GNU General Public License version
never@1445 17 * 2 along with this work; if not, write to the Free Software Foundation,
never@1445 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@1445 19 *
trims@1907 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 21 * or visit www.oracle.com if you need additional information or have any
trims@1907 22 * questions.
never@1445 23 *
never@1445 24 */
never@1445 25
stefank@2314 26 #include "precompiled.hpp"
stefank@2314 27 #include "asm/assembler.hpp"
stefank@2314 28 #include "interpreter/bytecodeHistogram.hpp"
stefank@2314 29 #include "interpreter/cppInterpreter.hpp"
stefank@2314 30 #include "interpreter/interpreter.hpp"
stefank@2314 31 #include "interpreter/interpreterGenerator.hpp"
stefank@2314 32 #include "interpreter/interpreterRuntime.hpp"
stefank@2314 33 #include "oops/arrayOop.hpp"
coleenp@4037 34 #include "oops/methodData.hpp"
coleenp@4037 35 #include "oops/method.hpp"
stefank@2314 36 #include "oops/oop.inline.hpp"
stefank@2314 37 #include "prims/jvmtiExport.hpp"
stefank@2314 38 #include "prims/jvmtiThreadState.hpp"
stefank@2314 39 #include "runtime/arguments.hpp"
stefank@2314 40 #include "runtime/deoptimization.hpp"
stefank@2314 41 #include "runtime/frame.inline.hpp"
stefank@2314 42 #include "runtime/interfaceSupport.hpp"
goetz@6911 43 #include "runtime/orderAccess.inline.hpp"
stefank@2314 44 #include "runtime/sharedRuntime.hpp"
stefank@2314 45 #include "runtime/stubRoutines.hpp"
stefank@2314 46 #include "runtime/synchronizer.hpp"
stefank@2314 47 #include "runtime/timer.hpp"
stefank@2314 48 #include "runtime/vframeArray.hpp"
stefank@2314 49 #include "stack_zero.inline.hpp"
stefank@2314 50 #include "utilities/debug.hpp"
jprovino@4542 51 #include "utilities/macros.hpp"
stefank@2314 52 #ifdef SHARK
stefank@2314 53 #include "shark/shark_globals.hpp"
stefank@2314 54 #endif
never@1445 55
never@1445 56 #ifdef CC_INTERP
never@1445 57
never@1445 58 #define fixup_after_potential_safepoint() \
never@1445 59 method = istate->method()
never@1445 60
twisti@2762 61 #define CALL_VM_NOCHECK_NOFIX(func) \
never@1445 62 thread->set_last_Java_frame(); \
never@1445 63 func; \
twisti@2762 64 thread->reset_last_Java_frame();
twisti@2762 65
twisti@2762 66 #define CALL_VM_NOCHECK(func) \
twisti@2762 67 CALL_VM_NOCHECK_NOFIX(func) \
never@1445 68 fixup_after_potential_safepoint()
never@1445 69
coleenp@4037 70 int CppInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
never@1445 71 JavaThread *thread = (JavaThread *) THREAD;
never@1445 72
never@1445 73 // Allocate and initialize our frame.
twisti@1869 74 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
never@1445 75 thread->push_zero_frame(frame);
never@1445 76
never@1445 77 // Execute those bytecodes!
never@1445 78 main_loop(0, THREAD);
twisti@1869 79
twisti@1869 80 // No deoptimized frames on the stack
twisti@1869 81 return 0;
never@1445 82 }
never@1445 83
kevinw@8368 84 intptr_t narrow(BasicType type, intptr_t result) {
kevinw@8368 85 // mask integer result to narrower return type.
kevinw@8368 86 switch (type) {
kevinw@8368 87 case T_BOOLEAN:
kevinw@8368 88 return result&1;
kevinw@8368 89 case T_BYTE:
kevinw@8368 90 return (intptr_t)(jbyte)result;
kevinw@8368 91 case T_CHAR:
kevinw@8368 92 return (intptr_t)(uintptr_t)(jchar)result;
kevinw@8368 93 case T_SHORT:
kevinw@8368 94 return (intptr_t)(jshort)result;
kevinw@8368 95 case T_OBJECT: // nothing to do fall through
kevinw@8402 96 case T_ARRAY:
kevinw@8368 97 case T_LONG:
kevinw@8368 98 case T_INT:
kevinw@8368 99 case T_FLOAT:
kevinw@8368 100 case T_DOUBLE:
kevinw@8368 101 case T_VOID:
kevinw@8368 102 return result;
kevinw@8368 103 default : ShouldNotReachHere();
kevinw@8368 104 }
kevinw@8368 105 }
kevinw@8368 106
kevinw@8368 107
never@1445 108 void CppInterpreter::main_loop(int recurse, TRAPS) {
never@1445 109 JavaThread *thread = (JavaThread *) THREAD;
never@1445 110 ZeroStack *stack = thread->zero_stack();
never@1445 111
never@1445 112 // If we are entering from a deopt we may need to call
never@1445 113 // ourself a few times in order to get to our frame.
never@1445 114 if (recurse)
never@1445 115 main_loop(recurse - 1, THREAD);
never@1445 116
never@1445 117 InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
never@1445 118 interpreterState istate = frame->interpreter_state();
coleenp@4037 119 Method* method = istate->method();
never@1445 120
never@1445 121 intptr_t *result = NULL;
never@1445 122 int result_slots = 0;
never@1445 123
never@1445 124 while (true) {
never@1445 125 // We can set up the frame anchor with everything we want at
never@1445 126 // this point as we are thread_in_Java and no safepoints can
never@1445 127 // occur until we go to vm mode. We do have to clear flags
never@1445 128 // on return from vm but that is it.
never@1445 129 thread->set_last_Java_frame();
never@1445 130
never@1445 131 // Call the interpreter
never@1445 132 if (JvmtiExport::can_post_interpreter_events())
never@1445 133 BytecodeInterpreter::runWithChecks(istate);
never@1445 134 else
never@1445 135 BytecodeInterpreter::run(istate);
never@1445 136 fixup_after_potential_safepoint();
never@1445 137
never@1445 138 // Clear the frame anchor
never@1445 139 thread->reset_last_Java_frame();
never@1445 140
never@1445 141 // Examine the message from the interpreter to decide what to do
never@1445 142 if (istate->msg() == BytecodeInterpreter::call_method) {
coleenp@4037 143 Method* callee = istate->callee();
never@1445 144
never@1445 145 // Trim back the stack to put the parameters at the top
never@1445 146 stack->set_sp(istate->stack() + 1);
never@1445 147
never@1445 148 // Make the call
never@1445 149 Interpreter::invoke_method(callee, istate->callee_entry_point(), THREAD);
never@1445 150 fixup_after_potential_safepoint();
never@1445 151
never@1445 152 // Convert the result
never@1445 153 istate->set_stack(stack->sp() - 1);
never@1445 154
never@1445 155 // Restore the stack
never@1445 156 stack->set_sp(istate->stack_limit() + 1);
never@1445 157
never@1445 158 // Resume the interpreter
never@1445 159 istate->set_msg(BytecodeInterpreter::method_resume);
never@1445 160 }
never@1445 161 else if (istate->msg() == BytecodeInterpreter::more_monitors) {
never@1445 162 int monitor_words = frame::interpreter_frame_monitor_size();
never@1445 163
never@1445 164 // Allocate the space
twisti@1814 165 stack->overflow_check(monitor_words, THREAD);
twisti@1814 166 if (HAS_PENDING_EXCEPTION)
twisti@1814 167 break;
never@1445 168 stack->alloc(monitor_words * wordSize);
never@1445 169
never@1445 170 // Move the expression stack contents
never@1445 171 for (intptr_t *p = istate->stack() + 1; p < istate->stack_base(); p++)
never@1445 172 *(p - monitor_words) = *p;
never@1445 173
never@1445 174 // Move the expression stack pointers
never@1445 175 istate->set_stack_limit(istate->stack_limit() - monitor_words);
never@1445 176 istate->set_stack(istate->stack() - monitor_words);
never@1445 177 istate->set_stack_base(istate->stack_base() - monitor_words);
never@1445 178
never@1445 179 // Zero the new monitor so the interpreter can find it.
never@1445 180 ((BasicObjectLock *) istate->stack_base())->set_obj(NULL);
never@1445 181
never@1445 182 // Resume the interpreter
never@1445 183 istate->set_msg(BytecodeInterpreter::got_monitors);
never@1445 184 }
never@1445 185 else if (istate->msg() == BytecodeInterpreter::return_from_method) {
never@1445 186 // Copy the result into the caller's frame
kevinw@8402 187 result_slots = type2size[method->result_type()];
never@1445 188 assert(result_slots >= 0 && result_slots <= 2, "what?");
never@1445 189 result = istate->stack() + result_slots;
never@1445 190 break;
never@1445 191 }
never@1445 192 else if (istate->msg() == BytecodeInterpreter::throwing_exception) {
never@1445 193 assert(HAS_PENDING_EXCEPTION, "should do");
never@1445 194 break;
never@1445 195 }
never@1445 196 else if (istate->msg() == BytecodeInterpreter::do_osr) {
never@1445 197 // Unwind the current frame
never@1445 198 thread->pop_zero_frame();
never@1445 199
never@1445 200 // Remove any extension of the previous frame
never@1445 201 int extra_locals = method->max_locals() - method->size_of_parameters();
never@1445 202 stack->set_sp(stack->sp() + extra_locals);
never@1445 203
never@1445 204 // Jump into the OSR method
never@1445 205 Interpreter::invoke_osr(
never@1445 206 method, istate->osr_entry(), istate->osr_buf(), THREAD);
never@1445 207 return;
never@1445 208 }
never@1445 209 else {
never@1445 210 ShouldNotReachHere();
never@1445 211 }
never@1445 212 }
never@1445 213
never@1445 214 // Unwind the current frame
never@1445 215 thread->pop_zero_frame();
never@1445 216
never@1445 217 // Pop our local variables
never@1445 218 stack->set_sp(stack->sp() + method->max_locals());
never@1445 219
never@1445 220 // Push our result
kevinw@8368 221 for (int i = 0; i < result_slots; i++) {
kevinw@8368 222 // Adjust result to smaller
aph@8429 223 union {
aph@8429 224 intptr_t res;
aph@8429 225 jint res_jint;
aph@8429 226 };
aph@8429 227 res = result[-i];
kevinw@8368 228 if (result_slots == 1) {
aph@8429 229 BasicType t = method->result_type();
aph@8429 230 if (is_subword_type(t)) {
aph@8429 231 res_jint = (jint)narrow(t, res_jint);
aph@8429 232 }
kevinw@8368 233 }
kevinw@8368 234 stack->push(res);
kevinw@8368 235 }
never@1445 236 }
never@1445 237
coleenp@4037 238 int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
never@1445 239 // Make sure method is native and not abstract
never@1445 240 assert(method->is_native() && !method->is_abstract(), "should be");
never@1445 241
never@1445 242 JavaThread *thread = (JavaThread *) THREAD;
never@1445 243 ZeroStack *stack = thread->zero_stack();
never@1445 244
never@1445 245 // Allocate and initialize our frame
twisti@1869 246 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
never@1445 247 thread->push_zero_frame(frame);
never@1445 248 interpreterState istate = frame->interpreter_state();
never@1445 249 intptr_t *locals = istate->locals();
never@1445 250
twisti@1513 251 // Update the invocation counter
twisti@1513 252 if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
jiangli@5065 253 MethodCounters* mcs = method->method_counters();
jiangli@5065 254 if (mcs == NULL) {
jiangli@5065 255 CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method));
jiangli@5065 256 if (HAS_PENDING_EXCEPTION)
jiangli@5065 257 goto unwind_and_return;
jiangli@5065 258 }
jiangli@5065 259 InvocationCounter *counter = mcs->invocation_counter();
twisti@1513 260 counter->increment();
goetz@6470 261 if (counter->reached_InvocationLimit(mcs->backedge_counter())) {
twisti@1513 262 CALL_VM_NOCHECK(
twisti@1513 263 InterpreterRuntime::frequency_counter_overflow(thread, NULL));
twisti@1513 264 if (HAS_PENDING_EXCEPTION)
twisti@1513 265 goto unwind_and_return;
twisti@1513 266 }
twisti@1513 267 }
twisti@1513 268
never@1445 269 // Lock if necessary
never@1445 270 BasicObjectLock *monitor;
never@1445 271 monitor = NULL;
never@1445 272 if (method->is_synchronized()) {
never@1445 273 monitor = (BasicObjectLock*) istate->stack_base();
never@1445 274 oop lockee = monitor->obj();
never@1445 275 markOop disp = lockee->mark()->set_unlocked();
never@1445 276
never@1445 277 monitor->lock()->set_displaced_header(disp);
never@1445 278 if (Atomic::cmpxchg_ptr(monitor, lockee->mark_addr(), disp) != disp) {
never@1445 279 if (thread->is_lock_owned((address) disp->clear_lock_bits())) {
never@1445 280 monitor->lock()->set_displaced_header(NULL);
never@1445 281 }
never@1445 282 else {
never@1445 283 CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
never@1445 284 if (HAS_PENDING_EXCEPTION)
never@1445 285 goto unwind_and_return;
never@1445 286 }
never@1445 287 }
never@1445 288 }
never@1445 289
never@1445 290 // Get the signature handler
never@1445 291 InterpreterRuntime::SignatureHandler *handler; {
never@1445 292 address handlerAddr = method->signature_handler();
never@1445 293 if (handlerAddr == NULL) {
never@1445 294 CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
never@1445 295 if (HAS_PENDING_EXCEPTION)
never@1574 296 goto unlock_unwind_and_return;
never@1445 297
never@1445 298 handlerAddr = method->signature_handler();
never@1445 299 assert(handlerAddr != NULL, "eh?");
never@1445 300 }
never@1445 301 if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) {
never@1445 302 CALL_VM_NOCHECK(handlerAddr =
never@1445 303 InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL));
never@1445 304 if (HAS_PENDING_EXCEPTION)
never@1574 305 goto unlock_unwind_and_return;
never@1445 306 }
never@1445 307 handler = \
never@1445 308 InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr);
never@1445 309 }
never@1445 310
never@1445 311 // Get the native function entry point
never@1445 312 address function;
never@1445 313 function = method->native_function();
never@1445 314 assert(function != NULL, "should be set if signature handler is");
never@1445 315
never@1445 316 // Build the argument list
twisti@1814 317 stack->overflow_check(handler->argument_count() * 2, THREAD);
twisti@1814 318 if (HAS_PENDING_EXCEPTION)
twisti@1814 319 goto unlock_unwind_and_return;
twisti@1814 320
never@1445 321 void **arguments;
never@1445 322 void *mirror; {
never@1445 323 arguments =
never@1445 324 (void **) stack->alloc(handler->argument_count() * sizeof(void **));
never@1445 325 void **dst = arguments;
never@1445 326
never@1445 327 void *env = thread->jni_environment();
never@1445 328 *(dst++) = &env;
never@1445 329
never@1445 330 if (method->is_static()) {
never@1445 331 istate->set_oop_temp(
never@2658 332 method->constants()->pool_holder()->java_mirror());
never@1445 333 mirror = istate->oop_temp_addr();
never@1445 334 *(dst++) = &mirror;
never@1445 335 }
never@1445 336
never@1445 337 intptr_t *src = locals;
never@1445 338 for (int i = dst - arguments; i < handler->argument_count(); i++) {
never@1445 339 ffi_type *type = handler->argument_type(i);
never@1445 340 if (type == &ffi_type_pointer) {
never@1445 341 if (*src) {
never@1445 342 stack->push((intptr_t) src);
never@1445 343 *(dst++) = stack->sp();
never@1445 344 }
never@1445 345 else {
never@1445 346 *(dst++) = src;
never@1445 347 }
never@1445 348 src--;
never@1445 349 }
never@1445 350 else if (type->size == 4) {
never@1445 351 *(dst++) = src--;
never@1445 352 }
never@1445 353 else if (type->size == 8) {
never@1445 354 src--;
never@1445 355 *(dst++) = src--;
never@1445 356 }
never@1445 357 else {
never@1445 358 ShouldNotReachHere();
never@1445 359 }
never@1445 360 }
never@1445 361 }
never@1445 362
never@1445 363 // Set up the Java frame anchor
never@1445 364 thread->set_last_Java_frame();
never@1445 365
never@1445 366 // Change the thread state to _thread_in_native
never@1445 367 ThreadStateTransition::transition_from_java(thread, _thread_in_native);
never@1445 368
never@1445 369 // Make the call
never@1445 370 intptr_t result[4 - LogBytesPerWord];
never@1445 371 ffi_call(handler->cif(), (void (*)()) function, result, arguments);
never@1445 372
never@1445 373 // Change the thread state back to _thread_in_Java.
never@1445 374 // ThreadStateTransition::transition_from_native() cannot be used
never@1445 375 // here because it does not check for asynchronous exceptions.
never@1445 376 // We have to manage the transition ourself.
never@1445 377 thread->set_thread_state(_thread_in_native_trans);
never@1445 378
never@1445 379 // Make sure new state is visible in the GC thread
never@1445 380 if (os::is_MP()) {
never@1445 381 if (UseMembar) {
never@1445 382 OrderAccess::fence();
never@1445 383 }
never@1445 384 else {
never@1445 385 InterfaceSupport::serialize_memory(thread);
never@1445 386 }
never@1445 387 }
never@1445 388
never@1445 389 // Handle safepoint operations, pending suspend requests,
never@1445 390 // and pending asynchronous exceptions.
never@1445 391 if (SafepointSynchronize::do_call_back() ||
never@1445 392 thread->has_special_condition_for_native_trans()) {
never@1445 393 JavaThread::check_special_condition_for_native_trans(thread);
never@1445 394 CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops());
never@1445 395 }
never@1445 396
never@1445 397 // Finally we can change the thread state to _thread_in_Java.
never@1445 398 thread->set_thread_state(_thread_in_Java);
never@1445 399 fixup_after_potential_safepoint();
never@1445 400
never@1445 401 // Clear the frame anchor
never@1445 402 thread->reset_last_Java_frame();
never@1445 403
never@1445 404 // If the result was an oop then unbox it and store it in
never@1445 405 // oop_temp where the garbage collector can see it before
never@1445 406 // we release the handle it might be protected by.
never@1445 407 if (handler->result_type() == &ffi_type_pointer) {
phh@9669 408 if (result[0] == 0) {
never@1445 409 istate->set_oop_temp(NULL);
phh@9669 410 } else {
phh@9669 411 jobject handle = reinterpret_cast<jobject>(result[0]);
phh@9669 412 istate->set_oop_temp(JNIHandles::resolve(handle));
phh@9669 413 }
never@1445 414 }
never@1445 415
never@1445 416 // Reset handle block
never@1445 417 thread->active_handles()->clear();
never@1445 418
never@1574 419 unlock_unwind_and_return:
never@1574 420
never@1574 421 // Unlock if necessary
never@1574 422 if (monitor) {
never@1445 423 BasicLock *lock = monitor->lock();
never@1445 424 markOop header = lock->displaced_header();
never@1445 425 oop rcvr = monitor->obj();
never@1445 426 monitor->set_obj(NULL);
never@1445 427
never@1445 428 if (header != NULL) {
never@1445 429 if (Atomic::cmpxchg_ptr(header, rcvr->mark_addr(), lock) != lock) {
never@1445 430 monitor->set_obj(rcvr); {
never@1445 431 HandleMark hm(thread);
never@1445 432 CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(thread, monitor));
never@1445 433 }
never@1445 434 }
never@1445 435 }
never@1445 436 }
never@1445 437
never@1445 438 unwind_and_return:
never@1445 439
never@1445 440 // Unwind the current activation
never@1445 441 thread->pop_zero_frame();
never@1445 442
never@1445 443 // Pop our parameters
never@1445 444 stack->set_sp(stack->sp() + method->size_of_parameters());
never@1445 445
never@1445 446 // Push our result
never@1445 447 if (!HAS_PENDING_EXCEPTION) {
kevinw@8402 448 BasicType type = method->result_type();
kvn@1691 449 stack->set_sp(stack->sp() - type2size[type]);
never@1445 450
kvn@1691 451 switch (type) {
never@1445 452 case T_VOID:
never@1445 453 break;
never@1445 454
never@1445 455 case T_BOOLEAN:
never@1445 456 #ifndef VM_LITTLE_ENDIAN
never@1445 457 result[0] <<= (BitsPerWord - BitsPerByte);
never@1445 458 #endif
never@1445 459 SET_LOCALS_INT(*(jboolean *) result != 0, 0);
never@1445 460 break;
never@1445 461
never@1445 462 case T_CHAR:
never@1445 463 #ifndef VM_LITTLE_ENDIAN
never@1445 464 result[0] <<= (BitsPerWord - BitsPerShort);
never@1445 465 #endif
never@1445 466 SET_LOCALS_INT(*(jchar *) result, 0);
never@1445 467 break;
never@1445 468
never@1445 469 case T_BYTE:
never@1445 470 #ifndef VM_LITTLE_ENDIAN
never@1445 471 result[0] <<= (BitsPerWord - BitsPerByte);
never@1445 472 #endif
never@1445 473 SET_LOCALS_INT(*(jbyte *) result, 0);
never@1445 474 break;
never@1445 475
never@1445 476 case T_SHORT:
never@1445 477 #ifndef VM_LITTLE_ENDIAN
never@1445 478 result[0] <<= (BitsPerWord - BitsPerShort);
never@1445 479 #endif
never@1445 480 SET_LOCALS_INT(*(jshort *) result, 0);
never@1445 481 break;
never@1445 482
never@1445 483 case T_INT:
never@1445 484 #ifndef VM_LITTLE_ENDIAN
never@1445 485 result[0] <<= (BitsPerWord - BitsPerInt);
never@1445 486 #endif
never@1445 487 SET_LOCALS_INT(*(jint *) result, 0);
never@1445 488 break;
never@1445 489
never@1445 490 case T_LONG:
never@1445 491 SET_LOCALS_LONG(*(jlong *) result, 0);
never@1445 492 break;
never@1445 493
never@1445 494 case T_FLOAT:
never@1445 495 SET_LOCALS_FLOAT(*(jfloat *) result, 0);
never@1445 496 break;
never@1445 497
never@1445 498 case T_DOUBLE:
never@1445 499 SET_LOCALS_DOUBLE(*(jdouble *) result, 0);
never@1445 500 break;
never@1445 501
never@1445 502 case T_OBJECT:
never@1445 503 case T_ARRAY:
never@1445 504 SET_LOCALS_OBJECT(istate->oop_temp(), 0);
never@1445 505 break;
never@1445 506
never@1445 507 default:
never@1445 508 ShouldNotReachHere();
never@1445 509 }
never@1445 510 }
twisti@1869 511
twisti@1869 512 // No deoptimized frames on the stack
twisti@1869 513 return 0;
never@1445 514 }
never@1445 515
coleenp@4037 516 int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
never@1445 517 JavaThread *thread = (JavaThread *) THREAD;
never@1445 518 ZeroStack *stack = thread->zero_stack();
never@1445 519 intptr_t *locals = stack->sp();
never@1445 520
never@1445 521 // Drop into the slow path if we need a safepoint check
never@1445 522 if (SafepointSynchronize::do_call_back()) {
twisti@1869 523 return normal_entry(method, 0, THREAD);
never@1445 524 }
never@1445 525
never@1445 526 // Load the object pointer and drop into the slow path
never@1445 527 // if we have a NullPointerException
never@1445 528 oop object = LOCALS_OBJECT(0);
never@1445 529 if (object == NULL) {
twisti@1869 530 return normal_entry(method, 0, THREAD);
never@1445 531 }
never@1445 532
never@1445 533 // Read the field index from the bytecode, which looks like this:
never@1445 534 // 0: aload_0
never@1445 535 // 1: getfield
never@1445 536 // 2: index
never@1445 537 // 3: index
never@1445 538 // 4: ireturn/areturn
never@1445 539 // NB this is not raw bytecode: index is in machine order
never@1445 540 u1 *code = method->code_base();
never@1445 541 assert(code[0] == Bytecodes::_aload_0 &&
never@1445 542 code[1] == Bytecodes::_getfield &&
never@1445 543 (code[4] == Bytecodes::_ireturn ||
never@1445 544 code[4] == Bytecodes::_areturn), "should do");
never@1445 545 u2 index = Bytes::get_native_u2(&code[2]);
never@1445 546
never@1445 547 // Get the entry from the constant pool cache, and drop into
never@1445 548 // the slow path if it has not been resolved
coleenp@4037 549 ConstantPoolCache* cache = method->constants()->cache();
never@1445 550 ConstantPoolCacheEntry* entry = cache->entry_at(index);
never@1445 551 if (!entry->is_resolved(Bytecodes::_getfield)) {
twisti@1869 552 return normal_entry(method, 0, THREAD);
never@1445 553 }
never@1445 554
never@1445 555 // Get the result and push it onto the stack
never@1445 556 switch (entry->flag_state()) {
never@1445 557 case ltos:
never@1445 558 case dtos:
twisti@1869 559 stack->overflow_check(1, CHECK_0);
never@1445 560 stack->alloc(wordSize);
never@1445 561 break;
never@1445 562 }
never@1445 563 if (entry->is_volatile()) {
never@1445 564 switch (entry->flag_state()) {
never@1445 565 case ctos:
twisti@4237 566 SET_LOCALS_INT(object->char_field_acquire(entry->f2_as_index()), 0);
never@1445 567 break;
never@1445 568
never@1445 569 case btos:
kevinw@8368 570 case ztos:
twisti@4237 571 SET_LOCALS_INT(object->byte_field_acquire(entry->f2_as_index()), 0);
never@1445 572 break;
never@1445 573
never@1445 574 case stos:
twisti@4237 575 SET_LOCALS_INT(object->short_field_acquire(entry->f2_as_index()), 0);
never@1445 576 break;
never@1445 577
never@1445 578 case itos:
twisti@4237 579 SET_LOCALS_INT(object->int_field_acquire(entry->f2_as_index()), 0);
never@1445 580 break;
never@1445 581
never@1445 582 case ltos:
twisti@4237 583 SET_LOCALS_LONG(object->long_field_acquire(entry->f2_as_index()), 0);
never@1445 584 break;
never@1445 585
never@1445 586 case ftos:
twisti@4237 587 SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2_as_index()), 0);
never@1445 588 break;
never@1445 589
never@1445 590 case dtos:
twisti@4237 591 SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2_as_index()), 0);
never@1445 592 break;
never@1445 593
never@1445 594 case atos:
twisti@4237 595 SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2_as_index()), 0);
never@1445 596 break;
never@1445 597
never@1445 598 default:
never@1445 599 ShouldNotReachHere();
never@1445 600 }
never@1445 601 }
never@1445 602 else {
never@1445 603 switch (entry->flag_state()) {
never@1445 604 case ctos:
twisti@4237 605 SET_LOCALS_INT(object->char_field(entry->f2_as_index()), 0);
never@1445 606 break;
never@1445 607
never@1445 608 case btos:
kevinw@8368 609 case ztos:
twisti@4237 610 SET_LOCALS_INT(object->byte_field(entry->f2_as_index()), 0);
never@1445 611 break;
never@1445 612
never@1445 613 case stos:
twisti@4237 614 SET_LOCALS_INT(object->short_field(entry->f2_as_index()), 0);
never@1445 615 break;
never@1445 616
never@1445 617 case itos:
twisti@4237 618 SET_LOCALS_INT(object->int_field(entry->f2_as_index()), 0);
never@1445 619 break;
never@1445 620
never@1445 621 case ltos:
twisti@4237 622 SET_LOCALS_LONG(object->long_field(entry->f2_as_index()), 0);
never@1445 623 break;
never@1445 624
never@1445 625 case ftos:
twisti@4237 626 SET_LOCALS_FLOAT(object->float_field(entry->f2_as_index()), 0);
never@1445 627 break;
never@1445 628
never@1445 629 case dtos:
twisti@4237 630 SET_LOCALS_DOUBLE(object->double_field(entry->f2_as_index()), 0);
never@1445 631 break;
never@1445 632
never@1445 633 case atos:
twisti@4237 634 SET_LOCALS_OBJECT(object->obj_field(entry->f2_as_index()), 0);
never@1445 635 break;
never@1445 636
never@1445 637 default:
never@1445 638 ShouldNotReachHere();
never@1445 639 }
never@1445 640 }
twisti@1869 641
twisti@1869 642 // No deoptimized frames on the stack
twisti@1869 643 return 0;
never@1445 644 }
never@1445 645
coleenp@4037 646 int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
never@1445 647 JavaThread *thread = (JavaThread *) THREAD;
never@1445 648 ZeroStack *stack = thread->zero_stack();
never@1445 649
never@1445 650 // Drop into the slow path if we need a safepoint check
never@1445 651 if (SafepointSynchronize::do_call_back()) {
twisti@1869 652 return normal_entry(method, 0, THREAD);
never@1445 653 }
never@1445 654
never@1445 655 // Pop our parameters
never@1445 656 stack->set_sp(stack->sp() + method->size_of_parameters());
twisti@1869 657
twisti@1869 658 // No deoptimized frames on the stack
twisti@1869 659 return 0;
never@1445 660 }
never@1445 661
twisti@2762 662 // The new slots will be inserted before slot insert_before.
twisti@2762 663 // Slots < insert_before will have the same slot number after the insert.
twisti@2762 664 // Slots >= insert_before will become old_slot + num_slots.
twisti@2762 665 void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
twisti@2762 666 JavaThread *thread = (JavaThread *) THREAD;
twisti@2762 667 ZeroStack *stack = thread->zero_stack();
twisti@2762 668
twisti@2762 669 // Allocate the space
twisti@2762 670 stack->overflow_check(num_slots, CHECK);
twisti@2762 671 stack->alloc(num_slots * wordSize);
twisti@2762 672 intptr_t *vmslots = stack->sp();
twisti@2762 673
twisti@2762 674 // Shuffle everything up
twisti@2762 675 for (int i = 0; i < insert_before; i++)
twisti@2762 676 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i + num_slots), i);
twisti@2762 677 }
twisti@2762 678
twisti@2762 679 void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
twisti@2762 680 JavaThread *thread = (JavaThread *) THREAD;
twisti@2762 681 ZeroStack *stack = thread->zero_stack();
twisti@2762 682 intptr_t *vmslots = stack->sp();
twisti@2762 683
twisti@2762 684 // Move everything down
twisti@2762 685 for (int i = first_slot - 1; i >= 0; i--)
twisti@2762 686 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i + num_slots);
twisti@2762 687
twisti@2762 688 // Deallocate the space
twisti@2762 689 stack->set_sp(stack->sp() + num_slots);
twisti@2762 690 }
twisti@2762 691
twisti@2762 692 BasicType CppInterpreter::result_type_of_handle(oop method_handle) {
twisti@2762 693 oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
twisti@2762 694 oop return_type = java_lang_invoke_MethodType::rtype(method_type);
coleenp@4037 695 return java_lang_Class::as_BasicType(return_type, (Klass* *) NULL);
twisti@2762 696 }
twisti@2762 697
twisti@2762 698 intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
twisti@2762 699 oop method_handle) {
twisti@2762 700 oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
twisti@3969 701 int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
twisti@2762 702
twisti@2762 703 return stack->sp() + argument_slots;
twisti@2762 704 }
twisti@2762 705
twisti@2762 706 IRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,
twisti@2762 707 Symbol* name,
twisti@2762 708 char* message))
twisti@2762 709 THROW_MSG(name, message);
twisti@2762 710 IRT_END
twisti@2762 711
coleenp@4037 712 InterpreterFrame *InterpreterFrame::build(Method* const method, TRAPS) {
twisti@1814 713 JavaThread *thread = (JavaThread *) THREAD;
twisti@1814 714 ZeroStack *stack = thread->zero_stack();
twisti@1814 715
twisti@1814 716 // Calculate the size of the frame we'll build, including
twisti@1814 717 // any adjustments to the caller's frame that we'll make.
twisti@1814 718 int extra_locals = 0;
twisti@1814 719 int monitor_words = 0;
twisti@1814 720 int stack_words = 0;
twisti@1814 721
twisti@1814 722 if (!method->is_native()) {
twisti@1814 723 extra_locals = method->max_locals() - method->size_of_parameters();
twisti@1814 724 stack_words = method->max_stack();
never@1445 725 }
twisti@1814 726 if (method->is_synchronized()) {
twisti@1814 727 monitor_words = frame::interpreter_frame_monitor_size();
twisti@1814 728 }
twisti@1814 729 stack->overflow_check(
twisti@1814 730 extra_locals + header_words + monitor_words + stack_words, CHECK_NULL);
never@1445 731
twisti@1814 732 // Adjust the caller's stack frame to accomodate any additional
twisti@1814 733 // local variables we have contiguously with our parameters.
twisti@1814 734 for (int i = 0; i < extra_locals; i++)
twisti@1814 735 stack->push(0);
never@1445 736
never@1445 737 intptr_t *locals;
never@1445 738 if (method->is_native())
never@1445 739 locals = stack->sp() + (method->size_of_parameters() - 1);
never@1445 740 else
never@1445 741 locals = stack->sp() + (method->max_locals() - 1);
never@1445 742
never@1445 743 stack->push(0); // next_frame, filled in later
never@1445 744 intptr_t *fp = stack->sp();
never@1445 745 assert(fp - stack->sp() == next_frame_off, "should be");
never@1445 746
never@1445 747 stack->push(INTERPRETER_FRAME);
never@1445 748 assert(fp - stack->sp() == frame_type_off, "should be");
never@1445 749
never@1445 750 interpreterState istate =
never@1445 751 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter));
never@1445 752 assert(fp - stack->sp() == istate_off, "should be");
never@1445 753
never@1445 754 istate->set_locals(locals);
never@1445 755 istate->set_method(method);
never@1445 756 istate->set_self_link(istate);
never@1445 757 istate->set_prev_link(NULL);
never@1445 758 istate->set_thread(thread);
never@1445 759 istate->set_bcp(method->is_native() ? NULL : method->code_base());
never@1445 760 istate->set_constants(method->constants()->cache());
never@1445 761 istate->set_msg(BytecodeInterpreter::method_entry);
never@1445 762 istate->set_oop_temp(NULL);
never@1445 763 istate->set_mdx(NULL);
never@1445 764 istate->set_callee(NULL);
never@1445 765
never@1445 766 istate->set_monitor_base((BasicObjectLock *) stack->sp());
never@1445 767 if (method->is_synchronized()) {
never@1445 768 BasicObjectLock *monitor =
never@1445 769 (BasicObjectLock *) stack->alloc(monitor_words * wordSize);
never@1445 770 oop object;
never@1445 771 if (method->is_static())
never@2658 772 object = method->constants()->pool_holder()->java_mirror();
never@1445 773 else
coleenp@7675 774 object = (oop) (void*)locals[0];
never@1445 775 monitor->set_obj(object);
never@1445 776 }
never@1445 777
never@1445 778 istate->set_stack_base(stack->sp());
never@1445 779 istate->set_stack(stack->sp() - 1);
never@1445 780 if (stack_words)
never@1445 781 stack->alloc(stack_words * wordSize);
never@1445 782 istate->set_stack_limit(stack->sp() - 1);
never@1445 783
never@1445 784 return (InterpreterFrame *) fp;
never@1445 785 }
never@1445 786
never@1445 787 int AbstractInterpreter::BasicType_as_index(BasicType type) {
never@1445 788 int i = 0;
never@1445 789 switch (type) {
never@1445 790 case T_BOOLEAN: i = 0; break;
never@1445 791 case T_CHAR : i = 1; break;
never@1445 792 case T_BYTE : i = 2; break;
never@1445 793 case T_SHORT : i = 3; break;
never@1445 794 case T_INT : i = 4; break;
never@1445 795 case T_LONG : i = 5; break;
never@1445 796 case T_VOID : i = 6; break;
never@1445 797 case T_FLOAT : i = 7; break;
never@1445 798 case T_DOUBLE : i = 8; break;
never@1445 799 case T_OBJECT : i = 9; break;
never@1445 800 case T_ARRAY : i = 9; break;
never@1445 801 default : ShouldNotReachHere();
never@1445 802 }
never@1445 803 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
never@1445 804 "index out of bounds");
never@1445 805 return i;
never@1445 806 }
never@1445 807
never@1445 808 address InterpreterGenerator::generate_empty_entry() {
never@1445 809 if (!UseFastEmptyMethods)
never@1445 810 return NULL;
never@1445 811
never@1445 812 return generate_entry((address) CppInterpreter::empty_entry);
never@1445 813 }
never@1445 814
never@1445 815 address InterpreterGenerator::generate_accessor_entry() {
never@1445 816 if (!UseFastAccessorMethods)
never@1445 817 return NULL;
never@1445 818
never@1445 819 return generate_entry((address) CppInterpreter::accessor_entry);
never@1445 820 }
never@1445 821
johnc@2781 822 address InterpreterGenerator::generate_Reference_get_entry(void) {
jprovino@4542 823 #if INCLUDE_ALL_GCS
johnc@2781 824 if (UseG1GC) {
johnc@2781 825 // We need to generate have a routine that generates code to:
johnc@2781 826 // * load the value in the referent field
johnc@2781 827 // * passes that value to the pre-barrier.
johnc@2781 828 //
johnc@2781 829 // In the case of G1 this will record the value of the
johnc@2781 830 // referent in an SATB buffer if marking is active.
johnc@2781 831 // This will cause concurrent marking to mark the referent
johnc@2781 832 // field as live.
johnc@2781 833 Unimplemented();
johnc@2781 834 }
jprovino@4542 835 #endif // INCLUDE_ALL_GCS
johnc@2781 836
johnc@2781 837 // If G1 is not enabled then attempt to go through the accessor entry point
johnc@2781 838 // Reference.get is an accessor
johnc@2781 839 return generate_accessor_entry();
johnc@2781 840 }
johnc@2781 841
never@1445 842 address InterpreterGenerator::generate_native_entry(bool synchronized) {
never@1445 843 assert(synchronized == false, "should be");
never@1445 844
never@1445 845 return generate_entry((address) CppInterpreter::native_entry);
never@1445 846 }
never@1445 847
never@1445 848 address InterpreterGenerator::generate_normal_entry(bool synchronized) {
never@1445 849 assert(synchronized == false, "should be");
never@1445 850
never@1445 851 return generate_entry((address) CppInterpreter::normal_entry);
never@1445 852 }
never@1445 853
never@1445 854 address AbstractInterpreterGenerator::generate_method_entry(
never@1445 855 AbstractInterpreter::MethodKind kind) {
never@1445 856 address entry_point = NULL;
never@1445 857
never@1445 858 switch (kind) {
never@1445 859 case Interpreter::zerolocals:
never@1445 860 case Interpreter::zerolocals_synchronized:
never@1445 861 break;
never@1445 862
never@1445 863 case Interpreter::native:
never@1445 864 entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false);
never@1445 865 break;
never@1445 866
never@1445 867 case Interpreter::native_synchronized:
never@1445 868 entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false);
never@1445 869 break;
never@1445 870
never@1445 871 case Interpreter::empty:
never@1445 872 entry_point = ((InterpreterGenerator*) this)->generate_empty_entry();
never@1445 873 break;
never@1445 874
never@1445 875 case Interpreter::accessor:
never@1445 876 entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry();
never@1445 877 break;
never@1445 878
never@1445 879 case Interpreter::abstract:
never@1445 880 entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry();
never@1445 881 break;
never@1445 882
never@1445 883 case Interpreter::java_lang_math_sin:
never@1445 884 case Interpreter::java_lang_math_cos:
never@1445 885 case Interpreter::java_lang_math_tan:
never@1445 886 case Interpreter::java_lang_math_abs:
never@1445 887 case Interpreter::java_lang_math_log:
never@1445 888 case Interpreter::java_lang_math_log10:
never@1445 889 case Interpreter::java_lang_math_sqrt:
twisti@4237 890 case Interpreter::java_lang_math_pow:
twisti@4237 891 case Interpreter::java_lang_math_exp:
never@1445 892 entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);
never@1445 893 break;
never@1445 894
johnc@2781 895 case Interpreter::java_lang_ref_reference_get:
johnc@2781 896 entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry();
johnc@2781 897 break;
johnc@2781 898
never@1445 899 default:
never@1445 900 ShouldNotReachHere();
never@1445 901 }
never@1445 902
never@1445 903 if (entry_point == NULL)
never@1445 904 entry_point = ((InterpreterGenerator*) this)->generate_normal_entry(false);
never@1445 905
never@1445 906 return entry_point;
never@1445 907 }
never@1445 908
never@1445 909 InterpreterGenerator::InterpreterGenerator(StubQueue* code)
never@1445 910 : CppInterpreterGenerator(code) {
never@1445 911 generate_all();
never@1445 912 }
never@1445 913
never@1445 914 // Deoptimization helpers
never@1445 915
twisti@1814 916 InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
twisti@1814 917 ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
twisti@1814 918
never@1445 919 int size_in_words = size >> LogBytesPerWord;
never@1445 920 assert(size_in_words * wordSize == size, "unaligned");
never@1445 921 assert(size_in_words >= header_words, "too small");
twisti@1814 922 stack->overflow_check(size_in_words, CHECK_NULL);
never@1445 923
never@1445 924 stack->push(0); // next_frame, filled in later
never@1445 925 intptr_t *fp = stack->sp();
never@1445 926 assert(fp - stack->sp() == next_frame_off, "should be");
never@1445 927
never@1445 928 stack->push(INTERPRETER_FRAME);
never@1445 929 assert(fp - stack->sp() == frame_type_off, "should be");
never@1445 930
never@1445 931 interpreterState istate =
never@1445 932 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter));
never@1445 933 assert(fp - stack->sp() == istate_off, "should be");
never@1445 934 istate->set_self_link(NULL); // mark invalid
never@1445 935
never@1445 936 stack->alloc((size_in_words - header_words) * wordSize);
never@1445 937
never@1445 938 return (InterpreterFrame *) fp;
never@1445 939 }
never@1445 940
roland@6723 941 int AbstractInterpreter::size_activation(int max_stack,
roland@6723 942 int tempcount,
roland@6723 943 int extra_args,
roland@6723 944 int moncount,
roland@6723 945 int callee_param_count,
roland@6723 946 int callee_locals,
roland@6723 947 bool is_top_frame) {
roland@6723 948 int header_words = InterpreterFrame::header_words;
roland@6723 949 int monitor_words = moncount * frame::interpreter_frame_monitor_size();
roland@6723 950 int stack_words = is_top_frame ? max_stack : tempcount;
roland@6723 951 int callee_extra_locals = callee_locals - callee_param_count;
roland@6723 952
roland@6723 953 return header_words + monitor_words + stack_words + callee_extra_locals;
roland@6723 954 }
roland@6723 955
roland@6723 956 void AbstractInterpreter::layout_activation(Method* method,
roland@6723 957 int tempcount,
roland@6723 958 int popframe_extra_args,
roland@6723 959 int moncount,
roland@6723 960 int caller_actual_parameters,
roland@6723 961 int callee_param_count,
roland@6723 962 int callee_locals,
roland@6723 963 frame* caller,
roland@6723 964 frame* interpreter_frame,
roland@6723 965 bool is_top_frame,
roland@6723 966 bool is_bottom_frame) {
never@1445 967 assert(popframe_extra_args == 0, "what to do?");
never@1445 968 assert(!is_top_frame || (!callee_locals && !callee_param_count),
twisti@1960 969 "top frame should have no caller");
never@1445 970
never@1445 971 // This code must exactly match what InterpreterFrame::build
never@1445 972 // does (the full InterpreterFrame::build, that is, not the
never@1445 973 // one that creates empty frames for the deoptimizer).
never@1445 974 //
roland@6723 975 // interpreter_frame will be filled in. It's size is determined by
roland@6723 976 // a previous call to the size_activation() method,
never@1445 977 //
never@1445 978 // Note that tempcount is the current size of the expression
never@1445 979 // stack. For top most frames we will allocate a full sized
never@1445 980 // expression stack and not the trimmed version that non-top
never@1445 981 // frames have.
never@1445 982
never@1445 983 int monitor_words = moncount * frame::interpreter_frame_monitor_size();
roland@6723 984 intptr_t *locals = interpreter_frame->fp() + method->max_locals();
roland@6723 985 interpreterState istate = interpreter_frame->get_interpreterState();
roland@6723 986 intptr_t *monitor_base = (intptr_t*) istate;
roland@6723 987 intptr_t *stack_base = monitor_base - monitor_words;
roland@6723 988 intptr_t *stack = stack_base - tempcount - 1;
never@1445 989
roland@6723 990 BytecodeInterpreter::layout_interpreterState(istate,
roland@6723 991 caller,
roland@6723 992 NULL,
roland@6723 993 method,
roland@6723 994 locals,
roland@6723 995 stack,
roland@6723 996 stack_base,
roland@6723 997 monitor_base,
roland@6723 998 NULL,
roland@6723 999 is_top_frame);
never@1445 1000 }
never@1445 1001
never@1445 1002 void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
never@1445 1003 frame* caller,
never@1445 1004 frame* current,
coleenp@4037 1005 Method* method,
never@1445 1006 intptr_t* locals,
never@1445 1007 intptr_t* stack,
never@1445 1008 intptr_t* stack_base,
never@1445 1009 intptr_t* monitor_base,
never@1445 1010 intptr_t* frame_bottom,
never@1445 1011 bool is_top_frame) {
never@1445 1012 istate->set_locals(locals);
never@1445 1013 istate->set_method(method);
never@1445 1014 istate->set_self_link(istate);
never@1445 1015 istate->set_prev_link(NULL);
never@1445 1016 // thread will be set by a hacky repurposing of frame::patch_pc()
never@1445 1017 // bcp will be set by vframeArrayElement::unpack_on_stack()
never@1445 1018 istate->set_constants(method->constants()->cache());
never@1445 1019 istate->set_msg(BytecodeInterpreter::method_resume);
never@1445 1020 istate->set_bcp_advance(0);
never@1445 1021 istate->set_oop_temp(NULL);
never@1445 1022 istate->set_mdx(NULL);
never@1445 1023 if (caller->is_interpreted_frame()) {
never@1445 1024 interpreterState prev = caller->get_interpreterState();
never@1445 1025 prev->set_callee(method);
never@1445 1026 if (*prev->bcp() == Bytecodes::_invokeinterface)
never@1445 1027 prev->set_bcp_advance(5);
never@1445 1028 else
never@1445 1029 prev->set_bcp_advance(3);
never@1445 1030 }
never@1445 1031 istate->set_callee(NULL);
never@1445 1032 istate->set_monitor_base((BasicObjectLock *) monitor_base);
never@1445 1033 istate->set_stack_base(stack_base);
never@1445 1034 istate->set_stack(stack);
never@1445 1035 istate->set_stack_limit(stack_base - method->max_stack() - 1);
never@1445 1036 }
never@1445 1037
twisti@6039 1038 address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
never@1445 1039 ShouldNotCallThis();
twisti@5545 1040 return NULL;
never@1445 1041 }
never@1445 1042
never@1445 1043 address CppInterpreter::deopt_entry(TosState state, int length) {
never@1445 1044 return NULL;
never@1445 1045 }
never@1445 1046
never@1445 1047 // Helper for (runtime) stack overflow checks
never@1445 1048
coleenp@4037 1049 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
never@1445 1050 return 0;
never@1445 1051 }
never@1445 1052
never@1445 1053 // Helper for figuring out if frames are interpreter frames
never@1445 1054
never@1445 1055 bool CppInterpreter::contains(address pc) {
never@1445 1056 return false; // make frame::print_value_on work
never@1445 1057 }
never@1445 1058
never@1445 1059 // Result handlers and convertors
never@1445 1060
never@1445 1061 address CppInterpreterGenerator::generate_result_handler_for(
never@1445 1062 BasicType type) {
never@1445 1063 assembler()->advance(1);
never@1445 1064 return ShouldNotCallThisStub();
never@1445 1065 }
never@1445 1066
never@1445 1067 address CppInterpreterGenerator::generate_tosca_to_stack_converter(
never@1445 1068 BasicType type) {
never@1445 1069 assembler()->advance(1);
never@1445 1070 return ShouldNotCallThisStub();
never@1445 1071 }
never@1445 1072
never@1445 1073 address CppInterpreterGenerator::generate_stack_to_stack_converter(
never@1445 1074 BasicType type) {
never@1445 1075 assembler()->advance(1);
never@1445 1076 return ShouldNotCallThisStub();
never@1445 1077 }
never@1445 1078
never@1445 1079 address CppInterpreterGenerator::generate_stack_to_native_abi_converter(
never@1445 1080 BasicType type) {
never@1445 1081 assembler()->advance(1);
never@1445 1082 return ShouldNotCallThisStub();
never@1445 1083 }
never@1445 1084
never@1445 1085 #endif // CC_INTERP

mercurial