src/cpu/x86/vm/methodHandles_x86.cpp

changeset 2436
d810e9a3fc33
parent 2411
8d0b933dda2d
child 2565
28bf941f445e
equal deleted inserted replaced
2435:78e248949382 2436:d810e9a3fc33
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
388 //------------------------------------------------------------------------------ 388 //------------------------------------------------------------------------------
389 // MethodHandles::generate_method_handle_stub 389 // MethodHandles::generate_method_handle_stub
390 // 390 //
391 // Generate an "entry" field for a method handle. 391 // Generate an "entry" field for a method handle.
392 // This determines how the method handle will respond to calls. 392 // This determines how the method handle will respond to calls.
393 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek, TRAPS) { 393 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) {
394 // Here is the register state during an interpreted call, 394 // Here is the register state during an interpreted call,
395 // as set up by generate_method_handle_interpreter_entry(): 395 // as set up by generate_method_handle_interpreter_entry():
396 // - rbx: garbage temp (was MethodHandle.invoke methodOop, unused) 396 // - rbx: garbage temp (was MethodHandle.invoke methodOop, unused)
397 // - rcx: receiver method handle 397 // - rcx: receiver method handle
398 // - rax: method handle type (only used by the check_mtype entry point) 398 // - rax: method handle type (only used by the check_mtype entry point)
449 { 449 {
450 // Not a real MH entry, but rather shared code for raising an 450 // Not a real MH entry, but rather shared code for raising an
451 // exception. Since we use a C2I adapter to set up the 451 // exception. Since we use a C2I adapter to set up the
452 // interpreter state, arguments are expected in compiler 452 // interpreter state, arguments are expected in compiler
453 // argument registers. 453 // argument registers.
454 methodHandle mh(raise_exception_method()); 454 assert(raise_exception_method(), "must be set");
455 address c2i_entry = methodOopDesc::make_adapters(mh, CHECK); 455 address c2i_entry = raise_exception_method()->get_c2i_entry();
456 assert(c2i_entry, "method must be linked");
456 457
457 const Register rdi_pc = rax; 458 const Register rdi_pc = rax;
458 __ pop(rdi_pc); // caller PC 459 __ pop(rdi_pc); // caller PC
459 __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started 460 __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started
460 461

mercurial