MCPcopy Index your code
hub / github.com/RustPython/RustPython / new

Method new

crates/jit/src/instructions.rs:77–104  ·  view source on GitHub ↗
(
        builder: &'a mut FunctionBuilder<'b>,
        num_variables: usize,
        arg_types: &[JitType],
        ret_type: Option<JitType>,
        entry_block: Block,
    )

Source from the content-addressed store, hash-verified

75
76impl<'a, 'b> FunctionCompiler<'a, 'b> {
77 pub fn new(
78 builder: &'a mut FunctionBuilder<'b>,
79 num_variables: usize,
80 arg_types: &[JitType],
81 ret_type: Option<JitType>,
82 entry_block: Block,
83 ) -> FunctionCompiler<'a, 'b> {
84 let mut compiler = FunctionCompiler {
85 builder,
86 stack: Vec::new(),
87 variables: vec![None; num_variables].into_boxed_slice(),
88 label_to_block: HashMap::new(),
89 sig: JitSig {
90 args: arg_types.to_vec(),
91 ret: ret_type,
92 },
93 };
94 let params = compiler.builder.func.dfg.block_params(entry_block).to_vec();
95 for (i, (ty, val)) in arg_types.iter().zip(params).enumerate() {
96 compiler
97 .store_variable(
98 (i as u32).into(),
99 JitValue::from_type_and_value(ty.clone(), val),
100 )
101 .unwrap();
102 }
103 compiler
104 }
105
106 fn pop_multiple(&mut self, count: usize) -> Vec<JitValue> {
107 let stack_len = self.stack.len();

Callers

nothing calls this directly

Calls 6

newFunction · 0.85
to_vecMethod · 0.80
store_variableMethod · 0.80
iterMethod · 0.45
unwrapMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected