Skip to content

Commit

Permalink
Revert change to the new opcode
Browse files Browse the repository at this point in the history
Since this one will never be an array descriptor, might as well
leave it as a Cow for the binary name case.
  • Loading branch information
staktrace committed Aug 29, 2024
1 parent 1f011fa commit 239c6e5
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/bytecode.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::borrow::Cow;
use std::convert::TryFrom;

use crate::constant_pool::{
get_cp_loadable, read_cp_invokedynamic, read_cp_memberref, read_cp_object_array_type,
get_cp_loadable, read_cp_classinfo, read_cp_invokedynamic, read_cp_memberref,
read_cp_object_array_type,
};
use crate::constant_pool::{
ConstantPoolEntry, ConstantPoolEntryTypes, InvokeDynamic, Loadable, MemberRef, ObjectArrayType,
Expand Down Expand Up @@ -186,7 +188,7 @@ pub enum Opcode<'a> {
Monitorenter,
Monitorexit,
Multianewarray(ObjectArrayType<'a>, u8),
New(ObjectArrayType<'a>),
New(Cow<'a, str>),
Newarray(PrimitiveArrayType),
Nop,
Pop,
Expand Down Expand Up @@ -613,15 +615,7 @@ fn read_opcodes<'a>(
}
Opcode::Invokedynamic(invokedynamic)
}
0xbb => {
let object_array_type = match read_cp_object_array_type(code, &mut ix, pool)? {
ObjectArrayType::ArrayType(_) => {
fail!("Array types not allowed for new opcode at index {}", ix - 2)
}
ObjectArrayType::BinaryName(name) => ObjectArrayType::BinaryName(name),
};
Opcode::New(object_array_type)
}
0xbb => Opcode::New(read_cp_classinfo(code, &mut ix, pool)?),
0xbc => {
let primitive_type = match read_u1(code, &mut ix)? {
4 => PrimitiveArrayType::Boolean,
Expand Down

0 comments on commit 239c6e5

Please sign in to comment.