aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/gc.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-09-15 16:42:31 +0200
committerRon Evans <[email protected]>2019-09-15 19:09:10 +0200
commit10ed3decb076c88077ccd849029357e1c2c33f7c (patch)
tree8c78d0c16530e61ff3315f1051f9315ea915d1fa /compiler/gc.go
parent8d959b7c636a392046558046e9b423efb2c288bb (diff)
downloadtinygo-10ed3decb076c88077ccd849029357e1c2c33f7c.tar.gz
tinygo-10ed3decb076c88077ccd849029357e1c2c33f7c.zip
compiler: rename getZeroValue to llvm.ConstNull
It does the same thing but should be more complete, and it probably is faster as well (just one CGo call instead of several).
Diffstat (limited to 'compiler/gc.go')
-rw-r--r--compiler/gc.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/gc.go b/compiler/gc.go
index d9679efca..87fed6b16 100644
--- a/compiler/gc.go
+++ b/compiler/gc.go
@@ -134,7 +134,7 @@ func (c *Compiler) makeGCStackSlots() bool {
}
stackChainStart := c.mod.NamedGlobal("runtime.stackChainStart")
if !stackChainStart.IsNil() {
- stackChainStart.SetInitializer(c.getZeroValue(stackChainStart.Type().ElementType()))
+ stackChainStart.SetInitializer(llvm.ConstNull(stackChainStart.Type().ElementType()))
stackChainStart.SetGlobalConstant(true)
}
}
@@ -198,7 +198,7 @@ func (c *Compiler) makeGCStackSlots() bool {
panic("stack chain start not found!")
}
stackChainStartType := stackChainStart.Type().ElementType()
- stackChainStart.SetInitializer(c.getZeroValue(stackChainStartType))
+ stackChainStart.SetInitializer(llvm.ConstNull(stackChainStartType))
// Iterate until runtime.trackPointer has no uses left.
for use := trackPointer.FirstUse(); !use.IsNil(); use = trackPointer.FirstUse() {
@@ -303,7 +303,7 @@ func (c *Compiler) makeGCStackSlots() bool {
// Create the stack object at the function entry.
c.builder.SetInsertPointBefore(fn.EntryBasicBlock().FirstInstruction())
stackObject := c.builder.CreateAlloca(stackObjectType, "gc.stackobject")
- initialStackObject := c.getZeroValue(stackObjectType)
+ initialStackObject := llvm.ConstNull(stackObjectType)
numSlots := (c.targetData.TypeAllocSize(stackObjectType) - c.targetData.TypeAllocSize(c.i8ptrType)*2) / uint64(c.targetData.ABITypeAlignment(c.uintptrType))
numSlotsValue := llvm.ConstInt(c.uintptrType, numSlots, false)
initialStackObject = llvm.ConstInsertValue(initialStackObject, numSlotsValue, []uint32{1})