hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp
changeset 25916 c5c22fab48fd
parent 24322 c2978d1578e3
child 26705 fca1785e7084
equal deleted inserted replaced
25915:f43b5dab2dd3 25916:c5c22fab48fd
   117     bne(CCR0, L);
   117     bne(CCR0, L);
   118 
   118 
   119     // Call the Interpreter::remove_activation_preserving_args_entry()
   119     // Call the Interpreter::remove_activation_preserving_args_entry()
   120     // func to get the address of the same-named entrypoint in the
   120     // func to get the address of the same-named entrypoint in the
   121     // generated interpreter code.
   121     // generated interpreter code.
       
   122 #if defined(ABI_ELFv2)
       
   123     call_c(CAST_FROM_FN_PTR(address,
       
   124                             Interpreter::remove_activation_preserving_args_entry),
       
   125            relocInfo::none);
       
   126 #else
   122     call_c(CAST_FROM_FN_PTR(FunctionDescriptor*,
   127     call_c(CAST_FROM_FN_PTR(FunctionDescriptor*,
   123                             Interpreter::remove_activation_preserving_args_entry),
   128                             Interpreter::remove_activation_preserving_args_entry),
   124            relocInfo::none);
   129            relocInfo::none);
       
   130 #endif
   125 
   131 
   126     // Jump to Interpreter::_remove_activation_preserving_args_entry.
   132     // Jump to Interpreter::_remove_activation_preserving_args_entry.
   127     mtctr(R3_RET);
   133     mtctr(R3_RET);
   128     bctr();
   134     bctr();
   129 
   135 
   329 }
   335 }
   330 
   336 
   331 void InterpreterMacroAssembler::get_2_byte_integer_at_bcp(int         bcp_offset,
   337 void InterpreterMacroAssembler::get_2_byte_integer_at_bcp(int         bcp_offset,
   332                                                           Register    Rdst,
   338                                                           Register    Rdst,
   333                                                           signedOrNot is_signed) {
   339                                                           signedOrNot is_signed) {
       
   340 #if defined(VM_LITTLE_ENDIAN)
       
   341   if (bcp_offset) {
       
   342     load_const_optimized(Rdst, bcp_offset);
       
   343     lhbrx(Rdst, R14_bcp, Rdst);
       
   344   } else {
       
   345     lhbrx(Rdst, R14_bcp);
       
   346   }
       
   347   if (is_signed == Signed) {
       
   348     extsh(Rdst, Rdst);
       
   349   }
       
   350 #else
   334   // Read Java big endian format.
   351   // Read Java big endian format.
   335   if (is_signed == Signed) {
   352   if (is_signed == Signed) {
   336     lha(Rdst, bcp_offset, R14_bcp);
   353     lha(Rdst, bcp_offset, R14_bcp);
   337   } else {
   354   } else {
   338     lhz(Rdst, bcp_offset, R14_bcp);
   355     lhz(Rdst, bcp_offset, R14_bcp);
   339   }
   356   }
   340 #if 0
       
   341   assert(Rtmp != Rdst, "need separate temp register");
       
   342   Register Rfirst = Rtmp;
       
   343   lbz(Rfirst, bcp_offset, R14_bcp); // first byte
       
   344   lbz(Rdst, bcp_offset+1, R14_bcp); // second byte
       
   345 
       
   346   // Rdst = ((Rfirst<<8) & 0xFF00) | (Rdst &~ 0xFF00)
       
   347   rldimi(/*RA=*/Rdst, /*RS=*/Rfirst, /*sh=*/8, /*mb=*/48);
       
   348   if (is_signed == Signed) {
       
   349     extsh(Rdst, Rdst);
       
   350   }
       
   351 #endif
   357 #endif
   352 }
   358 }
   353 
   359 
   354 void InterpreterMacroAssembler::get_4_byte_integer_at_bcp(int         bcp_offset,
   360 void InterpreterMacroAssembler::get_4_byte_integer_at_bcp(int         bcp_offset,
   355                                                           Register    Rdst,
   361                                                           Register    Rdst,
   356                                                           signedOrNot is_signed) {
   362                                                           signedOrNot is_signed) {
       
   363 #if defined(VM_LITTLE_ENDIAN)
       
   364   if (bcp_offset) {
       
   365     load_const_optimized(Rdst, bcp_offset);
       
   366     lwbrx(Rdst, R14_bcp, Rdst);
       
   367   } else {
       
   368     lwbrx(Rdst, R14_bcp);
       
   369   }
       
   370   if (is_signed == Signed) {
       
   371     extsw(Rdst, Rdst);
       
   372   }
       
   373 #else
   357   // Read Java big endian format.
   374   // Read Java big endian format.
   358   if (bcp_offset & 3) { // Offset unaligned?
   375   if (bcp_offset & 3) { // Offset unaligned?
   359     load_const_optimized(Rdst, bcp_offset);
   376     load_const_optimized(Rdst, bcp_offset);
   360     if (is_signed == Signed) {
   377     if (is_signed == Signed) {
   361       lwax(Rdst, R14_bcp, Rdst);
   378       lwax(Rdst, R14_bcp, Rdst);
   367       lwa(Rdst, bcp_offset, R14_bcp);
   384       lwa(Rdst, bcp_offset, R14_bcp);
   368     } else {
   385     } else {
   369       lwz(Rdst, bcp_offset, R14_bcp);
   386       lwz(Rdst, bcp_offset, R14_bcp);
   370     }
   387     }
   371   }
   388   }
   372 }
   389 #endif
       
   390 }
       
   391 
   373 
   392 
   374 // Load the constant pool cache index from the bytecode stream.
   393 // Load the constant pool cache index from the bytecode stream.
   375 //
   394 //
   376 // Kills / writes:
   395 // Kills / writes:
   377 //   - Rdst, Rscratch
   396 //   - Rdst, Rscratch
   378 void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_offset, size_t index_size) {
   397 void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_offset, size_t index_size) {
   379   assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
   398   assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
       
   399   // Cache index is always in the native format, courtesy of Rewriter.
   380   if (index_size == sizeof(u2)) {
   400   if (index_size == sizeof(u2)) {
   381     get_2_byte_integer_at_bcp(bcp_offset, Rdst, Unsigned);
   401     lhz(Rdst, bcp_offset, R14_bcp);
   382   } else if (index_size == sizeof(u4)) {
   402   } else if (index_size == sizeof(u4)) {
   383     get_4_byte_integer_at_bcp(bcp_offset, Rdst, Signed);
   403     if (bcp_offset & 3) {
       
   404       load_const_optimized(Rdst, bcp_offset);
       
   405       lwax(Rdst, R14_bcp, Rdst);
       
   406     } else {
       
   407       lwa(Rdst, bcp_offset, R14_bcp);
       
   408     }
   384     assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
   409     assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
   385     nand(Rdst, Rdst, Rdst); // convert to plain index
   410     nand(Rdst, Rdst, Rdst); // convert to plain index
   386   } else if (index_size == sizeof(u1)) {
   411   } else if (index_size == sizeof(u1)) {
   387     lbz(Rdst, bcp_offset, R14_bcp);
   412     lbz(Rdst, bcp_offset, R14_bcp);
   388   } else {
   413   } else {
   393 
   418 
   394 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size) {
   419 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size) {
   395   get_cache_index_at_bcp(cache, bcp_offset, index_size);
   420   get_cache_index_at_bcp(cache, bcp_offset, index_size);
   396   sldi(cache, cache, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord));
   421   sldi(cache, cache, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord));
   397   add(cache, R27_constPoolCache, cache);
   422   add(cache, R27_constPoolCache, cache);
       
   423 }
       
   424 
       
   425 // Load 4-byte signed or unsigned integer in Java format (that is, big-endian format)
       
   426 // from (Rsrc)+offset.
       
   427 void InterpreterMacroAssembler::get_u4(Register Rdst, Register Rsrc, int offset,
       
   428                                        signedOrNot is_signed) {
       
   429 #if defined(VM_LITTLE_ENDIAN)
       
   430   if (offset) {
       
   431     load_const_optimized(Rdst, offset);
       
   432     lwbrx(Rdst, Rdst, Rsrc);
       
   433   } else {
       
   434     lwbrx(Rdst, Rsrc);
       
   435   }
       
   436   if (is_signed == Signed) {
       
   437     extsw(Rdst, Rdst);
       
   438   }
       
   439 #else
       
   440   if (is_signed == Signed) {
       
   441     lwa(Rdst, offset, Rsrc);
       
   442   } else {
       
   443     lwz(Rdst, offset, Rsrc);
       
   444   }
       
   445 #endif
   398 }
   446 }
   399 
   447 
   400 // Load object from cpool->resolved_references(index).
   448 // Load object from cpool->resolved_references(index).
   401 void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index) {
   449 void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index) {
   402   assert_different_registers(result, index);
   450   assert_different_registers(result, index);