@@ -23,12 +23,8 @@ pub struct DefaultDecoder {
23
23
factories : Vec < InstructionFactory > ,
24
24
mop : bool ,
25
25
version : u32 ,
26
- // Use a cache of instructions to avoid decoding the same instruction
27
- // twice, pc is the key and the instruction is the value.
28
- //
29
- // Use Vector so that the data is on the heap. Otherwise, if there is
30
- // a vm call chain, it will quickly consume Rust's 2M stack space.
31
- instructions_cache : Vec < ( u64 , u64 ) > ,
26
+ // use a cache of instructions to avoid decoding the same instruction twice, pc is the key and the instruction is the value
27
+ instructions_cache : [ ( u64 , u64 ) ; INSTRUCTION_CACHE_SIZE ] ,
32
28
}
33
29
34
30
impl DefaultDecoder {
@@ -38,7 +34,7 @@ impl DefaultDecoder {
38
34
factories : vec ! [ ] ,
39
35
mop,
40
36
version,
41
- instructions_cache : vec ! [ ( u64 :: MAX as u64 , 0 ) ; INSTRUCTION_CACHE_SIZE ] ,
37
+ instructions_cache : [ ( u64:: MAX , 0 ) ; INSTRUCTION_CACHE_SIZE ] ,
42
38
}
43
39
}
44
40
@@ -886,7 +882,7 @@ impl InstDecoder for DefaultDecoder {
886
882
}
887
883
888
884
fn reset_instructions_cache ( & mut self ) -> Result < ( ) , Error > {
889
- self . instructions_cache = vec ! [ ( u64 :: MAX , 0 ) ; INSTRUCTION_CACHE_SIZE ] ;
885
+ self . instructions_cache = [ ( u64:: MAX , 0 ) ; INSTRUCTION_CACHE_SIZE ] ;
890
886
Ok ( ( ) )
891
887
}
892
888
}
0 commit comments