@@ -40,24 +40,22 @@ const tinygoPath = "github.com/tinygo-org/tinygo"
4040var functionsUsedInTransforms = []string {
4141 "runtime.alloc" ,
4242 "runtime.free" ,
43- "runtime.scheduler" ,
4443 "runtime.nilPanic" ,
4544}
4645
47- var taskFunctionsUsedInTransforms = []string {
48- "runtime.startGoroutine" ,
49- }
46+ var taskFunctionsUsedInTransforms = []string {}
5047
5148var coroFunctionsUsedInTransforms = []string {
52- "runtime.avrSleep" ,
53- "runtime.getFakeCoroutine" ,
54- "runtime.setTaskStatePtr" ,
55- "runtime.getTaskStatePtr" ,
56- "runtime.activateTask" ,
57- "runtime.noret" ,
58- "runtime.getParentHandle" ,
59- "runtime.getCoroutine" ,
60- "runtime.llvmCoroRefHolder" ,
49+ "internal/task.start" ,
50+ "internal/task.Pause" ,
51+ "internal/task.fake" ,
52+ "internal/task.Current" ,
53+ "internal/task.createTask" ,
54+ "(*internal/task.Task).setState" ,
55+ "(*internal/task.Task).returnTo" ,
56+ "(*internal/task.Task).returnCurrent" ,
57+ "(*internal/task.Task).setReturnPtr" ,
58+ "(*internal/task.Task).getReturnPtr" ,
6159}
6260
6361type Compiler struct {
@@ -161,6 +159,7 @@ func (c *Compiler) Module() llvm.Module {
161159func (c * Compiler ) getFunctionsUsedInTransforms () []string {
162160 fnused := functionsUsedInTransforms
163161 switch c .Scheduler () {
162+ case "none" :
164163 case "coroutines" :
165164 fnused = append (append ([]string {}, fnused ... ), coroFunctionsUsedInTransforms ... )
166165 case "tasks" :
@@ -217,7 +216,7 @@ func (c *Compiler) Compile(mainPath string) []error {
217216 path = path [len (tinygoPath + "/src/" ):]
218217 }
219218 switch path {
220- case "machine" , "os" , "reflect" , "runtime" , "runtime/interrupt" , "runtime/volatile" , "sync" , "testing" , "internal/reflectlite" :
219+ case "machine" , "os" , "reflect" , "runtime" , "runtime/interrupt" , "runtime/volatile" , "sync" , "testing" , "internal/reflectlite" , "internal/task" :
221220 return path
222221 default :
223222 if strings .HasPrefix (path , "device/" ) || strings .HasPrefix (path , "examples/" ) {
@@ -1035,7 +1034,7 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) {
10351034 funcPtr , context := c .decodeFuncValue (c .getValue (frame , instr .Call .Value ), instr .Call .Value .Type ().(* types.Signature ))
10361035 params = append (params , context ) // context parameter
10371036 switch c .Scheduler () {
1038- case "coroutines" :
1037+ case "none" , " coroutines" :
10391038 // There are no additional parameters needed for the goroutine start operation.
10401039 case "tasks" :
10411040 // Add the function pointer as a parameter to start the goroutine.
0 commit comments