@@ -712,10 +712,13 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
712
712
" Null instruction at index %zu" ,
713
713
instr_idx);
714
714
715
+ const void * instr_args = instruction->instr_args ();
715
716
switch (instruction->instr_args_type ()) {
716
717
case executorch_flatbuffer::InstructionArguments::KernelCall: {
717
- const auto arg_idxs =
718
- instruction->instr_args_as_KernelCall ()->args ();
718
+ const auto * instr_args_as_KernelCall =
719
+ static_cast <const executorch_flatbuffer::KernelCall*>(
720
+ instr_args);
721
+ const auto arg_idxs = instr_args_as_KernelCall->args ();
719
722
ET_CHECK_OR_RETURN_ERROR (
720
723
arg_idxs != nullptr , InvalidProgram, " KernelCall args missing" );
721
724
auto res = gen_instruction_arguments (
@@ -729,7 +732,7 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
729
732
}
730
733
chain_instruction_arg_lists[instr_idx] = res.get ();
731
734
auto err = resolve_operator (
732
- instruction-> instr_args_as_KernelCall () ->op_index (),
735
+ instr_args_as_KernelCall->op_index (),
733
736
chain_instruction_kernels,
734
737
instr_idx,
735
738
res.get (),
@@ -744,7 +747,9 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
744
747
} break ;
745
748
case executorch_flatbuffer::InstructionArguments::DelegateCall: {
746
749
const auto arg_idxs =
747
- instruction->instr_args_as_DelegateCall ()->args ();
750
+ static_cast <const executorch_flatbuffer::DelegateCall*>(
751
+ instr_args)
752
+ ->args ();
748
753
ET_CHECK_OR_RETURN_ERROR (
749
754
arg_idxs != nullptr ,
750
755
InvalidProgram,
@@ -764,7 +769,9 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
764
769
// Validate the index at load time so we can trust it during
765
770
// execution.
766
771
auto index =
767
- instruction->instr_args_as_JumpFalseCall ()->cond_value_index ();
772
+ static_cast <const executorch_flatbuffer::JumpFalseCall*>(
773
+ instr_args)
774
+ ->cond_value_index ();
768
775
ET_CHECK_OR_RETURN_ERROR (
769
776
index >= 0 && index < n_value_,
770
777
InvalidProgram,
0 commit comments