src/cpu/x86/vm/methodHandles_x86.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7010180 Sdiff src/cpu/x86/vm

src/cpu/x86/vm/methodHandles_x86.cpp

Print this page




 373 int MethodHandles::adapter_conversion_ops_supported_mask() {
 374   return ((1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY)
 375          |(1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW)
 376          |(1<<sun_dyn_AdapterMethodHandle::OP_CHECK_CAST)
 377          |(1<<sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM)
 378          |(1<<sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM)
 379          |(1<<sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS)
 380          |(1<<sun_dyn_AdapterMethodHandle::OP_ROT_ARGS)
 381          |(1<<sun_dyn_AdapterMethodHandle::OP_DUP_ARGS)
 382          |(1<<sun_dyn_AdapterMethodHandle::OP_DROP_ARGS)
 383          //|(1<<sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
 384          );
 385   // FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
 386 }
 387 
 388 //------------------------------------------------------------------------------
 389 // MethodHandles::generate_method_handle_stub
 390 //
 391 // Generate an "entry" field for a method handle.
 392 // This determines how the method handle will respond to calls.
 393 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek, TRAPS) {
 394   // Here is the register state during an interpreted call,
 395   // as set up by generate_method_handle_interpreter_entry():
 396   // - rbx: garbage temp (was MethodHandle.invoke methodOop, unused)
 397   // - rcx: receiver method handle
 398   // - rax: method handle type (only used by the check_mtype entry point)
 399   // - rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted)
 400   // - rdx: garbage temp, can blow away
 401 
 402   const Register rcx_recv    = rcx;
 403   const Register rax_argslot = rax;
 404   const Register rbx_temp    = rbx;
 405   const Register rdx_temp    = rdx;
 406 
 407   // This guy is set up by prepare_to_jump_from_interpreted (from interpreted calls)
 408   // and gen_c2i_adapter (from compiled calls):
 409   const Register saved_last_sp = LP64_ONLY(r13) NOT_LP64(rsi);
 410 
 411   // Argument registers for _raise_exception.
 412   // 32-bit: Pass first two oop/int args in registers ECX and EDX.
 413   const Register rarg0_code     = LP64_ONLY(j_rarg0) NOT_LP64(rcx);


 434   const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes();
 435 
 436   if (have_entry(ek)) {
 437     __ nop();                   // empty stubs make SG sick
 438     return;
 439   }
 440 
 441   address interp_entry = __ pc();
 442 
 443   trace_method_handle(_masm, entry_name(ek));
 444 
 445   BLOCK_COMMENT(entry_name(ek));
 446 
 447   switch ((int) ek) {
 448   case _raise_exception:
 449     {
 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
 452       // interpreter state, arguments are expected in compiler
 453       // argument registers.
 454       methodHandle mh(raise_exception_method());
 455       address c2i_entry = methodOopDesc::make_adapters(mh, CHECK);

 456 
 457       const Register rdi_pc = rax;
 458       __ pop(rdi_pc);  // caller PC
 459       __ mov(rsp, saved_last_sp);  // cut the stack back to where the caller started
 460 
 461       Register rbx_method = rbx_temp;
 462       Label L_no_method;
 463       // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
 464       __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method));
 465       __ testptr(rbx_method, rbx_method);
 466       __ jccb(Assembler::zero, L_no_method);
 467 
 468       const int jobject_oop_offset = 0;
 469       __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset));  // dereference the jobject
 470       __ testptr(rbx_method, rbx_method);
 471       __ jccb(Assembler::zero, L_no_method);
 472       __ verify_oop(rbx_method);
 473 
 474       // 32-bit: push remaining arguments as if coming from the compiler.
 475       NOT_LP64(__ push(rarg2_required));




 373 int MethodHandles::adapter_conversion_ops_supported_mask() {
 374   return ((1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_ONLY)
 375          |(1<<sun_dyn_AdapterMethodHandle::OP_RETYPE_RAW)
 376          |(1<<sun_dyn_AdapterMethodHandle::OP_CHECK_CAST)
 377          |(1<<sun_dyn_AdapterMethodHandle::OP_PRIM_TO_PRIM)
 378          |(1<<sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM)
 379          |(1<<sun_dyn_AdapterMethodHandle::OP_SWAP_ARGS)
 380          |(1<<sun_dyn_AdapterMethodHandle::OP_ROT_ARGS)
 381          |(1<<sun_dyn_AdapterMethodHandle::OP_DUP_ARGS)
 382          |(1<<sun_dyn_AdapterMethodHandle::OP_DROP_ARGS)
 383          //|(1<<sun_dyn_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
 384          );
 385   // FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
 386 }
 387 
 388 //------------------------------------------------------------------------------
 389 // MethodHandles::generate_method_handle_stub
 390 //
 391 // Generate an "entry" field for a method handle.
 392 // This determines how the method handle will respond to calls.
 393 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) {
 394   // Here is the register state during an interpreted call,
 395   // as set up by generate_method_handle_interpreter_entry():
 396   // - rbx: garbage temp (was MethodHandle.invoke methodOop, unused)
 397   // - rcx: receiver method handle
 398   // - rax: method handle type (only used by the check_mtype entry point)
 399   // - rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted)
 400   // - rdx: garbage temp, can blow away
 401 
 402   const Register rcx_recv    = rcx;
 403   const Register rax_argslot = rax;
 404   const Register rbx_temp    = rbx;
 405   const Register rdx_temp    = rdx;
 406 
 407   // This guy is set up by prepare_to_jump_from_interpreted (from interpreted calls)
 408   // and gen_c2i_adapter (from compiled calls):
 409   const Register saved_last_sp = LP64_ONLY(r13) NOT_LP64(rsi);
 410 
 411   // Argument registers for _raise_exception.
 412   // 32-bit: Pass first two oop/int args in registers ECX and EDX.
 413   const Register rarg0_code     = LP64_ONLY(j_rarg0) NOT_LP64(rcx);


 434   const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes();
 435 
 436   if (have_entry(ek)) {
 437     __ nop();                   // empty stubs make SG sick
 438     return;
 439   }
 440 
 441   address interp_entry = __ pc();
 442 
 443   trace_method_handle(_masm, entry_name(ek));
 444 
 445   BLOCK_COMMENT(entry_name(ek));
 446 
 447   switch ((int) ek) {
 448   case _raise_exception:
 449     {
 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
 452       // interpreter state, arguments are expected in compiler
 453       // argument registers.
 454       assert(raise_exception_method(), "must be set");
 455       address c2i_entry = raise_exception_method()->get_c2i_entry();
 456       assert(c2i_entry, "method must be linked");
 457 
 458       const Register rdi_pc = rax;
 459       __ pop(rdi_pc);  // caller PC
 460       __ mov(rsp, saved_last_sp);  // cut the stack back to where the caller started
 461 
 462       Register rbx_method = rbx_temp;
 463       Label L_no_method;
 464       // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
 465       __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method));
 466       __ testptr(rbx_method, rbx_method);
 467       __ jccb(Assembler::zero, L_no_method);
 468 
 469       const int jobject_oop_offset = 0;
 470       __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset));  // dereference the jobject
 471       __ testptr(rbx_method, rbx_method);
 472       __ jccb(Assembler::zero, L_no_method);
 473       __ verify_oop(rbx_method);
 474 
 475       // 32-bit: push remaining arguments as if coming from the compiler.
 476       NOT_LP64(__ push(rarg2_required));


src/cpu/x86/vm/methodHandles_x86.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File