I need to make smaller commits
This commit is contained in:
parent
64eef60c4e
commit
0c54a1d7e1
8 changed files with 377 additions and 83 deletions
|
@ -58,6 +58,7 @@ impl Bytecode {
|
|||
0x57 => (Instruction::Pop(), 1),
|
||||
0x59 => (Instruction::Duplicate(), 1),
|
||||
|
||||
0x60 => (Instruction::AddInt(), 1),
|
||||
0x68 => (Instruction::MultiplyInt(), 1),
|
||||
0x6C => (Instruction::DivideInt(), 1),
|
||||
0x6D => (Instruction::DivideLong(), 1),
|
||||
|
@ -80,7 +81,7 @@ impl Bytecode {
|
|||
}
|
||||
0x9C => {
|
||||
let bytes = [self.bytes[offset+1], self.bytes[offset+2]];
|
||||
(Instruction::BranchNonPositive(i16::from_be_bytes(bytes)), 3)
|
||||
(Instruction::BranchNonNegative(i16::from_be_bytes(bytes)), 3)
|
||||
}
|
||||
0x9D => {
|
||||
let bytes = [self.bytes[offset+1], self.bytes[offset+2]];
|
||||
|
@ -88,7 +89,7 @@ impl Bytecode {
|
|||
}
|
||||
0x9E => {
|
||||
let bytes = [self.bytes[offset+1], self.bytes[offset+2]];
|
||||
(Instruction::BranchNonNegative(i16::from_be_bytes(bytes)), 3)
|
||||
(Instruction::BranchNonPositive(i16::from_be_bytes(bytes)), 3)
|
||||
}
|
||||
|
||||
0x9F => {
|
||||
|
@ -194,7 +195,7 @@ pub enum Instruction {
|
|||
LoadByteImmediate(u8) = 0x10, // push immediate short
|
||||
LoadShortImmediate(u16) = 0x11, // push immediate short
|
||||
LoadConstant(u8) = 0x12, // Push from constant pool
|
||||
LoadCostantWide(u16) = 0x13, // Push from constant pool with wide index, don't load
|
||||
LoadCostantWide(u16) = 0x13, // Push from constant pool with wide index, don't load
|
||||
// double or long or whatever
|
||||
LoadConstant64(u16) = 0x14, // Push Long or Double from constant pool
|
||||
LoadLocalInt0() = 0x1A, // Load int from local variable
|
||||
|
@ -227,6 +228,7 @@ pub enum Instruction {
|
|||
Pop() = 0x57, // Pop top stack value
|
||||
Duplicate() = 0x59, // duplicate top stack value
|
||||
|
||||
AddInt() = 0x60, // int addition
|
||||
MultiplyInt() = 0x68, // int multiplication
|
||||
DivideInt() = 0x6C, // integer division, round toward zero and more rules
|
||||
DivideLong() = 0x6D, // long division
|
||||
|
@ -238,9 +240,9 @@ pub enum Instruction {
|
|||
BranchZero(i16) = 0x99, // branch if value == 0
|
||||
BranchNonZero(i16) = 0x9A, // branch if value != 0
|
||||
BranchNegative(i16) = 0x9B, // branch if value < 0
|
||||
BranchNonPositive(i16) = 0x9C, // branch if value <= 0
|
||||
BranchNonNegative(i16) = 0x9C, // branch if value <= 0
|
||||
BranchPositive(i16) = 0x9D, // branch if value > 0
|
||||
BranchNonNegative(i16) = 0x9E, // branch if value >= 0
|
||||
BranchNonPositive(i16) = 0x9E, // branch if value >= 0
|
||||
|
||||
BranchIntEquality(i16) = 0x9F,
|
||||
BranchIntInequality(i16) = 0xA0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue