Add -gc=custom option (#3302)

* Add -gc=custom option
This commit is contained in:
Anuraag Agrawal
2023-01-29 04:24:56 +09:00
committed by GitHub
parent 13698b17f7
commit eebd2f648b
7 changed files with 67 additions and 6 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ func (c *Config) GC() string {
// that can be traced by the garbage collector.
func (c *Config) NeedsStackObjects() bool {
switch c.GC() {
case "conservative", "precise":
case "conservative", "custom", "precise":
for _, tag := range c.BuildTags() {
if tag == "tinygo.wasm" {
return true
+1 -1
View File
@@ -8,7 +8,7 @@ import (
)
var (
validGCOptions = []string{"none", "leaking", "conservative", "precise"}
validGCOptions = []string{"none", "leaking", "conservative", "custom", "precise"}
validSchedulerOptions = []string{"none", "tasks", "asyncify"}
validSerialOptions = []string{"none", "uart", "usb"}
validPrintSizeOptions = []string{"none", "short", "full"}
+7 -1
View File
@@ -9,7 +9,7 @@ import (
func TestVerifyOptions(t *testing.T) {
expectedGCError := errors.New(`invalid gc option 'incorrect': valid values are none, leaking, conservative, precise`)
expectedGCError := errors.New(`invalid gc option 'incorrect': valid values are none, leaking, conservative, custom, precise`)
expectedSchedulerError := errors.New(`invalid scheduler option 'incorrect': valid values are none, tasks, asyncify`)
expectedPrintSizeError := errors.New(`invalid size option 'incorrect': valid values are none, short, full`)
expectedPanicStrategyError := errors.New(`invalid panic option 'incorrect': valid values are print, trap`)
@@ -48,6 +48,12 @@ func TestVerifyOptions(t *testing.T) {
GC: "conservative",
},
},
{
name: "GCOptionCustom",
opts: compileopts.Options{
GC: "custom",
},
},
{
name: "InvalidSchedulerOption",
opts: compileopts.Options{