Skip to content

Commit

Permalink
fix: allow kernel instructions in private kernel procedures
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Aug 12, 2024
1 parent c65429d commit 2414c9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions assembly/src/assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ impl Assembler {
procedure_gid,
name,
proc.visibility(),
module.is_kernel(),
self.source_manager.clone(),
)
.with_num_locals(num_locals)
Expand All @@ -452,6 +453,7 @@ impl Assembler {
procedure_gid,
name,
ast::Visibility::Public,
module.is_kernel(),
self.source_manager.clone(),
)
.with_span(proc_alias.span());
Expand Down
6 changes: 5 additions & 1 deletion assembly/src/assembler/procedure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct ProcedureContext {
span: SourceSpan,
name: QualifiedProcedureName,
visibility: Visibility,
is_kernel: bool,
num_locals: u16,
callset: CallSet,
}
Expand All @@ -32,6 +33,7 @@ impl ProcedureContext {
gid: GlobalProcedureIndex,
name: QualifiedProcedureName,
visibility: Visibility,
is_kernel: bool,
source_manager: Arc<dyn SourceManager>,
) -> Self {
Self {
Expand All @@ -40,6 +42,7 @@ impl ProcedureContext {
span: name.span(),
name,
visibility,
is_kernel,
num_locals: 0,
callset: Default::default(),
}
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit 2414c9b

Please sign in to comment.