Commit Graph

735 Commits

Author SHA1 Message Date
pca006132 b18626b149 Fix compilation and test failures 2022-02-12 22:50:32 +08:00
pca006132 750d912eb4 nac3core: do list bound check and negative index handling
Raise error when index out of range. Note that we use llvm.expect to
tell the optimizer that we expect not to raise an exception, so the
normal path performance would be better. If this assumption is violated,
the exception overhead might be slightly larger, but the percentage
increase in overhead should not be high since exception unwinding is
already pretty slow.
2022-02-12 22:50:32 +08:00
pca006132 bf52e294ee nac3artiq: RPC support 2022-02-12 22:50:32 +08:00
pca006132 e303248261 nac3core: exception type check and codegen 2022-02-12 22:50:32 +08:00
pca006132 7ea5a5f84d nac3core: codegen refactoring
- No longer check if the statement will return. Instead, we check if
  the current basic block is terminated, which is simpler and handles
  exception/break/continue better.
- Use invoke statement when unwind is needed.
- Moved codegen for a block of statements into a separate function.
2022-02-12 22:13:59 +08:00
pca006132 b267a656a8 nac3core: added exception type and fixed primitive representation
- Added `Exception` primitive type and some builtin exception types.
  Note that all exception types share the same layout, and should
  inherit from the base `Exception` type. There are some hacks in the
  toplevel module for handling exception types, we should revisit and
  fix them later.
- Added new primitive types to concrete type module, otherwise there
  would be some weird type errors.
- Changed the representation of strings to CSlice<u8>, instead of
  CString.
2022-02-12 22:13:59 +08:00
pca006132 050c862c1a nac3core: function codegen callback changes
Added code generator argument to the callback, so it would be easier to
write complicated codegen with that callback. To prepare for RPC
codegen.
2022-02-12 21:24:41 +08:00
Sebastien Bourdeauducq ffe89eec86 llvm: disable threads 2022-02-08 14:52:09 +08:00
ychenfo d6ab73afb0 nac3core: style 2022-02-07 02:18:56 +08:00
ychenfo 6f9f455152 nac3core: list slice irrt use one function to handle var size 2022-02-07 02:09:50 +08:00
ychenfo e50f1017fa nac3core: irrt list of tuple use struct value representation 2022-02-07 02:09:50 +08:00
ychenfo 77608346b1 nac3core: handle tuple by value 2022-02-07 02:09:50 +08:00
Sebastien Bourdeauducq f5ce7376e3 flake: fix Windows build 2022-02-05 16:53:47 +08:00
Sebastien Bourdeauducq 1288624218 lock insta version (#179) 2022-01-31 15:18:49 +08:00
Sebastien Bourdeauducq 0124bcd26c update dependencies (missing part of previous commit) 2022-01-31 14:15:05 +08:00
Sebastien Bourdeauducq de065cfa14 update dependencies 2022-01-31 12:28:40 +08:00
pca006132 304181fd8c Merge pull request 'fix errors of non-primitive host object when running multiple kernels' (#171) from multiple_kernel_err into master
Reviewed-on: M-Labs/nac3#171
2022-01-27 14:46:22 +08:00
ychenfo 43048eb8d8 nac3standalone: add tests for list slice and len 2022-01-26 03:58:27 +08:00
ychenfo ace0e2a2c6 nac3core: fix use of size_t in list comprehension, cleanup 2022-01-25 03:35:59 +08:00
Sebastien Bourdeauducq e891683f2e flake: hack-link libstdc++ statically on Windows. Closes #175 2022-01-24 16:54:05 +08:00
Sebastien Bourdeauducq 8e01a20ac3 README: add Windows instructions 2022-01-24 15:54:01 +08:00
Sebastien Bourdeauducq 465514ca7a flake: fix mcfgthread filename 2022-01-24 15:52:04 +08:00
Sebastien Bourdeauducq 9c34dd9c80 flake: distribute mcfgthreads-12.dll on hydra 2022-01-24 15:49:32 +08:00
Sebastien Bourdeauducq ced7acd871 check_demos: improve output 2022-01-24 11:38:43 +08:00
Sebastien Bourdeauducq 6ea40809b3 README: fix nix shell URL 2022-01-24 11:35:39 +08:00
Sebastien Bourdeauducq f8e3f7a4ca add some basic list tests 2022-01-23 14:28:08 +08:00
Sebastien Bourdeauducq ba997ae094 flake: run nac3standalone demo checks
also keep auxiliary projects in separate Nix outputs
2022-01-23 11:32:34 +08:00
Sebastien Bourdeauducq 2a0caf931f nac3standalone: work around bash mess with exit codes of substituted processes
https://unix.stackexchange.com/questions/376114/how-to-detect-an-error-using-process-substitution
2022-01-23 11:15:11 +08:00
Sebastien Bourdeauducq 64b94955fe nac3standalone: reorganize demos, compare against cpython 2022-01-23 10:35:06 +08:00
Sebastien Bourdeauducq f478c6afcc update dependencies 2022-01-19 21:17:07 +08:00
ychenfo 0439bf6aef nac3artiq: fix errors of non-primitive object when running multiple kernels 2022-01-15 04:43:39 +08:00
Sebastien Bourdeauducq fd4bf12808 fix grammar of some type error messages 2022-01-14 16:56:23 +08:00
Sebastien Bourdeauducq d7b14dd705 update dependencies 2022-01-14 16:55:10 +08:00
ychenfo 9d342d9f0f nac3artiq: error msg improvement for synthesized __modinit__ 2022-01-14 16:28:37 +08:00
ychenfo ae8f82ccb0 nac3core: fix broken tests 2022-01-14 16:28:37 +08:00
ychenfo 4a1a4dc076 nac3core/artiq/standalone: symbol resolver return error msg for type error of host variables 2022-01-14 16:28:34 +08:00
ychenfo eba9fc8a69 nac3core: add missing location for type inference 2022-01-14 03:05:11 +08:00
ychenfo 4976e89ae2 nac3core: list slice support 2022-01-13 16:53:32 +08:00
Sebastien Bourdeauducq 82509d60ec remove obvious comment 2022-01-13 12:31:28 +08:00
ychenfo 2579ecbd19 nac3core: irrt module get attribute id using name instead of hard code 2022-01-11 17:25:07 +08:00
ychenfo 44f4c4f028 nac3core: build script use Path::join 2022-01-09 12:06:45 +08:00
Sebastien Bourdeauducq 8ef9e74aaf move rustfmt.toml upper 2022-01-09 11:31:06 +08:00
Sebastien Bourdeauducq 9c20e84c84 flake: fix/cleanup 2022-01-09 11:30:36 +08:00
Sebastien Bourdeauducq b88f17ed42 switch to clang-unwrapped, build IRRT with wasm32 2022-01-09 10:56:28 +08:00
Sebastien Bourdeauducq 096193f7ab demo: rewrite in Rust 2022-01-09 10:51:10 +08:00
ychenfo 4760851638 nac3standalone: link modules and load irrt like in nac3artiq 2022-01-09 02:17:58 +08:00
ychenfo 1ee857de6a nac3core: format, fix clippy warning 2022-01-09 01:12:18 +08:00
Sebastien Bourdeauducq 4a65d82db5 introduce IRRT, implement power
based on code by Yijia
M-Labs/nac3#160
2022-01-09 00:57:50 +08:00
Sebastien Bourdeauducq b638d1b4b0 nac3standalone: set up LLVM inliner like in nac3artiq 2022-01-08 21:03:58 +08:00
Sebastien Bourdeauducq 52ccf31bb1 update dependencies 2022-01-04 22:00:29 +08:00