lshl 0x79

Shifts left two longs on top of the stack; pushes the result.

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

What it does

x << n on a long: shifts left, filling with zeros. The shift distance is always an int, and only its low 6 bits are used: 1L << 64 is 1, not 0.

How often javac uses it

In JDK 25.0.5's java.base module, lshl appears 2,125 times in 150 of its 7,391 classes: 0.11% of all instructions, the 85th most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectStreamClass.computeDefaultSUID, java.lang.AbstractStringBuilder.needsNewBuffer, java.lang.FdLibm.__HI, java.lang.invoke.LambdaFormEditor$TransformKey.packedBytes.

Example

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

static long longs(long a, long b) in Tour, compiled by javac 25
… 14 instructions before
19x = -x;
19lload 4// x
21lneg
22lstore 4// x
20x = (x << 3) | (x >> 2) ^ (x >>> 1) & 0xff;
24lload 4// x
27lshl
28lload 4// x
31lshr
32lload 4// x
… 9 instructions after

Open in the viewer

Related instructions

ishl Shifts left two ints on top of the stack; pushes the result.

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