Better lowering of distinct types. Noreturn function call expr recognized as a "jump" for escape analysis. Preferring "def" in libs. To upper / to lower for ascii. Initial dynlib support.

This commit is contained in:
Christoffer Lerno
2023-05-21 21:25:33 +02:00
committed by Christoffer Lerno
parent a877d4458c
commit ddd0497922
55 changed files with 579 additions and 416 deletions

View File

@@ -1,6 +1,6 @@
module std::thread;
typedef NativeMutex = distinct int;
typedef NativeConditionVariable = distinct int;
typedef NativeOnceFlag = distinct int;
typedef NativeThread = distinct int;
def NativeMutex = distinct int;
def NativeConditionVariable = distinct int;
def NativeOnceFlag = distinct int;
def NativeThread = distinct int;

View File

@@ -7,30 +7,30 @@ const PTHREAD_MUTEX_NORMAL = 0;
const PTHREAD_MUTEX_ERRORCHECK = 1;
const PTHREAD_MUTEX_RECURSIVE = 2;
typedef NativeMutex = PthreadMutex;
typedef NativeConditionVariable = PthreadCond;
typedef NativeThread = Pthread;
typedef NativeOnceFlag = PthreadOnce;
def NativeMutex = PthreadMutex;
def NativeConditionVariable = PthreadCond;
def NativeThread = Pthread;
def NativeOnceFlag = PthreadOnce;
typedef Pthread = distinct void*;
def Pthread = distinct void*;
$if env::OS_TYPE == LINUX:
typedef PthreadMutex = distinct ulong[5];
typedef PthreadAttribute = distinct ulong[7];
typedef PthreadMutexAttribute = distinct uint;
typedef PthreadCondAttribute = distinct uint;
typedef PthreadCond = distinct ulong[6];
typedef PthreadOnce = distinct uint;
def PthreadMutex = distinct ulong[5];
def PthreadAttribute = distinct ulong[7];
def PthreadMutexAttribute = distinct uint;
def PthreadCondAttribute = distinct uint;
def PthreadCond = distinct ulong[6];
def PthreadOnce = distinct uint;
$else
typedef PthreadMutex = distinct ulong[8];
typedef PthreadMutexAttribute = distinct ulong[2];
typedef PthreadAttribute = distinct ulong[8];
typedef PthreadCond = distinct ulong[6];
typedef PthreadCondAttribute = distinct ulong[8];
typedef PthreadOnce = distinct ulong[2];
def PthreadMutex = distinct ulong[8];
def PthreadMutexAttribute = distinct ulong[2];
def PthreadAttribute = distinct ulong[8];
def PthreadCond = distinct ulong[6];
def PthreadCondAttribute = distinct ulong[8];
def PthreadOnce = distinct ulong[2];
$endif
typedef PosixThreadFn = fn void*(void*);
def PosixThreadFn = fn void*(void*);
extern fn int pthread_attr_destroy(PthreadAttribute*);
extern fn int pthread_attr_getdetachstate(PthreadAttribute*, int*);

View File

@@ -11,19 +11,19 @@ const ThreadModel THREAD_MODEL = env::COMPILER_LIBC_AVAILABLE
? (env::os_is_win32() ? ThreadModel.WIN32 : ThreadModel.POSIX)
: ThreadModel.NONE;
typedef MutexType = distinct int;
def MutexType = distinct int;
const MutexType MUTEX_PLAIN = 0;
const MutexType MUTEX_TIMED = 1;
const MutexType MUTEX_RECURSIVE = 2;
typedef Mutex = distinct NativeMutex;
typedef ConditionVariable = distinct NativeConditionVariable;
typedef Thread = distinct NativeThread;
typedef OnceFlag = distinct NativeOnceFlag;
typedef OnceFn = fn void();
def Mutex = distinct NativeMutex;
def ConditionVariable = distinct NativeConditionVariable;
def Thread = distinct NativeThread;
def OnceFlag = distinct NativeOnceFlag;
def OnceFn = fn void();
typedef ThreadFn = fn int(void* arg);
def ThreadFn = fn int(void* arg);
fault ThreadFault
{