From 2414c9bb1be1fca9fe68ba1f00168d5e9683250f Mon Sep 17 00:00:00 2001 From: Bobbin Threadbare Date: Sun, 11 Aug 2024 23:01:10 -0700 Subject: [PATCH] fix: allow kernel instructions in private kernel procedures --- assembly/src/assembler/mod.rs | 2 ++ assembly/src/assembler/procedure.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assembly/src/assembler/mod.rs b/assembly/src/assembler/mod.rs index 6181d6b4e..ea9b8fd73 100644 --- a/assembly/src/assembler/mod.rs +++ b/assembly/src/assembler/mod.rs @@ -430,6 +430,7 @@ impl Assembler { procedure_gid, name, proc.visibility(), + module.is_kernel(), self.source_manager.clone(), ) .with_num_locals(num_locals) @@ -452,6 +453,7 @@ impl Assembler { procedure_gid, name, ast::Visibility::Public, + module.is_kernel(), self.source_manager.clone(), ) .with_span(proc_alias.span()); diff --git a/assembly/src/assembler/procedure.rs b/assembly/src/assembler/procedure.rs index 17c2cb145..c1a59063b 100644 --- a/assembly/src/assembler/procedure.rs +++ b/assembly/src/assembler/procedure.rs @@ -21,6 +21,7 @@ pub struct ProcedureContext { span: SourceSpan, name: QualifiedProcedureName, visibility: Visibility, + is_kernel: bool, num_locals: u16, callset: CallSet, } @@ -32,6 +33,7 @@ impl ProcedureContext { gid: GlobalProcedureIndex, name: QualifiedProcedureName, visibility: Visibility, + is_kernel: bool, source_manager: Arc, ) -> Self { Self { @@ -40,6 +42,7 @@ impl ProcedureContext { span: name.span(), name, visibility, + is_kernel, num_locals: 0, callset: Default::default(), } @@ -76,8 +79,9 @@ impl ProcedureContext { &self.name.module } + /// Returns true if the procedure is being assembled for a kernel. pub fn is_kernel(&self) -> bool { - self.visibility.is_syscall() + self.is_kernel } #[inline(always)]