コード例 #1
0
ファイル: test_support.py プロジェクト: sbw111/lab4
def gen_check(input):
    for _, dst, src in input:
        print 'input:', dst, src
    result = ' '.join(gen_assignments(input))
    print result
    result = result.replace('{ int', '').replace('}', '').strip()
    d = {}
    for _, dst, src in input:
        d[src] = '<value of %s>' % (src, )
    exec result in d
    for _, dst, src in input:
        assert d[dst] == '<value of %s>' % (src, )
コード例 #2
0
ファイル: test_support.py プロジェクト: Darriall/pypy
def gen_check(input):
    for _, dst, src in input:
        print 'input:', dst, src
    result = ' '.join(gen_assignments(input))
    print result
    result = result.replace('{ int', '').replace('}', '').strip()
    d = {}
    for _, dst, src in input:
        d[src] = '<value of %s>' % (src,)
    exec result in d
    for _, dst, src in input:
        assert d[dst] == '<value of %s>' % (src,)
コード例 #3
0
ファイル: funcgen.py プロジェクト: zcxowwww/pypy
 def gen_link(self, link):
     "Generate the code to jump across the given Link."
     assignments = []
     for a1, a2 in zip(link.args, link.target.inputargs):
         a2type, a2typename = self.illtypes[a2]
         if a2type is Void:
             continue
         src = self.expr(a1)
         dest = LOCALVAR % a2.name
         assignments.append((a2typename, dest, src))
     for line in gen_assignments(assignments):
         yield line
     for line in self.gen_goto(link.target, link):
         yield line
コード例 #4
0
ファイル: funcgen.py プロジェクト: mozillazg/pypy
 def gen_link(self, link):
     "Generate the code to jump across the given Link."
     assignments = []
     for a1, a2 in zip(link.args, link.target.inputargs):
         a2type, a2typename = self.illtypes[a2]
         if a2type is Void:
             continue
         src = self.expr(a1)
         dest = LOCALVAR % a2.name
         assignments.append((a2typename, dest, src))
     for line in gen_assignments(assignments):
         yield line
     for line in self.gen_goto(link.target, link):
         yield line
コード例 #5
0
ファイル: funcgen.py プロジェクト: yuyichao/pypy
 def gen_link(self, link):
     "Generate the code to jump across the given Link."
     assignments = []
     for a1, a2 in zip(link.args, link.target.inputargs):
         a2type, a2typename = self.illtypes[a2]
         if a2type is Void:
             continue
         src = self.expr(a1)
         dest = LOCALVAR % a2.name
         assignments.append((a2typename, dest, src))
     for line in gen_assignments(assignments):
         yield line
     label = 'block%d' % self.blocknum[link.target]
     if link.target in self.innerloops:
         loop = self.innerloops[link.target]
         if link is loop.links[-1]:   # link that ends a loop
             label += '_back'
     yield 'goto %s;' % label
コード例 #6
0
 def gen_link(self, link):
     "Generate the code to jump across the given Link."
     assignments = []
     for a1, a2 in zip(link.args, link.target.inputargs):
         a2type, a2typename = self.illtypes[a2]
         if a2type is Void:
             continue
         src = self.expr(a1)
         dest = LOCALVAR % a2.name
         assignments.append((a2typename, dest, src))
     for line in gen_assignments(assignments):
         yield line
     label = 'block%d' % self.blocknum[link.target]
     if link.target in self.innerloops:
         loop = self.innerloops[link.target]
         if link is loop.links[-1]:  # link that ends a loop
             label += '_back'
     yield 'goto %s;' % label