hotspot/src/cpu/x86/vm/assembler_x86.cpp
changeset 5426 470c15eda401
parent 5402 c51fd0c1d005
parent 5419 f2e8cc8c12ea
child 5694 1e0532a6abff
child 5547 f4b087cbb361
equal deleted inserted replaced
5409:95cd788badb7 5426:470c15eda401
     1 /*
     1 /*
     2  * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 1997-2010 Sun Microsystems, Inc.  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.
  6490   }
  6490   }
  6491   return off;
  6491   return off;
  6492 }
  6492 }
  6493 
  6493 
  6494 void MacroAssembler::load_sized_value(Register dst, Address src,
  6494 void MacroAssembler::load_sized_value(Register dst, Address src,
  6495                                       int size_in_bytes, bool is_signed) {
  6495                                       size_t size_in_bytes, bool is_signed) {
  6496   switch (size_in_bytes ^ (is_signed ? -1 : 0)) {
  6496   switch (size_in_bytes) {
  6497 #ifndef _LP64
  6497 #ifndef _LP64
  6498   // For case 8, caller is responsible for manually loading
  6498   // For case 8, caller is responsible for manually loading
  6499   // the second word into another register.
  6499   // the second word into another register.
  6500   case ~8:  // fall through:
  6500   case  8: movl(dst, src); break;
  6501   case  8:  movl(                dst, src ); break;
       
  6502 #else
  6501 #else
  6503   case ~8:  // fall through:
  6502   case  8: movq(dst, src); break;
  6504   case  8:  movq(                dst, src ); break;
       
  6505 #endif
  6503 #endif
  6506   case ~4:  // fall through:
  6504   case  4: movl(dst, src); break;
  6507   case  4:  movl(                dst, src ); break;
  6505   case  2: is_signed ? load_signed_short(dst, src) : load_unsigned_short(dst, src); break;
  6508   case ~2:  load_signed_short(   dst, src ); break;
  6506   case  1: is_signed ? load_signed_byte( dst, src) : load_unsigned_byte( dst, src); break;
  6509   case  2:  load_unsigned_short( dst, src ); break;
  6507   default: ShouldNotReachHere();
  6510   case ~1:  load_signed_byte(    dst, src ); break;
       
  6511   case  1:  load_unsigned_byte(  dst, src ); break;
       
  6512   default:  ShouldNotReachHere();
       
  6513   }
  6508   }
  6514 }
  6509 }
  6515 
  6510 
  6516 void MacroAssembler::mov32(AddressLiteral dst, Register src) {
  6511 void MacroAssembler::mov32(AddressLiteral dst, Register src) {
  6517   if (reachable(dst)) {
  6512   if (reachable(dst)) {
  7704 // argument list in JVM stack slots.  This field is either located directly
  7699 // argument list in JVM stack slots.  This field is either located directly
  7705 // in every method handle, or else is indirectly accessed through the
  7700 // in every method handle, or else is indirectly accessed through the
  7706 // method handle's MethodType.  This macro hides the distinction.
  7701 // method handle's MethodType.  This macro hides the distinction.
  7707 void MacroAssembler::load_method_handle_vmslots(Register vmslots_reg, Register mh_reg,
  7702 void MacroAssembler::load_method_handle_vmslots(Register vmslots_reg, Register mh_reg,
  7708                                                 Register temp_reg) {
  7703                                                 Register temp_reg) {
       
  7704   assert_different_registers(vmslots_reg, mh_reg, temp_reg);
  7709   if (UseCompressedOops)  unimplemented();  // field accesses must decode
  7705   if (UseCompressedOops)  unimplemented();  // field accesses must decode
  7710   // load mh.type.form.vmslots
  7706   // load mh.type.form.vmslots
  7711   if (java_dyn_MethodHandle::vmslots_offset_in_bytes() != 0) {
  7707   if (java_dyn_MethodHandle::vmslots_offset_in_bytes() != 0) {
  7712     // hoist vmslots into every mh to avoid dependent load chain
  7708     // hoist vmslots into every mh to avoid dependent load chain
  7713     movl(vmslots_reg, Address(mh_reg, delayed_value(java_dyn_MethodHandle::vmslots_offset_in_bytes, temp_reg)));
  7709     movl(vmslots_reg, Address(mh_reg, delayed_value(java_dyn_MethodHandle::vmslots_offset_in_bytes, temp_reg)));
  7742 
  7738 
  7743 
  7739 
  7744 Address MacroAssembler::argument_address(RegisterOrConstant arg_slot,
  7740 Address MacroAssembler::argument_address(RegisterOrConstant arg_slot,
  7745                                          int extra_slot_offset) {
  7741                                          int extra_slot_offset) {
  7746   // cf. TemplateTable::prepare_invoke(), if (load_receiver).
  7742   // cf. TemplateTable::prepare_invoke(), if (load_receiver).
  7747   int stackElementSize = Interpreter::stackElementSize();
  7743   int stackElementSize = Interpreter::stackElementSize;
  7748   int offset = Interpreter::expr_offset_in_bytes(extra_slot_offset+0);
  7744   int offset = Interpreter::expr_offset_in_bytes(extra_slot_offset+0);
  7749 #ifdef ASSERT
  7745 #ifdef ASSERT
  7750   int offset1 = Interpreter::expr_offset_in_bytes(extra_slot_offset+1);
  7746   int offset1 = Interpreter::expr_offset_in_bytes(extra_slot_offset+1);
  7751   assert(offset1 - offset == stackElementSize, "correct arithmetic");
  7747   assert(offset1 - offset == stackElementSize, "correct arithmetic");
  7752 #endif
  7748 #endif