mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 19:23:25 +00:00
compiler: mark stringFromRunes as nocapture/readonly
This commit is contained in:
@@ -175,6 +175,9 @@ func (c *compilerContext) getFunction(fn *ssa.Function) (llvm.Type, llvm.Value)
|
|||||||
case "runtime.stringFromBytes":
|
case "runtime.stringFromBytes":
|
||||||
llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("nocapture"), 0))
|
llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("nocapture"), 0))
|
||||||
llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("readonly"), 0))
|
llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("readonly"), 0))
|
||||||
|
case "runtime.stringFromRunes":
|
||||||
|
llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("nocapture"), 0))
|
||||||
|
llvmFn.AddAttributeAtIndex(1, c.ctx.CreateEnumAttribute(llvm.AttributeKindID("readonly"), 0))
|
||||||
case "runtime.trackPointer":
|
case "runtime.trackPointer":
|
||||||
// This function is necessary for tracking pointers on the stack in a
|
// This function is necessary for tracking pointers on the stack in a
|
||||||
// portable way (see gc_stack_portable.go). Indicate to the optimizer
|
// portable way (see gc_stack_portable.go). Indicate to the optimizer
|
||||||
|
|||||||
Vendored
+4
@@ -54,6 +54,10 @@ func main() {
|
|||||||
var buf [32]byte
|
var buf [32]byte
|
||||||
s := string(buf[:])
|
s := string(buf[:])
|
||||||
println(len(s))
|
println(len(s))
|
||||||
|
|
||||||
|
var rbuf [5]rune
|
||||||
|
s = string(rbuf[:])
|
||||||
|
println(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func derefInt(x *int) int {
|
func derefInt(x *int) int {
|
||||||
|
|||||||
Reference in New Issue
Block a user