Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 72a3a12d529a
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4198601abb4d
Choose a head ref
  • 3 commits
  • 6 files changed
  • 1 contributor

Commits on Jan 10, 2016

  1. Remove redundant ksupport API.

    whitequark committed Jan 10, 2016
    Copy the full SHA
    f8e50f2 View commit details
  2. validators.escape: cache_get result lives forever.

    whitequark committed Jan 10, 2016
    Copy the full SHA
    211af77 View commit details
  3. coredevice.exceptions: add CacheError.

    whitequark committed Jan 10, 2016
    Copy the full SHA
    4198601 View commit details
Showing with 18 additions and 18 deletions.
  1. +7 −2 artiq/compiler/types.py
  2. +7 −1 artiq/compiler/validators/escape.py
  3. +0 −8 artiq/coredevice/core.py
  4. +4 −0 artiq/coredevice/exceptions.py
  5. +0 −6 artiq/runtime/ksupport.c
  6. +0 −1 artiq/runtime/ksupport.h
9 changes: 7 additions & 2 deletions artiq/compiler/types.py
Original file line number Diff line number Diff line change
@@ -610,8 +610,13 @@ def is_function(typ):
def is_rpc_function(typ):
return isinstance(typ.find(), TRPCFunction)

def is_c_function(typ):
return isinstance(typ.find(), TCFunction)
def is_c_function(typ, name=None):
typ = typ.find()
if name is None:
return isinstance(typ, TCFunction)
else:
return isinstance(typ, TCFunction) and \
typ.name == name

def is_builtin(typ, name=None):
typ = typ.find()
8 changes: 7 additions & 1 deletion artiq/compiler/validators/escape.py
Original file line number Diff line number Diff line change
@@ -87,7 +87,13 @@ def visit_sometimes_allocating(self, node):
return None

visit_BinOpT = visit_sometimes_allocating
visit_CallT = visit_sometimes_allocating

def visit_CallT(self, node):
if types.is_c_function(node.func.type, "cache_get"):
# The cache is borrow checked dynamically
return None
else:
self.visit_sometimes_allocating(node)

# Value lives as long as the object/container, if it's mutable,
# or else forever
8 changes: 0 additions & 8 deletions artiq/coredevice/core.py
Original file line number Diff line number Diff line change
@@ -45,10 +45,6 @@ def cache_get(key: TStr) -> TList(TInt32):
def cache_put(key: TStr, value: TList(TInt32)):
raise NotImplementedError("syscall not simulated")

@syscall
def cache_clear(key: TStr):
raise NotImplementedError("syscall not simulated")

class Core:
"""Core device driver.
@@ -128,7 +124,3 @@ def get_cache(self, key):
@kernel
def put_cache(self, key, value):
return cache_put(key, value)

@kernel
def clear_cache(self, key):
return cache_clear(key)
4 changes: 4 additions & 0 deletions artiq/coredevice/exceptions.py
Original file line number Diff line number Diff line change
@@ -11,6 +11,10 @@ class InternalError(Exception):
"""Raised when the runtime encounters an internal error condition."""


class CacheError(Exception):
"""Raised when putting a value into a cache row would violate memory safety."""


class RTIOUnderflow(Exception):
"""Raised when the CPU fails to submit a RTIO event early enough
(with respect to the event's timestamp).
6 changes: 0 additions & 6 deletions artiq/runtime/ksupport.c
Original file line number Diff line number Diff line change
@@ -124,7 +124,6 @@ static const struct symbol runtime_exports[] = {

{"cache_get", &cache_get},
{"cache_put", &cache_put},
{"cache_clear", &cache_clear},

/* end */
{NULL, NULL}
@@ -492,11 +491,6 @@ void cache_put(const char *key, struct artiq_list value)
}
}

void cache_clear(const char *key)
{
cache_put(key, (struct artiq_list) { 0, NULL });
}

void lognonl(const char *fmt, ...)
{
struct msg_log request;
1 change: 0 additions & 1 deletion artiq/runtime/ksupport.h
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ void send_rpc(int service, const char *tag, ...);
int recv_rpc(void *slot);
struct artiq_list cache_get(const char *key);
void cache_put(const char *key, struct artiq_list value);
void cache_clear(const char *key);
void lognonl(const char *fmt, ...);
void log(const char *fmt, ...);