Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Commit 20e2cbe

Browse files
committed
More instructions
1 parent 346daf1 commit 20e2cbe

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/main/java/io/github/seggan/javaclasslib/attributes/code/instructions/JvmInstructions.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.common.primitives.Bytes;
44
import io.github.seggan.javaclasslib.ByteUtils;
5+
import io.github.seggan.javaclasslib.PrimitiveType;
56
import io.github.seggan.javaclasslib.constantpool.ClassEntry;
67
import io.github.seggan.javaclasslib.constantpool.ConstantPoolEntry;
78
import io.github.seggan.javaclasslib.constantpool.classmembers.FieldrefEntry;
@@ -237,6 +238,26 @@ public final class JvmInstructions {
237238
* </dl>
238239
*/
239240
public static final NoArgInstruction IADD = new NoArgInstruction(0x60);
241+
/**
242+
* Loads an int from an array
243+
*
244+
* <dl>
245+
* <dt>Stack:</dt>
246+
* <dd>..., arrayref, index →</dd>
247+
* <dd>..., value</dd>
248+
* </dl>
249+
*/
250+
public static final NoArgInstruction IALOAD = new NoArgInstruction(0x2e);
251+
/**
252+
* Stores an int into an array
253+
*
254+
* <dl>
255+
* <dt>Stack:</dt>
256+
* <dd>..., arrayref, index, value →</dd>
257+
* <dd>...,</dd>
258+
* </dl>
259+
*/
260+
public static final NoArgInstruction IASTORE = new NoArgInstruction(0x4f);
240261
/**
241262
* Pushes {@code 0} (an int) onto the stack
242263
*
@@ -477,6 +498,28 @@ public final class JvmInstructions {
477498
* </dl>
478499
*/
479500
public static final CPInstruction<ClassEntry> NEW = new CPInstruction<>(0xbb);
501+
/**
502+
* Creates a new primitive array. It is recommended to pass a {@link PrimitiveType} as the
503+
* parameter
504+
*
505+
* <dl>
506+
* <dt>Parameters:</dt>
507+
* <dd>A byte representing the primitive type</dd>
508+
* <dt>Stack:</dt>
509+
* <dd>..., count →</dd>
510+
* <dd>..., arrayref</dd>
511+
* </dl>
512+
*/
513+
public static final BPInstruction NEWARRAY = new BPInstruction(0xbc);
514+
/**
515+
* Do nothing
516+
*
517+
* <dl>
518+
* <dt>Stack:</dt>
519+
* <dd>[unchanged]</dd>
520+
* </dl>
521+
*/
522+
public static final NoArgInstruction NOP = new NoArgInstruction(0x00);
480523
/**
481524
* Discards the top value of the stack
482525
*

0 commit comments

Comments
 (0)