1
0
forked from M-Labs/nac3
Commit Graph

67 Commits

Author SHA1 Message Date
9d9ead211e [core] Move Proxies to their own modules 2024-11-19 13:46:23 +08:00
a98f33e6d1 [meta] Reorganize order of use declarations - Phase 2
Some more rules:

- For module-level imports, prefer no prefix > super > crate.
- Use crate instead of super if super refers to the crate-level module
2024-10-17 15:57:33 +08:00
9fdbe9695d [core] Add generator to SymbolResolver::get_symbol_value
Needed in a future commit.
2024-10-04 13:20:29 +08:00
192290889b [core] Add IdentifierInfo
Keeps track of whether an identifier refers to a global or local
variable.
2024-10-04 13:20:24 +08:00
fe06b2806f [meta] Reorganize order of use declarations
Use declarations are now grouped into 4 groups:

- Declarations from the standard library
- Declarations from external crates
- Declarations from other crates in this project
- Declarations from within this module

Furthermore, all use declarations are grouped together to enhance
readability. super::super is also replaced by an equivalent crate::
declaration.
2024-10-04 12:52:01 +08:00
8fd7216243 [core] toplevel/composer: Add lateinit_builtins
This is required for the new core_log and rtio_log functions, which take
a generic type as its parameter. However, in ARTIQ builtins are
initialized using one unifier and then actually used by another unifier.

lateinit_builtins workaround this issue by deferring the initialization
of functions requiring type variables until the actual unifier is ready.
2024-08-13 15:19:03 +08:00
cbf79c5e9c core/typecheck/typedef: Add is_vararg to FuncArg, ConcreteFuncArg 2024-08-06 11:43:13 +08:00
0ba68f6657 core: Set target triple and datalayout for each module
Fixes an issue with inconsistent pointer sizes causing crashes.
2024-07-26 13:35:40 +08:00
82091b1be8 meta: Apply clippy changes 2024-06-17 14:10:31 +08:00
8168692cc3 apply cargo fmt 2024-06-12 14:45:03 +08:00
210d9e2334 core: Add more creator functions for ProxyType 2024-06-11 15:26:37 +08:00
13f06f3e29 core: Refactor VarMap to IndexMap
This is the only Map I can find that preserves insertion order while
also deduplicating elements by key.
2024-03-22 15:51:23 +08:00
77de24ef74 core: Use BTreeMap for type variable mapping
There have been multiple instances where I had the need to iterate over
type variables, only to discover that the traversal order is arbitrary.

This commit fixes that by adding SortedMapping, which utilizes BTreeMap
internally to guarantee a traversal order. All instances of VarMap are
now refactored to use this to ensure that type variables are iterated in
 the order of its variable ID, which should be monotonically incremented
 by the unifier.
2024-03-04 23:56:04 +08:00
12c0eed0a3 core: Fix compilation of tests 2024-01-17 09:49:49 +08:00
32746c37be core: Refactor to return errors by HashSet 2023-12-12 15:41:59 +08:00
bd3d67f3d6 artiq: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00
ab2360d7a0 core: Remove emit_llvm from CodeGenLLVMOptions
We instead output an LLVM bitcode file when the option is specified on
the command-line.
2023-09-22 17:16:29 +08:00
3e430b9b40 core: Fix missing changes for codegen tests
Apparently the changes were dropped after rebasing.
2023-09-22 17:16:21 +08:00
676d07657a core: Add target field to CodeGenLLVMOptions
For specifying the target machine options when optimizing and linking.

This field is currently unused but will be required in a future
commit.
2023-09-18 09:46:24 +08:00
3993a5cf3f core: Add LLVM options to WorkerRegistry 2023-09-12 10:57:05 +08:00
a022005183 nac3core: fix broken tests 2022-05-11 03:53:53 +08:00
1f5826d352 fix ternary if (#250)
Use store and load to handle if expression as the blocks might be changed when generating sub-expressions.

Reviewed-on: M-Labs/nac3#250
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-03-29 06:54:00 +08:00
26a4834254 fix warnings 2022-03-26 18:52:08 +08:00
63b0f29728 Fix broken tests 2022-03-05 00:27:51 +08:00
f97f93d92c applied rustfmt and clippy auto fix 2022-02-21 18:27:46 +08:00
d9cb506f6a nac3core: refactored for better error messages 2022-02-21 18:24:19 +08:00
352831b2ca nac3core: removed legacy location definition 2022-02-13 22:39:24 +08:00
b18626b149 Fix compilation and test failures 2022-02-12 22:50:32 +08:00
ae8f82ccb0 nac3core: fix broken tests 2022-01-14 16:28:37 +08:00
9b3b47ce50 fix broken tests 2021-12-28 01:38:16 +08:00
fa04768a77 redo "nac3core: fix #84"
This reverts commit 86005da8e1.
2021-12-27 22:56:26 +08:00
86005da8e1 Revert "nac3core: fix #84"
This reverts commit 0902d8adf4.
2021-12-26 08:35:27 +08:00
0902d8adf4 nac3core: fix #84 2021-12-23 15:26:48 +08:00
4b17511b4a Merge branch 'master' into KernelInvariant 2021-11-27 21:29:27 +08:00
4587088835 Constant Default Parameter Support (#98)
Add support for constant default parameter

Reviewed-on: M-Labs/nac3#98
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-11-23 07:32:09 +08:00
ba08deada6 nac3core: refactor codegen 2021-11-20 19:50:25 +08:00
bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +08:00
cc83bbc63a nac3core/codegen: fix broken test 2021-10-17 13:07:45 +08:00
279f47f633 nac3core/codegen: avoid sending unifiers
Previously, we have to copy types from one unification table to another,
and make the table sendable. This requires cloning (processing) the
whole table 3 times per function call which is not efficient and uses
more memory than required when the unification table is large.

We now use a concrete type table to only copy the type we need. This
reduces the overhead as we only need to process the unification table
for once (when we do the function codegen), and reduces memory usage by
a bit (but not noticeable when the unification table is small, i.e. the
types are simple).
2021-10-17 13:02:18 +08:00
1f5bea2448 nac3core/codegen: refactor according to #23 2021-10-16 22:17:36 +08:00
c4259d14d1 fixed some clippy warnings 2021-10-16 18:08:13 +08:00
11144301ca nac3artiq: added simple host value support 2021-10-06 16:07:42 +08:00
f0fdfe42cb nac3core: better impl of #24 2021-09-30 17:07:48 +08:00
d4ed76d76e nac3core: implementing #24 2021-09-26 22:17:09 +08:00
693ac7d336 nac3core/toplevel: added personality symbol config 2021-09-25 21:44:00 +08:00
7d48883583 fixed tests 2021-09-22 18:04:06 +08:00
084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
35a94a8fc0 nac3core: fix broken test 2021-09-20 01:58:07 +08:00
2b74895b71 nac3standalone, nac3core: can use top level composer to compile and run mandelbrot 2021-09-19 16:19:49 +08:00
2ac3f9a176 nac3core: separate top level compoer to a new file 2021-09-12 05:10:10 +08:00