Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/x86_64.ad @ 671:d0994e5bebce
6822204: volatile fences should prefer lock:addl to actual mfence instructions
Reviewed-by: kvn, phh
author | never |
---|---|
date | Thu, 26 Mar 2009 14:31:45 -0700 |
parents | bd441136a5ce |
children | fbde8ec322d0 |
comparison
equal
deleted
inserted
replaced
668:90a66aa50514 | 671:d0994e5bebce |
---|---|
4160 emit_opcode(cbuf, 0x58 | (dstenc & 7)); | 4160 emit_opcode(cbuf, 0x58 | (dstenc & 7)); |
4161 | 4161 |
4162 // done: | 4162 // done: |
4163 %} | 4163 %} |
4164 | 4164 |
4165 enc_class enc_membar_acquire | |
4166 %{ | |
4167 // [jk] not needed currently, if you enable this and it really | |
4168 // emits code don't forget to the remove the "size(0)" line in | |
4169 // membar_acquire() | |
4170 // MacroAssembler masm(&cbuf); | |
4171 // masm.membar(Assembler::Membar_mask_bits(Assembler::LoadStore | | |
4172 // Assembler::LoadLoad)); | |
4173 %} | |
4174 | |
4175 enc_class enc_membar_release | |
4176 %{ | |
4177 // [jk] not needed currently, if you enable this and it really | |
4178 // emits code don't forget to the remove the "size(0)" line in | |
4179 // membar_release() | |
4180 // MacroAssembler masm(&cbuf); | |
4181 // masm.membar(Assembler::Membar_mask_bits(Assembler::LoadStore | | |
4182 // Assembler::StoreStore)); | |
4183 %} | |
4184 | |
4185 enc_class enc_membar_volatile | |
4186 %{ | |
4187 MacroAssembler masm(&cbuf); | |
4188 masm.membar(Assembler::Membar_mask_bits(Assembler::StoreLoad | | |
4189 Assembler::StoreStore)); | |
4190 %} | |
4191 | |
4192 // Safepoint Poll. This polls the safepoint page, and causes an | 4165 // Safepoint Poll. This polls the safepoint page, and causes an |
4193 // exception if it is not readable. Unfortunately, it kills | 4166 // exception if it is not readable. Unfortunately, it kills |
4194 // RFLAGS in the process. | 4167 // RFLAGS in the process. |
4195 enc_class enc_safepoint_poll | 4168 enc_class enc_safepoint_poll |
4196 %{ | 4169 %{ |
7456 %{ | 7429 %{ |
7457 match(MemBarAcquire); | 7430 match(MemBarAcquire); |
7458 ins_cost(0); | 7431 ins_cost(0); |
7459 | 7432 |
7460 size(0); | 7433 size(0); |
7461 format %{ "MEMBAR-acquire" %} | 7434 format %{ "MEMBAR-acquire ! (empty encoding)" %} |
7462 ins_encode(); | 7435 ins_encode(); |
7463 ins_pipe(empty); | 7436 ins_pipe(empty); |
7464 %} | 7437 %} |
7465 | 7438 |
7466 instruct membar_acquire_lock() | 7439 instruct membar_acquire_lock() |
7479 %{ | 7452 %{ |
7480 match(MemBarRelease); | 7453 match(MemBarRelease); |
7481 ins_cost(0); | 7454 ins_cost(0); |
7482 | 7455 |
7483 size(0); | 7456 size(0); |
7484 format %{ "MEMBAR-release" %} | 7457 format %{ "MEMBAR-release ! (empty encoding)" %} |
7485 ins_encode(); | 7458 ins_encode(); |
7486 ins_pipe(empty); | 7459 ins_pipe(empty); |
7487 %} | 7460 %} |
7488 | 7461 |
7489 instruct membar_release_lock() | 7462 instruct membar_release_lock() |
7496 format %{ "MEMBAR-release (a FastUnlock follows so empty encoding)" %} | 7469 format %{ "MEMBAR-release (a FastUnlock follows so empty encoding)" %} |
7497 ins_encode(); | 7470 ins_encode(); |
7498 ins_pipe(empty); | 7471 ins_pipe(empty); |
7499 %} | 7472 %} |
7500 | 7473 |
7501 instruct membar_volatile() | 7474 instruct membar_volatile(rFlagsReg cr) %{ |
7502 %{ | |
7503 match(MemBarVolatile); | 7475 match(MemBarVolatile); |
7476 effect(KILL cr); | |
7504 ins_cost(400); | 7477 ins_cost(400); |
7505 | 7478 |
7506 format %{ "MEMBAR-volatile" %} | 7479 format %{ |
7507 ins_encode(enc_membar_volatile); | 7480 $$template |
7481 if (os::is_MP()) { | |
7482 $$emit$$"lock addl [rsp + #0], 0\t! membar_volatile" | |
7483 } else { | |
7484 $$emit$$"MEMBAR-volatile ! (empty encoding)" | |
7485 } | |
7486 %} | |
7487 ins_encode %{ | |
7488 __ membar(Assembler::StoreLoad); | |
7489 %} | |
7508 ins_pipe(pipe_slow); | 7490 ins_pipe(pipe_slow); |
7509 %} | 7491 %} |
7510 | 7492 |
7511 instruct unnecessary_membar_volatile() | 7493 instruct unnecessary_membar_volatile() |
7512 %{ | 7494 %{ |