@@ -117,12 +117,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
117117 }
118118 }
119119
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) )
122122 }
123123
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) )
126126 }
127127
128128 pub fn allocate_with (
@@ -140,9 +140,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
140140 size : Size ,
141141 align : Align ,
142142 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) ?) )
146145 }
147146
148147 pub fn reallocate (
@@ -153,17 +152,18 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
153152 new_size : Size ,
154153 new_align : Align ,
155154 kind : MemoryKind < M :: MemoryKinds > ,
156- ) -> EvalResult < ' tcx , Pointer < M :: PointerTag > > {
155+ ) -> EvalResult < ' tcx , Pointer > {
157156 if ptr. offset . bytes ( ) != 0 {
158157 return err ! ( ReallocateNonBasePtr ) ;
159158 }
160159
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.
162162 let new_ptr = self . allocate ( new_size, new_align, kind) ?;
163163 self . copy (
164164 ptr. into ( ) ,
165165 old_align,
166- new_ptr. into ( ) ,
166+ new_ptr. with_default_tag ( ) . into ( ) ,
167167 new_align,
168168 old_size. min ( new_size) ,
169169 /*nonoverlapping*/ true ,
@@ -347,7 +347,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
347347 Some ( AllocType :: Memory ( mem) ) => {
348348 // We got tcx memory. Let the machine figure out whether and how to
349349 // 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) )
351351 }
352352 Some ( AllocType :: Function ( ..) ) => {
353353 return err ! ( DerefFunctionPointer )
@@ -381,7 +381,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
381381 if let ConstValue :: ByRef ( _, allocation, _) = const_val. val {
382382 // We got tcx memory. Let the machine figure out whether and how to
383383 // turn that into memory with the right pointer tag.
384- M :: static_with_default_tag ( allocation)
384+ M :: adjust_static_allocation ( allocation)
385385 } else {
386386 bug ! ( "Matching on non-ByRef static" )
387387 }
0 commit comments