linux: reduce binary size in the common case
This commit changes the runtime.putchar implementation to directly call the `write` system call. This reduces the binary size by around 2.7kB.
Этот коммит содержится в:
		
							родитель
							
								
									cceb655874
								
							
						
					
					
						коммит
						670fcf59d8
					
				
					 1 изменённых файлов: 4 добавлений и 3 удалений
				
			
		|  | @ -7,8 +7,8 @@ import ( | ||||||
| 	"unsafe" | 	"unsafe" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| //export putchar | //export write | ||||||
| func _putchar(c int) int | func libc_write(fd int32, buf unsafe.Pointer, count uint) int | ||||||
| 
 | 
 | ||||||
| //export usleep | //export usleep | ||||||
| func usleep(usec uint) int | func usleep(usec uint) int | ||||||
|  | @ -145,7 +145,8 @@ func syscall_runtime_envs() []string { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func putchar(c byte) { | func putchar(c byte) { | ||||||
| 	_putchar(int(c)) | 	buf := [1]byte{c} | ||||||
|  | 	libc_write(1, unsafe.Pointer(&buf[0]), 1) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func ticksToNanoseconds(ticks timeUnit) int64 { | func ticksToNanoseconds(ticks timeUnit) int64 { | ||||||
|  |  | ||||||
		Загрузка…
	
	Создание таблицы
		
		Сослаться в новой задаче
	
	 Ayke van Laethem
						Ayke van Laethem