File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 4545#include < cstddef>
4646
4747#include " types.hpp"
48- #include " ptr.hpp"
4948
5049#define __jule_AsyncRet co_return // Equivalent to `ret` in async functions.
5150#define __jule_AsyncAwait co_await // Equivalent to `await` in async functions.
@@ -80,7 +79,11 @@ class __jule_thread;
8079
8180// Each OS thread executing Jule code has a TLS pointer to its associated
8281// runtime thread object.
83- inline thread_local __jule_Ptr<__jule_thread> __jule_ct;
82+ //
83+ // Historically, this field was a smart pointer.
84+ // However, due to a toolchain bug in Windows, it's supposed to be a trivial type.
85+ // See: https://github.com/mstorsjo/llvm-mingw/issues/541
86+ inline thread_local __jule_thread *__jule_ct = nullptr ;
8487
8588// Non-templated coroutine handle used by the runtime.
8689// The runtime never needs promise-type information.
Original file line number Diff line number Diff line change 22// Use of this source code is governed by a BSD 3-Clause
33// license that can be found in the LICENSE file.
44
5- extern let mut __jule_ct: & thread
5+ extern let mut __jule_ct: * thread
66
77const (
88 // Thread roles.
@@ -41,13 +41,13 @@ struct thread {
4141// Returns the current thread.
4242// Uses the thread-local data.
4343fn gett(): &thread {
44- ret extern.__jule_ct
44+ ret unsafe { (&thread)( extern.__jule_ct) }
4545}
4646
4747// Sets the current thread as t.
4848// Writes to the thread-local data.
4949fn sett(mut t: &thread) {
50- extern.__jule_ct = t
50+ extern.__jule_ct = (*thread)(t)
5151}
5252
5353// Pointer to the main M, the main program thread.
You can’t perform that action at this time.
0 commit comments