@@ -688,10 +688,13 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
688
688
" Null instruction at index %zu" ,
689
689
instr_idx);
690
690
691
+ const void * instr_args = instruction->instr_args ();
691
692
switch (instruction->instr_args_type ()) {
692
693
case executorch_flatbuffer::InstructionArguments::KernelCall: {
693
- const auto arg_idxs =
694
- instruction->instr_args_as_KernelCall ()->args ();
694
+ const auto * instr_args_as_KernelCall =
695
+ static_cast <const executorch_flatbuffer::KernelCall*>(
696
+ instr_args);
697
+ const auto arg_idxs = instr_args_as_KernelCall->args ();
695
698
ET_CHECK_OR_RETURN_ERROR (
696
699
arg_idxs != nullptr , InvalidProgram, " KernelCall args missing" );
697
700
auto res = gen_instruction_arguments (
@@ -705,7 +708,7 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
705
708
}
706
709
chain_instruction_arg_lists[instr_idx] = res.get ();
707
710
auto err = resolve_operator (
708
- instruction-> instr_args_as_KernelCall () ->op_index (),
711
+ instr_args_as_KernelCall->op_index (),
709
712
chain_instruction_kernels,
710
713
instr_idx,
711
714
res.get (),
@@ -720,7 +723,9 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
720
723
} break ;
721
724
case executorch_flatbuffer::InstructionArguments::DelegateCall: {
722
725
const auto arg_idxs =
723
- instruction->instr_args_as_DelegateCall ()->args ();
726
+ static_cast <const executorch_flatbuffer::DelegateCall*>(
727
+ instr_args)
728
+ ->args ();
724
729
ET_CHECK_OR_RETURN_ERROR (
725
730
arg_idxs != nullptr ,
726
731
InvalidProgram,
@@ -740,7 +745,9 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
740
745
// Validate the index at load time so we can trust it during
741
746
// execution.
742
747
auto index =
743
- instruction->instr_args_as_JumpFalseCall ()->cond_value_index ();
748
+ static_cast <const executorch_flatbuffer::JumpFalseCall*>(
749
+ instr_args)
750
+ ->cond_value_index ();
744
751
ET_CHECK_OR_RETURN_ERROR (
745
752
index >= 0 && index < n_value_,
746
753
InvalidProgram,
0 commit comments