GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

entrypoints.rs 3.47 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![]
        }),
qinsoon's avatar
qinsoon committed
28
        aot: ValueLocation::Relocatable(RegGroup::GPR, 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
        }),
qinsoon's avatar
qinsoon committed
40
        aot: ValueLocation::Relocatable(RegGroup::GPR, 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
            ret_tys: vec![ADDRESS_TYPE.clone()],
qinsoon's avatar
qinsoon committed
49
            arg_tys: vec![ADDRESS_TYPE.clone(), UINT64_TYPE.clone(), UINT64_TYPE.clone()]
50
        }),
qinsoon's avatar
qinsoon committed
51 52 53
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_alloc_slow")),
        jit: RwLock::new(None),
    };
qinsoon's avatar
qinsoon committed
54 55 56 57 58 59 60 61 62 63 64

    // impl/decl: gc/lib.rs
    pub static ref ALLOC_LARGE : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig {
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
            ret_tys: vec![ADDRESS_TYPE.clone()],
            arg_tys: vec![ADDRESS_TYPE.clone(), UINT64_TYPE.clone(), UINT64_TYPE.clone()]
        }),
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_alloc_large")),
        jit: RwLock::new(None)
    };
65 66 67 68 69 70 71 72 73 74 75

    // impl/decl: gc/lib.rs
    pub static ref INIT_OBJ : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig {
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
            ret_tys: vec![],
            arg_tys: vec![ADDRESS_TYPE.clone(), ADDRESS_TYPE.clone(), UINT64_TYPE.clone()]
        }),
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_init_object")),
        jit: RwLock::new(None)
    };
qinsoon's avatar
qinsoon committed
76 77 78 79 80 81 82 83 84
    
    // 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()]        
        }),
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_throw_exception")),
85 86
        jit: RwLock::new(None),
    };
qinsoon's avatar
qinsoon committed
87 88 89 90 91 92 93 94 95 96 97

    // impl/decl: math.rs
    pub static ref FREM : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig{
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
            ret_tys: vec![DOUBLE_TYPE.clone()],
            arg_tys: vec![DOUBLE_TYPE.clone(), DOUBLE_TYPE.clone()]
        }),
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_frem")),
        jit: RwLock::new(None)
    };
98
}