forked from M-Labs/artiq
compiler: Revert function call lifetime tracking fix
This reverts commitsf8d1506922
andcf19c9512d
. While the commit just fixes a clear typo in the implementation, it turns out the original algorithm isn't flexible enough to capture functions that transitively return references to long-lived data. For instance, while cache_get() is special-cased in the compiler to be recognised as returning a value of Global() lifetime, a function just forwarding to it (as seen in the embedding tests) isn't anymore. A separate issue is also that this makes implementing functions that take lists and return references to global data in user code impossible, which central parts of the Oxford codebase rely on. Just reverting for now to unblock master; a fix is easily designed, but needs testing.
This commit is contained in:
parent
709026d945
commit
ae999db8f6
@ -24,9 +24,6 @@ Highlights:
|
||||
* Core device: ``panic_reset 1`` now correctly resets the kernel CPU as well if
|
||||
communication CPU panic occurs.
|
||||
* NumberValue accepts a ``type`` parameter specifying the output as ``int`` or ``float``
|
||||
* In kernels, lifetime of allocated values (e.g. lists) is now correctly tracked across
|
||||
function calls (see #1497, #1394). Previous versions (since ARTIQ 1.0) would accept
|
||||
illegal code that would result in silent memory corruption at runtime.
|
||||
|
||||
Breaking changes:
|
||||
|
||||
|
@ -103,7 +103,7 @@ class RegionOf(algorithm.Visitor):
|
||||
# The cache is borrow checked dynamically
|
||||
return Global()
|
||||
else:
|
||||
return self.visit_sometimes_allocating(node)
|
||||
self.visit_sometimes_allocating(node)
|
||||
|
||||
# Value lives as long as the object/container, if it's mutable,
|
||||
# or else forever
|
||||
|
@ -1,14 +0,0 @@
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.experiment import *
|
||||
|
||||
@kernel
|
||||
def leak(a):
|
||||
return a
|
||||
|
||||
@kernel
|
||||
def entrypoint():
|
||||
# CHECK-L: ${LINE:+2}: error: cannot return an allocated value that does not live forever
|
||||
# CHECK-L: ${LINE:+1}: note: ... to this point
|
||||
return leak([1, 2, 3])
|
Loading…
Reference in New Issue
Block a user