@@ -288,28 +288,19 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
288
288
}
289
289
290
290
/// 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 (
292
292
_ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
293
293
def_id : DefId ,
294
294
) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > {
295
295
throw_unsup ! ( ThreadLocalStatic ( def_id) )
296
296
}
297
297
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 (
300
300
ecx : & InterpCx < ' mir , ' tcx , Self > ,
301
301
def_id : DefId ,
302
302
) -> InterpResult < ' tcx , Pointer < Self :: Provenance > > ;
303
303
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
-
313
304
/// "Int-to-pointer cast"
314
305
fn ptr_from_addr_cast (
315
306
ecx : & InterpCx < ' mir , ' tcx , Self > ,
@@ -336,6 +327,8 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
336
327
337
328
/// Called to adjust allocations to the Provenance and AllocExtra of this machine.
338
329
///
330
+ /// If `alloc` contains pointers, then they are all pointing to globals.
331
+ ///
339
332
/// The way we construct allocations is to always first construct it without extra and then add
340
333
/// the extra. This keeps uniform code paths for handling both allocations created by CTFE for
341
334
/// globals, and allocations created by Miri during evaluation.
@@ -354,6 +347,19 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
354
347
kind : Option < MemoryKind < Self :: MemoryKind > > ,
355
348
) -> InterpResult < ' tcx , Cow < ' b , Allocation < Self :: Provenance , Self :: AllocExtra , Self :: Bytes > > > ;
356
349
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
+
357
363
/// Evaluate the inline assembly.
358
364
///
359
365
/// 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>) {
592
598
Ok ( alloc)
593
599
}
594
600
595
- fn extern_static_base_pointer (
601
+ fn extern_static_pointer (
596
602
ecx : & InterpCx < $mir, $tcx, Self > ,
597
603
def_id : DefId ,
598
604
) -> InterpResult < $tcx, Pointer > {
@@ -601,9 +607,10 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
601
607
}
602
608
603
609
#[ inline( always) ]
604
- fn adjust_alloc_base_pointer (
610
+ fn adjust_alloc_root_pointer (
605
611
_ecx : & InterpCx < $mir, $tcx, Self > ,
606
612
ptr : Pointer < CtfeProvenance > ,
613
+ _kind : Option < MemoryKind < Self :: MemoryKind > > ,
607
614
) -> InterpResult < $tcx, Pointer < CtfeProvenance > > {
608
615
Ok ( ptr)
609
616
}
0 commit comments