Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdDev = &cli.Command{ Hidden: true, Name: "dev", Usage: "only for dev/debug", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "hello", }, &cli.BoolFlag{ Name: "malloc", }, &cli.BoolFlag{ Name: "count-code-lines", }, }, Action: func(c *cli.Context) error { if c.Bool("count-code-lines") { RunCountCodeLines() os.Exit(0) } if c.Bool("hello") { _, wat, err := api.BuildFile( config.DefaultConfig(), "hello.wa", "func main() { println(123) }", ) if err != nil { if len(wat) != 0 { fmt.Println(string(wat)) } fmt.Println(err) os.Exit(1) } fmt.Println(string(wat)) os.Exit(0) } if c.Bool("malloc") { h := malloc.NewHeap(&malloc.Config{ MemoryPages: 1, MemoryPagesMax: 2, StackPtr: 100, HeapBase: 1000, HeapLFixedCap: 3, }) os.WriteFile("a.out-0.wasm", []byte(h.WasmBytes()), 0666) os.WriteFile("a.out-0.dot", []byte(h.DotString()), 0666) p1 := h.Malloc(65536 - 10) os.WriteFile("a.out-1.dot", []byte(h.DotString()), 0666) fmt.Println("p1:", p1) h.Free(p1) os.WriteFile("a.out-2.dot", []byte(h.DotString()), 0666) p2 := h.Malloc(malloc.KPageBytes) os.WriteFile("a.out-2.dot", []byte(h.DotString()), 0666) fmt.Println("p2:", p2) os.Exit(0) } fmt.Println("...dev...") return nil }, }
Functions ¶
func RunCountCodeLines ¶ added in v0.9.0
func RunCountCodeLines()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.