mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Simplify call_import and call
This commit is contained in:
parent
10b0357140
commit
eb76ec4e90
1 changed files with 6 additions and 15 deletions
|
@ -343,24 +343,15 @@ impl<'a> CodeBuilder<'a> {
|
|||
instruction_no_args!(return_, RETURN);
|
||||
|
||||
pub fn call(&mut self, function_index: u32) {
|
||||
self.call_impl(function_index, false)
|
||||
self.inst_base(CALL);
|
||||
self.code.encode_padded_u32(function_index);
|
||||
log_instruction!("{:10}\t{}", format!("{CALL:?}"), function_index);
|
||||
}
|
||||
|
||||
pub fn call_import(&mut self, function_index: u32) {
|
||||
self.call_impl(function_index, true)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn call_impl(&mut self, function_index: u32, is_import: bool) {
|
||||
self.inst_base(CALL);
|
||||
|
||||
if is_import {
|
||||
self.import_relocations
|
||||
.push((self.code.len(), function_index));
|
||||
}
|
||||
|
||||
self.code.encode_padded_u32(function_index);
|
||||
log_instruction!("{:10}\t{}", format!("{CALL:?}"), function_index);
|
||||
self.import_relocations
|
||||
.push((self.code.len(), function_index));
|
||||
self.call(function_index)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue