mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
gc: drop support for 'precise' globals
Precise globals require a whole program optimization pass that is hard to support when building packages separately. This patch removes support for these globals by converting the last use (Linux) to use linker-defined symbols instead. For details, see: https://github.com/tinygo-org/tinygo/issues/2870
This commit is contained in:
committed by
Ron Evans
parent
5c488e3145
commit
2d61972475
Vendored
-33
@@ -1,33 +0,0 @@
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
||||
target triple = "wasm32-unknown-unknown-wasm"
|
||||
|
||||
%runtime._string = type { i8*, i32 }
|
||||
%runtime._interface = type { i32, i8* }
|
||||
|
||||
@globalInt = global i32 5
|
||||
@globalString = global %runtime._string zeroinitializer
|
||||
@globalInterface = global %runtime._interface zeroinitializer
|
||||
@constString = constant %runtime._string zeroinitializer
|
||||
@constInterface = constant %runtime._interface zeroinitializer
|
||||
@runtime.trackedGlobalsLength = external global i32
|
||||
@runtime.trackedGlobalsBitmap = external global [0 x i8]
|
||||
@runtime.trackedGlobalsStart = external global i32
|
||||
|
||||
define void @main() {
|
||||
%1 = load i32, i32* @globalInt
|
||||
%2 = load %runtime._string, %runtime._string* @globalString
|
||||
%3 = load %runtime._interface, %runtime._interface* @globalInterface
|
||||
%4 = load %runtime._string, %runtime._string* @constString
|
||||
%5 = load %runtime._interface, %runtime._interface* @constInterface
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @runtime.markGlobals() {
|
||||
; Very small subset of what runtime.markGlobals would really do.
|
||||
; Just enough to make sure the transformation is correct.
|
||||
%1 = load i32, i32* @runtime.trackedGlobalsStart
|
||||
%2 = load i32, i32* @runtime.trackedGlobalsLength
|
||||
%3 = getelementptr inbounds [0 x i8], [0 x i8]* @runtime.trackedGlobalsBitmap, i32 0, i32 0
|
||||
%4 = load i8, i8* %3
|
||||
ret void
|
||||
}
|
||||
Vendored
-31
@@ -1,31 +0,0 @@
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
||||
target triple = "wasm32-unknown-unknown-wasm"
|
||||
|
||||
%runtime._string = type { i8*, i32 }
|
||||
%runtime._interface = type { i32, i8* }
|
||||
|
||||
@globalInt = global i32 5
|
||||
@constString = constant %runtime._string zeroinitializer
|
||||
@constInterface = constant %runtime._interface zeroinitializer
|
||||
@runtime.trackedGlobalsLength = internal global i32 4
|
||||
@runtime.trackedGlobalsBitmap = external global [0 x i8]
|
||||
@runtime.trackedGlobalsStart = internal global i32 ptrtoint ({ %runtime._string, %runtime._interface }* @tinygo.trackedGlobals to i32)
|
||||
@tinygo.trackedGlobals = internal unnamed_addr global { %runtime._string, %runtime._interface } zeroinitializer
|
||||
@runtime.trackedGlobalsBitmap.1 = internal global [1 x i8] c"\09"
|
||||
|
||||
define void @main() {
|
||||
%1 = load i32, i32* @globalInt, align 4
|
||||
%2 = load %runtime._string, %runtime._string* getelementptr inbounds ({ %runtime._string, %runtime._interface }, { %runtime._string, %runtime._interface }* @tinygo.trackedGlobals, i32 0, i32 0), align 4
|
||||
%3 = load %runtime._interface, %runtime._interface* getelementptr inbounds ({ %runtime._string, %runtime._interface }, { %runtime._string, %runtime._interface }* @tinygo.trackedGlobals, i32 0, i32 1), align 4
|
||||
%4 = load %runtime._string, %runtime._string* @constString, align 4
|
||||
%5 = load %runtime._interface, %runtime._interface* @constInterface, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @runtime.markGlobals() {
|
||||
%1 = load i32, i32* @runtime.trackedGlobalsStart, align 4
|
||||
%2 = load i32, i32* @runtime.trackedGlobalsLength, align 4
|
||||
%3 = getelementptr inbounds [0 x i8], [0 x i8]* bitcast ([1 x i8]* @runtime.trackedGlobalsBitmap.1 to [0 x i8]*), i32 0, i32 0
|
||||
%4 = load i8, i8* %3, align 1
|
||||
ret void
|
||||
}
|
||||
Reference in New Issue
Block a user