@@ -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 {
@@ -162,6 +160,7 @@ func (c *Compiler) Module() llvm.Module {
162160func (c * Compiler ) getFunctionsUsedInTransforms () []string {
163161 fnused := functionsUsedInTransforms
164162 switch c .Scheduler () {
163+ case "none" :
165164 case "coroutines" :
166165 fnused = append (append ([]string {}, fnused ... ), coroFunctionsUsedInTransforms ... )
167166 case "tasks" :
@@ -218,7 +217,7 @@ func (c *Compiler) Compile(mainPath string) []error {
218217 path = path [len (tinygoPath + "/src/" ):]
219218 }
220219 switch path {
221- case "machine" , "os" , "reflect" , "runtime" , "runtime/interrupt" , "runtime/volatile" , "sync" , "testing" , "internal/reflectlite" :
220+ case "machine" , "os" , "reflect" , "runtime" , "runtime/interrupt" , "runtime/volatile" , "sync" , "testing" , "internal/reflectlite" , "internal/task" :
222221 return path
223222 default :
224223 if strings .HasPrefix (path , "device/" ) || strings .HasPrefix (path , "examples/" ) {
@@ -1095,7 +1094,7 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) {
10951094 funcPtr , context := c .decodeFuncValue (c .getValue (frame , instr .Call .Value ), instr .Call .Value .Type ().(* types.Signature ))
10961095 params = append (params , context ) // context parameter
10971096 switch c .Scheduler () {
1098- case "coroutines" :
1097+ case "none" , " coroutines" :
10991098 // There are no additional parameters needed for the goroutine start operation.
11001099 case "tasks" :
11011100 // Add the function pointer as a parameter to start the goroutine.
0 commit comments