Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
radkomih committed Nov 27, 2023
1 parent b637ba9 commit 13f93b1
Show file tree
Hide file tree
Showing 11 changed files with 452 additions and 463 deletions.
29 changes: 21 additions & 8 deletions builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,21 +816,34 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
args = append(args, "--asyncify")
}

args = append(args,
opt,
"-g",
result.Executable,
"--output", result.Executable,
)

if config.Target.Triple == "wasm32-unknown-polkawasm" {
args = append(args, "--signext-lowering")
args = append(args,
opt,
opt,
"--signext-lowering",
"--signature-pruning",
"--const-hoisting",
// "--mvp-features",
result.Executable,
"--output",
result.Executable,
)
} else {
args = append(args,
opt,
"-g",
result.Executable,
"--output",
result.Executable,
)
}

cmd := exec.Command(goenv.Get("WASMOPT"), args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

println(cmd.String())

err := cmd.Run()
if err != nil {
return fmt.Errorf("wasm-opt failed: %w", err)
Expand Down
2 changes: 2 additions & 0 deletions compileopts/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func (c *Config) OptLevel() (level string, speedLevel, sizeLevel int) {
return "O1", 1, 0
case "2":
return "O2", 2, 0
case "3":
return "O3", 2, 0
case "s":
return "Os", 2, 1
case "z":
Expand Down
2 changes: 1 addition & 1 deletion compileopts/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
validSerialOptions = []string{"none", "uart", "usb"}
validPrintSizeOptions = []string{"none", "short", "full"}
validPanicStrategyOptions = []string{"print", "trap"}
validOptOptions = []string{"none", "0", "1", "2", "s", "z"}
validOptOptions = []string{"none", "0", "1", "2", "3", "s", "z"}
)

// Options contains extra options to give to the compiler. These options are
Expand Down
2 changes: 1 addition & 1 deletion lib/binaryen
Submodule binaryen updated 746 files
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ func main() {
}
command := os.Args[1]

opt := flag.String("opt", "z", "optimization level: 0, 1, 2, s, z")
opt := flag.String("opt", "z", "optimization level: 0, 1, 2, 3, s, z")
gc := flag.String("gc", "", "garbage collector to use (none, leaking, conservative)")
panicStrategy := flag.String("panic", "print", "panic strategy (print, trap)")
scheduler := flag.String("scheduler", "", "which scheduler to use (none, tasks, asyncify)")
Expand Down
14 changes: 4 additions & 10 deletions src/runtime/gc_custom.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build gc.custom
//go:build gc.custom_wip

package runtime

Expand Down Expand Up @@ -105,19 +105,13 @@ func free(ptr unsafe.Pointer) {

// markRoots is called with the start and end addresses to scan for references.
// It is currently only called with the top and bottom of the stack.
func markRoots(start, end uintptr) {

}
func markRoots(start, end uintptr) {}

// GC is called to explicitly run garbage collection.
func GC() {

}
func GC() {}

// SetFinalizer registers a finalizer.
func SetFinalizer(obj interface{}, finalizer interface{}) {

}
func SetFinalizer(obj interface{}, finalizer interface{}) {}

// ReadMemStats populates m with memory statistics.
func ReadMemStats(ms *MemStats) {
Expand Down
Loading

0 comments on commit 13f93b1

Please sign in to comment.