mirror of
				https://github.com/golang/go.git
				synced 2025-10-31 16:50:58 +00:00 
			
		
		
		
	runtime: remove type-punning for Type.gc[0], gc[1]
Depending on flags&KindGCProg, gc[0] and gc[1] are either pointers or inlined bitmap bits. That's not compatible with a precise garbage collector: it needs to be always pointers or never pointers. Change the inlined bitmap case to store a pointer to an out-of-line bitmap in gc[0]. The out-of-line bitmaps are dedup'ed, so that for example all pointer types share the same out-of-line bitmap. Fixes #8864. LGTM=r R=golang-codereviews, dvyukov, r CC=golang-codereviews, iant, khr, rlh https://golang.org/cl/155820043
This commit is contained in:
		
							parent
							
								
									f739b77508
								
							
						
					
					
						commit
						18172c42ff
					
				
					 5 changed files with 30 additions and 8 deletions
				
			
		|  | @ -270,7 +270,7 @@ func mallocgc(size uintptr, typ *_type, flags int) unsafe.Pointer { | |||
| 			} | ||||
| 			ptrmask = (*uint8)(add(unsafe.Pointer(ptrmask), 1)) // skip the unroll flag byte | ||||
| 		} else { | ||||
| 			ptrmask = (*uint8)(unsafe.Pointer(&typ.gc[0])) // embed mask | ||||
| 			ptrmask = (*uint8)(unsafe.Pointer(typ.gc[0])) // pointer to unrolled mask | ||||
| 		} | ||||
| 		if size == 2*ptrSize { | ||||
| 			*xbits = *ptrmask | bitBoundary | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Russ Cox
						Russ Cox