hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp

Print this page
rev 611 : Merge
   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)interpreterRT_x86_64.cpp     1.27 07/09/17 09:26:03 JVM"
   3 #endif
   4 /*
   5  * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


  79     break;
  80   case 4:
  81     __ movl(c_rarg5, src);
  82     _num_int_args++;
  83     break;
  84   default:
  85     __ movl(rax, src);
  86     __ movl(Address(to(), _stack_offset), rax);
  87     _stack_offset += wordSize;
  88     break;
  89   }
  90 #endif
  91 }
  92 
  93 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
  94   const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
  95 
  96 #ifdef _WIN64
  97   switch (_num_args) {
  98   case 0:
  99     __ movq(c_rarg1, src);
 100     _num_args++;
 101     break;
 102   case 1:
 103     __ movq(c_rarg2, src);
 104     _num_args++;
 105     break;
 106   case 2:
 107     __ movq(c_rarg3, src);
 108     _num_args++;
 109     break;
 110   case 3:
 111   default:
 112     __ movq(rax, src);
 113     __ movq(Address(to(), _stack_offset), rax);
 114     _stack_offset += wordSize;
 115     break;
 116   }
 117 #else
 118   switch (_num_int_args) {
 119   case 0:
 120     __ movq(c_rarg1, src);
 121     _num_int_args++;
 122     break;
 123   case 1:
 124     __ movq(c_rarg2, src);
 125     _num_int_args++;
 126     break;
 127   case 2:
 128     __ movq(c_rarg3, src);
 129     _num_int_args++;
 130     break;
 131   case 3:
 132     __ movq(c_rarg4, src);
 133     _num_int_args++;
 134     break;
 135   case 4:
 136     __ movq(c_rarg5, src);
 137     _num_int_args++;
 138     break;
 139   default:
 140     __ movq(rax, src);
 141     __ movq(Address(to(), _stack_offset), rax);
 142     _stack_offset += wordSize;
 143     break;
 144   }
 145 #endif
 146 }
 147 
 148 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
 149   const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
 150 
 151 #ifdef _WIN64
 152   if (_num_args < Argument::n_float_register_parameters_c-1) {
 153     __ movflt(as_XMMRegister(++_num_args), src);
 154   } else {
 155     __ movl(rax, src);
 156     __ movl(Address(to(), _stack_offset), rax);
 157     _stack_offset += wordSize;
 158   }
 159 #else
 160   if (_num_fp_args < Argument::n_float_register_parameters_c) {
 161     __ movflt(as_XMMRegister(_num_fp_args++), src);
 162   } else {
 163     __ movl(rax, src);
 164     __ movl(Address(to(), _stack_offset), rax);
 165     _stack_offset += wordSize;
 166   }
 167 #endif
 168 }
 169 
 170 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
 171   const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
 172 
 173 #ifdef _WIN64
 174   if (_num_args < Argument::n_float_register_parameters_c-1) {
 175     __ movdbl(as_XMMRegister(++_num_args), src);
 176   } else {
 177     __ movq(rax, src);
 178     __ movq(Address(to(), _stack_offset), rax);
 179     _stack_offset += wordSize;
 180   }
 181 #else
 182   if (_num_fp_args < Argument::n_float_register_parameters_c) {
 183     __ movdbl(as_XMMRegister(_num_fp_args++), src);
 184   } else {
 185     __ movq(rax, src);
 186     __ movq(Address(to(), _stack_offset), rax);
 187     _stack_offset += wordSize;
 188   }
 189 #endif
 190 }
 191 
 192 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
 193   const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
 194 
 195 #ifdef _WIN64
 196   switch (_num_args) {
 197   case 0:
 198     assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
 199     __ leaq(c_rarg1, src);
 200     _num_args++;
 201     break;
 202   case 1:
 203     __ leaq(rax, src);
 204     __ xorl(c_rarg2, c_rarg2);
 205     __ cmpq(src, 0);
 206     __ cmovq(Assembler::notEqual, c_rarg2, rax);
 207     _num_args++;
 208     break;
 209   case 2:
 210     __ leaq(rax, src);
 211     __ xorl(c_rarg3, c_rarg3);
 212     __ cmpq(src, 0);
 213     __ cmovq(Assembler::notEqual, c_rarg3, rax);
 214     _num_args++;
 215     break;
 216   default:
 217     __ leaq(rax, src);
 218     __ xorl(temp(), temp());
 219     __ cmpq(src, 0);
 220     __ cmovq(Assembler::notEqual, temp(), rax);
 221     __ movq(Address(to(), _stack_offset), temp());
 222     _stack_offset += wordSize;
 223     break;
 224   }
 225 #else
 226   switch (_num_int_args) {
 227   case 0:
 228     assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
 229     __ leaq(c_rarg1, src);
 230     _num_int_args++;
 231     break;
 232   case 1:
 233     __ leaq(rax, src);
 234     __ xorl(c_rarg2, c_rarg2);
 235     __ cmpq(src, 0);
 236     __ cmovq(Assembler::notEqual, c_rarg2, rax);
 237     _num_int_args++;
 238     break;
 239   case 2:
 240     __ leaq(rax, src);
 241     __ xorl(c_rarg3, c_rarg3);
 242     __ cmpq(src, 0);
 243     __ cmovq(Assembler::notEqual, c_rarg3, rax);
 244     _num_int_args++;
 245     break;
 246   case 3:
 247     __ leaq(rax, src);
 248     __ xorl(c_rarg4, c_rarg4);
 249     __ cmpq(src, 0);
 250     __ cmovq(Assembler::notEqual, c_rarg4, rax);
 251     _num_int_args++;
 252     break;
 253   case 4:
 254     __ leaq(rax, src);
 255     __ xorl(c_rarg5, c_rarg5);
 256     __ cmpq(src, 0);
 257     __ cmovq(Assembler::notEqual, c_rarg5, rax);
 258     _num_int_args++;
 259     break;
 260   default:
 261     __ leaq(rax, src);
 262     __ xorl(temp(), temp());
 263     __ cmpq(src, 0);
 264     __ cmovq(Assembler::notEqual, temp(), rax);
 265     __ movq(Address(to(), _stack_offset), temp());
 266     _stack_offset += wordSize;
 267     break;
 268   }
 269 #endif
 270 }
 271 
 272 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
 273   // generate code to handle arguments
 274   iterate(fingerprint);
 275 
 276   // return result handler
 277   __ lea(rax, ExternalAddress(Interpreter::result_handler(method()->result_type())));
 278   __ ret(0);
 279 
 280   __ flush();
 281 }
 282 
 283 
 284 // Implementation of SignatureHandlerLibrary
 285 





   1 /*
   2  * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


  76     break;
  77   case 4:
  78     __ movl(c_rarg5, src);
  79     _num_int_args++;
  80     break;
  81   default:
  82     __ movl(rax, src);
  83     __ movl(Address(to(), _stack_offset), rax);
  84     _stack_offset += wordSize;
  85     break;
  86   }
  87 #endif
  88 }
  89 
  90 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
  91   const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
  92 
  93 #ifdef _WIN64
  94   switch (_num_args) {
  95   case 0:
  96     __ movptr(c_rarg1, src);
  97     _num_args++;
  98     break;
  99   case 1:
 100     __ movptr(c_rarg2, src);
 101     _num_args++;
 102     break;
 103   case 2:
 104     __ movptr(c_rarg3, src);
 105     _num_args++;
 106     break;
 107   case 3:
 108   default:
 109     __ movptr(rax, src);
 110     __ movptr(Address(to(), _stack_offset), rax);
 111     _stack_offset += wordSize;
 112     break;
 113   }
 114 #else
 115   switch (_num_int_args) {
 116   case 0:
 117     __ movptr(c_rarg1, src);
 118     _num_int_args++;
 119     break;
 120   case 1:
 121     __ movptr(c_rarg2, src);
 122     _num_int_args++;
 123     break;
 124   case 2:
 125     __ movptr(c_rarg3, src);
 126     _num_int_args++;
 127     break;
 128   case 3:
 129     __ movptr(c_rarg4, src);
 130     _num_int_args++;
 131     break;
 132   case 4:
 133     __ movptr(c_rarg5, src);
 134     _num_int_args++;
 135     break;
 136   default:
 137     __ movptr(rax, src);
 138     __ movptr(Address(to(), _stack_offset), rax);
 139     _stack_offset += wordSize;
 140     break;
 141   }
 142 #endif
 143 }
 144 
 145 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
 146   const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
 147 
 148 #ifdef _WIN64
 149   if (_num_args < Argument::n_float_register_parameters_c-1) {
 150     __ movflt(as_XMMRegister(++_num_args), src);
 151   } else {
 152     __ movl(rax, src);
 153     __ movl(Address(to(), _stack_offset), rax);
 154     _stack_offset += wordSize;
 155   }
 156 #else
 157   if (_num_fp_args < Argument::n_float_register_parameters_c) {
 158     __ movflt(as_XMMRegister(_num_fp_args++), src);
 159   } else {
 160     __ movl(rax, src);
 161     __ movl(Address(to(), _stack_offset), rax);
 162     _stack_offset += wordSize;
 163   }
 164 #endif
 165 }
 166 
 167 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
 168   const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
 169 
 170 #ifdef _WIN64
 171   if (_num_args < Argument::n_float_register_parameters_c-1) {
 172     __ movdbl(as_XMMRegister(++_num_args), src);
 173   } else {
 174     __ movptr(rax, src);
 175     __ movptr(Address(to(), _stack_offset), rax);
 176     _stack_offset += wordSize;
 177   }
 178 #else
 179   if (_num_fp_args < Argument::n_float_register_parameters_c) {
 180     __ movdbl(as_XMMRegister(_num_fp_args++), src);
 181   } else {
 182     __ movptr(rax, src);
 183     __ movptr(Address(to(), _stack_offset), rax);
 184     _stack_offset += wordSize;
 185   }
 186 #endif
 187 }
 188 
 189 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
 190   const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
 191 
 192 #ifdef _WIN64
 193   switch (_num_args) {
 194   case 0:
 195     assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
 196     __ lea(c_rarg1, src);
 197     _num_args++;
 198     break;
 199   case 1:
 200     __ lea(rax, src);
 201     __ xorl(c_rarg2, c_rarg2);
 202     __ cmpptr(src, 0);
 203     __ cmov(Assembler::notEqual, c_rarg2, rax);
 204     _num_args++;
 205     break;
 206   case 2:
 207     __ lea(rax, src);
 208     __ xorl(c_rarg3, c_rarg3);
 209     __ cmpptr(src, 0);
 210     __ cmov(Assembler::notEqual, c_rarg3, rax);
 211     _num_args++;
 212     break;
 213   default:
 214     __ lea(rax, src);
 215     __ xorl(temp(), temp());
 216     __ cmpptr(src, 0);
 217     __ cmov(Assembler::notEqual, temp(), rax);
 218     __ movptr(Address(to(), _stack_offset), temp());
 219     _stack_offset += wordSize;
 220     break;
 221   }
 222 #else
 223   switch (_num_int_args) {
 224   case 0:
 225     assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
 226     __ lea(c_rarg1, src);
 227     _num_int_args++;
 228     break;
 229   case 1:
 230     __ lea(rax, src);
 231     __ xorl(c_rarg2, c_rarg2);
 232     __ cmpptr(src, 0);
 233     __ cmov(Assembler::notEqual, c_rarg2, rax);
 234     _num_int_args++;
 235     break;
 236   case 2:
 237     __ lea(rax, src);
 238     __ xorl(c_rarg3, c_rarg3);
 239     __ cmpptr(src, 0);
 240     __ cmov(Assembler::notEqual, c_rarg3, rax);
 241     _num_int_args++;
 242     break;
 243   case 3:
 244     __ lea(rax, src);
 245     __ xorl(c_rarg4, c_rarg4);
 246     __ cmpptr(src, 0);
 247     __ cmov(Assembler::notEqual, c_rarg4, rax);
 248     _num_int_args++;
 249     break;
 250   case 4:
 251     __ lea(rax, src);
 252     __ xorl(c_rarg5, c_rarg5);
 253     __ cmpptr(src, 0);
 254     __ cmov(Assembler::notEqual, c_rarg5, rax);
 255     _num_int_args++;
 256     break;
 257   default:
 258     __ lea(rax, src);
 259     __ xorl(temp(), temp());
 260     __ cmpptr(src, 0);
 261     __ cmov(Assembler::notEqual, temp(), rax);
 262     __ movptr(Address(to(), _stack_offset), temp());
 263     _stack_offset += wordSize;
 264     break;
 265   }
 266 #endif
 267 }
 268 
 269 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
 270   // generate code to handle arguments
 271   iterate(fingerprint);
 272 
 273   // return result handler
 274   __ lea(rax, ExternalAddress(Interpreter::result_handler(method()->result_type())));
 275   __ ret(0);
 276 
 277   __ flush();
 278 }
 279 
 280 
 281 // Implementation of SignatureHandlerLibrary
 282