src/cpu/x86/vm/x86.ad
Print this page
rev 10065 : 8147844: new method j.l.Runtime.onSpinWait() and the corresponding x86 hotspot instrinsic
Summary: adds c1 & c2 x86 intrinsics for j.l.Runtime.onSpinWait() that utilize the 'pause' instruction
Contributed-by: ikrylov, ygaevsky
Reviewed-by: iveresov, vlivanov, kvn
@@ -1717,10 +1717,14 @@
break;
case Op_StrIndexOfChar:
if (!(UseSSE > 4))
ret_value = false;
break;
+ case Op_OnSpinWait:
+ if (VM_Version::supports_on_spin_wait() == false)
+ ret_value = false;
+ break;
}
return ret_value; // Per default match rules are supported.
}
@@ -2994,10 +2998,28 @@
__ sqrtsd($dst$$XMMRegister, $constantaddress($con));
%}
ins_pipe(pipe_slow);
%}
+instruct onspinwait() %{
+ match(OnSpinWait);
+ ins_cost(200);
+
+ format %{
+ $$template
+ if (os::is_MP()) {
+ $$emit$$"pause\t! membar_onspinwait"
+ } else {
+ $$emit$$"MEMBAR-onspinwait ! (empty encoding)"
+ }
+ %}
+ ins_encode %{
+ __ pause();
+ %}
+ ins_pipe(pipe_slow);
+%}
+
// ====================VECTOR INSTRUCTIONS=====================================
// Load vectors (4 bytes long)
instruct loadV4(vecS dst, memory mem) %{
predicate(n->as_LoadVector()->memory_size() == 4);