File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -81,28 +81,30 @@ impl CairoRunner2 {
8181 }
8282 }
8383
84+ let mut virtual_machine = VirtualMachineBuilder :: default ( )
85+ . builtin_runners ( builtin_runners)
86+ . segments ( memory_segment_manager)
87+ . build ( ) ;
88+
8489 // TODO: implement main entrypoint initialization
8590 let pc = ( || todo ! ( ) ) ( ) ;
8691 let ap = ( || todo ! ( ) ) ( ) ;
8792 let fp = ( || todo ! ( ) ) ( ) ;
8893
8994 let run_context = RunContext :: new ( pc, ap, fp) ;
9095
91- for builtin_runner in & mut builtin_runners {
92- builtin_runner. add_validation_rule ( & mut memory_segment_manager . memory )
96+ for builtin_runner in & mut virtual_machine . builtin_runners {
97+ builtin_runner. add_validation_rule ( & mut virtual_machine . segments . memory )
9398 }
9499
95- memory_segment_manager
100+ virtual_machine. set_run_context ( run_context) ;
101+
102+ virtual_machine
103+ . segments
96104 . memory
97105 . validate_existing_memory ( )
98106 . map_err ( RunnerError :: MemoryValidationError ) ?;
99107
100- let virtual_machine = VirtualMachineBuilder :: default ( )
101- . builtin_runners ( builtin_runners)
102- . segments ( memory_segment_manager)
103- . run_context ( run_context)
104- . build ( ) ;
105-
106108 Ok ( Self {
107109 executable,
108110 virtual_machine,
Original file line number Diff line number Diff line change @@ -1067,6 +1067,11 @@ impl VirtualMachine {
10671067 self . run_context . set_pc ( pc)
10681068 }
10691069
1070+ #[ doc( hidden) ]
1071+ pub fn set_run_context ( & mut self , run_context : RunContext ) {
1072+ self . run_context = run_context;
1073+ }
1074+
10701075 pub fn get_segment_used_size ( & self , index : usize ) -> Option < usize > {
10711076 self . segments . get_segment_used_size ( index)
10721077 }
You can’t perform that action at this time.
0 commit comments