@@ -117,12 +117,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
117
117
}
118
118
}
119
119
120
- pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> Pointer < M :: PointerTag > {
121
- Pointer :: from ( self . tcx . alloc_map . lock ( ) . create_fn_alloc ( instance) ) . with_default_tag ( )
120
+ pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> Pointer {
121
+ Pointer :: from ( self . tcx . alloc_map . lock ( ) . create_fn_alloc ( instance) )
122
122
}
123
123
124
- pub fn allocate_static_bytes ( & mut self , bytes : & [ u8 ] ) -> Pointer < M :: PointerTag > {
125
- Pointer :: from ( self . tcx . allocate_bytes ( bytes) ) . with_default_tag ( )
124
+ pub fn allocate_static_bytes ( & mut self , bytes : & [ u8 ] ) -> Pointer {
125
+ Pointer :: from ( self . tcx . allocate_bytes ( bytes) )
126
126
}
127
127
128
128
pub fn allocate_with (
@@ -140,9 +140,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
140
140
size : Size ,
141
141
align : Align ,
142
142
kind : MemoryKind < M :: MemoryKinds > ,
143
- ) -> EvalResult < ' tcx , Pointer < M :: PointerTag > > {
144
- let ptr = Pointer :: from ( self . allocate_with ( Allocation :: undef ( size, align) , kind) ?) ;
145
- Ok ( ptr. with_default_tag ( ) )
143
+ ) -> EvalResult < ' tcx , Pointer > {
144
+ Ok ( Pointer :: from ( self . allocate_with ( Allocation :: undef ( size, align) , kind) ?) )
146
145
}
147
146
148
147
pub fn reallocate (
@@ -153,17 +152,18 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
153
152
new_size : Size ,
154
153
new_align : Align ,
155
154
kind : MemoryKind < M :: MemoryKinds > ,
156
- ) -> EvalResult < ' tcx , Pointer < M :: PointerTag > > {
155
+ ) -> EvalResult < ' tcx , Pointer > {
157
156
if ptr. offset . bytes ( ) != 0 {
158
157
return err ! ( ReallocateNonBasePtr ) ;
159
158
}
160
159
161
- // For simplicities' sake, we implement reallocate as "alloc, copy, dealloc"
160
+ // For simplicities' sake, we implement reallocate as "alloc, copy, dealloc".
161
+ // FIXME: Do something more efficient.
162
162
let new_ptr = self . allocate ( new_size, new_align, kind) ?;
163
163
self . copy (
164
164
ptr. into ( ) ,
165
165
old_align,
166
- new_ptr. into ( ) ,
166
+ new_ptr. with_default_tag ( ) . into ( ) ,
167
167
new_align,
168
168
old_size. min ( new_size) ,
169
169
/*nonoverlapping*/ true ,
@@ -347,7 +347,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
347
347
Some ( AllocType :: Memory ( mem) ) => {
348
348
// We got tcx memory. Let the machine figure out whether and how to
349
349
// turn that into memory with the right pointer tag.
350
- return Ok ( M :: static_with_default_tag ( mem) )
350
+ return Ok ( M :: adjust_static_allocation ( mem) )
351
351
}
352
352
Some ( AllocType :: Function ( ..) ) => {
353
353
return err ! ( DerefFunctionPointer )
@@ -381,7 +381,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
381
381
if let ConstValue :: ByRef ( _, allocation, _) = const_val. val {
382
382
// We got tcx memory. Let the machine figure out whether and how to
383
383
// turn that into memory with the right pointer tag.
384
- M :: static_with_default_tag ( allocation)
384
+ M :: adjust_static_allocation ( allocation)
385
385
} else {
386
386
bug ! ( "Matching on non-ByRef static" )
387
387
}
0 commit comments