Mercurial > hg > truffle
comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 644:c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
Summary: Code in interp_masm, stubGenerator, c1_LIRAssembler, and AD files moved into MacroAssembler.
Reviewed-by: kvn
author | jrose |
---|---|
date | Fri, 13 Mar 2009 18:39:22 -0700 |
parents | dc3ad84615cf |
children | bd441136a5ce |
comparison
equal
deleted
inserted
replaced
643:c771b7f43bbf | 644:c517646eef23 |
---|---|
1352 } | 1352 } |
1353 break; | 1353 break; |
1354 | 1354 |
1355 case slow_subtype_check_id: | 1355 case slow_subtype_check_id: |
1356 { | 1356 { |
1357 // Typical calling sequence: | |
1358 // __ push(klass_RInfo); // object klass or other subclass | |
1359 // __ push(sup_k_RInfo); // array element klass or other superclass | |
1360 // __ call(slow_subtype_check); | |
1361 // Note that the subclass is pushed first, and is therefore deepest. | |
1362 // Previous versions of this code reversed the names 'sub' and 'super'. | |
1363 // This was operationally harmless but made the code unreadable. | |
1357 enum layout { | 1364 enum layout { |
1358 rax_off, SLOT2(raxH_off) | 1365 rax_off, SLOT2(raxH_off) |
1359 rcx_off, SLOT2(rcxH_off) | 1366 rcx_off, SLOT2(rcxH_off) |
1360 rsi_off, SLOT2(rsiH_off) | 1367 rsi_off, SLOT2(rsiH_off) |
1361 rdi_off, SLOT2(rdiH_off) | 1368 rdi_off, SLOT2(rdiH_off) |
1362 // saved_rbp_off, SLOT2(saved_rbpH_off) | 1369 // saved_rbp_off, SLOT2(saved_rbpH_off) |
1363 return_off, SLOT2(returnH_off) | 1370 return_off, SLOT2(returnH_off) |
1364 sub_off, SLOT2(subH_off) | 1371 sup_k_off, SLOT2(sup_kH_off) |
1365 super_off, SLOT2(superH_off) | 1372 klass_off, SLOT2(superH_off) |
1366 framesize | 1373 framesize, |
1374 result_off = klass_off // deepest argument is also the return value | |
1367 }; | 1375 }; |
1368 | 1376 |
1369 __ set_info("slow_subtype_check", dont_gc_arguments); | 1377 __ set_info("slow_subtype_check", dont_gc_arguments); |
1370 __ push(rdi); | 1378 __ push(rdi); |
1371 __ push(rsi); | 1379 __ push(rsi); |
1372 __ push(rcx); | 1380 __ push(rcx); |
1373 __ push(rax); | 1381 __ push(rax); |
1374 | 1382 |
1375 // This is called by pushing args and not with C abi | 1383 // This is called by pushing args and not with C abi |
1376 __ movptr(rsi, Address(rsp, (super_off) * VMRegImpl::stack_slot_size)); // super | 1384 __ movptr(rsi, Address(rsp, (klass_off) * VMRegImpl::stack_slot_size)); // subclass |
1377 __ movptr(rax, Address(rsp, (sub_off ) * VMRegImpl::stack_slot_size)); // sub | 1385 __ movptr(rax, Address(rsp, (sup_k_off) * VMRegImpl::stack_slot_size)); // superclass |
1378 | |
1379 __ movptr(rdi,Address(rsi,sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes())); | |
1380 // since size is postive movl does right thing on 64bit | |
1381 __ movl(rcx, Address(rdi, arrayOopDesc::length_offset_in_bytes())); | |
1382 __ addptr(rdi, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); | |
1383 | 1386 |
1384 Label miss; | 1387 Label miss; |
1385 __ repne_scan(); | 1388 __ check_klass_subtype_slow_path(rsi, rax, rcx, rdi, NULL, &miss); |
1386 __ jcc(Assembler::notEqual, miss); | 1389 |
1387 __ movptr(Address(rsi,sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes()), rax); | 1390 // fallthrough on success: |
1388 __ movptr(Address(rsp, (super_off) * VMRegImpl::stack_slot_size), 1); // result | 1391 __ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), 1); // result |
1389 __ pop(rax); | 1392 __ pop(rax); |
1390 __ pop(rcx); | 1393 __ pop(rcx); |
1391 __ pop(rsi); | 1394 __ pop(rsi); |
1392 __ pop(rdi); | 1395 __ pop(rdi); |
1393 __ ret(0); | 1396 __ ret(0); |
1394 | 1397 |
1395 __ bind(miss); | 1398 __ bind(miss); |
1396 __ movptr(Address(rsp, (super_off) * VMRegImpl::stack_slot_size), NULL_WORD); // result | 1399 __ movptr(Address(rsp, (result_off) * VMRegImpl::stack_slot_size), NULL_WORD); // result |
1397 __ pop(rax); | 1400 __ pop(rax); |
1398 __ pop(rcx); | 1401 __ pop(rcx); |
1399 __ pop(rsi); | 1402 __ pop(rsi); |
1400 __ pop(rdi); | 1403 __ pop(rdi); |
1401 __ ret(0); | 1404 __ ret(0); |