The type checker/inferer visits every node in an AST tree, including
function return annotations. This means for a function definition like
def f() -> TTuple([TInt32, TBool]):
...
We attempt to type check the list [TInt32, TBool], which generates the
unification constraint builtins.TBool ~ builtins.TInt. This causes an
internal error due to compiler weirdness.
We can avoid this by just nulling-out the return annotation in the
embedding stage. The return type isn't actually used anywhere (it's
extracted via the inspect module instead), so this is entirely safe.
Arguments aren't affected by this, as we already nulled out the
annotation (see visit_arg in embedding.py).
Signed-off-by: Jonathan Coates <jonathan.coates@oxionics.com>
The original fix in 21574bdfa9
was incomplete, as it only addressed the TInstance types, but
not their linked (typ.constructor) TConstructor instances.
This would (potentially among other issues) cause assertion
errors in llvm_ir_generator due to the wrong associated globals
being referenced; see added test case for an example that
previously caused such a crash.
Also modified the name collision detection from O(len(type_map))
(so quadratic overall in the number of custom types) to cache
names in sets for O(1) lookup.
Receiving an empty string in an RPC call currently panics.
When `length` is zero, a call to the `alloc` function (as implemented in `artiq/firmware/runtime/session.rs`) returns a null pointer. Constructing a `CMutSlice` from a null pointer panics.
A `CMutSlice` consists of a pointer and the length. Rust's documentation of the `core::ptr` module states: "The canonical way to obtain a pointer that is valid for zero-sized accesses is `NonNull::dangling`."
This commits adds a check for the length of a string received in an RPC call. Only for lengths greater than zero a memory allocation is performed. For zero-length strings, a dangling pointer is used.
Test plan:
Invoke the following experiment, which returns an empty string over RPC:
```
class ReturnEmptyString(artiq.experiment.EnvExperiment):
def build(self):
self.core: Core = self.get_device("core")
@kernel
def run(self):
x = self.do_rpc()
print(x)
@rpc
def do_rpc(self) -> TStr:
return ""
```
Signed-off-by: Sven Over (Oxford Ionics) <sven.over@oxionics.com>
The changes are backported from PR2128.
Org Problem: DRIO cannot establish connections with satellite after updatting
the IBUFDS_GTE2 parameters on commit d6704d30e9.
Description of Changes:
- CPLL Parameters are added.
- CEB signal of IBUFDS_GTE2 is asserted by NOT(OR(stable_clkin, GTX CPLL Locked)).
- Modify the GTX Init FSM so that the PLL Reset and GTX Reset are done in two seperated state.
- Restart of GTX module now only resets GTX transceiver.
Lists are passed by-reference from python code, and so should be
&CSlice<_> not CSlice<_>.
Signed-off-by: Jonathan Coates <jonathan.coates@oxionics.com>
This would have made the issue in the pre-740543d4e code
much more obvious (the config option by itself does not
have any effect on the choice of active reference input).
Commit 740543d4e2 had unintentionally broken DRTIO
satellites, as si5324::setup is also used there. This
imports setup_si5324_as_synthesizer() from artiq-zynq,
where the input selection was already explicitly done.
GitHub: Fixes#2028.
better comments and address translation
fix spurious };
unwrap init in runtime and return err instead of panic
propagate error
del unnecessary use
Signed-off-by: SingularitySurfer <Norman_Krackow@gmx.de>
This caused sporadic LoadFaults with LLD 14 and above, as they
happened to lay out the (not otherwise mentioned) GOT/PLT such
that they would overlap with the stack guard page.
LLD does support the --orphan-handling=error option, which
would be useful to avoid similar problems in the future, but
then we'd need to mention all the other misc sections
(symbol table, comments) in the linker script as well.
GitHub: Fixes#1975.
Also factors out duplicate code for (de)serializing
elements of lists and ndarrays, and replaces the rounding
calculations by the well-known, much faster power-of-two-only
bit-twiddling version.
GitHub: Fixes#1934.