1
+ use super :: { JitCompileError , JitSig , JitType } ;
2
+ use cranelift:: codegen:: ir:: FuncRef ;
1
3
use cranelift:: prelude:: * ;
2
4
use num_traits:: cast:: ToPrimitive ;
3
5
use rustpython_compiler_core:: bytecode:: {
4
6
self , BinaryOperator , BorrowedConstant , CodeObject , ComparisonOperator , Instruction , Label ,
5
7
OpArg , OpArgState , UnaryOperator ,
6
8
} ;
7
9
use std:: collections:: HashMap ;
8
- use cranelift:: codegen:: ir:: FuncRef ;
9
- use super :: { JitCompileError , JitSig , JitType } ;
10
10
11
11
#[ repr( u16 ) ]
12
12
enum CustomTrapCode {
@@ -286,7 +286,8 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
286
286
self . store_variable ( idx. get ( arg) , val)
287
287
}
288
288
Instruction :: LoadConst { idx } => {
289
- let val = self . prepare_const ( bytecode. constants [ idx. get ( arg) as usize ] . borrow_constant ( ) ) ?;
289
+ let val = self
290
+ . prepare_const ( bytecode. constants [ idx. get ( arg) as usize ] . borrow_constant ( ) ) ?;
290
291
self . stack . push ( val) ;
291
292
Ok ( ( ) )
292
293
}
@@ -315,7 +316,8 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
315
316
self . return_value ( val)
316
317
}
317
318
Instruction :: ReturnConst { idx } => {
318
- let val = self . prepare_const ( bytecode. constants [ idx. get ( arg) as usize ] . borrow_constant ( ) ) ?;
319
+ let val = self
320
+ . prepare_const ( bytecode. constants [ idx. get ( arg) as usize ] . borrow_constant ( ) ) ?;
319
321
self . return_value ( val)
320
322
}
321
323
Instruction :: CompareOperation { op, .. } => {
@@ -521,7 +523,7 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
521
523
self . stack . push ( JitValue :: FuncRef ( func_ref) ) ;
522
524
Ok ( ( ) )
523
525
}
524
- } ,
526
+ }
525
527
Instruction :: CallFunctionPositional { nargs } => {
526
528
let nargs = nargs. get ( arg) ;
527
529
@@ -538,10 +540,10 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
538
540
self . stack . push ( JitValue :: Int ( returns[ 0 ] ) ) ;
539
541
540
542
Ok ( ( ) )
541
- } ,
543
+ }
542
544
_ => Err ( JitCompileError :: BadBytecode ) ,
543
545
}
544
- } ,
546
+ }
545
547
_ => Err ( JitCompileError :: NotSupported ) ,
546
548
}
547
549
}
0 commit comments