harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 912b5ccf5164bd11074d4b76b87a66dadb553cf6
parent 8e6827e81b0d17e63c9d0ff30d0dd2e653f99842
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Wed, 10 Feb 2021 12:44:21 -0500

*.ha: update for flexible constants/type promotion

Diffstat:
Mrt/+linux/segmalloc.ha | 2+-
Mrt/+linux/syscallno+aarch64.ha | 582+++++++++++++++++++++++++++++++++++++++---------------------------------------
Mrt/+linux/syscallno+x86_64.ha | 690++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mrt/+linux/syscalls.ha | 87+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mrt/abort.ha | 2+-
Mrt/compile.ha | 2+-
Mrt/ensure.ha | 4++--
Mrt/malloc.ha | 39++++++++++++++++++---------------------
Mrt/memcpy.ha | 2+-
Mrt/memset.ha | 2+-
Mrt/rtmain.ha | 4++--
Mrt/strcmp.ha | 2+-
Mtests/00-constants.ha | 1-
Mtests/01-arrays.ha | 40++++++++++++++++++++--------------------
Mtests/02-integers.ha | 46+++++++++++++++++++++++-----------------------
Mtests/03-pointers.ha | 2+-
Mtests/04-strings.ha | 24++++++++++++------------
Mtests/05-implicit-casts.ha | 4++--
Mtests/06-structs.ha | 28++++++++++++++--------------
Mtests/07-aliases.ha | 3+--
Mtests/08-slices.ha | 16++++++++--------
Mtests/09-funcs.ha | 2+-
Mtests/11-globals.ha | 6+++---
Mtests/13-tagged.ha | 32++++++++++++++++----------------
Mtests/14-switch.ha | 2+-
Mtests/15-enums.ha | 30++++++++++++++----------------
Mtests/17-alloc.ha | 17++++++++---------
Mtests/18-match.ha | 10+++++-----
Mtests/19-append.ha | 14+++++++-------
Mtests/20-if.ha | 4++--
30 files changed, 845 insertions(+), 854 deletions(-)

diff --git a/rt/+linux/segmalloc.ha b/rt/+linux/segmalloc.ha @@ -2,7 +2,7 @@ fn segmalloc(n: size) nullable *void = { let p: *void = mmap(null, n, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON, -1, 0z); + MAP_PRIVATE | MAP_ANON, -1, 0); return if (p: uintptr: int == -ENOMEM) null else p; }; diff --git a/rt/+linux/syscallno+aarch64.ha b/rt/+linux/syscallno+aarch64.ha @@ -1,291 +1,291 @@ -export def SYS_io_setup: u64 = 0u64; -export def SYS_io_destroy: u64 = 1u64; -export def SYS_io_submit: u64 = 2u64; -export def SYS_io_cancel: u64 = 3u64; -export def SYS_io_getevents: u64 = 4u64; -export def SYS_setxattr: u64 = 5u64; -export def SYS_lsetxattr: u64 = 6u64; -export def SYS_fsetxattr: u64 = 7u64; -export def SYS_getxattr: u64 = 8u64; -export def SYS_lgetxattr: u64 = 9u64; -export def SYS_fgetxattr: u64 = 10u64; -export def SYS_listxattr: u64 = 11u64; -export def SYS_llistxattr: u64 = 12u64; -export def SYS_flistxattr: u64 = 13u64; -export def SYS_removexattr: u64 = 14u64; -export def SYS_lremovexattr: u64 = 15u64; -export def SYS_fremovexattr: u64 = 16u64; -export def SYS_getcwd: u64 = 17u64; -export def SYS_lookup_dcookie: u64 = 18u64; -export def SYS_eventfd2: u64 = 19u64; -export def SYS_epoll_create1: u64 = 20u64; -export def SYS_epoll_ctl: u64 = 21u64; -export def SYS_epoll_pwait: u64 = 22u64; -export def SYS_dup: u64 = 23u64; -export def SYS_dup3: u64 = 24u64; -export def SYS_fcntl: u64 = 25u64; -export def SYS_inotify_init1: u64 = 26u64; -export def SYS_inotify_add_watch: u64 = 27u64; -export def SYS_inotify_rm_watch: u64 = 28u64; -export def SYS_ioctl: u64 = 29u64; -export def SYS_ioprio_set: u64 = 30u64; -export def SYS_ioprio_get: u64 = 31u64; -export def SYS_flock: u64 = 32u64; -export def SYS_mknodat: u64 = 33u64; -export def SYS_mkdirat: u64 = 34u64; -export def SYS_unlinkat: u64 = 35u64; -export def SYS_symlinkat: u64 = 36u64; -export def SYS_linkat: u64 = 37u64; -export def SYS_renameat: u64 = 38u64; -export def SYS_umount2: u64 = 39u64; -export def SYS_mount: u64 = 40u64; -export def SYS_pivot_root: u64 = 41u64; -export def SYS_nfsservctl: u64 = 42u64; -export def SYS_statfs: u64 = 43u64; -export def SYS_fstatfs: u64 = 44u64; -export def SYS_truncate: u64 = 45u64; -export def SYS_ftruncate: u64 = 46u64; -export def SYS_fallocate: u64 = 47u64; -export def SYS_faccessat: u64 = 48u64; -export def SYS_chdir: u64 = 49u64; -export def SYS_fchdir: u64 = 50u64; -export def SYS_chroot: u64 = 51u64; -export def SYS_fchmod: u64 = 52u64; -export def SYS_fchmodat: u64 = 53u64; -export def SYS_fchownat: u64 = 54u64; -export def SYS_fchown: u64 = 55u64; -export def SYS_openat: u64 = 56u64; -export def SYS_close: u64 = 57u64; -export def SYS_vhangup: u64 = 58u64; -export def SYS_pipe2: u64 = 59u64; -export def SYS_quotactl: u64 = 60u64; -export def SYS_getdents64: u64 = 61u64; -export def SYS_lseek: u64 = 62u64; -export def SYS_read: u64 = 63u64; -export def SYS_write: u64 = 64u64; -export def SYS_readv: u64 = 65u64; -export def SYS_writev: u64 = 66u64; -export def SYS_pread64: u64 = 67u64; -export def SYS_pwrite64: u64 = 68u64; -export def SYS_preadv: u64 = 69u64; -export def SYS_pwritev: u64 = 70u64; -export def SYS_sendfile: u64 = 71u64; -export def SYS_pselect6: u64 = 72u64; -export def SYS_ppoll: u64 = 73u64; -export def SYS_signalfd4: u64 = 74u64; -export def SYS_vmsplice: u64 = 75u64; -export def SYS_splice: u64 = 76u64; -export def SYS_tee: u64 = 77u64; -export def SYS_readlinkat: u64 = 78u64; -export def SYS_newfstatat: u64 = 79u64; -export def SYS_fstat: u64 = 80u64; -export def SYS_sync: u64 = 81u64; -export def SYS_fsync: u64 = 82u64; -export def SYS_fdatasync: u64 = 83u64; -export def SYS_sync_file_range: u64 = 84u64; -export def SYS_timerfd_create: u64 = 85u64; -export def SYS_timerfd_settime: u64 = 86u64; -export def SYS_timerfd_gettime: u64 = 87u64; -export def SYS_utimensat: u64 = 88u64; -export def SYS_acct: u64 = 89u64; -export def SYS_capget: u64 = 90u64; -export def SYS_capset: u64 = 91u64; -export def SYS_personality: u64 = 92u64; -export def SYS_exit: u64 = 93u64; -export def SYS_exit_group: u64 = 94u64; -export def SYS_waitid: u64 = 95u64; -export def SYS_set_tid_address: u64 = 96u64; -export def SYS_unshare: u64 = 97u64; -export def SYS_futex: u64 = 98u64; -export def SYS_set_robust_list: u64 = 99u64; -export def SYS_get_robust_list: u64 = 100u64; -export def SYS_nanosleep: u64 = 101u64; -export def SYS_getitimer: u64 = 102u64; -export def SYS_setitimer: u64 = 103u64; -export def SYS_kexec_load: u64 = 104u64; -export def SYS_init_module: u64 = 105u64; -export def SYS_delete_module: u64 = 106u64; -export def SYS_timer_create: u64 = 107u64; -export def SYS_timer_gettime: u64 = 108u64; -export def SYS_timer_getoverrun: u64 = 109u64; -export def SYS_timer_settime: u64 = 110u64; -export def SYS_timer_delete: u64 = 111u64; -export def SYS_clock_settime: u64 = 112u64; -export def SYS_clock_gettime: u64 = 113u64; -export def SYS_clock_getres: u64 = 114u64; -export def SYS_clock_nanosleep: u64 = 115u64; -export def SYS_syslog: u64 = 116u64; -export def SYS_ptrace: u64 = 117u64; -export def SYS_sched_setparam: u64 = 118u64; -export def SYS_sched_setscheduler: u64 = 119u64; -export def SYS_sched_getscheduler: u64 = 120u64; -export def SYS_sched_getparam: u64 = 121u64; -export def SYS_sched_setaffinity: u64 = 122u64; -export def SYS_sched_getaffinity: u64 = 123u64; -export def SYS_sched_yield: u64 = 124u64; -export def SYS_sched_get_priority_max: u64 = 125u64; -export def SYS_sched_get_priority_min: u64 = 126u64; -export def SYS_sched_rr_get_interval: u64 = 127u64; -export def SYS_restart_syscall: u64 = 128u64; -export def SYS_kill: u64 = 129u64; -export def SYS_tkill: u64 = 130u64; -export def SYS_tgkill: u64 = 131u64; -export def SYS_sigaltstack: u64 = 132u64; -export def SYS_rt_sigsuspend: u64 = 133u64; -export def SYS_rt_sigaction: u64 = 134u64; -export def SYS_rt_sigprocmask: u64 = 135u64; -export def SYS_rt_sigpending: u64 = 136u64; -export def SYS_rt_sigtimedwait: u64 = 137u64; -export def SYS_rt_sigqueueinfo: u64 = 138u64; -export def SYS_rt_sigreturn: u64 = 139u64; -export def SYS_setpriority: u64 = 140u64; -export def SYS_getpriority: u64 = 141u64; -export def SYS_reboot: u64 = 142u64; -export def SYS_setregid: u64 = 143u64; -export def SYS_setgid: u64 = 144u64; -export def SYS_setreuid: u64 = 145u64; -export def SYS_setuid: u64 = 146u64; -export def SYS_setresuid: u64 = 147u64; -export def SYS_getresuid: u64 = 148u64; -export def SYS_setresgid: u64 = 149u64; -export def SYS_getresgid: u64 = 150u64; -export def SYS_setfsuid: u64 = 151u64; -export def SYS_setfsgid: u64 = 152u64; -export def SYS_times: u64 = 153u64; -export def SYS_setpgid: u64 = 154u64; -export def SYS_getpgid: u64 = 155u64; -export def SYS_getsid: u64 = 156u64; -export def SYS_setsid: u64 = 157u64; -export def SYS_getgroups: u64 = 158u64; -export def SYS_setgroups: u64 = 159u64; -export def SYS_uname: u64 = 160u64; -export def SYS_sethostname: u64 = 161u64; -export def SYS_setdomainname: u64 = 162u64; -export def SYS_getrlimit: u64 = 163u64; -export def SYS_setrlimit: u64 = 164u64; -export def SYS_getrusage: u64 = 165u64; -export def SYS_umask: u64 = 166u64; -export def SYS_prctl: u64 = 167u64; -export def SYS_getcpu: u64 = 168u64; -export def SYS_gettimeofday: u64 = 169u64; -export def SYS_settimeofday: u64 = 170u64; -export def SYS_adjtimex: u64 = 171u64; -export def SYS_getpid: u64 = 172u64; -export def SYS_getppid: u64 = 173u64; -export def SYS_getuid: u64 = 174u64; -export def SYS_geteuid: u64 = 175u64; -export def SYS_getgid: u64 = 176u64; -export def SYS_getegid: u64 = 177u64; -export def SYS_gettid: u64 = 178u64; -export def SYS_sysinfo: u64 = 179u64; -export def SYS_mq_open: u64 = 180u64; -export def SYS_mq_unlink: u64 = 181u64; -export def SYS_mq_timedsend: u64 = 182u64; -export def SYS_mq_timedreceive: u64 = 183u64; -export def SYS_mq_notify: u64 = 184u64; -export def SYS_mq_getsetattr: u64 = 185u64; -export def SYS_msgget: u64 = 186u64; -export def SYS_msgctl: u64 = 187u64; -export def SYS_msgrcv: u64 = 188u64; -export def SYS_msgsnd: u64 = 189u64; -export def SYS_semget: u64 = 190u64; -export def SYS_semctl: u64 = 191u64; -export def SYS_semtimedop: u64 = 192u64; -export def SYS_semop: u64 = 193u64; -export def SYS_shmget: u64 = 194u64; -export def SYS_shmctl: u64 = 195u64; -export def SYS_shmat: u64 = 196u64; -export def SYS_shmdt: u64 = 197u64; -export def SYS_socket: u64 = 198u64; -export def SYS_socketpair: u64 = 199u64; -export def SYS_bind: u64 = 200u64; -export def SYS_listen: u64 = 201u64; -export def SYS_accept: u64 = 202u64; -export def SYS_connect: u64 = 203u64; -export def SYS_getsockname: u64 = 204u64; -export def SYS_getpeername: u64 = 205u64; -export def SYS_sendto: u64 = 206u64; -export def SYS_recvfrom: u64 = 207u64; -export def SYS_setsockopt: u64 = 208u64; -export def SYS_getsockopt: u64 = 209u64; -export def SYS_shutdown: u64 = 210u64; -export def SYS_sendmsg: u64 = 211u64; -export def SYS_recvmsg: u64 = 212u64; -export def SYS_readahead: u64 = 213u64; -export def SYS_brk: u64 = 214u64; -export def SYS_munmap: u64 = 215u64; -export def SYS_mremap: u64 = 216u64; -export def SYS_add_key: u64 = 217u64; -export def SYS_request_key: u64 = 218u64; -export def SYS_keyctl: u64 = 219u64; -export def SYS_clone: u64 = 220u64; -export def SYS_execve: u64 = 221u64; -export def SYS_mmap: u64 = 222u64; -export def SYS_fadvise64: u64 = 223u64; -export def SYS_swapon: u64 = 224u64; -export def SYS_swapoff: u64 = 225u64; -export def SYS_mprotect: u64 = 226u64; -export def SYS_msync: u64 = 227u64; -export def SYS_mlock: u64 = 228u64; -export def SYS_munlock: u64 = 229u64; -export def SYS_mlockall: u64 = 230u64; -export def SYS_munlockall: u64 = 231u64; -export def SYS_mincore: u64 = 232u64; -export def SYS_madvise: u64 = 233u64; -export def SYS_remap_file_pages: u64 = 234u64; -export def SYS_mbind: u64 = 235u64; -export def SYS_get_mempolicy: u64 = 236u64; -export def SYS_set_mempolicy: u64 = 237u64; -export def SYS_migrate_pages: u64 = 238u64; -export def SYS_move_pages: u64 = 239u64; -export def SYS_rt_tgsigqueueinfo: u64 = 240u64; -export def SYS_perf_event_open: u64 = 241u64; -export def SYS_accept4: u64 = 242u64; -export def SYS_recvmmsg: u64 = 243u64; -export def SYS_wait4: u64 = 260u64; -export def SYS_prlimit64: u64 = 261u64; -export def SYS_fanotify_init: u64 = 262u64; -export def SYS_fanotify_mark: u64 = 263u64; -export def SYS_name_to_handle_at: u64 = 264u64; -export def SYS_open_by_handle_at: u64 = 265u64; -export def SYS_clock_adjtime: u64 = 266u64; -export def SYS_syncfs: u64 = 267u64; -export def SYS_setns: u64 = 268u64; -export def SYS_sendmmsg: u64 = 269u64; -export def SYS_process_vm_readv: u64 = 270u64; -export def SYS_process_vm_writev: u64 = 271u64; -export def SYS_kcmp: u64 = 272u64; -export def SYS_finit_module: u64 = 273u64; -export def SYS_sched_setattr: u64 = 274u64; -export def SYS_sched_getattr: u64 = 275u64; -export def SYS_renameat2: u64 = 276u64; -export def SYS_seccomp: u64 = 277u64; -export def SYS_getrandom: u64 = 278u64; -export def SYS_memfd_create: u64 = 279u64; -export def SYS_bpf: u64 = 280u64; -export def SYS_execveat: u64 = 281u64; -export def SYS_userfaultfd: u64 = 282u64; -export def SYS_membarrier: u64 = 283u64; -export def SYS_mlock2: u64 = 284u64; -export def SYS_copy_file_range: u64 = 285u64; -export def SYS_preadv2: u64 = 286u64; -export def SYS_pwritev2: u64 = 287u64; -export def SYS_pkey_mprotect: u64 = 288u64; -export def SYS_pkey_alloc: u64 = 289u64; -export def SYS_pkey_free: u64 = 290u64; -export def SYS_statx: u64 = 291u64; -export def SYS_io_pgetevents: u64 = 292u64; -export def SYS_rseq: u64 = 293u64; -export def SYS_kexec_file_load: u64 = 294u64; -export def SYS_pidfd_send_signal: u64 = 424u64; -export def SYS_io_uring_setup: u64 = 425u64; -export def SYS_io_uring_enter: u64 = 426u64; -export def SYS_io_uring_register: u64 = 427u64; -export def SYS_open_tree: u64 = 428u64; -export def SYS_move_mount: u64 = 429u64; -export def SYS_fsopen: u64 = 430u64; -export def SYS_fsconfig: u64 = 431u64; -export def SYS_fsmount: u64 = 432u64; -export def SYS_fspick: u64 = 433u64; -export def SYS_pidfd_open: u64 = 434u64; -export def SYS_clone3: u64 = 435u64; +export def SYS_io_setup: u64 = 0; +export def SYS_io_destroy: u64 = 1; +export def SYS_io_submit: u64 = 2; +export def SYS_io_cancel: u64 = 3; +export def SYS_io_getevents: u64 = 4; +export def SYS_setxattr: u64 = 5; +export def SYS_lsetxattr: u64 = 6; +export def SYS_fsetxattr: u64 = 7; +export def SYS_getxattr: u64 = 8; +export def SYS_lgetxattr: u64 = 9; +export def SYS_fgetxattr: u64 = 10; +export def SYS_listxattr: u64 = 11; +export def SYS_llistxattr: u64 = 12; +export def SYS_flistxattr: u64 = 13; +export def SYS_removexattr: u64 = 14; +export def SYS_lremovexattr: u64 = 15; +export def SYS_fremovexattr: u64 = 16; +export def SYS_getcwd: u64 = 17; +export def SYS_lookup_dcookie: u64 = 18; +export def SYS_eventfd2: u64 = 19; +export def SYS_epoll_create1: u64 = 20; +export def SYS_epoll_ctl: u64 = 21; +export def SYS_epoll_pwait: u64 = 22; +export def SYS_dup: u64 = 23; +export def SYS_dup3: u64 = 24; +export def SYS_fcntl: u64 = 25; +export def SYS_inotify_init1: u64 = 26; +export def SYS_inotify_add_watch: u64 = 27; +export def SYS_inotify_rm_watch: u64 = 28; +export def SYS_ioctl: u64 = 29; +export def SYS_ioprio_set: u64 = 30; +export def SYS_ioprio_get: u64 = 31; +export def SYS_flock: u64 = 32; +export def SYS_mknodat: u64 = 33; +export def SYS_mkdirat: u64 = 34; +export def SYS_unlinkat: u64 = 35; +export def SYS_symlinkat: u64 = 36; +export def SYS_linkat: u64 = 37; +export def SYS_renameat: u64 = 38; +export def SYS_umount2: u64 = 39; +export def SYS_mount: u64 = 40; +export def SYS_pivot_root: u64 = 41; +export def SYS_nfsservctl: u64 = 42; +export def SYS_statfs: u64 = 43; +export def SYS_fstatfs: u64 = 44; +export def SYS_truncate: u64 = 45; +export def SYS_ftruncate: u64 = 46; +export def SYS_fallocate: u64 = 47; +export def SYS_faccessat: u64 = 48; +export def SYS_chdir: u64 = 49; +export def SYS_fchdir: u64 = 50; +export def SYS_chroot: u64 = 51; +export def SYS_fchmod: u64 = 52; +export def SYS_fchmodat: u64 = 53; +export def SYS_fchownat: u64 = 54; +export def SYS_fchown: u64 = 55; +export def SYS_openat: u64 = 56; +export def SYS_close: u64 = 57; +export def SYS_vhangup: u64 = 58; +export def SYS_pipe2: u64 = 59; +export def SYS_quotactl: u64 = 60; +export def SYS_getdents64: u64 = 61; +export def SYS_lseek: u64 = 62; +export def SYS_read: u64 = 63; +export def SYS_write: u64 = 64; +export def SYS_readv: u64 = 65; +export def SYS_writev: u64 = 66; +export def SYS_pread64: u64 = 67; +export def SYS_pwrite64: u64 = 68; +export def SYS_preadv: u64 = 69; +export def SYS_pwritev: u64 = 70; +export def SYS_sendfile: u64 = 71; +export def SYS_pselect6: u64 = 72; +export def SYS_ppoll: u64 = 73; +export def SYS_signalfd4: u64 = 74; +export def SYS_vmsplice: u64 = 75; +export def SYS_splice: u64 = 76; +export def SYS_tee: u64 = 77; +export def SYS_readlinkat: u64 = 78; +export def SYS_newfstatat: u64 = 79; +export def SYS_fstat: u64 = 80; +export def SYS_sync: u64 = 81; +export def SYS_fsync: u64 = 82; +export def SYS_fdatasync: u64 = 83; +export def SYS_sync_file_range: u64 = 84; +export def SYS_timerfd_create: u64 = 85; +export def SYS_timerfd_settime: u64 = 86; +export def SYS_timerfd_gettime: u64 = 87; +export def SYS_utimensat: u64 = 88; +export def SYS_acct: u64 = 89; +export def SYS_capget: u64 = 90; +export def SYS_capset: u64 = 91; +export def SYS_personality: u64 = 92; +export def SYS_exit: u64 = 93; +export def SYS_exit_group: u64 = 94; +export def SYS_waitid: u64 = 95; +export def SYS_set_tid_address: u64 = 96; +export def SYS_unshare: u64 = 97; +export def SYS_futex: u64 = 98; +export def SYS_set_robust_list: u64 = 99; +export def SYS_get_robust_list: u64 = 100; +export def SYS_nanosleep: u64 = 101; +export def SYS_getitimer: u64 = 102; +export def SYS_setitimer: u64 = 103; +export def SYS_kexec_load: u64 = 104; +export def SYS_init_module: u64 = 105; +export def SYS_delete_module: u64 = 106; +export def SYS_timer_create: u64 = 107; +export def SYS_timer_gettime: u64 = 108; +export def SYS_timer_getoverrun: u64 = 109; +export def SYS_timer_settime: u64 = 110; +export def SYS_timer_delete: u64 = 111; +export def SYS_clock_settime: u64 = 112; +export def SYS_clock_gettime: u64 = 113; +export def SYS_clock_getres: u64 = 114; +export def SYS_clock_nanosleep: u64 = 115; +export def SYS_syslog: u64 = 116; +export def SYS_ptrace: u64 = 117; +export def SYS_sched_setparam: u64 = 118; +export def SYS_sched_setscheduler: u64 = 119; +export def SYS_sched_getscheduler: u64 = 120; +export def SYS_sched_getparam: u64 = 121; +export def SYS_sched_setaffinity: u64 = 122; +export def SYS_sched_getaffinity: u64 = 123; +export def SYS_sched_yield: u64 = 124; +export def SYS_sched_get_priority_max: u64 = 125; +export def SYS_sched_get_priority_min: u64 = 126; +export def SYS_sched_rr_get_interval: u64 = 127; +export def SYS_restart_syscall: u64 = 128; +export def SYS_kill: u64 = 129; +export def SYS_tkill: u64 = 130; +export def SYS_tgkill: u64 = 131; +export def SYS_sigaltstack: u64 = 132; +export def SYS_rt_sigsuspend: u64 = 133; +export def SYS_rt_sigaction: u64 = 134; +export def SYS_rt_sigprocmask: u64 = 135; +export def SYS_rt_sigpending: u64 = 136; +export def SYS_rt_sigtimedwait: u64 = 137; +export def SYS_rt_sigqueueinfo: u64 = 138; +export def SYS_rt_sigreturn: u64 = 139; +export def SYS_setpriority: u64 = 140; +export def SYS_getpriority: u64 = 141; +export def SYS_reboot: u64 = 142; +export def SYS_setregid: u64 = 143; +export def SYS_setgid: u64 = 144; +export def SYS_setreuid: u64 = 145; +export def SYS_setuid: u64 = 146; +export def SYS_setresuid: u64 = 147; +export def SYS_getresuid: u64 = 148; +export def SYS_setresgid: u64 = 149; +export def SYS_getresgid: u64 = 150; +export def SYS_setfsuid: u64 = 151; +export def SYS_setfsgid: u64 = 152; +export def SYS_times: u64 = 153; +export def SYS_setpgid: u64 = 154; +export def SYS_getpgid: u64 = 155; +export def SYS_getsid: u64 = 156; +export def SYS_setsid: u64 = 157; +export def SYS_getgroups: u64 = 158; +export def SYS_setgroups: u64 = 159; +export def SYS_uname: u64 = 160; +export def SYS_sethostname: u64 = 161; +export def SYS_setdomainname: u64 = 162; +export def SYS_getrlimit: u64 = 163; +export def SYS_setrlimit: u64 = 164; +export def SYS_getrusage: u64 = 165; +export def SYS_umask: u64 = 166; +export def SYS_prctl: u64 = 167; +export def SYS_getcpu: u64 = 168; +export def SYS_gettimeofday: u64 = 169; +export def SYS_settimeofday: u64 = 170; +export def SYS_adjtimex: u64 = 171; +export def SYS_getpid: u64 = 172; +export def SYS_getppid: u64 = 173; +export def SYS_getuid: u64 = 174; +export def SYS_geteuid: u64 = 175; +export def SYS_getgid: u64 = 176; +export def SYS_getegid: u64 = 177; +export def SYS_gettid: u64 = 178; +export def SYS_sysinfo: u64 = 179; +export def SYS_mq_open: u64 = 180; +export def SYS_mq_unlink: u64 = 181; +export def SYS_mq_timedsend: u64 = 182; +export def SYS_mq_timedreceive: u64 = 183; +export def SYS_mq_notify: u64 = 184; +export def SYS_mq_getsetattr: u64 = 185; +export def SYS_msgget: u64 = 186; +export def SYS_msgctl: u64 = 187; +export def SYS_msgrcv: u64 = 188; +export def SYS_msgsnd: u64 = 189; +export def SYS_semget: u64 = 190; +export def SYS_semctl: u64 = 191; +export def SYS_semtimedop: u64 = 192; +export def SYS_semop: u64 = 193; +export def SYS_shmget: u64 = 194; +export def SYS_shmctl: u64 = 195; +export def SYS_shmat: u64 = 196; +export def SYS_shmdt: u64 = 197; +export def SYS_socket: u64 = 198; +export def SYS_socketpair: u64 = 199; +export def SYS_bind: u64 = 200; +export def SYS_listen: u64 = 201; +export def SYS_accept: u64 = 202; +export def SYS_connect: u64 = 203; +export def SYS_getsockname: u64 = 204; +export def SYS_getpeername: u64 = 205; +export def SYS_sendto: u64 = 206; +export def SYS_recvfrom: u64 = 207; +export def SYS_setsockopt: u64 = 208; +export def SYS_getsockopt: u64 = 209; +export def SYS_shutdown: u64 = 210; +export def SYS_sendmsg: u64 = 211; +export def SYS_recvmsg: u64 = 212; +export def SYS_readahead: u64 = 213; +export def SYS_brk: u64 = 214; +export def SYS_munmap: u64 = 215; +export def SYS_mremap: u64 = 216; +export def SYS_add_key: u64 = 217; +export def SYS_request_key: u64 = 218; +export def SYS_keyctl: u64 = 219; +export def SYS_clone: u64 = 220; +export def SYS_execve: u64 = 221; +export def SYS_mmap: u64 = 222; +export def SYS_fadvise64: u64 = 223; +export def SYS_swapon: u64 = 224; +export def SYS_swapoff: u64 = 225; +export def SYS_mprotect: u64 = 226; +export def SYS_msync: u64 = 227; +export def SYS_mlock: u64 = 228; +export def SYS_munlock: u64 = 229; +export def SYS_mlockall: u64 = 230; +export def SYS_munlockall: u64 = 231; +export def SYS_mincore: u64 = 232; +export def SYS_madvise: u64 = 233; +export def SYS_remap_file_pages: u64 = 234; +export def SYS_mbind: u64 = 235; +export def SYS_get_mempolicy: u64 = 236; +export def SYS_set_mempolicy: u64 = 237; +export def SYS_migrate_pages: u64 = 238; +export def SYS_move_pages: u64 = 239; +export def SYS_rt_tgsigqueueinfo: u64 = 240; +export def SYS_perf_event_open: u64 = 241; +export def SYS_accept4: u64 = 242; +export def SYS_recvmmsg: u64 = 243; +export def SYS_wait4: u64 = 260; +export def SYS_prlimit64: u64 = 261; +export def SYS_fanotify_init: u64 = 262; +export def SYS_fanotify_mark: u64 = 263; +export def SYS_name_to_handle_at: u64 = 264; +export def SYS_open_by_handle_at: u64 = 265; +export def SYS_clock_adjtime: u64 = 266; +export def SYS_syncfs: u64 = 267; +export def SYS_setns: u64 = 268; +export def SYS_sendmmsg: u64 = 269; +export def SYS_process_vm_readv: u64 = 270; +export def SYS_process_vm_writev: u64 = 271; +export def SYS_kcmp: u64 = 272; +export def SYS_finit_module: u64 = 273; +export def SYS_sched_setattr: u64 = 274; +export def SYS_sched_getattr: u64 = 275; +export def SYS_renameat2: u64 = 276; +export def SYS_seccomp: u64 = 277; +export def SYS_getrandom: u64 = 278; +export def SYS_memfd_create: u64 = 279; +export def SYS_bpf: u64 = 280; +export def SYS_execveat: u64 = 281; +export def SYS_userfaultfd: u64 = 282; +export def SYS_membarrier: u64 = 283; +export def SYS_mlock2: u64 = 284; +export def SYS_copy_file_range: u64 = 285; +export def SYS_preadv2: u64 = 286; +export def SYS_pwritev2: u64 = 287; +export def SYS_pkey_mprotect: u64 = 288; +export def SYS_pkey_alloc: u64 = 289; +export def SYS_pkey_free: u64 = 290; +export def SYS_statx: u64 = 291; +export def SYS_io_pgetevents: u64 = 292; +export def SYS_rseq: u64 = 293; +export def SYS_kexec_file_load: u64 = 294; +export def SYS_pidfd_send_signal: u64 = 424; +export def SYS_io_uring_setup: u64 = 425; +export def SYS_io_uring_enter: u64 = 426; +export def SYS_io_uring_register: u64 = 427; +export def SYS_open_tree: u64 = 428; +export def SYS_move_mount: u64 = 429; +export def SYS_fsopen: u64 = 430; +export def SYS_fsconfig: u64 = 431; +export def SYS_fsmount: u64 = 432; +export def SYS_fspick: u64 = 433; +export def SYS_pidfd_open: u64 = 434; +export def SYS_clone3: u64 = 435; diff --git a/rt/+linux/syscallno+x86_64.ha b/rt/+linux/syscallno+x86_64.ha @@ -1,345 +1,345 @@ -export def SYS_read: u64 = 0u64; -export def SYS_write: u64 = 1u64; -export def SYS_open: u64 = 2u64; -export def SYS_close: u64 = 3u64; -export def SYS_stat: u64 = 4u64; -export def SYS_fstat: u64 = 5u64; -export def SYS_lstat: u64 = 6u64; -export def SYS_poll: u64 = 7u64; -export def SYS_lseek: u64 = 8u64; -export def SYS_mmap: u64 = 9u64; -export def SYS_mprotect: u64 = 10u64; -export def SYS_munmap: u64 = 11u64; -export def SYS_brk: u64 = 12u64; -export def SYS_rt_sigaction: u64 = 13u64; -export def SYS_rt_sigprocmask: u64 = 14u64; -export def SYS_rt_sigreturn: u64 = 15u64; -export def SYS_ioctl: u64 = 16u64; -export def SYS_pread64: u64 = 17u64; -export def SYS_pwrite64: u64 = 18u64; -export def SYS_readv: u64 = 19u64; -export def SYS_writev: u64 = 20u64; -export def SYS_access: u64 = 21u64; -export def SYS_pipe: u64 = 22u64; -export def SYS_select: u64 = 23u64; -export def SYS_sched_yield: u64 = 24u64; -export def SYS_mremap: u64 = 25u64; -export def SYS_msync: u64 = 26u64; -export def SYS_mincore: u64 = 27u64; -export def SYS_madvise: u64 = 28u64; -export def SYS_shmget: u64 = 29u64; -export def SYS_shmat: u64 = 30u64; -export def SYS_shmctl: u64 = 31u64; -export def SYS_dup: u64 = 32u64; -export def SYS_dup2: u64 = 33u64; -export def SYS_pause: u64 = 34u64; -export def SYS_nanosleep: u64 = 35u64; -export def SYS_getitimer: u64 = 36u64; -export def SYS_alarm: u64 = 37u64; -export def SYS_setitimer: u64 = 38u64; -export def SYS_getpid: u64 = 39u64; -export def SYS_sendfile: u64 = 40u64; -export def SYS_socket: u64 = 41u64; -export def SYS_connect: u64 = 42u64; -export def SYS_accept: u64 = 43u64; -export def SYS_sendto: u64 = 44u64; -export def SYS_recvfrom: u64 = 45u64; -export def SYS_sendmsg: u64 = 46u64; -export def SYS_recvmsg: u64 = 47u64; -export def SYS_shutdown: u64 = 48u64; -export def SYS_bind: u64 = 49u64; -export def SYS_listen: u64 = 50u64; -export def SYS_getsockname: u64 = 51u64; -export def SYS_getpeername: u64 = 52u64; -export def SYS_socketpair: u64 = 53u64; -export def SYS_setsockopt: u64 = 54u64; -export def SYS_getsockopt: u64 = 55u64; -export def SYS_clone: u64 = 56u64; -export def SYS_fork: u64 = 57u64; -export def SYS_vfork: u64 = 58u64; -export def SYS_execve: u64 = 59u64; -export def SYS_exit: u64 = 60u64; -export def SYS_wait4: u64 = 61u64; -export def SYS_kill: u64 = 62u64; -export def SYS_uname: u64 = 63u64; -export def SYS_semget: u64 = 64u64; -export def SYS_semop: u64 = 65u64; -export def SYS_semctl: u64 = 66u64; -export def SYS_shmdt: u64 = 67u64; -export def SYS_msgget: u64 = 68u64; -export def SYS_msgsnd: u64 = 69u64; -export def SYS_msgrcv: u64 = 70u64; -export def SYS_msgctl: u64 = 71u64; -export def SYS_fcntl: u64 = 72u64; -export def SYS_flock: u64 = 73u64; -export def SYS_fsync: u64 = 74u64; -export def SYS_fdatasync: u64 = 75u64; -export def SYS_truncate: u64 = 76u64; -export def SYS_ftruncate: u64 = 77u64; -export def SYS_getdents: u64 = 78u64; -export def SYS_getcwd: u64 = 79u64; -export def SYS_chdir: u64 = 80u64; -export def SYS_fchdir: u64 = 81u64; -export def SYS_rename: u64 = 82u64; -export def SYS_mkdir: u64 = 83u64; -export def SYS_rmdir: u64 = 84u64; -export def SYS_creat: u64 = 85u64; -export def SYS_link: u64 = 86u64; -export def SYS_unlink: u64 = 87u64; -export def SYS_symlink: u64 = 88u64; -export def SYS_readlink: u64 = 89u64; -export def SYS_chmod: u64 = 90u64; -export def SYS_fchmod: u64 = 91u64; -export def SYS_chown: u64 = 92u64; -export def SYS_fchown: u64 = 93u64; -export def SYS_lchown: u64 = 94u64; -export def SYS_umask: u64 = 95u64; -export def SYS_gettimeofday: u64 = 96u64; -export def SYS_getrlimit: u64 = 97u64; -export def SYS_getrusage: u64 = 98u64; -export def SYS_sysinfo: u64 = 99u64; -export def SYS_times: u64 = 100u64; -export def SYS_ptrace: u64 = 101u64; -export def SYS_getuid: u64 = 102u64; -export def SYS_syslog: u64 = 103u64; -export def SYS_getgid: u64 = 104u64; -export def SYS_setuid: u64 = 105u64; -export def SYS_setgid: u64 = 106u64; -export def SYS_geteuid: u64 = 107u64; -export def SYS_getegid: u64 = 108u64; -export def SYS_setpgid: u64 = 109u64; -export def SYS_getppid: u64 = 110u64; -export def SYS_getpgrp: u64 = 111u64; -export def SYS_setsid: u64 = 112u64; -export def SYS_setreuid: u64 = 113u64; -export def SYS_setregid: u64 = 114u64; -export def SYS_getgroups: u64 = 115u64; -export def SYS_setgroups: u64 = 116u64; -export def SYS_setresuid: u64 = 117u64; -export def SYS_getresuid: u64 = 118u64; -export def SYS_setresgid: u64 = 119u64; -export def SYS_getresgid: u64 = 120u64; -export def SYS_getpgid: u64 = 121u64; -export def SYS_setfsuid: u64 = 122u64; -export def SYS_setfsgid: u64 = 123u64; -export def SYS_getsid: u64 = 124u64; -export def SYS_capget: u64 = 125u64; -export def SYS_capset: u64 = 126u64; -export def SYS_rt_sigpending: u64 = 127u64; -export def SYS_rt_sigtimedwait: u64 = 128u64; -export def SYS_rt_sigqueueinfo: u64 = 129u64; -export def SYS_rt_sigsuspend: u64 = 130u64; -export def SYS_sigaltstack: u64 = 131u64; -export def SYS_utime: u64 = 132u64; -export def SYS_mknod: u64 = 133u64; -export def SYS_uselib: u64 = 134u64; -export def SYS_personality: u64 = 135u64; -export def SYS_ustat: u64 = 136u64; -export def SYS_statfs: u64 = 137u64; -export def SYS_fstatfs: u64 = 138u64; -export def SYS_sysfs: u64 = 139u64; -export def SYS_getpriority: u64 = 140u64; -export def SYS_setpriority: u64 = 141u64; -export def SYS_sched_setparam: u64 = 142u64; -export def SYS_sched_getparam: u64 = 143u64; -export def SYS_sched_setscheduler: u64 = 144u64; -export def SYS_sched_getscheduler: u64 = 145u64; -export def SYS_sched_get_priority_max: u64 = 146u64; -export def SYS_sched_get_priority_min: u64 = 147u64; -export def SYS_sched_rr_get_interval: u64 = 148u64; -export def SYS_mlock: u64 = 149u64; -export def SYS_munlock: u64 = 150u64; -export def SYS_mlockall: u64 = 151u64; -export def SYS_munlockall: u64 = 152u64; -export def SYS_vhangup: u64 = 153u64; -export def SYS_modify_ldt: u64 = 154u64; -export def SYS_pivot_root: u64 = 155u64; -export def SYS__sysctl: u64 = 156u64; -export def SYS_prctl: u64 = 157u64; -export def SYS_arch_prctl: u64 = 158u64; -export def SYS_adjtimex: u64 = 159u64; -export def SYS_setrlimit: u64 = 160u64; -export def SYS_chroot: u64 = 161u64; -export def SYS_sync: u64 = 162u64; -export def SYS_acct: u64 = 163u64; -export def SYS_settimeofday: u64 = 164u64; -export def SYS_mount: u64 = 165u64; -export def SYS_umount2: u64 = 166u64; -export def SYS_swapon: u64 = 167u64; -export def SYS_swapoff: u64 = 168u64; -export def SYS_reboot: u64 = 169u64; -export def SYS_sethostname: u64 = 170u64; -export def SYS_setdomainname: u64 = 171u64; -export def SYS_iopl: u64 = 172u64; -export def SYS_ioperm: u64 = 173u64; -export def SYS_create_module: u64 = 174u64; -export def SYS_init_module: u64 = 175u64; -export def SYS_delete_module: u64 = 176u64; -export def SYS_get_kernel_syms: u64 = 177u64; -export def SYS_query_module: u64 = 178u64; -export def SYS_quotactl: u64 = 179u64; -export def SYS_nfsservctl: u64 = 180u64; -export def SYS_getpmsg: u64 = 181u64; -export def SYS_putpmsg: u64 = 182u64; -export def SYS_afs_syscall: u64 = 183u64; -export def SYS_tuxcall: u64 = 184u64; -export def SYS_security: u64 = 185u64; -export def SYS_gettid: u64 = 186u64; -export def SYS_readahead: u64 = 187u64; -export def SYS_setxattr: u64 = 188u64; -export def SYS_lsetxattr: u64 = 189u64; -export def SYS_fsetxattr: u64 = 190u64; -export def SYS_getxattr: u64 = 191u64; -export def SYS_lgetxattr: u64 = 192u64; -export def SYS_fgetxattr: u64 = 193u64; -export def SYS_listxattr: u64 = 194u64; -export def SYS_llistxattr: u64 = 195u64; -export def SYS_flistxattr: u64 = 196u64; -export def SYS_removexattr: u64 = 197u64; -export def SYS_lremovexattr: u64 = 198u64; -export def SYS_fremovexattr: u64 = 199u64; -export def SYS_tkill: u64 = 200u64; -export def SYS_time: u64 = 201u64; -export def SYS_futex: u64 = 202u64; -export def SYS_sched_setaffinity: u64 = 203u64; -export def SYS_sched_getaffinity: u64 = 204u64; -export def SYS_set_thread_area: u64 = 205u64; -export def SYS_io_setup: u64 = 206u64; -export def SYS_io_destroy: u64 = 207u64; -export def SYS_io_getevents: u64 = 208u64; -export def SYS_io_submit: u64 = 209u64; -export def SYS_io_cancel: u64 = 210u64; -export def SYS_get_thread_area: u64 = 211u64; -export def SYS_lookup_dcookie: u64 = 212u64; -export def SYS_epoll_create: u64 = 213u64; -export def SYS_epoll_ctl_old: u64 = 214u64; -export def SYS_epoll_wait_old: u64 = 215u64; -export def SYS_remap_file_pages: u64 = 216u64; -export def SYS_getdents64: u64 = 217u64; -export def SYS_set_tid_address: u64 = 218u64; -export def SYS_restart_syscall: u64 = 219u64; -export def SYS_semtimedop: u64 = 220u64; -export def SYS_fadvise64: u64 = 221u64; -export def SYS_timer_create: u64 = 222u64; -export def SYS_timer_settime: u64 = 223u64; -export def SYS_timer_gettime: u64 = 224u64; -export def SYS_timer_getoverrun: u64 = 225u64; -export def SYS_timer_delete: u64 = 226u64; -export def SYS_clock_settime: u64 = 227u64; -export def SYS_clock_gettime: u64 = 228u64; -export def SYS_clock_getres: u64 = 229u64; -export def SYS_clock_nanosleep: u64 = 230u64; -export def SYS_exit_group: u64 = 231u64; -export def SYS_epoll_wait: u64 = 232u64; -export def SYS_epoll_ctl: u64 = 233u64; -export def SYS_tgkill: u64 = 234u64; -export def SYS_utimes: u64 = 235u64; -export def SYS_vserver: u64 = 236u64; -export def SYS_mbind: u64 = 237u64; -export def SYS_set_mempolicy: u64 = 238u64; -export def SYS_get_mempolicy: u64 = 239u64; -export def SYS_mq_open: u64 = 240u64; -export def SYS_mq_unlink: u64 = 241u64; -export def SYS_mq_timedsend: u64 = 242u64; -export def SYS_mq_timedreceive: u64 = 243u64; -export def SYS_mq_notify: u64 = 244u64; -export def SYS_mq_getsetattr: u64 = 245u64; -export def SYS_kexec_load: u64 = 246u64; -export def SYS_waitid: u64 = 247u64; -export def SYS_add_key: u64 = 248u64; -export def SYS_request_key: u64 = 249u64; -export def SYS_keyctl: u64 = 250u64; -export def SYS_ioprio_set: u64 = 251u64; -export def SYS_ioprio_get: u64 = 252u64; -export def SYS_inotify_init: u64 = 253u64; -export def SYS_inotify_add_watch: u64 = 254u64; -export def SYS_inotify_rm_watch: u64 = 255u64; -export def SYS_migrate_pages: u64 = 256u64; -export def SYS_openat: u64 = 257u64; -export def SYS_mkdirat: u64 = 258u64; -export def SYS_mknodat: u64 = 259u64; -export def SYS_fchownat: u64 = 260u64; -export def SYS_futimesat: u64 = 261u64; -export def SYS_newfstatat: u64 = 262u64; -export def SYS_unlinkat: u64 = 263u64; -export def SYS_renameat: u64 = 264u64; -export def SYS_linkat: u64 = 265u64; -export def SYS_symlinkat: u64 = 266u64; -export def SYS_readlinkat: u64 = 267u64; -export def SYS_fchmodat: u64 = 268u64; -export def SYS_faccessat: u64 = 269u64; -export def SYS_pselect6: u64 = 270u64; -export def SYS_ppoll: u64 = 271u64; -export def SYS_unshare: u64 = 272u64; -export def SYS_set_robust_list: u64 = 273u64; -export def SYS_get_robust_list: u64 = 274u64; -export def SYS_splice: u64 = 275u64; -export def SYS_tee: u64 = 276u64; -export def SYS_sync_file_range: u64 = 277u64; -export def SYS_vmsplice: u64 = 278u64; -export def SYS_move_pages: u64 = 279u64; -export def SYS_utimensat: u64 = 280u64; -export def SYS_epoll_pwait: u64 = 281u64; -export def SYS_signalfd: u64 = 282u64; -export def SYS_timerfd_create: u64 = 283u64; -export def SYS_eventfd: u64 = 284u64; -export def SYS_fallocate: u64 = 285u64; -export def SYS_timerfd_settime: u64 = 286u64; -export def SYS_timerfd_gettime: u64 = 287u64; -export def SYS_accept4: u64 = 288u64; -export def SYS_signalfd4: u64 = 289u64; -export def SYS_eventfd2: u64 = 290u64; -export def SYS_epoll_create1: u64 = 291u64; -export def SYS_dup3: u64 = 292u64; -export def SYS_pipe2: u64 = 293u64; -export def SYS_inotify_init1: u64 = 294u64; -export def SYS_preadv: u64 = 295u64; -export def SYS_pwritev: u64 = 296u64; -export def SYS_rt_tgsigqueueinfo: u64 = 297u64; -export def SYS_perf_event_open: u64 = 298u64; -export def SYS_recvmmsg: u64 = 299u64; -export def SYS_fanotify_init: u64 = 300u64; -export def SYS_fanotify_mark: u64 = 301u64; -export def SYS_prlimit64: u64 = 302u64; -export def SYS_name_to_handle_at: u64 = 303u64; -export def SYS_open_by_handle_at: u64 = 304u64; -export def SYS_clock_adjtime: u64 = 305u64; -export def SYS_syncfs: u64 = 306u64; -export def SYS_sendmmsg: u64 = 307u64; -export def SYS_setns: u64 = 308u64; -export def SYS_getcpu: u64 = 309u64; -export def SYS_process_vm_readv: u64 = 310u64; -export def SYS_process_vm_writev: u64 = 311u64; -export def SYS_kcmp: u64 = 312u64; -export def SYS_finit_module: u64 = 313u64; -export def SYS_sched_setattr: u64 = 314u64; -export def SYS_sched_getattr: u64 = 315u64; -export def SYS_renameat2: u64 = 316u64; -export def SYS_seccomp: u64 = 317u64; -export def SYS_getrandom: u64 = 318u64; -export def SYS_memfd_create: u64 = 319u64; -export def SYS_kexec_file_load: u64 = 320u64; -export def SYS_bpf: u64 = 321u64; -export def SYS_execveat: u64 = 322u64; -export def SYS_userfaultfd: u64 = 323u64; -export def SYS_membarrier: u64 = 324u64; -export def SYS_mlock2: u64 = 325u64; -export def SYS_copy_file_range: u64 = 326u64; -export def SYS_preadv2: u64 = 327u64; -export def SYS_pwritev2: u64 = 328u64; -export def SYS_pkey_mprotect: u64 = 329u64; -export def SYS_pkey_alloc: u64 = 330u64; -export def SYS_pkey_free: u64 = 331u64; -export def SYS_statx: u64 = 332u64; -export def SYS_io_pgetevents: u64 = 333u64; -export def SYS_rseq: u64 = 334u64; -export def SYS_pidfd_send_signal: u64 = 424u64; -export def SYS_io_uring_setup: u64 = 425u64; -export def SYS_io_uring_enter: u64 = 426u64; -export def SYS_io_uring_register: u64 = 427u64; -export def SYS_open_tree: u64 = 428u64; -export def SYS_move_mount: u64 = 429u64; -export def SYS_fsopen: u64 = 430u64; -export def SYS_fsconfig: u64 = 431u64; -export def SYS_fsmount: u64 = 432u64; -export def SYS_fspick: u64 = 433u64; +export def SYS_read: u64 = 0; +export def SYS_write: u64 = 1; +export def SYS_open: u64 = 2; +export def SYS_close: u64 = 3; +export def SYS_stat: u64 = 4; +export def SYS_fstat: u64 = 5; +export def SYS_lstat: u64 = 6; +export def SYS_poll: u64 = 7; +export def SYS_lseek: u64 = 8; +export def SYS_mmap: u64 = 9; +export def SYS_mprotect: u64 = 10; +export def SYS_munmap: u64 = 11; +export def SYS_brk: u64 = 12; +export def SYS_rt_sigaction: u64 = 13; +export def SYS_rt_sigprocmask: u64 = 14; +export def SYS_rt_sigreturn: u64 = 15; +export def SYS_ioctl: u64 = 16; +export def SYS_pread64: u64 = 17; +export def SYS_pwrite64: u64 = 18; +export def SYS_readv: u64 = 19; +export def SYS_writev: u64 = 20; +export def SYS_access: u64 = 21; +export def SYS_pipe: u64 = 22; +export def SYS_select: u64 = 23; +export def SYS_sched_yield: u64 = 24; +export def SYS_mremap: u64 = 25; +export def SYS_msync: u64 = 26; +export def SYS_mincore: u64 = 27; +export def SYS_madvise: u64 = 28; +export def SYS_shmget: u64 = 29; +export def SYS_shmat: u64 = 30; +export def SYS_shmctl: u64 = 31; +export def SYS_dup: u64 = 32; +export def SYS_dup2: u64 = 33; +export def SYS_pause: u64 = 34; +export def SYS_nanosleep: u64 = 35; +export def SYS_getitimer: u64 = 36; +export def SYS_alarm: u64 = 37; +export def SYS_setitimer: u64 = 38; +export def SYS_getpid: u64 = 39; +export def SYS_sendfile: u64 = 40; +export def SYS_socket: u64 = 41; +export def SYS_connect: u64 = 42; +export def SYS_accept: u64 = 43; +export def SYS_sendto: u64 = 44; +export def SYS_recvfrom: u64 = 45; +export def SYS_sendmsg: u64 = 46; +export def SYS_recvmsg: u64 = 47; +export def SYS_shutdown: u64 = 48; +export def SYS_bind: u64 = 49; +export def SYS_listen: u64 = 50; +export def SYS_getsockname: u64 = 51; +export def SYS_getpeername: u64 = 52; +export def SYS_socketpair: u64 = 53; +export def SYS_setsockopt: u64 = 54; +export def SYS_getsockopt: u64 = 55; +export def SYS_clone: u64 = 56; +export def SYS_fork: u64 = 57; +export def SYS_vfork: u64 = 58; +export def SYS_execve: u64 = 59; +export def SYS_exit: u64 = 60; +export def SYS_wait4: u64 = 61; +export def SYS_kill: u64 = 62; +export def SYS_uname: u64 = 63; +export def SYS_semget: u64 = 64; +export def SYS_semop: u64 = 65; +export def SYS_semctl: u64 = 66; +export def SYS_shmdt: u64 = 67; +export def SYS_msgget: u64 = 68; +export def SYS_msgsnd: u64 = 69; +export def SYS_msgrcv: u64 = 70; +export def SYS_msgctl: u64 = 71; +export def SYS_fcntl: u64 = 72; +export def SYS_flock: u64 = 73; +export def SYS_fsync: u64 = 74; +export def SYS_fdatasync: u64 = 75; +export def SYS_truncate: u64 = 76; +export def SYS_ftruncate: u64 = 77; +export def SYS_getdents: u64 = 78; +export def SYS_getcwd: u64 = 79; +export def SYS_chdir: u64 = 80; +export def SYS_fchdir: u64 = 81; +export def SYS_rename: u64 = 82; +export def SYS_mkdir: u64 = 83; +export def SYS_rmdir: u64 = 84; +export def SYS_creat: u64 = 85; +export def SYS_link: u64 = 86; +export def SYS_unlink: u64 = 87; +export def SYS_symlink: u64 = 88; +export def SYS_readlink: u64 = 89; +export def SYS_chmod: u64 = 90; +export def SYS_fchmod: u64 = 91; +export def SYS_chown: u64 = 92; +export def SYS_fchown: u64 = 93; +export def SYS_lchown: u64 = 94; +export def SYS_umask: u64 = 95; +export def SYS_gettimeofday: u64 = 96; +export def SYS_getrlimit: u64 = 97; +export def SYS_getrusage: u64 = 98; +export def SYS_sysinfo: u64 = 99; +export def SYS_times: u64 = 100; +export def SYS_ptrace: u64 = 101; +export def SYS_getuid: u64 = 102; +export def SYS_syslog: u64 = 103; +export def SYS_getgid: u64 = 104; +export def SYS_setuid: u64 = 105; +export def SYS_setgid: u64 = 106; +export def SYS_geteuid: u64 = 107; +export def SYS_getegid: u64 = 108; +export def SYS_setpgid: u64 = 109; +export def SYS_getppid: u64 = 110; +export def SYS_getpgrp: u64 = 111; +export def SYS_setsid: u64 = 112; +export def SYS_setreuid: u64 = 113; +export def SYS_setregid: u64 = 114; +export def SYS_getgroups: u64 = 115; +export def SYS_setgroups: u64 = 116; +export def SYS_setresuid: u64 = 117; +export def SYS_getresuid: u64 = 118; +export def SYS_setresgid: u64 = 119; +export def SYS_getresgid: u64 = 120; +export def SYS_getpgid: u64 = 121; +export def SYS_setfsuid: u64 = 122; +export def SYS_setfsgid: u64 = 123; +export def SYS_getsid: u64 = 124; +export def SYS_capget: u64 = 125; +export def SYS_capset: u64 = 126; +export def SYS_rt_sigpending: u64 = 127; +export def SYS_rt_sigtimedwait: u64 = 128; +export def SYS_rt_sigqueueinfo: u64 = 129; +export def SYS_rt_sigsuspend: u64 = 130; +export def SYS_sigaltstack: u64 = 131; +export def SYS_utime: u64 = 132; +export def SYS_mknod: u64 = 133; +export def SYS_uselib: u64 = 134; +export def SYS_personality: u64 = 135; +export def SYS_ustat: u64 = 136; +export def SYS_statfs: u64 = 137; +export def SYS_fstatfs: u64 = 138; +export def SYS_sysfs: u64 = 139; +export def SYS_getpriority: u64 = 140; +export def SYS_setpriority: u64 = 141; +export def SYS_sched_setparam: u64 = 142; +export def SYS_sched_getparam: u64 = 143; +export def SYS_sched_setscheduler: u64 = 144; +export def SYS_sched_getscheduler: u64 = 145; +export def SYS_sched_get_priority_max: u64 = 146; +export def SYS_sched_get_priority_min: u64 = 147; +export def SYS_sched_rr_get_interval: u64 = 148; +export def SYS_mlock: u64 = 149; +export def SYS_munlock: u64 = 150; +export def SYS_mlockall: u64 = 151; +export def SYS_munlockall: u64 = 152; +export def SYS_vhangup: u64 = 153; +export def SYS_modify_ldt: u64 = 154; +export def SYS_pivot_root: u64 = 155; +export def SYS__sysctl: u64 = 156; +export def SYS_prctl: u64 = 157; +export def SYS_arch_prctl: u64 = 158; +export def SYS_adjtimex: u64 = 159; +export def SYS_setrlimit: u64 = 160; +export def SYS_chroot: u64 = 161; +export def SYS_sync: u64 = 162; +export def SYS_acct: u64 = 163; +export def SYS_settimeofday: u64 = 164; +export def SYS_mount: u64 = 165; +export def SYS_umount2: u64 = 166; +export def SYS_swapon: u64 = 167; +export def SYS_swapoff: u64 = 168; +export def SYS_reboot: u64 = 169; +export def SYS_sethostname: u64 = 170; +export def SYS_setdomainname: u64 = 171; +export def SYS_iopl: u64 = 172; +export def SYS_ioperm: u64 = 173; +export def SYS_create_module: u64 = 174; +export def SYS_init_module: u64 = 175; +export def SYS_delete_module: u64 = 176; +export def SYS_get_kernel_syms: u64 = 177; +export def SYS_query_module: u64 = 178; +export def SYS_quotactl: u64 = 179; +export def SYS_nfsservctl: u64 = 180; +export def SYS_getpmsg: u64 = 181; +export def SYS_putpmsg: u64 = 182; +export def SYS_afs_syscall: u64 = 183; +export def SYS_tuxcall: u64 = 184; +export def SYS_security: u64 = 185; +export def SYS_gettid: u64 = 186; +export def SYS_readahead: u64 = 187; +export def SYS_setxattr: u64 = 188; +export def SYS_lsetxattr: u64 = 189; +export def SYS_fsetxattr: u64 = 190; +export def SYS_getxattr: u64 = 191; +export def SYS_lgetxattr: u64 = 192; +export def SYS_fgetxattr: u64 = 193; +export def SYS_listxattr: u64 = 194; +export def SYS_llistxattr: u64 = 195; +export def SYS_flistxattr: u64 = 196; +export def SYS_removexattr: u64 = 197; +export def SYS_lremovexattr: u64 = 198; +export def SYS_fremovexattr: u64 = 199; +export def SYS_tkill: u64 = 200; +export def SYS_time: u64 = 201; +export def SYS_futex: u64 = 202; +export def SYS_sched_setaffinity: u64 = 203; +export def SYS_sched_getaffinity: u64 = 204; +export def SYS_set_thread_area: u64 = 205; +export def SYS_io_setup: u64 = 206; +export def SYS_io_destroy: u64 = 207; +export def SYS_io_getevents: u64 = 208; +export def SYS_io_submit: u64 = 209; +export def SYS_io_cancel: u64 = 210; +export def SYS_get_thread_area: u64 = 211; +export def SYS_lookup_dcookie: u64 = 212; +export def SYS_epoll_create: u64 = 213; +export def SYS_epoll_ctl_old: u64 = 214; +export def SYS_epoll_wait_old: u64 = 215; +export def SYS_remap_file_pages: u64 = 216; +export def SYS_getdents64: u64 = 217; +export def SYS_set_tid_address: u64 = 218; +export def SYS_restart_syscall: u64 = 219; +export def SYS_semtimedop: u64 = 220; +export def SYS_fadvise64: u64 = 221; +export def SYS_timer_create: u64 = 222; +export def SYS_timer_settime: u64 = 223; +export def SYS_timer_gettime: u64 = 224; +export def SYS_timer_getoverrun: u64 = 225; +export def SYS_timer_delete: u64 = 226; +export def SYS_clock_settime: u64 = 227; +export def SYS_clock_gettime: u64 = 228; +export def SYS_clock_getres: u64 = 229; +export def SYS_clock_nanosleep: u64 = 230; +export def SYS_exit_group: u64 = 231; +export def SYS_epoll_wait: u64 = 232; +export def SYS_epoll_ctl: u64 = 233; +export def SYS_tgkill: u64 = 234; +export def SYS_utimes: u64 = 235; +export def SYS_vserver: u64 = 236; +export def SYS_mbind: u64 = 237; +export def SYS_set_mempolicy: u64 = 238; +export def SYS_get_mempolicy: u64 = 239; +export def SYS_mq_open: u64 = 240; +export def SYS_mq_unlink: u64 = 241; +export def SYS_mq_timedsend: u64 = 242; +export def SYS_mq_timedreceive: u64 = 243; +export def SYS_mq_notify: u64 = 244; +export def SYS_mq_getsetattr: u64 = 245; +export def SYS_kexec_load: u64 = 246; +export def SYS_waitid: u64 = 247; +export def SYS_add_key: u64 = 248; +export def SYS_request_key: u64 = 249; +export def SYS_keyctl: u64 = 250; +export def SYS_ioprio_set: u64 = 251; +export def SYS_ioprio_get: u64 = 252; +export def SYS_inotify_init: u64 = 253; +export def SYS_inotify_add_watch: u64 = 254; +export def SYS_inotify_rm_watch: u64 = 255; +export def SYS_migrate_pages: u64 = 256; +export def SYS_openat: u64 = 257; +export def SYS_mkdirat: u64 = 258; +export def SYS_mknodat: u64 = 259; +export def SYS_fchownat: u64 = 260; +export def SYS_futimesat: u64 = 261; +export def SYS_newfstatat: u64 = 262; +export def SYS_unlinkat: u64 = 263; +export def SYS_renameat: u64 = 264; +export def SYS_linkat: u64 = 265; +export def SYS_symlinkat: u64 = 266; +export def SYS_readlinkat: u64 = 267; +export def SYS_fchmodat: u64 = 268; +export def SYS_faccessat: u64 = 269; +export def SYS_pselect6: u64 = 270; +export def SYS_ppoll: u64 = 271; +export def SYS_unshare: u64 = 272; +export def SYS_set_robust_list: u64 = 273; +export def SYS_get_robust_list: u64 = 274; +export def SYS_splice: u64 = 275; +export def SYS_tee: u64 = 276; +export def SYS_sync_file_range: u64 = 277; +export def SYS_vmsplice: u64 = 278; +export def SYS_move_pages: u64 = 279; +export def SYS_utimensat: u64 = 280; +export def SYS_epoll_pwait: u64 = 281; +export def SYS_signalfd: u64 = 282; +export def SYS_timerfd_create: u64 = 283; +export def SYS_eventfd: u64 = 284; +export def SYS_fallocate: u64 = 285; +export def SYS_timerfd_settime: u64 = 286; +export def SYS_timerfd_gettime: u64 = 287; +export def SYS_accept4: u64 = 288; +export def SYS_signalfd4: u64 = 289; +export def SYS_eventfd2: u64 = 290; +export def SYS_epoll_create1: u64 = 291; +export def SYS_dup3: u64 = 292; +export def SYS_pipe2: u64 = 293; +export def SYS_inotify_init1: u64 = 294; +export def SYS_preadv: u64 = 295; +export def SYS_pwritev: u64 = 296; +export def SYS_rt_tgsigqueueinfo: u64 = 297; +export def SYS_perf_event_open: u64 = 298; +export def SYS_recvmmsg: u64 = 299; +export def SYS_fanotify_init: u64 = 300; +export def SYS_fanotify_mark: u64 = 301; +export def SYS_prlimit64: u64 = 302; +export def SYS_name_to_handle_at: u64 = 303; +export def SYS_open_by_handle_at: u64 = 304; +export def SYS_clock_adjtime: u64 = 305; +export def SYS_syncfs: u64 = 306; +export def SYS_sendmmsg: u64 = 307; +export def SYS_setns: u64 = 308; +export def SYS_getcpu: u64 = 309; +export def SYS_process_vm_readv: u64 = 310; +export def SYS_process_vm_writev: u64 = 311; +export def SYS_kcmp: u64 = 312; +export def SYS_finit_module: u64 = 313; +export def SYS_sched_setattr: u64 = 314; +export def SYS_sched_getattr: u64 = 315; +export def SYS_renameat2: u64 = 316; +export def SYS_seccomp: u64 = 317; +export def SYS_getrandom: u64 = 318; +export def SYS_memfd_create: u64 = 319; +export def SYS_kexec_file_load: u64 = 320; +export def SYS_bpf: u64 = 321; +export def SYS_execveat: u64 = 322; +export def SYS_userfaultfd: u64 = 323; +export def SYS_membarrier: u64 = 324; +export def SYS_mlock2: u64 = 325; +export def SYS_copy_file_range: u64 = 326; +export def SYS_preadv2: u64 = 327; +export def SYS_pwritev2: u64 = 328; +export def SYS_pkey_mprotect: u64 = 329; +export def SYS_pkey_alloc: u64 = 330; +export def SYS_pkey_free: u64 = 331; +export def SYS_statx: u64 = 332; +export def SYS_io_pgetevents: u64 = 333; +export def SYS_rseq: u64 = 334; +export def SYS_pidfd_send_signal: u64 = 424; +export def SYS_io_uring_setup: u64 = 425; +export def SYS_io_uring_enter: u64 = 426; +export def SYS_io_uring_register: u64 = 427; +export def SYS_open_tree: u64 = 428; +export def SYS_move_mount: u64 = 429; +export def SYS_fsopen: u64 = 430; +export def SYS_fsconfig: u64 = 431; +export def SYS_fsmount: u64 = 432; +export def SYS_fspick: u64 = 433; diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -41,44 +41,44 @@ export fn kill(pid: int, signal: int) int = export fn pipe2(pipefd: *[2]int, flags: int) int = syscall2(SYS_pipe2, pipefd: uintptr: u64, flags: u64): int; -export def MAP_SHARED: uint = 0x01u; -export def MAP_PRIVATE: uint = 0x02u; -export def MAP_SHARED_VALIDATE: uint = 0x03u; -export def MAP_FIXED: uint = 0x10u; -export def MAP_ANON: uint = 0x20u; -export def MAP_NORESERVE: uint = 0x4000u; -export def MAP_GROWSDOWN: uint = 0x0100u; -export def MAP_DENYWRITE: uint = 0x0800u; -export def MAP_EXECUTABLE: uint = 0x1000u; -export def MAP_LOCKED: uint = 0x2000u; -export def MAP_POPULATE: uint = 0x8000u; -export def MAP_NONBLOCK: uint = 0x10000u; -export def MAP_STACK: uint = 0x20000u; -export def MAP_HUGETLB: uint = 0x40000u; -export def MAP_SYNC: uint = 0x80000u; -export def MAP_FIXED_NOREPLACE: uint = 0x100000u; -export def MAP_FILE: uint = 0u; -export def MAP_HUGE_SHIFT: uint = 26u; -export def MAP_HUGE_MASK: uint = 0x3fu; -export def MAP_HUGE_64KB: uint = 16u << 26u; -export def MAP_HUGE_512KB: uint = 19u << 26u; -export def MAP_HUGE_1MB: uint = 20u << 26u; -export def MAP_HUGE_2MB: uint = 21u << 26u; -export def MAP_HUGE_8MB: uint = 23u << 26u; -export def MAP_HUGE_16MB: uint = 24u << 26u; -export def MAP_HUGE_32MB: uint = 25u << 26u; -export def MAP_HUGE_256MB: uint = 28u << 26u; -export def MAP_HUGE_512MB: uint = 29u << 26u; -export def MAP_HUGE_1GB: uint = 30u << 26u; -export def MAP_HUGE_2GB: uint = 31u << 26u; -export def MAP_HUGE_16GB: uint = 34u << 26u; - -export def PROT_NONE: uint = 0u; -export def PROT_READ: uint = 1u; -export def PROT_WRITE: uint = 2u; -export def PROT_EXEC: uint = 4u; -export def PROT_GROWSDOWN: uint = 0x01000000u; -export def PROT_GROWSUP: uint = 0x02000000u; +export def MAP_SHARED: uint = 0x01; +export def MAP_PRIVATE: uint = 0x02; +export def MAP_SHARED_VALIDATE: uint = 0x03; +export def MAP_FIXED: uint = 0x10; +export def MAP_ANON: uint = 0x20; +export def MAP_NORESERVE: uint = 0x4000; +export def MAP_GROWSDOWN: uint = 0x0100; +export def MAP_DENYWRITE: uint = 0x0800; +export def MAP_EXECUTABLE: uint = 0x1000; +export def MAP_LOCKED: uint = 0x2000; +export def MAP_POPULATE: uint = 0x8000; +export def MAP_NONBLOCK: uint = 0x10000; +export def MAP_STACK: uint = 0x20000; +export def MAP_HUGETLB: uint = 0x40000; +export def MAP_SYNC: uint = 0x8000u; +export def MAP_FIXED_NOREPLACE: uint = 0x100000; +export def MAP_FILE: uint = 0; +export def MAP_HUGE_SHIFT: uint = 26; +export def MAP_HUGE_MASK: uint = 0x3f; +export def MAP_HUGE_64KB: uint = 16 << 26; +export def MAP_HUGE_512KB: uint = 19 << 26; +export def MAP_HUGE_1MB: uint = 20 << 26; +export def MAP_HUGE_2MB: uint = 21 << 26; +export def MAP_HUGE_8MB: uint = 23 << 26; +export def MAP_HUGE_16MB: uint = 24 << 26; +export def MAP_HUGE_32MB: uint = 25 << 26; +export def MAP_HUGE_256MB: uint = 28 << 26; +export def MAP_HUGE_512MB: uint = 29 << 26; +export def MAP_HUGE_1GB: uint = 30 << 26; +export def MAP_HUGE_2GB: uint = 31 << 26; +export def MAP_HUGE_16GB: uint = 34 << 26; + +export def PROT_NONE: uint = 0; +export def PROT_READ: uint = 1; +export def PROT_WRITE: uint = 2; +export def PROT_EXEC: uint = 4; +export def PROT_GROWSDOWN: uint = 0x01000000; +export def PROT_GROWSUP: uint = 0x02000000; export fn mmap( addr: nullable *void, @@ -88,12 +88,11 @@ export fn mmap( fd: int, offs: size ) *void = { - let r: u64 = syscall6(SYS_mmap, addr: uintptr: u64, - length: u64, prot: u64, flags: u64, fd: u64, offs: u64): u64; - // TODO: Type promotion - return if (r: int == -EPERM && addr: uintptr == null: uintptr - && (flags & MAP_ANON) > 0u && (flags & MAP_FIXED) == 0u) { - (-ENOMEM): uintptr: *void; // Fix up incorrect EPERM from kernel + let r = syscall6(SYS_mmap, addr: uintptr: u64, length: u64, prot: u64, + flags: u64, fd: u64, offs: u64): u64; + return if (r: int == -EPERM && addr == null + && flags & MAP_ANON > 0 && flags & MAP_FIXED == 0) { + -ENOMEM: uintptr: *void; // Fix up incorrect EPERM from kernel } else r: uintptr: *void; }; diff --git a/rt/abort.ha b/rt/abort.ha @@ -2,7 +2,7 @@ export @noreturn @symbol("rt.abort") fn _abort(msg: str) void = { const prefix = "Abort: "; write(2, prefix: *const char, len(prefix)); write(2, msg: *const char, len(msg)); - write(2, "\n": *const char, 1z); + write(2, "\n": *const char, 1); kill(getpid(), SIGABRT); }; diff --git a/rt/compile.ha b/rt/compile.ha @@ -22,7 +22,7 @@ export fn compile(src: const str) int = { const buf = src: *const char: *const [*]u8; for (let n = 0z; n < len(src)) { let m = write(pipefd[1], &buf[n], len(src) - n); - assert(m: i64 > 0i64, "write(2) failed"); + assert(m > 0, "write(2) failed"); n += m; }; diff --git a/rt/ensure.ha b/rt/ensure.ha @@ -7,9 +7,9 @@ export type slice = struct { export fn ensure(s: *slice, membsz: size, length: size) void = { // TODO: make sure length * membsz < SIZE_MAX for (s.capacity < length) { - s.capacity *= 2z; + s.capacity *= 2; }; let data = realloc(s.data, s.capacity * membsz); - assert(data != null: nullable *void); + assert(data != null); s.data = data; }; diff --git a/rt/malloc.ha b/rt/malloc.ha @@ -30,19 +30,18 @@ // bin to become non-continuous. This has no consequences for performance or // correctness. -// TODO: Type promotion -def ALIGN: size = 2z; +def ALIGN: size = 2; def WORD: size = size(size); def WASTE: size = WORD * ALIGN - WORD; -def BIGBLOCK: size = (2z << 16z) * WORD; +def BIGBLOCK: size = (2 << 16) * WORD; let bins: [50]nullable *void = [null...]; -fn bin2size(b: size) size = ((b + 1z) * ALIGN - 1z) * WORD; +fn bin2size(b: size) size = ((b + 1) * ALIGN - 1) * WORD; fn size2bin(s: size) size = { - assert(s <= bin2size(len(bins) - 1z), "Size exceeds maximum for bin"); - return (s + (WORD * (ALIGN - 1z) - 1z)) / (WORD * ALIGN); + assert(s <= bin2size(len(bins) - 1), "Size exceeds maximum for bin"); + return (s + (WORD * (ALIGN - 1) - 1)) / (WORD * ALIGN); }; let nalloc: int = 0; @@ -53,9 +52,8 @@ let nfree: int = 0; // Allocates n bytes of memory and returns a pointer to them, or null if there // is insufficient memory. export fn malloc(n: size) nullable *void = { - assert(n > 0z); - let r: nullable *void = - if (n > bin2size(len(bins) - 1z)) malloc_large(n) + assert(n > 0); + let r = if (n > bin2size(len(bins) - 1)) malloc_large(n) else malloc_small(n); nalloc += 1; return r; @@ -63,7 +61,7 @@ export fn malloc(n: size) nullable *void = { fn malloc_large(n: size) nullable *void = { let p = segmalloc(n + WASTE + WORD); - if (p == null: nullable *void) { + if (p == null) { return null; }; let bsize = (p: uintptr + WASTE: uintptr): *[1]size; @@ -74,13 +72,13 @@ fn malloc_large(n: size) nullable *void = { fn malloc_small(n: size) nullable *void = { const b = size2bin(n); let p = bins[b]; - if (p == null: nullable *void) { + if (p == null) { p = fill_bin(b); - if (p != null: nullable *void) { + if (p != null) { bins[b] = p; }; }; - return if (p != null: nullable *void) { + return if (p != null) { let q = *(p: **void); bins[b] = q; p; @@ -90,15 +88,14 @@ fn malloc_small(n: size) nullable *void = { fn fill_bin(b: size) nullable *void = { const s = bin2size(b); let p = segmalloc(BIGBLOCK); - return if (p == null: nullable *void) null - else list_from_block(s, p: uintptr); + return if (p == null) null else list_from_block(s, p: uintptr); }; fn list_from_block(s: size, p: uintptr) nullable *void = { const nblocks = (BIGBLOCK - WASTE) / (s + WORD); let q = p + WASTE: uintptr; // align q+WORD - for (let j = 0z; j != nblocks - 1z; j += 1z) { + for (let j = 0z; j != nblocks - 1; j += 1) { let sz = q: *size; let useralloc = q + WORD: uintptr; // aligned let next = (useralloc + s: uintptr + WORD: uintptr): *void; @@ -122,7 +119,7 @@ export @symbol("rt.free") fn free_(_p: nullable *void) void = { let p = _p: *void; let bsize = (p: uintptr - size(size): uintptr): *[1]size; let s = bsize[0]; - if (s <= bin2size(len(bins) - 1z)) free_small(p, s) + if (s <= bin2size(len(bins) - 1)) free_small(p, s) else free_large(p, s); }; }; @@ -147,8 +144,8 @@ fn free_small(p: *void, s: size) void = { // in-place. Returns null if there is insufficient memory to support the // request. export fn realloc(_p: nullable *void, n: size) nullable *void = { - assert(n > 0z); - if (_p == null: nullable *void) { + assert(n > 0); + if (_p == null) { return malloc(n); }; @@ -159,12 +156,12 @@ export fn realloc(_p: nullable *void, n: size) nullable *void = { return p; }; - if (n < bin2size(len(bins) - 1z) && size2bin(n) == size2bin(s)) { + if (n < bin2size(len(bins) - 1) && size2bin(n) == size2bin(s)) { return p; }; let new = malloc(n); - if (new != null: nullable *void) { + if (new != null) { memcpy(new: *void, p, s); free(p); }; diff --git a/rt/memcpy.ha b/rt/memcpy.ha @@ -1,6 +1,6 @@ export fn memcpy(dest: *void, src: *void, amt: size) void = { let a = dest: *[*]u8, b = src: *[*]u8; - for (let i = 0z; i < amt; i += 1z) { + for (let i = 0z; i < amt; i += 1) { a[i] = b[i]; }; }; diff --git a/rt/memset.ha b/rt/memset.ha @@ -1,6 +1,6 @@ export fn memset(dest: *void, val: u8, amt: size) void = { let a = dest: *[*]u8; - for (let i = 0z; i < amt; i += 1z) { + for (let i = 0z; i < amt; i += 1) { a[i] = val; }; }; diff --git a/rt/rtmain.ha b/rt/rtmain.ha @@ -8,7 +8,7 @@ const @symbol("__fini_array_end") fini_end: [*]*fn() void; export fn start_ha(iv: [*]uintptr) void = { const ninit = (&init_end: uintptr - &init_start: uintptr): size / size(*fn() void); - for (let i = 0z; i < ninit; i += 1z) { + for (let i = 0z; i < ninit; i += 1) { init_start[i](); }; @@ -16,7 +16,7 @@ export fn start_ha(iv: [*]uintptr) void = { const nfini = (&fini_end: uintptr - &fini_start: uintptr): size / size(*fn() void); - for (let i = 0z; i < nfini; i += 1z) { + for (let i = 0z; i < nfini; i += 1) { fini_start[i](); }; diff --git a/rt/strcmp.ha b/rt/strcmp.ha @@ -9,7 +9,7 @@ export fn strcmp(_a: str, _b: str) bool = { return false; }; let a = (&_a: *string).data, b = (&_b: *string).data; - for (let i = 0z; i < len(_a); i += 1z) { + for (let i = 0z; i < len(_a); i += 1) { if (a[i] != b[i]) { return false; }; diff --git a/tests/00-constants.ha b/tests/00-constants.ha @@ -8,5 +8,4 @@ export fn main() void = { r6 = '\b', r7 = '\f', r8 = '\n', r9 = '\r', r10 = '\t', r11 = '\v', r12 = '\\', r13 = '\'', r14 = '\"'; // TODO: Floating constants - return void; }; diff --git a/tests/01-arrays.ha b/tests/01-arrays.ha @@ -19,23 +19,23 @@ fn indexing() void = { fn measurements() void = { let x = [1, 2, 3]; - assert(len(x) == 3z); - assert(size([3]int) == size(int) * 3z); + assert(len(x) == 3); + assert(size([3]int) == size(int) * 3); }; fn storage() void = { let x = [1, 2, 3]; let y = &x: uintptr; - assert(*((y + (size(int) * 0z): uintptr): *int) == 1); - assert(*((y + (size(int) * 1z): uintptr): *int) == 2); - assert(*((y + (size(int) * 2z): uintptr): *int) == 3); + assert(*((y + (size(int) * 0): uintptr): *int) == 1); + assert(*((y + (size(int) * 1): uintptr): *int) == 2); + assert(*((y + (size(int) * 2): uintptr): *int) == 3); }; fn alignment() void = { - let x = [1i32, 2i32, 3i32]; - assert(&x: uintptr: size % 4z == 0z); - let y = [1i64, 2i64, 3i64]; - assert(&y: uintptr: size % 8z == 0z); + let x: [_]i32 = [1, 2, 3]; + assert(&x: uintptr: size % 4 == 0); + let y: [_]i64 = [1, 2, 3]; + assert(&y: uintptr: size % 8 == 0); }; fn assignment() void = { @@ -48,7 +48,7 @@ fn assignment() void = { }; fn param(x: [3]int) void = { - assert(len(x) == 3z); + assert(len(x) == 3); assert(x[0] == 1); assert(x[1] == 2); assert(x[2] == 3); @@ -58,14 +58,14 @@ fn nested() void = { let x = [[1, 2], [3, 4]]; assert(x[0][0] == 1 && x[0][1] == 2); assert(x[1][0] == 3 && x[1][1] == 4); - assert(len(x[0]) == 2z); + assert(len(x[0]) == 2); x[1] = [5, 6]; assert(x[1][0] == 5 && x[1][1] == 6); }; fn expanded() void = { let a: [5]int = [1337...]; - for (let i = 0z; i < len(a); i += 1z) { + for (let i = 0z; i < len(a); i += 1) { assert(a[i] == 1337); }; @@ -73,25 +73,25 @@ fn expanded() void = { x: int = 10, y: int = 20, }...]; - for (let i = 0z; i < len(b); i += 1z) { + for (let i = 0z; i < len(b); i += 1) { assert(b[i].x == 10 && b[i].y == 20); }; let c: [5]int = [1, 2, 3...]; let expected = [1, 2, 3, 3, 3]; - for (let i = 0z; i < len(c); i += 1z) { + for (let i = 0z; i < len(c); i += 1) { assert(c[i] == expected[i]); }; }; fn extype() void = { - let x: [5]u8 = [42u8...]; - for (let i = 0z; i < len(x); i += 1z) { - assert(x[i] == 42u8); + let x: [5]u8 = [42...]; + for (let i = 0z; i < len(x); i += 1) { + assert(x[i] == 42); }; - x[0] = 24u8; - assert(x[0] == 24u8); - assert(x[1] == 42u8); + x[0] = 24; + assert(x[0] == 24); + assert(x[1] == 42); }; export fn main() void = { diff --git a/tests/02-integers.ha b/tests/02-integers.ha @@ -1,40 +1,40 @@ fn sizes() void = { // Fixed precision - assert(size(i8) == 1z); - assert(size(i16) == 2z); - assert(size(i32) == 4z); - assert(size(i64) == 8z); - assert(size(u8) == 1z); - assert(size(u16) == 2z); - assert(size(u32) == 4z); - assert(size(u64) == 8z); + assert(size(i8) == 1); + assert(size(i16) == 2); + assert(size(i32) == 4); + assert(size(i64) == 8); + assert(size(u8) == 1); + assert(size(u16) == 2); + assert(size(u32) == 4); + assert(size(u64) == 8); // Implementation-defined (test meets spec limits) - assert(size(int) >= 4z); - assert(size(uint) >= 4z); + assert(size(int) >= 4); + assert(size(uint) >= 4); // etc - assert(size(char) == 1z); + assert(size(char) == 1); }; fn alignment() void = { // Fixed alignment let _i8 = 0i8, _u8 = 0u8; - assert(&_i8: uintptr: size % 1z == 0z); - assert(&_u8: uintptr: size % 1z == 0z); + assert(&_i8: uintptr: size % 1 == 0); + assert(&_u8: uintptr: size % 1 == 0); let _i16 = 0i16, _u16 = 0u16; - assert(&_i16: uintptr: size % 2z == 0z); - assert(&_u16: uintptr: size % 2z == 0z); + assert(&_i16: uintptr: size % 2 == 0); + assert(&_u16: uintptr: size % 2 == 0); let _i32 = 0i32, _u32 = 0u32; - assert(&_i32: uintptr: size % 4z == 0z); - assert(&_u32: uintptr: size % 4z == 0z); + assert(&_i32: uintptr: size % 4 == 0); + assert(&_u32: uintptr: size % 4 == 0); let _i64 = 0i64, _u64 = 0u64; - assert(&_i64: uintptr: size % 8z == 0z); - assert(&_u64: uintptr: size % 8z == 0z); + assert(&_i64: uintptr: size % 8 == 0); + assert(&_u64: uintptr: size % 8 == 0); // Implementation-defined alignment let i = 0i, u = 0u, z = 0z, uptr = &i: uintptr; - assert(&i: uintptr: size % size(int) == 0z); - assert(&u: uintptr: size % size(uint) == 0z); - assert(&z: uintptr: size % size(size) == 0z); - assert(&uptr: uintptr: size % size(uintptr) == 0z); + assert(&i: uintptr: size % size(int) == 0); + assert(&u: uintptr: size % size(uint) == 0); + assert(&z: uintptr: size % size(size) == 0); + assert(&uptr: uintptr: size % size(uintptr) == 0); }; export fn main() void = { diff --git a/tests/03-pointers.ha b/tests/03-pointers.ha @@ -10,7 +10,7 @@ fn basics() void = { fn _nullable() void = { let x: nullable *int = null; - assert(x == null: nullable *int); // TODO: type promotion + assert(x == null); let y = 42; x = &y; assert(*(x: *int) == 42); diff --git a/tests/04-strings.ha b/tests/04-strings.ha @@ -1,12 +1,12 @@ fn measurements() void = { const x = "Hello!"; - assert(len(x) == 6z); - assert(len("Hello!") == 6z); - assert(size(str) == size(*u8) + size(size) * 2z); + assert(len(x) == 6); + assert(len("Hello!") == 6); + assert(size(str) == size(*u8) + size(size) * 2); const align: size = if (size(*u8) > size(size)) size(*u8) else size(size); - assert(&x: uintptr: size % align == 0z); + assert(&x: uintptr: size % align == 0); }; fn charptr() void = { @@ -14,7 +14,7 @@ fn charptr() void = { const y = x: *const char; const z = y: *[*]u8; const expected = ['H', 'e', 'l', 'l', 'o', '!', '\0']; - for (let i = 0z; i < len(expected); i += 1z) { + for (let i = 0z; i < len(expected); i += 1) { assert(z[i] == expected[i]: u32: u8); }; }; @@ -26,14 +26,14 @@ fn storage() void = { length: size, capacity: size, }; - assert(ptr.length == 15z && ptr.capacity == 15z); + assert(ptr.length == 15 && ptr.capacity == 15); // UTF-8 encoded - const expected = [ - 0xE3u8, 0x81u8, 0x93u8, 0xE3u8, 0x82u8, 0x93u8, 0xE3u8, 0x81u8, - 0xABu8, 0xE3u8, 0x81u8, 0xA1u8, 0xE3u8, 0x81u8, 0xAFu8, 0x00u8, + const expected: [_]u8 = [ + 0xE3, 0x81, 0x93, 0xE3, 0x82, 0x93, 0xE3, 0x81, + 0xAB, 0xE3, 0x81, 0xA1, 0xE3, 0x81, 0xAF, 0x00, ]; - for (let i = 0z; i < len(expected); i += 1z) { + for (let i = 0z; i < len(expected); i += 1) { assert(ptr.data[i] == expected[i]); }; @@ -43,7 +43,7 @@ fn storage() void = { length: size, capacity: size, }; - assert(ptr2.data == null: nullable *[*]u8); // XXX: Type promotion + assert(ptr2.data == null); }; fn concat() void = { @@ -53,7 +53,7 @@ fn concat() void = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\0', ]; - for (let i = 0z; i < len(expected); i += 1z) { + for (let i = 0z; i < len(expected); i += 1) { assert(t[i] == expected[i]: u32: u8); }; }; diff --git a/tests/05-implicit-casts.ha b/tests/05-implicit-casts.ha @@ -24,7 +24,7 @@ fn rules() void = { _u16 = 42u8; // Implementation-defined precision - if (size(int) == 8z) { + if (size(int) == 8) { assert(rt::compile("fn test() void = { let i: int = 42i64; };") == 0); }; let i: int = 42i; @@ -32,7 +32,7 @@ fn rules() void = { i = 42i16; i = 42i8; - if (size(uint) == 8z) { + if (size(uint) == 8) { assert(rt::compile("fn test() void = { let u: uint = 42u64; };") == 0); }; let u: uint = 42u; diff --git a/tests/06-structs.ha b/tests/06-structs.ha @@ -1,26 +1,26 @@ use rt; fn padding() void = { - assert(size(struct { x: i32, y: i32 }) == 8z); - assert(size(struct { x: i32, y: i64 }) == 16z); - assert(size(union { x: i8, y: i16, z: i32 }) == 4z); + assert(size(struct { x: i32, y: i32 }) == 8); + assert(size(struct { x: i32, y: i64 }) == 16); + assert(size(union { x: i8, y: i16, z: i32 }) == 4); const s = struct { - x: i8 = 10i8, - y: i16 = 20i16, - z: i32 = 30i32, - q: i64 = 40i32, + x: i8 = 10, + y: i16 = 20, + z: i32 = 30, + q: i64 = 40, }; - assert(&s.x: uintptr: size % 1z == 0z); - assert(&s.y: uintptr: size % 2z == 0z); - assert(&s.z: uintptr: size % 4z == 0z); - assert(&s.q: uintptr: size % 8z == 0z); + assert(&s.x: uintptr: size % 1 == 0); + assert(&s.y: uintptr: size % 2 == 0); + assert(&s.z: uintptr: size % 4 == 0); + assert(&s.q: uintptr: size % 8 == 0); }; fn storage() void = { - let coords = struct { x: i32 = 10i32, y: i32 = 20i32 }; + let coords = struct { x: i32 = 10, y: i32 = 20 }; let ptr = &coords: *[*]i32; - assert(ptr[0] == 10i32 && ptr[1] == 20i32); + assert(ptr[0] == 10 && ptr[1] == 20); }; fn assignment() void = { @@ -109,7 +109,7 @@ fn invariants() void = { // Untyped field for unnamed struct: "fn test() void = { let x = struct { x = 10 }; };", ]; - for (let i = 0z; i < len(failures); i += 1z) { + for (let i = 0z; i < len(failures); i += 1) { assert(rt::compile(failures[i]) != 0); }; }; diff --git a/tests/07-aliases.ha b/tests/07-aliases.ha @@ -2,8 +2,7 @@ type my_int = int; fn alias_builtin() void = { let i: my_int = 1234; - // TODO: type promotion - assert(i == 1234: my_int, "built-in alias"); + assert(i == 1234, "built-in alias"); }; fn unwrap() void = { diff --git a/tests/08-slices.ha b/tests/08-slices.ha @@ -21,10 +21,10 @@ fn storage() void = { capacity: size, }; - assert(len(x) == 5z); - assert(ptr.length == 5z && ptr.capacity == 5z); + assert(len(x) == 5); + assert(ptr.length == 5 && ptr.capacity == 5); - for (let i = 0z; i < len(expected); i += 1z) { + for (let i = 0z; i < len(expected); i += 1) { assert(x[i] == expected[i]); }; }; @@ -32,16 +32,16 @@ fn storage() void = { fn casting() void = { let x: []int = [1, 2, 3, 4, 5]; let y = x: *[5]int; - for (let i = 0z; i < len(x); i += 1z) { + for (let i = 0z; i < len(x); i += 1) { assert(x[i] == y[i]); }; }; fn measurements() void = { let x: []int = [1, 2, 3, 4, 5]; - assert(size([]int) == size(*[*]int) + size(size) * 2z); - assert(len(x) == 5z); - assert(&x: uintptr: size % size(int) == 0z); + assert(size([]int) == size(*[*]int) + size(size) * 2); + assert(len(x) == 5); + assert(&x: uintptr: size % size(int) == 0); }; fn indexing() void = { @@ -74,7 +74,7 @@ fn assignment() void = { fn assert_slice_eq(actual: []int, expected: []int) void = { assert(len(expected) == len(actual)); - for (let i = 0z; i < len(expected); i += 1z) { + for (let i = 0z; i < len(expected); i += 1) { assert(expected[i] == actual[i]); }; }; diff --git a/tests/09-funcs.ha b/tests/09-funcs.ha @@ -20,7 +20,7 @@ fn pointers() void = { fn vafn(expected: []int, values: int...) void = { assert(len(expected) == len(values)); - for (let i = 0z; i < len(values); i += 1z) { + for (let i = 0z; i < len(values); i += 1) { assert(expected[i] == values[i]); }; }; diff --git a/tests/11-globals.ha b/tests/11-globals.ha @@ -20,11 +20,11 @@ type coords3 = struct { coords: coords, z: int }; let a3: coords3 = coords3 { ... }; fn storage() void = { - assert(len(ar) == 3z); + assert(len(ar) == 3); assert(ar[0] == 1 && ar[1] == 2 && ar[2] == 3); - assert(len(sl) == 3z); + assert(len(sl) == 3); assert(sl[0] == 1 && sl[1] == 2 && sl[2] == 3); - assert(len(st) == 6z); + assert(len(st) == 6); assert(su.x == 20 && su.y == 10); assert(au.x == 0 && au.y == 0); assert(a3.coords.x == 0 && a3.coords.y == 0 && a3.z == 0); diff --git a/tests/13-tagged.ha b/tests/13-tagged.ha @@ -5,13 +5,13 @@ fn measurements() void = { const align: size = if (size(u64) < size(uint)) size(uint) else size(u64); - assert(size((u8 | u16 | u32 | u64)) == align * 2z); - assert(&x: uintptr: size % size(uint) == 0z); - assert(&x: uintptr: size % size(u64) == 0z); + assert(size((u8 | u16 | u32 | u64)) == align * 2); + assert(&x: uintptr: size % size(uint) == 0); + assert(&x: uintptr: size % size(u64) == 0); const y: (u8 | u16) = 1337u16; // No padding - assert(&y: uintptr: size % size(uint) == 0z); - assert(&y: uintptr: size % size(u16) == 0z); + assert(&y: uintptr: size % size(uint) == 0); + assert(&y: uintptr: size % size(u16) == 0); }; fn storage() void = { @@ -20,20 +20,20 @@ fn storage() void = { tag: uint, union { _u8: u8, _u16: u16, _u32: u32, _u64: u64 }, }; - assert(y.tag == 1228088861u); // u8 type ID - assert(y._u8 == 42u8); + assert(y.tag == 1228467311); // u8 type ID + assert(y._u8 == 42); x = 1337u16; - assert(y.tag == 1225628936u); // u16 type ID - assert(y._u16 == 1337u16); + assert(y.tag == 1226007386); // u16 type ID + assert(y._u16 == 1337); x = 0xCAFEBABEu32; - assert(y.tag == 1226196611u); // u32 type ID - assert(y._u32 == 0xCAFEBABEu32); + assert(y.tag == 1228088861); // u32 type ID + assert(y._u32 == 0xCAFEBABE); x = 0xCAFEBABEDEADBEEFu64; - assert(y.tag == 1226007386u); // u64 type ID - assert(y._u64 == 0xCAFEBABEDEADBEEFu64); + assert(y.tag == 1227899636); // u64 type ID + assert(y._u64 == 0xCAFEBABEDEADBEEF); }; fn operators() void = { @@ -73,12 +73,12 @@ fn reduction() void = { fn casts() void = { let a: (u8 | u16) = 42u16; - assert(a as u16 == 42u16); + assert(a as u16 == 42); let x = a: u8; - assert(x == 42u8); + assert(x == 42); const val = 0xBEEFu16; - const is_little = (&val: *[2]u8)[0] == 0xEFu8; + const is_little = (&val: *[2]u8)[0] == 0xEF; a = 0xCAFEu16; x = a: u8; assert(x == (if (is_little) 0xFEu8 else 0xCAu8)); diff --git a/tests/14-switch.ha b/tests/14-switch.ha @@ -1,6 +1,6 @@ fn basics() void = { let cases = [[0, 1], [1, 3], [10, 20], [11, 21], [12, 22], [13, 13]]; - for (let i = 0z; i < len(cases); i += 1z) { + for (let i = 0z; i < len(cases); i += 1) { let x = cases[i][0]; let y: int = switch (x) { 0 => x + 1, diff --git a/tests/15-enums.ha b/tests/15-enums.ha @@ -5,10 +5,9 @@ type implicit_values = enum { }; fn implicit() void = { - // TODO: Type promotion - assert(implicit_values::ZERO == 0: implicit_values); - assert(implicit_values::ONE == 1: implicit_values); - assert(implicit_values::TWO == 2: implicit_values); + assert(implicit_values::ZERO == 0); + assert(implicit_values::ONE == 1); + assert(implicit_values::TWO == 2); }; type explicit_values = enum { @@ -20,26 +19,25 @@ type explicit_values = enum { }; fn explicit() void = { - // TODO: Type promotion - assert(explicit_values::NEGONE == -1: explicit_values); - assert(explicit_values::SIXTEEN == 16: explicit_values); - assert(explicit_values::SEVENTEEN == 17: explicit_values); - assert(explicit_values::EIGHTEEN == 18: explicit_values); - assert(explicit_values::FIFTY == 50: explicit_values); + assert(explicit_values::NEGONE == -1); + assert(explicit_values::SIXTEEN == 16); + assert(explicit_values::SEVENTEEN == 17); + assert(explicit_values::EIGHTEEN == 18); + assert(explicit_values::FIFTY == 50); }; type with_storage = enum u16 { - CAFE = 0xCAFEu16, - BABE = 0xBABEu16, - DEAD = 0xDEADu16, - BEEF = 0xBEEFu16, + CAFE = 0xCAFE, + BABE = 0xBABE, + DEAD = 0xDEAD, + BEEF = 0xBEEF, }; fn storage() void = { assert(size(explicit_values) == size(int)); - assert(size(with_storage) == 2z); + assert(size(with_storage) == 2); const val = 0xBEEFu16; - const is_little = (&val: *[2]u8)[0] == 0xEFu8; + const is_little = (&val: *[2]u8)[0] == 0xEF; assert(with_storage::CAFE: u8 == (if (is_little) 0xFEu8 else 0xCAu8)); assert(with_storage::BABE: u8 == (if (is_little) 0xBEu8 else 0xBAu8)); assert(with_storage::DEAD: u8 == (if (is_little) 0xADu8 else 0xDEu8)); diff --git a/tests/17-alloc.ha b/tests/17-alloc.ha @@ -11,8 +11,7 @@ fn allocation() void = { free(x); let y = alloc(nullable *int, 1234); - // TODO: Type promotion - if (y != null: nullable *int) { + if (y != null) { assert(*(y: *int) == 1234); }; free(y); @@ -52,10 +51,10 @@ fn double_alloc() void = { }; fn slice() void = { - let x = alloc([]int, [1, 2, 3], 10z); - assert(len(x) == 3z); - for (let i = 0z; i < len(x); i += 1z) { - assert(x[i] == (i + 1z): int); + let x = alloc([]int, [1, 2, 3], 10); + assert(len(x) == 3); + for (let i = 0z; i < len(x); i += 1) { + assert(x[i] == (i + 1): int); }; free(x); }; @@ -63,11 +62,11 @@ fn slice() void = { fn string() void = { let x = struct { data: *[3]int = alloc(*[3]int, [1, 2, 3]), - length: size = 3z, - capacity: size = 3z, + length: size = 3, + capacity: size = 3, }; let y = *(&x: *str); - assert(len(y) == 3z); + assert(len(y) == 3); free(y); }; diff --git a/tests/18-match.ha b/tests/18-match.ha @@ -1,10 +1,10 @@ fn tagged() void = { let cases: [3](int | uint | str) = [10i, 10u, "hello"]; - let expected = [1z, 2z, 5z]; - for (let i = 0z; i < len(cases); i += 1z) { + let expected: [_]size = [1, 2, 5]; + for (let i = 0z; i < len(cases); i += 1) { let y: size = match (cases[i]) { - int => 1z, - uint => 2z, + int => 1, + uint => 2, s: str => len(s), }; assert(y == expected[i]); @@ -57,7 +57,7 @@ type foobar = (foo | bar); fn alias() void = { let cases: []foobar = [foo, bar]; let expected = [42, 24]; - for (let i = 0z; i < len(cases); i += 1z) { + for (let i = 0z; i < len(cases); i += 1) { let y: int = match (cases[i]) { foo => 42, bar => 24, diff --git a/tests/19-append.ha b/tests/19-append.ha @@ -1,9 +1,9 @@ use rt; fn simple() void = { - let x = alloc([]int, [1, 2, 3], 6z); + let x = alloc([]int, [1, 2, 3], 6); append(x, 4, 5, 6); - assert(len(x) == 6z); + assert(len(x) == 6); assert(x[0] == 1 && x[1] == 2 && x[2] == 3 && x[3] == 4 && x[4] == 5); assert(x[5] == 6); append(x, 7, 8, 9); @@ -14,8 +14,8 @@ fn simple() void = { let z = [2, 3, 4]; append(y, ...y); append(y, z); - assert(len(y) == 3z); - assert(len(y[0]) == 1z && len(y[1]) == 1z && len(y[2]) == 3z); + assert(len(y) == 3); + assert(len(y[0]) == 1 && len(y[1]) == 1 && len(y[2]) == 3); assert(y[0][0] == 1); assert(y[1][0] == 1); assert(y[2][0] == 2 && y[2][1] == 3 && y[2][2] == 4); @@ -26,15 +26,15 @@ fn simple() void = { fn variadic() void = { let x = alloc([]int, [1, 2], 2z); append(x, 4, ...[8, 16, 32, 64]); - assert(len(x) == 7z); + assert(len(x) == 7); assert(x[0] == 1 && x[1] == 2 && x[2] == 4 && x[3] == 8 && x[4] == 16); assert(x[5] == 32 && x[6] == 64); - let y = alloc([]int, [1, 2, 3], 3z); + let y = alloc([]int, [1, 2, 3], 3); let z = [128, 256]; append(y, ...x); append(y, ...z); - assert(len(y) == 12z); + assert(len(y) == 12); assert(y[0] == 1 && y[1] == 2 && y[2] == 3 && y[3] == 1 && y[4] == 2); assert(y[5] == 4 && y[6] == 8 && y[7] == 16 && y[8] == 32); assert(y[9] == 64 && y[10] == 128 && y[11] == 256); diff --git a/tests/20-if.ha b/tests/20-if.ha @@ -54,8 +54,8 @@ fn or() void = { }; fn tagged() void = { - assert((if (true) 1u8 else 0i8) as u8 == 1u8); - assert((if (false) 1u8 else 0i8) as i8 == 0i8); + assert((if (true) 1u8 else 0i8) as u8 == 1); + assert((if (false) 1u8 else 0i8) as i8 == 0); }; export fn main() void = {