lxor 0x83

Bitwise XORs two longs on top of the stack; pushes the result.

Opcode
0x83 (131)
Family
Arithmetic and bitwise
Operands
none
Length
1 byte
Operand stack
…, value1 (long), value2 (long) → …, result (long)
Can throw
nothing at run time (beyond linking errors)

What it does

a ^ b on two longs: pops b, then a, and pushes the result.

javac compiles ~x on a long to ldc2_w -1 and lxor.

How often javac uses it

In JDK 25.0.5's java.base module, lxor appears 317 times in 43 of its 7,391 classes: 0.02% of all instructions, the 133rd most common of 194 opcodes in use. Some of the methods that use it: java.lang.invoke.MethodHandles.findFirstDupOrDrop, java.lang.invoke.VarHandleByteArrayAsLongs$ByteBufferHandle.getAndBitwiseXorConvEndianWithCAS, java.lang.invoke.VarHandleSegmentAsLongsAligned.getAndBitwiseXorConvEndianWithCAS, java.lang.Long.hashCode.

Examples

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; lxor is highlighted.

static long longs(long a, long b) in Tour, compiled by javac 25
… 23 instructions before
20x = (x << 3) | (x >> 2) ^ (x >>> 1) & 0xff;
32lload 4// x
36ldc2_w #9// 255L
39land
40lxor
41lor
42lstore 4// x
21return ~x;
44lload 4// x
46ldc2_w #11// -1L
49lxor

Open in the viewer

static long mix(long a, int b, short c, byte d, double e, float f, char g, boolean h) in Numbers, compiled by javac 25
… 12 instructions before
31r ^= (long) (e * f);
15dload 5// e
17fload 7// f
19f2d
20dmul
21d2l
22lxor
23lstore 10// r
32r += g;
25lload 10// r
27iload 8// g
29i2l
30ladd
31lstore 10// r
… 45 instructions after

Open in the viewer

Related instructions

ixor Bitwise XORs two ints on top of the stack; pushes the result.

Specification: JVMS §6.5, lxor (Java SE 25).