@@ -8,7 +8,6 @@ use std::hash::Hash;
88
99use rustc_abi:: { Align , Size } ;
1010use rustc_apfloat:: { Float , FloatConvert } ;
11- use rustc_ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
1211use rustc_middle:: query:: TyCtxtAt ;
1312use rustc_middle:: ty:: Ty ;
1413use rustc_middle:: ty:: layout:: TyAndLayout ;
@@ -21,7 +20,6 @@ use super::{
2120 AllocBytes , AllocId , AllocKind , AllocRange , Allocation , CTFE_ALLOC_SALT , ConstAllocation ,
2221 CtfeProvenance , FnArg , Frame , ImmTy , InterpCx , InterpResult , MPlaceTy , MemoryKind ,
2322 Misalignment , OpTy , PlaceTy , Pointer , Provenance , RangeSet , interp_ok, throw_unsup,
24- throw_unsup_format,
2523} ;
2624
2725/// Data returned by [`Machine::after_stack_pop`], and consumed by
@@ -361,6 +359,19 @@ pub trait Machine<'tcx>: Sized {
361359 size : i64 ,
362360 ) -> Option < ( AllocId , Size , Self :: ProvenanceExtra ) > ;
363361
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+
364375 /// Called to adjust global allocations to the Provenance and AllocExtra of this machine.
365376 ///
366377 /// If `alloc` contains pointers, then they are all pointing to globals.
@@ -375,46 +386,19 @@ pub trait Machine<'tcx>: Sized {
375386 alloc : & ' b Allocation ,
376387 ) -> InterpResult < ' tcx , Cow < ' b , Allocation < Self :: Provenance , Self :: AllocExtra , Self :: Bytes > > > ;
377388
378- /// Initialize the extra state of an allocation.
389+ /// Initialize the extra state of an allocation local to this machine .
379390 ///
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 (
383395 ecx : & InterpCx < ' tcx , Self > ,
384396 id : AllocId ,
385397 kind : MemoryKind < Self :: MemoryKind > ,
386398 size : Size ,
387399 align : Align ,
388400 ) -> InterpResult < ' tcx , Self :: AllocExtra > ;
389401
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-
418402 /// Hook for performing extra checks on a memory read access.
419403 ///
420404 /// This will *not* be called during validation!
@@ -699,7 +683,7 @@ pub macro compile_time_machine(<$tcx: lifetime>) {
699683 interp_ok ( Cow :: Borrowed ( alloc) )
700684 }
701685
702- fn init_alloc_extra (
686+ fn init_local_allocation (
703687 _ecx : & InterpCx < $tcx, Self > ,
704688 _id : AllocId ,
705689 _kind : MemoryKind < Self :: MemoryKind > ,
0 commit comments