Skip to content

Commit

Permalink
fix mangle consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
yhara committed Oct 24, 2024
1 parent 6ae7384 commit 2097df9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/skc_async_experiment/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn lib_externs() -> Result<Vec<(FunctionName, FunTy)>> {
("sleep_sec", FunTy::async_(vec![Ty::Int], Ty::Void)),
]
.into_iter()
.map(|(name, ty)| (FunctionName::mangled(name), ty))
.map(|(name, ty)| (FunctionName::unmangled(name), ty))
.collect::<Vec<_>>();
v.append(&mut core_class_funcs()?);
Ok(v)
Expand Down Expand Up @@ -128,7 +128,7 @@ fn main_body() -> Vec<hir::TypedExpr> {
fn chiika_start_user_body(main_is_async: bool) -> Vec<hir::TypedExpr> {
let cont_ty = FunTy::lowered(vec![Ty::ChiikaEnv, Ty::Int], Ty::RustFuture);
let chiika_main = hir::Expr::func_ref(
FunctionName::mangled("chiika_main"),
FunctionName::unmangled("chiika_main"),
if main_is_async {
FunTy::lowered(
vec![Ty::ChiikaEnv, Ty::Fun(cont_ty.clone())],
Expand Down
2 changes: 1 addition & 1 deletion lib/skc_async_experiment/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn main_is_async(hir: &hir::Program) -> Result<bool> {
let Some(main) = hir
.funcs
.iter()
.find(|x| x.name == FunctionName::mangled("chiika_main"))
.find(|x| x.name == FunctionName::unmangled("chiika_main"))
else {
bail!("chiika_main not found");
};
Expand Down
4 changes: 2 additions & 2 deletions lib/skc_runtime/src/async_functions.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::chiika_env::ChiikaEnv;
use crate::{ChiikaCont, ContFuture};
use shiika_ffi::core_class::SkInt;
use shiika_ffi_macro::shiika_method;
use std::future::{poll_fn, Future};
use std::task::Poll;
use std::time::Duration;

#[no_mangle]
#[allow(improper_ctypes_definitions)]
#[shiika_method("sleep_sec")]
pub extern "C" fn sleep_sec(
env: &'static mut ChiikaEnv,
nn: SkInt,
Expand Down
3 changes: 2 additions & 1 deletion lib/skc_runtime/src/sync_functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use shiika_ffi::core_class::SkInt;
use shiika_ffi_macro::shiika_method;

#[no_mangle]
#[shiika_method("print")]
pub extern "C" fn print(n: SkInt) {
println!("{}", n.val());
}

0 comments on commit 2097df9

Please sign in to comment.