mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
fix calling conventions
This commit is contained in:
parent
07a0f69d95
commit
73cb826a98
2 changed files with 8 additions and 2 deletions
|
@ -158,7 +158,7 @@ pub const RocResult = extern struct {
|
|||
}
|
||||
};
|
||||
|
||||
pub const Ordering = enum(u8) {
|
||||
pub const Ordering = packed enum(u8) {
|
||||
EQ = 0,
|
||||
GT = 1,
|
||||
LT = 2,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// Helpers for interacting with the zig that generates bitcode
|
||||
use crate::debug_info_init;
|
||||
use crate::llvm::build::{set_name, Env, FAST_CALL_CONV};
|
||||
use crate::llvm::build::{set_name, Env, C_CALL_CONV, FAST_CALL_CONV};
|
||||
use crate::llvm::convert::basic_type_from_layout;
|
||||
use crate::llvm::refcounting::{decrement_refcount_layout, increment_refcount_layout, Mode};
|
||||
use inkwell::attributes::{Attribute, AttributeLoc};
|
||||
|
@ -409,6 +409,9 @@ pub fn build_compare_wrapper<'a, 'ctx, 'env>(
|
|||
&[arg_type.into(), arg_type.into(), arg_type.into()],
|
||||
);
|
||||
|
||||
// we expose this function to zig; must use c calling convention
|
||||
function_value.set_call_conventions(C_CALL_CONV);
|
||||
|
||||
let kind_id = Attribute::get_named_enum_kind_id("alwaysinline");
|
||||
debug_assert!(kind_id > 0);
|
||||
let attr = env.context.create_enum_attribute(kind_id, 1);
|
||||
|
@ -463,6 +466,9 @@ pub fn build_compare_wrapper<'a, 'ctx, 'env>(
|
|||
// call.set_call_convention(user_defined_function.get_call_conventions());
|
||||
let result = call.try_as_basic_value().left().unwrap();
|
||||
|
||||
// IMPORTANT! we call a user function, so it has the fast calling convention
|
||||
call.set_call_convention(FAST_CALL_CONV);
|
||||
|
||||
env.builder.build_return(Some(&result));
|
||||
|
||||
function_value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue