From 2f248bbf8b3150cd0ef96859d234b2257fdabfa7 Mon Sep 17 00:00:00 2001 From: Kenneth Bell Date: Sun, 16 May 2021 11:05:23 -0700 Subject: [PATCH] scheduler: task.Data made 64bit to avoid overflow --- compiler/testdata/goroutine-cortex-m-qemu.ll | 2 +- compiler/testdata/goroutine-wasm.ll | 2 +- src/internal/task/task.go | 2 +- src/runtime/scheduler.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/testdata/goroutine-cortex-m-qemu.ll b/compiler/testdata/goroutine-cortex-m-qemu.ll index a00d49be6..a98592c15 100644 --- a/compiler/testdata/goroutine-cortex-m-qemu.ll +++ b/compiler/testdata/goroutine-cortex-m-qemu.ll @@ -5,7 +5,7 @@ target triple = "armv7m-none-eabi" %runtime.channel = type { i32, i32, i8, %runtime.channelBlockedList*, i32, i32, i32, i8* } %runtime.channelBlockedList = type { %runtime.channelBlockedList*, %"internal/task.Task"*, %runtime.chanSelectState*, { %runtime.channelBlockedList*, i32, i32 } } -%"internal/task.Task" = type { %"internal/task.Task"*, i8*, i32, %"internal/task.state" } +%"internal/task.Task" = type { %"internal/task.Task"*, i8*, i64, %"internal/task.state" } %"internal/task.state" = type { i32, i32* } %runtime.chanSelectState = type { %runtime.channel*, i8* } diff --git a/compiler/testdata/goroutine-wasm.ll b/compiler/testdata/goroutine-wasm.ll index 212bd714e..1d840e6da 100644 --- a/compiler/testdata/goroutine-wasm.ll +++ b/compiler/testdata/goroutine-wasm.ll @@ -6,7 +6,7 @@ target triple = "wasm32--wasi" %runtime.funcValueWithSignature = type { i32, i8* } %runtime.channel = type { i32, i32, i8, %runtime.channelBlockedList*, i32, i32, i32, i8* } %runtime.channelBlockedList = type { %runtime.channelBlockedList*, %"internal/task.Task"*, %runtime.chanSelectState*, { %runtime.channelBlockedList*, i32, i32 } } -%"internal/task.Task" = type { %"internal/task.Task"*, i8*, i32, %"internal/task.state" } +%"internal/task.Task" = type { %"internal/task.Task"*, i8*, i64, %"internal/task.state" } %"internal/task.state" = type { i8* } %runtime.chanSelectState = type { %runtime.channel*, i8* } diff --git a/src/internal/task/task.go b/src/internal/task/task.go index 489400dfc..bad501b61 100644 --- a/src/internal/task/task.go +++ b/src/internal/task/task.go @@ -13,7 +13,7 @@ type Task struct { Ptr unsafe.Pointer // Data is a field which can be used for storing state information. - Data uint + Data uint64 // state is the underlying running state of the task. state state diff --git a/src/runtime/scheduler.go b/src/runtime/scheduler.go index c5286d33b..44b07f75d 100644 --- a/src/runtime/scheduler.go +++ b/src/runtime/scheduler.go @@ -88,7 +88,7 @@ func addSleepTask(t *task.Task, duration timeUnit) { panic("runtime: addSleepTask: expected next task to be nil") } } - t.Data = uint(duration) // TODO: longer durations + t.Data = uint64(duration) now := ticks() if sleepQueue == nil { scheduleLog(" -> sleep new queue")