mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-08 21:59:06 +00:00
compiler: refactor named types to create them lazily
This commit refactors named types to be created lazily. Instead of defining all types in advance, do it only when necessary.
This commit is contained in:
committed by
Ron Evans
parent
88bb61f287
commit
6b5b4a681d
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// emitMakeChan returns a new channel value for the given channel type.
|
||||
func (c *Compiler) emitMakeChan(expr *ssa.MakeChan) (llvm.Value, error) {
|
||||
chanType := c.mod.GetTypeByName("runtime.channel")
|
||||
chanType := c.getLLVMType(c.getRuntimeType("channel"))
|
||||
size := c.targetData.TypeAllocSize(chanType)
|
||||
sizeValue := llvm.ConstInt(c.uintptrType, size, false)
|
||||
ptr := c.createRuntimeCall("alloc", []llvm.Value{sizeValue}, "chan.alloc")
|
||||
|
||||
Reference in New Issue
Block a user