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 5.21 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 44 45 46 47 48 49 50 51 52 53

    // impl/decl: gc/lib.rs
    pub static ref ALLOC_FAST : 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_fast")),
        jit: RwLock::new(None)
    };
54
    
qinsoon's avatar
qinsoon committed
55
    // impl/decl: gc/lib.rs
56 57 58
    pub static ref ALLOC_SLOW : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig {
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
qinsoon's avatar
qinsoon committed
59
            ret_tys: vec![ADDRESS_TYPE.clone()],
qinsoon's avatar
qinsoon committed
60
            arg_tys: vec![ADDRESS_TYPE.clone(), UINT64_TYPE.clone(), UINT64_TYPE.clone()]
61
        }),
qinsoon's avatar
qinsoon committed
62 63 64
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_alloc_slow")),
        jit: RwLock::new(None),
    };
qinsoon's avatar
qinsoon committed
65 66 67 68 69 70 71 72 73 74 75

    // 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)
    };
76 77 78 79 80 81 82 83 84 85 86

    // 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
87 88 89 90 91 92 93 94 95 96 97

    // impl/decl: gc/lib.rs
    pub static ref INIT_HYBRID : 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(), UINT64_TYPE.clone()]
        }),
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_init_hybrid")),
        jit: RwLock::new(None)
    };
qinsoon's avatar
qinsoon committed
98 99 100 101 102 103 104 105 106
    
    // 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")),
107 108
        jit: RwLock::new(None),
    };
qinsoon's avatar
qinsoon committed
109 110

    // impl/decl: math.rs
111
    pub static ref FREM_DOUBLE : RuntimeEntrypoint = RuntimeEntrypoint {
qinsoon's avatar
qinsoon committed
112 113 114 115 116
        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()]
        }),
117 118 119 120 121 122 123 124 125 126 127
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_frem_double")),
        jit: RwLock::new(None)
    };

    pub static ref FREM_FLOAT : RuntimeEntrypoint = RuntimeEntrypoint {
        sig: P(MuFuncSig{
            hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
            ret_tys: vec![FLOAT_TYPE.clone()],
            arg_tys: vec![FLOAT_TYPE.clone(), FLOAT_TYPE.clone()]
        }),
        aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_frem_float")),
qinsoon's avatar
qinsoon committed
128 129
        jit: RwLock::new(None)
    };
130 131 132 133 134 135 136 137 138 139 140

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