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: 72b6cca9c32e
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: 787a1d34fe89
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 30, 2015

  1. validators.escape: infer correct region for arguments.

    whitequark committed Dec 30, 2015
    Copy the full SHA
    25e2824 View commit details
  2. transforms.llvm_ir_generator: don't crash when quoting over than one …

    …list.
    whitequark committed Dec 30, 2015
    Copy the full SHA
    787a1d3 View commit details
Showing with 12 additions and 4 deletions.
  1. +2 −1 artiq/compiler/transforms/llvm_ir_generator.py
  2. +3 −0 artiq/compiler/types.py
  3. +7 −3 artiq/compiler/validators/escape.py
3 changes: 2 additions & 1 deletion artiq/compiler/transforms/llvm_ir_generator.py
Original file line number Diff line number Diff line change
@@ -1058,7 +1058,8 @@ def _quote(self, value, typ, path):
lleltsary = ll.Constant(ll.ArrayType(self.llty_of_type(elt_type), len(llelts)),
llelts)

llglobal = ll.GlobalVariable(self.llmodule, lleltsary.type, "quoted.list")
llglobal = ll.GlobalVariable(self.llmodule, lleltsary.type,
self.llmodule.scope.deduplicate("quoted.list"))
llglobal.initializer = lleltsary
llglobal.linkage = "private"

3 changes: 3 additions & 0 deletions artiq/compiler/types.py
Original file line number Diff line number Diff line change
@@ -248,6 +248,9 @@ def __init__(self, args, optargs, ret):
def arity(self):
return len(self.args) + len(self.optargs)

def arg_names(self):
return list(self.args.keys()) + list(self.optargs.keys())

def find(self):
return self

10 changes: 7 additions & 3 deletions artiq/compiler/validators/escape.py
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ def _diagnostics_for(self, region, loc, descr="the value of the expression"):
loc)
]

def visit_in_region(self, node, region, typing_env):
def visit_in_region(self, node, region, typing_env, args=[]):
try:
old_youngest_region = self.youngest_region
self.youngest_region = region
@@ -221,7 +221,10 @@ def visit_in_region(self, node, region, typing_env):

for name in typing_env:
if has_region(typing_env[name]):
self.youngest_env[name] = Region(None) # not yet known
if name in args:
self.youngest_env[name] = self.youngest_region
else:
self.youngest_env[name] = Region(None) # not yet known
else:
self.youngest_env[name] = None # lives forever
self.env_stack.append(self.youngest_env)
@@ -237,7 +240,8 @@ def visit_ModuleT(self, node):

def visit_FunctionDefT(self, node):
self.youngest_env[node.name] = self.youngest_region
self.visit_in_region(node, Region(node.loc), node.typing_env)
self.visit_in_region(node, Region(node.loc), node.typing_env,
args=node.signature_type.find().arg_names())

def visit_ClassDefT(self, node):
self.youngest_env[node.name] = self.youngest_region