@@ -9,15 +9,15 @@ use nom::{
99 sequence:: tuple,
1010} ;
1111
12- use crate :: constant_pool:: { ConstantPoolItem , ReferenceConstant , ValueConstant } ;
12+ use crate :: constant_pool:: { ConstantPoolItem , ConstantPoolReference } ;
1313
1414#[ derive( Clone , Debug ) ]
1515pub enum Opcode {
1616 Aaload ,
1717 Aastore ,
1818 AconstNull ,
1919 Aload ( u8 ) ,
20- Anewarray ( ValueConstant ) ,
20+ Anewarray ( ConstantPoolReference ) ,
2121 Areturn ,
2222 Arraylength ,
2323 Astore ( u8 ) ,
@@ -27,7 +27,7 @@ pub enum Opcode {
2727 Bipush ( i8 ) ,
2828 Caload ,
2929 Castore ,
30- Checkcast ( ValueConstant ) ,
30+ Checkcast ( ConstantPoolReference ) ,
3131 D2f ,
3232 D2i ,
3333 D2l ,
@@ -68,8 +68,8 @@ pub enum Opcode {
6868 Freturn ,
6969 Fstore ( u8 ) ,
7070 Fsub ,
71- Getfield ( ReferenceConstant ) ,
72- Getstatic ( ReferenceConstant ) ,
71+ Getfield ( ConstantPoolReference ) ,
72+ Getstatic ( ConstantPoolReference ) ,
7373 Goto ( i16 ) ,
7474 GotoW ( i32 ) ,
7575 I2b ,
@@ -104,12 +104,12 @@ pub enum Opcode {
104104 Iload ( u8 ) ,
105105 Imul ,
106106 Ineg ,
107- Instanceof ( ValueConstant ) ,
108- Invokedynamic ( ReferenceConstant ) ,
109- Invokeinterface ( ReferenceConstant , u8 , u8 ) ,
110- Invokespecial ( ReferenceConstant ) ,
111- Invokestatic ( ReferenceConstant ) ,
112- Invokevirtual ( ReferenceConstant ) ,
107+ Instanceof ( ConstantPoolReference ) ,
108+ Invokedynamic ( ConstantPoolReference ) ,
109+ Invokeinterface ( ConstantPoolReference , u8 , u8 ) ,
110+ Invokespecial ( ConstantPoolReference ) ,
111+ Invokestatic ( ConstantPoolReference ) ,
112+ Invokevirtual ( ConstantPoolReference ) ,
113113 Ior ,
114114 Irem ,
115115 Ireturn ,
@@ -130,9 +130,9 @@ pub enum Opcode {
130130 Lastore ,
131131 Lcmp ,
132132 Lconst ( u8 ) ,
133- Ldc ( ValueConstant ) ,
134- LdcW ( ValueConstant ) ,
135- Ldc2W ( ValueConstant ) ,
133+ Ldc ( ConstantPoolReference ) ,
134+ LdcW ( ConstantPoolReference ) ,
135+ Ldc2W ( ConstantPoolReference ) ,
136136 Ldiv ,
137137 Lload ( u8 ) ,
138138 Lmul ,
@@ -149,14 +149,14 @@ pub enum Opcode {
149149 Lxor ,
150150 Monitorenter ,
151151 Monitorexit ,
152- Multianewarray ( ValueConstant , u8 ) ,
153- New ( ValueConstant ) ,
152+ Multianewarray ( ConstantPoolReference , u8 ) ,
153+ New ( ConstantPoolReference ) ,
154154 Newarray ( u8 ) ,
155155 Nop ,
156156 Pop ,
157157 Pop2 ,
158- Putfield ( ReferenceConstant ) ,
159- Putstatic ( ReferenceConstant ) ,
158+ Putfield ( ConstantPoolReference ) ,
159+ Putstatic ( ConstantPoolReference ) ,
160160 Ret ( u8 ) ,
161161 Return ,
162162 Saload ,
@@ -182,7 +182,9 @@ impl Opcode {
182182 0x2b => success ( Opcode :: Aload ( 1 ) ) ( data) ,
183183 0x2c => success ( Opcode :: Aload ( 2 ) ) ( data) ,
184184 0x2d => success ( Opcode :: Aload ( 3 ) ) ( data) ,
185- 0xbd => map ( be_u16, |x| Opcode :: Anewarray ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
185+ 0xbd => map ( be_u16, |x| {
186+ Opcode :: Anewarray ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
187+ } ) ( data) ,
186188 0xb0 => success ( Opcode :: Areturn ) ( data) ,
187189 0xbe => success ( Opcode :: Arraylength ) ( data) ,
188190 0x3a => map ( u8, Opcode :: Astore ) ( data) ,
@@ -196,7 +198,9 @@ impl Opcode {
196198 0x10 => map ( i8, Opcode :: Bipush ) ( data) ,
197199 0x34 => success ( Opcode :: Caload ) ( data) ,
198200 0x55 => success ( Opcode :: Castore ) ( data) ,
199- 0xc0 => map ( be_u16, |x| Opcode :: Checkcast ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
201+ 0xc0 => map ( be_u16, |x| {
202+ Opcode :: Checkcast ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
203+ } ) ( data) ,
200204 0x90 => success ( Opcode :: D2f ) ( data) ,
201205 0x8e => success ( Opcode :: D2i ) ( data) ,
202206 0x8f => success ( Opcode :: D2l ) ( data) ,
@@ -256,9 +260,11 @@ impl Opcode {
256260 0x45 => success ( Opcode :: Fstore ( 2 ) ) ( data) ,
257261 0x46 => success ( Opcode :: Fstore ( 3 ) ) ( data) ,
258262 0x66 => success ( Opcode :: Fsub ) ( data) ,
259- 0xb4 => map ( be_u16, |x| Opcode :: Getfield ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
263+ 0xb4 => map ( be_u16, |x| {
264+ Opcode :: Getfield ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
265+ } ) ( data) ,
260266 0xb2 => map ( be_u16, |x| {
261- Opcode :: Getstatic ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) )
267+ Opcode :: Getstatic ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
262268 } ) ( data) ,
263269 0xa7 => map ( be_i16, Opcode :: Goto ) ( data) ,
264270 0xc8 => map ( be_i32, Opcode :: GotoW ) ( data) ,
@@ -304,21 +310,23 @@ impl Opcode {
304310 0x1d => success ( Opcode :: Iload ( 3 ) ) ( data) ,
305311 0x68 => success ( Opcode :: Imul ) ( data) ,
306312 0x74 => success ( Opcode :: Ineg ) ( data) ,
307- 0xc1 => map ( be_u16, |x| Opcode :: Instanceof ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
313+ 0xc1 => map ( be_u16, |x| {
314+ Opcode :: Instanceof ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
315+ } ) ( data) ,
308316 0xba => map ( be_u16, |x| {
309- Opcode :: Invokedynamic ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) )
317+ Opcode :: Invokedynamic ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
310318 } ) ( data) ,
311319 0xb9 => map ( be_u16, |x| {
312- Opcode :: Invokeinterface ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) , 0 , 0 )
320+ Opcode :: Invokeinterface ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) , 0 , 0 )
313321 } ) ( data) ,
314322 0xb7 => map ( be_u16, |x| {
315- Opcode :: Invokespecial ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) )
323+ Opcode :: Invokespecial ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
316324 } ) ( data) ,
317325 0xb8 => map ( be_u16, |x| {
318- Opcode :: Invokestatic ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) )
326+ Opcode :: Invokestatic ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
319327 } ) ( data) ,
320328 0xb6 => map ( be_u16, |x| {
321- Opcode :: Invokevirtual ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) )
329+ Opcode :: Invokevirtual ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
322330 } ) ( data) ,
323331 0x80 => success ( Opcode :: Ior ) ( data) ,
324332 0x70 => success ( Opcode :: Irem ) ( data) ,
@@ -345,9 +353,11 @@ impl Opcode {
345353 0x94 => success ( Opcode :: Lcmp ) ( data) ,
346354 0x09 => success ( Opcode :: Lconst ( 0 ) ) ( data) ,
347355 0x0a => success ( Opcode :: Lconst ( 1 ) ) ( data) ,
348- 0x12 => map ( u8, |x| Opcode :: Ldc ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
349- 0x13 => map ( be_u16, |x| Opcode :: LdcW ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
350- 0x14 => map ( be_u16, |x| Opcode :: Ldc2W ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
356+ 0x12 => map ( u8, |x| Opcode :: Ldc ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
357+ 0x13 => map ( be_u16, |x| Opcode :: LdcW ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
358+ 0x14 => map ( be_u16, |x| {
359+ Opcode :: Ldc2W ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
360+ } ) ( data) ,
351361 0x6d => success ( Opcode :: Ldiv ) ( data) ,
352362 0x16 => map ( u8, Opcode :: Lload ) ( data) ,
353363 0x1e => success ( Opcode :: Lload ( 0 ) ) ( data) ,
@@ -379,16 +389,18 @@ impl Opcode {
379389 0xc2 => success ( Opcode :: Monitorenter ) ( data) ,
380390 0xc3 => success ( Opcode :: Monitorexit ) ( data) ,
381391 0xc5 => map ( tuple ( ( be_u16, u8) ) , |( index, dimensions) | {
382- Opcode :: Multianewarray ( ValueConstant :: from_constant_pool ( constant_pool, index as _ ) , dimensions)
392+ Opcode :: Multianewarray ( ConstantPoolReference :: from_constant_pool ( constant_pool, index as _ ) , dimensions)
383393 } ) ( data) ,
384- 0xbb => map ( be_u16, |x| Opcode :: New ( ValueConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
394+ 0xbb => map ( be_u16, |x| Opcode :: New ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
385395 0xbc => map ( u8, Opcode :: Newarray ) ( data) ,
386396 0x00 => success ( Opcode :: Nop ) ( data) ,
387397 0x57 => success ( Opcode :: Pop ) ( data) ,
388398 0x58 => success ( Opcode :: Pop2 ) ( data) ,
389- 0xb5 => map ( be_u16, |x| Opcode :: Putfield ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) ) ) ( data) ,
399+ 0xb5 => map ( be_u16, |x| {
400+ Opcode :: Putfield ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
401+ } ) ( data) ,
390402 0xb3 => map ( be_u16, |x| {
391- Opcode :: Putstatic ( ReferenceConstant :: from_constant_pool ( constant_pool, x as _ ) )
403+ Opcode :: Putstatic ( ConstantPoolReference :: from_constant_pool ( constant_pool, x as _ ) )
392404 } ) ( data) ,
393405 0xa9 => map ( u8, Opcode :: Ret ) ( data) ,
394406 0xb1 => success ( Opcode :: Return ) ( data) ,
0 commit comments