Pass FnAbi to find_mir_or_eval_fn · rust-lang/rust@fd8b983 (original) (raw)

1

``

`-

use rustc_abi::{ExternAbi, Size};

`

``

1

`+

use rustc_abi::Size;

`

2

2

`use rustc_middle::ty::layout::LayoutOf as _;

`

3

3

`use rustc_middle::ty::{self, Instance, Ty};

`

4

4

`use rustc_span::{BytePos, Loc, Symbol, hygiene};

`

``

5

`+

use rustc_target::callconv::{Conv, FnAbi};

`

5

6

``

6

7

`use crate::helpers::check_min_arg_count;

`

7

8

`use crate::*;

`

`@@ -10,13 +11,13 @@ impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}

`

10

11

`pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

`

11

12

`fn handle_miri_backtrace_size(

`

12

13

`&mut self,

`

13

``

`-

abi: ExternAbi,

`

``

14

`+

abi: &FnAbi<'tcx, Ty<'tcx>>,

`

14

15

`link_name: Symbol,

`

15

16

`args: &[OpTy<'tcx>],

`

16

17

`dest: &MPlaceTy<'tcx>,

`

17

18

`) -> InterpResult<'tcx> {

`

18

19

`let this = self.eval_context_mut();

`

19

``

`-

let [flags] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;

`

``

20

`+

let [flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;

`

20

21

``

21

22

`let flags = this.read_scalar(flags)?.to_u64()?;

`

22

23

`if flags != 0 {

`

`@@ -30,7 +31,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

`

30

31

``

31

32

`fn handle_miri_get_backtrace(

`

32

33

`&mut self,

`

33

``

`-

abi: ExternAbi,

`

``

34

`+

abi: &FnAbi<'tcx, Ty<'tcx>>,

`

34

35

`link_name: Symbol,

`

35

36

`args: &[OpTy<'tcx>],

`

36

37

`dest: &MPlaceTy<'tcx>,

`

`@@ -71,7 +72,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

`

71

72

`// storage for pointers is allocated by miri

`

72

73

`// deallocating the slice is undefined behavior with a custom global allocator

`

73

74

`0 => {

`

74

``

`-

let [_flags] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;

`

``

75

`+

let [_flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;

`

75

76

``

76

77

`let alloc = this.allocate(array_layout, MiriMemoryKind::Rust.into())?;

`

77

78

``

`@@ -86,7 +87,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

`

86

87

`}

`

87

88

`// storage for pointers is allocated by the caller

`

88

89

`1 => {

`

89

``

`-

let [_flags, buf] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;

`

``

90

`+

let [_flags, buf] = this.check_shim(abi, Conv::Rust, link_name, args)?;

`

90

91

``

91

92

`let buf_place = this.deref_pointer(buf)?;

`

92

93

``

`@@ -136,13 +137,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

`

136

137

``

137

138

`fn handle_miri_resolve_frame(

`

138

139

`&mut self,

`

139

``

`-

abi: ExternAbi,

`

``

140

`+

abi: &FnAbi<'tcx, Ty<'tcx>>,

`

140

141

`link_name: Symbol,

`

141

142

`args: &[OpTy<'tcx>],

`

142

143

`dest: &MPlaceTy<'tcx>,

`

143

144

`) -> InterpResult<'tcx> {

`

144

145

`let this = self.eval_context_mut();

`

145

``

`-

let [ptr, flags] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;

`

``

146

`+

let [ptr, flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;

`

146

147

``

147

148

`let flags = this.read_scalar(flags)?.to_u64()?;

`

148

149

``

`@@ -207,14 +208,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

`

207

208

``

208

209

`fn handle_miri_resolve_frame_names(

`

209

210

`&mut self,

`

210

``

`-

abi: ExternAbi,

`

``

211

`+

abi: &FnAbi<'tcx, Ty<'tcx>>,

`

211

212

`link_name: Symbol,

`

212

213

`args: &[OpTy<'tcx>],

`

213

214

`) -> InterpResult<'tcx> {

`

214

215

`let this = self.eval_context_mut();

`

215

216

``

216

217

`let [ptr, flags, name_ptr, filename_ptr] =

`

217

``

`-

this.check_shim(abi, ExternAbi::Rust, link_name, args)?;

`

``

218

`+

this.check_shim(abi, Conv::Rust, link_name, args)?;

`

218

219

``

219

220

`let flags = this.read_scalar(flags)?.to_u64()?;

`

220

221

`if flags != 0 {

`