Print this page
rev 1022 : 6829192: JSR 292 needs to support 64-bit x86
Summary: changes for method handles and invokedynamic
Reviewed-by: ?, ?

Split Close
Expand all
Collapse all
          --- old/src/cpu/x86/vm/interp_masm_x86_64.cpp
          +++ new/src/cpu/x86/vm/interp_masm_x86_64.cpp
↓ open down ↓ 177 lines elided ↑ open up ↑
 178  178  void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(
 179  179    Register reg,
 180  180    int bcp_offset) {
 181  181    assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode");
 182  182    movl(reg, Address(r13, bcp_offset));
 183  183    bswapl(reg);
 184  184    shrl(reg, 16);
 185  185  }
 186  186  
 187  187  
      188 +void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
      189 +                                                       int bcp_offset,
      190 +                                                       bool giant_index) {
      191 +  assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
      192 +  if (!giant_index) {
      193 +    load_unsigned_short(index, Address(r13, bcp_offset));
      194 +  } else {
      195 +    assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
      196 +    movl(index, Address(r13, bcp_offset));
      197 +    // Check if the secondary index definition is still ~x, otherwise
      198 +    // we have to change the following assembler code to calculate the
      199 +    // plain index.
      200 +    assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
      201 +    notl(index);  // convert to plain index
      202 +  }
      203 +}
      204 +
      205 +
 188  206  void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache,
 189  207                                                             Register index,
 190      -                                                           int bcp_offset) {
 191      -  assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
      208 +                                                           int bcp_offset,
      209 +                                                           bool giant_index) {
 192  210    assert(cache != index, "must use different registers");
 193      -  load_unsigned_short(index, Address(r13, bcp_offset));
      211 +  get_cache_index_at_bcp(index, bcp_offset, giant_index);
 194  212    movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
 195  213    assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
 196  214    // convert from field index to ConstantPoolCacheEntry index
 197  215    shll(index, 2);
 198  216  }
 199  217  
 200  218  
 201  219  void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache,
 202  220                                                                 Register tmp,
 203      -                                                               int bcp_offset) {
 204      -  assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
      221 +                                                               int bcp_offset,
      222 +                                                               bool giant_index) {
 205  223    assert(cache != tmp, "must use different register");
 206      -  load_unsigned_short(tmp, Address(r13, bcp_offset));
      224 +  get_cache_index_at_bcp(tmp, bcp_offset, giant_index);
 207  225    assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
 208  226    // convert from field index to ConstantPoolCacheEntry index
 209  227    // and from word offset to byte offset
 210  228    shll(tmp, 2 + LogBytesPerWord);
 211  229    movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
 212  230    // skip past the header
 213  231    addptr(cache, in_bytes(constantPoolCacheOopDesc::base_offset()));
 214  232    addptr(cache, tmp);  // construct pointer to cache entry
 215  233  }
 216  234  
↓ open down ↓ 1012 lines elided ↑ open up ↑
1229 1247      update_mdp_by_constant(mdp,
1230 1248                             in_bytes(VirtualCallData::
1231 1249                                      virtual_call_data_size()));
1232 1250      bind(profile_continue);
1233 1251    }
1234 1252  }
1235 1253  
1236 1254  
1237 1255  void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
1238 1256                                                       Register mdp,
1239      -                                                     Register reg2) {
     1257 +                                                     Register reg2,
     1258 +                                                     bool receiver_can_be_null) {
1240 1259    if (ProfileInterpreter) {
1241 1260      Label profile_continue;
1242 1261  
1243 1262      // If no method data exists, go to profile_continue.
1244 1263      test_method_data_pointer(mdp, profile_continue);
1245 1264  
1246 1265      // We are making a call.  Increment the count.
1247 1266      increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1248 1267  
     1268 +    Label skip_receiver_profile;
     1269 +    if (receiver_can_be_null) {
     1270 +      testptr(receiver, receiver);
     1271 +      jcc(Assembler::zero, skip_receiver_profile);
     1272 +    }
     1273 +
1249 1274      // Record the receiver type.
1250 1275      record_klass_in_profile(receiver, mdp, reg2);
     1276 +    bind(skip_receiver_profile);
1251 1277  
1252 1278      // The method data pointer needs to be updated to reflect the new target.
1253 1279      update_mdp_by_constant(mdp,
1254 1280                             in_bytes(VirtualCallData::
1255 1281                                      virtual_call_data_size()));
1256 1282      bind(profile_continue);
1257 1283    }
1258 1284  }
1259 1285  
1260 1286  // This routine creates a state machine for updating the multi-row
↓ open down ↓ 337 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX