@@ -288,28 +288,19 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
288288 }
289289
290290 /// Return the `AllocId` for the given thread-local static in the current thread.
291- fn thread_local_static_base_pointer (
291+ fn thread_local_static_pointer (
292292 _ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
293293 def_id : DefId ,
294294 ) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > {
295295 throw_unsup ! ( ThreadLocalStatic ( def_id) )
296296 }
297297
298- /// Return the root pointer for the given `extern static`.
299- fn extern_static_base_pointer (
298+ /// Return the `AllocId` for the given `extern static`.
299+ fn extern_static_pointer (
300300 ecx : & InterpCx < ' mir , ' tcx , Self > ,
301301 def_id : DefId ,
302302 ) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > ;
303303
304- /// Return a "base" pointer for the given allocation: the one that is used for direct
305- /// accesses to this static/const/fn allocation, or the one returned from the heap allocator.
306- ///
307- /// Not called on `extern` or thread-local statics (those use the methods above).
308- fn adjust_alloc_base_pointer (
309- ecx : & InterpCx < ' mir , ' tcx , Self > ,
310- ptr : Pointer ,
311- ) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > ;
312-
313304 /// "Int-to-pointer cast"
314305 fn ptr_from_addr_cast (
315306 ecx : & InterpCx < ' mir , ' tcx , Self > ,
@@ -336,6 +327,8 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
336327
337328 /// Called to adjust allocations to the Provenance and AllocExtra of this machine.
338329 ///
330+ /// If `alloc` contains pointers, then they are all pointing to globals.
331+ ///
339332 /// The way we construct allocations is to always first construct it without extra and then add
340333 /// the extra. This keeps uniform code paths for handling both allocations created by CTFE for
341334 /// globals, and allocations created by Miri during evaluation.
@@ -354,6 +347,19 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
354347 kind : Option < MemoryKind < Self :: MemoryKind > > ,
355348 ) -> InterpResult < ' tcx , Cow < ' b , Allocation < Self :: Provenance , Self :: AllocExtra , Self :: Bytes > > > ;
356349
350+ /// Return a "root" pointer for the given allocation: the one that is used for direct
351+ /// accesses to this static/const/fn allocation, or the one returned from the heap allocator.
352+ ///
353+ /// Not called on `extern` or thread-local statics (those use the methods above).
354+ ///
355+ /// `kind` is the kind of the allocation the pointer points to; it can be `None` when
356+ /// it's a global and `GLOBAL_KIND` is `None`.
357+ fn adjust_alloc_root_pointer (
358+ ecx : & InterpCx < ' mir , ' tcx , Self > ,
359+ ptr : Pointer ,
360+ kind : Option < MemoryKind < Self :: MemoryKind > > ,
361+ ) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > ;
362+
357363 /// Evaluate the inline assembly.
358364 ///
359365 /// This should take care of jumping to the next block (one of `targets`) when asm goto
@@ -592,7 +598,7 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
592598 Ok ( alloc)
593599 }
594600
595- fn extern_static_base_pointer (
601+ fn extern_static_pointer (
596602 ecx : & InterpCx < $mir, $tcx, Self > ,
597603 def_id : DefId ,
598604 ) -> InterpResult < $tcx, Pointer > {
@@ -601,9 +607,10 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
601607 }
602608
603609 #[ inline( always) ]
604- fn adjust_alloc_base_pointer (
610+ fn adjust_alloc_root_pointer (
605611 _ecx : & InterpCx < $mir, $tcx, Self > ,
606612 ptr : Pointer < CtfeProvenance > ,
613+ _kind : Option < MemoryKind < Self :: MemoryKind > > ,
607614 ) -> InterpResult < $tcx, Pointer < CtfeProvenance > > {
608615 Ok ( ptr)
609616 }
0 commit comments