mirror of
				https://github.com/golang/go.git
				synced 2025-10-31 16:50:58 +00:00 
			
		
		
		
	runtime: make Go and C mallocgc signatures match
Previously, the flags argument to mallocgc was an int in Go, but a uint32 in C. Change the Go type to use uint32 so these agree. The largest flag value is 2 (and of course no flag values are negative), so this won't change anything on little endian architectures, but it matters on big endian. LGTM=rsc R=khr, rsc CC=golang-codereviews https://golang.org/cl/169920043
This commit is contained in:
		
							parent
							
								
									b802240300
								
							
						
					
					
						commit
						489ff75ab8
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -43,7 +43,7 @@ var zerobase uintptr | |||
| // Allocate an object of size bytes. | ||||
| // Small objects are allocated from the per-P cache's free lists. | ||||
| // Large objects (> 32 kB) are allocated straight from the heap. | ||||
| func mallocgc(size uintptr, typ *_type, flags int) unsafe.Pointer { | ||||
| func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { | ||||
| 	if size == 0 { | ||||
| 		return unsafe.Pointer(&zerobase) | ||||
| 	} | ||||
|  | @ -346,7 +346,7 @@ marked: | |||
| 
 | ||||
| // implementation of new builtin | ||||
| func newobject(typ *_type) unsafe.Pointer { | ||||
| 	flags := 0 | ||||
| 	flags := uint32(0) | ||||
| 	if typ.kind&kindNoPointers != 0 { | ||||
| 		flags |= flagNoScan | ||||
| 	} | ||||
|  | @ -355,7 +355,7 @@ func newobject(typ *_type) unsafe.Pointer { | |||
| 
 | ||||
| // implementation of make builtin for slices | ||||
| func newarray(typ *_type, n uintptr) unsafe.Pointer { | ||||
| 	flags := 0 | ||||
| 	flags := uint32(0) | ||||
| 	if typ.kind&kindNoPointers != 0 { | ||||
| 		flags |= flagNoScan | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Austin Clements
						Austin Clements