Skip to content

Commit

Permalink
Update JDK
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlloyd committed Feb 11, 2025
1 parent 9dd3723 commit 3200d4b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion jdk
Submodule jdk updated 639 files
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Alibaba Group Holding Limited. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -484,7 +484,7 @@ public void writeBytecode(Opcode opcode) {
bytecodesBufWriter.writeU1(opcode.bytecode());
}

// Instruction version, refer to opcode
// Instruction version, refer to opcode, trusted
public void writeLocalVar(Opcode opcode, int slot) {
if (opcode.isWide()) {
bytecodesBufWriter.writeU2U2(opcode.bytecode(), slot);
Expand All @@ -493,12 +493,12 @@ public void writeLocalVar(Opcode opcode, int slot) {
}
}

// Shortcut version, refer to and validate slot
private void writeLocalVar(int bytecode, int slot) {
// TODO validation like (slot & 0xFFFF) == slot
if (slot < 256) {
// local var access, not a trusted write method, needs slot validation
private void localAccess(int bytecode, int slot) {
if ((slot & ~0xFF) == 0) {
bytecodesBufWriter.writeU1U1(bytecode, slot);
} else {
BytecodeHelpers.validateSlot(slot);
bytecodesBufWriter.writeU1U1U2(WIDE, bytecode, slot);
}
}
Expand Down Expand Up @@ -989,7 +989,7 @@ public CodeBuilder aload(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(ALOAD_0 + slot);
} else {
writeLocalVar(ALOAD, slot);
localAccess(ALOAD, slot);
}
return this;
}
Expand Down Expand Up @@ -1017,7 +1017,7 @@ public CodeBuilder astore(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(ASTORE_0 + slot);
} else {
writeLocalVar(ASTORE, slot);
localAccess(ASTORE, slot);
}
return this;
}
Expand Down Expand Up @@ -1100,7 +1100,7 @@ public CodeBuilder dload(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(DLOAD_0 + slot);
} else {
writeLocalVar(DLOAD, slot);
localAccess(DLOAD, slot);
}
return this;
}
Expand Down Expand Up @@ -1134,7 +1134,7 @@ public CodeBuilder dstore(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(DSTORE_0 + slot);
} else {
writeLocalVar(DSTORE, slot);
localAccess(DSTORE, slot);
}
return this;
}
Expand Down Expand Up @@ -1246,7 +1246,7 @@ public CodeBuilder fload(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(FLOAD_0 + slot);
} else {
writeLocalVar(FLOAD, slot);
localAccess(FLOAD, slot);
}
return this;
}
Expand Down Expand Up @@ -1280,7 +1280,7 @@ public CodeBuilder fstore(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(FSTORE_0 + slot);
} else {
writeLocalVar(FSTORE, slot);
localAccess(FSTORE, slot);
}
return this;
}
Expand Down Expand Up @@ -1506,7 +1506,7 @@ public CodeBuilder iload(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(ILOAD_0 + slot);
} else {
writeLocalVar(ILOAD, slot);
localAccess(ILOAD, slot);
}
return this;
}
Expand Down Expand Up @@ -1606,7 +1606,7 @@ public CodeBuilder istore(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(ISTORE_0 + slot);
} else {
writeLocalVar(ISTORE, slot);
localAccess(ISTORE, slot);
}
return this;
}
Expand Down Expand Up @@ -1701,7 +1701,7 @@ public CodeBuilder lload(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(LLOAD_0 + slot);
} else {
writeLocalVar(LLOAD, slot);
localAccess(LLOAD, slot);
}
return this;
}
Expand Down Expand Up @@ -1753,7 +1753,7 @@ public CodeBuilder lstore(int slot) {
if (slot >= 0 && slot <= 3) {
bytecodesBufWriter.writeU1(LSTORE_0 + slot);
} else {
writeLocalVar(LSTORE, slot);
localAccess(LSTORE, slot);
}
return this;
}
Expand Down

0 comments on commit 3200d4b

Please sign in to comment.