entrypoints.rs 2.12 KB
Newer Older
1
2
3
4
5
use runtime::ValueLocation;

use ast::ir;
use ast::ir::*;
use ast::ptr::*;
qinsoon's avatar
qinsoon committed
6
use ast::types::*;
7
8
9
10
11
12
13
use compiler::backend::RegGroup;

use std::sync::RwLock;

pub type EntryFuncSig = MuFuncSig;

pub struct RuntimeEntrypoint {
14
15
16
    pub sig: P<MuFuncSig>,
    pub aot: ValueLocation,
    pub jit: RwLock<Option<ValueLocation>>
17
18
19
}

lazy_static! {
qinsoon's avatar
qinsoon committed
20
21
    // impl: runtime_x64_macos.c
    // decl: thread.rs
22
23
24
    pub static ref GET_THREAD_LOCAL : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig {
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
qinsoon's avatar
qinsoon committed
25
            ret_tys: vec![ADDRESS_TYPE.clone()],
26
27
            arg_tys: vec![]
        }),
28
        aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_get_thread_local")),
29
30
31
        jit: RwLock::new(None),
    };
    
qinsoon's avatar
qinsoon committed
32
33
    // impl: swap_stack_x64_macos.s
    // decl: thread.rs
34
35
36
37
    pub static ref SWAP_BACK_TO_NATIVE_STACK : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig{
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
            ret_tys: vec![],
qinsoon's avatar
qinsoon committed
38
            arg_tys: vec![ADDRESS_TYPE.clone()]
39
        }),
40
        aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_swap_back_to_native_stack")),
41
42
        jit: RwLock::new(None),
    };
43
    
qinsoon's avatar
qinsoon committed
44
    // impl/decl: gc/lib.rs
45
46
47
    pub static ref ALLOC_SLOW : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig {
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
qinsoon's avatar
qinsoon committed
48
49
            ret_tys: vec![ADDRESS_TYPE.clone()],
            arg_tys: vec![UINT64_TYPE.clone(), UINT64_TYPE.clone()]
50
        }),
51
        aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_alloc_slow")),
qinsoon's avatar
qinsoon committed
52
53
54
55
56
57
58
59
60
61
        jit: RwLock::new(None),
    };
    
    // impl/decl: exception.rs
    pub static ref THROW_EXCEPTION : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig {
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
            ret_tys: vec![],
            arg_tys: vec![ADDRESS_TYPE.clone()]        
        }),
62
        aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_throw_exception")),
63
64
        jit: RwLock::new(None),
    };
65
}