@@ -8,7 +8,6 @@ use std::hash::Hash;
8
8
9
9
use rustc_abi:: { Align , Size } ;
10
10
use rustc_apfloat:: { Float , FloatConvert } ;
11
- use rustc_ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
12
11
use rustc_middle:: query:: TyCtxtAt ;
13
12
use rustc_middle:: ty:: Ty ;
14
13
use rustc_middle:: ty:: layout:: TyAndLayout ;
@@ -21,7 +20,6 @@ use super::{
21
20
AllocBytes , AllocId , AllocKind , AllocRange , Allocation , CTFE_ALLOC_SALT , ConstAllocation ,
22
21
CtfeProvenance , FnArg , Frame , ImmTy , InterpCx , InterpResult , MPlaceTy , MemoryKind ,
23
22
Misalignment , OpTy , PlaceTy , Pointer , Provenance , RangeSet , interp_ok, throw_unsup,
24
- throw_unsup_format,
25
23
} ;
26
24
27
25
/// Data returned by [`Machine::after_stack_pop`], and consumed by
@@ -361,6 +359,19 @@ pub trait Machine<'tcx>: Sized {
361
359
size : i64 ,
362
360
) -> Option < ( AllocId , Size , Self :: ProvenanceExtra ) > ;
363
361
362
+ /// Return a "root" pointer for the given allocation: the one that is used for direct
363
+ /// accesses to this static/const/fn allocation, or the one returned from the heap allocator.
364
+ ///
365
+ /// Not called on `extern` or thread-local statics (those use the methods above).
366
+ ///
367
+ /// `kind` is the kind of the allocation the pointer points to; it can be `None` when
368
+ /// it's a global and `GLOBAL_KIND` is `None`.
369
+ fn adjust_alloc_root_pointer (
370
+ ecx : & InterpCx < ' tcx , Self > ,
371
+ ptr : Pointer ,
372
+ kind : Option < MemoryKind < Self :: MemoryKind > > ,
373
+ ) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > ;
374
+
364
375
/// Called to adjust global allocations to the Provenance and AllocExtra of this machine.
365
376
///
366
377
/// If `alloc` contains pointers, then they are all pointing to globals.
@@ -375,46 +386,19 @@ pub trait Machine<'tcx>: Sized {
375
386
alloc : & ' b Allocation ,
376
387
) -> InterpResult < ' tcx , Cow < ' b , Allocation < Self :: Provenance , Self :: AllocExtra , Self :: Bytes > > > ;
377
388
378
- /// Initialize the extra state of an allocation.
389
+ /// Initialize the extra state of an allocation local to this machine .
379
390
///
380
- /// This is guaranteed to be called exactly once on all allocations that are accessed by the
381
- /// program.
382
- fn init_alloc_extra (
391
+ /// This is guaranteed to be called exactly once on all allocations local to this machine.
392
+ /// It will not be called automatically for global allocations; `adjust_global_allocation`
393
+ /// has to do that itself if that is desired.
394
+ fn init_local_allocation (
383
395
ecx : & InterpCx < ' tcx , Self > ,
384
396
id : AllocId ,
385
397
kind : MemoryKind < Self :: MemoryKind > ,
386
398
size : Size ,
387
399
align : Align ,
388
400
) -> InterpResult < ' tcx , Self :: AllocExtra > ;
389
401
390
- /// Return a "root" pointer for the given allocation: the one that is used for direct
391
- /// accesses to this static/const/fn allocation, or the one returned from the heap allocator.
392
- ///
393
- /// Not called on `extern` or thread-local statics (those use the methods above).
394
- ///
395
- /// `kind` is the kind of the allocation the pointer points to; it can be `None` when
396
- /// it's a global and `GLOBAL_KIND` is `None`.
397
- fn adjust_alloc_root_pointer (
398
- ecx : & InterpCx < ' tcx , Self > ,
399
- ptr : Pointer ,
400
- kind : Option < MemoryKind < Self :: MemoryKind > > ,
401
- ) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > ;
402
-
403
- /// Evaluate the inline assembly.
404
- ///
405
- /// This should take care of jumping to the next block (one of `targets`) when asm goto
406
- /// is triggered, `targets[0]` when the assembly falls through, or diverge in case of
407
- /// naked_asm! or `InlineAsmOptions::NORETURN` being set.
408
- fn eval_inline_asm (
409
- _ecx : & mut InterpCx < ' tcx , Self > ,
410
- _template : & ' tcx [ InlineAsmTemplatePiece ] ,
411
- _operands : & [ mir:: InlineAsmOperand < ' tcx > ] ,
412
- _options : InlineAsmOptions ,
413
- _targets : & [ mir:: BasicBlock ] ,
414
- ) -> InterpResult < ' tcx > {
415
- throw_unsup_format ! ( "inline assembly is not supported" )
416
- }
417
-
418
402
/// Hook for performing extra checks on a memory read access.
419
403
///
420
404
/// This will *not* be called during validation!
@@ -699,7 +683,7 @@ pub macro compile_time_machine(<$tcx: lifetime>) {
699
683
interp_ok ( Cow :: Borrowed ( alloc) )
700
684
}
701
685
702
- fn init_alloc_extra (
686
+ fn init_local_allocation (
703
687
_ecx : & InterpCx < $tcx, Self > ,
704
688
_id : AllocId ,
705
689
_kind : MemoryKind < Self :: MemoryKind > ,
0 commit comments