21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "asm/assembler.hpp" |
26 #include "interpreter/interpreter.hpp" |
27 #include "interpreter/interpreter.hpp" |
27 #include "interpreter/interpreterRuntime.hpp" |
28 #include "interpreter/interpreterRuntime.hpp" |
28 #include "interpreter/templateTable.hpp" |
29 #include "interpreter/templateTable.hpp" |
29 #include "memory/universe.inline.hpp" |
30 #include "memory/universe.inline.hpp" |
30 #include "oops/methodDataOop.hpp" |
31 #include "oops/methodDataOop.hpp" |
1937 // } |
1938 // } |
1938 // Convert array[h].match to native byte-ordering before compare |
1939 // Convert array[h].match to native byte-ordering before compare |
1939 __ movl(temp, Address(array, h, Address::times_8, 0*wordSize)); |
1940 __ movl(temp, Address(array, h, Address::times_8, 0*wordSize)); |
1940 __ bswapl(temp); |
1941 __ bswapl(temp); |
1941 __ cmpl(key, temp); |
1942 __ cmpl(key, temp); |
1942 if (VM_Version::supports_cmov()) { |
1943 // j = h if (key < array[h].fast_match()) |
1943 __ cmovl(Assembler::less , j, h); // j = h if (key < array[h].fast_match()) |
1944 __ cmov32(Assembler::less , j, h); |
1944 __ cmovl(Assembler::greaterEqual, i, h); // i = h if (key >= array[h].fast_match()) |
1945 // i = h if (key >= array[h].fast_match()) |
1945 } else { |
1946 __ cmov32(Assembler::greaterEqual, i, h); |
1946 Label set_i, end_of_if; |
|
1947 __ jccb(Assembler::greaterEqual, set_i); // { |
|
1948 __ mov(j, h); // j = h; |
|
1949 __ jmp(end_of_if); // } |
|
1950 __ bind(set_i); // else { |
|
1951 __ mov(i, h); // i = h; |
|
1952 __ bind(end_of_if); // } |
|
1953 } |
|
1954 // while (i+1 < j) |
1947 // while (i+1 < j) |
1955 __ bind(entry); |
1948 __ bind(entry); |
1956 __ leal(h, Address(i, 1)); // i+1 |
1949 __ leal(h, Address(i, 1)); // i+1 |
1957 __ cmpl(h, j); // i+1 < j |
1950 __ cmpl(h, j); // i+1 < j |
1958 __ jcc(Assembler::less, loop); |
1951 __ jcc(Assembler::less, loop); |
3476 // initialize entry pointer |
3469 // initialize entry pointer |
3477 __ xorl(rdx, rdx); // points to free slot or NULL |
3470 __ xorl(rdx, rdx); // points to free slot or NULL |
3478 |
3471 |
3479 // find a free slot in the monitor block (result in rdx) |
3472 // find a free slot in the monitor block (result in rdx) |
3480 { Label entry, loop, exit; |
3473 { Label entry, loop, exit; |
3481 __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry |
3474 __ movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry |
3482 __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block |
3475 |
|
3476 __ lea(rbx, monitor_block_bot); // points to word before bottom of monitor block |
3483 __ jmpb(entry); |
3477 __ jmpb(entry); |
3484 |
3478 |
3485 __ bind(loop); |
3479 __ bind(loop); |
3486 __ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used |
3480 __ cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used |
3487 |
3481 __ cmovptr(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx |
3488 // TODO - need new func here - kbt |
|
3489 if (VM_Version::supports_cmov()) { |
|
3490 __ cmov(Assembler::equal, rdx, rcx); // if not used then remember entry in rdx |
|
3491 } else { |
|
3492 Label L; |
|
3493 __ jccb(Assembler::notEqual, L); |
|
3494 __ mov(rdx, rcx); // if not used then remember entry in rdx |
|
3495 __ bind(L); |
|
3496 } |
|
3497 __ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object |
3482 __ cmpptr(rax, Address(rcx, BasicObjectLock::obj_offset_in_bytes())); // check if current entry is for same object |
3498 __ jccb(Assembler::equal, exit); // if same object then stop searching |
3483 __ jccb(Assembler::equal, exit); // if same object then stop searching |
3499 __ addptr(rcx, entry_size); // otherwise advance to next entry |
3484 __ addptr(rcx, entry_size); // otherwise advance to next entry |
3500 __ bind(entry); |
3485 __ bind(entry); |
3501 __ cmpptr(rcx, rbx); // check if bottom reached |
3486 __ cmpptr(rcx, rbx); // check if bottom reached |