From noreply at buildbot.pypy.org Mon Nov 2 04:47:04 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Mon, 2 Nov 2015 10:47:04 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: first loop correctly assembled. it is correctly entered, correctly calulating the counter variable and cleanly exiting back to the VM Message-ID: <20151102094704.5E6821C120F@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80497:6fbf6c1ae931 Date: 2015-11-02 10:43 +0100 http://bitbucket.org/pypy/pypy/changeset/6fbf6c1ae931/ Log: first loop correctly assembled. it is correctly entered, correctly calulating the counter variable and cleanly exiting back to the VM diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -456,7 +456,9 @@ def _push_fp_regs_to_jitframe(self, mc, includes=r.MANAGED_FP_REGS): base_ofs = self.cpu.get_baseofs_of_frame_field() assert len(includes) == 16 - mc.LMG(r.r0, r.r15, l.addr(base_ofs, r.SPP)) + v = 16 + for i,reg in enumerate(includes): + mc.STD(reg, l.addr(base_ofs + (v+i) * WORD, r.SPP)) # ________________________________________ # ASSEMBLER EMISSION diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -110,7 +110,7 @@ print "reserve!", self.get_relative_pos() self.BRC(l.imm(0x0), l.imm(0)) - def cmp_op(self, a, b, pool=False, signed=True, fp=False): + def cmp_op(self, a, b, pool=False, imm=False, signed=True, fp=False): if fp == True: xxx self.fcmpu(a, b) @@ -119,6 +119,8 @@ if pool: # 64 bit immediate signed self.CLG(a, b) + elif imm: + self.CGHI(a, b) else: # 64 bit signed self.CLGR(a, b) @@ -126,6 +128,8 @@ if pool: # 64 bit immediate unsigned self.CG(a, b) + elif imm: + raise NotImplementedError else: # 64 bit unsigned self.CGR(a, b) diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -1,15 +1,28 @@ +from rpython.jit.backend.zarch import locations as loc +from rpython.rlib.objectmodel import specialize -from rpython.jit.backend.zarch import locations as loc EQ = loc.imm(0x8) LT = loc.imm(0x4) GT = loc.imm(0x2) +OF = loc.imm(0x1) LE = loc.imm(EQ.value | LT.value) GE = loc.imm(EQ.value | GT.value) NE = loc.imm(LT.value | GT.value) -OVERFLOW = loc.imm(0x1) cond_none = loc.imm(0x0) -def negate(cond): - return cond + at specialize.arg(1) +def negate(cond, inv_overflow=False): + overflow = cond.value & 0x1 + if inv_overflow: + assert False + value = (~cond.value) & 0xe + return loc.imm(value | overflow) + +assert negate(EQ).value == NE.value +assert negate(NE).value == EQ.value +assert negate(LT).value == GE.value +assert negate(LE).value == GT.value +assert negate(GT).value == LE.value +assert negate(GE).value == LT.value diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py --- a/rpython/jit/backend/zarch/helper/assembler.py +++ b/rpython/jit/backend/zarch/helper/assembler.py @@ -39,7 +39,7 @@ l1 = arglocs[1] assert not l0.is_imm() # do the comparison - self.mc.cmp_op(l0, l1, pool=l1.is_in_pool(), signed=signed, fp=fp) + self.mc.cmp_op(l0, l1, pool=l1.is_in_pool(), imm=l1.is_imm(), signed=signed, fp=fp) # CR bits: # 0: LT diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -28,6 +28,7 @@ 'CG': ('rxy', ['\xE3','\x20']), 'CLGR': ('rre', ['\xB9','\x21']), 'CLG': ('rxy', ['\xE3','\x20']), + 'CGHI': ('ri', ['\xA7','\x0F']), } logic_mnemonic_codes = { From noreply at buildbot.pypy.org Mon Nov 2 06:12:43 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 12:12:43 +0100 (CET) Subject: [pypy-commit] pypy default: Issue #2180: fix. The problem shows up as missing 'same_as', and these Message-ID: <20151102111243.CA1A81C071E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80498:dfb609e46b95 Date: 2015-11-02 11:16 +0000 http://bitbucket.org/pypy/pypy/changeset/dfb609e46b95/ Log: Issue #2180: fix. The problem shows up as missing 'same_as', and these places pass for some reason an empty list instead of 'extra_same_as', so I think this fix has chances to be correct. I fail completely at designing the correct tests, though. diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -186,12 +186,12 @@ except InvalidLoop: # inlining short preamble failed, jump to preamble self.jump_to_preamble(celltoken, end_jump, info) - return (UnrollInfo(target_token, label_op, [], + return (UnrollInfo(target_token, label_op, extra_same_as, self.optimizer.quasi_immutable_deps), self.optimizer._newoperations) if new_virtual_state is not None: self.jump_to_preamble(celltoken, end_jump, info) - return (UnrollInfo(target_token, label_op, [], + return (UnrollInfo(target_token, label_op, extra_same_as, self.optimizer.quasi_immutable_deps), self.optimizer._newoperations) From noreply at buildbot.pypy.org Mon Nov 2 06:25:47 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Mon, 2 Nov 2015 12:25:47 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: adding trap2 instruction, skeletal structure to assemble a bridge, allocating additional space in pool if a 64bit jump is needed (e.g. bridge jump to loop token of already compiled loop) Message-ID: <20151102112547.136E61C120F@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80499:468121ce68fa Date: 2015-11-02 12:25 +0100 http://bitbucket.org/pypy/pypy/changeset/468121ce68fa/ Log: adding trap2 instruction, skeletal structure to assemble a bridge, allocating additional space in pool if a 64bit jump is needed (e.g. bridge jump to loop token of already compiled loop) diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -210,6 +210,8 @@ del looptoken._x86_ops_offset # else it's kept alive if hasattr(looptoken, '_ppc_ops_offset'): del looptoken._ppc_ops_offset # else it's kept alive + if hasattr(looptoken, '_zarch_ops_offset'): + del looptoken._ppc_ops_offset # else it's kept alive del loop gc.collect() assert not wr_i1() and not wr_guard() diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -25,6 +25,7 @@ from rpython.rlib import rgc from rpython.rlib.longlong2float import float2longlong from rpython.rtyper.lltypesystem import lltype, rffi, llmemory +from rpython.rlib.jit import AsmInfo class AssemblerZARCH(BaseAssembler, IntOpAssembler, FloatOpAssembler, @@ -201,6 +202,25 @@ mc.cmp_op(0, r.SCRATCH.value, r.SCRATCH2.value, signed=False) mc.bgtctrl() + def _check_frame_depth(self, mc, gcmap): + """ check if the frame is of enough depth to follow this bridge. + Otherwise reallocate the frame in a helper. + """ + descrs = self.cpu.gc_ll_descr.getframedescrs(self.cpu) + ofs = self.cpu.unpack_fielddescr(descrs.arraydescr.lendescr) + mc.LG(r.r2, l.addr(ofs, r.SPP)) + patch_pos = mc.currpos() + mc.TRAP2() # placeholder for cmpdi(0, r2, ...) + mc.TRAP2() # placeholder for bge + mc.TRAP2() # placeholder for li(r0, ...) + #mc.load_imm(r.SCRATCH2, self._frame_realloc_slowpath) + #mc.mtctr(r.SCRATCH2.value) + #self.load_gcmap(mc, r.r2, gcmap) + #mc.bctrl() + + self.frame_depth_to_patch.append((patch_pos, mc.currpos())) + + @rgc.no_release_gil def assemble_loop(self, jd_id, unique_id, logger, loopname, inputargs, operations, looptoken, log): @@ -228,7 +248,7 @@ operations = regalloc.prepare_loop(inputargs, operations, looptoken, clt.allgcrefs) looppos = self.mc.get_relative_pos() - self.pool.pre_assemble(self.mc, operations) + self.pool.pre_assemble(self, operations) frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, operations) self.update_frame_depth(frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) @@ -262,6 +282,64 @@ logger.log_loop(inputargs, operations, 0, "rewritten", name=loopname, ops_offset=ops_offset) + self.fixup_target_tokens(rawstart) + self.teardown() + # oprofile support + #if self.cpu.profile_agent is not None: + # name = "Loop # %s: %s" % (looptoken.number, loopname) + # self.cpu.profile_agent.native_code_written(name, + # rawstart, full_size) + return AsmInfo(ops_offset, rawstart + looppos, + size_excluding_failure_stuff - looppos) + + @rgc.no_release_gil + def assemble_bridge(self, faildescr, inputargs, operations, + original_loop_token, log, logger): + if not we_are_translated(): + # Arguments should be unique + assert len(set(inputargs)) == len(inputargs) + + self.setup(original_loop_token) + descr_number = compute_unique_id(faildescr) + if log: + operations = self._inject_debugging_code(faildescr, operations, + 'b', descr_number) + + arglocs = self.rebuild_faillocs_from_descr(faildescr, inputargs) + regalloc = Regalloc(assembler=self) + startpos = self.mc.get_relative_pos() + operations = regalloc.prepare_bridge(inputargs, arglocs, + operations, + self.current_clt.allgcrefs, + self.current_clt.frame_info) + self._check_frame_depth(self.mc, regalloc.get_gcmap()) + frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, operations) + codeendpos = self.mc.get_relative_pos() + self.write_pending_failure_recoveries() + fullsize = self.mc.get_relative_pos() + # + self.patch_stack_checks(frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) + rawstart = self.materialize_loop(original_loop_token) + debug_bridge(descr_number, rawstart, codeendpos) + self.patch_pending_failure_recoveries(rawstart) + # patch the jump from original guard + self.patch_jump_for_descr(faildescr, rawstart) + ops_offset = self.mc.ops_offset + frame_depth = max(self.current_clt.frame_info.jfi_frame_depth, + frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) + if logger: + logger.log_bridge(inputargs, operations, "rewritten", + ops_offset=ops_offset) + self.fixup_target_tokens(rawstart) + self.update_frame_depth(frame_depth) + self.teardown() + return AsmInfo(ops_offset, startpos + rawstart, codeendpos - startpos) + + def fixup_target_tokens(self, rawstart): + for targettoken in self.target_tokens_currently_compiling: + targettoken._ll_loop_code += rawstart + self.target_tokens_currently_compiling = None + def _assemble(self, regalloc, inputargs, operations): self._regalloc = regalloc self.guard_success_cc = c.cond_none diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -45,6 +45,8 @@ self.counter += 4 def impl(func): func._arguments_ = args_str.split(',') + if args_str == '': + func._arguments_ = [] args = [dummy_argument(a) for a in func._arguments_] c = Counter() # invoke it once and get the amount of bytes @@ -103,6 +105,13 @@ mc.writechar(chr(byte)) mc.writechar(chr(displace & 0xff)) +def build_e(mnemonic, (opcode1,opcode2)): + @builder.arguments('') + def encode_e(self): + self.writechar(opcode1) + self.writechar(opcode2) + return encode_e + def build_i(mnemonic, (opcode,)): @builder.arguments('u8') def encode_i(self, imm): diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -168,6 +168,7 @@ 'CDB': ('rxe', ['\xED','\x19'], 'r,bidl,-'), } +# MISC all_mnemonic_codes = { # 'BXH': ('rs', ['\x86']), @@ -184,6 +185,7 @@ 'PKA': ('ssf', ['\xE9']), 'SVC': ('i', ['\x0A']), + 'TRAP2': ('e', ['\x01','\xFF']), } all_mnemonic_codes.update(arith_mnemonic_codes) all_mnemonic_codes.update(logic_mnemonic_codes) diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -13,12 +13,17 @@ self.pool_start = 0 self.offset_map = {} - def ensure_can_hold_constants(self, op): + def ensure_can_hold_constants(self, asm, op): if op.is_guard(): # 1x gcmap pointer # 1x target address self.offset_map[op.getdescr()] = self.size self.reserve_literal(2 * 8) + if op.getopnum() == rop.JUMP: + descr = op.getdescr() + if descr not in asm.target_tokens_currently_compiling: + # this is a 'long' jump instead of a relative jump + self.reserve_literal(8) for arg in op.getarglist(): if arg.is_constant(): self.offset_map[arg] = self.size @@ -33,7 +38,8 @@ self.size = 0 self.offset = 0 - def walk_operations(self, operations): + def pre_assemble(self, asm, operations): + self.reset() # O(len(operations)). I do not think there is a way # around this. # @@ -49,20 +55,16 @@ # located at register r13. This one can easily offset with 20 # bit signed values (should be enough) for op in operations: - self.ensure_can_hold_constants(op) - - def pre_assemble(self, mc, operations): - self.reset() - self.walk_operations(operations) + self.ensure_can_hold_constants(asm, op) if self.size == 0: # no pool needed! return if self.size % 2 == 1: self.size += 1 assert self.size < 2**16-1 - mc.BRAS(r.POOL, l.imm(self.size+mc.BRAS._byte_count)) + asm.mc.BRAS(r.POOL, l.imm(self.size+mc.BRAS._byte_count)) self.pool_start = mc.get_relative_pos() - mc.write('\x00' * self.size) + asm.mc.write('\x00' * self.size) print "pool with %d quad words" % (self.size // 8) def overwrite_64(self, mc, index, value): diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py --- a/rpython/jit/backend/zarch/runner.py +++ b/rpython/jit/backend/zarch/runner.py @@ -38,3 +38,11 @@ @rgc.no_release_gil def finish_once(self): self.assembler.finish_once() + + def compile_bridge(self, faildescr, inputargs, operations, + original_loop_token, log=True, logger=None): + clt = original_loop_token.compiled_loop_token + clt.compiling_a_bridge() + return self.assembler.assemble_bridge(faildescr, inputargs, operations, + original_loop_token, log, logger) + From noreply at buildbot.pypy.org Mon Nov 2 07:48:48 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 2 Nov 2015 13:48:48 +0100 (CET) Subject: [pypy-commit] pypy default: test, fix failure in ndarray creation from list of unicodes Message-ID: <20151102124848.6EB291C120F@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80500:058bbfa7fe93 Date: 2015-11-02 14:39 +0200 http://bitbucket.org/pypy/pypy/changeset/058bbfa7fe93/ Log: test, fix failure in ndarray creation from list of unicodes diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -669,14 +669,17 @@ raise oefmt(space.w_NotImplementedError, "astype(%s) not implemented yet", new_dtype.get_name()) - if new_dtype.is_str() and new_dtype.elsize == 0: + if new_dtype.is_str_or_unicode() and new_dtype.elsize == 0: elsize = 0 + ch = new_dtype.char itype = cur_dtype.itemtype for i in range(self.get_size()): - elsize = max(elsize, len(itype.str_format(self.implementation.getitem(i), add_quotes=False))) + elsize = max(elsize, space.len_w(itype.to_builtin_type(space, self.implementation.getitem(i)))) new_dtype = descriptor.variable_dtype( - space, 'S' + str(elsize)) - + space, ch + str(elsize)) + if new_dtype.elsize == 0: + # XXX Should not happen + raise oefmt(space.w_ValueError, "new dtype has elsize of 0") if not can_cast_array(space, self, new_dtype, casting): raise oefmt(space.w_TypeError, "Cannot cast array from %s to %s" "according to the rule %s", diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py --- a/pypy/module/micronumpy/test/test_object_arrays.py +++ b/pypy/module/micronumpy/test/test_object_arrays.py @@ -174,6 +174,11 @@ b = a.astype('S') assert b.dtype == 'S100' assert 'a' * 100 in str(b) + a = np.array([u'a' * 100], dtype='O') + assert 'a' * 100 in str(a) + b = a.astype('U') + assert b.dtype == 'U100' + a = np.array([123], dtype='U') assert a[0] == u'123' b = a.astype('O') From noreply at buildbot.pypy.org Mon Nov 2 07:48:50 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 2 Nov 2015 13:48:50 +0100 (CET) Subject: [pypy-commit] pypy default: document branch Message-ID: <20151102124850.A297B1C120F@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80501:7b27fd1568e6 Date: 2015-11-02 14:48 +0200 http://bitbucket.org/pypy/pypy/changeset/7b27fd1568e6/ Log: document branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -5,4 +5,6 @@ .. this is a revision shortly after release-4.0.0 .. startrev: 57c9a47c70f6 +.. branch: 2174-fix-osx-10-11-translation +Use pkg-config to find ssl headers on OS-X From noreply at buildbot.pypy.org Mon Nov 2 10:16:48 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 16:16:48 +0100 (CET) Subject: [pypy-commit] cffi default: Fix the error we get for 'int f(unknown_type); ' Message-ID: <20151102151648.CC3F31C120F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2363:e6500be6fdfb Date: 2015-11-02 16:17 +0100 http://bitbucket.org/cffi/cffi/changeset/e6500be6fdfb/ Log: Fix the error we get for 'int f(unknown_type);' diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -456,6 +456,13 @@ def _parse_function_type(self, typenode, funcname=None): params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise api.CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) ellipsis = ( len(params) > 0 and isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -272,6 +272,13 @@ ffi = FFI() ffi.cdef("typedef _Bool bool; void f(bool);") +def test_unknown_argument_type(): + ffi = FFI() + e = py.test.raises(CDefError, ffi.cdef, "void f(foobarbazzz);") + assert str(e.value) == ("f arg 1: unknown type 'foobarbazzz' (if you meant" + " to use the old C syntax of giving untyped" + " arguments, it is not supported)") + def test_void_renamed_as_only_arg(): ffi = FFI() ffi.cdef("typedef void void_t1;" From noreply at buildbot.pypy.org Mon Nov 2 10:38:47 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 2 Nov 2015 16:38:47 +0100 (CET) Subject: [pypy-commit] pypy default: test, fix __array_interface__ for non-compliant keys and values Message-ID: <20151102153847.7C21A1C148B@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80502:62330b3e9b7f Date: 2015-11-02 16:39 +0200 http://bitbucket.org/pypy/pypy/changeset/62330b3e9b7f/ Log: test, fix __array_interface__ for non-compliant keys and values diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -44,30 +44,43 @@ def try_interface_method(space, w_object): try: w_interface = space.getattr(w_object, space.wrap("__array_interface__")) - except OperationError, e: + if w_interface is None: + return None + version_w = space.finditem(w_interface, space.wrap("version")) + if version_w is None: + raise oefmt(space.w_ValueError, "__array_interface__ found without" + " 'version' key") + if not space.isinstance_w(version_w, space.w_int): + raise oefmt(space.w_ValueError, "__array_interface__ found with" + " non-int 'version' key") + version = space.int_w(version_w) + if version < 3: + raise oefmt(space.w_ValueError, + "__array_interface__ version %d not supported", version) + # make a view into the data + w_shape = space.finditem(w_interface, space.wrap('shape')) + w_dtype = space.finditem(w_interface, space.wrap('typestr')) + w_descr = space.finditem(w_interface, space.wrap('descr')) + w_data = space.finditem(w_interface, space.wrap('data')) + w_strides = space.finditem(w_interface, space.wrap('strides')) + if w_shape is None or w_dtype is None: + raise oefmt(space.w_ValueError, + "__array_interface__ missing one or more required keys: shape, typestr" + ) + raise oefmt(space.w_NotImplementedError, + "creating array from __array_interface__ not supported yet") + ''' + data_w = space.listview() + shape = [space.int_w(i) for i in space.listview(w_shape)] + dtype = descriptor.decode_w_dtype(space, w_dtype) + rw = space.is_true(data_w[1]) + ''' + #print 'create view from shape',shape,'dtype',dtype,'descr',w_descr,'data',data_w[0],'rw',rw + return None + except OperationError as e: if e.match(space, space.w_AttributeError): return None raise - if w_interface is None: - # happens from compile.py - return None - version = space.int_w(space.finditem(w_interface, space.wrap("version"))) - if version < 3: - raise oefmt(space.w_NotImplementedError, - "__array_interface__ version %d not supported", version) - # make a view into the data - w_shape = space.finditem(w_interface, space.wrap('shape')) - w_dtype = space.finditem(w_interface, space.wrap('typestr')) - w_descr = space.finditem(w_interface, space.wrap('descr')) - data_w = space.listview(space.finditem(w_interface, space.wrap('data'))) - w_strides = space.finditem(w_interface, space.wrap('strides')) - shape = [space.int_w(i) for i in space.listview(w_shape)] - dtype = descriptor.decode_w_dtype(space, w_dtype) - rw = space.is_true(data_w[1]) - #print 'create view from shape',shape,'dtype',dtype,'descr',w_descr,'data',data_w[0],'rw',rw - raise oefmt(space.w_NotImplementedError, - "creating array from __array_interface__ not supported yet") - return @unwrap_spec(ndmin=int, copy=bool, subok=bool) diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -3073,6 +3073,18 @@ c_data = c.__array_interface__['data'][0] assert b_data + 3 * b.dtype.itemsize == c_data + class Dummy(object): + def __init__(self, aif=None): + if aif: + self.__array_interface__ = aif + + a = array(Dummy()) + assert a.dtype == object + raises(ValueError, array, Dummy({'xxx': 0})) + raises(ValueError), array, Dummy({'version': 0})) + raises(ValueError, array, Dummy({'version': 'abc'})) + raises(ValueError, array, Dummy({'version': 3})) + def test_array_indexing_one_elem(self): from numpy import array, arange raises(IndexError, 'arange(3)[array([3.5])]') From noreply at buildbot.pypy.org Mon Nov 2 15:52:02 2015 From: noreply at buildbot.pypy.org (cfbolz) Date: Mon, 2 Nov 2015 21:52:02 +0100 (CET) Subject: [pypy-commit] pypy default: hopefully fix the set failures Message-ID: <20151102205202.7941B1C120F@cobra.cs.uni-duesseldorf.de> Author: Carl Friedrich Bolz Branch: Changeset: r80503:175220886e4c Date: 2015-11-02 21:32 +0100 http://bitbucket.org/pypy/pypy/changeset/175220886e4c/ Log: hopefully fix the set failures (there's some weird other problem) diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py --- a/pypy/objspace/std/setobject.py +++ b/pypy/objspace/std/setobject.py @@ -1651,12 +1651,19 @@ w_set.sstorage = strategy.get_empty_storage() tp = space.type(w_iterable) - for w_item in space.iteriterable(w_iterable): + + w_iter = space.iter(w_iterable) + while True: + try: + w_item = space.next(w_iter) + except OperationError, e: + if not e.match(space, space.w_StopIteration): + raise + return create_set_driver.jit_merge_point(tp=tp, strategy=w_set.strategy) w_set.add(w_item) - init_signature = Signature(['some_iterable'], None, None) init_defaults = [None] def _initialize_set(space, w_obj, w_iterable=None): diff --git a/pypy/objspace/std/test/test_setobject.py b/pypy/objspace/std/test/test_setobject.py --- a/pypy/objspace/std/test/test_setobject.py +++ b/pypy/objspace/std/test/test_setobject.py @@ -996,3 +996,9 @@ s = set([1, 2, 3]) s.intersection_update(set()) assert strategy(s) == "EmptySetStrategy" + + def test_weird_exception_from_iterable(self): + def f(): + raise ValueError + yield 1 + raises(ValueError, set, f()) From noreply at buildbot.pypy.org Mon Nov 2 15:52:04 2015 From: noreply at buildbot.pypy.org (cfbolz) Date: Mon, 2 Nov 2015 21:52:04 +0100 (CET) Subject: [pypy-commit] pypy default: remove leftover line Message-ID: <20151102205204.941381C120F@cobra.cs.uni-duesseldorf.de> Author: Carl Friedrich Bolz Branch: Changeset: r80504:0071c13198cf Date: 2015-11-02 21:44 +0100 http://bitbucket.org/pypy/pypy/changeset/0071c13198cf/ Log: remove leftover line diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py --- a/pypy/objspace/std/setobject.py +++ b/pypy/objspace/std/setobject.py @@ -1646,7 +1646,6 @@ reds='auto') def _create_from_iterable(space, w_set, w_iterable): - iterable = space.iteriterable(w_iterable) w_set.strategy = strategy = space.fromcache(EmptySetStrategy) w_set.sstorage = strategy.get_empty_storage() From noreply at buildbot.pypy.org Mon Nov 2 15:52:06 2015 From: noreply at buildbot.pypy.org (cfbolz) Date: Mon, 2 Nov 2015 21:52:06 +0100 (CET) Subject: [pypy-commit] pypy default: generators are a bit broken Message-ID: <20151102205206.ADECD1C120F@cobra.cs.uni-duesseldorf.de> Author: Carl Friedrich Bolz Branch: Changeset: r80505:f25d33c5dcec Date: 2015-11-02 21:44 +0100 http://bitbucket.org/pypy/pypy/changeset/f25d33c5dcec/ Log: generators are a bit broken diff --git a/rpython/rtyper/test/test_generator.py b/rpython/rtyper/test/test_generator.py --- a/rpython/rtyper/test/test_generator.py +++ b/rpython/rtyper/test/test_generator.py @@ -76,6 +76,31 @@ res = self.interpret(f, []) assert res == 358 + def test_different_exception(self): + py.test.skip("generators broken") + def h(c): + if c == 8: + raise ValueError + def g(c): + try: + h(c) + except Exception, e: + if isinstance(e, ValueError): + raise + raise StopIteration + yield c + + def f(x): + try: + for x in g(x): + pass + except ValueError: + return -5 + return 5 + assert f(8) == -5 + res = self.interpret(f, [8]) + assert res == -5 + def test_iterating_generator(self): def f(): yield 1 From noreply at buildbot.pypy.org Mon Nov 2 16:55:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 22:55:11 +0100 (CET) Subject: [pypy-commit] cffi default: Propagate "volatile" in addition to "const" and "restrict" Message-ID: <20151102215511.8C5301C13C0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2364:996827b4ddcd Date: 2015-11-02 21:27 +0100 http://bitbucket.org/cffi/cffi/changeset/996827b4ddcd/ Log: Propagate "volatile" in addition to "const" and "restrict" diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -348,6 +348,8 @@ pycparser.c_ast.PtrDecl)): if 'const' in type.quals: quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE if 'restrict' in type.quals: quals |= model.Q_RESTRICT return quals diff --git a/cffi/model.py b/cffi/model.py --- a/cffi/model.py +++ b/cffi/model.py @@ -7,10 +7,13 @@ # type qualifiers Q_CONST = 0x01 Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 def qualify(quals, replace_with): if quals & Q_CONST: replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() if quals & Q_RESTRICT: # It seems that __restrict is supported by gcc and msvc. # If you hit some different compiler, add a #define in diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1204,12 +1204,19 @@ assert foo_s.fields[1][1].type is ffi.typeof("void *") def test_restrict_fields(): - if sys.platform == 'win32': - py.test.skip("'__restrict__' probably not recognized") ffi = FFI() ffi.cdef("""struct foo_s { void * restrict b; };""") lib = verify(ffi, 'test_restrict_fields', """ - struct foo_s { void * __restrict__ b; };""") + struct foo_s { void * __restrict b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + +def test_volatile_fields(): + ffi = FFI() + ffi.cdef("""struct foo_s { void * volatile b; };""") + lib = verify(ffi, 'test_volatile_fields', """ + struct foo_s { void * volatile b; };""") foo_s = ffi.typeof("struct foo_s") assert foo_s.fields[0][0] == 'b' assert foo_s.fields[0][1].type is ffi.typeof("void *") From noreply at buildbot.pypy.org Mon Nov 2 16:55:13 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 22:55:13 +0100 (CET) Subject: [pypy-commit] cffi default: Found a pycparser issue. Work around it by adding some parentheses in Message-ID: <20151102215513.AC4551C13C0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2365:97315bc352f8 Date: 2015-11-02 22:22 +0100 http://bitbucket.org/cffi/cffi/changeset/97315bc352f8/ Log: Found a pycparser issue. Work around it by adding some parentheses in the csource passed to it, to avoid the buggy cases. diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -29,6 +29,8 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") def _get_parser(): global _parser_cache @@ -47,6 +49,45 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + # + # Workaround for a pycparser issue: "char*const***" gives us a wrong + # syntax tree, the same as for "char***(*const)". This means we can't + # tell the difference afterwards. But "char(*const(***))" gives us + # the right syntax tree. The issue only occurs if there are several + # stars in sequence with no parenthesis inbetween, just possibly + # qualifiers. Attempt to fix it by adding some parentheses in the + # source: each time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + for i in xrange(endpos, len(csource)): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + csource = ''.join(parts) + # # BIG HACK: replace WINAPI or __stdcall with "volatile const". # It doesn't make sense for the return type of a function to be # "volatile volatile const", so we abuse it to detect __stdcall... @@ -320,13 +361,15 @@ self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] assert not macros exprnode = ast.ext[-1].type.args.params[0] if isinstance(exprnode, pycparser.c_ast.ID): raise api.CDefError("unknown identifier '%s'" % (exprnode.name,)) - tp, quals = self._get_type_and_quals(exprnode.type) - return tp + return self._get_type_and_quals(exprnode.type) def _declare(self, name, obj, included=False, quals=0): if name in self._declarations: diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -367,6 +367,41 @@ assert lst[0] == lst[2] assert lst[1] == lst[3] +def test_const_pointer_to_pointer(): + from cffi import model + ffi = FFI(backend=FakeBackend()) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * (* const)") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * (* const (*))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char (* const (* (*)))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * * const const") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * * volatile *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char * volatile restrict * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const volatile * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals( + "int(char*const*, short****const*)") + assert (str(tp), qual) == ( + "", 0) + tp, qual = ffi._parser.parse_type_and_quals( + "char*const*(short*const****)") + assert (str(tp), qual) == ( + "", 0) + def test_enum(): ffi = FFI() ffi.cdef(""" diff --git a/testing/cffi1/test_verify1.py b/testing/cffi1/test_verify1.py --- a/testing/cffi1/test_verify1.py +++ b/testing/cffi1/test_verify1.py @@ -2250,3 +2250,8 @@ assert p == lib.myarray + 4 p[1] = 82 assert lib.my_value == 82 # [5] + +def test_const_pointer_to_pointer(): + ffi = FFI() + ffi.cdef("struct s { char *const *a; };") + ffi.verify("struct s { char *const *a; };") From noreply at buildbot.pypy.org Mon Nov 2 16:55:15 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 22:55:15 +0100 (CET) Subject: [pypy-commit] cffi default: Found out that the pycparser problem was fixed between 2.10 and 2.14. Message-ID: <20151102215515.AA4901C13C0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2366:b74bf1aad694 Date: 2015-11-02 22:46 +0100 http://bitbucket.org/cffi/cffi/changeset/b74bf1aad694/ Log: Found out that the pycparser problem was fixed between 2.10 and 2.14. diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -38,25 +38,15 @@ _parser_cache = pycparser.CParser() return _parser_cache -def _preprocess(csource): - # Remove comments. NOTE: this only work because the cdef() section - # should not contain any string literal! - csource = _r_comment.sub(' ', csource) - # Remove the "#define FOO x" lines - macros = {} - for match in _r_define.finditer(csource): - macroname, macrovalue = match.groups() - macrovalue = macrovalue.replace('\\\n', '').strip() - macros[macroname] = macrovalue - csource = _r_define.sub('', csource) - # - # Workaround for a pycparser issue: "char*const***" gives us a wrong - # syntax tree, the same as for "char***(*const)". This means we can't - # tell the difference afterwards. But "char(*const(***))" gives us - # the right syntax tree. The issue only occurs if there are several - # stars in sequence with no parenthesis inbetween, just possibly - # qualifiers. Attempt to fix it by adding some parentheses in the - # source: each time we see "* const" or "* const *", we add an opening +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening # parenthesis before each star---the hard part is figuring out where # to close them. parts = [] @@ -86,7 +76,22 @@ csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) - csource = ''.join(parts) + return ''.join(parts) + +def _preprocess(csource): + # Remove comments. NOTE: this only work because the cdef() section + # should not contain any string literal! + csource = _r_comment.sub(' ', csource) + # Remove the "#define FOO x" lines + macros = {} + for match in _r_define.finditer(csource): + macroname, macrovalue = match.groups() + macrovalue = macrovalue.replace('\\\n', '').strip() + macros[macroname] = macrovalue + csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) # # BIG HACK: replace WINAPI or __stdcall with "volatile const". # It doesn't make sense for the return type of a function to be From noreply at buildbot.pypy.org Mon Nov 2 16:55:41 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 22:55:41 +0100 (CET) Subject: [pypy-commit] pypy default: Update pycparser from 2.10 (2012) to 2.14 (2015). Not much changed, but Message-ID: <20151102215541.7A5C91C13C0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80506:29383d0315f6 Date: 2015-11-02 22:56 +0100 http://bitbucket.org/pypy/pypy/changeset/29383d0315f6/ Log: Update pycparser from 2.10 (2012) to 2.14 (2015). Not much changed, but there is at least one bug fixed (cffi workaround b74bf1aad694). diff too long, truncating to 2000 out of 2333 lines diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), - ('type_specifier -> SHORT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',711), - ('type_specifier -> INT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',712), - ('type_specifier -> LONG','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',713), - ('type_specifier -> FLOAT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',714), - ('type_specifier -> DOUBLE','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',715), - ('type_specifier -> _COMPLEX','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',716), - ('type_specifier -> SIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',717), - ('type_specifier -> UNSIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',718), - ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',723), - ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',724), - ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',725), - ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',730), - ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',731), - ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',732), - ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list_1','../pycparser/c_parser.py',737), - ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list_1','../pycparser/c_parser.py',738), - ('init_declarator_list -> EQUALS initializer','init_declarator_list',2,'p_init_declarator_list_2','../pycparser/c_parser.py',748), - ('init_declarator_list -> abstract_declarator','init_declarator_list',1,'p_init_declarator_list_3','../pycparser/c_parser.py',756), - ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','../pycparser/c_parser.py',764), - ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','../pycparser/c_parser.py',765), - ('specifier_qualifier_list -> type_qualifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','../pycparser/c_parser.py',770), - ('specifier_qualifier_list -> type_specifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','../pycparser/c_parser.py',775), - ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',783), - ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',784), - ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','../pycparser/c_parser.py',793), - ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',802), - ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',803), - ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',812), - ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',813), - ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','../pycparser/c_parser.py',820), - ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','../pycparser/c_parser.py',821), - ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','../pycparser/c_parser.py',826), - ('struct_declaration -> specifier_qualifier_list abstract_declarator SEMI','struct_declaration',3,'p_struct_declaration_2','../pycparser/c_parser.py',864), - ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','../pycparser/c_parser.py',878), - ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','../pycparser/c_parser.py',879), - ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','../pycparser/c_parser.py',887), - ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','../pycparser/c_parser.py',892), - ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','../pycparser/c_parser.py',893), - ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',901), - ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',902), - ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','../pycparser/c_parser.py',907), - ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',912), - ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',913), - ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','../pycparser/c_parser.py',918), - ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','../pycparser/c_parser.py',919), - ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','../pycparser/c_parser.py',920), - ('enumerator -> ID','enumerator',1,'p_enumerator','../pycparser/c_parser.py',931), - ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','../pycparser/c_parser.py',932), - ('declarator -> direct_declarator','declarator',1,'p_declarator_1','../pycparser/c_parser.py',947), - ('declarator -> pointer direct_declarator','declarator',2,'p_declarator_2','../pycparser/c_parser.py',952), - ('declarator -> pointer TYPEID','declarator',2,'p_declarator_3','../pycparser/c_parser.py',961), - ('direct_declarator -> ID','direct_declarator',1,'p_direct_declarator_1','../pycparser/c_parser.py',972), - ('direct_declarator -> LPAREN declarator RPAREN','direct_declarator',3,'p_direct_declarator_2','../pycparser/c_parser.py',981), - ('direct_declarator -> direct_declarator LBRACKET assignment_expression_opt RBRACKET','direct_declarator',4,'p_direct_declarator_3','../pycparser/c_parser.py',986), - ('direct_declarator -> direct_declarator LBRACKET TIMES RBRACKET','direct_declarator',4,'p_direct_declarator_4','../pycparser/c_parser.py',998), - ('direct_declarator -> direct_declarator LPAREN parameter_type_list RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1008), - ('direct_declarator -> direct_declarator LPAREN identifier_list_opt RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1009), - ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','../pycparser/c_parser.py',1036), - ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','../pycparser/c_parser.py',1037), - ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','../pycparser/c_parser.py',1047), - ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','../pycparser/c_parser.py',1048), - ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','../pycparser/c_parser.py',1053), - ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','../pycparser/c_parser.py',1054), - ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','../pycparser/c_parser.py',1062), - ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','../pycparser/c_parser.py',1063), - ('parameter_declaration -> declaration_specifiers declarator','parameter_declaration',2,'p_parameter_declaration_1','../pycparser/c_parser.py',1072), - ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','../pycparser/c_parser.py',1083), - ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','../pycparser/c_parser.py',1113), - ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','../pycparser/c_parser.py',1114), - ('initializer -> assignment_expression','initializer',1,'p_initializer_1','../pycparser/c_parser.py',1123), - ('initializer -> brace_open initializer_list brace_close','initializer',3,'p_initializer_2','../pycparser/c_parser.py',1128), - ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','../pycparser/c_parser.py',1129), - ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','../pycparser/c_parser.py',1134), - ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','../pycparser/c_parser.py',1135), - ('designation -> designator_list EQUALS','designation',2,'p_designation','../pycparser/c_parser.py',1146), - ('designator_list -> designator','designator_list',1,'p_designator_list','../pycparser/c_parser.py',1154), - ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','../pycparser/c_parser.py',1155), - ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','../pycparser/c_parser.py',1160), - ('designator -> PERIOD identifier','designator',2,'p_designator','../pycparser/c_parser.py',1161), - ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','../pycparser/c_parser.py',1166), - ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','../pycparser/c_parser.py',1182), - ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','../pycparser/c_parser.py',1190), - ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','../pycparser/c_parser.py',1195), - ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','../pycparser/c_parser.py',1205), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','../pycparser/c_parser.py',1209), - ('direct_abstract_declarator -> LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_3','../pycparser/c_parser.py',1219), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','../pycparser/c_parser.py',1227), - ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','../pycparser/c_parser.py',1237), - ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','../pycparser/c_parser.py',1245), - ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','../pycparser/c_parser.py',1255), - ('block_item -> declaration','block_item',1,'p_block_item','../pycparser/c_parser.py',1266), - ('block_item -> statement','block_item',1,'p_block_item','../pycparser/c_parser.py',1267), - ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','../pycparser/c_parser.py',1274), - ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','../pycparser/c_parser.py',1275), - ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','../pycparser/c_parser.py',1281), - ('labeled_statement -> ID COLON statement','labeled_statement',3,'p_labeled_statement_1','../pycparser/c_parser.py',1287), - ('labeled_statement -> CASE constant_expression COLON statement','labeled_statement',4,'p_labeled_statement_2','../pycparser/c_parser.py',1291), - ('labeled_statement -> DEFAULT COLON statement','labeled_statement',3,'p_labeled_statement_3','../pycparser/c_parser.py',1295), - ('selection_statement -> IF LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_1','../pycparser/c_parser.py',1299), - ('selection_statement -> IF LPAREN expression RPAREN statement ELSE statement','selection_statement',7,'p_selection_statement_2','../pycparser/c_parser.py',1303), - ('selection_statement -> SWITCH LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_3','../pycparser/c_parser.py',1307), - ('iteration_statement -> WHILE LPAREN expression RPAREN statement','iteration_statement',5,'p_iteration_statement_1','../pycparser/c_parser.py',1312), - ('iteration_statement -> DO statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','../pycparser/c_parser.py',1316), - ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN statement','iteration_statement',9,'p_iteration_statement_3','../pycparser/c_parser.py',1320), - ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement','iteration_statement',8,'p_iteration_statement_4','../pycparser/c_parser.py',1324), - ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','../pycparser/c_parser.py',1328), - ('jump_statement -> BREAK SEMI','jump_statement',2,'p_jump_statement_2','../pycparser/c_parser.py',1332), - ('jump_statement -> CONTINUE SEMI','jump_statement',2,'p_jump_statement_3','../pycparser/c_parser.py',1336), - ('jump_statement -> RETURN expression SEMI','jump_statement',3,'p_jump_statement_4','../pycparser/c_parser.py',1340), - ('jump_statement -> RETURN SEMI','jump_statement',2,'p_jump_statement_4','../pycparser/c_parser.py',1341), - ('expression_statement -> expression_opt SEMI','expression_statement',2,'p_expression_statement','../pycparser/c_parser.py',1346), - ('expression -> assignment_expression','expression',1,'p_expression','../pycparser/c_parser.py',1353), - ('expression -> expression COMMA assignment_expression','expression',3,'p_expression','../pycparser/c_parser.py',1354), - ('typedef_name -> TYPEID','typedef_name',1,'p_typedef_name','../pycparser/c_parser.py',1366), - ('assignment_expression -> conditional_expression','assignment_expression',1,'p_assignment_expression','../pycparser/c_parser.py',1370), - ('assignment_expression -> unary_expression assignment_operator assignment_expression','assignment_expression',3,'p_assignment_expression','../pycparser/c_parser.py',1371), - ('assignment_operator -> EQUALS','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1384), - ('assignment_operator -> XOREQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1385), - ('assignment_operator -> TIMESEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1386), - ('assignment_operator -> DIVEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1387), - ('assignment_operator -> MODEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1388), - ('assignment_operator -> PLUSEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1389), - ('assignment_operator -> MINUSEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1390), - ('assignment_operator -> LSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1391), - ('assignment_operator -> RSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1392), - ('assignment_operator -> ANDEQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1393), - ('assignment_operator -> OREQUAL','assignment_operator',1,'p_assignment_operator','../pycparser/c_parser.py',1394), - ('constant_expression -> conditional_expression','constant_expression',1,'p_constant_expression','../pycparser/c_parser.py',1399), From noreply at buildbot.pypy.org Mon Nov 2 17:13:24 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 2 Nov 2015 23:13:24 +0100 (CET) Subject: [pypy-commit] cffi default: Issue #228: "bool" not working in out-of-line FFI objects. Same problem Message-ID: <20151102221324.D6A201C071E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2367:bcbbce0b1d78 Date: 2015-11-02 23:12 +0100 http://bitbucket.org/cffi/cffi/changeset/bcbbce0b1d78/ Log: Issue #228: "bool" not working in out-of-line FFI objects. Same problem with all Windows common types. Mostly fixed by moving the list of common types to C code. The only remaining corner case I can think of is "FILE", which works only if it was mentioned in the cdef while building the out-of-line module. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -5861,6 +5861,9 @@ (PyObject *)&CTypeDescr_Type); } +/* forward, in commontypes.c */ +static PyObject *b__get_common_types(PyObject *self, PyObject *arg); + static PyObject *b_gcp(PyObject *self, PyObject *args, PyObject *kwds) { CDataObject *cd; @@ -6187,6 +6190,7 @@ {"getwinerror", (PyCFunction)b_getwinerror, METH_VARARGS | METH_KEYWORDS}, #endif {"_get_types", b__get_types, METH_NOARGS}, + {"_get_common_types", b__get_common_types, METH_O}, {"_testfunc", b__testfunc, METH_VARARGS}, {"_testbuff", b__testbuff, METH_VARARGS}, {"_init_cffi_1_0_external_module", b_init_cffi_1_0_external_module, METH_O}, diff --git a/c/cffi1_module.c b/c/cffi1_module.c --- a/c/cffi1_module.c +++ b/c/cffi1_module.c @@ -15,6 +15,7 @@ #include "cglob.c" #include "lib_obj.c" #include "cdlopen.c" +#include "commontypes.c" static int init_ffi_lib(PyObject *m) diff --git a/c/commontypes.c b/c/commontypes.c new file mode 100644 --- /dev/null +++ b/c/commontypes.c @@ -0,0 +1,209 @@ +/* This file must be kept in alphabetical order. See test_commontypes.py */ + +#define EQ(key, value) key "\0" value /* string concatenation */ +#ifdef _WIN64 +# define W32_64(X,Y) Y +# else +# define W32_64(X,Y) X +# endif + + +static const char *common_simple_types[] = { + +#ifdef MS_WIN32 /* Windows types */ + EQ("ATOM", "WORD"), + EQ("BOOL", "int"), + EQ("BOOLEAN", "BYTE"), + EQ("BYTE", "unsigned char"), + EQ("CCHAR", "char"), + EQ("CHAR", "char"), + EQ("COLORREF", "DWORD"), + EQ("DWORD", "unsigned long"), + EQ("DWORD32", "unsigned int"), + EQ("DWORD64", "unsigned long long"), + EQ("DWORDLONG", "ULONGLONG"), + EQ("DWORD_PTR", "ULONG_PTR"), + EQ("FLOAT", "float"), + EQ("HACCEL", "HANDLE"), + EQ("HALF_PTR", W32_64("short","int")), + EQ("HBITMAP", "HANDLE"), + EQ("HBRUSH", "HANDLE"), + EQ("HCOLORSPACE", "HANDLE"), + EQ("HCONV", "HANDLE"), + EQ("HCONVLIST", "HANDLE"), + EQ("HCURSOR", "HICON"), + EQ("HDC", "HANDLE"), + EQ("HDDEDATA", "HANDLE"), + EQ("HDESK", "HANDLE"), + EQ("HDROP", "HANDLE"), + EQ("HDWP", "HANDLE"), + EQ("HENHMETAFILE", "HANDLE"), + EQ("HFILE", "int"), + EQ("HFONT", "HANDLE"), + EQ("HGDIOBJ", "HANDLE"), + EQ("HGLOBAL", "HANDLE"), + EQ("HHOOK", "HANDLE"), + EQ("HICON", "HANDLE"), + EQ("HINSTANCE", "HANDLE"), + EQ("HKEY", "HANDLE"), + EQ("HKL", "HANDLE"), + EQ("HLOCAL", "HANDLE"), + EQ("HMENU", "HANDLE"), + EQ("HMETAFILE", "HANDLE"), + EQ("HMODULE", "HINSTANCE"), + EQ("HMONITOR", "HANDLE"), + EQ("HPALETTE", "HANDLE"), + EQ("HPEN", "HANDLE"), + EQ("HRESULT", "LONG"), + EQ("HRGN", "HANDLE"), + EQ("HRSRC", "HANDLE"), + EQ("HSZ", "HANDLE"), + EQ("HWND", "HANDLE"), + EQ("INT", "int"), + EQ("INT16", "short"), + EQ("INT32", "int"), + EQ("INT64", "long long"), + EQ("INT8", "signed char"), + EQ("INT_PTR", W32_64("int","long long")), + EQ("LANGID", "WORD"), + EQ("LCID", "DWORD"), + EQ("LCTYPE", "DWORD"), + EQ("LGRPID", "DWORD"), + EQ("LONG", "long"), + EQ("LONG32", "int"), + EQ("LONG64", "long long"), + EQ("LONGLONG", "long long"), + EQ("LONG_PTR", W32_64("long","long long")), + EQ("LPARAM", "LONG_PTR"), + EQ("LPBOOL", "BOOL *"), + EQ("LPBYTE", "BYTE *"), + EQ("LPCOLORREF", "DWORD *"), + EQ("LPCSTR", "const char *"), + EQ("LPCVOID", "const void *"), + EQ("LPCWSTR", "const WCHAR *"), + EQ("LPDWORD", "DWORD *"), + EQ("LPHANDLE", "HANDLE *"), + EQ("LPINT", "int *"), + EQ("LPLONG", "long *"), + EQ("LPSTR", "CHAR *"), + EQ("LPVOID", "void *"), + EQ("LPWORD", "WORD *"), + EQ("LPWSTR", "WCHAR *"), + EQ("LRESULT", "LONG_PTR"), + EQ("PBOOL", "BOOL *"), + EQ("PBOOLEAN", "BOOLEAN *"), + EQ("PBYTE", "BYTE *"), + EQ("PCHAR", "CHAR *"), + EQ("PCSTR", "const CHAR *"), + EQ("PCWSTR", "const WCHAR *"), + EQ("PDWORD", "DWORD *"), + EQ("PDWORD32", "DWORD32 *"), + EQ("PDWORD64", "DWORD64 *"), + EQ("PDWORDLONG", "DWORDLONG *"), + EQ("PDWORD_PTR", "DWORD_PTR *"), + EQ("PFLOAT", "FLOAT *"), + EQ("PHALF_PTR", "HALF_PTR *"), + EQ("PHANDLE", "HANDLE *"), + EQ("PHKEY", "HKEY *"), + EQ("PINT", "int *"), + EQ("PINT16", "INT16 *"), + EQ("PINT32", "INT32 *"), + EQ("PINT64", "INT64 *"), + EQ("PINT8", "INT8 *"), + EQ("PINT_PTR", "INT_PTR *"), + EQ("PLCID", "PDWORD"), + EQ("PLONG", "LONG *"), + EQ("PLONG32", "LONG32 *"), + EQ("PLONG64", "LONG64 *"), + EQ("PLONGLONG", "LONGLONG *"), + EQ("PLONG_PTR", "LONG_PTR *"), + EQ("PSHORT", "SHORT *"), + EQ("PSIZE_T", "SIZE_T *"), + EQ("PSSIZE_T", "SSIZE_T *"), + EQ("PSTR", "CHAR *"), + EQ("PUCHAR", "UCHAR *"), + EQ("PUHALF_PTR", "UHALF_PTR *"), + EQ("PUINT", "UINT *"), + EQ("PUINT16", "UINT16 *"), + EQ("PUINT32", "UINT32 *"), + EQ("PUINT64", "UINT64 *"), + EQ("PUINT8", "UINT8 *"), + EQ("PUINT_PTR", "UINT_PTR *"), + EQ("PULONG", "ULONG *"), + EQ("PULONG32", "ULONG32 *"), + EQ("PULONG64", "ULONG64 *"), + EQ("PULONGLONG", "ULONGLONG *"), + EQ("PULONG_PTR", "ULONG_PTR *"), + EQ("PUSHORT", "USHORT *"), + EQ("PVOID", "void *"), + EQ("PWCHAR", "WCHAR *"), + EQ("PWORD", "WORD *"), + EQ("PWSTR", "WCHAR *"), + EQ("QWORD", "unsigned long long"), + EQ("SC_HANDLE", "HANDLE"), + EQ("SC_LOCK", "LPVOID"), + EQ("SERVICE_STATUS_HANDLE", "HANDLE"), + EQ("SHORT", "short"), + EQ("SIZE_T", "ULONG_PTR"), + EQ("SSIZE_T", "LONG_PTR"), + EQ("UCHAR", "unsigned char"), + EQ("UHALF_PTR", W32_64("unsigned short","unsigned int")), + EQ("UINT", "unsigned int"), + EQ("UINT16", "unsigned short"), + EQ("UINT32", "unsigned int"), + EQ("UINT64", "unsigned long long"), + EQ("UINT8", "unsigned char"), + EQ("UINT_PTR", W32_64("unsigned int","unsigned long long")), + EQ("ULONG", "unsigned long"), + EQ("ULONG32", "unsigned int"), + EQ("ULONG64", "unsigned long long"), + EQ("ULONGLONG", "unsigned long long"), + EQ("ULONG_PTR", W32_64("unsigned long","unsigned long long")), + EQ("USHORT", "unsigned short"), + EQ("USN", "LONGLONG"), + EQ("VOID", "void"), + EQ("WCHAR", "wchar_t"), + EQ("WINSTA", "HANDLE"), + EQ("WORD", "unsigned short"), + EQ("WPARAM", "UINT_PTR"), +#endif + + EQ("bool", "_Bool"), +}; + + +#undef EQ +#undef W32_64 + +#define num_common_simple_types \ + (sizeof(common_simple_types) / sizeof(common_simple_types[0])) + + +static const char *get_common_type(const char *search, size_t search_len) +{ + const char *entry; + int index = search_sorted(common_simple_types, sizeof(const char *), + num_common_simple_types, search, search_len); + if (index < 0) + return NULL; + + entry = common_simple_types[index]; + return entry + strlen(entry) + 1; +} + +static PyObject *b__get_common_types(PyObject *self, PyObject *arg) +{ + int i, err; + for (i = 0; i < num_common_simple_types; i++) { + const char *s = common_simple_types[i]; + PyObject *o = PyString_FromString(s + strlen(s) + 1); + if (o == NULL) + return NULL; + err = PyDict_SetItemString(arg, s, o); + Py_DECREF(o); + if (err < 0) + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} diff --git a/c/parse_c_type.c b/c/parse_c_type.c --- a/c/parse_c_type.c +++ b/c/parse_c_type.c @@ -220,6 +220,8 @@ #define MAX_SSIZE_T (((size_t)-1) >> 1) static int parse_complete(token_t *tok); +static const char *get_common_type(const char *search, size_t search_len); +static int parse_common_type_replacement(token_t *tok, const char *replacement); static int parse_sequel(token_t *tok, int outer) { @@ -442,26 +444,34 @@ return _CFFI_GETARG(result); } +static int search_sorted(const char *const *base, + size_t item_size, int array_len, + const char *search, size_t search_len) +{ + int left = 0, right = array_len; + const char *baseptr = (const char *)base; -#define MAKE_SEARCH_FUNC(FIELD) \ - static \ - int search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ - const char *search, size_t search_len) \ - { \ - int left = 0, right = ctx->num_##FIELD; \ - \ - while (left < right) { \ - int middle = (left + right) / 2; \ - const char *src = ctx->FIELD[middle].name; \ - int diff = strncmp(src, search, search_len); \ - if (diff == 0 && src[search_len] == '\0') \ - return middle; \ - else if (diff >= 0) \ - right = middle; \ - else \ - left = middle + 1; \ - } \ - return -1; \ + while (left < right) { + int middle = (left + right) / 2; + const char *src = *(const char *const *)(baseptr + middle * item_size); + int diff = strncmp(src, search, search_len); + if (diff == 0 && src[search_len] == '\0') + return middle; + else if (diff >= 0) + right = middle; + else + left = middle + 1; + } + return -1; +} + +#define MAKE_SEARCH_FUNC(FIELD) \ + static \ + int search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ + const char *search, size_t search_len) \ + { \ + return search_sorted(&ctx->FIELD->name, sizeof(*ctx->FIELD), \ + ctx->num_##FIELD, search, search_len); \ } MAKE_SEARCH_FUNC(globals) @@ -715,6 +725,7 @@ break; case TOK_IDENTIFIER: { + const char *replacement; int n = search_in_typenames(tok->info->ctx, tok->p, tok->size); if (n >= 0) { t1 = _CFFI_OP(_CFFI_OP_TYPENAME, n); @@ -725,6 +736,14 @@ t1 = _CFFI_OP(_CFFI_OP_PRIMITIVE, n); break; } + replacement = get_common_type(tok->p, tok->size); + if (replacement != NULL) { + n = parse_common_type_replacement(tok, replacement); + if (n < 0) + return parse_error(tok, "internal error, please report!"); + t1 = _CFFI_OP(_CFFI_OP_NOOP, n); + break; + } return parse_error(tok, "undefined type name"); } case TOK_STRUCT: @@ -770,7 +789,8 @@ static -int parse_c_type(struct _cffi_parse_info_s *info, const char *input) +int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, + const char *input) { int result; token_t token; @@ -781,12 +801,26 @@ token.p = input; token.size = 0; token.output = info->output; - token.output_index = 0; + token.output_index = *output_index; next_token(&token); result = parse_complete(&token); + *output_index = token.output_index; if (token.kind != TOK_END) return parse_error(&token, "unexpected symbol"); return result; } + +static +int parse_c_type(struct _cffi_parse_info_s *info, const char *input) +{ + size_t output_index = 0; + return parse_c_type_from(info, &output_index, input); +} + +static +int parse_common_type_replacement(token_t *tok, const char *replacement) +{ + return parse_c_type_from(tok->info, &tok->output_index, replacement); +} diff --git a/cffi/commontypes.py b/cffi/commontypes.py --- a/cffi/commontypes.py +++ b/cffi/commontypes.py @@ -7,6 +7,13 @@ 'bool': '_Bool', } +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: if _type.endswith('_t'): COMMON_TYPES[_type] = _type @@ -14,212 +21,35 @@ _CACHE = {} -def resolve_common_type(commontype): +def resolve_common_type(parser, commontype): try: return _CACHE[commontype] except KeyError: - result = COMMON_TYPES.get(commontype, commontype) - if not isinstance(result, str): - pass # result is already a BaseType - elif result.endswith(' *'): - if result.startswith('const '): - result = model.ConstPointerType( - resolve_common_type(result[6:-2])) - else: - result = model.PointerType(resolve_common_type(result[:-2])) - elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES: - result = model.PrimitiveType(result) - elif result == 'set-unicode-needed': + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': raise api.FFIError("The Windows type %r is only available after " "you call ffi.set_unicode()" % (commontype,)) else: - if commontype == result: + if commontype == cdecl: raise api.FFIError("Unsupported type: %r. Please file a bug " "if you think it should be." % (commontype,)) - result = resolve_common_type(result) # recursively + result, quals = parser.parse_type_and_quals(cdecl) # recursive + assert isinstance(result, model.BaseTypeByIdentity) - _CACHE[commontype] = result - return result + _CACHE[commontype] = result, quals + return result, quals # ____________________________________________________________ -# Windows common types +# extra types for Windows (most of them are in commontypes.c) -def win_common_types(maxsize): - result = {} - if maxsize < (1<<32): - result.update({ # Windows 32-bits - 'HALF_PTR': 'short', - 'INT_PTR': 'int', - 'LONG_PTR': 'long', - 'UHALF_PTR': 'unsigned short', - 'UINT_PTR': 'unsigned int', - 'ULONG_PTR': 'unsigned long', - }) - else: - result.update({ # Windows 64-bits - 'HALF_PTR': 'int', - 'INT_PTR': 'long long', - 'LONG_PTR': 'long long', - 'UHALF_PTR': 'unsigned int', - 'UINT_PTR': 'unsigned long long', - 'ULONG_PTR': 'unsigned long long', - }) - result.update({ - "BYTE": "unsigned char", - "BOOL": "int", - "CCHAR": "char", - "CHAR": "char", - "DWORD": "unsigned long", - "DWORD32": "unsigned int", - "DWORD64": "unsigned long long", - "FLOAT": "float", - "INT": "int", - "INT8": "signed char", - "INT16": "short", - "INT32": "int", - "INT64": "long long", - "LONG": "long", - "LONGLONG": "long long", - "LONG32": "int", - "LONG64": "long long", - "WORD": "unsigned short", - "PVOID": model.voidp_type, - "ULONGLONG": "unsigned long long", - "WCHAR": "wchar_t", - "SHORT": "short", - "UCHAR": "unsigned char", - "UINT": "unsigned int", - "UINT8": "unsigned char", - "UINT16": "unsigned short", - "UINT32": "unsigned int", - "UINT64": "unsigned long long", - "ULONG": "unsigned long", - "ULONG32": "unsigned int", - "ULONG64": "unsigned long long", - "USHORT": "unsigned short", - - "SIZE_T": "ULONG_PTR", - "SSIZE_T": "LONG_PTR", - "ATOM": "WORD", - "BOOLEAN": "BYTE", - "COLORREF": "DWORD", - - "HANDLE": "PVOID", - "DWORDLONG": "ULONGLONG", - "DWORD_PTR": "ULONG_PTR", - "HACCEL": "HANDLE", - - "HBITMAP": "HANDLE", - "HBRUSH": "HANDLE", - "HCOLORSPACE": "HANDLE", - "HCONV": "HANDLE", - "HCONVLIST": "HANDLE", - "HDC": "HANDLE", - "HDDEDATA": "HANDLE", - "HDESK": "HANDLE", - "HDROP": "HANDLE", - "HDWP": "HANDLE", - "HENHMETAFILE": "HANDLE", - "HFILE": "int", - "HFONT": "HANDLE", - "HGDIOBJ": "HANDLE", - "HGLOBAL": "HANDLE", - "HHOOK": "HANDLE", - "HICON": "HANDLE", - "HCURSOR": "HICON", - "HINSTANCE": "HANDLE", - "HKEY": "HANDLE", - "HKL": "HANDLE", - "HLOCAL": "HANDLE", - "HMENU": "HANDLE", - "HMETAFILE": "HANDLE", - "HMODULE": "HINSTANCE", - "HMONITOR": "HANDLE", - "HPALETTE": "HANDLE", - "HPEN": "HANDLE", - "HRESULT": "LONG", - "HRGN": "HANDLE", - "HRSRC": "HANDLE", - "HSZ": "HANDLE", - "WINSTA": "HANDLE", - "HWND": "HANDLE", - - "LANGID": "WORD", - "LCID": "DWORD", - "LCTYPE": "DWORD", - "LGRPID": "DWORD", - "LPARAM": "LONG_PTR", - "LPBOOL": "BOOL *", - "LPBYTE": "BYTE *", - "LPCOLORREF": "DWORD *", - "LPCSTR": "const char *", - - "LPCVOID": model.const_voidp_type, - "LPCWSTR": "const WCHAR *", - "LPDWORD": "DWORD *", - "LPHANDLE": "HANDLE *", - "LPINT": "int *", - "LPLONG": "long *", - "LPSTR": "CHAR *", - "LPWSTR": "WCHAR *", - "LPVOID": model.voidp_type, - "LPWORD": "WORD *", - "LRESULT": "LONG_PTR", - "PBOOL": "BOOL *", - "PBOOLEAN": "BOOLEAN *", - "PBYTE": "BYTE *", - "PCHAR": "CHAR *", - "PCSTR": "const CHAR *", - "PCWSTR": "const WCHAR *", - "PDWORD": "DWORD *", - "PDWORDLONG": "DWORDLONG *", - "PDWORD_PTR": "DWORD_PTR *", - "PDWORD32": "DWORD32 *", - "PDWORD64": "DWORD64 *", - "PFLOAT": "FLOAT *", - "PHALF_PTR": "HALF_PTR *", - "PHANDLE": "HANDLE *", - "PHKEY": "HKEY *", - "PINT": "int *", - "PINT_PTR": "INT_PTR *", - "PINT8": "INT8 *", - "PINT16": "INT16 *", - "PINT32": "INT32 *", - "PINT64": "INT64 *", - "PLCID": "PDWORD", - "PLONG": "LONG *", - "PLONGLONG": "LONGLONG *", - "PLONG_PTR": "LONG_PTR *", - "PLONG32": "LONG32 *", - "PLONG64": "LONG64 *", - "PSHORT": "SHORT *", - "PSIZE_T": "SIZE_T *", - "PSSIZE_T": "SSIZE_T *", - "PSTR": "CHAR *", - "PUCHAR": "UCHAR *", - "PUHALF_PTR": "UHALF_PTR *", - "PUINT": "UINT *", - "PUINT_PTR": "UINT_PTR *", - "PUINT8": "UINT8 *", - "PUINT16": "UINT16 *", - "PUINT32": "UINT32 *", - "PUINT64": "UINT64 *", - "PULONG": "ULONG *", - "PULONGLONG": "ULONGLONG *", - "PULONG_PTR": "ULONG_PTR *", - "PULONG32": "ULONG32 *", - "PULONG64": "ULONG64 *", - "PUSHORT": "USHORT *", - "PWCHAR": "WCHAR *", - "PWORD": "WORD *", - "PWSTR": "WCHAR *", - "QWORD": "unsigned long long", - "SC_HANDLE": "HANDLE", - "SC_LOCK": "LPVOID", - "SERVICE_STATUS_HANDLE": "HANDLE", - +def win_common_types(): + return { "UNICODE_STRING": model.StructType( "_UNICODE_STRING", ["Length", @@ -232,10 +62,6 @@ "PUNICODE_STRING": "UNICODE_STRING *", "PCUNICODE_STRING": "const UNICODE_STRING *", - "USN": "LONGLONG", - "VOID": model.void_type, - "WPARAM": "UINT_PTR", - "TBYTE": "set-unicode-needed", "TCHAR": "set-unicode-needed", "LPCTSTR": "set-unicode-needed", @@ -244,9 +70,7 @@ "PTSTR": "set-unicode-needed", "PTBYTE": "set-unicode-needed", "PTCHAR": "set-unicode-needed", - }) - return result - + } if sys.platform == 'win32': - COMMON_TYPES.update(win_common_types(sys.maxsize)) + COMMON_TYPES.update(win_common_types()) diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -472,7 +472,8 @@ if ident == '__dotdotdot__': raise api.FFIError(':%d: bad usage of "..."' % typenode.coord.line) - return resolve_common_type(ident), quals + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) # if isinstance(type, pycparser.c_ast.Struct): # 'struct foobar' diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -286,38 +286,16 @@ "typedef int (*func_t)(void_t);") assert ffi.typeof("func_t").args == () -def test_win_common_types(): - from cffi.commontypes import COMMON_TYPES, _CACHE - from cffi.commontypes import win_common_types, resolve_common_type - # - def clear_all(extra={}, old_dict=COMMON_TYPES.copy()): - COMMON_TYPES.clear() - COMMON_TYPES.update(old_dict) - COMMON_TYPES.update(extra) - _CACHE.clear() - # - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - for key in sorted(ct): - if ct[key] != 'set-unicode-needed': - resolve_common_type(key) - # assert did not crash - # now try to use e.g. WPARAM (-> UINT_PTR -> unsigned 32/64-bit) - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - ffi = FFI() - value = int(ffi.cast("WPARAM", -1)) - assert value == maxsize - # - clear_all() - def test_WPARAM_on_windows(): if sys.platform != 'win32': py.test.skip("Only for Windows") ffi = FFI() ffi.cdef("void f(WPARAM);") + # + # WPARAM -> UINT_PTR -> unsigned 32/64-bit integer + ffi = FFI() + value = int(ffi.cast("WPARAM", -42)) + assert value == sys.maxsize * 2 - 40 def test__is_constant_globalvar(): for input, expected_output in [ diff --git a/testing/cffi1/test_commontypes.py b/testing/cffi1/test_commontypes.py new file mode 100644 --- /dev/null +++ b/testing/cffi1/test_commontypes.py @@ -0,0 +1,15 @@ +import py, os, cffi +import _cffi_backend + + +def test_alphabetical_order(): + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] + f.close() + assert lines == sorted(lines) + +def test_get_common_types(): + d = {} + _cffi_backend._get_common_types(d) + assert d["bool"] == "_Bool" diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py --- a/testing/cffi1/test_ffi_obj.py +++ b/testing/cffi1/test_ffi_obj.py @@ -395,3 +395,17 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) py.test.raises(MemoryError, alloc5, "int[5]") + +def test_bool_issue228(): + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + +def test_cast_from_int_type_to_bool(): + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 diff --git a/testing/cffi1/test_parse_c_type.py b/testing/cffi1/test_parse_c_type.py --- a/testing/cffi1/test_parse_c_type.py +++ b/testing/cffi1/test_parse_c_type.py @@ -19,8 +19,11 @@ ffi.cdef(header) lib = ffi.verify( - open(os.path.join(cffi_dir, '..', 'c', 'parse_c_type.c')).read(), - include_dirs=[cffi_dir]) + open(os.path.join(cffi_dir, '..', 'c', 'parse_c_type.c')).read() + """ +static const char *get_common_type(const char *search, size_t search_len) { + return NULL; +} +""", include_dirs=[cffi_dir]) class ParseError(Exception): pass diff --git a/testing/cffi1/test_verify1.py b/testing/cffi1/test_verify1.py --- a/testing/cffi1/test_verify1.py +++ b/testing/cffi1/test_verify1.py @@ -1494,15 +1494,6 @@ assert lib.foo(0) == 1 py.test.raises(TypeError, lib.foo, 0.0) -def test_cast_from_int_type_to_bool(): - ffi = FFI() - for basetype in ['char', 'short', 'int', 'long', 'long long']: - for sign in ['signed', 'unsigned']: - type = '%s %s' % (sign, basetype) - assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 - assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 - assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 - def test_addressof(): ffi = FFI() ffi.cdef(""" From noreply at buildbot.pypy.org Mon Nov 2 22:37:11 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 3 Nov 2015 04:37:11 +0100 (CET) Subject: [pypy-commit] pypy default: whoops, syntax error Message-ID: <20151103033711.B238C1C148B@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80507:e4f6d787123a Date: 2015-11-03 04:36 +0200 http://bitbucket.org/pypy/pypy/changeset/e4f6d787123a/ Log: whoops, syntax error diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -3081,7 +3081,7 @@ a = array(Dummy()) assert a.dtype == object raises(ValueError, array, Dummy({'xxx': 0})) - raises(ValueError), array, Dummy({'version': 0})) + raises(ValueError, array, Dummy({'version': 0})) raises(ValueError, array, Dummy({'version': 'abc'})) raises(ValueError, array, Dummy({'version': 3})) From noreply at buildbot.pypy.org Mon Nov 2 22:37:13 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 3 Nov 2015 04:37:13 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: porpogate various nan values across float conversions Message-ID: <20151103033713.E04A51C148B@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80508:ebaf0b23194a Date: 2015-11-03 04:42 +0200 http://bitbucket.org/pypy/pypy/changeset/ebaf0b23194a/ Log: porpogate various nan values across float conversions diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1852,6 +1852,19 @@ a = array([(1, 2)], dtype=[('a', 'int64'), ('b', 'int64')]) assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02' + def test_half_conversions(self): + from numpy import array, arange + all_f16 = arange(0xff10, 0xff20, dtype='uint16') + all_f16.dtype = 'float16' + print all_f16.view(dtype='uint16') + all_f32 = array(all_f16, dtype='float32') + print all_f32.view(dtype='uint32') + b = array(all_f32, dtype='float16') + print b.view(dtype='uint16') + c = b.view(dtype='uint16') + d = all_f16.view(dtype='uint16') + assert (c == d).all() + def test_ndarray_view_empty(self): from numpy import array, dtype x = array([], dtype=[('a', 'int8'), ('b', 'int8')]) diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -6,6 +6,7 @@ from rpython.rlib import rarithmetic, rfloat, objectmodel, jit from rpython.rlib.rarithmetic import r_ulonglong +from rpython.rtyper.lltypesystem.rffi import DOUBLE, cast def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but @@ -60,7 +61,10 @@ if exp == MAX_EXP - MIN_EXP + 2: # nan or infinity - result = rfloat.NAN if mant else rfloat.INFINITY + if mant == 0: + result = rfloat.INFINITY + else: + result = rfloat.NAN #cast(DOUBLE, mant | elif exp == 0: # subnormal or zero result = math.ldexp(mant, MIN_EXP - MANT_DIG) From noreply at buildbot.pypy.org Tue Nov 3 02:47:14 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 08:47:14 +0100 (CET) Subject: [pypy-commit] cffi default: Issue #228: do the same for "FILE". Only remaining case now is the Message-ID: <20151103074714.121A81C06BE@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2368:8b042b8ebb63 Date: 2015-11-03 08:47 +0100 http://bitbucket.org/cffi/cffi/changeset/8b042b8ebb63/ Log: Issue #228: do the same for "FILE". Only remaining case now is the very obscure Windows type UNICODE_STRING. I think it is unlikely that someone hits the case of their cdef not mentioning UNICODE_STRING but their runtime code still wants to use it, so I'll close this issue. diff --git a/c/commontypes.c b/c/commontypes.c --- a/c/commontypes.c +++ b/c/commontypes.c @@ -23,6 +23,11 @@ EQ("DWORD64", "unsigned long long"), EQ("DWORDLONG", "ULONGLONG"), EQ("DWORD_PTR", "ULONG_PTR"), +#endif + + EQ("FILE", "struct _IO_FILE"), + +#ifdef MS_WIN32 /* more Windows types */ EQ("FLOAT", "float"), EQ("HACCEL", "HANDLE"), EQ("HALF_PTR", W32_64("short","int")), diff --git a/c/parse_c_type.c b/c/parse_c_type.c --- a/c/parse_c_type.c +++ b/c/parse_c_type.c @@ -755,10 +755,15 @@ return parse_error(tok, "struct or union name expected"); n = search_in_struct_unions(tok->info->ctx, tok->p, tok->size); - if (n < 0) - return parse_error(tok, "undefined struct/union name"); - if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) != 0) - ^ (kind == TOK_UNION)) + if (n < 0) { + if (kind == TOK_STRUCT && tok->size == 8 && + !memcmp(tok->p, "_IO_FILE", 8)) + n = _CFFI__IO_FILE_STRUCT; + else + return parse_error(tok, "undefined struct/union name"); + } + else if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) + != 0) ^ (kind == TOK_UNION)) return parse_error(tok, "wrong kind of tag: struct vs union"); t1 = _CFFI_OP(_CFFI_OP_STRUCT_UNION, n); diff --git a/c/realize_c_type.c b/c/realize_c_type.c --- a/c/realize_c_type.c +++ b/c/realize_c_type.c @@ -314,6 +314,16 @@ _cffi_opcode_t op2; const struct _cffi_struct_union_s *s; + if (sindex == _CFFI__IO_FILE_STRUCT) { + /* returns a single global cached opaque type */ + static PyObject *file_struct = NULL; + if (file_struct == NULL) + file_struct = new_struct_or_union_type("struct _IO_FILE", + CT_STRUCT | CT_IS_FILE); + Py_XINCREF(file_struct); + return file_struct; + } + s = &builder->ctx.struct_unions[sindex]; op2 = builder->ctx.types[s->type_index]; if ((((uintptr_t)op2) & 1) == 0) { @@ -330,9 +340,9 @@ (s->flags & _CFFI_F_UNION) ? "union " : "struct ", s->name); if (strcmp(name, "struct _IO_FILE") == 0) - flags |= CT_IS_FILE; - - x = new_struct_or_union_type(name, flags); + x = _realize_c_struct_or_union(builder, _CFFI__IO_FILE_STRUCT); + else + x = new_struct_or_union_type(name, flags); if (x == NULL) return NULL; diff --git a/cffi/cffi_opcode.py b/cffi/cffi_opcode.py --- a/cffi/cffi_opcode.py +++ b/cffi/cffi_opcode.py @@ -110,6 +110,8 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/cffi/commontypes.py b/cffi/commontypes.py --- a/cffi/commontypes.py +++ b/cffi/commontypes.py @@ -2,10 +2,7 @@ from . import api, model -COMMON_TYPES = { - 'FILE': model.unknown_type('FILE', '_IO_FILE'), - 'bool': '_Bool', - } +COMMON_TYPES = {} try: # fetch "bool" and all simple Windows types @@ -14,6 +11,9 @@ except ImportError: pass +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above + for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: if _type.endswith('_t'): COMMON_TYPES[_type] = _type diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -83,6 +83,8 @@ #define _CFFI__UNKNOWN_FLOAT_PRIM (-2) #define _CFFI__UNKNOWN_LONG_DOUBLE (-3) +#define _CFFI__IO_FILE_STRUCT (-1) + struct _cffi_global_s { const char *name; diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py --- a/testing/cffi1/test_ffi_obj.py +++ b/testing/cffi1/test_ffi_obj.py @@ -401,6 +401,12 @@ fntype = ffi.typeof("int(*callback)(bool is_valid)") assert repr(fntype.args[0]) == "" +def test_FILE_issue228(): + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + def test_cast_from_int_type_to_bool(): ffi = _cffi1_backend.FFI() for basetype in ['char', 'short', 'int', 'long', 'long long']: diff --git a/testing/cffi1/test_verify1.py b/testing/cffi1/test_verify1.py --- a/testing/cffi1/test_verify1.py +++ b/testing/cffi1/test_verify1.py @@ -2246,3 +2246,26 @@ ffi = FFI() ffi.cdef("struct s { char *const *a; };") ffi.verify("struct s { char *const *a; };") + +def test_share_FILE(): + ffi1 = FFI() + ffi1.cdef("void do_stuff(FILE *);") + lib1 = ffi1.verify("void do_stuff(FILE *f) { (void)f; }") + ffi2 = FFI() + ffi2.cdef("FILE *barize(void);") + lib2 = ffi2.verify("FILE *barize(void) { return NULL; }") + lib1.do_stuff(lib2.barize()) + +def test_win_common_types(): + if sys.platform != 'win32': + py.test.skip("Windows only") + ffi = FFI() + ffi.set_unicode(True) + ffi.verify("") + assert ffi.typeof("PBYTE") is ffi.typeof("unsigned char *") + if sys.maxsize > 2**32: + expected = "unsigned long long" + else: + expected = "unsigned int" + assert ffi.typeof("UINT_PTR") is ffi.typeof(expected) + assert ffi.typeof("PTSTR") is ffi.typeof("wchar_t *") From noreply at buildbot.pypy.org Tue Nov 3 02:59:15 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 08:59:15 +0100 (CET) Subject: [pypy-commit] cffi default: Allow different formattings of the underlying "%p" Message-ID: <20151103075915.036541C06BE@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2369:17abd378d528 Date: 2015-11-03 09:00 +0100 http://bitbucket.org/cffi/cffi/changeset/17abd378d528/ Log: Allow different formattings of the underlying "%p" diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -261,7 +261,8 @@ ffi = FFI() ffi.cdef("typedef int bool, *FILE;") assert repr(ffi.cast("bool", 123)) == "" - assert repr(ffi.cast("FILE", 123)) == "" + assert re.match(r"", + repr(ffi.cast("FILE", 123))) ffi = FFI() ffi.cdef("typedef bool (*fn_t)(bool, bool);") # "bool," but within "( )" From noreply at buildbot.pypy.org Tue Nov 3 03:24:06 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 09:24:06 +0100 (CET) Subject: [pypy-commit] cffi default: Show instead of Message-ID: <20151103082406.E7AE21C06BE@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2370:2d96d742f41f Date: 2015-11-03 09:07 +0100 http://bitbucket.org/cffi/cffi/changeset/2d96d742f41f/ Log: Show instead of diff --git a/c/realize_c_type.c b/c/realize_c_type.c --- a/c/realize_c_type.c +++ b/c/realize_c_type.c @@ -318,7 +318,7 @@ /* returns a single global cached opaque type */ static PyObject *file_struct = NULL; if (file_struct == NULL) - file_struct = new_struct_or_union_type("struct _IO_FILE", + file_struct = new_struct_or_union_type("FILE", CT_STRUCT | CT_IS_FILE); Py_XINCREF(file_struct); return file_struct; diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py --- a/testing/cffi1/test_ffi_obj.py +++ b/testing/cffi1/test_ffi_obj.py @@ -404,7 +404,7 @@ def test_FILE_issue228(): fntype1 = _cffi1_backend.FFI().typeof("FILE *") fntype2 = _cffi1_backend.FFI().typeof("FILE *") - assert repr(fntype1) == "" + assert repr(fntype1) == "" assert fntype1 is fntype2 def test_cast_from_int_type_to_bool(): From noreply at buildbot.pypy.org Tue Nov 3 03:24:08 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 09:24:08 +0100 (CET) Subject: [pypy-commit] cffi default: One of the Windows common types was lost somehow. Add a test Message-ID: <20151103082408.E59561C06BE@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2371:427021f52c7f Date: 2015-11-03 09:25 +0100 http://bitbucket.org/cffi/cffi/changeset/427021f52c7f/ Log: One of the Windows common types was lost somehow. Add a test that at least dependencies are there. diff --git a/c/commontypes.c b/c/commontypes.c --- a/c/commontypes.c +++ b/c/commontypes.c @@ -31,6 +31,7 @@ EQ("FLOAT", "float"), EQ("HACCEL", "HANDLE"), EQ("HALF_PTR", W32_64("short","int")), + EQ("HANDLE", "PVOID"), EQ("HBITMAP", "HANDLE"), EQ("HBRUSH", "HANDLE"), EQ("HCOLORSPACE", "HANDLE"), diff --git a/testing/cffi1/test_commontypes.py b/testing/cffi1/test_commontypes.py --- a/testing/cffi1/test_commontypes.py +++ b/testing/cffi1/test_commontypes.py @@ -1,14 +1,30 @@ -import py, os, cffi +import py, os, cffi, re import _cffi_backend -def test_alphabetical_order(): +def getlines(): f = open(os.path.join(os.path.dirname(cffi.__file__), '..', 'c', 'commontypes.c')) lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] f.close() + return lines + +def test_alphabetical_order(): + lines = getlines() assert lines == sorted(lines) +def test_dependencies(): + r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?') + lines = getlines() + d = {} + for line in lines: + match = r.search(line) + if match is not None: + d[match.group(1)] = match.group(2) + for value in d.values(): + if value: + assert value in d + def test_get_common_types(): d = {} _cffi_backend._get_common_types(d) From noreply at buildbot.pypy.org Tue Nov 3 03:29:16 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 09:29:16 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151103082916.37CA21C06BE@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r651:d36f9e895c57 Date: 2015-11-03 09:30 +0100 http://bitbucket.org/pypy/pypy.org/changeset/d36f9e895c57/ Log: update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -9,13 +9,13 @@ - $60723 of $105000 (57.8%) + $60818 of $105000 (57.9%)
@@ -23,7 +23,7 @@
  • From noreply at buildbot.pypy.org Tue Nov 3 06:24:05 2015 From: noreply at buildbot.pypy.org (Zearin) Date: Tue, 3 Nov 2015 12:24:05 +0100 (CET) Subject: [pypy-commit] pypy Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092: Minor whatsnew.rst markup tweaks (edited online with Bitbucket) Message-ID: <20151103112405.7785F1C065A@cobra.cs.uni-duesseldorf.de> Author: Zearin Branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 Changeset: r80509:7f2a0fc28f4b Date: 2015-11-01 14:21 +0000 http://bitbucket.org/pypy/pypy/changeset/7f2a0fc28f4b/ Log: Minor whatsnew.rst markup tweaks (edited online with Bitbucket) diff --git a/pypy/doc/whatsnew-4.0.0.rst b/pypy/doc/whatsnew-4.0.0.rst --- a/pypy/doc/whatsnew-4.0.0.rst +++ b/pypy/doc/whatsnew-4.0.0.rst @@ -6,12 +6,12 @@ .. startrev: 3a8f5481dab4 .. branch: keys_with_hash -Improve the performance of dict.update() and a bunch of methods from +Improve the performance of ``dict.update()`` and a bunch of methods from sets, by reusing the hash value stored in one dict when inspecting or changing another dict with that key. .. branch: optresult-unroll -A major refactoring of the ResOperations that kills Box. Also rewrote +A major refactoring of the ``ResOperations`` that kills Box. Also rewrote unrolling to enable future enhancements. Should improve warmup time by 20% or so. @@ -24,7 +24,7 @@ .. branch: gc-more-incremental Remove a source of non-incremental-ness in the GC: now -external_malloc() no longer runs gc_step_until() any more. If there +``external_malloc()`` no longer runs ``gc_step_until()`` any more. If there is a currently-running major collection, we do only so many steps before returning. This number of steps depends on the size of the allocated object. It is controlled by tracking the general progress @@ -55,7 +55,7 @@ floats, cf. issue #2148. .. branch: cffi-stdcall -Win32: support '__stdcall' in CFFI. +Win32: support ``__stdcall`` in CFFI. .. branch: callfamily @@ -67,19 +67,19 @@ .. branch: type_system-cleanup -Remove some remnants of the old ootypesystem vs lltypesystem dichotomy. +Remove some remnants of the old ``ootypesystem`` vs ``lltypesystem`` dichotomy. .. branch: cffi-handle-lifetime -ffi.new_handle() returns handles that work more like CPython's: they +``ffi.new_handle()`` returns handles that work more like CPython's: they remain valid as long as the target exists (unlike the previous -version, where handles become invalid *before* the __del__ is called). +version, where handles become invalid *before* the ``__del__`` is called). .. branch: ufunc-casting -allow automatic casting in ufuncs (and frompypyfunc) to cast the +allow automatic casting in ufuncs (and ``frompypyfunc``) to cast the arguments to the allowed function type declarations, fixes various -failures in linalg cffi functions +failures in linalg CFFI functions .. branch: vecopt .. branch: vecopt-merge @@ -94,4 +94,5 @@ .. branch: lazy-fast2locals improve the performance of simple trace functions by lazily calling -fast2locals and locals2fast only if f_locals is actually accessed. +``fast2locals`` and ``locals2fast`` only if ``f_locals`` is actually accessed. + From noreply at buildbot.pypy.org Tue Nov 3 06:24:07 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 12:24:07 +0100 (CET) Subject: [pypy-commit] pypy default: Merged in Zearin/pypy/Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 (pull request #352) Message-ID: <20151103112407.975CF1C135E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80510:452c074c6e37 Date: 2015-11-03 12:24 +0100 http://bitbucket.org/pypy/pypy/changeset/452c074c6e37/ Log: Merged in Zearin/pypy/Zearin/minor-whatsnewrst-markup-tweaks- edited-o-1446387512092 (pull request #352) Minor whatsnew.rst markup tweaks (edited online with Bitbucket) diff --git a/pypy/doc/whatsnew-4.0.0.rst b/pypy/doc/whatsnew-4.0.0.rst --- a/pypy/doc/whatsnew-4.0.0.rst +++ b/pypy/doc/whatsnew-4.0.0.rst @@ -6,12 +6,12 @@ .. startrev: 3a8f5481dab4 .. branch: keys_with_hash -Improve the performance of dict.update() and a bunch of methods from +Improve the performance of ``dict.update()`` and a bunch of methods from sets, by reusing the hash value stored in one dict when inspecting or changing another dict with that key. .. branch: optresult-unroll -A major refactoring of the ResOperations that kills Box. Also rewrote +A major refactoring of the ``ResOperations`` that kills Box. Also rewrote unrolling to enable future enhancements. Should improve warmup time by 20% or so. @@ -24,7 +24,7 @@ .. branch: gc-more-incremental Remove a source of non-incremental-ness in the GC: now -external_malloc() no longer runs gc_step_until() any more. If there +``external_malloc()`` no longer runs ``gc_step_until()`` any more. If there is a currently-running major collection, we do only so many steps before returning. This number of steps depends on the size of the allocated object. It is controlled by tracking the general progress @@ -55,7 +55,7 @@ floats, cf. issue #2148. .. branch: cffi-stdcall -Win32: support '__stdcall' in CFFI. +Win32: support ``__stdcall`` in CFFI. .. branch: callfamily @@ -67,19 +67,19 @@ .. branch: type_system-cleanup -Remove some remnants of the old ootypesystem vs lltypesystem dichotomy. +Remove some remnants of the old ``ootypesystem`` vs ``lltypesystem`` dichotomy. .. branch: cffi-handle-lifetime -ffi.new_handle() returns handles that work more like CPython's: they +``ffi.new_handle()`` returns handles that work more like CPython's: they remain valid as long as the target exists (unlike the previous -version, where handles become invalid *before* the __del__ is called). +version, where handles become invalid *before* the ``__del__`` is called). .. branch: ufunc-casting -allow automatic casting in ufuncs (and frompypyfunc) to cast the +allow automatic casting in ufuncs (and ``frompypyfunc``) to cast the arguments to the allowed function type declarations, fixes various -failures in linalg cffi functions +failures in linalg CFFI functions .. branch: vecopt .. branch: vecopt-merge @@ -94,4 +94,5 @@ .. branch: lazy-fast2locals improve the performance of simple trace functions by lazily calling -fast2locals and locals2fast only if f_locals is actually accessed. +``fast2locals`` and ``locals2fast`` only if ``f_locals`` is actually accessed. + From noreply at buildbot.pypy.org Tue Nov 3 07:56:59 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 3 Nov 2015 13:56:59 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: saving byte_count as attribute to codebuilder instead as attribute of the function Message-ID: <20151103125659.A2D2C1C06BE@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80511:e9d5e097f0aa Date: 2015-11-02 18:21 +0100 http://bitbucket.org/pypy/pypy/changeset/e9d5e097f0aa/ Log: saving byte_count as attribute to codebuilder instead as attribute of the function diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -354,7 +354,6 @@ newargs[i] = args[i] return func(self, *newargs) function.__name__ = mnemonic - function._byte_count = func._byte_count return function def is_branch_relative(name): @@ -375,3 +374,5 @@ name = mnemonic + "_" + instrtype setattr(clazz, name, func) setattr(clazz, mnemonic, build_unpack_func(mnemonic, func)) + setattr(clazz, mnemonic + '_byte_count', func._byte_count) + del func._byte_count diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -2,6 +2,7 @@ from rpython.jit.backend.zarch import locations as l from rpython.jit.metainterp.history import (INT, REF, FLOAT, TargetToken) +from rpython.jit.metainterp.resoperation import rop from rpython.rtyper.lltypesystem import lltype, rffi, llmemory from rpython.jit.backend.zarch.arch import (WORD, RECOVERY_GCMAP_POOL_OFFSET, RECOVERY_TARGET_POOL_OFFSET) @@ -62,8 +63,8 @@ if self.size % 2 == 1: self.size += 1 assert self.size < 2**16-1 - asm.mc.BRAS(r.POOL, l.imm(self.size+mc.BRAS._byte_count)) - self.pool_start = mc.get_relative_pos() + asm.mc.BRAS(r.POOL, l.imm(self.size+asm.mc.BRAS_byte_count)) + self.pool_start = asm.mc.get_relative_pos() asm.mc.write('\x00' * self.size) print "pool with %d quad words" % (self.size // 8) From noreply at buildbot.pypy.org Tue Nov 3 07:57:01 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 3 Nov 2015 13:57:01 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: implemented patch pending failure recoveries after a guard has failed and a bridge is attached (r13 is not yet restored correctly on bridge to label jump Message-ID: <20151103125701.C63461C06BE@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80512:e4a706c55bfc Date: 2015-11-03 13:08 +0100 http://bitbucket.org/pypy/pypy/changeset/e4a706c55bfc/ Log: implemented patch pending failure recoveries after a guard has failed and a bridge is attached (r13 is not yet restored correctly on bridge to label jump diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -1,4 +1,5 @@ -from rpython.jit.backend.llsupport.assembler import GuardToken, BaseAssembler +from rpython.jit.backend.llsupport.assembler import (GuardToken, BaseAssembler, + debug_bridge, DEBUG_COUNTER) from rpython.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper from rpython.jit.backend.llsupport import jitframe, rewrite from rpython.jit.backend.model import CompiledLoopToken @@ -208,11 +209,11 @@ """ descrs = self.cpu.gc_ll_descr.getframedescrs(self.cpu) ofs = self.cpu.unpack_fielddescr(descrs.arraydescr.lendescr) - mc.LG(r.r2, l.addr(ofs, r.SPP)) + #mc.LG(r.r2, l.addr(ofs, r.SPP)) patch_pos = mc.currpos() - mc.TRAP2() # placeholder for cmpdi(0, r2, ...) - mc.TRAP2() # placeholder for bge - mc.TRAP2() # placeholder for li(r0, ...) + #mc.TRAP2() # placeholder for cmpdi(0, r2, ...) + #mc.TRAP2() # placeholder for bge + #mc.TRAP2() # placeholder for li(r0, ...) #mc.load_imm(r.SCRATCH2, self._frame_realloc_slowpath) #mc.mtctr(r.SCRATCH2.value) #self.load_gcmap(mc, r.r2, gcmap) @@ -254,7 +255,7 @@ self.update_frame_depth(frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) # size_excluding_failure_stuff = self.mc.get_relative_pos() - self.pool.post_assemble(self.mc, self.pending_guard_tokens) + self.pool.post_assemble(self) self.write_pending_failure_recoveries() full_size = self.mc.get_relative_pos() # @@ -313,12 +314,14 @@ self.current_clt.allgcrefs, self.current_clt.frame_info) self._check_frame_depth(self.mc, regalloc.get_gcmap()) + self.pool.pre_assemble(self, operations) frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, operations) codeendpos = self.mc.get_relative_pos() + self.pool.post_assemble(self) self.write_pending_failure_recoveries() fullsize = self.mc.get_relative_pos() # - self.patch_stack_checks(frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) + # TODO self.patch_stack_checks(frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) rawstart = self.materialize_loop(original_loop_token) debug_bridge(descr_number, rawstart, codeendpos) self.patch_pending_failure_recoveries(rawstart) @@ -335,6 +338,18 @@ self.teardown() return AsmInfo(ops_offset, startpos + rawstart, codeendpos - startpos) + def patch_jump_for_descr(self, faildescr, adr_new_target): + # 'faildescr.adr_jump_offset' is the address of an instruction that is a + # conditional jump. We must patch this conditional jump to go + # to 'adr_new_target'. + # Updates the pool address + mc = InstrBuilder() + mc.write_i64(adr_new_target) + print "addr is", hex(adr_new_target), "writing to", hex(faildescr.adr_jump_offset) + mc.copy_to_raw_memory(faildescr.adr_jump_offset) + assert faildescr.adr_jump_offset != 0 + faildescr.adr_jump_offset = 0 # means "patched" + def fixup_target_tokens(self, rawstart): for targettoken in self.target_tokens_currently_compiling: targettoken._ll_loop_code += rawstart @@ -475,9 +490,9 @@ for tok in self.pending_guard_tokens: addr = rawstart + tok.pos_jump_offset # - # XXX see patch_jump_for_descr() - tok.faildescr.adr_jump_offset = rawstart + tok.pos_recovery_stub - # + tok.faildescr.adr_jump_offset = rawstart + \ + self.pool.pool_start + tok._pool_offset + \ + RECOVERY_TARGET_POOL_OFFSET relative_target = tok.pos_recovery_stub - tok.pos_jump_offset # if not tok.guard_not_invalidated(): @@ -526,12 +541,12 @@ self.mc.LMG(r.r6, r.r15, l.addr(upoffset, r.SP)) self.jmpto(r.r14) - def _push_core_regs_to_jitframe(self, mc, includes=r.MANAGED_REGS): + def _push_core_regs_to_jitframe(self, mc, includes=r.registers): base_ofs = self.cpu.get_baseofs_of_frame_field() assert len(includes) == 16 mc.STMG(r.r0, r.r15, l.addr(base_ofs, r.SPP)) - def _push_fp_regs_to_jitframe(self, mc, includes=r.MANAGED_FP_REGS): + def _push_fp_regs_to_jitframe(self, mc, includes=r.fpregisters): base_ofs = self.cpu.get_baseofs_of_frame_field() assert len(includes) == 16 v = 16 @@ -562,7 +577,10 @@ if descr in self.target_tokens_currently_compiling: self.mc.b_offset(descr._ll_loop_code) else: - self.mc.b_abs(descr._ll_loop_code) + offset = self.pool.get_descr_offset(descr) + self.mc.b_abs(l.pool(offset)) + print "writing", hex(descr._ll_loop_code) + self.pool.overwrite_64(self.mc, offset, descr._ll_loop_code) def emit_finish(self, op, arglocs, regalloc): diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -36,6 +36,17 @@ self._pool_offset = -1 class AbstractZARCHBuilder(object): + + def write_i64(self, word): + self.writechar(chr((word >> 56) & 0xFF)) + self.writechar(chr((word >> 48) & 0xFF)) + self.writechar(chr((word >> 40) & 0xFF)) + self.writechar(chr((word >> 32) & 0xFF)) + self.writechar(chr((word >> 24) & 0xFF)) + self.writechar(chr((word >> 16) & 0xFF)) + self.writechar(chr((word >> 8) & 0xFF)) + self.writechar(chr(word & 0xFF)) + def write_i32(self, word): self.writechar(chr((word >> 24) & 0xFF)) self.writechar(chr((word >> 16) & 0xFF)) @@ -104,7 +115,11 @@ def b_offset(self, reladdr): offset = reladdr - self.get_relative_pos() - self.BRC(l.imm(0xf), l.imm(offset)) + self.BRC(c.ANY, l.imm(offset)) + + def b_abs(self, pooled): + self.LG(r.r10, pooled) + self.BCR(c.ANY, r.r10) def reserve_guard_branch(self): print "reserve!", self.get_relative_pos() diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -9,6 +9,7 @@ LE = loc.imm(EQ.value | LT.value) GE = loc.imm(EQ.value | GT.value) NE = loc.imm(LT.value | GT.value) +ANY = loc.imm(0xf) cond_none = loc.imm(0x0) diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -12,6 +12,8 @@ self.size = 0 # the offset to index the pool self.pool_start = 0 + self.label_offset = 0 + self.label_count = 0 self.offset_map = {} def ensure_can_hold_constants(self, asm, op): @@ -20,24 +22,36 @@ # 1x target address self.offset_map[op.getdescr()] = self.size self.reserve_literal(2 * 8) - if op.getopnum() == rop.JUMP: + elif op.getopnum() == rop.JUMP: descr = op.getdescr() if descr not in asm.target_tokens_currently_compiling: # this is a 'long' jump instead of a relative jump + self.offset_map[descr] = self.size self.reserve_literal(8) + elif op.getopnum() == rop.LABEL: + descr = op.getdescr() + if descr not in asm.target_tokens_currently_compiling: + # this is a 'long' jump instead of a relative jump + descr._ll_loop_code = self.pool_start + self.offset_map[descr] = self.size + self.reserve_literal(asm.BRAS_byte_count) for arg in op.getarglist(): if arg.is_constant(): self.offset_map[arg] = self.size self.reserve_literal(8) + def get_descr_offset(self, descr): + return self.offset_map[descr] + def reserve_literal(self, size): self.size += size print "resized to", self.size, "(+",size,")" def reset(self): self.pool_start = 0 + self.label_offset = 0 self.size = 0 - self.offset = 0 + self.offset_map.clear() def pre_assemble(self, asm, operations): self.reset() @@ -60,8 +74,10 @@ if self.size == 0: # no pool needed! return - if self.size % 2 == 1: - self.size += 1 + self.size += 8 + assert self.size % 2 == 0 + #if self.size % 2 == 1: + # self.size += 1 assert self.size < 2**16-1 asm.mc.BRAS(r.POOL, l.imm(self.size+asm.mc.BRAS_byte_count)) self.pool_start = asm.mc.get_relative_pos() @@ -80,7 +96,9 @@ mc.overwrite(index+6, chr(value >> 8 & 0xff)) mc.overwrite(index+7, chr(value & 0xff)) - def post_assemble(self, mc, pending_guard_tokens): + def post_assemble(self, asm): + mc = asm.mc + pending_guard_tokens = asm.pending_guard_tokens if self.size == 0: return for val, offset in self.offset_map.items(): @@ -101,5 +119,4 @@ guard_token._pool_offset = offset ptr = rffi.cast(lltype.Signed, guard_token.gcmap) self.overwrite_64(mc, offset + RECOVERY_GCMAP_POOL_OFFSET, ptr) - self.offset_map.clear() diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -121,6 +121,7 @@ def ensure_reg(self, box): if isinstance(box, Const): + xxx loc = self.get_scratch_reg() immvalue = self.convert_to_int(box) self.assembler.mc.load_imm(loc, immvalue) diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -7,8 +7,8 @@ [r0,r1,r2,r3,r4,r5,r6,r7,r8, r9,r10,r11,r12,r13,r14,r15] = registers -MANAGED_REGS = registers -VOLATILES = [r6,r7,r8,r9,r10,r11,r12,r13,r14,r15] +MANAGED_REGS = [r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r12] +VOLATILES = [r6,r7,r8,r9,r10,r12] SP = r15 RETURN = r14 POOL = r13 From noreply at buildbot.pypy.org Tue Nov 3 09:33:33 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 15:33:33 +0100 (CET) Subject: [pypy-commit] pypy default: Silence gcc warnings that sometimes show up Message-ID: <20151103143333.567EB1C065A@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80513:81b4c17ff215 Date: 2015-11-03 15:33 +0100 http://bitbucket.org/pypy/pypy/changeset/81b4c17ff215/ Log: Silence gcc warnings that sometimes show up diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, From noreply at buildbot.pypy.org Tue Nov 3 09:33:38 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 3 Nov 2015 15:33:38 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: jump to loop header from a bridge is now correctly working Message-ID: <20151103143338.9D6471C065A@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80514:07e92acaeeec Date: 2015-11-03 15:23 +0100 http://bitbucket.org/pypy/pypy/changeset/07e92acaeeec/ Log: jump to loop header from a bridge is now correctly working diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -314,7 +314,7 @@ self.current_clt.allgcrefs, self.current_clt.frame_info) self._check_frame_depth(self.mc, regalloc.get_gcmap()) - self.pool.pre_assemble(self, operations) + self.pool.pre_assemble(self, operations, bridge=True) frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, operations) codeendpos = self.mc.get_relative_pos() self.pool.post_assemble(self) @@ -577,8 +577,9 @@ if descr in self.target_tokens_currently_compiling: self.mc.b_offset(descr._ll_loop_code) else: + # restore the pool address offset = self.pool.get_descr_offset(descr) - self.mc.b_abs(l.pool(offset)) + self.mc.b_abs(l.pool(offset), restore_pool=True) print "writing", hex(descr._ll_loop_code) self.pool.overwrite_64(self.mc, offset, descr._ll_loop_code) diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -117,8 +117,9 @@ offset = reladdr - self.get_relative_pos() self.BRC(c.ANY, l.imm(offset)) - def b_abs(self, pooled): + def b_abs(self, pooled, restore_pool=False): self.LG(r.r10, pooled) + self.LG(r.POOL, l.pool(0)) self.BCR(c.ANY, r.r10) def reserve_guard_branch(self): diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -34,7 +34,6 @@ # this is a 'long' jump instead of a relative jump descr._ll_loop_code = self.pool_start self.offset_map[descr] = self.size - self.reserve_literal(asm.BRAS_byte_count) for arg in op.getarglist(): if arg.is_constant(): self.offset_map[arg] = self.size @@ -53,7 +52,7 @@ self.size = 0 self.offset_map.clear() - def pre_assemble(self, asm, operations): + def pre_assemble(self, asm, operations, bridge=True): self.reset() # O(len(operations)). I do not think there is a way # around this. @@ -69,6 +68,8 @@ # the current solution (gcc does the same), use a literal pool # located at register r13. This one can easily offset with 20 # bit signed values (should be enough) + if bridge: + self.reserve_literal(8) for op in operations: self.ensure_can_hold_constants(asm, op) if self.size == 0: @@ -79,9 +80,13 @@ #if self.size % 2 == 1: # self.size += 1 assert self.size < 2**16-1 + if bridge: + asm.mc.LGR(r.SCRATCH, r.r13) asm.mc.BRAS(r.POOL, l.imm(self.size+asm.mc.BRAS_byte_count)) self.pool_start = asm.mc.get_relative_pos() - asm.mc.write('\x00' * self.size) + asm.mc.write('\xFF' * self.size) + if bridge: + asm.mc.STG(r.SCRATCH, l.pool(0)) print "pool with %d quad words" % (self.size // 8) def overwrite_64(self, mc, index, value): diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -7,13 +7,13 @@ [r0,r1,r2,r3,r4,r5,r6,r7,r8, r9,r10,r11,r12,r13,r14,r15] = registers -MANAGED_REGS = [r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r12] -VOLATILES = [r6,r7,r8,r9,r10,r12] +MANAGED_REGS = [r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10] +VOLATILES = [r6,r7,r8,r9,r10] SP = r15 RETURN = r14 POOL = r13 SPP = r11 -SCRATCH = r0 +SCRATCH = r12 [f0,f1,f2,f3,f4,f5,f6,f7,f8, f9,f10,f11,f12,f13,f14,f15] = fpregisters From noreply at buildbot.pypy.org Tue Nov 3 10:04:53 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 3 Nov 2015 16:04:53 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: test drag along, found one bug (did not copy compare long instr bytes from manual) Message-ID: <20151103150453.75F181C13B5@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80515:4baab7a89095 Date: 2015-11-03 16:04 +0100 http://bitbucket.org/pypy/pypy/changeset/4baab7a89095/ Log: test drag along, found one bug (did not copy compare long instr bytes from manual) diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -155,4 +155,5 @@ # Used to build the MachineCodeBlockWrapper all_instructions = sorted([name for cls in _classes for name in cls.__dict__ \ - if name.split('_')[0].isupper() and '_' in name]) + if name.split('_')[0].isupper() and '_' in name and \ + not name.endswith('_byte_count')]) diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -27,7 +27,7 @@ 'CGR': ('rre', ['\xB9','\x20']), 'CG': ('rxy', ['\xE3','\x20']), 'CLGR': ('rre', ['\xB9','\x21']), - 'CLG': ('rxy', ['\xE3','\x20']), + 'CLG': ('rxy', ['\xE3','\x21']), 'CGHI': ('ri', ['\xA7','\x0F']), } diff --git a/rpython/jit/backend/zarch/test/test_assembler.py b/rpython/jit/backend/zarch/test/test_assembler.py --- a/rpython/jit/backend/zarch/test/test_assembler.py +++ b/rpython/jit/backend/zarch/test/test_assembler.py @@ -25,9 +25,6 @@ CPU = getcpuclass() -def byte_count(func): - return func._byte_count - def BFL(value, short=False): if short: return struct.pack('f', value) @@ -114,8 +111,8 @@ is AssemblerZARCH.emit_int_add.im_func def test_byte_count_instr(self): - byte_count(self.mc.BRC) == 4 - byte_count(self.mc.LG) == 6 + assert self.mc.BRC_byte_count == 4 + assert self.mc.LG_byte_count == 6 def test_load_small_int_to_reg(self): self.a.mc.LGHI(reg.r2, loc.imm(123)) @@ -178,7 +175,7 @@ def test_literal_pool(self): self.a.gen_func_prolog() - self.a.mc.BRAS(reg.r13, loc.imm(8 + byte_count(self.mc.BRAS))) + self.a.mc.BRAS(reg.r13, loc.imm(8 + self.mc.BRAS_byte_count)) self.a.mc.write('\x08\x07\x06\x05\x04\x03\x02\x01') self.a.mc.LG(reg.r2, loc.addr(0, reg.r13)) self.a.gen_func_epilog() From noreply at buildbot.pypy.org Tue Nov 3 11:50:01 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 3 Nov 2015 17:50:01 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: saving the last used constant pool below the stack pointer Message-ID: <20151103165002.1A0A41C065A@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80516:2e5796108f90 Date: 2015-11-03 17:50 +0100 http://bitbucket.org/pypy/pypy/changeset/2e5796108f90/ Log: saving the last used constant pool below the stack pointer diff --git a/rpython/jit/backend/zarch/arch.py b/rpython/jit/backend/zarch/arch.py --- a/rpython/jit/backend/zarch/arch.py +++ b/rpython/jit/backend/zarch/arch.py @@ -5,17 +5,19 @@ # OFFSET # +------------------------------+ 0 # | gpr save are (int+float) | -# +------------------------------+ 8 -# | local vars | -# +------------------------------+ 0 +# +------------------------------+ GPR_STACK_SAVE_IN_BYTES | 120 +# | last base pointer | +# +------------------------------+ BSP_STACK_OFFSET | 128 # | | # +------------------------------+ # | | -# +------------------------------+ <- SP 0 (r15) +# +------------------------------+ | 140 +# # GPR_STACK_SAVE_IN_BYTES = 120 STD_FRAME_SIZE_IN_BYTES = 140 +BSP_STACK_OFFSET = 128 THREADLOCAL_ADDR_OFFSET = 8 assert STD_FRAME_SIZE_IN_BYTES % 2 == 0 diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -517,9 +517,10 @@ # Build a new stackframe of size STD_FRAME_SIZE_IN_BYTES self.mc.STMG(r.r6, r.r15, l.addr(-GPR_STACK_SAVE_IN_BYTES, r.SP)) self.mc.AGHI(r.SP, l.imm(-STD_FRAME_SIZE_IN_BYTES)) + self.mc.LGR(r.BSP, r.SP) # save r4, the second argument, to THREADLOCAL_ADDR_OFFSET - self.mc.STG(r.r3, l.addr(THREADLOCAL_ADDR_OFFSET, r.SP)) + #self.mc.STG(r.r3, l.addr(THREADLOCAL_ADDR_OFFSET, r.SP)) # move the first argument to SPP: the jitframe object self.mc.LGR(r.SPP, r.r2) @@ -579,7 +580,10 @@ else: # restore the pool address offset = self.pool.get_descr_offset(descr) - self.mc.b_abs(l.pool(offset), restore_pool=True) + self.mc.LG(r.SCRATCH, l.pool(offset)) + self.mc.LG(r.POOL, l.addr(0, r.BSP)) + self.mc.AGHI(r.BSP, l.imm(8)) + self.mc.BCR(c.ANY, r.SCRATCH) print "writing", hex(descr._ll_loop_code) self.pool.overwrite_64(self.mc, offset, descr._ll_loop_code) diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -117,11 +117,6 @@ offset = reladdr - self.get_relative_pos() self.BRC(c.ANY, l.imm(offset)) - def b_abs(self, pooled, restore_pool=False): - self.LG(r.r10, pooled) - self.LG(r.POOL, l.pool(0)) - self.BCR(c.ANY, r.r10) - def reserve_guard_branch(self): print "reserve!", self.get_relative_pos() self.BRC(l.imm(0x0), l.imm(0)) diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -52,7 +52,7 @@ self.size = 0 self.offset_map.clear() - def pre_assemble(self, asm, operations, bridge=True): + def pre_assemble(self, asm, operations, bridge=False): self.reset() # O(len(operations)). I do not think there is a way # around this. @@ -68,25 +68,24 @@ # the current solution (gcc does the same), use a literal pool # located at register r13. This one can easily offset with 20 # bit signed values (should be enough) - if bridge: - self.reserve_literal(8) for op in operations: self.ensure_can_hold_constants(asm, op) if self.size == 0: # no pool needed! return - self.size += 8 assert self.size % 2 == 0 #if self.size % 2 == 1: # self.size += 1 - assert self.size < 2**16-1 + jump_offset = self.size+asm.mc.BRAS_byte_count + assert jump_offset < 2**15-1 if bridge: - asm.mc.LGR(r.SCRATCH, r.r13) - asm.mc.BRAS(r.POOL, l.imm(self.size+asm.mc.BRAS_byte_count)) + asm.mc.LGR(r.SCRATCH, r.POOL) + asm.mc.BRAS(r.POOL, l.imm(jump_offset)) self.pool_start = asm.mc.get_relative_pos() asm.mc.write('\xFF' * self.size) if bridge: - asm.mc.STG(r.SCRATCH, l.pool(0)) + asm.mc.STG(r.SCRATCH, l.addr(-8, r.BSP)) + asm.mc.AGHI(r.BSP, l.imm(-8)) print "pool with %d quad words" % (self.size // 8) def overwrite_64(self, mc, index, value): diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -7,13 +7,14 @@ [r0,r1,r2,r3,r4,r5,r6,r7,r8, r9,r10,r11,r12,r13,r14,r15] = registers -MANAGED_REGS = [r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10] +MANAGED_REGS = [r0,r2,r3,r4,r5,r6,r7,r8,r9,r10] VOLATILES = [r6,r7,r8,r9,r10] SP = r15 +BSP = r12 RETURN = r14 POOL = r13 SPP = r11 -SCRATCH = r12 +SCRATCH = r1 [f0,f1,f2,f3,f4,f5,f6,f7,f8, f9,f10,f11,f12,f13,f14,f15] = fpregisters From noreply at buildbot.pypy.org Tue Nov 3 12:28:05 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 3 Nov 2015 18:28:05 +0100 (CET) Subject: [pypy-commit] pypy array_interface: implement creating ndarrays via __array_interface__ Message-ID: <20151103172805.645771C13E2@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: array_interface Changeset: r80517:8662c0105271 Date: 2015-11-03 19:14 +0200 http://bitbucket.org/pypy/pypy/changeset/8662c0105271/ Log: implement creating ndarrays via __array_interface__ From noreply at buildbot.pypy.org Tue Nov 3 12:28:07 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 3 Nov 2015 18:28:07 +0100 (CET) Subject: [pypy-commit] pypy array_interface: test, implement enough to create ndarrays from Pillow Images Message-ID: <20151103172807.77DA41C13E2@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: array_interface Changeset: r80518:901d9fdf43fd Date: 2015-11-03 19:15 +0200 http://bitbucket.org/pypy/pypy/changeset/901d9fdf43fd/ Log: test, implement enough to create ndarrays from Pillow Images diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -371,6 +371,8 @@ @specialize.arg(2) def call_method(self, w_obj, s, *args): # XXX even the hacks have hacks + if s == 'size': # used in _array() but never called by tests + return IntObject(0) return getattr(w_obj, 'descr_' + s)(self, *args) @specialize.arg(1) diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -2,6 +2,7 @@ from pypy.interpreter.gateway import unwrap_spec, WrappedDefault from rpython.rlib.buffer import SubBuffer from rpython.rlib.rstring import strip_spaces +from rpython.rlib.rawstorage import RAW_STORAGE_PTR from rpython.rtyper.lltypesystem import lltype, rffi from pypy.module.micronumpy import descriptor, loop, support @@ -45,7 +46,7 @@ try: w_interface = space.getattr(w_object, space.wrap("__array_interface__")) if w_interface is None: - return None + return None, False version_w = space.finditem(w_interface, space.wrap("version")) if version_w is None: raise oefmt(space.w_ValueError, "__array_interface__ found without" @@ -67,19 +68,41 @@ raise oefmt(space.w_ValueError, "__array_interface__ missing one or more required keys: shape, typestr" ) - raise oefmt(space.w_NotImplementedError, - "creating array from __array_interface__ not supported yet") - ''' - data_w = space.listview() + if w_descr is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ descr not supported yet") + if w_strides is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ strides not supported yet") shape = [space.int_w(i) for i in space.listview(w_shape)] dtype = descriptor.decode_w_dtype(space, w_dtype) - rw = space.is_true(data_w[1]) - ''' - #print 'create view from shape',shape,'dtype',dtype,'descr',w_descr,'data',data_w[0],'rw',rw - return None + if dtype is None: + raise oefmt(space.w_ValueError, + "__array_interface__ could not decode dtype %R", w_dtype + ) + if w_data is not None and (space.isinstance_w(w_data, space.w_tuple) or space.isinstance_w(w_data, space.w_list)): + data_w = space.listview(w_data) + data = rffi.cast(RAW_STORAGE_PTR, space.int_w(data_w[0])) + read_only = True # XXX why not space.is_true(data_w[1]) + offset = 0 + return W_NDimArray.from_shape_and_storage(space, shape, data, dtype, start=offset), read_only + if w_data is None: + data = w_object + else: + data = w_data + w_offset = space.finditem(w_interface, space.wrap('offset')) + if w_offset is None: + offset = 0 + else: + offset = space.int_w(w_offset) + #print 'create view from shape',shape,'dtype',dtype,'data',data + arr = frombuffer(space, data, dtype, support.product(shape), offset) + new_impl = arr.implementation.reshape(arr, shape) + return W_NDimArray(new_impl), False + except OperationError as e: if e.match(space, space.w_AttributeError): - return None + return None, False raise @@ -103,19 +126,20 @@ if space.isinstance_w(w_object, space.w_type): raise oefmt(space.w_ValueError, "cannot create ndarray from type instance") # for anything that isn't already an array, try __array__ method first + dtype = descriptor.decode_w_dtype(space, w_dtype) if not isinstance(w_object, W_NDimArray): w_array = try_array_method(space, w_object, w_dtype) if w_array is not None: # continue with w_array, but do further operations in place w_object = w_array copy = False + dtype = w_object.get_dtype() if not isinstance(w_object, W_NDimArray): - w_array = try_interface_method(space, w_object) + w_array, _copy = try_interface_method(space, w_object) if w_array is not None: w_object = w_array - copy = False - dtype = descriptor.decode_w_dtype(space, w_dtype) - + copy = _copy + dtype = w_object.get_dtype() if isinstance(w_object, W_NDimArray): npy_order = order_converter(space, w_order, NPY.ANYORDER) diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -3075,7 +3075,7 @@ class Dummy(object): def __init__(self, aif=None): - if aif: + if aif is not None: self.__array_interface__ = aif a = array(Dummy()) @@ -3084,6 +3084,27 @@ raises(ValueError, array, Dummy({'version': 0})) raises(ValueError, array, Dummy({'version': 'abc'})) raises(ValueError, array, Dummy({'version': 3})) + raises(TypeError, array, Dummy({'version': 3, 'typestr': 'f8', 'shape': ('a', 3)})) + + a = array([1, 2, 3]) + interface_a = a.__array_interface__ + interface_a.pop('strides') + b = array(Dummy(interface_a)) + b[1] = 200 + assert a[1] == 2 # upstream compatibility, is this a bug? + interface_a = a.__array_interface__ + interface_b = b.__array_interface__ + # only the data[0] value should differ + assert interface_a['data'][0] != interface_b['data'][0] + assert interface_b['data'][1] == interface_a['data'][1] + interface_b.pop('data') + interface_a.pop('data') + assert interface_a == interface_b + + b = array(Dummy({'version':3, 'shape': (50,), 'typestr': 'u1', + 'data': 'a'*100})) + assert b.dtype == 'uint8' + assert b.shape == (50,) def test_array_indexing_one_elem(self): from numpy import array, arange From noreply at buildbot.pypy.org Tue Nov 3 12:44:00 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 3 Nov 2015 18:44:00 +0100 (CET) Subject: [pypy-commit] pypy default: Use a real exception instead of an assertion in LLFrame.op_debug_assert() Message-ID: <20151103174400.C3DF41C065A@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80519:46cb647a4410 Date: 2015-11-03 17:43 +0000 http://bitbucket.org/pypy/pypy/changeset/46cb647a4410/ Log: Use a real exception instead of an assertion in LLFrame.op_debug_assert() diff --git a/rpython/rtyper/llinterp.py b/rpython/rtyper/llinterp.py --- a/rpython/rtyper/llinterp.py +++ b/rpython/rtyper/llinterp.py @@ -41,6 +41,10 @@ def __str__(self): return ': '.join([str(x) for x in self.args]) +class LLAssertFailure(Exception): + pass + + def type_name(etype): return ''.join(etype.name.chars) @@ -508,7 +512,8 @@ track(*ll_objects) def op_debug_assert(self, x, msg): - assert x, msg + if not x: + raise LLAssertFailure(msg) def op_debug_fatalerror(self, ll_msg, ll_exc=None): msg = ''.join(ll_msg.chars) diff --git a/rpython/rtyper/test/test_rlist.py b/rpython/rtyper/test/test_rlist.py --- a/rpython/rtyper/test/test_rlist.py +++ b/rpython/rtyper/test/test_rlist.py @@ -5,7 +5,7 @@ from rpython.rlib.debug import ll_assert from rpython.rtyper.error import TyperError -from rpython.rtyper.llinterp import LLException +from rpython.rtyper.llinterp import LLException, LLAssertFailure from rpython.rtyper.lltypesystem import rlist as ll_rlist from rpython.rtyper.lltypesystem.rlist import ListRepr, FixedSizeListRepr, ll_newlist, ll_fixed_newlist from rpython.rtyper.rint import signed_repr @@ -1182,7 +1182,8 @@ res = self.interpret(f, [0]) assert res == 1 - py.test.raises(AssertionError, self.interpret, f, [1]) + with py.test.raises(LLAssertFailure): + self.interpret(f, [1]) def f(x): l = [1] @@ -1227,7 +1228,8 @@ res = self.interpret(f, [0]) assert res == 1 - py.test.raises(AssertionError, self.interpret, f, [1]) + with py.test.raises(LLAssertFailure): + self.interpret(f, [1]) def f(x): l = [1] @@ -1264,7 +1266,8 @@ res = self.interpret(f, [0]) assert res == 1 - py.test.raises(AssertionError, self.interpret, f, [1]) + with py.test.raises(LLAssertFailure): + self.interpret(f, [1]) def test_charlist_extension_1(self): def f(n): diff --git a/rpython/rtyper/test/test_rstr.py b/rpython/rtyper/test/test_rstr.py --- a/rpython/rtyper/test/test_rstr.py +++ b/rpython/rtyper/test/test_rstr.py @@ -10,6 +10,7 @@ from rpython.rtyper.rtyper import TyperError from rpython.rtyper.test.tool import BaseRtypingTest from rpython.rtyper.annlowlevel import llstr, hlstr +from rpython.rtyper.llinterp import LLAssertFailure def test_parse_fmt(): @@ -979,12 +980,8 @@ res = self.interpret(f, [0]) assert res == 'z' - try: - self.interpret_raises(IndexError, f, [1]) - except (AssertionError,), e: - pass - else: - assert False + with py.test.raises(LLAssertFailure): + self.interpret(f, [1]) def f(x): s = const("z") @@ -1021,12 +1018,8 @@ res = self.interpret(f, [0]) assert res == 'z' - try: - self.interpret_raises(IndexError, f, [1]) - except (AssertionError,), e: - pass - else: - assert False + with py.test.raises(LLAssertFailure): + self.interpret(f, [1]) def test_fold_concat(self): const = self.const From noreply at buildbot.pypy.org Tue Nov 3 12:46:47 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 3 Nov 2015 18:46:47 +0100 (CET) Subject: [pypy-commit] pypy default: remove extra quotes in conversion from object dtype to unicode, continuation of cdb5f895892c Message-ID: <20151103174647.43B8A1C065A@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80520:af5d2330798e Date: 2015-11-03 19:42 +0200 http://bitbucket.org/pypy/pypy/changeset/af5d2330798e/ Log: remove extra quotes in conversion from object dtype to unicode, continuation of cdb5f895892c diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py --- a/pypy/module/micronumpy/test/test_object_arrays.py +++ b/pypy/module/micronumpy/test/test_object_arrays.py @@ -178,6 +178,7 @@ assert 'a' * 100 in str(a) b = a.astype('U') assert b.dtype == 'U100' + assert 'a' * 100 in str(b) a = np.array([123], dtype='U') assert a[0] == u'123' diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -2221,7 +2221,10 @@ def coerce(self, space, dtype, w_item): if isinstance(w_item, boxes.W_UnicodeBox): return w_item - value = space.unicode_w(space.unicode_from_object(w_item)) + if isinstance(w_item, boxes.W_ObjectBox): + value = space.unicode_w(space.unicode_from_object(w_item.w_obj)) + else: + value = space.unicode_w(space.unicode_from_object(w_item)) return boxes.W_UnicodeBox(value) def store(self, arr, i, offset, box, native): From noreply at buildbot.pypy.org Tue Nov 3 13:20:34 2015 From: noreply at buildbot.pypy.org (vaibhavsood12) Date: Tue, 3 Nov 2015 19:20:34 +0100 (CET) Subject: [pypy-commit] pypy ppc-stacklet: Implementation of slp_switch for PPC Message-ID: <20151103182034.C244D1C065A@cobra.cs.uni-duesseldorf.de> Author: Vaibhav Sood Branch: ppc-stacklet Changeset: r80521:64dbe96612e5 Date: 2015-10-28 13:14 +0530 http://bitbucket.org/pypy/pypy/changeset/64dbe96612e5/ Log: Implementation of slp_switch for PPC diff --git a/rpython/translator/c/src/stacklet/slp_platformselect.h b/rpython/translator/c/src/stacklet/slp_platformselect.h --- a/rpython/translator/c/src/stacklet/slp_platformselect.h +++ b/rpython/translator/c/src/stacklet/slp_platformselect.h @@ -10,6 +10,8 @@ #include "switch_x86_gcc.h" /* gcc on X86 */ #elif defined(__GNUC__) && defined(__arm__) #include "switch_arm_gcc.h" /* gcc on arm */ +#elif defined(__GNUC__) && defined(__PPC64__) +#include "switch_ppc64_gcc.h" /* gcc on ppc64 */ #elif defined(__GNUC__) && defined(__mips__) && defined(_ABI64) #include "switch_mips64_gcc.h" /* gcc on mips64 */ #else diff --git a/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h b/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h new file mode 100644 --- /dev/null +++ b/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h @@ -0,0 +1,64 @@ + +static void __attribute__((optimize("O2"))) *slp_switch(void *(*save_state)(void*, void*), + void *(*restore_state)(void*, void*), + void *extra) +{ + void *result; + __asm__ volatile ( + /*Prologue: Save explicitly lr and some non-volatile registers used by compiler in caller code */ + "mflr 0\n" + "std 0, 16(1)\n" + "std 31, -8(1)\n" + "std 30, -16(1)\n" + "std 29, -24(1)\n" + "std 28, -32(1)\n" + "stdu 1, -176(1)\n" /* 48(save area) + 64(parameter area) + 64(non-volatile save area) = 176 bytes */ + /* stack is implicitly 16-byte aligned */ + + "mr 14, %[restore_state]\n" /* save 'restore_state' for later, r14 marked clobbered */ + "mr 15, %[extra]\n" /* save 'extra' for later, r15 marked clobbered */ + + "mtlr %[save_state]\n" /* save 'save_state' for branching */ + "mr 3, 1\n" /* arg 1: current (old) stack pointer */ + "mr 4, %[extra]\n" /* arg 2: extra */ + "stdu 1, -64(1)\n" /* create temp stack space for callee to use */ + "blrl\n" /* call save_state() */ + "nop\n" + "addi 1, 1, 64\n" /* destroy temp stack space */ + + "cmpdi 3, 0\n" /* skip the rest if the return value is null */ + "bt eq, zero\n" + + "mr 1, 3\n" /* change the stack pointer */ + /* From now on, the stack pointer is modified, but the content of the + stack is not restored yet. It contains only garbage here. */ + + "mr 5, 14\n" + "mtlr 5\n" + "mr 4, 15\n" /* arg 2: extra */ + /* arg 1: current (new) stack pointer is already in r3*/ + + "stdu 1, -64(1)\n" /* create temp stack space for callee to use */ + "blrl\n" /* call restore_state() */ + "nop\n" + "addi 1, 1, 64\n" /* destroy temp stack space */ + + /* The stack's content is now restored. */ + + "zero:\n" + /* Epilogue: Restore sp, lr and saved non-volatile registers */ + "ld 1, 0(1)\n" + "ld 0, 16(1)\n" + "mtlr 0\n" + "ld 28, -32(1)\n" + "ld 29, -24(1)\n" + "ld 30, -16(1)\n" + "ld 31, -8(1)\n" + : [result]"=r"(result) /* output variables */ + : [restore_state]"r"(restore_state), /* input variables */ + [save_state]"r"(save_state), + [extra]"r"(extra) + : "r0", "r4", "r5", "r14", "r15", "memory" + ); + return result; +} From noreply at buildbot.pypy.org Tue Nov 3 13:20:36 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 19:20:36 +0100 (CET) Subject: [pypy-commit] pypy ppc-stacklet: More tweaks, copying the Stackless version by Kristjan Valur Jonsson. Message-ID: <20151103182036.E951E1C065A@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ppc-stacklet Changeset: r80522:15335b9f2972 Date: 2015-11-03 19:12 +0100 http://bitbucket.org/pypy/pypy/changeset/15335b9f2972/ Log: More tweaks, copying the Stackless version by Kristjan Valur Jonsson. As far as I can tell this is now correct, but more testing is needed diff --git a/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h b/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h --- a/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h +++ b/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h @@ -1,64 +1,233 @@ +#if !(defined(__LITTLE_ENDIAN__) ^ defined(__BIG_ENDIAN__)) +# error "cannot determine if it is ppc64 or ppc64le" +#endif -static void __attribute__((optimize("O2"))) *slp_switch(void *(*save_state)(void*, void*), - void *(*restore_state)(void*, void*), - void *extra) +#ifdef __BIG_ENDIAN__ +# define TOC_AREA "40" +#else +# define TOC_AREA "24" +#endif + + +/* This depends on these attributes so that gcc generates a function + with no code before the asm, and only "blr" after. */ +static __attribute__((noinline, optimize("O2"))) +void *slp_switch(void *(*save_state)(void*, void*), + void *(*restore_state)(void*, void*), + void *extra) { void *result; __asm__ volatile ( - /*Prologue: Save explicitly lr and some non-volatile registers used by compiler in caller code */ - "mflr 0\n" - "std 0, 16(1)\n" - "std 31, -8(1)\n" - "std 30, -16(1)\n" - "std 29, -24(1)\n" - "std 28, -32(1)\n" - "stdu 1, -176(1)\n" /* 48(save area) + 64(parameter area) + 64(non-volatile save area) = 176 bytes */ - /* stack is implicitly 16-byte aligned */ + /* By Vaibhav Sood & Armin Rigo, with some copying from + the Stackless version by Kristjan Valur Jonsson */ - "mr 14, %[restore_state]\n" /* save 'restore_state' for later, r14 marked clobbered */ - "mr 15, %[extra]\n" /* save 'extra' for later, r15 marked clobbered */ - - "mtlr %[save_state]\n" /* save 'save_state' for branching */ - "mr 3, 1\n" /* arg 1: current (old) stack pointer */ - "mr 4, %[extra]\n" /* arg 2: extra */ - "stdu 1, -64(1)\n" /* create temp stack space for callee to use */ - "blrl\n" /* call save_state() */ - "nop\n" - "addi 1, 1, 64\n" /* destroy temp stack space */ + /* Save all 18 volatile GP registers, 18 volatile FP regs, and 12 + volatile vector regs. We need a stack frame of 144 bytes for FPR, + 144 bytes for GPR, 192 bytes for VR plus 48 bytes for the standard + stackframe = 528 bytes (a multiple of 16). */ - "cmpdi 3, 0\n" /* skip the rest if the return value is null */ + "mflr 0\n" /* Save LR into 16(r1) */ + "std 0, 16(1)\n" + + "std 14,-288(1)\n" /* the GPR save area is between -288(r1) */ + "std 15,-280(1)\n" /* included and -144(r1) excluded */ + "std 16,-272(1)\n" + "std 17,-264(1)\n" + "std 18,-256(1)\n" + "std 19,-248(1)\n" + "std 20,-240(1)\n" + "std 21,-232(1)\n" + "std 22,-224(1)\n" + "std 23,-216(1)\n" + "std 24,-208(1)\n" + "std 25,-200(1)\n" + "std 26,-192(1)\n" + "std 27,-184(1)\n" + "std 28,-176(1)\n" + "std 29,-168(1)\n" + "std 30,-160(1)\n" + "std 31,-152(1)\n" + + "stfd 14,-144(1)\n" /* the FPR save area is between -144(r1) */ + "stfd 15,-136(1)\n" /* included and 0(r1) excluded */ + "stfd 16,-128(1)\n" + "stfd 17,-120(1)\n" + "stfd 18,-112(1)\n" + "stfd 19,-104(1)\n" + "stfd 20,-96(1)\n" + "stfd 21,-88(1)\n" + "stfd 22,-80(1)\n" + "stfd 23,-72(1)\n" + "stfd 24,-64(1)\n" + "stfd 25,-56(1)\n" + "stfd 26,-48(1)\n" + "stfd 27,-40(1)\n" + "stfd 28,-32(1)\n" + "stfd 29,-24(1)\n" + "stfd 30,-16(1)\n" + "stfd 31,-8(1)\n" + + "li 12,-480\n" /* the VR save area is between -480(r1) */ + "stvx 20,12,1\n" /* included and -288(r1) excluded */ + "li 12,-464\n" + "stvx 21,12,1\n" + "li 12,-448\n" + "stvx 22,12,1\n" + "li 12,-432\n" + "stvx 23,12,1\n" + "li 12,-416\n" + "stvx 24,12,1\n" + "li 12,-400\n" + "stvx 25,12,1\n" + "li 12,-384\n" + "stvx 26,12,1\n" + "li 12,-368\n" + "stvx 27,12,1\n" + "li 12,-352\n" + "stvx 28,12,1\n" + "li 12,-336\n" + "stvx 29,12,1\n" + "li 12,-320\n" + "stvx 30,12,1\n" + "li 12,-304\n" + "stvx 31,12,1\n" + + "stdu 1,-528(1)\n" /* Create stack frame */ + + "std 2, "TOC_AREA"(1)\n" /* Save TOC in the "TOC save area"*/ + "mfcr 12\n" /* Save CR in the "CR save area" */ + "std 12, 8(1)\n" + + "mr 14, %[restore_state]\n" /* save 'restore_state' for later */ + "mr 15, %[extra]\n" /* save 'extra' for later */ + "mr 12, %[save_state]\n" /* move 'save_state' into r12 for branching */ + "mr 3, 1\n" /* arg 1: current (old) stack pointer */ + "mr 4, 15\n" /* arg 2: extra */ + + "stdu 1, -48(1)\n" /* create temp stack space (see below) */ +#ifdef __BIG_ENDIAN__ + "ld 0, 0(12)\n" + "ld 11, 16(12)\n" + "mtctr 0\n" + "ld 2, 8(12)\n" +#else + "mtctr 12\n" /* r12 is fixed by this ABI */ +#endif + "bctrl\n" /* call save_state() */ + "addi 1, 1, 48\n" /* destroy temp stack space */ + + "cmpdi 3, 0\n" /* skip the rest if the return value is null */ "bt eq, zero\n" "mr 1, 3\n" /* change the stack pointer */ /* From now on, the stack pointer is modified, but the content of the stack is not restored yet. It contains only garbage here. */ - "mr 5, 14\n" - "mtlr 5\n" "mr 4, 15\n" /* arg 2: extra */ - /* arg 1: current (new) stack pointer is already in r3*/ + /* arg 1: current (new) stack pointer + is already in r3 */ - "stdu 1, -64(1)\n" /* create temp stack space for callee to use */ - "blrl\n" /* call restore_state() */ - "nop\n" - "addi 1, 1, 64\n" /* destroy temp stack space */ + "stdu 1, -48(1)\n" /* create temp stack space for callee to use */ + /* ^^^ we have to be careful. The function call will store the link + register in the current frame (as the ABI) dictates. But it will + then trample it with the restore! We fix this by creating a fake + stack frame */ + +#ifdef __BIG_ENDIAN__ + "ld 0, 0(14)\n" /* 'restore_state' is in r14 */ + "ld 11, 16(14)\n" + "mtctr 0\n" + "ld 2, 8(14)\n" +#endif +#ifdef __LITTLE_ENDIAN__ + "mr 12, 14\n" /* copy 'restore_state' */ + "mtctr 12\n" /* r12 is fixed by this ABI */ +#endif + + "bctrl\n" /* call restore_state() */ + "addi 1, 1, 48\n" /* destroy temp stack space */ /* The stack's content is now restored. */ "zero:\n" - /* Epilogue: Restore sp, lr and saved non-volatile registers */ - "ld 1, 0(1)\n" + + /* Epilogue */ + + "ld 2, "TOC_AREA"(1)\n" /* restore the TOC */ + "ld 12,8(1)\n" /* restore the condition register */ + "mtcrf 0xff, 12\n" + + "addi 1,1,528\n" /* restore stack pointer */ + + "li 12,-480\n" /* restore vector registers */ + "lvx 20,12,1\n" + "li 12,-464\n" + "lvx 21,12,1\n" + "li 12,-448\n" + "lvx 22,12,1\n" + "li 12,-432\n" + "lvx 23,12,1\n" + "li 12,-416\n" + "lvx 24,12,1\n" + "li 12,-400\n" + "lvx 25,12,1\n" + "li 12,-384\n" + "lvx 26,12,1\n" + "li 12,-368\n" + "lvx 27,12,1\n" + "li 12,-352\n" + "lvx 28,12,1\n" + "li 12,-336\n" + "lvx 29,12,1\n" + "li 12,-320\n" + "lvx 30,12,1\n" + "li 12,-304\n" + "lvx 31,12,1\n" + + "ld 14,-288(1)\n" /* restore general purporse registers */ + "ld 15,-280(1)\n" + "ld 16,-272(1)\n" + "ld 17,-264(1)\n" + "ld 18,-256(1)\n" + "ld 19,-248(1)\n" + "ld 20,-240(1)\n" + "ld 21,-232(1)\n" + "ld 22,-224(1)\n" + "ld 23,-216(1)\n" + "ld 24,-208(1)\n" + "ld 25,-200(1)\n" + "ld 26,-192(1)\n" + "ld 27,-184(1)\n" + "ld 28,-176(1)\n" + "ld 29,-168(1)\n" + "ld 30,-160(1)\n" + "ld 31,-152(1)\n" + + "lfd 14,-144(1)\n" /* restore floating point registers */ + "lfd 15,-136(1)\n" + "lfd 16,-128(1)\n" + "lfd 17,-120(1)\n" + "lfd 18,-112(1)\n" + "lfd 19,-104(1)\n" + "lfd 20,-96(1)\n" + "lfd 21,-88(1)\n" + "lfd 22,-80(1)\n" + "lfd 23,-72(1)\n" + "lfd 24,-64(1)\n" + "lfd 25,-56(1)\n" + "lfd 26,-48(1)\n" + "lfd 27,-40(1)\n" + "lfd 28,-32(1)\n" "ld 0, 16(1)\n" + "lfd 29,-24(1)\n" "mtlr 0\n" - "ld 28, -32(1)\n" - "ld 29, -24(1)\n" - "ld 30, -16(1)\n" - "ld 31, -8(1)\n" - : [result]"=r"(result) /* output variables */ - : [restore_state]"r"(restore_state), /* input variables */ + "lfd 30,-16(1)\n" + "lfd 31,-8(1)\n" + + : "=r"(result) /* output variable: expected to be r3 */ + : [restore_state]"r"(restore_state), /* input variables */ [save_state]"r"(save_state), [extra]"r"(extra) - : "r0", "r4", "r5", "r14", "r15", "memory" ); return result; } From noreply at buildbot.pypy.org Tue Nov 3 13:20:39 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 19:20:39 +0100 (CET) Subject: [pypy-commit] pypy ppc-stacklet: Skip TestStackletAsmGcc on platforms where asmgcc is disabled Message-ID: <20151103182039.1403B1C065A@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ppc-stacklet Changeset: r80523:4428aa79c94b Date: 2015-11-03 19:16 +0100 http://bitbucket.org/pypy/pypy/changeset/4428aa79c94b/ Log: Skip TestStackletAsmGcc on platforms where asmgcc is disabled diff --git a/rpython/rlib/test/test_rstacklet.py b/rpython/rlib/test/test_rstacklet.py --- a/rpython/rlib/test/test_rstacklet.py +++ b/rpython/rlib/test/test_rstacklet.py @@ -7,6 +7,7 @@ except CompilationError, e: py.test.skip("cannot import rstacklet: %s" % e) +from rpython.config.translationoption import DEFL_ROOTFINDER_WITHJIT from rpython.rlib import rrandom, rgc from rpython.rlib.rarithmetic import intmask from rpython.rtyper.lltypesystem import lltype, llmemory, rffi @@ -289,6 +290,9 @@ class BaseTestStacklet(StandaloneTests): def setup_class(cls): + if cls.gcrootfinder == "asmgcc" and DEFL_ROOTFINDER_WITHJIT != "asmgcc": + py.test.skip("asmgcc is disabled on the current platform") + from rpython.config.translationoption import get_combined_translation_config config = get_combined_translation_config(translating=True) config.translation.gc = cls.gc @@ -300,8 +304,6 @@ cls.old_values = Runner.config, Runner.STATUSMAX Runner.config = config Runner.STATUSMAX = 25000 - if cls.gcrootfinder == "asmgcc" and sys.platform == "win32": - py.test.skip("fails with asmgcc on win32") def teardown_class(cls): Runner.config, Runner.STATUSMAX = cls.old_values From noreply at buildbot.pypy.org Tue Nov 3 13:59:17 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 3 Nov 2015 19:59:17 +0100 (CET) Subject: [pypy-commit] pypy default: trivial fixes Message-ID: <20151103185917.0C1C81C06BE@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80525:83f9532a7bf3 Date: 2015-11-03 20:59 +0200 http://bitbucket.org/pypy/pypy/changeset/83f9532a7bf3/ Log: trivial fixes diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -8,3 +8,7 @@ .. branch: 2174-fix-osx-10-11-translation Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + + diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py --- a/rpython/translator/platform/darwin.py +++ b/rpython/translator/platform/darwin.py @@ -1,6 +1,7 @@ """Support for OS X.""" from rpython.translator.platform import posix +import os # # Although Intel 32bit is supported since Apple Mac OS X 10.4, (and PPC since, ever) From noreply at buildbot.pypy.org Tue Nov 3 14:57:52 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 20:57:52 +0100 (CET) Subject: [pypy-commit] cffi default: Add a direct test for _get_common_types() Message-ID: <20151103195752.43C951C14DA@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2372:86cdfb3ff7fa Date: 2015-11-03 20:58 +0100 http://bitbucket.org/cffi/cffi/changeset/86cdfb3ff7fa/ Log: Add a direct test for _get_common_types() diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -7,7 +7,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) _setup_path() from _cffi_backend import * -from _cffi_backend import _testfunc, _get_types, __version__ +from _cffi_backend import _testfunc, _get_types, _get_common_types, __version__ # ____________________________________________________________ @@ -3520,3 +3520,8 @@ assert repr(BFunc) == "" else: assert repr(BFunc) == "" + +def test_get_common_types(): + d = {} + _get_common_types(d) + assert d['bool'] == '_Bool' From noreply at buildbot.pypy.org Tue Nov 3 16:37:18 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 22:37:18 +0100 (CET) Subject: [pypy-commit] pypy default: Update to cffi/86cdfb3ff7fa Message-ID: <20151103213718.DBF121C15C8@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80526:4a523256b0e4 Date: 2015-11-03 21:28 +0100 http://bitbucket.org/pypy/pypy/changeset/4a523256b0e4/ Log: Update to cffi/86cdfb3ff7fa diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py --- a/lib_pypy/cffi/cffi_opcode.py +++ b/lib_pypy/cffi/cffi_opcode.py @@ -110,6 +110,8 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/lib_pypy/cffi/commontypes.py b/lib_pypy/cffi/commontypes.py --- a/lib_pypy/cffi/commontypes.py +++ b/lib_pypy/cffi/commontypes.py @@ -2,10 +2,17 @@ from . import api, model -COMMON_TYPES = { - 'FILE': model.unknown_type('FILE', '_IO_FILE'), - 'bool': '_Bool', - } +COMMON_TYPES = {} + +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: if _type.endswith('_t'): @@ -14,212 +21,35 @@ _CACHE = {} -def resolve_common_type(commontype): +def resolve_common_type(parser, commontype): try: return _CACHE[commontype] except KeyError: - result = COMMON_TYPES.get(commontype, commontype) - if not isinstance(result, str): - pass # result is already a BaseType - elif result.endswith(' *'): - if result.startswith('const '): - result = model.ConstPointerType( - resolve_common_type(result[6:-2])) - else: - result = model.PointerType(resolve_common_type(result[:-2])) - elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES: - result = model.PrimitiveType(result) - elif result == 'set-unicode-needed': + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': raise api.FFIError("The Windows type %r is only available after " "you call ffi.set_unicode()" % (commontype,)) else: - if commontype == result: + if commontype == cdecl: raise api.FFIError("Unsupported type: %r. Please file a bug " "if you think it should be." % (commontype,)) - result = resolve_common_type(result) # recursively + result, quals = parser.parse_type_and_quals(cdecl) # recursive + assert isinstance(result, model.BaseTypeByIdentity) - _CACHE[commontype] = result - return result + _CACHE[commontype] = result, quals + return result, quals # ____________________________________________________________ -# Windows common types +# extra types for Windows (most of them are in commontypes.c) -def win_common_types(maxsize): - result = {} - if maxsize < (1<<32): - result.update({ # Windows 32-bits - 'HALF_PTR': 'short', - 'INT_PTR': 'int', - 'LONG_PTR': 'long', - 'UHALF_PTR': 'unsigned short', - 'UINT_PTR': 'unsigned int', - 'ULONG_PTR': 'unsigned long', - }) - else: - result.update({ # Windows 64-bits - 'HALF_PTR': 'int', - 'INT_PTR': 'long long', - 'LONG_PTR': 'long long', - 'UHALF_PTR': 'unsigned int', - 'UINT_PTR': 'unsigned long long', - 'ULONG_PTR': 'unsigned long long', - }) - result.update({ - "BYTE": "unsigned char", - "BOOL": "int", - "CCHAR": "char", - "CHAR": "char", - "DWORD": "unsigned long", - "DWORD32": "unsigned int", - "DWORD64": "unsigned long long", - "FLOAT": "float", - "INT": "int", - "INT8": "signed char", - "INT16": "short", - "INT32": "int", - "INT64": "long long", - "LONG": "long", - "LONGLONG": "long long", - "LONG32": "int", - "LONG64": "long long", - "WORD": "unsigned short", - "PVOID": model.voidp_type, - "ULONGLONG": "unsigned long long", - "WCHAR": "wchar_t", - "SHORT": "short", - "UCHAR": "unsigned char", - "UINT": "unsigned int", - "UINT8": "unsigned char", - "UINT16": "unsigned short", - "UINT32": "unsigned int", - "UINT64": "unsigned long long", - "ULONG": "unsigned long", - "ULONG32": "unsigned int", - "ULONG64": "unsigned long long", - "USHORT": "unsigned short", - - "SIZE_T": "ULONG_PTR", - "SSIZE_T": "LONG_PTR", - "ATOM": "WORD", - "BOOLEAN": "BYTE", - "COLORREF": "DWORD", - - "HANDLE": "PVOID", - "DWORDLONG": "ULONGLONG", - "DWORD_PTR": "ULONG_PTR", - "HACCEL": "HANDLE", - - "HBITMAP": "HANDLE", - "HBRUSH": "HANDLE", - "HCOLORSPACE": "HANDLE", - "HCONV": "HANDLE", - "HCONVLIST": "HANDLE", - "HDC": "HANDLE", - "HDDEDATA": "HANDLE", - "HDESK": "HANDLE", - "HDROP": "HANDLE", - "HDWP": "HANDLE", - "HENHMETAFILE": "HANDLE", - "HFILE": "int", - "HFONT": "HANDLE", - "HGDIOBJ": "HANDLE", - "HGLOBAL": "HANDLE", - "HHOOK": "HANDLE", - "HICON": "HANDLE", - "HCURSOR": "HICON", - "HINSTANCE": "HANDLE", - "HKEY": "HANDLE", - "HKL": "HANDLE", - "HLOCAL": "HANDLE", - "HMENU": "HANDLE", - "HMETAFILE": "HANDLE", - "HMODULE": "HINSTANCE", - "HMONITOR": "HANDLE", - "HPALETTE": "HANDLE", - "HPEN": "HANDLE", - "HRESULT": "LONG", - "HRGN": "HANDLE", - "HRSRC": "HANDLE", - "HSZ": "HANDLE", - "WINSTA": "HANDLE", - "HWND": "HANDLE", - - "LANGID": "WORD", - "LCID": "DWORD", - "LCTYPE": "DWORD", - "LGRPID": "DWORD", - "LPARAM": "LONG_PTR", - "LPBOOL": "BOOL *", - "LPBYTE": "BYTE *", - "LPCOLORREF": "DWORD *", - "LPCSTR": "const char *", - - "LPCVOID": model.const_voidp_type, - "LPCWSTR": "const WCHAR *", - "LPDWORD": "DWORD *", - "LPHANDLE": "HANDLE *", - "LPINT": "int *", - "LPLONG": "long *", - "LPSTR": "CHAR *", - "LPWSTR": "WCHAR *", - "LPVOID": model.voidp_type, - "LPWORD": "WORD *", - "LRESULT": "LONG_PTR", - "PBOOL": "BOOL *", - "PBOOLEAN": "BOOLEAN *", - "PBYTE": "BYTE *", - "PCHAR": "CHAR *", - "PCSTR": "const CHAR *", - "PCWSTR": "const WCHAR *", - "PDWORD": "DWORD *", - "PDWORDLONG": "DWORDLONG *", - "PDWORD_PTR": "DWORD_PTR *", - "PDWORD32": "DWORD32 *", - "PDWORD64": "DWORD64 *", - "PFLOAT": "FLOAT *", - "PHALF_PTR": "HALF_PTR *", - "PHANDLE": "HANDLE *", - "PHKEY": "HKEY *", - "PINT": "int *", - "PINT_PTR": "INT_PTR *", - "PINT8": "INT8 *", - "PINT16": "INT16 *", - "PINT32": "INT32 *", - "PINT64": "INT64 *", - "PLCID": "PDWORD", - "PLONG": "LONG *", - "PLONGLONG": "LONGLONG *", - "PLONG_PTR": "LONG_PTR *", - "PLONG32": "LONG32 *", - "PLONG64": "LONG64 *", - "PSHORT": "SHORT *", - "PSIZE_T": "SIZE_T *", - "PSSIZE_T": "SSIZE_T *", - "PSTR": "CHAR *", - "PUCHAR": "UCHAR *", - "PUHALF_PTR": "UHALF_PTR *", - "PUINT": "UINT *", - "PUINT_PTR": "UINT_PTR *", - "PUINT8": "UINT8 *", - "PUINT16": "UINT16 *", - "PUINT32": "UINT32 *", - "PUINT64": "UINT64 *", - "PULONG": "ULONG *", - "PULONGLONG": "ULONGLONG *", - "PULONG_PTR": "ULONG_PTR *", - "PULONG32": "ULONG32 *", - "PULONG64": "ULONG64 *", - "PUSHORT": "USHORT *", - "PWCHAR": "WCHAR *", - "PWORD": "WORD *", - "PWSTR": "WCHAR *", - "QWORD": "unsigned long long", - "SC_HANDLE": "HANDLE", - "SC_LOCK": "LPVOID", - "SERVICE_STATUS_HANDLE": "HANDLE", - +def win_common_types(): + return { "UNICODE_STRING": model.StructType( "_UNICODE_STRING", ["Length", @@ -232,10 +62,6 @@ "PUNICODE_STRING": "UNICODE_STRING *", "PCUNICODE_STRING": "const UNICODE_STRING *", - "USN": "LONGLONG", - "VOID": model.void_type, - "WPARAM": "UINT_PTR", - "TBYTE": "set-unicode-needed", "TCHAR": "set-unicode-needed", "LPCTSTR": "set-unicode-needed", @@ -244,9 +70,7 @@ "PTSTR": "set-unicode-needed", "PTBYTE": "set-unicode-needed", "PTCHAR": "set-unicode-needed", - }) - return result - + } if sys.platform == 'win32': - COMMON_TYPES.update(win_common_types(sys.maxsize)) + COMMON_TYPES.update(win_common_types()) diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -29,6 +29,8 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") def _get_parser(): global _parser_cache @@ -36,6 +38,46 @@ _parser_cache = pycparser.CParser() return _parser_cache +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + for i in xrange(endpos, len(csource)): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + return ''.join(parts) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -47,6 +89,10 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) + # # BIG HACK: replace WINAPI or __stdcall with "volatile const". # It doesn't make sense for the return type of a function to be # "volatile volatile const", so we abuse it to detect __stdcall... @@ -320,13 +366,15 @@ self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] assert not macros exprnode = ast.ext[-1].type.args.params[0] if isinstance(exprnode, pycparser.c_ast.ID): raise api.CDefError("unknown identifier '%s'" % (exprnode.name,)) - tp, quals = self._get_type_and_quals(exprnode.type) - return tp + return self._get_type_and_quals(exprnode.type) def _declare(self, name, obj, included=False, quals=0): if name in self._declarations: @@ -348,6 +396,8 @@ pycparser.c_ast.PtrDecl)): if 'const' in type.quals: quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE if 'restrict' in type.quals: quals |= model.Q_RESTRICT return quals @@ -422,7 +472,8 @@ if ident == '__dotdotdot__': raise api.FFIError(':%d: bad usage of "..."' % typenode.coord.line) - return resolve_common_type(ident), quals + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) # if isinstance(type, pycparser.c_ast.Struct): # 'struct foobar' @@ -456,6 +507,13 @@ def _parse_function_type(self, typenode, funcname=None): params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise api.CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) ellipsis = ( len(params) > 0 and isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -7,10 +7,13 @@ # type qualifiers Q_CONST = 0x01 Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 def qualify(quals, replace_with): if quals & Q_CONST: replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() if quals & Q_RESTRICT: # It seems that __restrict is supported by gcc and msvc. # If you hit some different compiler, add a #define in diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -83,6 +83,8 @@ #define _CFFI__UNKNOWN_FLOAT_PRIM (-2) #define _CFFI__UNKNOWN_LONG_DOUBLE (-3) +#define _CFFI__IO_FILE_STRUCT (-1) + struct _cffi_global_s { const char *name; diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -43,6 +43,7 @@ 'newp_handle': 'handle.newp_handle', 'from_handle': 'handle.from_handle', '_get_types': 'func._get_types', + '_get_common_types': 'func._get_common_types', 'from_buffer': 'func.from_buffer', 'string': 'func.string', diff --git a/pypy/module/_cffi_backend/cffi_opcode.py b/pypy/module/_cffi_backend/cffi_opcode.py --- a/pypy/module/_cffi_backend/cffi_opcode.py +++ b/pypy/module/_cffi_backend/cffi_opcode.py @@ -110,6 +110,9 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py --- a/pypy/module/_cffi_backend/func.py +++ b/pypy/module/_cffi_backend/func.py @@ -84,6 +84,20 @@ # ____________________________________________________________ +def _get_common_types(space, w_dict): + from pypy.module._cffi_backend.parse_c_type import ll_enum_common_types + index = 0 + while True: + p = ll_enum_common_types(rffi.cast(rffi.INT, index)) + if not p: + break + key = rffi.charp2str(p) + value = rffi.charp2str(rffi.ptradd(p, len(key) + 1)) + space.setitem_str(w_dict, key, space.wrap(value)) + index += 1 + +# ____________________________________________________________ + def _fetch_as_read_buffer(space, w_x): # xxx do we really need to implement the same mess as in CPython 2.7 # w.r.t. buffers and memoryviews?? diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -87,6 +87,8 @@ ll_set_cdl_realize_global_int = llexternal('pypy_set_cdl_realize_global_int', [lltype.Ptr(GLOBAL_S)], lltype.Void) +ll_enum_common_types = llexternal('pypy_enum_common_types', + [rffi.INT], rffi.CCHARP) def parse_c_type(info, input): p_input = rffi.str2charp(input) diff --git a/pypy/module/_cffi_backend/realize_c_type.py b/pypy/module/_cffi_backend/realize_c_type.py --- a/pypy/module/_cffi_backend/realize_c_type.py +++ b/pypy/module/_cffi_backend/realize_c_type.py @@ -74,7 +74,15 @@ assert len(NAMES) == cffi_opcode._NUM_PRIM def __init__(self, space): + self.space = space self.all_primitives = [None] * cffi_opcode._NUM_PRIM + self.file_struct = None + + def get_file_struct(self): + if self.file_struct is None: + self.file_struct = ctypestruct.W_CTypeStruct(self.space, "FILE") + return self.file_struct + def get_primitive_type(ffi, num): space = ffi.space @@ -266,6 +274,10 @@ def _realize_c_struct_or_union(ffi, sindex): + if sindex == cffi_opcode._IO_FILE_STRUCT: + # returns a single global cached opaque type + return ffi.space.fromcache(RealizeCache).get_file_struct() + s = ffi.ctxobj.ctx.c_struct_unions[sindex] type_index = rffi.getintfield(s, 'c_type_index') if ffi.cached_types[type_index] is not None: @@ -281,7 +293,10 @@ x = ctypestruct.W_CTypeUnion(space, name) else: name = _realize_name("struct ", s.c_name) - x = ctypestruct.W_CTypeStruct(space, name) + if name == "struct _IO_FILE": + x = space.fromcache(RealizeCache).get_file_struct() + else: + x = ctypestruct.W_CTypeStruct(space, name) if (c_flags & cffi_opcode.F_OPAQUE) == 0: assert c_first_field_index >= 0 w_ctype = x diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -231,6 +231,8 @@ #define MAX_SSIZE_T (((size_t)-1) >> 1) static int parse_complete(token_t *tok); +static const char *get_common_type(const char *search, size_t search_len); +static int parse_common_type_replacement(token_t *tok, const char *replacement); static int parse_sequel(token_t *tok, int outer) { @@ -387,11 +389,18 @@ case TOK_INTEGER: errno = 0; -#ifndef _MSC_VER - if (sizeof(length) > sizeof(unsigned long)) + if (sizeof(length) > sizeof(unsigned long)) { +#ifdef MS_WIN32 +# ifdef _WIN64 + length = _strtoui64(tok->p, &endptr, 0); +# else + abort(); /* unreachable */ +# endif +#else length = strtoull(tok->p, &endptr, 0); +#endif + } else -#endif length = strtoul(tok->p, &endptr, 0); if (endptr != tok->p + tok->size) return parse_error(tok, "invalid number"); @@ -446,26 +455,34 @@ return _CFFI_GETARG(result); } +static int search_sorted(const char *const *base, + size_t item_size, int array_len, + const char *search, size_t search_len) +{ + int left = 0, right = array_len; + const char *baseptr = (const char *)base; -#define MAKE_SEARCH_FUNC(FIELD) \ - RPY_EXTERN int \ - pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx,\ - const char *search, size_t search_len) \ - { \ - int left = 0, right = ctx->num_##FIELD; \ - \ - while (left < right) { \ - int middle = (left + right) / 2; \ - const char *src = ctx->FIELD[middle].name; \ - int diff = strncmp(src, search, search_len); \ - if (diff == 0 && src[search_len] == '\0') \ - return middle; \ - else if (diff >= 0) \ - right = middle; \ - else \ - left = middle + 1; \ - } \ - return -1; \ + while (left < right) { + int middle = (left + right) / 2; + const char *src = *(const char *const *)(baseptr + middle * item_size); + int diff = strncmp(src, search, search_len); + if (diff == 0 && src[search_len] == '\0') + return middle; + else if (diff >= 0) + right = middle; + else + left = middle + 1; + } + return -1; +} + +#define MAKE_SEARCH_FUNC(FIELD) \ + RPY_EXTERN int \ + pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ + const char *search, size_t search_len) \ + { \ + return search_sorted(&ctx->FIELD->name, sizeof(*ctx->FIELD), \ + ctx->num_##FIELD, search, search_len); \ } MAKE_SEARCH_FUNC(globals) @@ -719,6 +736,7 @@ break; case TOK_IDENTIFIER: { + const char *replacement; int n = search_in_typenames(tok->info->ctx, tok->p, tok->size); if (n >= 0) { t1 = _CFFI_OP(_CFFI_OP_TYPENAME, n); @@ -729,6 +747,14 @@ t1 = _CFFI_OP(_CFFI_OP_PRIMITIVE, n); break; } + replacement = get_common_type(tok->p, tok->size); + if (replacement != NULL) { + n = parse_common_type_replacement(tok, replacement); + if (n < 0) + return parse_error(tok, "internal error, please report!"); + t1 = _CFFI_OP(_CFFI_OP_NOOP, n); + break; + } return parse_error(tok, "undefined type name"); } case TOK_STRUCT: @@ -740,10 +766,15 @@ return parse_error(tok, "struct or union name expected"); n = search_in_struct_unions(tok->info->ctx, tok->p, tok->size); - if (n < 0) - return parse_error(tok, "undefined struct/union name"); - if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) != 0) - ^ (kind == TOK_UNION)) + if (n < 0) { + if (kind == TOK_STRUCT && tok->size == 8 && + !memcmp(tok->p, "_IO_FILE", 8)) + n = _CFFI__IO_FILE_STRUCT; + else + return parse_error(tok, "undefined struct/union name"); + } + else if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) + != 0) ^ (kind == TOK_UNION)) return parse_error(tok, "wrong kind of tag: struct vs union"); t1 = _CFFI_OP(_CFFI_OP_STRUCT_UNION, n); @@ -773,8 +804,9 @@ } -RPY_EXTERN -int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input) +static +int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, + const char *input) { int result; token_t token; @@ -785,16 +817,33 @@ token.p = input; token.size = 0; token.output = info->output; - token.output_index = 0; + token.output_index = *output_index; next_token(&token); result = parse_complete(&token); + *output_index = token.output_index; if (token.kind != TOK_END) return parse_error(&token, "unexpected symbol"); return result; } +RPY_EXTERN +int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input) +{ + size_t output_index = 0; + return parse_c_type_from(info, &output_index, input); +} + +static +int parse_common_type_replacement(token_t *tok, const char *replacement) +{ + return parse_c_type_from(tok->info, &tok->output_index, replacement); +} + + +#include "commontypes.c" /* laziness hack: include this file here */ + /************************************************************/ /* extra from cdlopen.c */ diff --git a/pypy/module/_cffi_backend/src/parse_c_type.h b/pypy/module/_cffi_backend/src/parse_c_type.h --- a/pypy/module/_cffi_backend/src/parse_c_type.h +++ b/pypy/module/_cffi_backend/src/parse_c_type.h @@ -5,7 +5,7 @@ #define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8)) #define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode) -#define _CFFI_GETARG(cffi_opcode) (((uintptr_t)cffi_opcode) >> 8) +#define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8) #define _CFFI_OP_PRIMITIVE 1 #define _CFFI_OP_POINTER 3 @@ -25,6 +25,8 @@ #define _CFFI_OP_CONSTANT_INT 31 #define _CFFI_OP_GLOBAL_VAR 33 #define _CFFI_OP_DLOPEN_FUNC 35 +#define _CFFI_OP_DLOPEN_CONST 37 +#define _CFFI_OP_GLOBAL_VAR_F 39 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -77,6 +79,11 @@ #define _CFFI_PRIM_UINTMAX 47 #define _CFFI__NUM_PRIM 48 +#define _CFFI__UNKNOWN_PRIM (-1) +#define _CFFI__UNKNOWN_FLOAT_PRIM (-2) +#define _CFFI__UNKNOWN_LONG_DOUBLE (-3) + +#define _CFFI__IO_FILE_STRUCT (-1) struct _cffi_global_s { @@ -164,4 +171,6 @@ const char *search, size_t search_len); RPY_EXTERN void pypy_set_cdl_realize_global_int(struct _cffi_global_s *target); +RPY_EXTERN +char *pypy_enum_common_types(int index); #endif diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -3509,3 +3509,8 @@ assert repr(BFunc) == "" else: assert repr(BFunc) == "" + +def test_get_common_types(): + d = {} + _get_common_types(d) + assert d['bool'] == '_Bool' diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -424,3 +424,26 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) raises(MemoryError, alloc5, "int[5]") + + def test_bool_issue228(self): + import _cffi_backend as _cffi1_backend + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + + def test_FILE_issue228(self): + import _cffi_backend as _cffi1_backend + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + + def test_cast_from_int_type_to_bool(self): + import _cffi_backend as _cffi1_backend + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -28,6 +28,7 @@ module_name = '_CFFI_' + module_name rdir = udir.ensure('recompiler', dir=1) rdir.join('Python.h').write( + '#include \n' '#define PYPY_VERSION XX\n' '#define PyMODINIT_FUNC /*exported*/ void\n' ) @@ -1076,3 +1077,302 @@ raises(ffi.error, getattr, lib, 'my_value') e = raises(ffi.error, setattr, lib, 'my_value', 50) assert str(e.value) == "global variable 'my_value' is at address NULL" + + def test_const_fields(self): + ffi, lib = self.prepare( + """struct foo_s { const int a; void *const b; };""", + 'test_const_fields', + """struct foo_s { const int a; void *const b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int") + assert foo_s.fields[1][0] == 'b' + assert foo_s.fields[1][1].type is ffi.typeof("void *") + + def test_restrict_fields(self): + ffi, lib = self.prepare( + """struct foo_s { void * restrict b; };""", + 'test_restrict_fields', + """struct foo_s { void * __restrict b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + + def test_volatile_fields(self): + ffi, lib = self.prepare( + """struct foo_s { void * volatile b; };""", + 'test_volatile_fields', + """struct foo_s { void * volatile b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + + def test_const_array_fields(self): + ffi, lib = self.prepare( + """struct foo_s { const int a[4]; };""", + 'test_const_array_fields', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[4]") + + def test_const_array_fields_varlength(self): + ffi, lib = self.prepare( + """struct foo_s { const int a[]; ...; };""", + 'test_const_array_fields_varlength', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[]") + + def test_const_array_fields_unknownlength(self): + ffi, lb = self.prepare( + """struct foo_s { const int a[...]; ...; };""", + 'test_const_array_fields_unknownlength', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[4]") + + def test_const_function_args(self): + ffi, lib = self.prepare( + """int foobar(const int a, const int *b, const int c[]);""", + 'test_const_function_args', """ + int foobar(const int a, const int *b, const int c[]) { + return a + *b + *c; + } + """) + assert lib.foobar(100, ffi.new("int *", 40), ffi.new("int *", 2)) == 142 + + def test_const_function_type_args(self): + ffi, lib = self.prepare( + """int (*foobar)(const int a, const int *b, const int c[]);""", + 'test_const_function_type_args', """ + int (*foobar)(const int a, const int *b, const int c[]); + """) + t = ffi.typeof(lib.foobar) + assert t.args[0] is ffi.typeof("int") + assert t.args[1] is ffi.typeof("int *") + assert t.args[2] is ffi.typeof("int *") + + def test_const_constant(self): + ffi, lib = self.prepare( + """struct foo_s { int x,y; }; const struct foo_s myfoo;""", + 'test_const_constant', """ + struct foo_s { int x,y; }; const struct foo_s myfoo = { 40, 2 }; + """) + assert lib.myfoo.x == 40 + assert lib.myfoo.y == 2 + + def test_const_via_typedef(self): + ffi, lib = self.prepare( + """typedef const int const_t; const_t aaa;""", + 'test_const_via_typedef', """ + typedef const int const_t; + #define aaa 42 + """) + assert lib.aaa == 42 + raises(AttributeError, "lib.aaa = 43") + + def test_win32_calling_convention_0(self): + import sys + ffi, lib = self.prepare( + """ + int call1(int(__cdecl *cb)(int)); + int (*const call2)(int(__stdcall *cb)(int)); + """, + 'test_win32_calling_convention_0', r""" + #ifndef _MSC_VER + # define __stdcall /* nothing */ + #endif + int call1(int(*cb)(int)) { + int i, result = 0; + //printf("call1: cb = %p\n", cb); + for (i = 0; i < 1000; i++) + result += cb(i); + //printf("result = %d\n", result); + return result; + } + int call2(int(__stdcall *cb)(int)) { + int i, result = 0; + //printf("call2: cb = %p\n", cb); + for (i = 0; i < 1000; i++) + result += cb(-i); + //printf("result = %d\n", result); + return result; + } + """) + @ffi.callback("int(int)") + def cb1(x): + return x * 2 + @ffi.callback("int __stdcall(int)") + def cb2(x): + return x * 3 + res = lib.call1(cb1) + assert res == 500*999*2 + assert res == ffi.addressof(lib, 'call1')(cb1) + res = lib.call2(cb2) + assert res == -500*999*3 + assert res == ffi.addressof(lib, 'call2')(cb2) + if sys.platform == 'win32' and not sys.maxsize > 2**32: + assert '__stdcall' in str(ffi.typeof(cb2)) + assert '__stdcall' not in str(ffi.typeof(cb1)) + raises(TypeError, lib.call1, cb2) + raises(TypeError, lib.call2, cb1) + else: + assert '__stdcall' not in str(ffi.typeof(cb2)) + assert ffi.typeof(cb2) is ffi.typeof(cb1) + + def test_win32_calling_convention_1(self): + ffi, lib = self.prepare(""" + int __cdecl call1(int(__cdecl *cb)(int)); + int __stdcall call2(int(__stdcall *cb)(int)); + int (__cdecl *const cb1)(int); + int (__stdcall *const cb2)(int); + """, 'test_win32_calling_convention_1', r""" + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + int __cdecl cb1(int x) { return x * 2; } + int __stdcall cb2(int x) { return x * 3; } + + int __cdecl call1(int(__cdecl *cb)(int)) { + int i, result = 0; + //printf("here1\n"); + //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1); + for (i = 0; i < 1000; i++) + result += cb(i); + //printf("result = %d\n", result); + return result; + } + int __stdcall call2(int(__stdcall *cb)(int)) { + int i, result = 0; + //printf("here1\n"); + //printf("cb = %p, cb2 = %p\n", cb, (void *)cb2); + for (i = 0; i < 1000; i++) + result += cb(-i); + //printf("result = %d\n", result); + return result; + } + """) + #print '<<< cb1 =', ffi.addressof(lib, 'cb1') + ptr_call1 = ffi.addressof(lib, 'call1') + assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + #print '<<< cb2 =', ffi.addressof(lib, 'cb2') + ptr_call2 = ffi.addressof(lib, 'call2') + assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + assert ptr_call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + #print '<<< done' + + def test_win32_calling_convention_2(self): + import sys + # any mistake in the declaration of plain function (including the + # precise argument types and, here, the calling convention) are + # automatically corrected. But this does not apply to the 'cb' + # function pointer argument. + ffi, lib = self.prepare(""" + int __stdcall call1(int(__cdecl *cb)(int)); + int __cdecl call2(int(__stdcall *cb)(int)); + int (__cdecl *const cb1)(int); + int (__stdcall *const cb2)(int); + """, 'test_win32_calling_convention_2', """ + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + int __cdecl call1(int(__cdecl *cb)(int)) { + int i, result = 0; + for (i = 0; i < 1000; i++) + result += cb(i); + return result; + } + int __stdcall call2(int(__stdcall *cb)(int)) { + int i, result = 0; + for (i = 0; i < 1000; i++) + result += cb(-i); + return result; + } + int __cdecl cb1(int x) { return x * 2; } + int __stdcall cb2(int x) { return x * 3; } + """) + ptr_call1 = ffi.addressof(lib, 'call1') + ptr_call2 = ffi.addressof(lib, 'call2') + if sys.platform == 'win32' and not sys.maxsize > 2**32: + raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + assert ptr_call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + + def test_win32_calling_convention_3(self): + import sys + ffi, lib = self.prepare(""" + struct point { int x, y; }; + + int (*const cb1)(struct point); + int (__stdcall *const cb2)(struct point); + + struct point __stdcall call1(int(*cb)(struct point)); + struct point call2(int(__stdcall *cb)(struct point)); + """, 'test_win32_calling_convention_3', r""" + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + struct point { int x, y; }; + int cb1(struct point pt) { return pt.x + 10 * pt.y; } + int __stdcall cb2(struct point pt) { return pt.x + 100 * pt.y; } + struct point __stdcall call1(int(__cdecl *cb)(struct point)) { + int i; + struct point result = { 0, 0 }; + //printf("here1\n"); + //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1); + for (i = 0; i < 1000; i++) { + struct point p = { i, -i }; + int r = cb(p); + result.x += r; + result.y -= r; + } + return result; + } + struct point __cdecl call2(int(__stdcall *cb)(struct point)) { + int i; + struct point result = { 0, 0 }; + for (i = 0; i < 1000; i++) { + struct point p = { -i, i }; + int r = cb(p); + result.x += r; + result.y -= r; + } + return result; + } + """) + ptr_call1 = ffi.addressof(lib, 'call1') + ptr_call2 = ffi.addressof(lib, 'call2') + if sys.platform == 'win32' and not sys.maxsize > 2**32: + raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + pt = lib.call1(ffi.addressof(lib, 'cb1')) + assert (pt.x, pt.y) == (-9*500*999, 9*500*999) + pt = ptr_call1(ffi.addressof(lib, 'cb1')) + assert (pt.x, pt.y) == (-9*500*999, 9*500*999) + pt = lib.call2(ffi.addressof(lib, 'cb2')) + assert (pt.x, pt.y) == (99*500*999, -99*500*999) + pt = ptr_call2(ffi.addressof(lib, 'cb2')) + assert (pt.x, pt.y) == (99*500*999, -99*500*999) + + def test_share_FILE(self): + ffi1, lib1 = self.prepare("void do_stuff(FILE *);", + 'test_share_FILE_a', + "void do_stuff(FILE *f) { (void)f; }") + ffi2, lib2 = self.prepare("FILE *barize(void);", + 'test_share_FILE_b', + "FILE *barize(void) { return NULL; }") + lib1.do_stuff(lib2.barize()) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -757,10 +757,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py @@ -262,7 +262,8 @@ ffi = FFI() ffi.cdef("typedef int bool, *FILE;") assert repr(ffi.cast("bool", 123)) == "" - assert repr(ffi.cast("FILE", 123)) == "" + assert re.match(r"", + repr(ffi.cast("FILE", 123))) ffi = FFI() ffi.cdef("typedef bool (*fn_t)(bool, bool);") # "bool," but within "( )" @@ -273,6 +274,13 @@ ffi = FFI() ffi.cdef("typedef _Bool bool; void f(bool);") +def test_unknown_argument_type(): + ffi = FFI() + e = py.test.raises(CDefError, ffi.cdef, "void f(foobarbazzz);") + assert str(e.value) == ("f arg 1: unknown type 'foobarbazzz' (if you meant" + " to use the old C syntax of giving untyped" + " arguments, it is not supported)") + def test_void_renamed_as_only_arg(): ffi = FFI() ffi.cdef("typedef void void_t1;" @@ -280,38 +288,16 @@ "typedef int (*func_t)(void_t);") assert ffi.typeof("func_t").args == () -def test_win_common_types(): - from cffi.commontypes import COMMON_TYPES, _CACHE - from cffi.commontypes import win_common_types, resolve_common_type - # - def clear_all(extra={}, old_dict=COMMON_TYPES.copy()): - COMMON_TYPES.clear() - COMMON_TYPES.update(old_dict) - COMMON_TYPES.update(extra) - _CACHE.clear() - # - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - for key in sorted(ct): - if ct[key] != 'set-unicode-needed': - resolve_common_type(key) - # assert did not crash - # now try to use e.g. WPARAM (-> UINT_PTR -> unsigned 32/64-bit) - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - ffi = FFI() - value = int(ffi.cast("WPARAM", -1)) - assert value == maxsize - # - clear_all() - def test_WPARAM_on_windows(): if sys.platform != 'win32': py.test.skip("Only for Windows") ffi = FFI() ffi.cdef("void f(WPARAM);") + # + # WPARAM -> UINT_PTR -> unsigned 32/64-bit integer + ffi = FFI() + value = int(ffi.cast("WPARAM", -42)) + assert value == sys.maxsize * 2 - 40 def test__is_constant_globalvar(): for input, expected_output in [ @@ -361,6 +347,41 @@ assert lst[0] == lst[2] assert lst[1] == lst[3] +def test_const_pointer_to_pointer(): + from cffi import model + ffi = FFI(backend=FakeBackend()) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * (* const)") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * (* const (*))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char (* const (* (*)))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * * const const") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * * volatile *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char * volatile restrict * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const volatile * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals( + "int(char*const*, short****const*)") + assert (str(tp), qual) == ( + "", 0) + tp, qual = ffi._parser.parse_type_and_quals( + "char*const*(short*const****)") + assert (str(tp), qual) == ( + "", 0) + def test_enum(): ffi = FFI() ffi.cdef(""" diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -396,3 +396,23 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) py.test.raises(MemoryError, alloc5, "int[5]") + +def test_bool_issue228(): + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + +def test_FILE_issue228(): + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + +def test_cast_from_int_type_to_bool(): + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py @@ -782,10 +782,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_parse_c_type.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_parse_c_type.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_parse_c_type.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_parse_c_type.py @@ -20,8 +20,11 @@ ffi.cdef(header) lib = ffi.verify( - open(os.path.join(cffi_dir, '..', 'c', 'parse_c_type.c')).read(), - include_dirs=[cffi_dir]) + open(os.path.join(cffi_dir, '..', 'c', 'parse_c_type.c')).read() + """ +static const char *get_common_type(const char *search, size_t search_len) { + return NULL; +} +""", include_dirs=[cffi_dir]) class ParseError(Exception): pass diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py @@ -1205,12 +1205,19 @@ assert foo_s.fields[1][1].type is ffi.typeof("void *") def test_restrict_fields(): - if sys.platform == 'win32': - py.test.skip("'__restrict__' probably not recognized") ffi = FFI() ffi.cdef("""struct foo_s { void * restrict b; };""") lib = verify(ffi, 'test_restrict_fields', """ - struct foo_s { void * __restrict__ b; };""") + struct foo_s { void * __restrict b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + +def test_volatile_fields(): + ffi = FFI() + ffi.cdef("""struct foo_s { void * volatile b; };""") + lib = verify(ffi, 'test_volatile_fields', """ + struct foo_s { void * volatile b; };""") foo_s = ffi.typeof("struct foo_s") assert foo_s.fields[0][0] == 'b' assert foo_s.fields[0][1].type is ffi.typeof("void *") diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py @@ -1495,15 +1495,6 @@ assert lib.foo(0) == 1 py.test.raises(TypeError, lib.foo, 0.0) -def test_cast_from_int_type_to_bool(): - ffi = FFI() - for basetype in ['char', 'short', 'int', 'long', 'long long']: - for sign in ['signed', 'unsigned']: - type = '%s %s' % (sign, basetype) - assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 - assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 - assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 - def test_addressof(): ffi = FFI() ffi.cdef(""" @@ -2251,3 +2242,31 @@ assert p == lib.myarray + 4 p[1] = 82 assert lib.my_value == 82 # [5] + +def test_const_pointer_to_pointer(): + ffi = FFI() + ffi.cdef("struct s { char *const *a; };") + ffi.verify("struct s { char *const *a; };") + +def test_share_FILE(): + ffi1 = FFI() + ffi1.cdef("void do_stuff(FILE *);") + lib1 = ffi1.verify("void do_stuff(FILE *f) { (void)f; }") + ffi2 = FFI() + ffi2.cdef("FILE *barize(void);") + lib2 = ffi2.verify("FILE *barize(void) { return NULL; }") + lib1.do_stuff(lib2.barize()) + +def test_win_common_types(): + if sys.platform != 'win32': + py.test.skip("Windows only") + ffi = FFI() + ffi.set_unicode(True) + ffi.verify("") + assert ffi.typeof("PBYTE") is ffi.typeof("unsigned char *") + if sys.maxsize > 2**32: + expected = "unsigned long long" + else: + expected = "unsigned int" + assert ffi.typeof("UINT_PTR") is ffi.typeof(expected) + assert ffi.typeof("PTSTR") is ffi.typeof("wchar_t *") From noreply at buildbot.pypy.org Tue Nov 3 16:37:21 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 22:37:21 +0100 (CET) Subject: [pypy-commit] pypy default: Forgot to add this file Message-ID: <20151103213721.0D0011C15C8@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80527:9fc10bf9ace6 Date: 2015-11-03 22:29 +0100 http://bitbucket.org/pypy/pypy/changeset/9fc10bf9ace6/ Log: Forgot to add this file diff --git a/pypy/module/_cffi_backend/src/commontypes.c b/pypy/module/_cffi_backend/src/commontypes.c new file mode 100644 --- /dev/null +++ b/pypy/module/_cffi_backend/src/commontypes.c @@ -0,0 +1,207 @@ +/* This file must be kept in alphabetical order. See test_commontypes.py */ + +#define EQ(key, value) key "\0" value /* string concatenation */ +#ifdef _WIN64 +# define W32_64(X,Y) Y +# else +# define W32_64(X,Y) X +# endif + + +static const char *common_simple_types[] = { + +#ifdef MS_WIN32 /* Windows types */ + EQ("ATOM", "WORD"), + EQ("BOOL", "int"), + EQ("BOOLEAN", "BYTE"), + EQ("BYTE", "unsigned char"), + EQ("CCHAR", "char"), + EQ("CHAR", "char"), + EQ("COLORREF", "DWORD"), + EQ("DWORD", "unsigned long"), + EQ("DWORD32", "unsigned int"), + EQ("DWORD64", "unsigned long long"), + EQ("DWORDLONG", "ULONGLONG"), + EQ("DWORD_PTR", "ULONG_PTR"), +#endif + + EQ("FILE", "struct _IO_FILE"), + +#ifdef MS_WIN32 /* more Windows types */ + EQ("FLOAT", "float"), + EQ("HACCEL", "HANDLE"), + EQ("HALF_PTR", W32_64("short","int")), + EQ("HANDLE", "PVOID"), + EQ("HBITMAP", "HANDLE"), + EQ("HBRUSH", "HANDLE"), + EQ("HCOLORSPACE", "HANDLE"), + EQ("HCONV", "HANDLE"), + EQ("HCONVLIST", "HANDLE"), + EQ("HCURSOR", "HICON"), + EQ("HDC", "HANDLE"), + EQ("HDDEDATA", "HANDLE"), + EQ("HDESK", "HANDLE"), + EQ("HDROP", "HANDLE"), + EQ("HDWP", "HANDLE"), + EQ("HENHMETAFILE", "HANDLE"), + EQ("HFILE", "int"), + EQ("HFONT", "HANDLE"), + EQ("HGDIOBJ", "HANDLE"), + EQ("HGLOBAL", "HANDLE"), + EQ("HHOOK", "HANDLE"), + EQ("HICON", "HANDLE"), + EQ("HINSTANCE", "HANDLE"), + EQ("HKEY", "HANDLE"), + EQ("HKL", "HANDLE"), + EQ("HLOCAL", "HANDLE"), + EQ("HMENU", "HANDLE"), + EQ("HMETAFILE", "HANDLE"), + EQ("HMODULE", "HINSTANCE"), + EQ("HMONITOR", "HANDLE"), + EQ("HPALETTE", "HANDLE"), + EQ("HPEN", "HANDLE"), + EQ("HRESULT", "LONG"), + EQ("HRGN", "HANDLE"), + EQ("HRSRC", "HANDLE"), + EQ("HSZ", "HANDLE"), + EQ("HWND", "HANDLE"), + EQ("INT", "int"), + EQ("INT16", "short"), + EQ("INT32", "int"), + EQ("INT64", "long long"), + EQ("INT8", "signed char"), + EQ("INT_PTR", W32_64("int","long long")), + EQ("LANGID", "WORD"), + EQ("LCID", "DWORD"), + EQ("LCTYPE", "DWORD"), + EQ("LGRPID", "DWORD"), + EQ("LONG", "long"), + EQ("LONG32", "int"), + EQ("LONG64", "long long"), + EQ("LONGLONG", "long long"), + EQ("LONG_PTR", W32_64("long","long long")), + EQ("LPARAM", "LONG_PTR"), + EQ("LPBOOL", "BOOL *"), + EQ("LPBYTE", "BYTE *"), + EQ("LPCOLORREF", "DWORD *"), + EQ("LPCSTR", "const char *"), + EQ("LPCVOID", "const void *"), + EQ("LPCWSTR", "const WCHAR *"), + EQ("LPDWORD", "DWORD *"), + EQ("LPHANDLE", "HANDLE *"), + EQ("LPINT", "int *"), + EQ("LPLONG", "long *"), + EQ("LPSTR", "CHAR *"), + EQ("LPVOID", "void *"), + EQ("LPWORD", "WORD *"), + EQ("LPWSTR", "WCHAR *"), + EQ("LRESULT", "LONG_PTR"), + EQ("PBOOL", "BOOL *"), + EQ("PBOOLEAN", "BOOLEAN *"), + EQ("PBYTE", "BYTE *"), + EQ("PCHAR", "CHAR *"), + EQ("PCSTR", "const CHAR *"), + EQ("PCWSTR", "const WCHAR *"), + EQ("PDWORD", "DWORD *"), + EQ("PDWORD32", "DWORD32 *"), + EQ("PDWORD64", "DWORD64 *"), + EQ("PDWORDLONG", "DWORDLONG *"), + EQ("PDWORD_PTR", "DWORD_PTR *"), + EQ("PFLOAT", "FLOAT *"), + EQ("PHALF_PTR", "HALF_PTR *"), + EQ("PHANDLE", "HANDLE *"), + EQ("PHKEY", "HKEY *"), + EQ("PINT", "int *"), + EQ("PINT16", "INT16 *"), + EQ("PINT32", "INT32 *"), + EQ("PINT64", "INT64 *"), + EQ("PINT8", "INT8 *"), + EQ("PINT_PTR", "INT_PTR *"), + EQ("PLCID", "PDWORD"), + EQ("PLONG", "LONG *"), + EQ("PLONG32", "LONG32 *"), + EQ("PLONG64", "LONG64 *"), + EQ("PLONGLONG", "LONGLONG *"), + EQ("PLONG_PTR", "LONG_PTR *"), + EQ("PSHORT", "SHORT *"), + EQ("PSIZE_T", "SIZE_T *"), + EQ("PSSIZE_T", "SSIZE_T *"), + EQ("PSTR", "CHAR *"), + EQ("PUCHAR", "UCHAR *"), + EQ("PUHALF_PTR", "UHALF_PTR *"), + EQ("PUINT", "UINT *"), + EQ("PUINT16", "UINT16 *"), + EQ("PUINT32", "UINT32 *"), + EQ("PUINT64", "UINT64 *"), + EQ("PUINT8", "UINT8 *"), + EQ("PUINT_PTR", "UINT_PTR *"), + EQ("PULONG", "ULONG *"), + EQ("PULONG32", "ULONG32 *"), + EQ("PULONG64", "ULONG64 *"), + EQ("PULONGLONG", "ULONGLONG *"), + EQ("PULONG_PTR", "ULONG_PTR *"), + EQ("PUSHORT", "USHORT *"), + EQ("PVOID", "void *"), + EQ("PWCHAR", "WCHAR *"), + EQ("PWORD", "WORD *"), + EQ("PWSTR", "WCHAR *"), + EQ("QWORD", "unsigned long long"), + EQ("SC_HANDLE", "HANDLE"), + EQ("SC_LOCK", "LPVOID"), + EQ("SERVICE_STATUS_HANDLE", "HANDLE"), + EQ("SHORT", "short"), + EQ("SIZE_T", "ULONG_PTR"), + EQ("SSIZE_T", "LONG_PTR"), + EQ("UCHAR", "unsigned char"), + EQ("UHALF_PTR", W32_64("unsigned short","unsigned int")), + EQ("UINT", "unsigned int"), + EQ("UINT16", "unsigned short"), + EQ("UINT32", "unsigned int"), + EQ("UINT64", "unsigned long long"), + EQ("UINT8", "unsigned char"), + EQ("UINT_PTR", W32_64("unsigned int","unsigned long long")), + EQ("ULONG", "unsigned long"), + EQ("ULONG32", "unsigned int"), + EQ("ULONG64", "unsigned long long"), + EQ("ULONGLONG", "unsigned long long"), + EQ("ULONG_PTR", W32_64("unsigned long","unsigned long long")), + EQ("USHORT", "unsigned short"), + EQ("USN", "LONGLONG"), + EQ("VOID", "void"), + EQ("WCHAR", "wchar_t"), + EQ("WINSTA", "HANDLE"), + EQ("WORD", "unsigned short"), + EQ("WPARAM", "UINT_PTR"), +#endif + + EQ("bool", "_Bool"), +}; + + +#undef EQ +#undef W32_64 + +#define num_common_simple_types \ + (sizeof(common_simple_types) / sizeof(common_simple_types[0])) + + +static const char *get_common_type(const char *search, size_t search_len) +{ + const char *entry; + int index = search_sorted(common_simple_types, sizeof(const char *), + num_common_simple_types, search, search_len); + if (index < 0) + return NULL; + + entry = common_simple_types[index]; + return entry + strlen(entry) + 1; +} + +RPY_EXTERN +char *pypy_enum_common_types(int index) +{ + if (index < num_common_simple_types) + return (char *)(common_simple_types[index]); + else + return NULL; +} From noreply at buildbot.pypy.org Tue Nov 3 16:44:17 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 22:44:17 +0100 (CET) Subject: [pypy-commit] pypy ppc-stacklet: Remove the removal of the _continuation module on ppc Message-ID: <20151103214417.6193F1C065A@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ppc-stacklet Changeset: r80528:205e275c5895 Date: 2015-11-03 21:26 +0100 http://bitbucket.org/pypy/pypy/changeset/205e275c5895/ Log: Remove the removal of the _continuation module on ppc diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -76,10 +76,10 @@ if "cppyy" in working_modules: working_modules.remove("cppyy") # depends on ctypes -if sys.platform.startswith("linux"): - _mach = os.popen('uname -m', 'r').read().strip() - if _mach.startswith('ppc'): - working_modules.remove("_continuation") +#if sys.platform.startswith("linux"): +# _mach = os.popen('uname -m', 'r').read().strip() +# if _mach.startswith(...): +# working_modules.remove("_continuation") module_dependencies = { From noreply at buildbot.pypy.org Tue Nov 3 16:59:09 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 22:59:09 +0100 (CET) Subject: [pypy-commit] pypy ppc-stacklet: seems to work at least in simple examples, ready for merge Message-ID: <20151103215909.4FF131C0FD9@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ppc-stacklet Changeset: r80529:50288852578b Date: 2015-11-03 22:57 +0100 http://bitbucket.org/pypy/pypy/changeset/50288852578b/ Log: seems to work at least in simple examples, ready for merge From noreply at buildbot.pypy.org Tue Nov 3 16:59:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 22:59:11 +0100 (CET) Subject: [pypy-commit] pypy default: Pull request #349 plus tweaks: Message-ID: <20151103215911.7EE701C0FD9@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80530:a1282c2b5668 Date: 2015-11-03 22:58 +0100 http://bitbucket.org/pypy/pypy/changeset/a1282c2b5668/ Log: Pull request #349 plus tweaks: Implementation of slp_switch for PPC diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -76,10 +76,10 @@ if "cppyy" in working_modules: working_modules.remove("cppyy") # depends on ctypes -if sys.platform.startswith("linux"): - _mach = os.popen('uname -m', 'r').read().strip() - if _mach.startswith('ppc'): - working_modules.remove("_continuation") +#if sys.platform.startswith("linux"): +# _mach = os.popen('uname -m', 'r').read().strip() +# if _mach.startswith(...): +# working_modules.remove("_continuation") module_dependencies = { diff --git a/rpython/rlib/test/test_rstacklet.py b/rpython/rlib/test/test_rstacklet.py --- a/rpython/rlib/test/test_rstacklet.py +++ b/rpython/rlib/test/test_rstacklet.py @@ -7,6 +7,7 @@ except CompilationError, e: py.test.skip("cannot import rstacklet: %s" % e) +from rpython.config.translationoption import DEFL_ROOTFINDER_WITHJIT from rpython.rlib import rrandom, rgc from rpython.rlib.rarithmetic import intmask from rpython.rtyper.lltypesystem import lltype, llmemory, rffi @@ -289,6 +290,9 @@ class BaseTestStacklet(StandaloneTests): def setup_class(cls): + if cls.gcrootfinder == "asmgcc" and DEFL_ROOTFINDER_WITHJIT != "asmgcc": + py.test.skip("asmgcc is disabled on the current platform") + from rpython.config.translationoption import get_combined_translation_config config = get_combined_translation_config(translating=True) config.translation.gc = cls.gc @@ -300,8 +304,6 @@ cls.old_values = Runner.config, Runner.STATUSMAX Runner.config = config Runner.STATUSMAX = 25000 - if cls.gcrootfinder == "asmgcc" and sys.platform == "win32": - py.test.skip("fails with asmgcc on win32") def teardown_class(cls): Runner.config, Runner.STATUSMAX = cls.old_values diff --git a/rpython/translator/c/src/stacklet/slp_platformselect.h b/rpython/translator/c/src/stacklet/slp_platformselect.h --- a/rpython/translator/c/src/stacklet/slp_platformselect.h +++ b/rpython/translator/c/src/stacklet/slp_platformselect.h @@ -10,6 +10,8 @@ #include "switch_x86_gcc.h" /* gcc on X86 */ #elif defined(__GNUC__) && defined(__arm__) #include "switch_arm_gcc.h" /* gcc on arm */ +#elif defined(__GNUC__) && defined(__PPC64__) +#include "switch_ppc64_gcc.h" /* gcc on ppc64 */ #elif defined(__GNUC__) && defined(__mips__) && defined(_ABI64) #include "switch_mips64_gcc.h" /* gcc on mips64 */ #else diff --git a/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h b/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h new file mode 100644 --- /dev/null +++ b/rpython/translator/c/src/stacklet/switch_ppc64_gcc.h @@ -0,0 +1,233 @@ +#if !(defined(__LITTLE_ENDIAN__) ^ defined(__BIG_ENDIAN__)) +# error "cannot determine if it is ppc64 or ppc64le" +#endif + +#ifdef __BIG_ENDIAN__ +# define TOC_AREA "40" +#else +# define TOC_AREA "24" +#endif + + +/* This depends on these attributes so that gcc generates a function + with no code before the asm, and only "blr" after. */ +static __attribute__((noinline, optimize("O2"))) +void *slp_switch(void *(*save_state)(void*, void*), + void *(*restore_state)(void*, void*), + void *extra) +{ + void *result; + __asm__ volatile ( + /* By Vaibhav Sood & Armin Rigo, with some copying from + the Stackless version by Kristjan Valur Jonsson */ + + /* Save all 18 volatile GP registers, 18 volatile FP regs, and 12 + volatile vector regs. We need a stack frame of 144 bytes for FPR, + 144 bytes for GPR, 192 bytes for VR plus 48 bytes for the standard + stackframe = 528 bytes (a multiple of 16). */ + + "mflr 0\n" /* Save LR into 16(r1) */ + "std 0, 16(1)\n" + + "std 14,-288(1)\n" /* the GPR save area is between -288(r1) */ + "std 15,-280(1)\n" /* included and -144(r1) excluded */ + "std 16,-272(1)\n" + "std 17,-264(1)\n" + "std 18,-256(1)\n" + "std 19,-248(1)\n" + "std 20,-240(1)\n" + "std 21,-232(1)\n" + "std 22,-224(1)\n" + "std 23,-216(1)\n" + "std 24,-208(1)\n" + "std 25,-200(1)\n" + "std 26,-192(1)\n" + "std 27,-184(1)\n" + "std 28,-176(1)\n" + "std 29,-168(1)\n" + "std 30,-160(1)\n" + "std 31,-152(1)\n" + + "stfd 14,-144(1)\n" /* the FPR save area is between -144(r1) */ + "stfd 15,-136(1)\n" /* included and 0(r1) excluded */ + "stfd 16,-128(1)\n" + "stfd 17,-120(1)\n" + "stfd 18,-112(1)\n" + "stfd 19,-104(1)\n" + "stfd 20,-96(1)\n" + "stfd 21,-88(1)\n" + "stfd 22,-80(1)\n" + "stfd 23,-72(1)\n" + "stfd 24,-64(1)\n" + "stfd 25,-56(1)\n" + "stfd 26,-48(1)\n" + "stfd 27,-40(1)\n" + "stfd 28,-32(1)\n" + "stfd 29,-24(1)\n" + "stfd 30,-16(1)\n" + "stfd 31,-8(1)\n" + + "li 12,-480\n" /* the VR save area is between -480(r1) */ + "stvx 20,12,1\n" /* included and -288(r1) excluded */ + "li 12,-464\n" + "stvx 21,12,1\n" + "li 12,-448\n" + "stvx 22,12,1\n" + "li 12,-432\n" + "stvx 23,12,1\n" + "li 12,-416\n" + "stvx 24,12,1\n" + "li 12,-400\n" + "stvx 25,12,1\n" + "li 12,-384\n" + "stvx 26,12,1\n" + "li 12,-368\n" + "stvx 27,12,1\n" + "li 12,-352\n" + "stvx 28,12,1\n" + "li 12,-336\n" + "stvx 29,12,1\n" + "li 12,-320\n" + "stvx 30,12,1\n" + "li 12,-304\n" + "stvx 31,12,1\n" + + "stdu 1,-528(1)\n" /* Create stack frame */ + + "std 2, "TOC_AREA"(1)\n" /* Save TOC in the "TOC save area"*/ + "mfcr 12\n" /* Save CR in the "CR save area" */ + "std 12, 8(1)\n" + + "mr 14, %[restore_state]\n" /* save 'restore_state' for later */ + "mr 15, %[extra]\n" /* save 'extra' for later */ + "mr 12, %[save_state]\n" /* move 'save_state' into r12 for branching */ + "mr 3, 1\n" /* arg 1: current (old) stack pointer */ + "mr 4, 15\n" /* arg 2: extra */ + + "stdu 1, -48(1)\n" /* create temp stack space (see below) */ +#ifdef __BIG_ENDIAN__ + "ld 0, 0(12)\n" + "ld 11, 16(12)\n" + "mtctr 0\n" + "ld 2, 8(12)\n" +#else + "mtctr 12\n" /* r12 is fixed by this ABI */ +#endif + "bctrl\n" /* call save_state() */ + "addi 1, 1, 48\n" /* destroy temp stack space */ + + "cmpdi 3, 0\n" /* skip the rest if the return value is null */ + "bt eq, zero\n" + + "mr 1, 3\n" /* change the stack pointer */ + /* From now on, the stack pointer is modified, but the content of the + stack is not restored yet. It contains only garbage here. */ + + "mr 4, 15\n" /* arg 2: extra */ + /* arg 1: current (new) stack pointer + is already in r3 */ + + "stdu 1, -48(1)\n" /* create temp stack space for callee to use */ + /* ^^^ we have to be careful. The function call will store the link + register in the current frame (as the ABI) dictates. But it will + then trample it with the restore! We fix this by creating a fake + stack frame */ + +#ifdef __BIG_ENDIAN__ + "ld 0, 0(14)\n" /* 'restore_state' is in r14 */ + "ld 11, 16(14)\n" + "mtctr 0\n" + "ld 2, 8(14)\n" +#endif +#ifdef __LITTLE_ENDIAN__ + "mr 12, 14\n" /* copy 'restore_state' */ + "mtctr 12\n" /* r12 is fixed by this ABI */ +#endif + + "bctrl\n" /* call restore_state() */ + "addi 1, 1, 48\n" /* destroy temp stack space */ + + /* The stack's content is now restored. */ + + "zero:\n" + + /* Epilogue */ + + "ld 2, "TOC_AREA"(1)\n" /* restore the TOC */ + "ld 12,8(1)\n" /* restore the condition register */ + "mtcrf 0xff, 12\n" + + "addi 1,1,528\n" /* restore stack pointer */ + + "li 12,-480\n" /* restore vector registers */ + "lvx 20,12,1\n" + "li 12,-464\n" + "lvx 21,12,1\n" + "li 12,-448\n" + "lvx 22,12,1\n" + "li 12,-432\n" + "lvx 23,12,1\n" + "li 12,-416\n" + "lvx 24,12,1\n" + "li 12,-400\n" + "lvx 25,12,1\n" + "li 12,-384\n" + "lvx 26,12,1\n" + "li 12,-368\n" + "lvx 27,12,1\n" + "li 12,-352\n" + "lvx 28,12,1\n" + "li 12,-336\n" + "lvx 29,12,1\n" + "li 12,-320\n" + "lvx 30,12,1\n" + "li 12,-304\n" + "lvx 31,12,1\n" + + "ld 14,-288(1)\n" /* restore general purporse registers */ + "ld 15,-280(1)\n" + "ld 16,-272(1)\n" + "ld 17,-264(1)\n" + "ld 18,-256(1)\n" + "ld 19,-248(1)\n" + "ld 20,-240(1)\n" + "ld 21,-232(1)\n" + "ld 22,-224(1)\n" + "ld 23,-216(1)\n" + "ld 24,-208(1)\n" + "ld 25,-200(1)\n" + "ld 26,-192(1)\n" + "ld 27,-184(1)\n" + "ld 28,-176(1)\n" + "ld 29,-168(1)\n" + "ld 30,-160(1)\n" + "ld 31,-152(1)\n" + + "lfd 14,-144(1)\n" /* restore floating point registers */ + "lfd 15,-136(1)\n" + "lfd 16,-128(1)\n" + "lfd 17,-120(1)\n" + "lfd 18,-112(1)\n" + "lfd 19,-104(1)\n" + "lfd 20,-96(1)\n" + "lfd 21,-88(1)\n" + "lfd 22,-80(1)\n" + "lfd 23,-72(1)\n" + "lfd 24,-64(1)\n" + "lfd 25,-56(1)\n" + "lfd 26,-48(1)\n" + "lfd 27,-40(1)\n" + "lfd 28,-32(1)\n" + "ld 0, 16(1)\n" + "lfd 29,-24(1)\n" + "mtlr 0\n" + "lfd 30,-16(1)\n" + "lfd 31,-8(1)\n" + + : "=r"(result) /* output variable: expected to be r3 */ + : [restore_state]"r"(restore_state), /* input variables */ + [save_state]"r"(save_state), + [extra]"r"(extra) + ); + return result; +} From noreply at buildbot.pypy.org Tue Nov 3 16:59:13 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 3 Nov 2015 22:59:13 +0100 (CET) Subject: [pypy-commit] pypy default: Document branch Message-ID: <20151103215913.9C99E1C0FD9@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80531:f48af5699c24 Date: 2015-11-03 22:59 +0100 http://bitbucket.org/pypy/pypy/changeset/f48af5699c24/ Log: Document branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -11,4 +11,6 @@ .. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 +.. branch: ppc-stacklet +The PPC machines now support the _continuation module (stackless, greenlets) From noreply at buildbot.pypy.org Tue Nov 3 21:15:44 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 4 Nov 2015 03:15:44 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Fix detection of suitable exception links in GraphFlattener.make_exception_link() Message-ID: <20151104021544.510CA1C06BE@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80532:433f4c50738d Date: 2015-11-04 02:16 +0000 http://bitbucket.org/pypy/pypy/changeset/433f4c50738d/ Log: Fix detection of suitable exception links in GraphFlattener.make_exception_link() diff --git a/rpython/jit/codewriter/flatten.py b/rpython/jit/codewriter/flatten.py --- a/rpython/jit/codewriter/flatten.py +++ b/rpython/jit/codewriter/flatten.py @@ -160,8 +160,13 @@ # is jumping directly to the re-raising exception block. assert link.last_exception is not None assert link.last_exc_value is not None - if link.target.operations == () and link.args == [link.last_exception, - link.last_exc_value]: + def equals(a , b): + return (a == b or + isinstance(a, Constant) and isinstance(b, Constant) and + a.value == b.value) + if (link.target.operations == () and len(link.args) == 2 and + equals(link.args[0] , link.last_exception) and + equals(link.args[1], link.last_exc_value)): if handling_ovf: exc_data = self.cpu.rtyper.exceptiondata ll_ovf = exc_data.get_standard_ll_exc_instance_by_class( From noreply at buildbot.pypy.org Wed Nov 4 03:49:10 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 4 Nov 2015 09:49:10 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: random progres Message-ID: <20151104084910.E39D41C0797@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80533:92eb26363b25 Date: 2015-11-01 12:36 +0000 http://bitbucket.org/pypy/pypy/changeset/92eb26363b25/ Log: random progres diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -52,10 +52,22 @@ vmprof_register_virtual_function = rffi.llexternal( "vmprof_register_virtual_function", [rffi.CCHARP, rffi.LONG, rffi.INT], - rffi.INT, compilation_info=eci) + rffi.INT, compilation_info=eci, + _nowrapper=True) vmprof_ignore_signals = rffi.llexternal("vmprof_ignore_signals", [rffi.INT], lltype.Void, - compilation_info=eci) + compilation_info=eci, + _nowrapper=True) + vmprof_stack_new = rffi.llexternal("vmprof_stack_new", + [], rffi.VOIDP, compilation_info=eci, _nowrapper=True) + vmprof_stack_append = rffi.llexternal("vmprof_stack_append", + [rffi.VOIDP, lltype.Signed], rffi.INT, compilation_info=eci, + _nowrapper=True) + vmprof_stack_pop = rffi.llexternal("vmprof_stack_pop", + [rffi.VOIDP], lltype.Signed, compilation_info=eci, + _nowrapper=True) + vmprof_stack_free = rffi.llexternal("vmprof_stack_free", + [rffi.VOIDP], lltype.Void, compilation_info=eci, _nowrapper=True) return CInterface(locals()) diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -19,6 +19,8 @@ class VMProf(object): + _immutable_fields_ = ['is_enabled?'] + def __init__(self): "NOT_RPYTHON: use _get_vmprof()" self._code_classes = set() diff --git a/rpython/rlib/rvmprof/src/rvmprof.h b/rpython/rlib/rvmprof/src/rvmprof.h --- a/rpython/rlib/rvmprof/src/rvmprof.h +++ b/rpython/rlib/rvmprof/src/rvmprof.h @@ -4,3 +4,7 @@ RPY_EXTERN int vmprof_enable(void); RPY_EXTERN int vmprof_disable(void); RPY_EXTERN int vmprof_register_virtual_function(char *, long, int); +RPY_EXTERN void* vmprof_stack_new(void); +RPY_EXTERN int vmprof_stack_append(void*, long); +RPY_EXTERN long vmprof_stack_pop(void*); +RPY_EXTERN void vmprof_stack_free(void*); \ No newline at end of file diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h --- a/rpython/rlib/rvmprof/src/vmprof_main.h +++ b/rpython/rlib/rvmprof/src/vmprof_main.h @@ -37,6 +37,7 @@ #include "vmprof_unwind.h" #endif #include "vmprof_mt.h" +#include "vmprof_stack.h" /************************************************************/ diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h new file mode 100644 --- /dev/null +++ b/rpython/rlib/rvmprof/src/vmprof_stack.h @@ -0,0 +1,42 @@ + +#define STACK_SIZE 8192 +#include + +typedef struct vmprof_stack { + volatile long stack_depth; + long stack_items[STACK_SIZE]; +} vmprof_stack; + +void *vmprof_stack_new(void) +{ + vmprof_stack* stack = (vmprof_stack *)malloc(sizeof(vmprof_stack)); + stack->stack_depth = 0; + return (void*)stack; +} + +int vmprof_stack_append(void *_stack, long item) +{ + vmprof_stack* stack = (vmprof_stack*)_stack; + if (stack->stack_depth >= STACK_SIZE - 1) + return -1; + stack->stack_items[stack->stack_depth] = item; + stack->stack_depth += 1; + return 0; +} + +long vmprof_stack_pop(void *_stack) +{ + vmprof_stack* stack = (vmprof_stack*)_stack; + long res; + + if (stack->stack_depth <= 0) + return -1; + res = stack->stack_items[stack->stack_depth]; + stack->stack_depth -= 1; + return res; +} + +void vmprof_stack_free(void* stack) +{ + free(stack); +} \ No newline at end of file From noreply at buildbot.pypy.org Wed Nov 4 03:49:13 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 4 Nov 2015 09:49:13 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: fixes Message-ID: <20151104084913.122831C0797@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80534:c67fc4fb2414 Date: 2015-11-04 08:49 +0000 http://bitbucket.org/pypy/pypy/changeset/c67fc4fb2414/ Log: fixes diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -31,6 +31,7 @@ else: self._code_unique_id = 0x7000000000000000 self.cintf = cintf.setup() + self._stack = self.cintf.vmprof_stack_new() def _cleanup_(self): self.is_enabled = False @@ -129,7 +130,6 @@ if self.cintf.vmprof_register_virtual_function(name, uid, 500000) < 0: raise VMProfError("vmprof buffers full! disk full or too slow") - def vmprof_execute_code(name, get_code_fn, result_class=None): """Decorator to be used on the function that interprets a code object. @@ -147,7 +147,7 @@ """ def decorate(func): try: - _get_vmprof() + _vmprof = _get_vmprof() except cintf.VMProfPlatformUnsupported: return func @@ -169,6 +169,8 @@ @specialize.memo() def get_ll_trampoline(token): + """ Used by the trampoline-version only + """ if result_class is None: restok = "i" else: @@ -185,18 +187,27 @@ # If we are being JITted, we want to skip the trampoline, else the # JIT cannot see through it. # - if we_are_translated() and not jit.we_are_jitted(): - # if we are translated, call the trampoline + if 0: # this is the trampoline case + if we_are_translated() and not jit.we_are_jitted(): + # if we are translated, call the trampoline + unique_id = get_code_fn(*args)._vmprof_unique_id + ll_args, token = lower(*args) + ll_trampoline = get_ll_trampoline(token) + ll_result = ll_trampoline(*ll_args + (unique_id,)) + if result_class is not None: + return cast_base_ptr_to_instance(result_class, ll_result) + else: + return ll_result + else: + return func(*args) + else: # this is the case of the stack unique_id = get_code_fn(*args)._vmprof_unique_id - ll_args, token = lower(*args) - ll_trampoline = get_ll_trampoline(token) - ll_result = ll_trampoline(*ll_args + (unique_id,)) - if result_class is not None: - return cast_base_ptr_to_instance(result_class, ll_result) - else: - return ll_result - else: - return func(*args) + _vmprof.cintf.vmprof_stack_append(_vmprof._stack, unique_id) + try: + res = func(*args) + finally: + _vmprof.cintf.vmprof_stack_pop(_vmprof._stack) + return res decorated_function.__name__ = func.__name__ + '_rvmprof' return decorated_function diff --git a/rpython/rlib/rvmprof/src/rvmprof.c b/rpython/rlib/rvmprof/src/rvmprof.c --- a/rpython/rlib/rvmprof/src/rvmprof.c +++ b/rpython/rlib/rvmprof/src/rvmprof.c @@ -13,9 +13,9 @@ # include "common_header.h" # include "rvmprof.h" -# ifndef VMPROF_ADDR_OF_TRAMPOLINE +/*# ifndef VMPROF_ADDR_OF_TRAMPOLINE # error "RPython program using rvmprof, but not calling vmprof_execute_code()" -# endif +# endif*/ #endif diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h --- a/rpython/rlib/rvmprof/src/vmprof_stack.h +++ b/rpython/rlib/rvmprof/src/vmprof_stack.h @@ -7,14 +7,14 @@ long stack_items[STACK_SIZE]; } vmprof_stack; -void *vmprof_stack_new(void) +RPY_EXTERN void *vmprof_stack_new(void) { vmprof_stack* stack = (vmprof_stack *)malloc(sizeof(vmprof_stack)); stack->stack_depth = 0; return (void*)stack; } -int vmprof_stack_append(void *_stack, long item) +RPY_EXTERN int vmprof_stack_append(void *_stack, long item) { vmprof_stack* stack = (vmprof_stack*)_stack; if (stack->stack_depth >= STACK_SIZE - 1) @@ -24,7 +24,7 @@ return 0; } -long vmprof_stack_pop(void *_stack) +RPY_EXTERN long vmprof_stack_pop(void *_stack) { vmprof_stack* stack = (vmprof_stack*)_stack; long res; @@ -36,7 +36,7 @@ return res; } -void vmprof_stack_free(void* stack) +RPY_EXTERN void vmprof_stack_free(void* stack) { free(stack); } \ No newline at end of file From noreply at buildbot.pypy.org Wed Nov 4 04:46:38 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 4 Nov 2015 10:46:38 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: don't scan the first item of shadowstack and always use an extra one Message-ID: <20151104094638.752691C0155@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80535:f276c700c181 Date: 2015-11-04 09:46 +0000 http://bitbucket.org/pypy/pypy/changeset/f276c700c181/ Log: don't scan the first item of shadowstack and always use an extra one diff --git a/rpython/memory/gctransform/shadowstack.py b/rpython/memory/gctransform/shadowstack.py --- a/rpython/memory/gctransform/shadowstack.py +++ b/rpython/memory/gctransform/shadowstack.py @@ -76,10 +76,11 @@ def walk_stack_root(callback, start, end): gc = self.gc addr = end + addr -= sizeofaddr while addr != start: - addr -= sizeofaddr if gc.points_to_valid_gc_object(addr): callback(gc, addr) + addr -= sizeofaddr self.rootstackhook = walk_stack_root self.shadow_stack_pool = ShadowStackPool(gcdata) @@ -282,7 +283,7 @@ def start_fresh_new_state(self): self.gcdata.root_stack_base = self.unused_full_stack - self.gcdata.root_stack_top = self.unused_full_stack + self.gcdata.root_stack_top = self.unused_full_stack + sizeofaddr self.unused_full_stack = llmemory.NULL def _cleanup(self, shadowstackref): @@ -312,10 +313,11 @@ obj = llmemory.cast_adr_to_ptr(obj, SHADOWSTACKREFPTR) addr = obj.top start = obj.base + addr -= sizeofaddr while addr != start: + gc._trace_callback(callback, arg, addr) addr -= sizeofaddr - gc._trace_callback(callback, arg, addr) - + gc = gctransformer.gcdata.gc assert not hasattr(gc, 'custom_trace_dispatcher') # ^^^ create_custom_trace_funcs() must not run before this From noreply at buildbot.pypy.org Wed Nov 4 07:43:32 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 4 Nov 2015 13:43:32 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: ironed out issues that took the wrong register. excluding the scratch register from managed ones and correctly setting the registers on the cpu now gives the desired result. added int_sub Message-ID: <20151104124332.61F241C0155@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80536:78a1e03178a0 Date: 2015-11-04 13:43 +0100 http://bitbucket.org/pypy/pypy/changeset/78a1e03178a0/ Log: ironed out issues that took the wrong register. excluding the scratch register from managed ones and correctly setting the registers on the cpu now gives the desired result. added int_sub diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -102,12 +102,11 @@ # this function is called (see generate_quick_failure()). ofs = self.cpu.get_ofs_of_frame_field('jf_descr') ofs2 = self.cpu.get_ofs_of_frame_field('jf_gcmap') - mc.STG(r.r2, l.addr(ofs, r.SPP)) - mc.STG(r.r3, l.addr(ofs2, r.SPP)) - self._push_core_regs_to_jitframe(mc) if withfloats: self._push_fp_regs_to_jitframe(mc) + mc.STG(r.r2, l.addr(ofs, r.SPP)) + mc.STG(r.r3, l.addr(ofs2, r.SPP)) if exc: pass # TODO diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -14,6 +14,7 @@ 'AGFR': ('rre', ['\xB9','\x18']), 'A': ('rx', ['\x5A']), 'SR': ('rr', ['\x1B']), + 'SG': ('rxy', ['\xE3','\x09']), 'SGR': ('rre', ['\xB9','\x09']), 'AY': ('rxy', ['\xE3','\x5A']), diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -16,6 +16,13 @@ else: self.mc.AGR(l0, l1) + def emit_int_sub(self, op, arglocs, regalloc): + l0, l1 = arglocs + if l1.is_in_pool(): + self.mc.SG(l0, l1) + else: + self.mc.SGR(l0, l1) + emit_int_le = gen_emit_cmp_op(c.LE) emit_int_lt = gen_emit_cmp_op(c.LT) emit_int_gt = gen_emit_cmp_op(c.GT) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -121,10 +121,8 @@ def ensure_reg(self, box): if isinstance(box, Const): - xxx - loc = self.get_scratch_reg() - immvalue = self.convert_to_int(box) - self.assembler.mc.load_imm(loc, immvalue) + offset = self.assembler.pool.get_descr_offset(box) + return l.pool(offset) else: assert box in self.temp_boxes loc = self.make_sure_var_in_reg(box, diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -7,14 +7,15 @@ [r0,r1,r2,r3,r4,r5,r6,r7,r8, r9,r10,r11,r12,r13,r14,r15] = registers -MANAGED_REGS = [r0,r2,r3,r4,r5,r6,r7,r8,r9,r10] +MANAGED_REGS = [r0,r1,r4,r5,r6,r7,r8,r9,r10] VOLATILES = [r6,r7,r8,r9,r10] SP = r15 BSP = r12 RETURN = r14 POOL = r13 SPP = r11 -SCRATCH = r1 +SCRATCH = r3 +SCRATCH2 = r2 [f0,f1,f2,f3,f4,f5,f6,f7,f8, f9,f10,f11,f12,f13,f14,f15] = fpregisters @@ -26,7 +27,7 @@ # number of registers that need to be saved into the jitframe when # failing a guard, for example. ALL_REG_INDEXES = {} -for _r in MANAGED_REGS: +for _r in registers: ALL_REG_INDEXES[_r] = len(ALL_REG_INDEXES) for _r in MANAGED_FP_REGS: ALL_REG_INDEXES[_r] = len(ALL_REG_INDEXES) + 1 diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py --- a/rpython/jit/backend/zarch/runner.py +++ b/rpython/jit/backend/zarch/runner.py @@ -23,7 +23,7 @@ frame_reg = r.SP all_reg_indexes = [-1] * 32 - for _i, _r in enumerate(r.MANAGED_REGS): + for _i, _r in enumerate(r.registers): all_reg_indexes[_r.value] = _i gen_regs = r.MANAGED_REGS float_regs = r.MANAGED_FP_REGS From noreply at buildbot.pypy.org Wed Nov 4 08:20:06 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 4 Nov 2015 14:20:06 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: reordered free registers and force result in register (wrong order double loaded values already in a register) Message-ID: <20151104132006.90DEA1C071E@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80537:094ee6d25c63 Date: 2015-11-04 14:20 +0100 http://bitbucket.org/pypy/pypy/changeset/094ee6d25c63/ Log: reordered free registers and force result in register (wrong order double loaded values already in a register) diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -17,8 +17,8 @@ l1 = imm(a1.getint()) else: l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) self.free_op_vars() - self.force_result_in_reg(op, a0) return [l0, l1] def prepare_int_sub(self, op): @@ -28,8 +28,8 @@ a0, a1 = a1, a0 l0 = self.ensure_reg(a0) l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) self.free_op_vars() - self.force_result_in_reg(op, a0) return [l0, l1] def prepare_cmp_op(self, op): @@ -42,8 +42,8 @@ l1 = imm(a1.getint()) else: l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) self.free_op_vars() - self.force_result_in_reg(op, a0) return [l0, l1] def prepare_binary_op(self, op): @@ -51,6 +51,6 @@ a1 = op.getarg(1) l0 = self.ensure_reg(a0) l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) self.free_op_vars() - self.force_result_in_reg(op, a0) return [l0, l1] From noreply at buildbot.pypy.org Wed Nov 4 08:53:35 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 4 Nov 2015 14:53:35 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: merged default Message-ID: <20151104135335.80F4C1C1457@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80538:a51c53720c0b Date: 2015-11-04 14:53 +0100 http://bitbucket.org/pypy/pypy/changeset/a51c53720c0b/ Log: merged default diff too long, truncating to 2000 out of 6101 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), - ('type_specifier -> SHORT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',711), - ('type_specifier -> INT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',712), - ('type_specifier -> LONG','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',713), - ('type_specifier -> FLOAT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',714), - ('type_specifier -> DOUBLE','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',715), - ('type_specifier -> _COMPLEX','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',716), - ('type_specifier -> SIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',717), - ('type_specifier -> UNSIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',718), - ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',723), - ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',724), - ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',725), - ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',730), - ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',731), - ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',732), - ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list_1','../pycparser/c_parser.py',737), - ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list_1','../pycparser/c_parser.py',738), - ('init_declarator_list -> EQUALS initializer','init_declarator_list',2,'p_init_declarator_list_2','../pycparser/c_parser.py',748), - ('init_declarator_list -> abstract_declarator','init_declarator_list',1,'p_init_declarator_list_3','../pycparser/c_parser.py',756), - ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','../pycparser/c_parser.py',764), - ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','../pycparser/c_parser.py',765), - ('specifier_qualifier_list -> type_qualifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','../pycparser/c_parser.py',770), - ('specifier_qualifier_list -> type_specifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','../pycparser/c_parser.py',775), - ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',783), - ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',784), - ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','../pycparser/c_parser.py',793), - ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',802), - ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',803), - ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',812), - ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',813), - ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','../pycparser/c_parser.py',820), - ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','../pycparser/c_parser.py',821), - ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','../pycparser/c_parser.py',826), - ('struct_declaration -> specifier_qualifier_list abstract_declarator SEMI','struct_declaration',3,'p_struct_declaration_2','../pycparser/c_parser.py',864), - ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','../pycparser/c_parser.py',878), - ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','../pycparser/c_parser.py',879), - ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','../pycparser/c_parser.py',887), - ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','../pycparser/c_parser.py',892), - ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','../pycparser/c_parser.py',893), - ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',901), - ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',902), - ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','../pycparser/c_parser.py',907), - ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',912), - ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',913), - ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','../pycparser/c_parser.py',918), - ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','../pycparser/c_parser.py',919), - ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','../pycparser/c_parser.py',920), - ('enumerator -> ID','enumerator',1,'p_enumerator','../pycparser/c_parser.py',931), - ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','../pycparser/c_parser.py',932), - ('declarator -> direct_declarator','declarator',1,'p_declarator_1','../pycparser/c_parser.py',947), - ('declarator -> pointer direct_declarator','declarator',2,'p_declarator_2','../pycparser/c_parser.py',952), - ('declarator -> pointer TYPEID','declarator',2,'p_declarator_3','../pycparser/c_parser.py',961), - ('direct_declarator -> ID','direct_declarator',1,'p_direct_declarator_1','../pycparser/c_parser.py',972), - ('direct_declarator -> LPAREN declarator RPAREN','direct_declarator',3,'p_direct_declarator_2','../pycparser/c_parser.py',981), - ('direct_declarator -> direct_declarator LBRACKET assignment_expression_opt RBRACKET','direct_declarator',4,'p_direct_declarator_3','../pycparser/c_parser.py',986), - ('direct_declarator -> direct_declarator LBRACKET TIMES RBRACKET','direct_declarator',4,'p_direct_declarator_4','../pycparser/c_parser.py',998), - ('direct_declarator -> direct_declarator LPAREN parameter_type_list RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1008), - ('direct_declarator -> direct_declarator LPAREN identifier_list_opt RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1009), - ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','../pycparser/c_parser.py',1036), - ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','../pycparser/c_parser.py',1037), - ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','../pycparser/c_parser.py',1047), - ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','../pycparser/c_parser.py',1048), - ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','../pycparser/c_parser.py',1053), - ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','../pycparser/c_parser.py',1054), - ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','../pycparser/c_parser.py',1062), - ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','../pycparser/c_parser.py',1063), - ('parameter_declaration -> declaration_specifiers declarator','parameter_declaration',2,'p_parameter_declaration_1','../pycparser/c_parser.py',1072), - ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','../pycparser/c_parser.py',1083), - ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','../pycparser/c_parser.py',1113), - ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','../pycparser/c_parser.py',1114), - ('initializer -> assignment_expression','initializer',1,'p_initializer_1','../pycparser/c_parser.py',1123), - ('initializer -> brace_open initializer_list brace_close','initializer',3,'p_initializer_2','../pycparser/c_parser.py',1128), - ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','../pycparser/c_parser.py',1129), - ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','../pycparser/c_parser.py',1134), - ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','../pycparser/c_parser.py',1135), - ('designation -> designator_list EQUALS','designation',2,'p_designation','../pycparser/c_parser.py',1146), - ('designator_list -> designator','designator_list',1,'p_designator_list','../pycparser/c_parser.py',1154), - ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','../pycparser/c_parser.py',1155), - ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','../pycparser/c_parser.py',1160), - ('designator -> PERIOD identifier','designator',2,'p_designator','../pycparser/c_parser.py',1161), - ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','../pycparser/c_parser.py',1166), - ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','../pycparser/c_parser.py',1182), - ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','../pycparser/c_parser.py',1190), - ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','../pycparser/c_parser.py',1195), - ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','../pycparser/c_parser.py',1205), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','../pycparser/c_parser.py',1209), - ('direct_abstract_declarator -> LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_3','../pycparser/c_parser.py',1219), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','../pycparser/c_parser.py',1227), - ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','../pycparser/c_parser.py',1237), - ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','../pycparser/c_parser.py',1245), - ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','../pycparser/c_parser.py',1255), - ('block_item -> declaration','block_item',1,'p_block_item','../pycparser/c_parser.py',1266), - ('block_item -> statement','block_item',1,'p_block_item','../pycparser/c_parser.py',1267), - ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','../pycparser/c_parser.py',1274), - ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','../pycparser/c_parser.py',1275), - ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','../pycparser/c_parser.py',1281), - ('labeled_statement -> ID COLON statement','labeled_statement',3,'p_labeled_statement_1','../pycparser/c_parser.py',1287), - ('labeled_statement -> CASE constant_expression COLON statement','labeled_statement',4,'p_labeled_statement_2','../pycparser/c_parser.py',1291), - ('labeled_statement -> DEFAULT COLON statement','labeled_statement',3,'p_labeled_statement_3','../pycparser/c_parser.py',1295), - ('selection_statement -> IF LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_1','../pycparser/c_parser.py',1299), - ('selection_statement -> IF LPAREN expression RPAREN statement ELSE statement','selection_statement',7,'p_selection_statement_2','../pycparser/c_parser.py',1303), - ('selection_statement -> SWITCH LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_3','../pycparser/c_parser.py',1307), - ('iteration_statement -> WHILE LPAREN expression RPAREN statement','iteration_statement',5,'p_iteration_statement_1','../pycparser/c_parser.py',1312), - ('iteration_statement -> DO statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','../pycparser/c_parser.py',1316), - ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN statement','iteration_statement',9,'p_iteration_statement_3','../pycparser/c_parser.py',1320), - ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement','iteration_statement',8,'p_iteration_statement_4','../pycparser/c_parser.py',1324), - ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','../pycparser/c_parser.py',1328), From noreply at buildbot.pypy.org Wed Nov 4 17:36:59 2015 From: noreply at buildbot.pypy.org (cfbolz) Date: Wed, 4 Nov 2015 23:36:59 +0100 (CET) Subject: [pypy-commit] pypy default: a much faster implementation of enumerate Message-ID: <20151104223659.3F4CC1C12F1@cobra.cs.uni-duesseldorf.de> Author: Carl Friedrich Bolz Branch: Changeset: r80539:8c1d8f7986a2 Date: 2015-11-04 23:36 +0100 http://bitbucket.org/pypy/pypy/changeset/8c1d8f7986a2/ Log: a much faster implementation of enumerate diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py --- a/pypy/module/__builtin__/functional.py +++ b/pypy/module/__builtin__/functional.py @@ -8,7 +8,7 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault from pypy.interpreter.typedef import TypeDef -from rpython.rlib import jit +from rpython.rlib import jit, rarithmetic from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_uint, intmask from rpython.rlib.rbigint import rbigint @@ -229,10 +229,22 @@ return min_max(space, __args__, "min") + class W_Enumerate(W_Root): - def __init__(self, w_iter, w_start): - self.w_iter = w_iter - self.w_index = w_start + def __init__(self, space, w_iterable, w_start): + from pypy.objspace.std.listobject import W_ListObject + w_iter = space.iter(w_iterable) + if space.is_w(space.type(w_start), space.w_int): + self.index = space.int_w(w_start) + self.w_index = None + if self.index == 0 and type(w_iterable) is W_ListObject: + w_iter = w_iterable + else: + self.index = -1 + self.w_index = w_start + self.w_iter_or_list = w_iter + if self.w_index is not None: + assert not type(self.w_iter_or_list) is W_ListObject def descr___new__(space, w_subtype, w_iterable, w_start=None): self = space.allocate_instance(W_Enumerate, w_subtype) @@ -240,16 +252,42 @@ w_start = space.wrap(0) else: w_start = space.index(w_start) - self.__init__(space.iter(w_iterable), w_start) + self.__init__(space, w_iterable, w_start) return space.wrap(self) def descr___iter__(self, space): return space.wrap(self) def descr_next(self, space): - w_item = space.next(self.w_iter) + from pypy.objspace.std.listobject import W_ListObject w_index = self.w_index - self.w_index = space.add(w_index, space.wrap(1)) + w_iter_or_list = self.w_iter_or_list + w_item = None + if w_index is None: + index = self.index + if type(w_iter_or_list) is W_ListObject: + try: + w_item = w_iter_or_list.getitem(index) + except IndexError: + self.w_iter_or_list = None + raise OperationError(space.w_StopIteration, space.w_None) + self.index = index + 1 + elif w_iter_or_list is None: + raise OperationError(space.w_StopIteration, space.w_None) + else: + try: + newval = rarithmetic.ovfcheck(index + 1) + except OverflowError: + w_index = space.wrap(index) + self.w_index = space.add(w_index, space.wrap(1)) + self.index = -1 + else: + self.index = newval + w_index = space.wrap(index) + else: + self.w_index = space.add(w_index, space.wrap(1)) + if w_item is None: + w_item = space.next(self.w_iter_or_list) return space.newtuple([w_index, w_item]) def descr___reduce__(self, space): @@ -257,12 +295,17 @@ w_mod = space.getbuiltinmodule('_pickle_support') mod = space.interp_w(MixedModule, w_mod) w_new_inst = mod.get('enumerate_new') - w_info = space.newtuple([self.w_iter, self.w_index]) + w_index = self.w_index + if w_index is None: + w_index = space.wrap(self.index) + else: + w_index = self.w_index + w_info = space.newtuple([self.w_iter_or_list, w_index]) return space.newtuple([w_new_inst, w_info]) # exported through _pickle_support def _make_enumerate(space, w_iter, w_index): - return space.wrap(W_Enumerate(w_iter, w_index)) + return space.wrap(W_Enumerate(space, w_iter, w_index)) W_Enumerate.typedef = TypeDef("enumerate", __new__=interp2app(W_Enumerate.descr___new__.im_func), diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py --- a/pypy/module/__builtin__/test/test_builtin.py +++ b/pypy/module/__builtin__/test/test_builtin.py @@ -264,6 +264,7 @@ raises(StopIteration,x.next) def test_enumerate(self): + import sys seq = range(2,4) enum = enumerate(seq) assert enum.next() == (0, 2) @@ -274,6 +275,15 @@ enum = enumerate(range(5), 2) assert list(enum) == zip(range(2, 7), range(5)) + enum = enumerate(range(2), 2**100) + assert list(enum) == [(2**100, 0), (2**100+1, 1)] + + enum = enumerate(range(2), sys.maxint) + assert list(enum) == [(sys.maxint, 0), (sys.maxint+1, 1)] + + raises(TypeError, enumerate, range(2), 5.5) + + def test_next(self): x = iter(['a', 'b', 'c']) assert next(x) == 'a' diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -248,3 +248,23 @@ loop, = log.loops_by_filename(self.filepath) ops = loop.ops_by_id('getitem', include_guard_not_invalidated=False) assert log.opnames(ops) == [] + + def test_enumerate_list(self): + def main(n): + for a, b in enumerate([1, 2] * 1000): + a + b + + log = self.run(main, [1000]) + loop, = log.loops_by_filename(self.filepath) + opnames = log.opnames(loop.allops()) + assert opnames.count('new_with_vtable') == 0 + + def test_enumerate(self): + def main(n): + for a, b in enumerate("abc" * 1000): + a + ord(b) + + log = self.run(main, [1000]) + loop, = log.loops_by_filename(self.filepath) + opnames = log.opnames(loop.allops()) + assert opnames.count('new_with_vtable') == 0 From noreply at buildbot.pypy.org Thu Nov 5 01:43:25 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 07:43:25 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-gcc: import stmgc/41227d7659ac (the current head, only a comment added) Message-ID: <20151105064325.EC2881C02FB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-gcc Changeset: r80540:38e00aff4334 Date: 2015-11-05 07:41 +0100 http://bitbucket.org/pypy/pypy/changeset/38e00aff4334/ Log: import stmgc/41227d7659ac (the current head, only a comment added) diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision --- a/rpython/translator/stm/src_stm/revision +++ b/rpython/translator/stm/src_stm/revision @@ -1,1 +1,1 @@ -6ca47dad66a6 +41227d7659ac diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c --- a/rpython/translator/stm/src_stm/stm/core.c +++ b/rpython/translator/stm/src_stm/stm/core.c @@ -424,6 +424,8 @@ We choose the approach to reset all our changes to this obj here, so that we can throw away the backup copy completely: */ + /* XXX: this browses through the whole list of modified + fragments; this may become a problem... */ reset_modified_from_backup_copies(my_segnum, obj); continue; } From noreply at buildbot.pypy.org Thu Nov 5 01:43:28 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 07:43:28 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-gcc: close branch to be merged Message-ID: <20151105064328.40F921C02FB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-gcc Changeset: r80541:507bae789a11 Date: 2015-11-05 07:42 +0100 http://bitbucket.org/pypy/pypy/changeset/507bae789a11/ Log: close branch to be merged From noreply at buildbot.pypy.org Thu Nov 5 01:43:44 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 07:43:44 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: hg merge stmgc-c8-gcc Message-ID: <20151105064344.A75BD1C02FB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8 Changeset: r80542:10fa5e673328 Date: 2015-11-05 07:43 +0100 http://bitbucket.org/pypy/pypy/changeset/10fa5e673328/ Log: hg merge stmgc-c8-gcc diff too long, truncating to 2000 out of 35822 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -15,3 +15,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 +f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -168,7 +168,6 @@ Michael Twomey Lucian Branescu Mihaila Yichao Yu - Anton Gulenko Gabriel Lavoie Olivier Dormond Jared Grubb @@ -215,6 +214,7 @@ Carl Meyer Karl Ramm Pieter Zieschang + Anton Gulenko Gabriel Lukas Vacek Andrew Dalke @@ -247,6 +247,7 @@ Toni Mattis Lucas Stadler Julian Berman + Markus Holtermann roberto at goyle Yury V. Zaytsev Anna Katrina Dominguez @@ -352,8 +353,7 @@ Except when otherwise stated (look for LICENSE files or copyright/license information at the beginning of each file) the files in the 'lib-python/2.7' directory are all copyrighted by the Python Software Foundation and licensed -under the Python Software License of which you can find a copy here: -http://www.python.org/doc/Copyright.html +under the terms that you can find here: https://docs.python.org/2/license.html License for 'pypy/module/unicodedata/' ====================================== @@ -435,4 +435,4 @@ The code is based on gperftools. You may see a copy of the License for it at - https://code.google.com/p/gperftools/source/browse/COPYING + https://github.com/gperftools/gperftools/blob/master/COPYING diff --git a/TODO b/TODO --- a/TODO +++ b/TODO @@ -1,3 +1,63 @@ +------------------------------------------------------------ + +annotating and rtyping pixie: + +== with 1 thread: +- pypy26: +[Timer] annotate --- 27.6 s +[Timer] rtype_lltype --- 33.5 s +[Timer] ========================================= +[Timer] Total: --- 61.1 s + +- pypystm, with dict/set: +[Timer] annotate --- 41.3 s +[Timer] rtype_lltype --- 49.1 s +[Timer] ========================================= +[Timer] Total: --- 90.4 s + +- pypystm, with stmdict/stmset: +[Timer] annotate --- 41.8 s +[Timer] rtype_lltype --- 49.5 s +[Timer] ========================================= +[Timer] Total: --- 91.3 s + +== with 4 threads: +- pypy26: +[Timer] annotate --- 28.2 s +[Timer] rtype_lltype --- 36.3 s +[Timer] ========================================= +[Timer] Total: --- 64.4 s + +- pypystm, with dict/set: +[Timer] annotate --- 42.1 s +[Timer] rtype_lltype --- 65.8 s +[Timer] ========================================== +[Timer] Total: --- 107.9 s + +- pypystm, with stmdict/stmset: +[Timer] annotate --- 41.5 s +[Timer] rtype_lltype --- 62.5 s +[Timer] ========================================== +[Timer] Total: --- 103.9 s + +TODOs: +- stmdict/set with strategies: ~1% perf... +- 87% overhead when using 4 threads on STM vs. 1 thread pypy26 + or 26% overhead of STM 4 threads vs. STM 1 thread +--> make rtyping less conflicting? + +------------------------------------------------------------ + +see rpython.translator.backendopt.finalizer.py for an XXX +about light finalizers + +------------------------------------------------------------ + +the loop in + rstm.update_marker_num(intmask(next_instr) * 2 + 1) +can take up to 10% of dispatch_bytecode for non-JIT. +(in pyopcode.py) + ------------------------------------------------------------ fuse the two 32bit setfield_gc for stmflags & tid in the jit diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -308,7 +308,10 @@ if (len(data) != 8 or data[:4] != imp.get_magic() or struct.unpack("<@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]" +_LegalKeyChars = r"\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=" +_LegalValueChars = _LegalKeyChars + r"\[\]" _CookiePattern = re.compile( r"(?x)" # This is a Verbose pattern r"\s*" # Optional whitespace at start of cookie r"(?P" # Start of group 'key' - ""+ _LegalCharsPatt +"+?" # Any word of at least one letter, nongreedy + "["+ _LegalKeyChars +"]+?" # Any word of at least one letter, nongreedy r")" # End of group 'key' r"(" # Optional group: there may not be a value. r"\s*=\s*" # Equal Sign @@ -542,7 +543,7 @@ r"|" # or r"\w{3},\s[\s\w\d-]{9,11}\s[\d:]{8}\sGMT" # Special case for "expires" attr r"|" # or - ""+ _LegalCharsPatt +"*" # Any word or empty string + "["+ _LegalValueChars +"]*" # Any word or empty string r")" # End of group 'val' r")?" # End of optional value group r"\s*" # Any number of spaces. diff --git a/lib-python/2.7/SimpleHTTPServer.py b/lib-python/2.7/SimpleHTTPServer.py --- a/lib-python/2.7/SimpleHTTPServer.py +++ b/lib-python/2.7/SimpleHTTPServer.py @@ -14,6 +14,7 @@ import posixpath import BaseHTTPServer import urllib +import urlparse import cgi import sys import shutil @@ -68,10 +69,14 @@ path = self.translate_path(self.path) f = None if os.path.isdir(path): - if not self.path.endswith('/'): + parts = urlparse.urlsplit(self.path) + if not parts.path.endswith('/'): # redirect browser - doing basically what apache does self.send_response(301) - self.send_header("Location", self.path + "/") + new_parts = (parts[0], parts[1], parts[2] + '/', + parts[3], parts[4]) + new_url = urlparse.urlunsplit(new_parts) + self.send_header("Location", new_url) self.end_headers() return None for index in "index.html", "index.htm": diff --git a/lib-python/2.7/_LWPCookieJar.py b/lib-python/2.7/_LWPCookieJar.py --- a/lib-python/2.7/_LWPCookieJar.py +++ b/lib-python/2.7/_LWPCookieJar.py @@ -18,7 +18,7 @@ iso2time, time2isoz) def lwp_cookie_str(cookie): - """Return string representation of Cookie in an the LWP cookie file format. + """Return string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. diff --git a/lib-python/2.7/_abcoll.py b/lib-python/2.7/_abcoll.py --- a/lib-python/2.7/_abcoll.py +++ b/lib-python/2.7/_abcoll.py @@ -548,23 +548,25 @@ If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v ''' - if len(args) > 2: - raise TypeError("update() takes at most 2 positional " - "arguments ({} given)".format(len(args))) - elif not args: - raise TypeError("update() takes at least 1 argument (0 given)") + if not args: + raise TypeError("descriptor 'update' of 'MutableMapping' object " + "needs an argument") self = args[0] - other = args[1] if len(args) >= 2 else () - - if isinstance(other, Mapping): - for key in other: - self[key] = other[key] - elif hasattr(other, "keys"): - for key in other.keys(): - self[key] = other[key] - else: - for key, value in other: - self[key] = value + args = args[1:] + if len(args) > 1: + raise TypeError('update expected at most 1 arguments, got %d' % + len(args)) + if args: + other = args[0] + if isinstance(other, Mapping): + for key in other: + self[key] = other[key] + elif hasattr(other, "keys"): + for key in other.keys(): + self[key] = other[key] + else: + for key, value in other: + self[key] = value for key, value in kwds.items(): self[key] = value diff --git a/lib-python/2.7/_pyio.py b/lib-python/2.7/_pyio.py --- a/lib-python/2.7/_pyio.py +++ b/lib-python/2.7/_pyio.py @@ -25,8 +25,8 @@ DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes # NOTE: Base classes defined here are registered with the "official" ABCs -# defined in io.py. We don't use real inheritance though, because we don't -# want to inherit the C implementations. +# defined in io.py. We don't use real inheritance though, because we don't want +# to inherit the C implementations. class BlockingIOError(IOError): @@ -775,7 +775,7 @@ clsname = self.__class__.__name__ try: name = self.name - except AttributeError: + except Exception: return "<_pyio.{0}>".format(clsname) else: return "<_pyio.{0} name={1!r}>".format(clsname, name) @@ -1216,8 +1216,10 @@ return self.writer.flush() def close(self): - self.writer.close() - self.reader.close() + try: + self.writer.close() + finally: + self.reader.close() def isatty(self): return self.reader.isatty() or self.writer.isatty() @@ -1538,7 +1540,7 @@ def __repr__(self): try: name = self.name - except AttributeError: + except Exception: return "<_pyio.TextIOWrapper encoding='{0}'>".format(self.encoding) else: return "<_pyio.TextIOWrapper name={0!r} encoding='{1}'>".format( diff --git a/lib-python/2.7/_strptime.py b/lib-python/2.7/_strptime.py --- a/lib-python/2.7/_strptime.py +++ b/lib-python/2.7/_strptime.py @@ -335,9 +335,9 @@ # though week_of_year = -1 week_of_year_start = -1 - # weekday and julian defaulted to -1 so as to signal need to calculate + # weekday and julian defaulted to None so as to signal need to calculate # values - weekday = julian = -1 + weekday = julian = None found_dict = found.groupdict() for group_key in found_dict.iterkeys(): # Directives not explicitly handled below: @@ -434,14 +434,14 @@ year = 1900 # If we know the week of the year and what day of that week, we can figure # out the Julian day of the year. - if julian == -1 and week_of_year != -1 and weekday != -1: + if julian is None and week_of_year != -1 and weekday is not None: week_starts_Mon = True if week_of_year_start == 0 else False julian = _calc_julian_from_U_or_W(year, week_of_year, weekday, week_starts_Mon) # Cannot pre-calculate datetime_date() since can change in Julian # calculation and thus could have different value for the day of the week # calculation. - if julian == -1: + if julian is None: # Need to add 1 to result since first day of the year is 1, not 0. julian = datetime_date(year, month, day).toordinal() - \ datetime_date(year, 1, 1).toordinal() + 1 @@ -451,7 +451,7 @@ year = datetime_result.year month = datetime_result.month day = datetime_result.day - if weekday == -1: + if weekday is None: weekday = datetime_date(year, month, day).weekday() if leap_year_fix: # the caller didn't supply a year but asked for Feb 29th. We couldn't diff --git a/lib-python/2.7/aifc.py b/lib-python/2.7/aifc.py --- a/lib-python/2.7/aifc.py +++ b/lib-python/2.7/aifc.py @@ -357,10 +357,13 @@ self._soundpos = 0 def close(self): - if self._decomp: - self._decomp.CloseDecompressor() - self._decomp = None - self._file.close() + decomp = self._decomp + try: + if decomp: + self._decomp = None + decomp.CloseDecompressor() + finally: + self._file.close() def tell(self): return self._soundpos diff --git a/lib-python/2.7/binhex.py b/lib-python/2.7/binhex.py --- a/lib-python/2.7/binhex.py +++ b/lib-python/2.7/binhex.py @@ -32,7 +32,8 @@ pass # States (what have we written) -[_DID_HEADER, _DID_DATA, _DID_RSRC] = range(3) +_DID_HEADER = 0 +_DID_DATA = 1 # Various constants REASONABLY_LARGE=32768 # Minimal amount we pass the rle-coder @@ -235,17 +236,22 @@ self._write(data) def close(self): - if self.state < _DID_DATA: - self.close_data() - if self.state != _DID_DATA: - raise Error, 'Close at the wrong time' - if self.rlen != 0: - raise Error, \ - "Incorrect resource-datasize, diff=%r" % (self.rlen,) - self._writecrc() - self.ofp.close() - self.state = None - del self.ofp + if self.state is None: + return + try: + if self.state < _DID_DATA: + self.close_data() + if self.state != _DID_DATA: + raise Error, 'Close at the wrong time' + if self.rlen != 0: + raise Error, \ + "Incorrect resource-datasize, diff=%r" % (self.rlen,) + self._writecrc() + finally: + self.state = None + ofp = self.ofp + del self.ofp + ofp.close() def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" @@ -463,11 +469,15 @@ return self._read(n) def close(self): - if self.rlen: - dummy = self.read_rsrc(self.rlen) - self._checkcrc() - self.state = _DID_RSRC - self.ifp.close() + if self.state is None: + return + try: + if self.rlen: + dummy = self.read_rsrc(self.rlen) + self._checkcrc() + finally: + self.state = None + self.ifp.close() def hexbin(inp, out): """(infilename, outfilename) - Decode binhexed file""" diff --git a/lib-python/2.7/bsddb/test/test_all.py b/lib-python/2.7/bsddb/test/test_all.py --- a/lib-python/2.7/bsddb/test/test_all.py +++ b/lib-python/2.7/bsddb/test/test_all.py @@ -412,9 +412,6 @@ def get_dbp(self) : return self._db - import string - string.letters=[chr(i) for i in xrange(65,91)] - bsddb._db.DBEnv_orig = bsddb._db.DBEnv bsddb._db.DB_orig = bsddb._db.DB if bsddb.db.version() <= (4, 3) : diff --git a/lib-python/2.7/bsddb/test/test_basics.py b/lib-python/2.7/bsddb/test/test_basics.py --- a/lib-python/2.7/bsddb/test/test_basics.py +++ b/lib-python/2.7/bsddb/test/test_basics.py @@ -999,7 +999,7 @@ for x in "The quick brown fox jumped over the lazy dog".split(): d2.put(x, self.makeData(x)) - for x in string.letters: + for x in string.ascii_letters: d3.put(x, x*70) d1.sync() @@ -1047,7 +1047,7 @@ if verbose: print rec rec = c3.next() - self.assertEqual(count, len(string.letters)) + self.assertEqual(count, len(string.ascii_letters)) c1.close() diff --git a/lib-python/2.7/bsddb/test/test_dbshelve.py b/lib-python/2.7/bsddb/test/test_dbshelve.py --- a/lib-python/2.7/bsddb/test/test_dbshelve.py +++ b/lib-python/2.7/bsddb/test/test_dbshelve.py @@ -59,7 +59,7 @@ return bytes(key, "iso8859-1") # 8 bits def populateDB(self, d): - for x in string.letters: + for x in string.ascii_letters: d[self.mk('S' + x)] = 10 * x # add a string d[self.mk('I' + x)] = ord(x) # add an integer d[self.mk('L' + x)] = [x] * 10 # add a list diff --git a/lib-python/2.7/bsddb/test/test_get_none.py b/lib-python/2.7/bsddb/test/test_get_none.py --- a/lib-python/2.7/bsddb/test/test_get_none.py +++ b/lib-python/2.7/bsddb/test/test_get_none.py @@ -26,14 +26,14 @@ d.open(self.filename, db.DB_BTREE, db.DB_CREATE) d.set_get_returns_none(1) - for x in string.letters: + for x in string.ascii_letters: d.put(x, x * 40) data = d.get('bad key') self.assertEqual(data, None) - data = d.get(string.letters[0]) - self.assertEqual(data, string.letters[0]*40) + data = d.get(string.ascii_letters[0]) + self.assertEqual(data, string.ascii_letters[0]*40) count = 0 c = d.cursor() @@ -43,7 +43,7 @@ rec = c.next() self.assertEqual(rec, None) - self.assertEqual(count, len(string.letters)) + self.assertEqual(count, len(string.ascii_letters)) c.close() d.close() @@ -54,14 +54,14 @@ d.open(self.filename, db.DB_BTREE, db.DB_CREATE) d.set_get_returns_none(0) - for x in string.letters: + for x in string.ascii_letters: d.put(x, x * 40) self.assertRaises(db.DBNotFoundError, d.get, 'bad key') self.assertRaises(KeyError, d.get, 'bad key') - data = d.get(string.letters[0]) - self.assertEqual(data, string.letters[0]*40) + data = d.get(string.ascii_letters[0]) + self.assertEqual(data, string.ascii_letters[0]*40) count = 0 exceptionHappened = 0 @@ -77,7 +77,7 @@ self.assertNotEqual(rec, None) self.assertTrue(exceptionHappened) - self.assertEqual(count, len(string.letters)) + self.assertEqual(count, len(string.ascii_letters)) c.close() d.close() diff --git a/lib-python/2.7/bsddb/test/test_queue.py b/lib-python/2.7/bsddb/test/test_queue.py --- a/lib-python/2.7/bsddb/test/test_queue.py +++ b/lib-python/2.7/bsddb/test/test_queue.py @@ -10,7 +10,6 @@ #---------------------------------------------------------------------- - at unittest.skip("fails on Windows; see issue 22943") class SimpleQueueTestCase(unittest.TestCase): def setUp(self): self.filename = get_new_database_path() @@ -37,17 +36,17 @@ print "before appends" + '-' * 30 pprint(d.stat()) - for x in string.letters: + for x in string.ascii_letters: d.append(x * 40) - self.assertEqual(len(d), len(string.letters)) + self.assertEqual(len(d), len(string.ascii_letters)) d.put(100, "some more data") d.put(101, "and some more ") d.put(75, "out of order") d.put(1, "replacement data") - self.assertEqual(len(d), len(string.letters)+3) + self.assertEqual(len(d), len(string.ascii_letters)+3) if verbose: print "before close" + '-' * 30 @@ -108,17 +107,17 @@ print "before appends" + '-' * 30 pprint(d.stat()) - for x in string.letters: + for x in string.ascii_letters: d.append(x * 40) - self.assertEqual(len(d), len(string.letters)) + self.assertEqual(len(d), len(string.ascii_letters)) d.put(100, "some more data") d.put(101, "and some more ") d.put(75, "out of order") d.put(1, "replacement data") - self.assertEqual(len(d), len(string.letters)+3) + self.assertEqual(len(d), len(string.ascii_letters)+3) if verbose: print "before close" + '-' * 30 diff --git a/lib-python/2.7/bsddb/test/test_recno.py b/lib-python/2.7/bsddb/test/test_recno.py --- a/lib-python/2.7/bsddb/test/test_recno.py +++ b/lib-python/2.7/bsddb/test/test_recno.py @@ -4,12 +4,11 @@ import os, sys import errno from pprint import pprint +import string import unittest from test_all import db, test_support, verbose, get_new_environment_path, get_new_database_path -letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' - #---------------------------------------------------------------------- @@ -39,7 +38,7 @@ d.open(self.filename, db.DB_RECNO, db.DB_CREATE) - for x in letters: + for x in string.ascii_letters: recno = d.append(x * 60) self.assertIsInstance(recno, int) self.assertGreaterEqual(recno, 1) @@ -270,7 +269,7 @@ d.set_re_pad(45) # ...test both int and char d.open(self.filename, db.DB_RECNO, db.DB_CREATE) - for x in letters: + for x in string.ascii_letters: d.append(x * 35) # These will be padded d.append('.' * 40) # this one will be exact diff --git a/lib-python/2.7/chunk.py b/lib-python/2.7/chunk.py --- a/lib-python/2.7/chunk.py +++ b/lib-python/2.7/chunk.py @@ -85,8 +85,10 @@ def close(self): if not self.closed: - self.skip() - self.closed = True + try: + self.skip() + finally: + self.closed = True def isatty(self): if self.closed: diff --git a/lib-python/2.7/codecs.py b/lib-python/2.7/codecs.py --- a/lib-python/2.7/codecs.py +++ b/lib-python/2.7/codecs.py @@ -20,8 +20,14 @@ "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", + "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder", + "StreamReader", "StreamWriter", + "StreamReaderWriter", "StreamRecoder", + "getencoder", "getdecoder", "getincrementalencoder", + "getincrementaldecoder", "getreader", "getwriter", + "encode", "decode", "iterencode", "iterdecode", "strict_errors", "ignore_errors", "replace_errors", - "xmlcharrefreplace_errors", + "xmlcharrefreplace_errors", "backslashreplace_errors", "register_error", "lookup_error"] ### Constants @@ -1051,7 +1057,7 @@ during translation. One example where this happens is cp875.py which decodes - multiple character to \u001a. + multiple character to \\u001a. """ m = {} diff --git a/lib-python/2.7/collections.py b/lib-python/2.7/collections.py --- a/lib-python/2.7/collections.py +++ b/lib-python/2.7/collections.py @@ -330,7 +330,7 @@ # http://code.activestate.com/recipes/259174/ # Knuth, TAOCP Vol. II section 4.6.3 - def __init__(self, iterable=None, **kwds): + def __init__(*args, **kwds): '''Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts. @@ -341,8 +341,15 @@ >>> c = Counter(a=4, b=2) # a new counter from keyword args ''' + if not args: + raise TypeError("descriptor '__init__' of 'Counter' object " + "needs an argument") + self = args[0] + args = args[1:] + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) super(Counter, self).__init__() - self.update(iterable, **kwds) + self.update(*args, **kwds) def __missing__(self, key): 'The count of elements not in the Counter is zero.' @@ -393,7 +400,7 @@ raise NotImplementedError( 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') - def update(self, iterable=None, **kwds): + def update(*args, **kwds): '''Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. @@ -413,6 +420,14 @@ # contexts. Instead, we implement straight-addition. Both the inputs # and outputs are allowed to contain zero and negative counts. + if not args: + raise TypeError("descriptor 'update' of 'Counter' object " + "needs an argument") + self = args[0] + args = args[1:] + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + iterable = args[0] if args else None if iterable is not None: if isinstance(iterable, Mapping): if self: @@ -428,7 +443,7 @@ if kwds: self.update(kwds) - def subtract(self, iterable=None, **kwds): + def subtract(*args, **kwds): '''Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts. @@ -444,6 +459,14 @@ -1 ''' + if not args: + raise TypeError("descriptor 'subtract' of 'Counter' object " + "needs an argument") + self = args[0] + args = args[1:] + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + iterable = args[0] if args else None if iterable is not None: self_get = self.get if isinstance(iterable, Mapping): diff --git a/lib-python/2.7/cookielib.py b/lib-python/2.7/cookielib.py --- a/lib-python/2.7/cookielib.py +++ b/lib-python/2.7/cookielib.py @@ -464,26 +464,42 @@ for ns_header in ns_headers: pairs = [] version_set = False - for ii, param in enumerate(re.split(r";\s*", ns_header)): - param = param.rstrip() - if param == "": continue - if "=" not in param: - k, v = param, None - else: - k, v = re.split(r"\s*=\s*", param, 1) - k = k.lstrip() + + # XXX: The following does not strictly adhere to RFCs in that empty + # names and values are legal (the former will only appear once and will + # be overwritten if multiple occurrences are present). This is + # mostly to deal with backwards compatibility. + for ii, param in enumerate(ns_header.split(';')): + param = param.strip() + + key, sep, val = param.partition('=') + key = key.strip() + + if not key: + if ii == 0: + break + else: + continue + + # allow for a distinction between present and empty and missing + # altogether + val = val.strip() if sep else None + if ii != 0: - lc = k.lower() + lc = key.lower() if lc in known_attrs: - k = lc - if k == "version": + key = lc + + if key == "version": # This is an RFC 2109 cookie. - v = _strip_quotes(v) + if val is not None: + val = _strip_quotes(val) version_set = True - if k == "expires": + elif key == "expires": # convert expires date to seconds since epoch - v = http2time(_strip_quotes(v)) # None if invalid - pairs.append((k, v)) + if val is not None: + val = http2time(_strip_quotes(val)) # None if invalid + pairs.append((key, val)) if pairs: if not version_set: diff --git a/lib-python/2.7/ctypes/macholib/fetch_macholib.bat b/lib-python/2.7/ctypes/macholib/fetch_macholib.bat --- a/lib-python/2.7/ctypes/macholib/fetch_macholib.bat +++ b/lib-python/2.7/ctypes/macholib/fetch_macholib.bat @@ -1,1 +1,1 @@ -svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ . +svn export --force http://svn.red-bean.com/bob/macholib/trunk/macholib/ . diff --git a/lib-python/2.7/ctypes/test/test_find.py b/lib-python/2.7/ctypes/test/test_find.py --- a/lib-python/2.7/ctypes/test/test_find.py +++ b/lib-python/2.7/ctypes/test/test_find.py @@ -32,15 +32,24 @@ def setUp(self): self.gl = self.glu = self.gle = None if lib_gl: - self.gl = CDLL(lib_gl, mode=RTLD_GLOBAL) + try: + self.gl = CDLL(lib_gl, mode=RTLD_GLOBAL) + except OSError: + pass if lib_glu: - self.glu = CDLL(lib_glu, RTLD_GLOBAL) + try: + self.glu = CDLL(lib_glu, RTLD_GLOBAL) + except OSError: + pass if lib_gle: try: self.gle = CDLL(lib_gle) except OSError: pass + def tearDown(self): + self.gl = self.glu = self.gle = None + @unittest.skipUnless(lib_gl, 'lib_gl not available') def test_gl(self): if self.gl: diff --git a/lib-python/2.7/ctypes/test/test_pickling.py b/lib-python/2.7/ctypes/test/test_pickling.py --- a/lib-python/2.7/ctypes/test/test_pickling.py +++ b/lib-python/2.7/ctypes/test/test_pickling.py @@ -15,9 +15,9 @@ class Y(X): _fields_ = [("str", c_char_p)] -class PickleTest(unittest.TestCase): +class PickleTest: def dumps(self, item): - return pickle.dumps(item) + return pickle.dumps(item, self.proto) def loads(self, item): return pickle.loads(item) @@ -72,17 +72,15 @@ @xfail def test_wchar(self): - pickle.dumps(c_char("x")) + self.dumps(c_char(b"x")) # Issue 5049 - pickle.dumps(c_wchar(u"x")) + self.dumps(c_wchar(u"x")) -class PickleTest_1(PickleTest): - def dumps(self, item): - return pickle.dumps(item, 1) - -class PickleTest_2(PickleTest): - def dumps(self, item): - return pickle.dumps(item, 2) +for proto in range(pickle.HIGHEST_PROTOCOL + 1): + name = 'PickleTest_%s' % proto + globals()[name] = type(name, + (PickleTest, unittest.TestCase), + {'proto': proto}) if __name__ == "__main__": unittest.main() diff --git a/lib-python/2.7/ctypes/test/test_pointers.py b/lib-python/2.7/ctypes/test/test_pointers.py --- a/lib-python/2.7/ctypes/test/test_pointers.py +++ b/lib-python/2.7/ctypes/test/test_pointers.py @@ -7,8 +7,6 @@ c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float] python_types = [int, int, int, int, int, long, int, long, long, long, float, float] -LargeNamedType = type('T' * 2 ** 25, (Structure,), {}) -large_string = 'T' * 2 ** 25 class PointersTestCase(unittest.TestCase): @@ -191,9 +189,11 @@ self.assertEqual(bool(mth), True) def test_pointer_type_name(self): + LargeNamedType = type('T' * 2 ** 25, (Structure,), {}) self.assertTrue(POINTER(LargeNamedType)) def test_pointer_type_str_name(self): + large_string = 'T' * 2 ** 25 self.assertTrue(POINTER(large_string)) if __name__ == '__main__': diff --git a/lib-python/2.7/ctypes/util.py b/lib-python/2.7/ctypes/util.py --- a/lib-python/2.7/ctypes/util.py +++ b/lib-python/2.7/ctypes/util.py @@ -178,7 +178,7 @@ res = re.findall(expr, data) if not res: return _get_soname(_findLib_gcc(name)) - res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y))) + res.sort(key=_num_version) return res[-1] elif sys.platform == "sunos5": diff --git a/lib-python/2.7/distutils/__init__.py b/lib-python/2.7/distutils/__init__.py --- a/lib-python/2.7/distutils/__init__.py +++ b/lib-python/2.7/distutils/__init__.py @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "2.7.9" +__version__ = "2.7.10" #--end constants-- diff --git a/lib-python/2.7/distutils/command/check.py b/lib-python/2.7/distutils/command/check.py --- a/lib-python/2.7/distutils/command/check.py +++ b/lib-python/2.7/distutils/command/check.py @@ -126,7 +126,7 @@ """Returns warnings when the provided data doesn't compile.""" source_path = StringIO() parser = Parser() - settings = frontend.OptionParser().get_default_values() + settings = frontend.OptionParser(components=(Parser,)).get_default_values() settings.tab_width = 4 settings.pep_references = None settings.rfc_references = None @@ -142,8 +142,8 @@ document.note_source(source_path, -1) try: parser.parse(data, document) - except AttributeError: - reporter.messages.append((-1, 'Could not finish the parsing.', - '', {})) + except AttributeError as e: + reporter.messages.append( + (-1, 'Could not finish the parsing: %s.' % e, '', {})) return reporter.messages diff --git a/lib-python/2.7/distutils/dir_util.py b/lib-python/2.7/distutils/dir_util.py --- a/lib-python/2.7/distutils/dir_util.py +++ b/lib-python/2.7/distutils/dir_util.py @@ -83,7 +83,7 @@ """Create all the empty directories under 'base_dir' needed to put 'files' there. - 'base_dir' is just the a name of a directory which doesn't necessarily + 'base_dir' is just the name of a directory which doesn't necessarily exist yet; 'files' is a list of filenames to be interpreted relative to 'base_dir'. 'base_dir' + the directory portion of every file in 'files' will be created if it doesn't already exist. 'mode', 'verbose' and diff --git a/lib-python/2.7/distutils/tests/test_check.py b/lib-python/2.7/distutils/tests/test_check.py --- a/lib-python/2.7/distutils/tests/test_check.py +++ b/lib-python/2.7/distutils/tests/test_check.py @@ -1,5 +1,6 @@ # -*- encoding: utf8 -*- """Tests for distutils.command.check.""" +import textwrap import unittest from test.test_support import run_unittest @@ -93,6 +94,36 @@ cmd = self._run(metadata, strict=1, restructuredtext=1) self.assertEqual(cmd._warnings, 0) + @unittest.skipUnless(HAS_DOCUTILS, "won't test without docutils") + def test_check_restructuredtext_with_syntax_highlight(self): + # Don't fail if there is a `code` or `code-block` directive + + example_rst_docs = [] + example_rst_docs.append(textwrap.dedent("""\ + Here's some code: + + .. code:: python + + def foo(): + pass + """)) + example_rst_docs.append(textwrap.dedent("""\ + Here's some code: + + .. code-block:: python + + def foo(): + pass + """)) + + for rest_with_code in example_rst_docs: + pkg_info, dist = self.create_dist(long_description=rest_with_code) + cmd = check(dist) + cmd.check_restructuredtext() + self.assertEqual(cmd._warnings, 0) + msgs = cmd._check_rst_data(rest_with_code) + self.assertEqual(len(msgs), 0) + def test_check_all(self): metadata = {'url': 'xxx', 'author': 'xxx'} diff --git a/lib-python/2.7/distutils/text_file.py b/lib-python/2.7/distutils/text_file.py --- a/lib-python/2.7/distutils/text_file.py +++ b/lib-python/2.7/distutils/text_file.py @@ -124,11 +124,11 @@ def close (self): """Close the current file and forget everything we know about it (filename, current line number).""" - - self.file.close () + file = self.file self.file = None self.filename = None self.current_line = None + file.close() def gen_error (self, msg, line=None): diff --git a/lib-python/2.7/dumbdbm.py b/lib-python/2.7/dumbdbm.py --- a/lib-python/2.7/dumbdbm.py +++ b/lib-python/2.7/dumbdbm.py @@ -21,6 +21,7 @@ """ +import ast as _ast import os as _os import __builtin__ import UserDict @@ -85,7 +86,7 @@ with f: for line in f: line = line.rstrip() - key, pos_and_siz_pair = eval(line) + key, pos_and_siz_pair = _ast.literal_eval(line) self._index[key] = pos_and_siz_pair # Write the index dict to the directory file. The original directory @@ -208,8 +209,10 @@ return len(self._index) def close(self): - self._commit() - self._index = self._datfile = self._dirfile = self._bakfile = None + try: + self._commit() + finally: + self._index = self._datfile = self._dirfile = self._bakfile = None __del__ = close diff --git a/lib-python/2.7/encodings/uu_codec.py b/lib-python/2.7/encodings/uu_codec.py --- a/lib-python/2.7/encodings/uu_codec.py +++ b/lib-python/2.7/encodings/uu_codec.py @@ -84,7 +84,7 @@ data = a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh - nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 + nbytes = (((ord(s[0])-32) & 63) * 4 + 5) // 3 data = a2b_uu(s[:nbytes]) #sys.stderr.write("Warning: %s\n" % str(v)) write(data) diff --git a/lib-python/2.7/ensurepip/__init__.py b/lib-python/2.7/ensurepip/__init__.py --- a/lib-python/2.7/ensurepip/__init__.py +++ b/lib-python/2.7/ensurepip/__init__.py @@ -12,9 +12,9 @@ __all__ = ["version", "bootstrap"] -_SETUPTOOLS_VERSION = "7.0" +_SETUPTOOLS_VERSION = "15.2" -_PIP_VERSION = "1.5.6" +_PIP_VERSION = "6.1.1" # pip currently requires ssl support, so we try to provide a nicer # error message when that is missing (http://bugs.python.org/issue19744) diff --git a/lib-python/2.7/ensurepip/_bundled/pip-1.5.6-py2.py3-none-any.whl b/lib-python/2.7/ensurepip/_bundled/pip-1.5.6-py2.py3-none-any.whl deleted file mode 100644 Binary file lib-python/2.7/ensurepip/_bundled/pip-1.5.6-py2.py3-none-any.whl has changed diff --git a/lib-python/2.7/ensurepip/_bundled/pip-6.1.1-py2.py3-none-any.whl b/lib-python/2.7/ensurepip/_bundled/pip-6.1.1-py2.py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..e59694a019051d58b9a378a1adfc9461b8cec9c3 GIT binary patch [cut] diff --git a/lib-python/2.7/ensurepip/_bundled/setuptools-15.2-py2.py3-none-any.whl b/lib-python/2.7/ensurepip/_bundled/setuptools-15.2-py2.py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..f153ed376684275e08fcfebdb2de8352fb074171 GIT binary patch [cut] diff --git a/lib-python/2.7/ensurepip/_bundled/setuptools-7.0-py2.py3-none-any.whl b/lib-python/2.7/ensurepip/_bundled/setuptools-7.0-py2.py3-none-any.whl deleted file mode 100644 Binary file lib-python/2.7/ensurepip/_bundled/setuptools-7.0-py2.py3-none-any.whl has changed diff --git a/lib-python/2.7/fileinput.py b/lib-python/2.7/fileinput.py --- a/lib-python/2.7/fileinput.py +++ b/lib-python/2.7/fileinput.py @@ -233,8 +233,10 @@ self.close() def close(self): - self.nextfile() - self._files = () + try: + self.nextfile() + finally: + self._files = () def __iter__(self): return self @@ -270,23 +272,25 @@ output = self._output self._output = 0 - if output: - output.close() + try: + if output: + output.close() + finally: + file = self._file + self._file = 0 + try: + if file and not self._isstdin: + file.close() + finally: + backupfilename = self._backupfilename + self._backupfilename = 0 + if backupfilename and not self._backup: + try: os.unlink(backupfilename) + except OSError: pass - file = self._file - self._file = 0 - if file and not self._isstdin: - file.close() - - backupfilename = self._backupfilename - self._backupfilename = 0 - if backupfilename and not self._backup: - try: os.unlink(backupfilename) - except OSError: pass - - self._isstdin = False - self._buffer = [] - self._bufindex = 0 + self._isstdin = False + self._buffer = [] + self._bufindex = 0 def readline(self): try: diff --git a/lib-python/2.7/fnmatch.py b/lib-python/2.7/fnmatch.py --- a/lib-python/2.7/fnmatch.py +++ b/lib-python/2.7/fnmatch.py @@ -47,12 +47,14 @@ import os,posixpath result=[] pat=os.path.normcase(pat) - if not pat in _cache: + try: + re_pat = _cache[pat] + except KeyError: res = translate(pat) if len(_cache) >= _MAXCACHE: _cache.clear() - _cache[pat] = re.compile(res) - match=_cache[pat].match + _cache[pat] = re_pat = re.compile(res) + match = re_pat.match if os.path is posixpath: # normcase on posix is NOP. Optimize it away from the loop. for name in names: @@ -71,12 +73,14 @@ its arguments. """ - if not pat in _cache: + try: + re_pat = _cache[pat] + except KeyError: res = translate(pat) if len(_cache) >= _MAXCACHE: _cache.clear() - _cache[pat] = re.compile(res) - return _cache[pat].match(name) is not None + _cache[pat] = re_pat = re.compile(res) + return re_pat.match(name) is not None def translate(pat): """Translate a shell PATTERN to a regular expression. diff --git a/lib-python/2.7/ftplib.py b/lib-python/2.7/ftplib.py --- a/lib-python/2.7/ftplib.py +++ b/lib-python/2.7/ftplib.py @@ -594,11 +594,16 @@ def close(self): '''Close the connection without assuming anything about it.''' - if self.file is not None: - self.file.close() - if self.sock is not None: - self.sock.close() - self.file = self.sock = None + try: + file = self.file + self.file = None + if file is not None: + file.close() + finally: + sock = self.sock + self.sock = None + if sock is not None: + sock.close() try: import ssl @@ -638,12 +643,24 @@ '221 Goodbye.' >>> ''' - ssl_version = ssl.PROTOCOL_TLSv1 + ssl_version = ssl.PROTOCOL_SSLv23 def __init__(self, host='', user='', passwd='', acct='', keyfile=None, - certfile=None, timeout=_GLOBAL_DEFAULT_TIMEOUT): + certfile=None, context=None, + timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): + if context is not None and keyfile is not None: + raise ValueError("context and keyfile arguments are mutually " + "exclusive") + if context is not None and certfile is not None: + raise ValueError("context and certfile arguments are mutually " + "exclusive") self.keyfile = keyfile self.certfile = certfile + if context is None: + context = ssl._create_stdlib_context(self.ssl_version, + certfile=certfile, + keyfile=keyfile) + self.context = context self._prot_p = False FTP.__init__(self, host, user, passwd, acct, timeout) @@ -656,12 +673,12 @@ '''Set up secure control connection by using TLS/SSL.''' if isinstance(self.sock, ssl.SSLSocket): raise ValueError("Already using TLS") - if self.ssl_version == ssl.PROTOCOL_TLSv1: + if self.ssl_version >= ssl.PROTOCOL_SSLv23: resp = self.voidcmd('AUTH TLS') else: resp = self.voidcmd('AUTH SSL') - self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, - ssl_version=self.ssl_version) + self.sock = self.context.wrap_socket(self.sock, + server_hostname=self.host) self.file = self.sock.makefile(mode='rb') return resp @@ -692,8 +709,8 @@ def ntransfercmd(self, cmd, rest=None): conn, size = FTP.ntransfercmd(self, cmd, rest) if self._prot_p: - conn = ssl.wrap_socket(conn, self.keyfile, self.certfile, - ssl_version=self.ssl_version) + conn = self.context.wrap_socket(conn, + server_hostname=self.host) return conn, size def retrbinary(self, cmd, callback, blocksize=8192, rest=None): diff --git a/lib-python/2.7/genericpath.py b/lib-python/2.7/genericpath.py --- a/lib-python/2.7/genericpath.py +++ b/lib-python/2.7/genericpath.py @@ -10,6 +10,14 @@ 'getsize', 'isdir', 'isfile'] +try: + _unicode = unicode +except NameError: + # If Python is built without Unicode support, the unicode type + # will not exist. Fake one. + class _unicode(object): + pass + # Does a path exist? # This is false for dangling symbolic links on systems that support them. def exists(path): diff --git a/lib-python/2.7/gettext.py b/lib-python/2.7/gettext.py --- a/lib-python/2.7/gettext.py +++ b/lib-python/2.7/gettext.py @@ -52,7 +52,9 @@ __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog', 'find', 'translation', 'install', 'textdomain', 'bindtextdomain', - 'dgettext', 'dngettext', 'gettext', 'ngettext', + 'bind_textdomain_codeset', + 'dgettext', 'dngettext', 'gettext', 'lgettext', 'ldgettext', + 'ldngettext', 'lngettext', 'ngettext', ] _default_localedir = os.path.join(sys.prefix, 'share', 'locale') @@ -294,11 +296,12 @@ # See if we're looking at GNU .mo conventions for metadata if mlen == 0: # Catalog description - lastk = k = None + lastk = None for item in tmsg.splitlines(): item = item.strip() if not item: continue + k = v = None if ':' in item: k, v = item.split(':', 1) k = k.strip().lower() diff --git a/lib-python/2.7/gzip.py b/lib-python/2.7/gzip.py --- a/lib-python/2.7/gzip.py +++ b/lib-python/2.7/gzip.py @@ -238,9 +238,9 @@ data = data.tobytes() if len(data) > 0: - self.size = self.size + len(data) + self.fileobj.write(self.compress.compress(data)) + self.size += len(data) self.crc = zlib.crc32(data, self.crc) & 0xffffffffL - self.fileobj.write( self.compress.compress(data) ) self.offset += len(data) return len(data) @@ -369,19 +369,21 @@ return self.fileobj is None def close(self): - if self.fileobj is None: + fileobj = self.fileobj + if fileobj is None: return - if self.mode == WRITE: - self.fileobj.write(self.compress.flush()) - write32u(self.fileobj, self.crc) - # self.size may exceed 2GB, or even 4GB - write32u(self.fileobj, self.size & 0xffffffffL) - self.fileobj = None - elif self.mode == READ: - self.fileobj = None - if self.myfileobj: - self.myfileobj.close() - self.myfileobj = None + self.fileobj = None + try: + if self.mode == WRITE: + fileobj.write(self.compress.flush()) + write32u(fileobj, self.crc) + # self.size may exceed 2GB, or even 4GB + write32u(fileobj, self.size & 0xffffffffL) + finally: + myfileobj = self.myfileobj + if myfileobj: + self.myfileobj = None + myfileobj.close() def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH): self._check_closed() diff --git a/lib-python/2.7/hashlib.py b/lib-python/2.7/hashlib.py --- a/lib-python/2.7/hashlib.py +++ b/lib-python/2.7/hashlib.py @@ -187,7 +187,7 @@ def prf(msg, inner=inner, outer=outer): # PBKDF2_HMAC uses the password as key. We can re-use the same - # digest objects and and just update copies to skip initialization. + # digest objects and just update copies to skip initialization. icpy = inner.copy() ocpy = outer.copy() icpy.update(msg) diff --git a/lib-python/2.7/htmlentitydefs.py b/lib-python/2.7/htmlentitydefs.py --- a/lib-python/2.7/htmlentitydefs.py +++ b/lib-python/2.7/htmlentitydefs.py @@ -1,6 +1,6 @@ """HTML character entity references.""" -# maps the HTML entity name to the Unicode codepoint +# maps the HTML entity name to the Unicode code point name2codepoint = { 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1 @@ -256,7 +256,7 @@ 'zwnj': 0x200c, # zero width non-joiner, U+200C NEW RFC 2070 } -# maps the Unicode codepoint to the HTML entity name +# maps the Unicode code point to the HTML entity name codepoint2name = {} # maps the HTML entity name to the character diff --git a/lib-python/2.7/httplib.py b/lib-python/2.7/httplib.py --- a/lib-python/2.7/httplib.py +++ b/lib-python/2.7/httplib.py @@ -68,6 +68,7 @@ from array import array import os +import re import socket from sys import py3kwarning from urlparse import urlsplit @@ -218,6 +219,38 @@ # maximum amount of headers accepted _MAXHEADERS = 100 +# Header name/value ABNF (http://tools.ietf.org/html/rfc7230#section-3.2) +# +# VCHAR = %x21-7E +# obs-text = %x80-FF +# header-field = field-name ":" OWS field-value OWS +# field-name = token +# field-value = *( field-content / obs-fold ) +# field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] +# field-vchar = VCHAR / obs-text +# +# obs-fold = CRLF 1*( SP / HTAB ) +# ; obsolete line folding +# ; see Section 3.2.4 + +# token = 1*tchar +# +# tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" +# / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" +# / DIGIT / ALPHA +# ; any VCHAR, except delimiters +# +# VCHAR defined in http://tools.ietf.org/html/rfc5234#appendix-B.1 + +# the patterns for both name and value are more leniant than RFC +# definitions to allow for backwards compatibility +_is_legal_header_name = re.compile(r'\A[^:\s][^:\r\n]*\Z').match +_is_illegal_header_value = re.compile(r'\n(?![ \t])|\r(?![ \t\n])').search + +# We always set the Content-Length header for these methods because some +# servers will otherwise respond with a 411 +_METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'} + class HTTPMessage(mimetools.Message): @@ -313,6 +346,11 @@ hlist.append(line) self.addheader(headerseen, line[len(headerseen)+1:].strip()) continue + elif headerseen is not None: + # An empty header name. These aren't allowed in HTTP, but it's + # probably a benign mistake. Don't add the header, just keep + # going. + continue else: # It's not a header line; throw it back and stop here. if not self.dict: @@ -522,9 +560,10 @@ return True def close(self): - if self.fp: - self.fp.close() + fp = self.fp + if fp: self.fp = None + fp.close() def isclosed(self): # NOTE: it is possible that we will not ever call self.close(). This @@ -723,7 +762,7 @@ endpoint passed to set_tunnel. This is done by sending a HTTP CONNECT request to the proxy server when the connection is established. - This method must be called before the HTML connection has been + This method must be called before the HTTP connection has been established. The headers argument should be a mapping of extra HTTP headers @@ -797,13 +836,17 @@ def close(self): """Close the connection to the HTTP server.""" - if self.sock: - self.sock.close() # close it manually... there may be other refs - self.sock = None - if self.__response: - self.__response.close() - self.__response = None self.__state = _CS_IDLE + try: + sock = self.sock + if sock: + self.sock = None + sock.close() # close it manually... there may be other refs + finally: + response = self.__response + if response: + self.__response = None + response.close() def send(self, data): """Send `data' to the server.""" @@ -978,7 +1021,16 @@ if self.__state != _CS_REQ_STARTED: raise CannotSendHeader() - hdr = '%s: %s' % (header, '\r\n\t'.join([str(v) for v in values])) + header = '%s' % header + if not _is_legal_header_name(header): + raise ValueError('Invalid header name %r' % (header,)) + + values = [str(v) for v in values] + for one_value in values: + if _is_illegal_header_value(one_value): + raise ValueError('Invalid header value %r' % (one_value,)) + + hdr = '%s: %s' % (header, '\r\n\t'.join(values)) self._output(hdr) def endheaders(self, message_body=None): @@ -1000,19 +1052,25 @@ """Send a complete request to the server.""" self._send_request(method, url, body, headers) - def _set_content_length(self, body): - # Set the content-length based on the body. + def _set_content_length(self, body, method): + # Set the content-length based on the body. If the body is "empty", we + # set Content-Length: 0 for methods that expect a body (RFC 7230, + # Section 3.3.2). If the body is set for other methods, we set the + # header provided we can figure out what the length is. thelen = None - try: - thelen = str(len(body)) - except TypeError, te: - # If this is a file-like object, try to - # fstat its file descriptor + if body is None and method.upper() in _METHODS_EXPECTING_BODY: + thelen = '0' + elif body is not None: try: - thelen = str(os.fstat(body.fileno()).st_size) - except (AttributeError, OSError): - # Don't send a length if this failed - if self.debuglevel > 0: print "Cannot stat!!" + thelen = str(len(body)) + except TypeError: + # If this is a file-like object, try to + # fstat its file descriptor + try: + thelen = str(os.fstat(body.fileno()).st_size) + except (AttributeError, OSError): + # Don't send a length if this failed + if self.debuglevel > 0: print "Cannot stat!!" if thelen is not None: self.putheader('Content-Length', thelen) @@ -1028,8 +1086,8 @@ self.putrequest(method, url, **skips) - if body is not None and 'content-length' not in header_names: - self._set_content_length(body) + if 'content-length' not in header_names: + self._set_content_length(body, method) for hdr, value in headers.iteritems(): self.putheader(hdr, value) self.endheaders(body) @@ -1072,20 +1130,20 @@ try: response.begin() + assert response.will_close != _UNKNOWN + self.__state = _CS_IDLE + + if response.will_close: + # this effectively passes the connection to the response + self.close() + else: + # remember this, so we can tell when it is complete + self.__response = response + + return response except: response.close() raise - assert response.will_close != _UNKNOWN - self.__state = _CS_IDLE - - if response.will_close: - # this effectively passes the connection to the response - self.close() - else: - # remember this, so we can tell when it is complete - self.__response = response - - return response class HTTP: @@ -1129,7 +1187,7 @@ "Accept arguments to set the host/port, since the superclass doesn't." if host is not None: - self._conn._set_hostport(host, port) + (self._conn.host, self._conn.port) = self._conn._get_hostport(host, port) self._conn.connect() def getfile(self): diff --git a/lib-python/2.7/idlelib/CodeContext.py b/lib-python/2.7/idlelib/CodeContext.py --- a/lib-python/2.7/idlelib/CodeContext.py +++ b/lib-python/2.7/idlelib/CodeContext.py @@ -15,8 +15,8 @@ from sys import maxint as INFINITY from idlelib.configHandler import idleConf -BLOCKOPENERS = set(["class", "def", "elif", "else", "except", "finally", "for", - "if", "try", "while", "with"]) +BLOCKOPENERS = {"class", "def", "elif", "else", "except", "finally", "for", + "if", "try", "while", "with"} UPDATEINTERVAL = 100 # millisec FONTUPDATEINTERVAL = 1000 # millisec diff --git a/lib-python/2.7/idlelib/EditorWindow.py b/lib-python/2.7/idlelib/EditorWindow.py --- a/lib-python/2.7/idlelib/EditorWindow.py +++ b/lib-python/2.7/idlelib/EditorWindow.py @@ -469,13 +469,10 @@ ("format", "F_ormat"), ("run", "_Run"), ("options", "_Options"), - ("windows", "_Windows"), + ("windows", "_Window"), ("help", "_Help"), ] - if sys.platform == "darwin": - menu_specs[-2] = ("windows", "_Window") - def createmenubar(self): mbar = self.menubar diff --git a/lib-python/2.7/idlelib/FormatParagraph.py b/lib-python/2.7/idlelib/FormatParagraph.py --- a/lib-python/2.7/idlelib/FormatParagraph.py +++ b/lib-python/2.7/idlelib/FormatParagraph.py @@ -44,9 +44,11 @@ The length limit parameter is for testing with a known value. """ - if limit == None: + if limit is None: + # The default length limit is that defined by pep8 limit = idleConf.GetOption( - 'main', 'FormatParagraph', 'paragraph', type='int') + 'extensions', 'FormatParagraph', 'max-width', + type='int', default=72) text = self.editwin.text first, last = self.editwin.get_selection_indices() if first and last: diff --git a/lib-python/2.7/idlelib/PyShell.py b/lib-python/2.7/idlelib/PyShell.py --- a/lib-python/2.7/idlelib/PyShell.py +++ b/lib-python/2.7/idlelib/PyShell.py @@ -871,13 +871,10 @@ ("edit", "_Edit"), ("debug", "_Debug"), ("options", "_Options"), - ("windows", "_Windows"), + ("windows", "_Window"), ("help", "_Help"), ] - if sys.platform == "darwin": - menu_specs[-2] = ("windows", "_Window") - # New classes from idlelib.IdleHistory import History @@ -1350,7 +1347,7 @@ if type(s) not in (unicode, str, bytearray): # See issue #19481 if isinstance(s, unicode): - s = unicode.__getslice__(s, None, None) + s = unicode.__getitem__(s, slice(None)) elif isinstance(s, str): s = str.__str__(s) elif isinstance(s, bytearray): diff --git a/lib-python/2.7/idlelib/SearchEngine.py b/lib-python/2.7/idlelib/SearchEngine.py --- a/lib-python/2.7/idlelib/SearchEngine.py +++ b/lib-python/2.7/idlelib/SearchEngine.py @@ -191,7 +191,7 @@ This is done by searching forwards until there is no match. Prog: compiled re object with a search method returning a match. - Chars: line of text, without \n. + Chars: line of text, without \\n. Col: stop index for the search; the limit for match.end(). ''' m = prog.search(chars) diff --git a/lib-python/2.7/idlelib/config-extensions.def b/lib-python/2.7/idlelib/config-extensions.def --- a/lib-python/2.7/idlelib/config-extensions.def +++ b/lib-python/2.7/idlelib/config-extensions.def @@ -66,6 +66,7 @@ [FormatParagraph] enable=True +max-width=72 [FormatParagraph_cfgBindings] format-paragraph= diff --git a/lib-python/2.7/idlelib/config-main.def b/lib-python/2.7/idlelib/config-main.def --- a/lib-python/2.7/idlelib/config-main.def +++ b/lib-python/2.7/idlelib/config-main.def @@ -58,9 +58,6 @@ font-bold= 0 encoding= none -[FormatParagraph] -paragraph=72 - [Indent] use-spaces= 1 num-spaces= 4 diff --git a/lib-python/2.7/idlelib/configDialog.py b/lib-python/2.7/idlelib/configDialog.py --- a/lib-python/2.7/idlelib/configDialog.py +++ b/lib-python/2.7/idlelib/configDialog.py @@ -371,7 +371,6 @@ parent = self.parent self.winWidth = StringVar(parent) self.winHeight = StringVar(parent) - self.paraWidth = StringVar(parent) self.startupEdit = IntVar(parent) self.autoSave = IntVar(parent) self.encoding = StringVar(parent) @@ -387,7 +386,6 @@ frameSave = LabelFrame(frame, borderwidth=2, relief=GROOVE, text=' Autosave Preferences ') frameWinSize = Frame(frame, borderwidth=2, relief=GROOVE) - frameParaSize = Frame(frame, borderwidth=2, relief=GROOVE) frameEncoding = Frame(frame, borderwidth=2, relief=GROOVE) frameHelp = LabelFrame(frame, borderwidth=2, relief=GROOVE, text=' Additional Help Sources ') @@ -416,11 +414,6 @@ labelWinHeightTitle = Label(frameWinSize, text='Height') entryWinHeight = Entry( frameWinSize, textvariable=self.winHeight, width=3) - #paragraphFormatWidth - labelParaWidthTitle = Label( - frameParaSize, text='Paragraph reformat width (in characters)') - entryParaWidth = Entry( - frameParaSize, textvariable=self.paraWidth, width=3) #frameEncoding labelEncodingTitle = Label( frameEncoding, text="Default Source Encoding") @@ -458,7 +451,6 @@ frameRun.pack(side=TOP, padx=5, pady=5, fill=X) frameSave.pack(side=TOP, padx=5, pady=5, fill=X) frameWinSize.pack(side=TOP, padx=5, pady=5, fill=X) - frameParaSize.pack(side=TOP, padx=5, pady=5, fill=X) frameEncoding.pack(side=TOP, padx=5, pady=5, fill=X) frameHelp.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH) #frameRun @@ -475,9 +467,6 @@ labelWinHeightTitle.pack(side=RIGHT, anchor=E, pady=5) entryWinWidth.pack(side=RIGHT, anchor=E, padx=10, pady=5) labelWinWidthTitle.pack(side=RIGHT, anchor=E, pady=5) - #paragraphFormatWidth - labelParaWidthTitle.pack(side=LEFT, anchor=W, padx=5, pady=5) - entryParaWidth.pack(side=RIGHT, anchor=E, padx=10, pady=5) #frameEncoding labelEncodingTitle.pack(side=LEFT, anchor=W, padx=5, pady=5) radioEncNone.pack(side=RIGHT, anchor=E, pady=5) @@ -509,7 +498,6 @@ self.keysAreBuiltin.trace_variable('w', self.VarChanged_keysAreBuiltin) self.winWidth.trace_variable('w', self.VarChanged_winWidth) self.winHeight.trace_variable('w', self.VarChanged_winHeight) - self.paraWidth.trace_variable('w', self.VarChanged_paraWidth) self.startupEdit.trace_variable('w', self.VarChanged_startupEdit) self.autoSave.trace_variable('w', self.VarChanged_autoSave) self.encoding.trace_variable('w', self.VarChanged_encoding) @@ -594,10 +582,6 @@ value = self.winHeight.get() self.AddChangedItem('main', 'EditorWindow', 'height', value) - def VarChanged_paraWidth(self, *params): - value = self.paraWidth.get() - self.AddChangedItem('main', 'FormatParagraph', 'paragraph', value) - def VarChanged_startupEdit(self, *params): value = self.startupEdit.get() self.AddChangedItem('main', 'General', 'editor-on-startup', value) @@ -1094,9 +1078,6 @@ 'main', 'EditorWindow', 'width', type='int')) self.winHeight.set(idleConf.GetOption( 'main', 'EditorWindow', 'height', type='int')) - #initial paragraph reformat size - self.paraWidth.set(idleConf.GetOption( - 'main', 'FormatParagraph', 'paragraph', type='int')) # default source encoding self.encoding.set(idleConf.GetOption( 'main', 'EditorWindow', 'encoding', default='none')) diff --git a/lib-python/2.7/idlelib/help.txt b/lib-python/2.7/idlelib/help.txt --- a/lib-python/2.7/idlelib/help.txt +++ b/lib-python/2.7/idlelib/help.txt @@ -100,7 +100,7 @@ which is scrolling off the top or the window. (Not present in Shell window.) -Windows Menu: +Window Menu: Zoom Height -- toggles the window between configured size and maximum height. diff --git a/lib-python/2.7/idlelib/idle.bat b/lib-python/2.7/idlelib/idle.bat --- a/lib-python/2.7/idlelib/idle.bat +++ b/lib-python/2.7/idlelib/idle.bat @@ -1,4 +1,4 @@ - at echo off -rem Start IDLE using the appropriate Python interpreter -set CURRDIR=%~dp0 -start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9 + at echo off +rem Start IDLE using the appropriate Python interpreter +set CURRDIR=%~dp0 +start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/lib-python/2.7/idlelib/idle_test/test_calltips.py b/lib-python/2.7/idlelib/idle_test/test_calltips.py --- a/lib-python/2.7/idlelib/idle_test/test_calltips.py +++ b/lib-python/2.7/idlelib/idle_test/test_calltips.py @@ -55,7 +55,8 @@ def gtest(obj, out): self.assertEqual(signature(obj), out) - gtest(List, '()\n' + List.__doc__) + if List.__doc__ is not None: + gtest(List, '()\n' + List.__doc__) gtest(list.__new__, 'T.__new__(S, ...) -> a new object with type S, a subtype of T') gtest(list.__init__, @@ -70,7 +71,8 @@ def test_signature_wrap(self): # This is also a test of an old-style class - self.assertEqual(signature(textwrap.TextWrapper), '''\ + if textwrap.TextWrapper.__doc__ is not None: + self.assertEqual(signature(textwrap.TextWrapper), '''\ (width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True)''') @@ -106,20 +108,23 @@ def t5(a, b=None, *args, **kwds): 'doc' t5.tip = "(a, b=None, *args, **kwargs)" + doc = '\ndoc' if t1.__doc__ is not None else '' for func in (t1, t2, t3, t4, t5, TC): - self.assertEqual(signature(func), func.tip + '\ndoc') + self.assertEqual(signature(func), func.tip + doc) def test_methods(self): + doc = '\ndoc' if TC.__doc__ is not None else '' for meth in (TC.t1, TC.t2, TC.t3, TC.t4, TC.t5, TC.t6, TC.__call__): - self.assertEqual(signature(meth), meth.tip + "\ndoc") - self.assertEqual(signature(TC.cm), "(a)\ndoc") - self.assertEqual(signature(TC.sm), "(b)\ndoc") + self.assertEqual(signature(meth), meth.tip + doc) + self.assertEqual(signature(TC.cm), "(a)" + doc) + self.assertEqual(signature(TC.sm), "(b)" + doc) def test_bound_methods(self): # test that first parameter is correctly removed from argspec + doc = '\ndoc' if TC.__doc__ is not None else '' for meth, mtip in ((tc.t1, "()"), (tc.t4, "(*args)"), (tc.t6, "(self)"), (tc.__call__, '(ci)'), (tc, '(ci)'), (TC.cm, "(a)"),): - self.assertEqual(signature(meth), mtip + "\ndoc") + self.assertEqual(signature(meth), mtip + doc) def test_starred_parameter(self): # test that starred first parameter is *not* removed from argspec diff --git a/lib-python/2.7/idlelib/idle_test/test_io.py b/lib-python/2.7/idlelib/idle_test/test_io.py new file mode 100644 --- /dev/null +++ b/lib-python/2.7/idlelib/idle_test/test_io.py @@ -0,0 +1,267 @@ +import unittest +import io +from idlelib.PyShell import PseudoInputFile, PseudoOutputFile +from test import test_support as support + + +class Base(object): + def __str__(self): + return '%s:str' % type(self).__name__ + def __unicode__(self): + return '%s:unicode' % type(self).__name__ + def __len__(self): + return 3 + def __iter__(self): + return iter('abc') + def __getitem__(self, *args): + return '%s:item' % type(self).__name__ + def __getslice__(self, *args): + return '%s:slice' % type(self).__name__ + +class S(Base, str): + pass + +class U(Base, unicode): + pass + +class BA(Base, bytearray): + pass + +class MockShell: + def __init__(self): + self.reset() + + def write(self, *args): + self.written.append(args) + + def readline(self): + return self.lines.pop() + + def close(self): + pass + + def reset(self): + self.written = [] + + def push(self, lines): + self.lines = list(lines)[::-1] + + +class PseudeOutputFilesTest(unittest.TestCase): + def test_misc(self): + shell = MockShell() + f = PseudoOutputFile(shell, 'stdout', 'utf-8') + self.assertIsInstance(f, io.TextIOBase) + self.assertEqual(f.encoding, 'utf-8') + self.assertIsNone(f.errors) + self.assertIsNone(f.newlines) + self.assertEqual(f.name, '') + self.assertFalse(f.closed) + self.assertTrue(f.isatty()) + self.assertFalse(f.readable()) + self.assertTrue(f.writable()) + self.assertFalse(f.seekable()) + + def test_unsupported(self): + shell = MockShell() + f = PseudoOutputFile(shell, 'stdout', 'utf-8') + self.assertRaises(IOError, f.fileno) + self.assertRaises(IOError, f.tell) + self.assertRaises(IOError, f.seek, 0) + self.assertRaises(IOError, f.read, 0) + self.assertRaises(IOError, f.readline, 0) + + def test_write(self): + shell = MockShell() + f = PseudoOutputFile(shell, 'stdout', 'utf-8') + f.write('test') + self.assertEqual(shell.written, [('test', 'stdout')]) + shell.reset() + f.write('t\xe8st') + self.assertEqual(shell.written, [('t\xe8st', 'stdout')]) + shell.reset() + f.write(u't\xe8st') + self.assertEqual(shell.written, [(u't\xe8st', 'stdout')]) + shell.reset() + + f.write(S('t\xe8st')) + self.assertEqual(shell.written, [('t\xe8st', 'stdout')]) + self.assertEqual(type(shell.written[0][0]), str) + shell.reset() + f.write(BA('t\xe8st')) + self.assertEqual(shell.written, [('t\xe8st', 'stdout')]) + self.assertEqual(type(shell.written[0][0]), str) + shell.reset() + f.write(U(u't\xe8st')) + self.assertEqual(shell.written, [(u't\xe8st', 'stdout')]) + self.assertEqual(type(shell.written[0][0]), unicode) + shell.reset() + + self.assertRaises(TypeError, f.write) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.write, 123) + self.assertEqual(shell.written, []) + self.assertRaises(TypeError, f.write, 'test', 'spam') + self.assertEqual(shell.written, []) + + def test_writelines(self): + shell = MockShell() + f = PseudoOutputFile(shell, 'stdout', 'utf-8') + f.writelines([]) + self.assertEqual(shell.written, []) + shell.reset() + f.writelines(['one\n', 'two']) + self.assertEqual(shell.written, + [('one\n', 'stdout'), ('two', 'stdout')]) + shell.reset() + f.writelines(['on\xe8\n', 'tw\xf2']) From noreply at buildbot.pypy.org Thu Nov 5 03:08:50 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 09:08:50 +0100 (CET) Subject: [pypy-commit] cffi default: Complain more readily about opaque enums, by refusing to guess which Message-ID: <20151105080851.0050B1C13F7@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2373:0fc618efb98b Date: 2015-11-05 09:09 +0100 http://bitbucket.org/cffi/cffi/changeset/0fc618efb98b/ Log: Complain more readily about opaque enums, by refusing to guess which integer type (unsigned/signed, int/long) it is meant to be. diff --git a/cffi/model.py b/cffi/model.py --- a/cffi/model.py +++ b/cffi/model.py @@ -514,12 +514,15 @@ if self.baseinttype is not None: return self.baseinttype.get_cached_btype(ffi, finishlist) # + from . import api if self.enumvalues: smallest_value = min(self.enumvalues) largest_value = max(self.enumvalues) else: - smallest_value = 0 - largest_value = 0 + raise api.CDefError("%r has no values explicitly defined: " + "refusing to guess which integer type it is " + "meant to be (unsigned/signed, int/long)" + % self._get_c_name()) if smallest_value < 0: # needs a signed type sign = 1 candidate1 = PrimitiveType("int") diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -1335,7 +1335,8 @@ # these depend on user-defined data, so should not be shared assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo") assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*") - assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") + # the following test is an opaque enum, which we no longer support + #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") # sanity check: twice 'ffi1' assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *") @@ -1347,6 +1348,14 @@ assert ffi.getctype("pe") == 'e *' assert ffi.getctype("e1*") == 'e1 *' + def test_opaque_enum(self): + ffi = FFI(backend=self.Backend()) + ffi.cdef("enum foo;") + e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) + assert str(e.value) == ( + "'enum foo' has no values explicitly defined: refusing to guess " + "which integer type it is meant to be (unsigned/signed, int/long)") + def test_new_ctype(self): ffi = FFI(backend=self.Backend()) p = ffi.new("int *") From noreply at buildbot.pypy.org Thu Nov 5 06:19:42 2015 From: noreply at buildbot.pypy.org (int_0) Date: Thu, 5 Nov 2015 12:19:42 +0100 (CET) Subject: [pypy-commit] pypy int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227: I need this library to build on Ubuntu 14 Message-ID: <20151105111942.6083D1C0155@cobra.cs.uni-duesseldorf.de> Author: Tobias Diaz Branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 Changeset: r80543:5f2613378382 Date: 2015-11-05 10:05 +0000 http://bitbucket.org/pypy/pypy/changeset/5f2613378382/ Log: I need this library to build on Ubuntu 14 diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst --- a/pypy/doc/build.rst +++ b/pypy/doc/build.rst @@ -85,13 +85,16 @@ _ssl libssl +gdbm + libgdbm-dev + Make sure to have these libraries (with development headers) installed before building PyPy, otherwise the resulting binary will not contain these modules. On Debian, this is the command to install all build-time dependencies:: apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \ - libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev + libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev For the optional lzma module on PyPy3 you will also need ``liblzma-dev``. From noreply at buildbot.pypy.org Thu Nov 5 06:19:44 2015 From: noreply at buildbot.pypy.org (fijal) Date: Thu, 5 Nov 2015 12:19:44 +0100 (CET) Subject: [pypy-commit] pypy default: Merged in int_0/pypy/int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 (pull request #355) Message-ID: <20151105111944.893DC1C0155@cobra.cs.uni-duesseldorf.de> Author: Maciej Fijalkowski Branch: Changeset: r80544:517d899354de Date: 2015-11-05 11:20 +0000 http://bitbucket.org/pypy/pypy/changeset/517d899354de/ Log: Merged in int_0/pypy/int_0/i-need-this-library-to-build-on- ubuntu-1-1446717626227 (pull request #355) I need this library to build on Ubuntu 14 diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst --- a/pypy/doc/build.rst +++ b/pypy/doc/build.rst @@ -85,13 +85,16 @@ _ssl libssl +gdbm + libgdbm-dev + Make sure to have these libraries (with development headers) installed before building PyPy, otherwise the resulting binary will not contain these modules. On Debian, this is the command to install all build-time dependencies:: apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \ - libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev + libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev For the optional lzma module on PyPy3 you will also need ``liblzma-dev``. From noreply at buildbot.pypy.org Thu Nov 5 06:26:05 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 5 Nov 2015 12:26:05 +0100 (CET) Subject: [pypy-commit] benchmarks default: add lee-routing benchmark for STM Message-ID: <20151105112605.ACBD71C0155@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r338:c2a9d75029be Date: 2015-11-05 12:27 +0100 http://bitbucket.org/pypy/benchmarks/changeset/c2a9d75029be/ Log: add lee-routing benchmark for STM We are 11x slower for sparseshort.txt and 2x for sparselong.txt using pypy with STM enabled. Find out why.. diff too long, truncating to 2000 out of 13625 lines diff --git a/multithread/lee_routing/lee_router.py b/multithread/lee_routing/lee_router.py new file mode 100755 --- /dev/null +++ b/multithread/lee_routing/lee_router.py @@ -0,0 +1,503 @@ +#!/usr/bin/python + +# +# BSD License +# +# Copyright (c) 2007, The University of Manchester (UK) +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# - Neither the name of the University of Manchester nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Simple Lee's Routing Algorithm +# Author: IW +# Translated from Java to Python by Remi Meier + + +import time, Tkinter +import sys, math +import threading + +DEBUG = True + +CYAN = "#00FFFF" +MAGENTA = "#FF00FF" +YELLOW = "#FFFF00" +GREEN = "#00FF00" +RED = "#FF0000" +BLUE = "#0000FF" + +GRID_SIZE = 600 +EMPTY = 0 +TEMP_EMPTY = 10000 +OCC = 5120 +VIA = 6000 +BVIA = 6001 +TRACK = 8192 +MAX_WEIGHT = 1 + +# used as loop indices to look at neighbouring cells +NEIGHBOUR_OFFS = ((1,0), (-1,0), (0,1), (0,-1)) + +class Grid(object): + + def __init__(self, width, height, depth): + self.width = width + self.height = height + self.depth = depth + self._data = [[[0 for _ in range(depth)] + for _ in range(height)] + for _ in range(width)] + self.reset(EMPTY) + + def reset(self, val): + for col in self._data: + for row in col: + for c in range(len(row)): + row[c] = val + + def occupy(self, lo_x, lo_y, up_x, up_y): + for x in range(lo_x, up_x + 1): + for y in range(lo_y, up_y + 1): + depth = self._data[x][y] + for c in range(len(depth)): + depth[c] = OCC + + + def add_weights(self): + data = self._data + for i in range(MAX_WEIGHT): + # this loop iteratively propagates weights + # if for MAX_WEIGHT > 1... + for z in range(self.depth): + for x in range(1, self.width - 1): + for y in range(1, self.height - 1): + val = data[x][y][z] + if val == OCC: + # for OCC fields, we set EMPTY neighbours to + # MAX_WEIGHT + for dx, dy in NEIGHBOUR_OFFS: + if data[x + dx][y + dy][z] == EMPTY: + data[x + dx][y + dy][z] = MAX_WEIGHT + elif val != EMPTY: + # for MAX_WEIGHT fields, set EMPTY neighbours to + # "our value - 1" --> 0 = EMPTY if MAX_WEIGHT is 1 + for dx, dy in NEIGHBOUR_OFFS: + if data[x + dx][y + dy][z] == EMPTY: + data[x + dx][y + dy][z] = val - 1 + + def __getitem__(self, args): + x, y, z = args + return self._data[x][y][z] + + def __setitem__(self, args, value): + x, y, z = args + self._data[x][y][z] = value + + + + +class WorkQueue(object): + def __init__(self, xx1=0, yy1=0, xx2=0, yy2=0, n=0): + self.next = None + self.x1 = xx1 + self.y1 = yy1 + self.x2 = xx2 + self.y2 = yy2 + self.nn = n + + def enqueue(self, x1, y1, x2, y2, n): + q = WorkQueue(x1, y1, x2, y2, n) + q.next = self.next + return q + + def dequeue(self): + q = self.next + self.next = self.next.next + return q + + # def length(self): + # curr = self.next + # retval = 0 + # while curr is not None: + # retval += 1 + # curr = curr.next + # return retval + + def _less(self, other): + return (((self.x2 - self.x1) * (self.x2 - self.x1) + + (self.y2 - self.y1) * (self.y2 - self.y1)) + > ((other.x2 - other.x1) * (other.x2 - other.x1) + + (other.y2 - other.y1) * (other.y2 - other.y1))) + + def _pass(self): + done = True + ent = self + a = ent.next + while a.next is not None: + b = a.next + if a._less(b): + ent.next = b + a.next = b.next + b.next = a + done = False + ent = a + a = b + b = b.next + return done + + def sort(self): + while not self._pass(): + pass + + + + +class LeeThread(threading.Thread): + + def __init__(self, lr): + threading.Thread.__init__(self) + self.lr = lr + self.wq = None + self.tempgrid = Grid(GRID_SIZE, GRID_SIZE, 2) + self.hardware = "somehostname" + + def run(self): + while True: + self.wq = self.lr.get_next_track() + # + if self.wq is None: + print "finished" + return + # + self.lr.lay_next_track(self.wq, self.tempgrid) + + + + +class LeeRouter(object): + + def __init__(self, file): + self.grid = Grid(GRID_SIZE, GRID_SIZE, 2) + self.work = WorkQueue() + self.net_no = 0 + self._parse_data_file(file) + self.grid.add_weights() + self.work.sort() + self.queue_lock = threading.Lock() + self.grid_lock = threading.Lock() + self.view = Viewer() + + def _parse_data_file(self, file_name): + with open(file_name, 'r') as file: + for line in file: + line = line.strip() + line = line.split() + c, params = line[0], map(int, line[1:]) + if c == 'E': + break # end of file + if c == 'C': + # chip bounding box + x0, y0, x1, y1 = params + self.grid.occupy(x0, y0, x1, y1) + if c == 'P': + # pad + x0, y0 = params + self.grid.occupy(x0, y0, x0, y0) + if c == 'J': + # join connection pts + x0, y0, x1, y1 = params + self.net_no += 1 + self.work.next = self.work.enqueue(x0, y0, x1, y1, self.net_no) + + def get_next_track(self): + with self.queue_lock: + if self.work.next is not None: + return self.work.dequeue() + return None + + def lay_next_track(self, wq, tempgrid): + # start transaction + with self.grid_lock: + done = self._connect(wq.x1, wq.y1, wq.x2, wq.y2, + wq.nn, tempgrid, self.grid) + return done # end transaction + + def create_thread(self): + return LeeThread(self) + + def _expand_from_to(self, x, y, x_goal, y_goal, num, + tempgrid, grid): + # this method should use Lee's expansion algorithm from + # coordinate (x,y) to (x_goal, y_goal) for the num iterations + # it should return true if the goal is found and false if it is not + # reached within the number of iterations allowed. + # + # g[x_goal][y_goal][0] = EMPTY; // set goal as empty + # g[x_goal][y_goal][1] = EMPTY; // set goal as empty + front = [] + tmp_front = [] + tempgrid[x, y, 0] = 1 + tempgrid[x, y, 1] = 1 + # + front.append((x, y, 0, 0)) # (x y z dw) + front.append((x, y, 1, 0)) # we can start from either side + # + reached0, reached1 = False, False + while front: + while front: + fx, fy, fz, fdw = front.pop(0) + # + if fdw > 0: + tmp_front.append((fx, fy, fz, fdw - 1)) + else: + for dx, dy in NEIGHBOUR_OFFS: + fdx, fdy = fx + dx, fy + dy + + weight = grid[fdx, fdy, fz] + 1 + prev_val = tempgrid[fdx, fdy, fz] + reached = (fdx == x_goal) and (fdy == y_goal) + if reached or ( + prev_val > tempgrid[fx, fy, fz] + weight and weight < OCC): + # check that a point is actually within the bounds of grid array: + if 0 < fdx < GRID_SIZE - 1 and 0 < fdy < GRID_SIZE - 1: + tempgrid[fdx, fdy, fz] = tempgrid[fx, fy, fz] + weight + if not reached: + tmp_front.append((fdx, fdy, fz, 0)) + # + not_fz = 1 - fz + weight = grid[fx, fy, not_fz] + 1 + if tempgrid[fx, fy, not_fz] > tempgrid[fx, fy, fz] and weight < OCC: + tempgrid[fx, fy, not_fz] = tempgrid[fx, fy, fz] + tmp_front.append((fx, fy, not_fz, 0)) + # + # must check if found goal, if so, return True + reached0 = tempgrid[x_goal, y_goal, 0] != TEMP_EMPTY + reached1 = tempgrid[x_goal, y_goal, 1] != TEMP_EMPTY + if reached0 and reached1: # both + return True # (x_goal, y_goal) can be found in time + # + front, tmp_front = tmp_front, front + return False + + @staticmethod + def _path_from_other_side(tempgrid, x, y, z): + zo = 1 - z # other side + sqval = tempgrid[x, y, zo] + if sqval in (VIA, BVIA): + return False + # + if tempgrid[x, y, zo] <= tempgrid[x, y, z]: + return (tempgrid[x-1, y, zo] < sqval or tempgrid[x+1, y, zo] < sqval + or tempgrid[x, y-1, zo] < sqval or tempgrid[x, y+1, zo] < sqval) + return False + + @staticmethod + def _tlength(x1, y1, x2, y2): + sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + return math.sqrt(sq); + + def _backtrack_from(self, x_goal, y_goal, x_start, y_start, + track_no, tempgrid, grid): + # this method should backtrack from the goal position (x_goal, y_goal) + # back to the starting position (x_start, y_start) filling in the + # grid array g with the specified track number track_no ( + TRACK). + # *** + # CurrentPos = Goal + # Loop + # Find dir to start back from current position + # Loop + # Keep going in current dir and Fill in track (update currentPos) + # Until box number increases in this current dir + # Until back at starting point + # *** + distsofar = 0 + if abs(x_goal - x_start) > abs(y_goal - y_start): + z_goal = 0 + else: + z_goal = 1 + # + if tempgrid[x_goal, y_goal, z_goal] == TEMP_EMPTY: + z_goal = 1 - z_goal + # + # arrays used for looking NSEW: + DX = (( -1, 1, 0, 0 ), + ( 0, 0, -1, 1 )) + DY = (( 0, 0, -1, 1 ), + ( -1, 1, 0, 0 )) + # + temp_y, temp_x, temp_z = y_goal, x_goal, z_goal + while (temp_x != x_start) or (temp_y != y_start): # PDL: until back + # at starting point + advanced = False + min_dir = 0 + min_square = 100000 + for d in range(4): # PDL: find dir to start back from + # current position + temp_dx, temp_dy = temp_x + DX[temp_z][d], temp_y + DY[temp_z][d] + if (tempgrid[temp_dx, temp_dy, temp_z] < tempgrid[temp_x, temp_y, temp_z] + and tempgrid[temp_dx, temp_dy, temp_z] != TEMP_EMPTY): + if tempgrid[temp_dx, temp_dy, temp_z] < min_square: + min_square = tempgrid[temp_dx, temp_dy, temp_z] + min_dir = d + advanced = True + if advanced: + distsofar += 1 + # + if (self._path_from_other_side(tempgrid, temp_x, temp_y, temp_z) + # not preferred dir for this layer + and ((min_dir > 1 and distsofar > 15 + and self._tlength(temp_x, temp_y, x_start, y_start) > 15) + or (not advanced and + grid[temp_x, temp_y, temp_z] not in (VIA, BVIA) + ))): + t_z = 1 - temp_z + viat = VIA if advanced else BVIA # BVIA is nowhere else to go + # mark via + tempgrid[temp_x, temp_y, temp_z] = viat + grid[temp_x, temp_y, temp_z] = viat + # go to the other side: + temp_z = t_z + tempgrid[temp_x, temp_y, temp_z] = viat + grid[temp_x, temp_y, temp_z] = viat + distsofar = 0 + else: + if grid[temp_x, temp_y, temp_z] < OCC: + # PDL: fill in track unless connection point + grid[temp_x, temp_y, temp_z] = TRACK + # PDL: updating current position + temp_x = temp_x + DX[temp_z][min_dir]; + temp_y = temp_y + DY[temp_z][min_dir]; + + def _connect(self, xs, ys, xg, yg, net_no, tempgrid, grid): + # calls expand_from and backtrack_from to create connection + # This is the only real change needed to make the program + # transactional. + # Instead of using the grid 'in place' to do the expansion, we take a + # copy but the backtrack writes to the original grid. + # This is not a correctness issue. The transactions would still + # complete eventually without it. + # However the expansion writes are only temporary and do not logically + # conflict. + # There is a question as to whether a copy is really necessary as a + # transaction will anyway create + # its own copy. if we were then to distinguish between writes not to be + # committed (expansion) and + # those to be committed (backtrack), we would not need an explicit + # copy. + # Taking the copy is not really a computational(time) overhead because + # it avoids the grid 'reset' phase + # needed if we do the expansion in place. + tempgrid.reset(TEMP_EMPTY) + # call the expansion method to return found/not found boolean + found = self._expand_from_to(xs, ys, xg, yg, GRID_SIZE * 5, tempgrid, grid) + if found: + self._backtrack_from(xg, yg, xs, ys, net_no, tempgrid, grid) + return found + + def disp_grid(self, z): + laycol = (MAGENTA, GREEN)[z] + for y in reversed(range(GRID_SIZE)): #WTF + for x in range(GRID_SIZE): + gg = self.grid[x, y, z] + if gg == OCC: + self.view.point(x, y, CYAN) + elif gg == VIA: + self.view.point(x, y, YELLOW) + elif gg == BVIA: + self.view.point(x, y, RED) + elif gg == TRACK: + self.view.point(x, y, laycol) + + + +def main(args): + if len(args) != 2: + print "Params: [numthreads] [input-file]" + sys.exit(-1) + # + num_threads = int(args[0]) + filename = args[1] + lr = LeeRouter(filename) + # + # setup the benchmark + start_time = 0 + current_time = 0 + # + thread = [lr.create_thread() for _ in range(num_threads)] + start_time = time.time() + for t in thread: + t.start() + current_time = time.time() + for t in thread: + t.join() + # + elapsed_time = current_time - start_time + print "Numthreads:", num_threads + print "ElapsedTime:", elapsed_time, "s" + report(start_time) + if DEBUG: + lr.disp_grid(0) + lr.disp_grid(1) + lr.view.show() + + + +def report(start_time): + stop_time = time.time() + elapsed = stop_time - start_time + print "Elapsed time:", elapsed, "s" + print "-------------------------" + + + +class Viewer(object): + def __init__(self): + self.points = [] + + def point(self, x, y, col): + self.points.append((x, y, col)) + + def show(self, width=GRID_SIZE, height=GRID_SIZE): + master = Tkinter.Tk() + c = Tkinter.Canvas(master, width=width, height=height, + background="black") + c.pack() + img = Tkinter.PhotoImage(width=width, height=height) + c.create_image((width/2, height/2), image=img, + state="normal") + # draw + for (x, y, col) in self.points: + img.put(col, (x, y)) + #c.create_oval(x-1, y-1, x+1, y+1, fill=col, width=0) + Tkinter.mainloop() + + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/multithread/lee_routing/mainboard.txt b/multithread/lee_routing/mainboard.txt new file mode 100644 --- /dev/null +++ b/multithread/lee_routing/mainboard.txt @@ -0,0 +1,4653 @@ +P 306 476 +P 306 480 +P 306 484 +P 306 488 +P 306 492 +P 306 496 +P 306 500 +P 306 504 +P 306 508 +P 306 512 +P 306 516 +P 306 520 +P 306 524 +P 306 528 +P 306 532 +P 306 536 +P 306 540 +P 306 544 +P 306 548 +P 306 552 +P 282 552 +P 282 548 +P 282 544 +P 282 540 +P 282 536 +P 282 532 +P 282 528 +P 282 524 +P 282 520 +P 282 516 +P 282 512 +P 282 508 +P 282 504 +P 282 500 +P 282 496 +P 282 492 +P 282 488 +P 282 484 +P 282 480 +P 282 476 +P 366 526 +P 366 530 +P 366 534 +P 366 538 +P 366 542 +P 366 546 +P 366 550 +P 366 554 +P 366 558 +P 366 562 +P 366 566 +P 366 570 +P 354 570 +P 354 566 +P 354 562 +P 354 558 +P 354 554 +P 354 550 +P 354 546 +P 354 542 +P 354 538 +P 354 534 +P 354 530 +P 354 526 +P 394 526 +P 394 530 +P 394 534 +P 394 538 +P 394 542 +P 394 546 +P 394 550 +P 394 554 +P 394 558 +P 394 562 +P 394 566 +P 394 570 +P 382 570 +P 382 566 +P 382 562 +P 382 558 +P 382 554 +P 382 550 +P 382 546 +P 382 542 +P 382 538 +P 382 534 +P 382 530 +P 382 526 +P 422 526 +P 422 530 +P 422 534 +P 422 538 +P 422 542 +P 422 546 +P 422 550 +P 422 554 +P 422 558 +P 422 562 +P 422 566 +P 422 570 +P 410 570 +P 410 566 +P 410 562 +P 410 558 +P 410 554 +P 410 550 +P 410 546 +P 410 542 +P 410 538 +P 410 534 +P 410 530 +P 410 526 +P 450 526 +P 450 530 +P 450 534 +P 450 538 +P 450 542 +P 450 546 +P 450 550 +P 450 554 +P 450 558 +P 450 562 +P 450 566 +P 450 570 +P 438 570 +P 438 566 +P 438 562 +P 438 558 +P 438 554 +P 438 550 +P 438 546 +P 438 542 +P 438 538 +P 438 534 +P 438 530 +P 438 526 +P 478 526 +P 478 530 +P 478 534 +P 478 538 +P 478 542 +P 478 546 +P 478 550 +P 478 554 +P 478 558 +P 478 562 +P 478 566 +P 478 570 +P 466 570 +P 466 566 +P 466 562 +P 466 558 +P 466 554 +P 466 550 +P 466 546 +P 466 542 +P 466 538 +P 466 534 +P 466 530 +P 466 526 +P 506 526 +P 506 530 +P 506 534 +P 506 538 +P 506 542 +P 506 546 +P 506 550 +P 506 554 +P 506 558 +P 506 562 +P 506 566 +P 506 570 +P 494 570 +P 494 566 +P 494 562 +P 494 558 +P 494 554 +P 494 550 +P 494 546 +P 494 542 +P 494 538 +P 494 534 +P 494 530 +P 494 526 +P 534 526 +P 534 530 +P 534 534 +P 534 538 +P 534 542 +P 534 546 +P 534 550 +P 534 554 +P 534 558 +P 534 562 +P 534 566 +P 534 570 +P 522 570 +P 522 566 +P 522 562 +P 522 558 +P 522 554 +P 522 550 +P 522 546 +P 522 542 +P 522 538 +P 522 534 +P 522 530 +P 522 526 +P 562 526 +P 562 530 +P 562 534 +P 562 538 +P 562 542 +P 562 546 +P 562 550 +P 562 554 +P 562 558 +P 562 562 +P 562 566 +P 562 570 +P 550 570 +P 550 566 +P 550 562 +P 550 558 +P 550 554 +P 550 550 +P 550 546 +P 550 542 +P 550 538 +P 550 534 +P 550 530 +P 550 526 +P 366 444 +P 366 448 +P 366 452 +P 366 456 +P 366 460 +P 366 464 +P 366 468 +P 366 472 +P 366 476 +P 366 480 +P 366 484 +P 366 488 +P 354 488 +P 354 484 +P 354 480 +P 354 476 +P 354 472 +P 354 468 +P 354 464 +P 354 460 +P 354 456 +P 354 452 +P 354 448 +P 354 444 +P 394 444 +P 394 448 +P 394 452 +P 394 456 +P 394 460 +P 394 464 +P 394 468 +P 394 472 +P 394 476 +P 394 480 +P 394 484 +P 394 488 +P 382 488 +P 382 484 +P 382 480 +P 382 476 +P 382 472 +P 382 468 +P 382 464 +P 382 460 +P 382 456 +P 382 452 +P 382 448 +P 382 444 +P 422 444 +P 422 448 +P 422 452 +P 422 456 +P 422 460 +P 422 464 +P 422 468 +P 422 472 +P 422 476 +P 422 480 +P 422 484 +P 422 488 +P 410 488 +P 410 484 +P 410 480 +P 410 476 +P 410 472 +P 410 468 +P 410 464 +P 410 460 +P 410 456 +P 410 452 +P 410 448 +P 410 444 +P 450 444 +P 450 448 +P 450 452 +P 450 456 +P 450 460 +P 450 464 +P 450 468 +P 450 472 +P 450 476 +P 450 480 +P 450 484 +P 450 488 +P 438 488 +P 438 484 +P 438 480 +P 438 476 +P 438 472 +P 438 468 +P 438 464 +P 438 460 +P 438 456 +P 438 452 +P 438 448 +P 438 444 +P 478 444 +P 478 448 +P 478 452 +P 478 456 +P 478 460 +P 478 464 +P 478 468 +P 478 472 +P 478 476 +P 478 480 +P 478 484 +P 478 488 +P 466 488 +P 466 484 +P 466 480 +P 466 476 +P 466 472 +P 466 468 +P 466 464 +P 466 460 +P 466 456 +P 466 452 +P 466 448 +P 466 444 +P 506 444 +P 506 448 +P 506 452 +P 506 456 +P 506 460 +P 506 464 +P 506 468 +P 506 472 +P 506 476 +P 506 480 +P 506 484 +P 506 488 +P 494 488 +P 494 484 +P 494 480 +P 494 476 +P 494 472 +P 494 468 +P 494 464 +P 494 460 +P 494 456 +P 494 452 +P 494 448 +P 494 444 +P 534 444 +P 534 448 +P 534 452 +P 534 456 +P 534 460 +P 534 464 +P 534 468 +P 534 472 +P 534 476 +P 534 480 +P 534 484 +P 534 488 +P 522 488 +P 522 484 +P 522 480 +P 522 476 +P 522 472 +P 522 468 +P 522 464 +P 522 460 +P 522 456 +P 522 452 +P 522 448 +P 522 444 +P 562 444 +P 562 448 +P 562 452 +P 562 456 +P 562 460 +P 562 464 +P 562 468 +P 562 472 +P 562 476 +P 562 480 +P 562 484 +P 562 488 +P 550 488 +P 550 484 +P 550 480 +P 550 476 +P 550 472 +P 550 468 +P 550 464 +P 550 460 +P 550 456 +P 550 452 +P 550 448 +P 550 444 +P 378 242 +P 378 246 +P 378 250 +P 378 254 +P 378 258 +P 378 262 +P 378 266 +P 378 270 +P 378 274 +P 378 278 +P 378 282 +P 378 286 +P 378 290 +P 378 294 +P 354 294 +P 354 290 +P 354 286 +P 354 282 +P 354 278 +P 354 274 +P 354 270 +P 354 266 +P 354 262 +P 354 258 +P 354 254 +P 354 250 +P 354 246 +P 354 242 +P 406 226 +P 406 230 +P 406 234 +P 406 238 +P 406 242 +P 406 246 +P 406 250 +P 406 254 +P 406 258 +P 406 262 +P 394 262 +P 394 258 +P 394 254 +P 394 250 +P 394 246 +P 394 242 +P 394 238 +P 394 234 +P 394 230 +P 394 226 +P 406 286 +P 406 290 +P 406 294 +P 406 298 +P 406 302 +P 406 306 +P 406 310 +P 406 314 +P 406 318 +P 406 322 +P 394 322 +P 394 318 +P 394 314 +P 394 310 +P 394 306 +P 394 302 +P 394 298 +P 394 294 +P 394 290 +P 394 286 +P 280 40 +P 280 44 +P 280 48 +P 280 52 +P 280 56 +P 280 60 +P 280 64 +P 280 68 +P 280 72 +P 280 76 +P 268 76 +P 268 72 +P 268 68 +P 268 64 +P 268 60 +P 268 56 +P 268 52 +P 268 48 +P 268 44 +P 268 40 +P 336 534 +P 336 538 +P 336 542 +P 336 546 +P 336 550 +P 336 554 +P 336 558 +P 336 562 +P 336 566 +P 336 570 +P 324 570 +P 324 566 +P 324 562 +P 324 558 +P 324 554 +P 324 550 +P 324 546 +P 324 542 +P 324 538 +P 324 534 +P 336 466 +P 336 470 +P 336 474 +P 336 478 +P 336 482 +P 336 486 +P 336 490 +P 336 494 +P 336 498 +P 336 502 +P 324 502 +P 324 498 +P 324 494 +P 324 490 +P 324 486 +P 324 482 +P 324 478 +P 324 474 +P 324 470 +P 324 466 +P 434 226 +P 434 230 +P 434 234 +P 434 238 +P 434 242 +P 434 246 +P 434 250 +P 434 254 +P 434 258 +P 434 262 +P 422 262 +P 422 258 +P 422 254 +P 422 250 +P 422 246 +P 422 242 +P 422 238 +P 422 234 +P 422 230 +P 422 226 +P 436 286 +P 436 290 +P 436 294 +P 436 298 +P 436 302 +P 436 306 +P 436 310 +P 436 314 +P 436 318 +P 436 322 +P 424 322 +P 424 318 +P 424 314 +P 424 310 +P 424 306 +P 424 302 +P 424 298 +P 424 294 +P 424 290 +P 424 286 +P 130 432 +P 134 432 +P 138 432 +P 142 432 +P 146 432 +P 150 432 +P 154 432 +P 158 432 +P 162 432 +P 166 432 +P 166 444 +P 162 444 +P 158 444 +P 154 444 +P 150 444 +P 146 444 +P 142 444 +P 138 444 +P 134 444 +P 130 444 +P 214 540 +P 214 544 +P 214 548 +P 214 552 +P 214 556 +P 214 560 +P 214 564 +P 214 568 +P 214 572 +P 214 576 +P 202 576 +P 202 572 +P 202 568 +P 202 564 +P 202 560 +P 202 556 +P 202 552 +P 202 548 +P 202 544 +P 202 540 +P 182 540 +P 182 544 +P 182 548 +P 182 552 +P 182 556 +P 182 560 +P 182 564 +P 182 568 +P 182 572 +P 182 576 +P 170 576 +P 170 572 +P 170 568 +P 170 564 +P 170 560 +P 170 556 +P 170 552 +P 170 548 +P 170 544 +P 170 540 +P 214 468 +P 214 472 +P 214 476 +P 214 480 +P 214 484 +P 214 488 +P 214 492 +P 214 496 +P 214 500 +P 214 504 +P 214 508 +P 214 512 +P 202 512 +P 202 508 +P 202 504 +P 202 500 +P 202 496 +P 202 492 +P 202 488 +P 202 484 +P 202 480 +P 202 476 +P 202 472 +P 202 468 +P 248 468 +P 248 472 +P 248 476 +P 248 480 +P 248 484 +P 248 488 +P 248 492 +P 248 496 +P 248 500 +P 248 504 +P 236 504 +P 236 500 +P 236 496 +P 236 492 +P 236 488 +P 236 484 +P 236 480 +P 236 476 +P 236 472 +P 236 468 +P 186 468 +P 186 472 +P 186 476 +P 186 480 +P 186 484 +P 186 488 +P 186 492 +P 186 496 +P 186 500 +P 186 504 +P 186 508 +P 186 512 +P 174 512 +P 174 508 +P 174 504 +P 174 500 +P 174 496 +P 174 492 +P 174 488 +P 174 484 +P 174 480 +P 174 476 +P 174 472 +P 174 468 +P 110 540 +P 110 544 +P 110 548 +P 110 552 +P 110 556 +P 110 560 +P 110 564 +P 98 564 +P 98 560 +P 98 556 +P 98 552 +P 98 548 +P 98 544 +P 98 540 +P 46 540 +P 46 544 +P 46 548 +P 46 552 +P 46 556 +P 46 560 +P 46 564 +P 34 564 +P 34 560 +P 34 556 +P 34 552 +P 34 548 +P 34 544 +P 34 540 +P 306 460 +P 286 460 +P 248 540 +P 248 544 +P 248 548 +P 248 552 +P 248 556 +P 248 560 +P 248 564 +P 248 568 +P 248 572 +P 248 576 +P 236 576 +P 236 572 +P 236 568 +P 236 564 +P 236 560 +P 236 556 +P 236 552 +P 236 548 +P 236 544 +P 236 540 +P 336 450 +P 332 450 +P 328 450 +P 324 450 +P 320 450 +P 316 450 +P 312 450 +P 308 450 +P 448 422 +P 444 422 +P 440 422 +P 436 422 +P 432 422 +P 428 422 +P 424 422 +P 420 422 +P 420 410 +P 424 410 +P 428 410 +P 432 410 +P 436 410 +P 440 410 +P 444 410 +P 448 410 +P 254 40 +P 254 44 +P 254 48 +P 254 52 +P 254 56 +P 254 60 +P 254 64 +P 254 68 +P 254 72 +P 254 76 +P 242 76 +P 242 72 +P 242 68 +P 242 64 +P 242 60 +P 242 56 +P 242 52 +P 242 48 +P 242 44 +P 242 40 +P 172 244 +P 172 248 +P 172 252 +P 172 256 +P 172 260 +P 172 264 +P 172 268 +P 172 272 +P 172 276 +P 172 280 +P 172 284 +P 172 288 +P 160 288 +P 160 284 +P 160 280 +P 160 276 +P 160 272 +P 160 268 +P 160 264 +P 160 260 +P 160 256 +P 160 252 +P 160 248 +P 160 244 +P 172 192 +P 172 196 +P 172 200 +P 172 204 +P 172 208 +P 172 212 +P 172 216 +P 172 220 +P 172 224 +P 172 228 +P 172 232 +P 172 236 +P 160 236 +P 160 232 +P 160 228 +P 160 224 +P 160 220 +P 160 216 +P 160 212 +P 160 208 +P 160 204 +P 160 200 +P 160 196 +P 160 192 +P 172 140 +P 172 144 +P 172 148 +P 172 152 +P 172 156 +P 172 160 +P 172 164 +P 172 168 +P 172 172 +P 172 176 +P 172 180 +P 172 184 +P 160 184 +P 160 180 +P 160 176 +P 160 172 +P 160 168 +P 160 164 +P 160 160 +P 160 156 +P 160 152 +P 160 148 +P 160 144 +P 160 140 +P 172 88 +P 172 92 +P 172 96 +P 172 100 +P 172 104 +P 172 108 +P 172 112 +P 172 116 +P 172 120 +P 172 124 +P 172 128 +P 172 132 +P 160 132 +P 160 128 +P 160 124 +P 160 120 +P 160 116 +P 160 112 +P 160 108 +P 160 104 +P 160 100 +P 160 96 +P 160 92 +P 160 88 +P 172 36 +P 172 40 +P 172 44 +P 172 48 +P 172 52 +P 172 56 +P 172 60 +P 172 64 +P 172 68 +P 172 72 +P 172 76 +P 172 80 +P 160 80 +P 160 76 +P 160 72 +P 160 68 +P 160 64 +P 160 60 +P 160 56 +P 160 52 +P 160 48 +P 160 44 +P 160 40 +P 160 36 +P 110 256 +P 110 260 +P 110 264 +P 110 268 +P 110 272 +P 110 276 +P 110 280 +P 110 284 +P 110 288 +P 110 292 +P 98 292 +P 98 288 +P 98 284 +P 98 280 +P 98 276 +P 98 272 +P 98 268 +P 98 264 +P 98 260 +P 98 256 +P 128 204 +P 128 208 +P 128 212 +P 128 216 +P 128 220 +P 128 224 +P 128 228 +P 128 232 +P 128 236 +P 128 240 +P 116 240 +P 116 236 +P 116 232 +P 116 228 +P 116 224 +P 116 220 +P 116 216 +P 116 212 +P 116 208 +P 116 204 +P 138 152 +P 138 156 +P 138 160 +P 138 164 +P 138 168 +P 138 172 +P 138 176 +P 138 180 +P 138 184 +P 138 188 +P 126 188 +P 126 184 +P 126 180 +P 126 176 +P 126 172 +P 126 168 +P 126 164 +P 126 160 +P 126 156 +P 126 152 +P 148 100 +P 148 104 +P 148 108 +P 148 112 +P 148 116 +P 148 120 +P 148 124 +P 148 128 +P 148 132 +P 148 136 +P 136 136 +P 136 132 +P 136 128 +P 136 124 +P 136 120 +P 136 116 +P 136 112 +P 136 108 +P 136 104 +P 136 100 +P 148 48 +P 148 52 +P 148 56 +P 148 60 +P 148 64 +P 148 68 +P 148 72 +P 148 76 +P 148 80 +P 148 84 +P 136 84 +P 136 80 +P 136 76 +P 136 72 +P 136 68 +P 136 64 +P 136 60 +P 136 56 +P 136 52 +P 136 48 +P 68 86 +P 68 90 +P 68 94 +P 68 98 +P 68 102 +P 68 106 +P 68 110 +P 68 114 +P 68 118 +P 68 122 +P 68 126 +P 68 130 +P 56 130 +P 56 126 +P 56 122 +P 56 118 +P 56 114 +P 56 110 +P 56 106 +P 56 102 +P 56 98 +P 56 94 +P 56 90 +P 56 86 +P 84 196 +P 84 200 +P 84 204 +P 84 208 +P 84 212 +P 84 216 +P 84 220 +P 84 224 +P 84 228 +P 84 232 +P 84 236 +P 84 240 +P 72 240 +P 72 236 +P 72 232 +P 72 228 +P 72 224 +P 72 220 +P 72 216 +P 72 212 +P 72 208 +P 72 204 +P 72 200 +P 72 196 +P 72 140 +P 72 144 +P 72 148 +P 72 152 +P 72 156 +P 72 160 +P 72 164 +P 72 168 +P 72 172 +P 72 176 +P 72 180 +P 72 184 +P 60 184 +P 60 180 +P 60 176 +P 60 172 +P 60 168 +P 60 164 +P 60 160 +P 60 156 +P 60 152 +P 60 148 +P 60 144 +P 60 140 +P 84 252 +P 84 256 +P 84 260 +P 84 264 +P 84 268 +P 84 272 +P 84 276 +P 84 280 +P 84 284 +P 84 288 +P 84 292 +P 84 296 +P 72 296 +P 72 292 +P 72 288 +P 72 284 +P 72 280 +P 72 276 +P 72 272 +P 72 268 +P 72 264 +P 72 260 +P 72 256 +P 72 252 +P 28 86 +P 28 90 +P 28 94 +P 28 98 +P 28 102 +P 28 106 +P 28 110 +P 28 114 +P 28 118 +P 28 122 +P 28 126 +P 28 130 +P 16 130 +P 16 126 +P 16 122 +P 16 118 +P 16 114 +P 16 110 +P 16 106 +P 16 102 +P 16 98 +P 16 94 +P 16 90 +P 16 86 +P 40 152 +P 40 156 +P 40 160 +P 40 164 +P 40 168 +P 40 172 +P 40 176 +P 40 180 +P 40 184 +P 40 188 +P 40 192 +P 40 196 +P 28 196 +P 28 192 +P 28 188 +P 28 184 +P 28 180 +P 28 176 +P 28 172 +P 28 168 +P 28 164 +P 28 160 +P 28 156 +P 28 152 +P 52 214 +P 52 218 +P 52 222 +P 52 226 +P 52 230 +P 52 234 +P 52 238 +P 52 242 +P 52 246 +P 52 250 +P 52 254 +P 52 258 +P 40 258 +P 40 254 +P 40 250 +P 40 246 +P 40 242 +P 40 238 +P 40 234 +P 40 230 +P 40 226 +P 40 222 +P 40 218 +P 40 214 +P 46 466 +P 46 470 +P 46 474 +P 46 478 +P 46 482 +P 46 486 +P 46 490 +P 46 494 +P 46 498 +P 46 502 +P 46 506 +P 46 510 +P 34 510 +P 34 506 +P 34 502 +P 34 498 +P 34 494 +P 34 490 +P 34 486 +P 34 482 +P 34 478 +P 34 474 +P 34 470 +P 34 466 +P 24 466 +P 24 470 +P 24 474 +P 24 478 +P 24 482 +P 24 486 +P 24 490 +P 24 494 +P 24 498 +P 24 502 +P 24 506 +P 24 510 +P 12 510 +P 12 506 +P 12 502 +P 12 498 +P 12 494 +P 12 490 +P 12 486 +P 12 482 +P 12 478 +P 12 474 +P 12 470 +P 12 466 +P 106 304 +P 106 308 +P 106 312 +P 106 316 +P 106 320 +P 106 324 +P 106 328 +P 106 332 +P 106 336 +P 106 340 +P 94 340 +P 94 336 +P 94 332 +P 94 328 +P 94 324 +P 94 320 +P 94 316 +P 94 312 +P 94 308 +P 94 304 +P 68 466 +P 68 470 +P 68 474 +P 68 478 +P 68 482 +P 68 486 +P 68 490 +P 68 494 +P 68 498 +P 68 502 +P 68 506 +P 68 510 +P 56 510 +P 56 506 +P 56 502 +P 56 498 +P 56 494 +P 56 490 +P 56 486 +P 56 482 +P 56 478 +P 56 474 +P 56 470 +P 56 466 +P 108 466 +P 108 470 +P 108 474 +P 108 478 +P 108 482 +P 108 486 +P 108 490 +P 108 494 +P 96 494 +P 96 490 +P 96 486 +P 96 482 +P 96 478 +P 96 474 +P 96 470 +P 96 466 +P 18 432 +P 22 432 +P 26 432 +P 30 432 +P 34 432 +P 38 432 +P 42 432 +P 46 432 +P 50 432 +P 54 432 +P 54 444 +P 50 444 +P 46 444 +P 42 444 +P 38 444 +P 34 444 +P 30 444 +P 26 444 +P 22 444 +P 18 444 +P 74 432 +P 78 432 +P 82 432 +P 86 432 +P 90 432 +P 94 432 +P 98 432 +P 102 432 +P 106 432 +P 110 432 +P 110 444 +P 106 444 +P 102 444 +P 98 444 +P 94 444 +P 90 444 +P 86 444 +P 82 444 +P 78 444 +P 74 444 +P 144 8 +P 140 8 +P 136 8 +P 132 8 +P 128 8 +P 124 8 +P 120 8 +P 116 8 +P 112 8 +P 108 8 +P 104 8 +P 100 8 +P 96 8 +P 92 8 +P 88 8 +P 84 8 +P 80 8 +P 76 8 +P 72 8 +P 68 8 +P 64 8 +P 60 8 +P 56 8 +P 52 8 +P 48 8 +P 44 8 +P 40 8 +P 36 8 +P 32 8 +P 28 8 +P 24 8 +P 20 8 +P 144 12 +P 140 12 +P 136 12 +P 132 12 +P 128 12 +P 124 12 +P 120 12 +P 116 12 +P 112 12 +P 108 12 +P 104 12 +P 100 12 +P 96 12 +P 92 12 +P 88 12 +P 84 12 +P 80 12 +P 76 12 +P 72 12 +P 68 12 +P 64 12 +P 60 12 +P 56 12 +P 52 12 +P 48 12 +P 44 12 +P 40 12 +P 36 12 +P 32 12 +P 28 12 +P 24 12 +P 20 12 +P 144 16 +P 140 16 +P 136 16 +P 132 16 +P 128 16 +P 124 16 +P 120 16 +P 116 16 +P 112 16 +P 108 16 +P 104 16 +P 100 16 +P 96 16 +P 92 16 +P 88 16 +P 84 16 +P 80 16 +P 76 16 +P 72 16 +P 68 16 +P 64 16 +P 60 16 +P 56 16 +P 52 16 +P 48 16 +P 44 16 +P 40 16 +P 36 16 +P 32 16 +P 28 16 +P 24 16 +P 20 16 +P 76 406 +P 80 406 +P 84 406 +P 88 406 +P 92 406 +P 96 406 +P 100 406 +P 104 406 +P 104 418 +P 100 418 +P 96 418 +P 92 418 +P 88 418 +P 84 418 +P 80 418 +P 76 418 +P 28 318 +P 28 322 +P 28 326 +P 28 330 +P 28 334 +P 28 338 +P 28 342 +P 28 346 +P 16 346 +P 16 342 +P 16 338 +P 16 334 +P 16 330 +P 16 326 +P 16 322 +P 16 318 +P 26 540 +P 26 544 +P 26 548 +P 26 552 +P 26 556 +P 26 560 +P 26 564 +P 14 564 +P 14 560 From noreply at buildbot.pypy.org Thu Nov 5 08:15:31 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 5 Nov 2015 14:15:31 +0100 (CET) Subject: [pypy-commit] stmgc default: emit DETACH/REATTACH events when detaching/reattaching an inevitable transaction Message-ID: <20151105131532.0178F1C0155@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r1963:6397419657be Date: 2015-11-05 14:17 +0100 http://bitbucket.org/pypy/stmgc/changeset/6397419657be/ Log: emit DETACH/REATTACH events when detaching/reattaching an inevitable transaction diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -100,6 +100,8 @@ #define _stm_detach_inevitable_transaction(tl) do { \ write_fence(); \ assert(_stm_detached_inevitable_from_thread == 0); \ + if (stmcb_timing_event != NULL) \ + {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ _stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \ } while (0) void _stm_reattach_transaction(intptr_t); @@ -416,69 +418,6 @@ #endif -/* Entering and leaving a "transactional code zone": a (typically very - large) section in the code where we are running a transaction. - This is the STM equivalent to "acquire the GIL" and "release the - GIL", respectively. stm_read(), stm_write(), stm_allocate(), and - other functions should only be called from within a transaction. - - Note that transactions, in the STM sense, cover _at least_ one - transactional code zone. They may be longer; for example, if one - thread does a lot of stm_enter_transactional_zone() + - stm_become_inevitable() + stm_leave_transactional_zone(), as is - typical in a thread that does a lot of C function calls, then we - get only a few bigger inevitable transactions that cover the many - short transactional zones. This is done by having - stm_leave_transactional_zone() turn the current transaction - inevitable and detach it from the running thread (if there is no - other inevitable transaction running so far). Then - stm_enter_transactional_zone() will try to reattach to it. This is - far more efficient than constantly starting and committing - transactions. - - stm_enter_transactional_zone() and stm_leave_transactional_zone() - preserve the value of errno. -*/ -#ifdef STM_DEBUGPRINT -#include -#endif -static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { - intptr_t self = tl->self_or_0_if_atomic; - if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, - self, 0)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_enter_transactional_zone fast path\n"); -#endif - } - else { - _stm_reattach_transaction(self); - /* _stm_detached_inevitable_from_thread should be 0 here, but - it can already have been changed from a parallel thread - (assuming we're not inevitable ourselves) */ - } -} -static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { - assert(STM_SEGMENT->running_thread == tl); - if (stm_is_inevitable(tl)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_leave_transactional_zone fast path\n"); -#endif - _stm_detach_inevitable_transaction(tl); - } - else { - _stm_leave_noninevitable_transactional_zone(); - } -} - -/* stm_force_transaction_break() is in theory equivalent to - stm_leave_transactional_zone() immediately followed by - stm_enter_transactional_zone(); however, it is supposed to be - called in CPU-heavy threads that had a transaction run for a while, - and so it *always* forces a commit and starts the next transaction. - The new transaction is never inevitable. See also - stm_should_break_transaction(). */ -void stm_force_transaction_break(stm_thread_local_t *tl); - /* Abort the currently running transaction. This function never returns: it jumps back to the start of the transaction (which must not be inevitable). */ @@ -596,6 +535,10 @@ STM_TRANSACTION_COMMIT, STM_TRANSACTION_ABORT, + /* DETACH/REATTACH is used for leaving/reentering the transactional */ + STM_TRANSACTION_DETACH, + STM_TRANSACTION_REATTACH, + /* inevitable contention: all threads that try to become inevitable have a STM_BECOME_INEVITABLE event with a position marker. Then, if it waits it gets a STM_WAIT_OTHER_INEVITABLE. It is possible @@ -688,6 +631,75 @@ } while (0) + +/* Entering and leaving a "transactional code zone": a (typically very + large) section in the code where we are running a transaction. + This is the STM equivalent to "acquire the GIL" and "release the + GIL", respectively. stm_read(), stm_write(), stm_allocate(), and + other functions should only be called from within a transaction. + + Note that transactions, in the STM sense, cover _at least_ one + transactional code zone. They may be longer; for example, if one + thread does a lot of stm_enter_transactional_zone() + + stm_become_inevitable() + stm_leave_transactional_zone(), as is + typical in a thread that does a lot of C function calls, then we + get only a few bigger inevitable transactions that cover the many + short transactional zones. This is done by having + stm_leave_transactional_zone() turn the current transaction + inevitable and detach it from the running thread (if there is no + other inevitable transaction running so far). Then + stm_enter_transactional_zone() will try to reattach to it. This is + far more efficient than constantly starting and committing + transactions. + + stm_enter_transactional_zone() and stm_leave_transactional_zone() + preserve the value of errno. +*/ +#ifdef STM_DEBUGPRINT +#include +#endif +static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { + intptr_t self = tl->self_or_0_if_atomic; + if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, + self, 0)) { + if (self != 0 && stmcb_timing_event != NULL) { + /* for atomic transactions, we don't emit DETACH/REATTACH */ + stmcb_timing_event(tl, STM_TRANSACTION_REATTACH, NULL); + } +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_enter_transactional_zone fast path\n"); +#endif + } + else { + _stm_reattach_transaction(self); + /* _stm_detached_inevitable_from_thread should be 0 here, but + it can already have been changed from a parallel thread + (assuming we're not inevitable ourselves) */ + } +} +static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { + assert(STM_SEGMENT->running_thread == tl); + if (stm_is_inevitable(tl)) { +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_leave_transactional_zone fast path\n"); +#endif + _stm_detach_inevitable_transaction(tl); + } + else { + _stm_leave_noninevitable_transactional_zone(); + } +} + +/* stm_force_transaction_break() is in theory equivalent to + stm_leave_transactional_zone() immediately followed by + stm_enter_transactional_zone(); however, it is supposed to be + called in CPU-heavy threads that had a transaction run for a while, + and so it *always* forces a commit and starts the next transaction. + The new transaction is never inevitable. See also + stm_should_break_transaction(). */ +void stm_force_transaction_break(stm_thread_local_t *tl); + + /* Support for light finalizers. This is a simple version of finalizers that guarantees not to do anything fancy, like not resurrecting objects. */ From noreply at buildbot.pypy.org Thu Nov 5 08:18:33 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 5 Nov 2015 14:18:33 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: update stm_log tools for new DETACH/REATTACH events Message-ID: <20151105131833.7D67B1C0155@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80545:91fd46a1c483 Date: 2015-11-05 14:19 +0100 http://bitbucket.org/pypy/pypy/changeset/91fd46a1c483/ Log: update stm_log tools for new DETACH/REATTACH events diff --git a/pypy/stm/plot_stm_log.py b/pypy/stm/plot_stm_log.py --- a/pypy/stm/plot_stm_log.py +++ b/pypy/stm/plot_stm_log.py @@ -12,26 +12,33 @@ ########## DRAWING STUFF ########## BOX_HEIGHT = 0.8 -HALF_HEIGHT = 0.1 + BOX_HEIGHT / 2 -QUARTER_HEIGHT = 0.1 + BOX_HEIGHT / 4 +PADDING = 0.1 +HALF_HEIGHT = BOX_HEIGHT / 2 +QUARTER_HEIGHT = HALF_HEIGHT / 2 def plot_boxes(boxes, y, ax): coords = [(x, w) for x, w, c, i in boxes] colors = [c for x, w, c, i in boxes] - bars = ax.broken_barh(coords, (y+0.1, BOX_HEIGHT), + bars = ax.broken_barh(coords, (y + PADDING, BOX_HEIGHT), facecolors=colors, lw=1, edgecolor=(0, 0, 0), picker=True, antialiased=False, rasterized=True) bars.boxes = boxes +__offset = 0 def plot_hlines(hlines, y, ax): - args = [[[x1, x2], [y+HALF_HEIGHT, y+HALF_HEIGHT], color] for - x1, x2, color in hlines] - # flatten: - args = [item for sublist in args for item in sublist] - ax.plot(*args, linewidth=5, antialiased=False, rasterized=True) + global __offset + args = [] + for x1, x2, color in hlines: + arg = [[x1, x2], + 2*[y + 2*PADDING + __offset * QUARTER_HEIGHT], + color] + args.extend(arg) + __offset = (__offset + 1) % 4 + + ax.plot(*args, linewidth=10, antialiased=False, rasterized=True) #################################### @@ -45,8 +52,13 @@ hlines.append((x1, x2, color)) -def add_transaction(boxes, hlines, inited, inevitabled, - ended, aborted, pauses, info=""): +def add_transaction(boxes, hlines, tr): + # get the values: + inited, inevitabled, ended, aborted, pauses, gcs, info = ( + tr.start_time, tr.inevitabled, + tr.stop_time, + tr.aborted, tr.pauses, tr.gcs, + "\n".join(tr.info)) assert inited is not None if inevitabled is not None: @@ -58,7 +70,14 @@ add_box(boxes, inited, ended, 'r', info) for start, end in pauses: - add_hline(hlines, start, end, 'magenta') + if start == end: + print "Warning, start and end of pause match" + add_hline(hlines, start, end, 'darkred') + + for start, end in gcs: + if start == end: + print "Warning, start and end of GC match" + add_hline(hlines, start, end, 'b-.') class Transaction(object): @@ -68,7 +87,29 @@ self.stop_time = 0 self.aborted = False self.pauses = [] + self.gcs = [] self.info = [] + self.inevitabled = None + + +def transaction_start(curr_trs, entry): + if entry.threadnum in curr_trs: + print "WARNING: Start of transaction while there is one already running" + curr_trs[entry.threadnum] = Transaction(entry.threadnum, entry.timestamp) + +def transaction_become_inevitable(curr_trs, entry): + tr = curr_trs.get(entry.threadnum) + if tr is not None: + tr.inevitabled = entry.timestamp + +def transaction_commit(curr_trs, finished_trs, entry): + th_num = entry.threadnum + tr = curr_trs.get(th_num) + if tr is not None: + tr.stop_time = entry.timestamp + xs = finished_trs.setdefault(th_num, []) + xs.append(curr_trs[th_num]) + del curr_trs[th_num] def plot_log(logentries, ax): @@ -78,16 +119,16 @@ th_num = entry.threadnum if entry.event == psl.STM_TRANSACTION_START: - if th_num in curr_trs: - print "WARNING: Start of transaction while there is one already running" - curr_trs[th_num] = Transaction(th_num, entry.timestamp) + transaction_start(curr_trs, entry) + elif entry.event == psl.STM_TRANSACTION_REATTACH: + transaction_start(curr_trs, entry) # for now + transaction_become_inevitable(curr_trs, entry) + elif entry.event == psl.STM_TRANSACTION_DETACH: + transaction_commit(curr_trs, finished_trs, entry) # for now elif entry.event == psl.STM_TRANSACTION_COMMIT: - tr = curr_trs.get(th_num) - if tr is not None: - tr.stop_time = entry.timestamp - xs = finished_trs.setdefault(th_num, []) - xs.append(curr_trs[th_num]) - del curr_trs[th_num] + transaction_commit(curr_trs, finished_trs, entry) + elif entry.event == psl.STM_BECOME_INEVITABLE: + transaction_become_inevitable(curr_trs, entry) elif entry.event == psl.STM_TRANSACTION_ABORT: tr = curr_trs.get(th_num) if tr is not None: @@ -96,8 +137,10 @@ xs = finished_trs.setdefault(th_num, []) xs.append(curr_trs[th_num]) del curr_trs[th_num] - elif entry.event in (psl.STM_WAIT_SYNC_PAUSE, psl.STM_WAIT_CONTENTION, - psl.STM_WAIT_FREE_SEGMENT): + elif entry.event in (psl.STM_WAIT_FREE_SEGMENT, + psl.STM_WAIT_SYNCING, + psl.STM_WAIT_SYNC_PAUSE, + psl.STM_WAIT_OTHER_INEVITABLE): tr = curr_trs.get(th_num) if tr is not None: tr.pauses.append((entry.timestamp, entry.timestamp)) @@ -105,7 +148,14 @@ tr = curr_trs.get(th_num) if tr is not None: tr.pauses[-1] = (tr.pauses[-1][0], entry.timestamp) - + elif entry.event in (psl.STM_GC_MAJOR_START,): # no minor + tr = curr_trs.get(th_num) + if tr is not None: + tr.gcs.append((entry.timestamp, entry.timestamp)) + elif entry.event in (psl.STM_GC_MAJOR_DONE,): + tr = curr_trs.get(th_num) + if tr is not None: + tr.gcs[-1] = (tr.gcs[-1][0], entry.timestamp) # attach logentry as clickable transaction info tr = curr_trs.get(th_num) @@ -115,13 +165,13 @@ tr = finished_trs.get(th_num, [None])[-1] if tr is not None: tr.info.append(str(entry)) - # also affects other transaction: - if entry.marker2: - tr2 = curr_trs.get(entry.otherthreadnum) - if tr2 is None: - tr2 = finished_trs.get(entry.otherthreadnum, [None])[-1] - if tr2 is not None: - tr2.info.append(str(entry)) + # # also affects other transaction: + # if entry.marker2: + # tr2 = curr_trs.get(entry.otherthreadnum) + # if tr2 is None: + # tr2 = finished_trs.get(entry.otherthreadnum, [None])[-1] + # if tr2 is not None: + # tr2.info.append(str(entry)) @@ -136,10 +186,8 @@ boxes = [] hlines = [] for tr in trs: - add_transaction(boxes, hlines, - tr.start_time, None, tr.stop_time, - tr.aborted, tr.pauses, - "\n".join(tr.info)) + add_transaction(boxes, hlines, tr) + plot_boxes(boxes, th_num, ax) plot_hlines(hlines, th_num, ax) print "> Pauses:", len(hlines) @@ -167,7 +215,6 @@ def plot(logentries): global fig - print "Draw..." fig = plt.figure() grid_spec = matplotlib.gridspec.GridSpec(1, 1) diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py --- a/pypy/stm/print_stm_log.py +++ b/pypy/stm/print_stm_log.py @@ -8,32 +8,35 @@ STM_TRANSACTION_COMMIT = 1 STM_TRANSACTION_ABORT = 2 +STM_TRANSACTION_DETACH = 3 +STM_TRANSACTION_REATTACH = 4 + # inevitable contention: all threads that try to become inevitable # have a STM_BECOME_INEVITABLE event with a position marker. Then, # if it waits it gets a STM_WAIT_OTHER_INEVITABLE. It is possible # that a thread gets STM_BECOME_INEVITABLE followed by # STM_TRANSACTION_ABORT if it fails to become inevitable. -STM_BECOME_INEVITABLE = 3 +STM_BECOME_INEVITABLE = 5 # write-read contention: a "marker" is included in the PYPYSTM file # saying where the write was done. Followed by STM_TRANSACTION_ABORT. -STM_CONTENTION_WRITE_READ = 4 +STM_CONTENTION_WRITE_READ = 6 # always one STM_WAIT_xxx followed later by STM_WAIT_DONE or # possibly STM_TRANSACTION_ABORT -STM_WAIT_FREE_SEGMENT = 5 -STM_WAIT_SYNCING = 6 -STM_WAIT_SYNC_PAUSE = 7 -STM_WAIT_OTHER_INEVITABLE = 8 -STM_WAIT_DONE = 9 +STM_WAIT_FREE_SEGMENT = 7 +STM_WAIT_SYNCING = 8 +STM_WAIT_SYNC_PAUSE = 9 +STM_WAIT_OTHER_INEVITABLE = 10 +STM_WAIT_DONE = 11 # start and end of GC cycles -STM_GC_MINOR_START = 10 -STM_GC_MINOR_DONE = 11 -STM_GC_MAJOR_START = 12 -STM_GC_MAJOR_DONE = 13 +STM_GC_MINOR_START = 12 +STM_GC_MINOR_DONE = 13 +STM_GC_MAJOR_START = 14 +STM_GC_MAJOR_DONE = 15 -_STM_EVENT_N = 14 +_STM_EVENT_N = 16 PAUSE_AFTER_ABORT = 0.000001 # usleep(1) after every abort @@ -268,6 +271,11 @@ # if entry.event == STM_TRANSACTION_START: t.transaction_start(entry) + elif entry.event == STM_TRANSACTION_DETACH: + t.transaction_commit(entry) # for now + elif entry.event == STM_TRANSACTION_REATTACH: + t.transaction_start(entry) # for now + t.become_inevitable(entry) elif entry.event == STM_TRANSACTION_COMMIT: t.transaction_commit(entry) elif entry.event == STM_TRANSACTION_ABORT: From noreply at buildbot.pypy.org Thu Nov 5 08:22:35 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 14:22:35 +0100 (CET) Subject: [pypy-commit] stmgc default: Add stm_hashtable_iter*() functions. Contains a bit of delicate logic Message-ID: <20151105132235.DBBA01C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r1964:6d3eb55f21f9 Date: 2015-11-05 14:23 +0100 http://bitbucket.org/pypy/stmgc/changeset/6d3eb55f21f9/ Log: Add stm_hashtable_iter*() functions. Contains a bit of delicate logic to avoid tracing tables repeatedly during minor collection, which I think should be correct but is probably not diff --git a/c8/stm/gcpage.c b/c8/stm/gcpage.c --- a/c8/stm/gcpage.c +++ b/c8/stm/gcpage.c @@ -224,6 +224,9 @@ version and thus don't need tracing. */ static struct list_s *marked_objects_to_trace; +/* a list of hobj/hashtable pairs for all hashtables seen */ +static struct list_s *all_hashtables_seen = NULL; + /* we use the sharing seg0's pages for the GCFLAG_VISITED flag */ static inline struct object_s *mark_loc(object_t *obj) @@ -301,8 +304,6 @@ } -#define TRACE_FOR_MAJOR_COLLECTION (&mark_record_trace) - static void mark_and_trace( object_t *obj, char *segment_base, /* to trace obj in */ @@ -791,6 +792,7 @@ /* marking */ LIST_CREATE(marked_objects_to_trace); + LIST_CREATE(all_hashtables_seen); mark_visit_from_modified_objects(); mark_visit_from_markers(); mark_visit_from_roots(); @@ -815,6 +817,10 @@ sweep_large_objects(); sweep_small_objects(); + /* hashtables */ + stm_compact_hashtables(); + LIST_FREE(all_hashtables_seen); + dprintf((" | used after collection: %ld\n", (long)pages_ctl.total_allocated)); dprintf((" `----------------------------------------------\n")); diff --git a/c8/stm/hashtable.c b/c8/stm/hashtable.c --- a/c8/stm/hashtable.c +++ b/c8/stm/hashtable.c @@ -49,8 +49,12 @@ #define PERTURB_SHIFT 5 #define RESIZING_LOCK 0 -typedef struct { - uintptr_t mask; +#define TRACE_FLAG_OFF 0 +#define TRACE_FLAG_ONCE 1 +#define TRACE_FLAG_KEEPALIVE 2 + +typedef struct stm_hashtable_table_s { + uintptr_t mask; /* 'mask' is always immutable. */ /* 'resize_counter' start at an odd value, and is decremented (by 6) for every new item put in 'items'. When it crosses 0, we @@ -63,6 +67,8 @@ */ uintptr_t resize_counter; + uint8_t trace_flag; + stm_hashtable_entry_t *items[INITIAL_HASHTABLE_SIZE]; } stm_hashtable_table_t; @@ -79,6 +85,7 @@ { table->mask = itemcount - 1; table->resize_counter = itemcount * 4 + 1; + table->trace_flag = TRACE_FLAG_OFF; memset(table->items, 0, itemcount * sizeof(stm_hashtable_entry_t *)); } @@ -162,6 +169,7 @@ assert(biggertable); // XXX stm_hashtable_table_t *table = hashtable->table; + table->trace_flag = TRACE_FLAG_ONCE; table->resize_counter = (uintptr_t)biggertable; /* ^^^ this unlocks the table by writing a non-zero value to table->resize_counter, but the new value is a pointer to the @@ -485,6 +493,41 @@ static void _stm_compact_hashtable(struct object_s *hobj, stm_hashtable_t *hashtable) { + /* Walk the chained list that starts at 'hashtable->initial_table' + and follows the 'resize_counter' fields. Remove all tables + except (1) the initial one, (2) the most recent one, and (3) + the ones on which stm_hashtable_iter_tracefn() was called. + */ + stm_hashtable_table_t *most_recent_table = hashtable->table; + assert(!IS_EVEN(most_recent_table->resize_counter)); + /* set the "don't free me" flag on the most recent table */ + most_recent_table->trace_flag = TRACE_FLAG_KEEPALIVE; + + stm_hashtable_table_t *known_alive = &hashtable->initial_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + /* a KEEPALIVE flag is ignored on the initial table: it is never + individually freed anyway */ + + while (known_alive != most_recent_table) { + uintptr_t rc = known_alive->resize_counter; + assert(IS_EVEN(rc)); + assert(rc != RESIZING_LOCK); + + stm_hashtable_table_t *next_table = (stm_hashtable_table_t *)rc; + if (next_table->trace_flag != TRACE_FLAG_KEEPALIVE) { + /* free this next table and relink the chained list to skip it */ + assert(IS_EVEN(next_table->resize_counter)); + known_alive->resize_counter = next_table->resize_counter; + free(next_table); + } + else { + /* this next table is kept alive */ + known_alive = next_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + } + } + /* done the first part */ + stm_hashtable_table_t *table = hashtable->table; uintptr_t rc = table->resize_counter; assert(!IS_EVEN(rc)); @@ -515,35 +558,24 @@ dprintf(("compact with %ld items:\n", num_entries_times_6 / 6)); _stm_rehash_hashtable(hashtable, count, segnum); } +} - table = hashtable->table; - assert(!IS_EVEN(table->resize_counter)); - - if (table != &hashtable->initial_table) { - uintptr_t rc = hashtable->initial_table.resize_counter; - while (1) { - assert(IS_EVEN(rc)); - assert(rc != RESIZING_LOCK); - - stm_hashtable_table_t *old_table = (stm_hashtable_table_t *)rc; - if (old_table == table) - break; - rc = old_table->resize_counter; - free(old_table); - } - hashtable->initial_table.resize_counter = (uintptr_t)table; - assert(IS_EVEN(hashtable->initial_table.resize_counter)); +static void stm_compact_hashtables(void) +{ + uintptr_t i = all_hashtables_seen->count; + while (i > 0) { + i -= 2; + _stm_compact_hashtable( + (struct object_s *)all_hashtables_seen->items[i], + (stm_hashtable_t *)all_hashtables_seen->items[i + 1]); } } -void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, - void trace(object_t **)) +static void _hashtable_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) { - if (trace == TRACE_FOR_MAJOR_COLLECTION) - _stm_compact_hashtable(hobj, hashtable); - - stm_hashtable_table_t *table; - table = VOLATILE_HASHTABLE(hashtable)->table; + if (table->trace_flag == TRACE_FLAG_ONCE) + table->trace_flag = TRACE_FLAG_OFF; uintptr_t j, mask = table->mask; for (j = 0; j <= mask; j++) { @@ -554,3 +586,105 @@ } } } + +void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, + void trace(object_t **)) +{ + if (all_hashtables_seen != NULL) + all_hashtables_seen = list_append2(all_hashtables_seen, + (uintptr_t)hobj, + (uintptr_t)hashtable); + + _hashtable_tracefn(VOLATILE_HASHTABLE(hashtable)->table, trace); +} + + +/* Hashtable iterators */ + +/* TRACE_FLAG_ONCE: the table must be traced once if it supports an iterator + TRACE_FLAG_OFF: the table is the most recent table, or has already been + traced once + TRACE_FLAG_KEEPALIVE: during major collection only: mark tables that + must be kept alive because there are iterators +*/ + +struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *hashtable) +{ + /* Get the table. No synchronization is needed: we may miss some + entries that are being added, but they would contain NULL in + this segment anyway. */ + return VOLATILE_HASHTABLE(hashtable)->table; +} + +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, struct stm_hashtable_table_s *table, + stm_hashtable_entry_t **previous) +{ + /* Set the read marker on hobj for every item, in case we have + transaction breaks in-between. + */ + stm_read(hobj); + + /* Get the bounds of the part of the 'stm_hashtable_entry_t *' array + that we have to check */ + stm_hashtable_entry_t **pp, **last; + if (previous == NULL) + pp = table->items; + else + pp = previous + 1; + last = table->items + table->mask; + + /* Find the first non-null entry */ + stm_hashtable_entry_t *entry; + + while (pp <= last) { + entry = *(stm_hashtable_entry_t *volatile *)pp; + if (entry != NULL) { + stm_read((object_t *)entry); + if (entry->object != NULL) { + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, pp); + return pp; + } + } + ++pp; + } + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, NULL); + return NULL; +} + +void stm_hashtable_iter_tracefn(struct stm_hashtable_table_s *table, + void trace(object_t **)) +{ + if (all_hashtables_seen == NULL) { /* for minor collections */ + + /* During minor collection, tracing the table is only required + the first time: if it contains young objects, they must be + kept alive and have their address updated. We use + TRACE_FLAG_ONCE to know that. We don't need to do it if + our 'table' is the latest version, because in that case it + will be done by stm_hashtable_tracefn(). That's why + TRACE_FLAG_ONCE is only set when a more recent table is + attached. + + It is only needed once: non-latest-version tables are + immutable. We mark once all the entries as old, and + then these now-old objects stay alive until the next + major collection. + + Checking the flag can be done without synchronization: it + never wrong to call _hashtable_tracefn() too much, and the + only case where it *has to* be called occurs if the + hashtable object is still young (and not seen by other + threads). + */ + if (table->trace_flag == TRACE_FLAG_ONCE) + _hashtable_tracefn(table, trace); + } + else { /* for major collections */ + + /* Set this flag for _stm_compact_hashtable() */ + table->trace_flag = TRACE_FLAG_KEEPALIVE; + } +} diff --git a/c8/stm/hashtable.h b/c8/stm/hashtable.h new file mode 100644 --- /dev/null +++ b/c8/stm/hashtable.h @@ -0,0 +1,2 @@ + +static void stm_compact_hashtables(void); diff --git a/c8/stmgc.c b/c8/stmgc.c --- a/c8/stmgc.c +++ b/c8/stmgc.c @@ -19,6 +19,7 @@ #include "stm/finalizer.h" #include "stm/locks.h" #include "stm/detach.h" +#include "stm/hashtable.h" #include "stm/queue.h" #include "stm/misc.c" diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -767,6 +767,18 @@ object_t *object; }; +/* Hashtable iterators. You get a raw 'table' pointer when you make an + iterator, which you pass to stm_hashtable_iter_next(). When the GC + traces, you must keep the table pointer alive with + stm_hashtable_iter_tracefn(). This may or may not return items added + after stm_hashtable_iter() was called. */ +struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *); +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, struct stm_hashtable_table_s *table, + stm_hashtable_entry_t **previous); +void stm_hashtable_iter_tracefn(struct stm_hashtable_table_s *table, + void trace(object_t **)); + /* Queues. The items you put() and get() back are in random order. Like hashtables, the type 'stm_queue_t' is not an object type at diff --git a/c8/test/support.py b/c8/test/support.py --- a/c8/test/support.py +++ b/c8/test/support.py @@ -222,6 +222,15 @@ long _stm_hashtable_list(object_t *o, stm_hashtable_t *h, object_t *entries); +object_t *_hashtable_iter(stm_hashtable_t *); +stm_hashtable_entry_t *_hashtable_iter_next(object_t *, object_t *); +struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *); +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, struct stm_hashtable_table_s *table, + stm_hashtable_entry_t **previous); +void stm_hashtable_iter_tracefn(struct stm_hashtable_table_s *table, + void trace(object_t **)); + void _set_hashtable(object_t *obj, stm_hashtable_t *h); stm_hashtable_t *_get_hashtable(object_t *obj); uintptr_t _get_entry_index(stm_hashtable_entry_t *entry); @@ -419,6 +428,37 @@ return stm_hashtable_list(o, h, NULL); } +struct myiter_s { + struct myobj_s common; + struct stm_hashtable_table_s *table; + stm_hashtable_entry_t **previous; +}; +typedef TLPREFIX struct myiter_s myiter_t; + +object_t *_hashtable_iter(stm_hashtable_t *h) +{ + myiter_t *iter = (myiter_t *)stm_allocate(sizeof(myiter_t)); + _set_type_id(&iter->common.hdr, 421416); + iter->table = stm_hashtable_iter(h); + iter->previous = NULL; + return (object_t *)iter; +} + +stm_hashtable_entry_t *_hashtable_iter_next(object_t *hobj, object_t *iterobj) +{ + stm_write(iterobj); + myiter_t *iter = (myiter_t *)iterobj; + assert(iter->common.type_id == 421416); + stm_hashtable_entry_t **pentry; + pentry = stm_hashtable_iter_next(hobj, iter->table, iter->previous); + if (pentry == NULL) + return NULL; + iter->previous = pentry; + //fprintf(stderr, "\tcontaining %p: index=%ld, object=%p\n", + // *pentry, (*pentry)->index, (*pentry)->object); + return *pentry; +} + void _set_queue(object_t *obj, stm_queue_t *q) { @@ -478,6 +518,9 @@ if (myobj->type_id == 421417) { /* queue */ return sizeof(struct myobj_s) + 1 * sizeof(void*); } + if (myobj->type_id == 421416) { /* hashtable iterator */ + return sizeof(struct myobj_s) + 2 * sizeof(void*); + } /* basic case: tid equals 42 plus the size of the object */ assert(myobj->type_id >= 42 + sizeof(struct myobj_s)); assert((myobj->type_id - 42) >= 16); @@ -514,6 +557,13 @@ stm_queue_tracefn(q, visit); return; } + if (myobj->type_id == 421416) { + /* hashtable iterator */ + struct stm_hashtable_table_s *table; + table = *(struct stm_hashtable_table_s **)(myobj + 1); + stm_hashtable_iter_tracefn(table, visit); + return; + } if (myobj->type_id < 421420) { /* basic case: no references */ return; @@ -538,6 +588,7 @@ assert(myobj->type_id != 421419); assert(myobj->type_id != 421418); assert(myobj->type_id != 421417); + assert(myobj->type_id != 421416); if (myobj->type_id < 421420) { /* basic case: no references */ return; @@ -557,6 +608,7 @@ assert(myobj->type_id != 421419); assert(myobj->type_id != 421418); assert(myobj->type_id != 421417); + assert(myobj->type_id != 421416); if (myobj->type_id < 421420) { offset_itemsize[0] = SIZEOF_MYOBJ; offset_itemsize[1] = 1; @@ -699,6 +751,12 @@ lib._set_hashtable(o, h) return o +def hashtable_iter(hobj): + return lib._hashtable_iter(get_hashtable(hobj)) + +def hashtable_iter_next(hobj, o): + return lib._hashtable_iter_next(hobj, o) + def hashtable_lookup(hto, ht, idx): return ffi.cast("object_t*", lib.stm_hashtable_lookup(hto, ht, idx)) diff --git a/c8/test/test_hashtable.py b/c8/test/test_hashtable.py --- a/c8/test/test_hashtable.py +++ b/c8/test/test_hashtable.py @@ -455,8 +455,96 @@ stm_major_collect() self.commit_transaction() + def test_iter_direct(self): + self.start_transaction() + h = self.allocate_hashtable() + tl0 = self.tls[self.current_thread] + expected = [] + for i in range(29): + lp = stm_allocate(32) + htset(h, 19 ^ i, lp, tl0) + expected.append((19 ^ i, lp)) + table = lib.stm_hashtable_iter(get_hashtable(h)) + previous = ffi.NULL + seen = [] + while True: + next_pentry = lib.stm_hashtable_iter_next(h, table, previous) + if next_pentry == ffi.NULL: + break + previous = next_pentry + entry = next_pentry[0] + seen.append((lib._get_entry_index(entry), + lib._get_entry_object(entry))) + assert len(seen) == 29 + assert sorted(seen) == sorted(expected) + def test_iter_object(self): + self.start_transaction() + h = self.allocate_hashtable() + tl0 = self.tls[self.current_thread] + expected = [] + for i in range(29): + lp = stm_allocate(32) + htset(h, 19 ^ i, lp, tl0) + expected.append((19 ^ i, lp)) + iterobj = hashtable_iter(h) + seen = [] + while True: + entry = hashtable_iter_next(h, iterobj) + if entry == ffi.NULL: + break + seen.append((lib._get_entry_index(entry), + lib._get_entry_object(entry))) + assert len(seen) == 29 + assert sorted(seen) == sorted(expected) + def test_iter_collections(self): + def advance(iterobj, seen): + entry = hashtable_iter_next(h, iterobj) + if entry == ffi.NULL: + seen.add('DONE') + else: + item = (lib._get_entry_index(entry), + lib._get_entry_object(entry)) + assert htget(h, item[0]) == item[1] + assert item[0] not in seen + seen.add(item[0]) + + self.start_transaction() + h = self.allocate_hashtable() + tl0 = self.tls[self.current_thread] + iterators = [] + for i in range(250): + lp = stm_allocate(32) + htset(h, 19 ^ i, lp, tl0) + iterators.append((hashtable_iter(h), i, set())) + + iterobj, _, seen = random.choice(iterators) + if 'DONE' not in seen: + advance(iterobj, seen) + + self.push_root(h) + for iterobj, _, _ in iterators: + self.push_root(iterobj) + if i % 49 == 48: + stm_major_collect() + elif i % 7 == 6: + stm_minor_collect() + for i, prev in reversed(list(enumerate(iterators))): + iterators[i] = (self.pop_root(),) + prev[1:] + h = self.pop_root() + + for iterobj, _, seen in iterators: + while 'DONE' not in seen: + advance(iterobj, seen) + + maximum = set([j ^ 19 for j in range(250)]) + maximum.add('DONE') + for iterobj, i, seen in iterators: + assert seen.issubset(maximum) + for j in range(i): + assert j ^ 19 in seen + # we may also have seen more items added later class TestRandomHashtable(BaseTestHashtable): From noreply at buildbot.pypy.org Thu Nov 5 08:34:20 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 5 Nov 2015 14:34:20 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: print some more statistics Message-ID: <20151105133420.95E511C0352@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80546:1ae8e80dce84 Date: 2015-11-05 14:35 +0100 http://bitbucket.org/pypy/pypy/changeset/1ae8e80dce84/ Log: print some more statistics diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py --- a/pypy/stm/print_stm_log.py +++ b/pypy/stm/print_stm_log.py @@ -103,6 +103,8 @@ self.cpu_time_paused = 0.0 self.cpu_time_gc_minor = 0.0 self.cpu_time_gc_major = 0.0 + self.count_committed = 0 + self.count_aborted = 0 self._prev = (0.0, "stop") self._in_major_coll = None self.reset_counters() @@ -133,11 +135,13 @@ self.progress(entry.timestamp, "stop") self.cpu_time_committed += self._transaction_cpu_time self.cpu_time_paused += self._transaction_pause_time + self.count_committed += 1 def transaction_abort(self, entry): self.progress(entry.timestamp, "stop") self.cpu_time_aborted += self._transaction_cpu_time self.cpu_time_paused += self._transaction_pause_time + self.count_aborted += 1 def become_inevitable(self, entry): self.progress(entry.timestamp, "run") @@ -335,6 +339,14 @@ total_cpu_time_gc_minor, percent(total_cpu_time_gc_minor, total_time)) print ' and %9.3fs (%4s) major GC collections' % ( total_cpu_time_gc_major, percent(total_cpu_time_gc_major, total_time)) + total_committed, total_aborted = stmlog.get_transaction_statistics() + total_transactions = total_committed + total_aborted + transactions_per_second = total_transactions / total_cpu_time_total + print 'Total number of transactions: %6.f committed: %4s aborted: %4s' % ( + total_transactions, percent(total_committed, total_transactions), + percent(total_aborted, total_transactions)) + print ' transactions per second: %6.f' % ( + transactions_per_second) print # values = stmlog.get_conflicts() @@ -356,6 +368,11 @@ def __init__(self, filename): summarize_log_entries(parse_log(filename), self) + def get_transaction_statistics(self): + aborted = sum([v.count_aborted for v in self.threads.values()]) + committed = sum([v.count_committed for v in self.threads.values()]) + return (committed, aborted) + def get_total_cpu_time_committed(self): return sum([v.cpu_time_committed for v in self.threads.values()]) From noreply at buildbot.pypy.org Thu Nov 5 08:39:48 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 14:39:48 +0100 (CET) Subject: [pypy-commit] stmgc default: More comments Message-ID: <20151105133948.4DBF91C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r1965:712690ddffd5 Date: 2015-11-05 14:40 +0100 http://bitbucket.org/pypy/stmgc/changeset/712690ddffd5/ Log: More comments diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -767,11 +767,13 @@ object_t *object; }; -/* Hashtable iterators. You get a raw 'table' pointer when you make an - iterator, which you pass to stm_hashtable_iter_next(). When the GC - traces, you must keep the table pointer alive with - stm_hashtable_iter_tracefn(). This may or may not return items added - after stm_hashtable_iter() was called. */ +/* Hashtable iterators. You get a raw 'table' pointer when you make + an iterator, which you pass to stm_hashtable_iter_next(). This may + or may not return items added after stm_hashtable_iter() was + called; there is no logic so far to detect changes (unlike Python's + RuntimeError). When the GC traces, you must keep the table pointer + alive with stm_hashtable_iter_tracefn(). The original hashtable + object must also be kept alive. */ struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *); stm_hashtable_entry_t ** stm_hashtable_iter_next(object_t *hobj, struct stm_hashtable_table_s *table, From noreply at buildbot.pypy.org Thu Nov 5 09:00:19 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 15:00:19 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151105140019.EAC791C071E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r652:0ce3357d6c23 Date: 2015-11-05 15:01 +0100 http://bitbucket.org/pypy/pypy.org/changeset/0ce3357d6c23/ Log: update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -9,13 +9,13 @@ - $60818 of $105000 (57.9%) + $61221 of $105000 (58.3%)
    @@ -23,7 +23,7 @@
  • diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -9,7 +9,7 @@ @@ -17,7 +17,7 @@ 2nd call: - $29577 of $80000 (37.0%) + $29678 of $80000 (37.1%)
    @@ -25,7 +25,7 @@
  • From noreply at buildbot.pypy.org Thu Nov 5 10:35:24 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 5 Nov 2015 16:35:24 +0100 (CET) Subject: [pypy-commit] pypy py3.3: self.ext... was not enough, access the module _imp stored in self.imp instead Message-ID: <20151105153524.6EA9D1C0155@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: py3.3 Changeset: r80547:b22b2972eec4 Date: 2015-11-05 15:36 +0100 http://bitbucket.org/pypy/pypy/changeset/b22b2972eec4/ Log: self.ext... was not enough, access the module _imp stored in self.imp instead diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py --- a/pypy/module/imp/test/test_app.py +++ b/pypy/module/imp/test/test_app.py @@ -74,7 +74,7 @@ assert type == 'rb' def test_ext_suffixes(self): - for suffix in self.extension_suffixes(): + for suffix in self.imp.extension_suffixes(): assert suffix.endswith(('.pyd', '.so')) def test_obscure_functions(self): From noreply at buildbot.pypy.org Thu Nov 5 10:35:26 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 5 Nov 2015 16:35:26 +0100 (CET) Subject: [pypy-commit] pypy py3.3: need to write size (32 bits) just after timestamp Message-ID: <20151105153526.890EB1C0155@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: py3.3 Changeset: r80548:c389c7b3f1ae Date: 2015-11-05 16:25 +0100 http://bitbucket.org/pypy/pypy/changeset/c389c7b3f1ae/ Log: need to write size (32 bits) just after timestamp diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py --- a/pypy/module/imp/test/test_app.py +++ b/pypy/module/imp/test/test_app.py @@ -28,6 +28,7 @@ f = open('@TEST.pyc', 'wb') f.write(imp.get_magic()) f.write(b'\x00\x00\x00\x00') + f.write(b'\x00\x00\x00\x00') marshal.dump(co, f) f.close() return '@TEST.pyc' From noreply at buildbot.pypy.org Thu Nov 5 10:35:28 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 5 Nov 2015 16:35:28 +0100 (CET) Subject: [pypy-commit] pypy py3.3: charming the null importer works missed the positional argument, fixed the test Message-ID: <20151105153528.918C51C0155@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: py3.3 Changeset: r80549:c5b84e7e1e4e Date: 2015-11-05 16:30 +0100 http://bitbucket.org/pypy/pypy/changeset/c5b84e7e1e4e/ Log: charming the null importer works missed the positional argument, fixed the test diff --git a/lib-python/3/imp.py b/lib-python/3/imp.py --- a/lib-python/3/imp.py +++ b/lib-python/3/imp.py @@ -73,7 +73,7 @@ elif os.path.isdir(path): raise ImportError('existing directory', path=path) - def find_module(self, fullname): + def find_module(self, fullname, path=None): """Always returns None.""" return None diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py --- a/pypy/module/imp/test/test_app.py +++ b/pypy/module/imp/test/test_app.py @@ -160,7 +160,7 @@ def test_nullimporter(self): import os, imp importer = imp.NullImporter("path") - assert importer.find_module(1, 2, 3, 4) is None + assert importer.find_module(1, [2, 3, 4]) is None raises(ImportError, imp.NullImporter, os.getcwd()) def test_path_importer_cache(self): From noreply at buildbot.pypy.org Thu Nov 5 11:10:59 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 5 Nov 2015 17:10:59 +0100 (CET) Subject: [pypy-commit] stmgc default: 6397419657be done better (DETACH/REATTACH events) Message-ID: <20151105161059.81F791C13C6@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r1966:28751d82e012 Date: 2015-11-05 17:12 +0100 http://bitbucket.org/pypy/stmgc/changeset/28751d82e012/ Log: 6397419657be done better (DETACH/REATTACH events) diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -1374,6 +1374,8 @@ from its segment. Better do it as soon as possible, because other threads might be spin-looping, waiting for the -1 to disappear. */ + /* but first, emit commit-event of this thread: */ + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_COMMIT); STM_SEGMENT->running_thread = NULL; write_fence(); assert(_stm_detached_inevitable_from_thread == -1); diff --git a/c8/stm/detach.c b/c8/stm/detach.c --- a/c8/stm/detach.c +++ b/c8/stm/detach.c @@ -127,6 +127,7 @@ // XXX: not sure if the next line is a good idea tl->last_associated_segment_num = remote_seg_num; ensure_gs_register(remote_seg_num); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); } dprintf(("reattach_transaction: start a new transaction\n")); @@ -185,6 +186,7 @@ assert(segnum > 0); ensure_gs_register(segnum); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); ensure_gs_register(mysegnum); } diff --git a/c8/stm/finalizer.c b/c8/stm/finalizer.c --- a/c8/stm/finalizer.c +++ b/c8/stm/finalizer.c @@ -501,7 +501,17 @@ /* XXX: become inevitable, bc. otherwise, we would need to keep around the original g_finalizers.run_finalizers to restore it in case of an abort. */ - _stm_become_inevitable("finalizer-Tx"); + _stm_become_inevitable(MSG_INEV_DONT_SLEEP); + /* did it work? */ + if (STM_PSEGMENT->transaction_state != TS_INEVITABLE) { /* no */ + /* avoid blocking here, waiting for another INEV transaction. + If we did that, application code could not proceed (start the + next transaction) and it will not be obvious from the profile + why we were WAITing. */ + _stm_commit_transaction(); + stm_rewind_jmp_leaveframe(tl, &rjbuf); + return; + } while (__sync_lock_test_and_set(&g_finalizers.lock, 1) != 0) { /* somebody is adding more finalizers (_commit_finalizer()) */ diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -100,8 +100,8 @@ #define _stm_detach_inevitable_transaction(tl) do { \ write_fence(); \ assert(_stm_detached_inevitable_from_thread == 0); \ - if (stmcb_timing_event != NULL) \ - {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ + if (stmcb_timing_event != NULL && tl->self_or_0_if_atomic != 0) \ + {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ _stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \ } while (0) void _stm_reattach_transaction(intptr_t); From noreply at buildbot.pypy.org Thu Nov 5 12:34:52 2015 From: noreply at buildbot.pypy.org (fijal) Date: Thu, 5 Nov 2015 18:34:52 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: in progress Message-ID: <20151105173452.855001C0155@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80550:1b09a35e77d4 Date: 2015-11-04 19:56 +0000 http://bitbucket.org/pypy/pypy/changeset/1b09a35e77d4/ Log: in progress diff --git a/rpython/memory/gctransform/shadowstack.py b/rpython/memory/gctransform/shadowstack.py --- a/rpython/memory/gctransform/shadowstack.py +++ b/rpython/memory/gctransform/shadowstack.py @@ -74,6 +74,7 @@ self.decr_stack = decr_stack def walk_stack_root(callback, start, end): + # shadowstack[0] contains the vmprof stack gc = self.gc addr = end addr -= sizeofaddr @@ -283,6 +284,7 @@ def start_fresh_new_state(self): self.gcdata.root_stack_base = self.unused_full_stack + # shadowstack[0] contains the vmprof stack self.gcdata.root_stack_top = self.unused_full_stack + sizeofaddr self.unused_full_stack = llmemory.NULL @@ -310,6 +312,7 @@ SHADOWSTACKREFPTR.TO.become(SHADOWSTACKREF) def customtrace(gc, obj, callback, arg): + # we intentionally don't read shadowstack[0] obj = llmemory.cast_adr_to_ptr(obj, SHADOWSTACKREFPTR) addr = obj.top start = obj.base diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -86,6 +86,39 @@ return llmemory.GCREF raise NotImplementedError(repr(tok)) +def token2ctype(tok): + if tok == 'i': + return 'long' + elif tok == 'r': + return 'void*' + elif tok == 'f': + return 'double' + else: + raise NotImplementedError(repr(tok)) + +def make_c_trampoline_function(name, func, token, restok): + cont_name = 'rpyvmprof_f_%s_%s' % (name, token) + tramp_name = 'rpyvmprof_t_%s_%s' % (name, token) + + func.c_name = cont_name + func._dont_inline_ = True + + assert detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64), ( + "rvmprof only supports x86-64 CPUs for now") + + llargs = ", ".join([token2ctype(x) for x in token]) + type = token2ctype(restok) + target = udir.join('module_cache') + target.ensure(dir=1) + target = target.join('trampoline_%s_%s.vmprof.c' % (name, token)) + target.write(""" +#include + +%(type)s %(tramp_name)s(%(llargs)s) +{ +} +""" % locals()) + def make_trampoline_function(name, func, token, restok): from rpython.jit.backend import detect_cpu diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -4,7 +4,8 @@ from rpython.rlib.rvmprof import cintf from rpython.rtyper.annlowlevel import cast_instance_to_gcref from rpython.rtyper.annlowlevel import cast_base_ptr_to_instance -from rpython.rtyper.lltypesystem import rffi +from rpython.rtyper.lltypesystem import rffi, llmemory +from rpython.rtyper.lltypesystem.lloperation import llop MAX_FUNC_NAME = 1023 @@ -168,13 +169,16 @@ return (ll_arg,) + ll_args, tok + token @specialize.memo() - def get_ll_trampoline(token): + def get_ll_trampoline(token, c_version=False): """ Used by the trampoline-version only """ if result_class is None: restok = "i" else: restok = "r" + if c_version: + return cintf.make_c_trampoline_function(name, func, token, + restok) return cintf.make_trampoline_function(name, func, token, restok) def decorated_function(*args): @@ -194,20 +198,21 @@ ll_args, token = lower(*args) ll_trampoline = get_ll_trampoline(token) ll_result = ll_trampoline(*ll_args + (unique_id,)) - if result_class is not None: - return cast_base_ptr_to_instance(result_class, ll_result) - else: - return ll_result else: return func(*args) else: # this is the case of the stack - unique_id = get_code_fn(*args)._vmprof_unique_id - _vmprof.cintf.vmprof_stack_append(_vmprof._stack, unique_id) - try: - res = func(*args) - finally: - _vmprof.cintf.vmprof_stack_pop(_vmprof._stack) - return res + if we_are_translated() and not jit.we_are_jitted(): + unique_id = get_code_fn(*args)._vmprof_unique_id + shadowstack_0 = llop.gc_adr_of_root_stack_base(llmemory.Address) + ll_args, token = lower(*args) + ll_trampoline = get_ll_trampoline(token, True) + ll_result = ll_trampoline(*ll_args + (unique_id, shadowstack_0)) + else: + return func(*args) + if result_class is not None: + return cast_base_ptr_to_instance(result_class, ll_result) + else: + return ll_result decorated_function.__name__ = func.__name__ + '_rvmprof' return decorated_function diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h --- a/rpython/rlib/rvmprof/src/vmprof_stack.h +++ b/rpython/rlib/rvmprof/src/vmprof_stack.h @@ -2,6 +2,10 @@ #define STACK_SIZE 8192 #include +typedef stuct vmprof_stack { + +} vmprof_stack; + typedef struct vmprof_stack { volatile long stack_depth; long stack_items[STACK_SIZE]; From noreply at buildbot.pypy.org Thu Nov 5 12:34:54 2015 From: noreply at buildbot.pypy.org (fijal) Date: Thu, 5 Nov 2015 18:34:54 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: progress Message-ID: <20151105173454.A3D911C0155@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80551:ea3aa700ca28 Date: 2015-11-05 17:35 +0000 http://bitbucket.org/pypy/pypy/changeset/ea3aa700ca28/ Log: progress diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -52,22 +52,11 @@ vmprof_register_virtual_function = rffi.llexternal( "vmprof_register_virtual_function", [rffi.CCHARP, rffi.LONG, rffi.INT], - rffi.INT, compilation_info=eci, - _nowrapper=True) + rffi.INT, compilation_info=eci) vmprof_ignore_signals = rffi.llexternal("vmprof_ignore_signals", [rffi.INT], lltype.Void, compilation_info=eci, _nowrapper=True) - vmprof_stack_new = rffi.llexternal("vmprof_stack_new", - [], rffi.VOIDP, compilation_info=eci, _nowrapper=True) - vmprof_stack_append = rffi.llexternal("vmprof_stack_append", - [rffi.VOIDP, lltype.Signed], rffi.INT, compilation_info=eci, - _nowrapper=True) - vmprof_stack_pop = rffi.llexternal("vmprof_stack_pop", - [rffi.VOIDP], lltype.Signed, compilation_info=eci, - _nowrapper=True) - vmprof_stack_free = rffi.llexternal("vmprof_stack_free", - [rffi.VOIDP], lltype.Void, compilation_info=eci, _nowrapper=True) return CInterface(locals()) @@ -106,18 +95,36 @@ assert detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64), ( "rvmprof only supports x86-64 CPUs for now") - llargs = ", ".join([token2ctype(x) for x in token]) + llargs = ", ".join(["%s arg%d" % (token2ctype(x), i) for i, x in + enumerate(token)]) type = token2ctype(restok) target = udir.join('module_cache') target.ensure(dir=1) + argnames = ", ".join(["arg%d" % i for i in range(len(token))]) target = target.join('trampoline_%s_%s.vmprof.c' % (name, token)) target.write(""" -#include +typedef struct vmprof_stack { + struct vmprof_stack* next; + long value; +}; -%(type)s %(tramp_name)s(%(llargs)s) +%(type)s %(cont_name)s(%(llargs)s); + +%(type)s %(tramp_name)s(%(llargs)s, long unique_id, void** shadowstack_base) { + %(type)s result; + struct vmprof_stack node; + + node.value = unique_id; + node.next = (struct vmprof_stack*)shadowstack_base[0]; + shadowstack_base[0] = (void*)(&node); + result = %(cont_name)s(%(argnames)s); + shadowstack_base[0] = node.next; + return result; } """ % locals()) + return finish_ll_trampoline(tramp_name, tramp_name, target, token, + restok, True) def make_trampoline_function(name, func, token, restok): from rpython.jit.backend import detect_cpu @@ -183,18 +190,19 @@ \t.cfi_endproc %(size_decl)s """ % locals()) + return finish_ll_trampoline(orig_tramp_name, tramp_name, target, token, + restok, False) - def tok2cname(tok): - if tok == 'i': - return 'long' - if tok == 'r': - return 'void *' - raise NotImplementedError(repr(tok)) +def finish_ll_trampoline(orig_tramp_name, tramp_name, target, token, restok, + accepts_shadowstack): + extra_args = ['long'] + if accepts_shadowstack: + extra_args.append("void*") header = 'RPY_EXTERN %s %s(%s);\n' % ( - tok2cname(restok), + token2ctype(restok), orig_tramp_name, - ', '.join([tok2cname(tok) for tok in token] + ['long'])) + ', '.join([token2ctype(tok) for tok in token] + extra_args)) header += """\ static int cmp_%s(void *addr) { @@ -214,9 +222,11 @@ separate_module_files = [str(target)], ) + ARGS = [token2lltype(tok) for tok in token] + [lltype.Signed] + if accepts_shadowstack: + ARGS.append(llmemory.Address) return rffi.llexternal( - orig_tramp_name, - [token2lltype(tok) for tok in token] + [lltype.Signed], + orig_tramp_name, ARGS, token2lltype(restok), compilation_info=eci, _nowrapper=True, sandboxsafe=True, diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -32,8 +32,7 @@ else: self._code_unique_id = 0x7000000000000000 self.cintf = cintf.setup() - self._stack = self.cintf.vmprof_stack_new() - + def _cleanup_(self): self.is_enabled = False @@ -148,7 +147,7 @@ """ def decorate(func): try: - _vmprof = _get_vmprof() + _get_vmprof() except cintf.VMProfPlatformUnsupported: return func diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h --- a/rpython/rlib/rvmprof/src/vmprof_main.h +++ b/rpython/rlib/rvmprof/src/vmprof_main.h @@ -37,7 +37,6 @@ #include "vmprof_unwind.h" #endif #include "vmprof_mt.h" -#include "vmprof_stack.h" /************************************************************/ @@ -210,7 +209,12 @@ * ************************************************************* */ -static int get_stack_trace(void** result, int max_depth, ucontext_t *ucontext) +static int get_stack_trace(void **result, int max_depth, ucontext_t *ucontext) +{ + return 0; +} + +static int xxx_get_stack_trace(void** result, int max_depth, ucontext_t *ucontext) { void *ip; int n = 0; diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h deleted file mode 100644 --- a/rpython/rlib/rvmprof/src/vmprof_stack.h +++ /dev/null @@ -1,46 +0,0 @@ - -#define STACK_SIZE 8192 -#include - -typedef stuct vmprof_stack { - -} vmprof_stack; - -typedef struct vmprof_stack { - volatile long stack_depth; - long stack_items[STACK_SIZE]; -} vmprof_stack; - -RPY_EXTERN void *vmprof_stack_new(void) -{ - vmprof_stack* stack = (vmprof_stack *)malloc(sizeof(vmprof_stack)); - stack->stack_depth = 0; - return (void*)stack; -} - -RPY_EXTERN int vmprof_stack_append(void *_stack, long item) -{ - vmprof_stack* stack = (vmprof_stack*)_stack; - if (stack->stack_depth >= STACK_SIZE - 1) - return -1; - stack->stack_items[stack->stack_depth] = item; - stack->stack_depth += 1; - return 0; -} - -RPY_EXTERN long vmprof_stack_pop(void *_stack) -{ - vmprof_stack* stack = (vmprof_stack*)_stack; - long res; - - if (stack->stack_depth <= 0) - return -1; - res = stack->stack_items[stack->stack_depth]; - stack->stack_depth -= 1; - return res; -} - -RPY_EXTERN void vmprof_stack_free(void* stack) -{ - free(stack); -} \ No newline at end of file diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py --- a/rpython/rlib/rvmprof/test/test_rvmprof.py +++ b/rpython/rlib/rvmprof/test/test_rvmprof.py @@ -25,7 +25,7 @@ return 0 assert f() == 0 - fn = compile(f, []) + fn = compile(f, [], gcpolicy="minimark") assert fn() == 0 @@ -53,7 +53,7 @@ return 0 assert f() == 0 - fn = compile(f, []) + fn = compile(f, [], gcpolicy="minimark") assert fn() == 0 @@ -79,7 +79,7 @@ return 0 assert f() == 0 - fn = compile(f, []) + fn = compile(f, [], gcpolicy="minimark") assert fn() == 0 From noreply at buildbot.pypy.org Thu Nov 5 13:02:19 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 19:02:19 +0100 (CET) Subject: [pypy-commit] stmgc default: tweaks Message-ID: <20151105180219.684C71C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r1967:ae2c337fc0ae Date: 2015-11-05 17:38 +0100 http://bitbucket.org/pypy/stmgc/changeset/ae2c337fc0ae/ Log: tweaks diff --git a/c8/stm/hashtable.c b/c8/stm/hashtable.c --- a/c8/stm/hashtable.c +++ b/c8/stm/hashtable.c @@ -53,7 +53,7 @@ #define TRACE_FLAG_ONCE 1 #define TRACE_FLAG_KEEPALIVE 2 -typedef struct stm_hashtable_table_s { +struct stm_hashtable_table_s { uintptr_t mask; /* 'mask' is always immutable. */ /* 'resize_counter' start at an odd value, and is decremented (by @@ -70,7 +70,7 @@ uint8_t trace_flag; stm_hashtable_entry_t *items[INITIAL_HASHTABLE_SIZE]; -} stm_hashtable_table_t; +}; #define IS_EVEN(p) (((p) & 1) == 0) @@ -617,7 +617,7 @@ } stm_hashtable_entry_t ** -stm_hashtable_iter_next(object_t *hobj, struct stm_hashtable_table_s *table, +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, stm_hashtable_entry_t **previous) { /* Set the read marker on hobj for every item, in case we have @@ -654,7 +654,7 @@ return NULL; } -void stm_hashtable_iter_tracefn(struct stm_hashtable_table_s *table, +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, void trace(object_t **)) { if (all_hashtables_seen == NULL) { /* for minor collections */ diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -774,11 +774,12 @@ RuntimeError). When the GC traces, you must keep the table pointer alive with stm_hashtable_iter_tracefn(). The original hashtable object must also be kept alive. */ -struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *); +typedef struct stm_hashtable_table_s stm_hashtable_table_t; +stm_hashtable_table_t *stm_hashtable_iter(stm_hashtable_t *); stm_hashtable_entry_t ** -stm_hashtable_iter_next(object_t *hobj, struct stm_hashtable_table_s *table, +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, stm_hashtable_entry_t **previous); -void stm_hashtable_iter_tracefn(struct stm_hashtable_table_s *table, +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, void trace(object_t **)); diff --git a/c8/test/test_hashtable.py b/c8/test/test_hashtable.py --- a/c8/test/test_hashtable.py +++ b/c8/test/test_hashtable.py @@ -542,7 +542,7 @@ maximum.add('DONE') for iterobj, i, seen in iterators: assert seen.issubset(maximum) - for j in range(i): + for j in range(i + 1): assert j ^ 19 in seen # we may also have seen more items added later From noreply at buildbot.pypy.org Thu Nov 5 13:02:21 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 19:02:21 +0100 (CET) Subject: [pypy-commit] stmgc default: merge heads Message-ID: <20151105180221.6A6B71C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r1968:72facb6e4533 Date: 2015-11-05 19:03 +0100 http://bitbucket.org/pypy/stmgc/changeset/72facb6e4533/ Log: merge heads diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -1374,6 +1374,8 @@ from its segment. Better do it as soon as possible, because other threads might be spin-looping, waiting for the -1 to disappear. */ + /* but first, emit commit-event of this thread: */ + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_COMMIT); STM_SEGMENT->running_thread = NULL; write_fence(); assert(_stm_detached_inevitable_from_thread == -1); diff --git a/c8/stm/detach.c b/c8/stm/detach.c --- a/c8/stm/detach.c +++ b/c8/stm/detach.c @@ -127,6 +127,7 @@ // XXX: not sure if the next line is a good idea tl->last_associated_segment_num = remote_seg_num; ensure_gs_register(remote_seg_num); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); } dprintf(("reattach_transaction: start a new transaction\n")); @@ -185,6 +186,7 @@ assert(segnum > 0); ensure_gs_register(segnum); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); ensure_gs_register(mysegnum); } diff --git a/c8/stm/finalizer.c b/c8/stm/finalizer.c --- a/c8/stm/finalizer.c +++ b/c8/stm/finalizer.c @@ -501,7 +501,17 @@ /* XXX: become inevitable, bc. otherwise, we would need to keep around the original g_finalizers.run_finalizers to restore it in case of an abort. */ - _stm_become_inevitable("finalizer-Tx"); + _stm_become_inevitable(MSG_INEV_DONT_SLEEP); + /* did it work? */ + if (STM_PSEGMENT->transaction_state != TS_INEVITABLE) { /* no */ + /* avoid blocking here, waiting for another INEV transaction. + If we did that, application code could not proceed (start the + next transaction) and it will not be obvious from the profile + why we were WAITing. */ + _stm_commit_transaction(); + stm_rewind_jmp_leaveframe(tl, &rjbuf); + return; + } while (__sync_lock_test_and_set(&g_finalizers.lock, 1) != 0) { /* somebody is adding more finalizers (_commit_finalizer()) */ diff --git a/c8/stmgc.h b/c8/stmgc.h --- a/c8/stmgc.h +++ b/c8/stmgc.h @@ -100,8 +100,8 @@ #define _stm_detach_inevitable_transaction(tl) do { \ write_fence(); \ assert(_stm_detached_inevitable_from_thread == 0); \ - if (stmcb_timing_event != NULL) \ - {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ + if (stmcb_timing_event != NULL && tl->self_or_0_if_atomic != 0) \ + {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ _stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \ } while (0) void _stm_reattach_transaction(intptr_t); From noreply at buildbot.pypy.org Thu Nov 5 13:27:07 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 19:27:07 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: A branch to implement and test stm dict iterators Message-ID: <20151105182707.A93A01C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80552:997744ce33cb Date: 2015-11-05 19:26 +0100 http://bitbucket.org/pypy/pypy/changeset/997744ce33cb/ Log: A branch to implement and test stm dict iterators From noreply at buildbot.pypy.org Thu Nov 5 13:27:09 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 19:27:09 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: Iterators on hashtables Message-ID: <20151105182709.B1DC91C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80553:47629bb038b7 Date: 2015-11-05 19:27 +0100 http://bitbucket.org/pypy/pypy/changeset/47629bb038b7/ Log: Iterators on hashtables diff --git a/pypy/module/pypystm/hashtable.py b/pypy/module/pypystm/hashtable.py --- a/pypy/module/pypystm/hashtable.py +++ b/pypy/module/pypystm/hashtable.py @@ -2,6 +2,7 @@ The class pypystm.hashtable, mapping integers to objects. """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault @@ -78,6 +79,57 @@ for i in range(count)] return space.newlist(lst_w) + def iterkeys_w(self, space): + return W_HashtableIterKeys(self.h) + + def itervalues_w(self, space): + return W_HashtableIterValues(self.h) + + def iteritems_w(self, space): + return W_HashtableIterItems(self.h) + + +class W_BaseHashtableIter(W_Root): + _immutable_fields_ = ["hiter"] + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx overestimate: doesn't remove the items already yielded, + # and uses the faster len_estimate() + return space.wrap(self.hiter.hashtable.len_estimate()) + + def next_entry(self, space): + try: + return self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +class W_HashtableIterKeys(W_BaseHashtableIter): + def descr_next(self, space): + entry = self.next_entry(space) + return space.wrap(intmask(entry.index)) + +class W_HashtableIterValues(W_BaseHashtableIter): + def descr_next(self, space): + entry = self.next_entry(space) + return cast_gcref_to_instance(W_Root, entry.object) + +class W_HashtableIterItems(W_BaseHashtableIter): + def descr_next(self, space): + entry = self.next_entry(space) + return space.newtuple([ + space.wrap(intmask(entry.index)), + cast_gcref_to_instance(W_Root, entry.object)]) + def W_Hashtable___new__(space, w_subtype): r = space.allocate_instance(W_Hashtable, w_subtype) @@ -98,4 +150,30 @@ keys = interp2app(W_Hashtable.keys_w), values = interp2app(W_Hashtable.values_w), items = interp2app(W_Hashtable.items_w), + + __iter__ = interp2app(W_Hashtable.iterkeys_w), + iterkeys = interp2app(W_Hashtable.iterkeys_w), + itervalues = interp2app(W_Hashtable.itervalues_w), + iteritems = interp2app(W_Hashtable.iteritems_w), ) + +W_HashtableIterKeys.typedef = TypeDef( + "hashtable_iterkeys", + __iter__ = interp2app(W_HashtableIterKeys.descr_iter), + next = interp2app(W_HashtableIterKeys.descr_next), + __length_hint__ = interp2app(W_HashtableIterKeys.descr_length_hint), + ) + +W_HashtableIterValues.typedef = TypeDef( + "hashtable_itervalues", + __iter__ = interp2app(W_HashtableIterValues.descr_iter), + next = interp2app(W_HashtableIterValues.descr_next), + __length_hint__ = interp2app(W_HashtableIterValues.descr_length_hint), + ) + +W_HashtableIterItems.typedef = TypeDef( + "hashtable_iteritems", + __iter__ = interp2app(W_HashtableIterItems.descr_iter), + next = interp2app(W_HashtableIterItems.descr_next), + __length_hint__ = interp2app(W_HashtableIterItems.descr_length_hint), + ) diff --git a/pypy/module/pypystm/test/test_hashtable.py b/pypy/module/pypystm/test/test_hashtable.py --- a/pypy/module/pypystm/test/test_hashtable.py +++ b/pypy/module/pypystm/test/test_hashtable.py @@ -55,3 +55,13 @@ assert sorted(h.keys()) == [42, 43] assert sorted(h.values()) == ["bar", "foo"] assert sorted(h.items()) == [(42, "foo"), (43, "bar")] + + def test_iterator(self): + import pypystm + h = pypystm.hashtable() + h[42] = "foo" + h[43] = "bar" + assert sorted(h) == [42, 43] + assert sorted(h.iterkeys()) == [42, 43] + assert sorted(h.itervalues()) == ["bar", "foo"] + assert sorted(h.iteritems()) == [(42, "foo"), (43, "bar")] diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -223,11 +223,13 @@ # ____________________________________________________________ _STM_HASHTABLE_P = rffi.COpaquePtr('stm_hashtable_t') +_STM_HASHTABLE_TABLE_P = rffi.COpaquePtr('stm_hashtable_table_t') _STM_HASHTABLE_ENTRY = lltype.GcStruct('HASHTABLE_ENTRY', ('index', lltype.Unsigned), ('object', llmemory.GCREF)) _STM_HASHTABLE_ENTRY_P = lltype.Ptr(_STM_HASHTABLE_ENTRY) +_STM_HASHTABLE_ENTRY_PP = rffi.CArrayPtr(_STM_HASHTABLE_ENTRY_P) _STM_HASHTABLE_ENTRY_ARRAY = lltype.GcArray(_STM_HASHTABLE_ENTRY_P) @dont_look_inside @@ -245,6 +247,11 @@ lltype.nullptr(_STM_HASHTABLE_ENTRY_ARRAY)) @dont_look_inside +def _ll_hashtable_len_estimate(h): + return llop.stm_hashtable_length_upper_bound(lltype.Signed, + h.ll_raw_hashtable) + + at dont_look_inside def _ll_hashtable_list(h): upper_bound = llop.stm_hashtable_length_upper_bound(lltype.Signed, h.ll_raw_hashtable) @@ -264,6 +271,27 @@ def _ll_hashtable_writeobj(h, entry, value): llop.stm_hashtable_write_entry(lltype.Void, h, entry, value) + at dont_look_inside +def _ll_hashtable_iterentries(h): + rgc.register_custom_trace_hook(_HASHTABLE_ITER_OBJ, + lambda_hashtable_iter_trace) + table = llop.stm_hashtable_iter(_STM_HASHTABLE_TABLE_P, h.ll_raw_hashtable) + hiter = lltype.malloc(_HASHTABLE_ITER_OBJ) + hiter.hashtable = h # for keepalive + hiter.table = table + hiter.prev = lltype.nullptr(_STM_HASHTABLE_ENTRY_PP.TO) + return hiter + +def _ll_hashiter_next(hiter): + entrypp = llop.stm_hashtable_iter_next(_STM_HASHTABLE_ENTRY_PP, + hiter.hashtable, + hiter.table, + hiter.prev) + if not entrypp: + raise StopIteration + hiter.prev = entrypp + return entrypp[0] + _HASHTABLE_OBJ = lltype.GcStruct('HASHTABLE_OBJ', ('ll_raw_hashtable', _STM_HASHTABLE_P), hints={'immutable': True}, @@ -271,11 +299,19 @@ adtmeths={'get': _ll_hashtable_get, 'set': _ll_hashtable_set, 'len': _ll_hashtable_len, + 'len_estimate': _ll_hashtable_len_estimate, 'list': _ll_hashtable_list, 'lookup': _ll_hashtable_lookup, - 'writeobj': _ll_hashtable_writeobj}) + 'writeobj': _ll_hashtable_writeobj, + 'iterentries': _ll_hashtable_iterentries}) NULL_HASHTABLE = lltype.nullptr(_HASHTABLE_OBJ) +_HASHTABLE_ITER_OBJ = lltype.GcStruct('HASHTABLE_ITER_OBJ', + ('hashtable', lltype.Ptr(_HASHTABLE_OBJ)), + ('table', _STM_HASHTABLE_TABLE_P), + ('prev', _STM_HASHTABLE_ENTRY_PP), + adtmeths={'next': _ll_hashiter_next}) + def _ll_hashtable_trace(gc, obj, callback, arg): from rpython.memory.gctransform.stmframework import get_visit_function visit_fn = get_visit_function(callback, arg) @@ -288,6 +324,15 @@ llop.stm_hashtable_free(lltype.Void, h.ll_raw_hashtable) lambda_hashtable_finlz = lambda: _ll_hashtable_finalizer +def _ll_hashtable_iter_trace(gc, obj, callback, arg): + from rpython.memory.gctransform.stmframework import get_visit_function + addr = obj + llmemory.offsetof(_HASHTABLE_ITER_OBJ, 'hashtable') + gc._trace_callback(callback, arg, addr) + visit_fn = get_visit_function(callback, arg) + addr = obj + llmemory.offsetof(_HASHTABLE_ITER_OBJ, 'table') + llop.stm_hashtable_iter_tracefn(lltype.Void, addr.address[0], visit_fn) +lambda_hashtable_iter_trace = lambda: _ll_hashtable_iter_trace + _false = CDefinedIntSymbolic('0', default=0) # remains in the C code @dont_look_inside @@ -344,6 +389,9 @@ items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] return len(items) + def len_estimate(self): + return len(self._content) + def list(self): items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] count = len(items) @@ -359,6 +407,9 @@ assert isinstance(entry, EntryObjectForTest) self.set(entry.key, nvalue) + def iterentries(self): + return IterEntriesForTest(self, self._content.itervalues()) + class EntryObjectForTest(object): def __init__(self, hashtable, key): self.hashtable = hashtable @@ -374,6 +425,14 @@ object = property(_getobj, _setobj) +class IterEntriesForTest(object): + def __init__(self, hashtable, iterator): + self.hashtable = hashtable + self.iterator = iterator + + def next(self): + return next(self.iterator) + # ____________________________________________________________ _STM_QUEUE_P = rffi.COpaquePtr('stm_queue_t') diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -398,9 +398,28 @@ arg0 = funcgen.expr(op.args[0]) arg1 = funcgen.expr(op.args[1]) arg2 = funcgen.expr(op.args[2]) - return ('stm_hashtable_tracefn(%s, (stm_hashtable_t *)%s, ' + return ('stm_hashtable_tracefn(%s, (stm_hashtable_t *)%s,' ' (void(*)(object_t**))%s);' % (arg0, arg1, arg2)) +def stm_hashtable_iter(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + result = funcgen.expr(op.result) + return '%s = stm_hashtable_iter(%s);' % (result, arg0) + +def stm_hashtable_iter_next(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + arg1 = funcgen.expr(op.args[1]) + arg2 = funcgen.expr(op.args[2]) + result = funcgen.expr(op.result) + return ('%s = stm_hashtable_iter_next(%s, %s, %s);' % + (arg0, arg1, arg2, result)) + +def stm_hashtable_iter_tracefn(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + arg1 = funcgen.expr(op.args[1]) + return ('stm_hashtable_tracefn((stm_hashtable_table_t *)%s,' + ' (void(*)(object_t**))%s);' % (arg0, arg1)) + def stm_queue_create(funcgen, op): result = funcgen.expr(op.result) return '%s = stm_queue_create();' % (result,) From noreply at buildbot.pypy.org Thu Nov 5 14:23:28 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 5 Nov 2015 20:23:28 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Simplify guessexception() Message-ID: <20151105192328.BC86E1C0155@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80554:5b473e7cb37a Date: 2015-11-04 02:52 +0000 http://bitbucket.org/pypy/pypy/changeset/5b473e7cb37a/ Log: Simplify guessexception() diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -118,7 +118,7 @@ # block.exits[True] = ifLink. raise StopFlowing - def guessexception(self, ctx, *cases): + def guessexception(self, ctx): block = self.crnt_block links = [] normal_block = EggBlock([], block, None) @@ -163,7 +163,7 @@ ctx.recorder = self.nextreplayer return self.booloutcome - def guessexception(self, ctx, *classes): + def guessexception(self, ctx): assert self.index == len(self.listtoreplay) ctx.recorder = self.nextreplayer outcome = self.booloutcome @@ -354,19 +354,11 @@ def do_op(self, op): self.maybe_merge() self.record(op) - self.guessexception(op.canraise) + # Implicit exceptions are ignored unless they are caught explicitly + if op.canraise and self.has_exc_handler(): + self.recorder.guessexception(self) return op.result - def guessexception(self, exceptions): - """ - Catch possible exceptions implicitly. - """ - if not exceptions: - return - # Implicit exceptions are ignored unless they are caught explicitly - if self.has_exc_handler(): - self.recorder.guessexception(self, *exceptions) - def has_exc_handler(self): return any(isinstance(block, (ExceptBlock, FinallyBlock)) for block in self.blockstack) From noreply at buildbot.pypy.org Thu Nov 5 14:23:30 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 5 Nov 2015 20:23:30 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Get rid of specialize_exceptions() in specialize_graph(): Message-ID: <20151105192330.EEC181C0155@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80555:44fabbc0a7e2 Date: 2015-11-05 19:24 +0000 http://bitbucket.org/pypy/pypy/changeset/44fabbc0a7e2/ Log: Get rid of specialize_exceptions() in specialize_graph(): this is a job for the annotator, not for buildflowgraph(). diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py --- a/rpython/translator/simplify.py +++ b/rpython/translator/simplify.py @@ -311,56 +311,6 @@ stack.extend(link.target.exits) seen[link.target] = True -def specialize_exceptions(graph): - for block in list(graph.iterblocks()): - if block.canraise: - op = block.raising_op - if op.canraise != [Exception]: - exc_exits = block.exits[1:] - exits = [] - has_generic_case = False - for case in op.canraise: - if case is Exception: - has_generic_case = True - continue - for exit in exc_exits: - if issubclass(case, exit.exitcase): - v_exctype = const(case) - v_excvalue = Variable('last_exc_value') - subs = { - exit.last_exception: v_exctype, - exit.last_exc_value: v_excvalue} - new_link = exit.replace(subs) - new_link.exitcase = case - exits.append(new_link) - break - else: - # ignore the uncaught implicit exception - continue - if has_generic_case: - exits += exc_exits - exits.insert(0, block.exits[0]) - else: - exits = list(block.exits) - if OverflowError in op.canraise: - if not any(issubclass(OverflowError, exit.exitcase) - for exit in block.exits[1:]): - v_etype = const(OverflowError) - v_exc = Variable('last_exc_value') - exit = Link([v_etype, v_exc], graph.exceptblock, OverflowError) - exit.extravars(v_etype, v_exc) - exits.append(exit) - if Exception in op.canraise: - if block.exits[-1].exitcase is not Exception: - v_etype = Variable('last_exception') - v_exc = Variable('last_exc_value') - exit = Link([v_etype, v_exc], graph.exceptblock, Exception) - exit.extravars(v_etype, v_exc) - exits.append(exit) - block.recloseblock(*exits) - if len(exits) == 1: - block.exitswitch = None - def remove_assertion_errors(graph): """Remove branches that go directly to raising an AssertionError, @@ -1103,7 +1053,6 @@ transform_ovfcheck, simplify_exceptions, remove_assertion_errors, - specialize_exceptions, remove_dead_exceptions, join_blocks, ] @@ -1112,7 +1061,6 @@ """inplace-apply all the existing optimisations to the graph.""" if passes is True: passes = all_passes - #import pdb; pdb.set_trace() for pass_ in passes: pass_(graph) checkgraph(graph) From noreply at buildbot.pypy.org Thu Nov 5 16:53:54 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 22:53:54 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: stmdict iterators Message-ID: <20151105215354.2803A1C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80556:ea8156b61a62 Date: 2015-11-05 22:53 +0100 http://bitbucket.org/pypy/pypy/changeset/ea8156b61a62/ Log: stmdict iterators diff --git a/pypy/module/pypystm/hashtable.py b/pypy/module/pypystm/hashtable.py --- a/pypy/module/pypystm/hashtable.py +++ b/pypy/module/pypystm/hashtable.py @@ -103,29 +103,27 @@ # and uses the faster len_estimate() return space.wrap(self.hiter.hashtable.len_estimate()) - def next_entry(self, space): + def descr_next(self, space): try: - return self.hiter.next() + entry = self.hiter.next() except StopIteration: raise OperationError(space.w_StopIteration, space.w_None) + return self.get_final_value(space, entry) def _cleanup_(self): raise Exception("seeing a prebuilt %r object" % ( self.__class__,)) class W_HashtableIterKeys(W_BaseHashtableIter): - def descr_next(self, space): - entry = self.next_entry(space) + def get_final_value(self, space, entry): return space.wrap(intmask(entry.index)) class W_HashtableIterValues(W_BaseHashtableIter): - def descr_next(self, space): - entry = self.next_entry(space) + def get_final_value(self, space, entry): return cast_gcref_to_instance(W_Root, entry.object) class W_HashtableIterItems(W_BaseHashtableIter): - def descr_next(self, space): - entry = self.next_entry(space) + def get_final_value(self, space, entry): return space.newtuple([ space.wrap(intmask(entry.index)), cast_gcref_to_instance(W_Root, entry.object)]) @@ -157,23 +155,9 @@ iteritems = interp2app(W_Hashtable.iteritems_w), ) -W_HashtableIterKeys.typedef = TypeDef( - "hashtable_iterkeys", - __iter__ = interp2app(W_HashtableIterKeys.descr_iter), - next = interp2app(W_HashtableIterKeys.descr_next), - __length_hint__ = interp2app(W_HashtableIterKeys.descr_length_hint), +W_BaseHashtableIter.typedef = TypeDef( + "hashtable_iter", + __iter__ = interp2app(W_BaseHashtableIter.descr_iter), + next = interp2app(W_BaseHashtableIter.descr_next), + __length_hint__ = interp2app(W_BaseHashtableIter.descr_length_hint), ) - -W_HashtableIterValues.typedef = TypeDef( - "hashtable_itervalues", - __iter__ = interp2app(W_HashtableIterValues.descr_iter), - next = interp2app(W_HashtableIterValues.descr_next), - __length_hint__ = interp2app(W_HashtableIterValues.descr_length_hint), - ) - -W_HashtableIterItems.typedef = TypeDef( - "hashtable_iteritems", - __iter__ = interp2app(W_HashtableIterItems.descr_iter), - next = interp2app(W_HashtableIterItems.descr_next), - __length_hint__ = interp2app(W_HashtableIterItems.descr_length_hint), - ) diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -2,6 +2,7 @@ The class pypystm.stmdict, giving a part of the regular 'dict' interface """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault @@ -215,10 +216,6 @@ def len_w(self, space): return space.wrap(self.get_length()) - def iter_w(self, space): - # not a real lazy iterator! - return space.iter(self.keys_w(space)) - def keys_w(self, space): return space.newlist(self.get_keys_values_w(offset=0)) @@ -228,6 +225,70 @@ def items_w(self, space): return space.newlist(self.get_items_w(space)) + def iterkeys_w(self, space): + return W_STMDictIterKeys(self.h) + + def itervalues_w(self, space): + return W_STMDictIterValues(self.h) + + def iteritems_w(self, space): + return W_STMDictIterItems(self.h) + + +class W_BaseSTMDictIter(W_Root): + _immutable_fields_ = ["hiter"] + next_from_same_hash = 0 + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx estimate: doesn't remove the items already yielded, + # and uses the faster len_estimate(); on the other hand, + # counts only one for every 64-bit hash value + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + else: + index = self.next_from_same_hash + array = self.next_array + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 2: # uncommon case + self.next_from_same_hash = index + 2 + self.next_array = array + # + return self.get_final_value(space, array, index) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +class W_STMDictIterKeys(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return cast_gcref_to_instance(W_Root, array[index]) + +class W_STMDictIterValues(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return cast_gcref_to_instance(W_Root, array[index + 1]) + +class W_STMDictIterItems(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return space.newtuple([ + cast_gcref_to_instance(W_Root, array[index]), + cast_gcref_to_instance(W_Root, array[index + 1])]) + def W_STMDict___new__(space, w_subtype): r = space.allocate_instance(W_STMDict, w_subtype) @@ -246,8 +307,19 @@ setdefault = interp2app(W_STMDict.setdefault_w), __len__ = interp2app(W_STMDict.len_w), - __iter__ = interp2app(W_STMDict.iter_w), keys = interp2app(W_STMDict.keys_w), values = interp2app(W_STMDict.values_w), items = interp2app(W_STMDict.items_w), + + __iter__ = interp2app(W_STMDict.iterkeys_w), + iterkeys = interp2app(W_STMDict.iterkeys_w), + itervalues = interp2app(W_STMDict.itervalues_w), + iteritems = interp2app(W_STMDict.iteritems_w), ) + +W_BaseSTMDictIter.typedef = TypeDef( + "stmdict_iter", + __iter__ = interp2app(W_BaseSTMDictIter.descr_iter), + next = interp2app(W_BaseSTMDictIter.descr_next), + __length_hint__ = interp2app(W_BaseSTMDictIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/test/test_stmdict.py b/pypy/module/pypystm/test/test_stmdict.py --- a/pypy/module/pypystm/test/test_stmdict.py +++ b/pypy/module/pypystm/test/test_stmdict.py @@ -158,3 +158,24 @@ assert a not in d assert b not in d assert d.keys() == [] + + + def test_iterator(self): + import pypystm + class A(object): + def __hash__(self): + return 42 + class B(object): + pass + d = pypystm.stmdict() + a1 = A() + a2 = A() + b0 = B() + d[a1] = "foo" + d[a2] = None + d[b0] = "bar" + assert sorted(d) == sorted([a1, a2, b0]) + assert sorted(d.iterkeys()) == sorted([a1, a2, b0]) + assert sorted(d.itervalues()) == [None, "bar", "foo"] + assert sorted(d.iteritems()) == sorted([(a1, "foo"), (a2, None), + (b0, "bar")]) From noreply at buildbot.pypy.org Thu Nov 5 16:59:19 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 5 Nov 2015 22:59:19 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: stmset.__iter__ Message-ID: <20151105215919.2EDAC1C0352@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80557:cf95b2a3e1ca Date: 2015-11-05 22:59 +0100 http://bitbucket.org/pypy/pypy/changeset/cf95b2a3e1ca/ Log: stmset.__iter__ diff --git a/pypy/module/pypystm/stmset.py b/pypy/module/pypystm/stmset.py --- a/pypy/module/pypystm/stmset.py +++ b/pypy/module/pypystm/stmset.py @@ -2,6 +2,7 @@ The class pypystm.stmset, giving a part of the regular 'set' interface """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app @@ -150,8 +151,48 @@ return space.wrap(self.get_length()) def iter_w(self, space): - # not a real lazy iterator! - return space.iter(space.newlist(self.get_items_w())) + return W_STMSetIter(self.h) + + +class W_STMSetIter(W_Root): + _immutable_fields_ = ["hiter"] + next_from_same_hash = 0 + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx estimate: doesn't remove the items already yielded, + # and uses the faster len_estimate(); on the other hand, + # counts only one for every 64-bit hash value + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + else: + index = self.next_from_same_hash + array = self.next_array + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 1: # uncommon case + self.next_from_same_hash = index + 1 + self.next_array = array + # + return cast_gcref_to_instance(W_Root, array[index]) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) def W_STMSet___new__(space, w_subtype): @@ -170,3 +211,10 @@ __len__ = interp2app(W_STMSet.len_w), __iter__ = interp2app(W_STMSet.iter_w), ) + +W_STMSetIter.typedef = TypeDef( + "stmset_iter", + __iter__ = interp2app(W_STMSetIter.descr_iter), + next = interp2app(W_STMSetIter.descr_next), + __length_hint__ = interp2app(W_STMSetIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/test/test_stmset.py b/pypy/module/pypystm/test/test_stmset.py --- a/pypy/module/pypystm/test/test_stmset.py +++ b/pypy/module/pypystm/test/test_stmset.py @@ -83,3 +83,19 @@ assert len(s) == 2 items = list(s) assert items == [42.5, key3] or items == [key3, 42.5] + + def test_iterator(self): + import pypystm + class A(object): + def __hash__(self): + return 42 + class B(object): + pass + d = pypystm.stmset() + a1 = A() + a2 = A() + b0 = B() + d.add(a1) + d.add(a2) + d.add(b0) + assert sorted(d) == sorted([a1, a2, b0]) From noreply at buildbot.pypy.org Thu Nov 5 23:45:03 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 6 Nov 2015 05:45:03 +0100 (CET) Subject: [pypy-commit] pypy no-class-specialize: hg merge default Message-ID: <20151106044504.0590D1C13F2@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: no-class-specialize Changeset: r80558:9f26ec17b3f4 Date: 2015-11-06 04:45 +0000 http://bitbucket.org/pypy/pypy/changeset/9f26ec17b3f4/ Log: hg merge default diff too long, truncating to 2000 out of 7299 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), - ('type_specifier -> SHORT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',711), - ('type_specifier -> INT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',712), - ('type_specifier -> LONG','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',713), - ('type_specifier -> FLOAT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',714), - ('type_specifier -> DOUBLE','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',715), - ('type_specifier -> _COMPLEX','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',716), - ('type_specifier -> SIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',717), - ('type_specifier -> UNSIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',718), - ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',723), - ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',724), - ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',725), - ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',730), - ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',731), - ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',732), - ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list_1','../pycparser/c_parser.py',737), - ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list_1','../pycparser/c_parser.py',738), - ('init_declarator_list -> EQUALS initializer','init_declarator_list',2,'p_init_declarator_list_2','../pycparser/c_parser.py',748), - ('init_declarator_list -> abstract_declarator','init_declarator_list',1,'p_init_declarator_list_3','../pycparser/c_parser.py',756), - ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','../pycparser/c_parser.py',764), - ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','../pycparser/c_parser.py',765), - ('specifier_qualifier_list -> type_qualifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','../pycparser/c_parser.py',770), - ('specifier_qualifier_list -> type_specifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','../pycparser/c_parser.py',775), - ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',783), - ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',784), - ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','../pycparser/c_parser.py',793), - ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',802), - ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',803), - ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',812), - ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',813), - ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','../pycparser/c_parser.py',820), - ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','../pycparser/c_parser.py',821), - ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','../pycparser/c_parser.py',826), - ('struct_declaration -> specifier_qualifier_list abstract_declarator SEMI','struct_declaration',3,'p_struct_declaration_2','../pycparser/c_parser.py',864), - ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','../pycparser/c_parser.py',878), - ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','../pycparser/c_parser.py',879), - ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','../pycparser/c_parser.py',887), - ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','../pycparser/c_parser.py',892), - ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','../pycparser/c_parser.py',893), - ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',901), - ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',902), - ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','../pycparser/c_parser.py',907), - ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',912), - ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',913), - ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','../pycparser/c_parser.py',918), - ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','../pycparser/c_parser.py',919), - ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','../pycparser/c_parser.py',920), - ('enumerator -> ID','enumerator',1,'p_enumerator','../pycparser/c_parser.py',931), - ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','../pycparser/c_parser.py',932), - ('declarator -> direct_declarator','declarator',1,'p_declarator_1','../pycparser/c_parser.py',947), - ('declarator -> pointer direct_declarator','declarator',2,'p_declarator_2','../pycparser/c_parser.py',952), - ('declarator -> pointer TYPEID','declarator',2,'p_declarator_3','../pycparser/c_parser.py',961), - ('direct_declarator -> ID','direct_declarator',1,'p_direct_declarator_1','../pycparser/c_parser.py',972), - ('direct_declarator -> LPAREN declarator RPAREN','direct_declarator',3,'p_direct_declarator_2','../pycparser/c_parser.py',981), - ('direct_declarator -> direct_declarator LBRACKET assignment_expression_opt RBRACKET','direct_declarator',4,'p_direct_declarator_3','../pycparser/c_parser.py',986), - ('direct_declarator -> direct_declarator LBRACKET TIMES RBRACKET','direct_declarator',4,'p_direct_declarator_4','../pycparser/c_parser.py',998), - ('direct_declarator -> direct_declarator LPAREN parameter_type_list RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1008), - ('direct_declarator -> direct_declarator LPAREN identifier_list_opt RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1009), - ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','../pycparser/c_parser.py',1036), - ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','../pycparser/c_parser.py',1037), - ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','../pycparser/c_parser.py',1047), - ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','../pycparser/c_parser.py',1048), - ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','../pycparser/c_parser.py',1053), - ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','../pycparser/c_parser.py',1054), - ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','../pycparser/c_parser.py',1062), - ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','../pycparser/c_parser.py',1063), - ('parameter_declaration -> declaration_specifiers declarator','parameter_declaration',2,'p_parameter_declaration_1','../pycparser/c_parser.py',1072), - ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','../pycparser/c_parser.py',1083), - ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','../pycparser/c_parser.py',1113), - ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','../pycparser/c_parser.py',1114), - ('initializer -> assignment_expression','initializer',1,'p_initializer_1','../pycparser/c_parser.py',1123), - ('initializer -> brace_open initializer_list brace_close','initializer',3,'p_initializer_2','../pycparser/c_parser.py',1128), - ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','../pycparser/c_parser.py',1129), - ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','../pycparser/c_parser.py',1134), - ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','../pycparser/c_parser.py',1135), - ('designation -> designator_list EQUALS','designation',2,'p_designation','../pycparser/c_parser.py',1146), - ('designator_list -> designator','designator_list',1,'p_designator_list','../pycparser/c_parser.py',1154), - ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','../pycparser/c_parser.py',1155), - ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','../pycparser/c_parser.py',1160), - ('designator -> PERIOD identifier','designator',2,'p_designator','../pycparser/c_parser.py',1161), - ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','../pycparser/c_parser.py',1166), - ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','../pycparser/c_parser.py',1182), - ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','../pycparser/c_parser.py',1190), - ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','../pycparser/c_parser.py',1195), - ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','../pycparser/c_parser.py',1205), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','../pycparser/c_parser.py',1209), - ('direct_abstract_declarator -> LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_3','../pycparser/c_parser.py',1219), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','../pycparser/c_parser.py',1227), - ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','../pycparser/c_parser.py',1237), - ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','../pycparser/c_parser.py',1245), - ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','../pycparser/c_parser.py',1255), - ('block_item -> declaration','block_item',1,'p_block_item','../pycparser/c_parser.py',1266), - ('block_item -> statement','block_item',1,'p_block_item','../pycparser/c_parser.py',1267), - ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','../pycparser/c_parser.py',1274), - ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','../pycparser/c_parser.py',1275), - ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','../pycparser/c_parser.py',1281), - ('labeled_statement -> ID COLON statement','labeled_statement',3,'p_labeled_statement_1','../pycparser/c_parser.py',1287), - ('labeled_statement -> CASE constant_expression COLON statement','labeled_statement',4,'p_labeled_statement_2','../pycparser/c_parser.py',1291), - ('labeled_statement -> DEFAULT COLON statement','labeled_statement',3,'p_labeled_statement_3','../pycparser/c_parser.py',1295), - ('selection_statement -> IF LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_1','../pycparser/c_parser.py',1299), - ('selection_statement -> IF LPAREN expression RPAREN statement ELSE statement','selection_statement',7,'p_selection_statement_2','../pycparser/c_parser.py',1303), - ('selection_statement -> SWITCH LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_3','../pycparser/c_parser.py',1307), - ('iteration_statement -> WHILE LPAREN expression RPAREN statement','iteration_statement',5,'p_iteration_statement_1','../pycparser/c_parser.py',1312), - ('iteration_statement -> DO statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','../pycparser/c_parser.py',1316), - ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN statement','iteration_statement',9,'p_iteration_statement_3','../pycparser/c_parser.py',1320), - ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement','iteration_statement',8,'p_iteration_statement_4','../pycparser/c_parser.py',1324), - ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','../pycparser/c_parser.py',1328), From noreply at buildbot.pypy.org Fri Nov 6 01:35:51 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 6 Nov 2015 07:35:51 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: translation fixes Message-ID: <20151106063552.0F06C1C1495@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80559:0c53eff8e6fe Date: 2015-11-05 22:41 +0000 http://bitbucket.org/pypy/pypy/changeset/0c53eff8e6fe/ Log: translation fixes diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -282,6 +282,7 @@ hiter.prev = lltype.nullptr(_STM_HASHTABLE_ENTRY_PP.TO) return hiter + at dont_look_inside def _ll_hashiter_next(hiter): entrypp = llop.stm_hashtable_iter_next(_STM_HASHTABLE_ENTRY_PP, hiter.hashtable, diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -486,6 +486,10 @@ 'stm_hashtable_list' : LLOp(), 'stm_hashtable_tracefn': LLOp(), + 'stm_hashtable_iter': LLOp(), + 'stm_hashtable_iter_next': LLOp(), + 'stm_hashtable_iter_tracefn': LLOp(), + 'stm_queue_create': LLOp(), 'stm_queue_free': LLOp(), 'stm_queue_get': LLOp(canmallocgc=True), # push roots! From noreply at buildbot.pypy.org Fri Nov 6 01:35:54 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 6 Nov 2015 07:35:54 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: import stmgc/72facb6e4533 Message-ID: <20151106063554.4D51D1C1495@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80560:deb2b12c5415 Date: 2015-11-06 06:37 +0000 http://bitbucket.org/pypy/pypy/changeset/deb2b12c5415/ Log: import stmgc/72facb6e4533 diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision --- a/rpython/translator/stm/src_stm/revision +++ b/rpython/translator/stm/src_stm/revision @@ -1,1 +1,1 @@ -41227d7659ac +72facb6e4533 diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c --- a/rpython/translator/stm/src_stm/stm/core.c +++ b/rpython/translator/stm/src_stm/stm/core.c @@ -1374,6 +1374,8 @@ from its segment. Better do it as soon as possible, because other threads might be spin-looping, waiting for the -1 to disappear. */ + /* but first, emit commit-event of this thread: */ + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_COMMIT); STM_SEGMENT->running_thread = NULL; write_fence(); assert(_stm_detached_inevitable_from_thread == -1); diff --git a/rpython/translator/stm/src_stm/stm/detach.c b/rpython/translator/stm/src_stm/stm/detach.c --- a/rpython/translator/stm/src_stm/stm/detach.c +++ b/rpython/translator/stm/src_stm/stm/detach.c @@ -127,6 +127,7 @@ // XXX: not sure if the next line is a good idea tl->last_associated_segment_num = remote_seg_num; ensure_gs_register(remote_seg_num); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); } dprintf(("reattach_transaction: start a new transaction\n")); @@ -185,6 +186,7 @@ assert(segnum > 0); ensure_gs_register(segnum); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); ensure_gs_register(mysegnum); } diff --git a/rpython/translator/stm/src_stm/stm/finalizer.c b/rpython/translator/stm/src_stm/stm/finalizer.c --- a/rpython/translator/stm/src_stm/stm/finalizer.c +++ b/rpython/translator/stm/src_stm/stm/finalizer.c @@ -501,7 +501,17 @@ /* XXX: become inevitable, bc. otherwise, we would need to keep around the original g_finalizers.run_finalizers to restore it in case of an abort. */ - _stm_become_inevitable("finalizer-Tx"); + _stm_become_inevitable(MSG_INEV_DONT_SLEEP); + /* did it work? */ + if (STM_PSEGMENT->transaction_state != TS_INEVITABLE) { /* no */ + /* avoid blocking here, waiting for another INEV transaction. + If we did that, application code could not proceed (start the + next transaction) and it will not be obvious from the profile + why we were WAITing. */ + _stm_commit_transaction(); + stm_rewind_jmp_leaveframe(tl, &rjbuf); + return; + } while (__sync_lock_test_and_set(&g_finalizers.lock, 1) != 0) { /* somebody is adding more finalizers (_commit_finalizer()) */ diff --git a/rpython/translator/stm/src_stm/stm/gcpage.c b/rpython/translator/stm/src_stm/stm/gcpage.c --- a/rpython/translator/stm/src_stm/stm/gcpage.c +++ b/rpython/translator/stm/src_stm/stm/gcpage.c @@ -224,6 +224,9 @@ version and thus don't need tracing. */ static struct list_s *marked_objects_to_trace; +/* a list of hobj/hashtable pairs for all hashtables seen */ +static struct list_s *all_hashtables_seen = NULL; + /* we use the sharing seg0's pages for the GCFLAG_VISITED flag */ static inline struct object_s *mark_loc(object_t *obj) @@ -301,8 +304,6 @@ } -#define TRACE_FOR_MAJOR_COLLECTION (&mark_record_trace) - static void mark_and_trace( object_t *obj, char *segment_base, /* to trace obj in */ @@ -791,6 +792,7 @@ /* marking */ LIST_CREATE(marked_objects_to_trace); + LIST_CREATE(all_hashtables_seen); mark_visit_from_modified_objects(); mark_visit_from_markers(); mark_visit_from_roots(); @@ -815,6 +817,10 @@ sweep_large_objects(); sweep_small_objects(); + /* hashtables */ + stm_compact_hashtables(); + LIST_FREE(all_hashtables_seen); + dprintf((" | used after collection: %ld\n", (long)pages_ctl.total_allocated)); dprintf((" `----------------------------------------------\n")); diff --git a/rpython/translator/stm/src_stm/stm/hashtable.c b/rpython/translator/stm/src_stm/stm/hashtable.c --- a/rpython/translator/stm/src_stm/stm/hashtable.c +++ b/rpython/translator/stm/src_stm/stm/hashtable.c @@ -49,8 +49,12 @@ #define PERTURB_SHIFT 5 #define RESIZING_LOCK 0 -typedef struct { - uintptr_t mask; +#define TRACE_FLAG_OFF 0 +#define TRACE_FLAG_ONCE 1 +#define TRACE_FLAG_KEEPALIVE 2 + +struct stm_hashtable_table_s { + uintptr_t mask; /* 'mask' is always immutable. */ /* 'resize_counter' start at an odd value, and is decremented (by 6) for every new item put in 'items'. When it crosses 0, we @@ -63,8 +67,10 @@ */ uintptr_t resize_counter; + uint8_t trace_flag; + stm_hashtable_entry_t *items[INITIAL_HASHTABLE_SIZE]; -} stm_hashtable_table_t; +}; #define IS_EVEN(p) (((p) & 1) == 0) @@ -79,6 +85,7 @@ { table->mask = itemcount - 1; table->resize_counter = itemcount * 4 + 1; + table->trace_flag = TRACE_FLAG_OFF; memset(table->items, 0, itemcount * sizeof(stm_hashtable_entry_t *)); } @@ -162,6 +169,7 @@ assert(biggertable); // XXX stm_hashtable_table_t *table = hashtable->table; + table->trace_flag = TRACE_FLAG_ONCE; table->resize_counter = (uintptr_t)biggertable; /* ^^^ this unlocks the table by writing a non-zero value to table->resize_counter, but the new value is a pointer to the @@ -485,6 +493,41 @@ static void _stm_compact_hashtable(struct object_s *hobj, stm_hashtable_t *hashtable) { + /* Walk the chained list that starts at 'hashtable->initial_table' + and follows the 'resize_counter' fields. Remove all tables + except (1) the initial one, (2) the most recent one, and (3) + the ones on which stm_hashtable_iter_tracefn() was called. + */ + stm_hashtable_table_t *most_recent_table = hashtable->table; + assert(!IS_EVEN(most_recent_table->resize_counter)); + /* set the "don't free me" flag on the most recent table */ + most_recent_table->trace_flag = TRACE_FLAG_KEEPALIVE; + + stm_hashtable_table_t *known_alive = &hashtable->initial_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + /* a KEEPALIVE flag is ignored on the initial table: it is never + individually freed anyway */ + + while (known_alive != most_recent_table) { + uintptr_t rc = known_alive->resize_counter; + assert(IS_EVEN(rc)); + assert(rc != RESIZING_LOCK); + + stm_hashtable_table_t *next_table = (stm_hashtable_table_t *)rc; + if (next_table->trace_flag != TRACE_FLAG_KEEPALIVE) { + /* free this next table and relink the chained list to skip it */ + assert(IS_EVEN(next_table->resize_counter)); + known_alive->resize_counter = next_table->resize_counter; + free(next_table); + } + else { + /* this next table is kept alive */ + known_alive = next_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + } + } + /* done the first part */ + stm_hashtable_table_t *table = hashtable->table; uintptr_t rc = table->resize_counter; assert(!IS_EVEN(rc)); @@ -515,35 +558,24 @@ dprintf(("compact with %ld items:\n", num_entries_times_6 / 6)); _stm_rehash_hashtable(hashtable, count, segnum); } +} - table = hashtable->table; - assert(!IS_EVEN(table->resize_counter)); - - if (table != &hashtable->initial_table) { - uintptr_t rc = hashtable->initial_table.resize_counter; - while (1) { - assert(IS_EVEN(rc)); - assert(rc != RESIZING_LOCK); - - stm_hashtable_table_t *old_table = (stm_hashtable_table_t *)rc; - if (old_table == table) - break; - rc = old_table->resize_counter; - free(old_table); - } - hashtable->initial_table.resize_counter = (uintptr_t)table; - assert(IS_EVEN(hashtable->initial_table.resize_counter)); +static void stm_compact_hashtables(void) +{ + uintptr_t i = all_hashtables_seen->count; + while (i > 0) { + i -= 2; + _stm_compact_hashtable( + (struct object_s *)all_hashtables_seen->items[i], + (stm_hashtable_t *)all_hashtables_seen->items[i + 1]); } } -void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, - void trace(object_t **)) +static void _hashtable_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) { - if (trace == TRACE_FOR_MAJOR_COLLECTION) - _stm_compact_hashtable(hobj, hashtable); - - stm_hashtable_table_t *table; - table = VOLATILE_HASHTABLE(hashtable)->table; + if (table->trace_flag == TRACE_FLAG_ONCE) + table->trace_flag = TRACE_FLAG_OFF; uintptr_t j, mask = table->mask; for (j = 0; j <= mask; j++) { @@ -554,3 +586,105 @@ } } } + +void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, + void trace(object_t **)) +{ + if (all_hashtables_seen != NULL) + all_hashtables_seen = list_append2(all_hashtables_seen, + (uintptr_t)hobj, + (uintptr_t)hashtable); + + _hashtable_tracefn(VOLATILE_HASHTABLE(hashtable)->table, trace); +} + + +/* Hashtable iterators */ + +/* TRACE_FLAG_ONCE: the table must be traced once if it supports an iterator + TRACE_FLAG_OFF: the table is the most recent table, or has already been + traced once + TRACE_FLAG_KEEPALIVE: during major collection only: mark tables that + must be kept alive because there are iterators +*/ + +struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *hashtable) +{ + /* Get the table. No synchronization is needed: we may miss some + entries that are being added, but they would contain NULL in + this segment anyway. */ + return VOLATILE_HASHTABLE(hashtable)->table; +} + +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, + stm_hashtable_entry_t **previous) +{ + /* Set the read marker on hobj for every item, in case we have + transaction breaks in-between. + */ + stm_read(hobj); + + /* Get the bounds of the part of the 'stm_hashtable_entry_t *' array + that we have to check */ + stm_hashtable_entry_t **pp, **last; + if (previous == NULL) + pp = table->items; + else + pp = previous + 1; + last = table->items + table->mask; + + /* Find the first non-null entry */ + stm_hashtable_entry_t *entry; + + while (pp <= last) { + entry = *(stm_hashtable_entry_t *volatile *)pp; + if (entry != NULL) { + stm_read((object_t *)entry); + if (entry->object != NULL) { + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, pp); + return pp; + } + } + ++pp; + } + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, NULL); + return NULL; +} + +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) +{ + if (all_hashtables_seen == NULL) { /* for minor collections */ + + /* During minor collection, tracing the table is only required + the first time: if it contains young objects, they must be + kept alive and have their address updated. We use + TRACE_FLAG_ONCE to know that. We don't need to do it if + our 'table' is the latest version, because in that case it + will be done by stm_hashtable_tracefn(). That's why + TRACE_FLAG_ONCE is only set when a more recent table is + attached. + + It is only needed once: non-latest-version tables are + immutable. We mark once all the entries as old, and + then these now-old objects stay alive until the next + major collection. + + Checking the flag can be done without synchronization: it + never wrong to call _hashtable_tracefn() too much, and the + only case where it *has to* be called occurs if the + hashtable object is still young (and not seen by other + threads). + */ + if (table->trace_flag == TRACE_FLAG_ONCE) + _hashtable_tracefn(table, trace); + } + else { /* for major collections */ + + /* Set this flag for _stm_compact_hashtable() */ + table->trace_flag = TRACE_FLAG_KEEPALIVE; + } +} diff --git a/rpython/translator/stm/src_stm/stm/hashtable.h b/rpython/translator/stm/src_stm/stm/hashtable.h new file mode 100644 --- /dev/null +++ b/rpython/translator/stm/src_stm/stm/hashtable.h @@ -0,0 +1,2 @@ +/* Imported by rpython/translator/stm/import_stmgc.py */ +static void stm_compact_hashtables(void); diff --git a/rpython/translator/stm/src_stm/stmgc.c b/rpython/translator/stm/src_stm/stmgc.c --- a/rpython/translator/stm/src_stm/stmgc.c +++ b/rpython/translator/stm/src_stm/stmgc.c @@ -20,6 +20,7 @@ #include "stm/finalizer.h" #include "stm/locks.h" #include "stm/detach.h" +#include "stm/hashtable.h" #include "stm/queue.h" #include "stm/misc.c" #include "stm/list.c" diff --git a/rpython/translator/stm/src_stm/stmgc.h b/rpython/translator/stm/src_stm/stmgc.h --- a/rpython/translator/stm/src_stm/stmgc.h +++ b/rpython/translator/stm/src_stm/stmgc.h @@ -100,6 +100,8 @@ #define _stm_detach_inevitable_transaction(tl) do { \ write_fence(); \ assert(_stm_detached_inevitable_from_thread == 0); \ + if (stmcb_timing_event != NULL && tl->self_or_0_if_atomic != 0) \ + {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ _stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \ } while (0) void _stm_reattach_transaction(intptr_t); @@ -416,69 +418,6 @@ #endif -/* Entering and leaving a "transactional code zone": a (typically very - large) section in the code where we are running a transaction. - This is the STM equivalent to "acquire the GIL" and "release the - GIL", respectively. stm_read(), stm_write(), stm_allocate(), and - other functions should only be called from within a transaction. - - Note that transactions, in the STM sense, cover _at least_ one - transactional code zone. They may be longer; for example, if one - thread does a lot of stm_enter_transactional_zone() + - stm_become_inevitable() + stm_leave_transactional_zone(), as is - typical in a thread that does a lot of C function calls, then we - get only a few bigger inevitable transactions that cover the many - short transactional zones. This is done by having - stm_leave_transactional_zone() turn the current transaction - inevitable and detach it from the running thread (if there is no - other inevitable transaction running so far). Then - stm_enter_transactional_zone() will try to reattach to it. This is - far more efficient than constantly starting and committing - transactions. - - stm_enter_transactional_zone() and stm_leave_transactional_zone() - preserve the value of errno. -*/ -#ifdef STM_DEBUGPRINT -#include -#endif -static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { - intptr_t self = tl->self_or_0_if_atomic; - if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, - self, 0)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_enter_transactional_zone fast path\n"); -#endif - } - else { - _stm_reattach_transaction(self); - /* _stm_detached_inevitable_from_thread should be 0 here, but - it can already have been changed from a parallel thread - (assuming we're not inevitable ourselves) */ - } -} -static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { - assert(STM_SEGMENT->running_thread == tl); - if (stm_is_inevitable(tl)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_leave_transactional_zone fast path\n"); -#endif - _stm_detach_inevitable_transaction(tl); - } - else { - _stm_leave_noninevitable_transactional_zone(); - } -} - -/* stm_force_transaction_break() is in theory equivalent to - stm_leave_transactional_zone() immediately followed by - stm_enter_transactional_zone(); however, it is supposed to be - called in CPU-heavy threads that had a transaction run for a while, - and so it *always* forces a commit and starts the next transaction. - The new transaction is never inevitable. See also - stm_should_break_transaction(). */ -void stm_force_transaction_break(stm_thread_local_t *tl); - /* Abort the currently running transaction. This function never returns: it jumps back to the start of the transaction (which must not be inevitable). */ @@ -596,6 +535,10 @@ STM_TRANSACTION_COMMIT, STM_TRANSACTION_ABORT, + /* DETACH/REATTACH is used for leaving/reentering the transactional */ + STM_TRANSACTION_DETACH, + STM_TRANSACTION_REATTACH, + /* inevitable contention: all threads that try to become inevitable have a STM_BECOME_INEVITABLE event with a position marker. Then, if it waits it gets a STM_WAIT_OTHER_INEVITABLE. It is possible @@ -688,6 +631,75 @@ } while (0) + +/* Entering and leaving a "transactional code zone": a (typically very + large) section in the code where we are running a transaction. + This is the STM equivalent to "acquire the GIL" and "release the + GIL", respectively. stm_read(), stm_write(), stm_allocate(), and + other functions should only be called from within a transaction. + + Note that transactions, in the STM sense, cover _at least_ one + transactional code zone. They may be longer; for example, if one + thread does a lot of stm_enter_transactional_zone() + + stm_become_inevitable() + stm_leave_transactional_zone(), as is + typical in a thread that does a lot of C function calls, then we + get only a few bigger inevitable transactions that cover the many + short transactional zones. This is done by having + stm_leave_transactional_zone() turn the current transaction + inevitable and detach it from the running thread (if there is no + other inevitable transaction running so far). Then + stm_enter_transactional_zone() will try to reattach to it. This is + far more efficient than constantly starting and committing + transactions. + + stm_enter_transactional_zone() and stm_leave_transactional_zone() + preserve the value of errno. +*/ +#ifdef STM_DEBUGPRINT +#include +#endif +static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { + intptr_t self = tl->self_or_0_if_atomic; + if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, + self, 0)) { + if (self != 0 && stmcb_timing_event != NULL) { + /* for atomic transactions, we don't emit DETACH/REATTACH */ + stmcb_timing_event(tl, STM_TRANSACTION_REATTACH, NULL); + } +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_enter_transactional_zone fast path\n"); +#endif + } + else { + _stm_reattach_transaction(self); + /* _stm_detached_inevitable_from_thread should be 0 here, but + it can already have been changed from a parallel thread + (assuming we're not inevitable ourselves) */ + } +} +static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { + assert(STM_SEGMENT->running_thread == tl); + if (stm_is_inevitable(tl)) { +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_leave_transactional_zone fast path\n"); +#endif + _stm_detach_inevitable_transaction(tl); + } + else { + _stm_leave_noninevitable_transactional_zone(); + } +} + +/* stm_force_transaction_break() is in theory equivalent to + stm_leave_transactional_zone() immediately followed by + stm_enter_transactional_zone(); however, it is supposed to be + called in CPU-heavy threads that had a transaction run for a while, + and so it *always* forces a commit and starts the next transaction. + The new transaction is never inevitable. See also + stm_should_break_transaction(). */ +void stm_force_transaction_break(stm_thread_local_t *tl); + + /* Support for light finalizers. This is a simple version of finalizers that guarantees not to do anything fancy, like not resurrecting objects. */ @@ -755,6 +767,21 @@ object_t *object; }; +/* Hashtable iterators. You get a raw 'table' pointer when you make + an iterator, which you pass to stm_hashtable_iter_next(). This may + or may not return items added after stm_hashtable_iter() was + called; there is no logic so far to detect changes (unlike Python's + RuntimeError). When the GC traces, you must keep the table pointer + alive with stm_hashtable_iter_tracefn(). The original hashtable + object must also be kept alive. */ +typedef struct stm_hashtable_table_s stm_hashtable_table_t; +stm_hashtable_table_t *stm_hashtable_iter(stm_hashtable_t *); +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, + stm_hashtable_entry_t **previous); +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)); + /* Queues. The items you put() and get() back are in random order. Like hashtables, the type 'stm_queue_t' is not an object type at From noreply at buildbot.pypy.org Fri Nov 6 01:45:21 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 6 Nov 2015 07:45:21 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: oops Message-ID: <20151106064521.9E93C1C15B6@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80561:769f958d793d Date: 2015-11-06 06:47 +0000 http://bitbucket.org/pypy/pypy/changeset/769f958d793d/ Log: oops diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -417,7 +417,7 @@ def stm_hashtable_iter_tracefn(funcgen, op): arg0 = funcgen.expr(op.args[0]) arg1 = funcgen.expr(op.args[1]) - return ('stm_hashtable_tracefn((stm_hashtable_table_t *)%s,' + return ('stm_hashtable_iter_tracefn((stm_hashtable_table_t *)%s,' ' (void(*)(object_t**))%s);' % (arg0, arg1)) def stm_queue_create(funcgen, op): From noreply at buildbot.pypy.org Fri Nov 6 02:06:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 6 Nov 2015 08:06:11 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: oops 2 Message-ID: <20151106070611.078C31C13F7@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80562:cc55e74842af Date: 2015-11-06 06:58 +0000 http://bitbucket.org/pypy/pypy/changeset/cc55e74842af/ Log: oops 2 diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -412,7 +412,7 @@ arg2 = funcgen.expr(op.args[2]) result = funcgen.expr(op.result) return ('%s = stm_hashtable_iter_next(%s, %s, %s);' % - (arg0, arg1, arg2, result)) + (result, arg0, arg1, arg2)) def stm_hashtable_iter_tracefn(funcgen, op): arg0 = funcgen.expr(op.args[0]) From noreply at buildbot.pypy.org Fri Nov 6 06:29:13 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 6 Nov 2015 12:29:13 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: do bit manipulation to preserve, where possible, mantissa values in nan floating point conversions Message-ID: <20151106112913.368F41C2132@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80563:f9a88e6a3a0f Date: 2015-11-06 13:20 +0200 http://bitbucket.org/pypy/pypy/changeset/f9a88e6a3a0f/ Log: do bit manipulation to preserve, where possible, mantissa values in nan floating point conversions diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1853,14 +1853,14 @@ assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02' def test_half_conversions(self): + # numpy preserves value for uint16 -> cast_as_float16 -> + # convert_to_float64 -> convert_to_float16 -> uint16 + # even for float16 various float16 nans from numpy import array, arange - all_f16 = arange(0xff10, 0xff20, dtype='uint16') + all_f16 = arange(0xfe00, 0xfe08, dtype='uint16') all_f16.dtype = 'float16' - print all_f16.view(dtype='uint16') all_f32 = array(all_f16, dtype='float32') - print all_f32.view(dtype='uint32') b = array(all_f32, dtype='float16') - print b.view(dtype='uint16') c = b.view(dtype='uint16') d = all_f16.view(dtype='uint16') assert (c == d).all() diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -5,8 +5,8 @@ import math from rpython.rlib import rarithmetic, rfloat, objectmodel, jit -from rpython.rlib.rarithmetic import r_ulonglong -from rpython.rtyper.lltypesystem.rffi import DOUBLE, cast +from rpython.rtyper.lltypesystem.rffi import r_ulonglong, ULONGP, DOUBLEP, cast +from rpython.rtyper.lltypesystem import lltype def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but @@ -64,7 +64,16 @@ if mant == 0: result = rfloat.INFINITY else: - result = rfloat.NAN #cast(DOUBLE, mant | + # preserve mant value but pad w/zeros + exp = 0x7ff << 52 + sign = sign << 63 + mant = mant << (53 - MANT_DIG) + b = lltype.malloc(ULONGP.TO, 1, flavor='raw') + b[0] = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) + #b = cast(ULONGP, r_ulonglong(exp | mant | sign)) + result = cast(DOUBLEP, b)[0] + lltype.free(b, flavor='raw') + return result elif exp == 0: # subnormal or zero result = math.ldexp(mant, MIN_EXP - MANT_DIG) @@ -76,7 +85,7 @@ def float_unpack80(QQ, size): '''Unpack a (mant, exp) tuple of r_ulonglong in 80-bit extended format - into a long double float + into a python float (a double) ''' if size == 10 or size == 12 or size == 16: MIN_EXP = -16381 @@ -104,7 +113,16 @@ if exp == MAX_EXP - MIN_EXP + 2: # nan or infinity - result = rfloat.NAN if mant &((one << MANT_DIG - 1) - 1) else rfloat.INFINITY + if mant == 0: + result = rfloat.INFINITY + else: + exp = 0x7ff << 52 + b = lltype.malloc(ULONGP.TO, 1, flavor='raw') + sign = sign << 63 + b[0] = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) + result = cast(DOUBLEP, b)[0] + lltype.free(b, flavor='raw') + return result else: # normal result = math.ldexp(mant, exp + MIN_EXP - MANT_DIG - 1) @@ -132,13 +150,21 @@ raise ValueError("invalid size value") sign = rfloat.copysign(1.0, x) < 0.0 - if not rfloat.isfinite(x): - if rfloat.isinf(x): - mant = r_ulonglong(0) - exp = MAX_EXP - MIN_EXP + 2 - else: # rfloat.isnan(x): - mant = r_ulonglong(1) << (MANT_DIG-2) # other values possible - exp = MAX_EXP - MIN_EXP + 2 + if rfloat.isinf(x): + mant = r_ulonglong(0) + exp = MAX_EXP - MIN_EXP + 2 + elif rfloat.isnan(x): + b = lltype.malloc(DOUBLEP.TO, 1, flavor='raw') + b[0] = x + asint = cast(ULONGP, b)[0] + mant = asint & ((r_ulonglong(1) << 52) - 1) + sign = asint >> 63 + lltype.free(b, flavor='raw') + # shift off lower bits, perhaps losing data + mant = mant >> (53 - MANT_DIG) + if mant == 0: + mant = r_ulonglong(1) << (MANT_DIG-2) + exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) exp = 0 @@ -171,7 +197,7 @@ # check constraints if not objectmodel.we_are_translated(): - assert 0 <= mant < 1 << MANT_DIG - 1 + assert 0 <= mant <= (1 << MANT_DIG) - 1 assert 0 <= exp <= MAX_EXP - MIN_EXP + 2 assert 0 <= sign <= 1 exp = r_ulonglong(exp) @@ -191,13 +217,17 @@ raise ValueError("invalid size value") sign = rfloat.copysign(1.0, x) < 0.0 - if not rfloat.isfinite(x): - if rfloat.isinf(x): - mant = r_ulonglong(0) - exp = MAX_EXP - MIN_EXP + 2 - else: # rfloat.isnan(x): - mant = (r_ulonglong(1) << (MANT_DIG-2)) - 1 # other values possible - exp = MAX_EXP - MIN_EXP + 2 + if rfloat.isinf(x): + mant = r_ulonglong(0) + exp = MAX_EXP - MIN_EXP + 2 + elif rfloat.isnan(x): # rfloat.isnan(x): + b = lltype.malloc(DOUBLEP.TO, 1, flavor='raw') + b[0] = x + asint = cast(ULONGP, b)[0] + mant = asint & ((r_ulonglong(1) << 52) - 1) + lltype.free(b, flavor='raw') + sign = asint >> 63 + exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) exp = 0 @@ -225,12 +255,12 @@ if exp >= MAX_EXP - MIN_EXP + 2: raise OverflowError("float too large to pack in this format") + mant = mant << 1 # check constraints if not objectmodel.we_are_translated(): - assert 0 <= mant < 1 << MANT_DIG - 1 + assert 0 <= mant <= (1 << MANT_DIG) - 1 assert 0 <= exp <= MAX_EXP - MIN_EXP + 2 assert 0 <= sign <= 1 - mant = mant << 1 exp = r_ulonglong(exp) sign = r_ulonglong(sign) return (mant, (sign << BITS - MANT_DIG - 1) | exp) diff --git a/rpython/rlib/rstruct/test/test_ieee.py b/rpython/rlib/rstruct/test/test_ieee.py --- a/rpython/rlib/rstruct/test/test_ieee.py +++ b/rpython/rlib/rstruct/test/test_ieee.py @@ -168,15 +168,31 @@ def test_random(self): # construct a Python float from random integer, using struct + mantissa_mask = (1 << 53) - 1 for _ in xrange(10000): Q = random.randrange(2**64) x = struct.unpack('= 1 << 11: continue self.check_float(x) + def test_various_nans(self): + # check patterns that should preserve the mantissa across nan conversions + maxmant64 = (1 << 52) - 1 # maximum double mantissa + maxmant16 = (1 << 10) - 1 # maximum float16 mantissa + assert maxmant64 >> 42 == maxmant16 + exp = 0xfff << 52 + for i in range(20): + val_to_preserve = exp | ((maxmant16 - i) << 42) + a = ieee.float_unpack(val_to_preserve, 8) + assert isnan(a), 'i %d, maxmant %s' % (i, hex(val_to_preserve)) + b = ieee.float_pack(a, 8) + assert b == val_to_preserve, 'i %d, val %s b %s' % (i, hex(val_to_preserve), hex(b)) + b = ieee.float_pack(a, 2) + assert b == 0xffff - i, 'i %d, b%s' % (i, hex(b)) class TestCompiled: def test_pack_float(self): From noreply at buildbot.pypy.org Fri Nov 6 06:29:15 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 6 Nov 2015 12:29:15 +0100 (CET) Subject: [pypy-commit] pypy default: document merged branch Message-ID: <20151106112915.507121C2132@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80564:6233e7f1c1ff Date: 2015-11-06 13:26 +0200 http://bitbucket.org/pypy/pypy/changeset/6233e7f1c1ff/ Log: document merged branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -14,3 +14,7 @@ .. branch: ppc-stacklet The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging From noreply at buildbot.pypy.org Fri Nov 6 08:12:22 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 6 Nov 2015 14:12:22 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: use float2longlong and (longlong2float via casting to int64 from uint64) Message-ID: <20151106131222.A05231C1327@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80565:84b64808a037 Date: 2015-11-06 15:12 +0200 http://bitbucket.org/pypy/pypy/changeset/84b64808a037/ Log: use float2longlong and (longlong2float via casting to int64 from uint64) diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -5,8 +5,8 @@ import math from rpython.rlib import rarithmetic, rfloat, objectmodel, jit -from rpython.rtyper.lltypesystem.rffi import r_ulonglong, ULONGP, DOUBLEP, cast -from rpython.rtyper.lltypesystem import lltype +from rpython.rtyper.lltypesystem.rffi import r_ulonglong, r_longlong, LONGLONG, ULONGLONG, cast +from rpython.rlib.longlong2float import longlong2float, float2longlong def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but @@ -68,11 +68,8 @@ exp = 0x7ff << 52 sign = sign << 63 mant = mant << (53 - MANT_DIG) - b = lltype.malloc(ULONGP.TO, 1, flavor='raw') - b[0] = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) - #b = cast(ULONGP, r_ulonglong(exp | mant | sign)) - result = cast(DOUBLEP, b)[0] - lltype.free(b, flavor='raw') + uint = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) + result = longlong2float(cast(LONGLONG, uint)) return result elif exp == 0: # subnormal or zero @@ -117,11 +114,8 @@ result = rfloat.INFINITY else: exp = 0x7ff << 52 - b = lltype.malloc(ULONGP.TO, 1, flavor='raw') - sign = sign << 63 - b[0] = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) - result = cast(DOUBLEP, b)[0] - lltype.free(b, flavor='raw') + uint = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) + result = longlong2float(cast(LONGLONG, uint)) return result else: # normal @@ -154,12 +148,9 @@ mant = r_ulonglong(0) exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): - b = lltype.malloc(DOUBLEP.TO, 1, flavor='raw') - b[0] = x - asint = cast(ULONGP, b)[0] + asint = float2longlong(x) mant = asint & ((r_ulonglong(1) << 52) - 1) - sign = asint >> 63 - lltype.free(b, flavor='raw') + sign = asint < 0 # shift off lower bits, perhaps losing data mant = mant >> (53 - MANT_DIG) if mant == 0: @@ -221,12 +212,9 @@ mant = r_ulonglong(0) exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): # rfloat.isnan(x): - b = lltype.malloc(DOUBLEP.TO, 1, flavor='raw') - b[0] = x - asint = cast(ULONGP, b)[0] + asint = float2longlong(x) mant = asint & ((r_ulonglong(1) << 52) - 1) - lltype.free(b, flavor='raw') - sign = asint >> 63 + sign = asint < 0 exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) From noreply at buildbot.pypy.org Fri Nov 6 08:16:21 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 6 Nov 2015 14:16:21 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: support 32 bit (arigato) Message-ID: <20151106131621.3FE261C1327@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80566:16bd20ba340b Date: 2015-11-06 15:16 +0200 http://bitbucket.org/pypy/pypy/changeset/16bd20ba340b/ Log: support 32 bit (arigato) diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -65,10 +65,10 @@ result = rfloat.INFINITY else: # preserve mant value but pad w/zeros - exp = 0x7ff << 52 - sign = sign << 63 - mant = mant << (53 - MANT_DIG) - uint = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) + exp = r_ulonglong(0x7ff) << 52 + sign = r_ulonglong(sign) << 63 + mant = r_ulonglong(mant) << (53 - MANT_DIG) + uint = exp | mant | sign result = longlong2float(cast(LONGLONG, uint)) return result elif exp == 0: @@ -113,8 +113,8 @@ if mant == 0: result = rfloat.INFINITY else: - exp = 0x7ff << 52 - uint = r_ulonglong(exp) | r_ulonglong(mant) | r_ulonglong(sign) + exp = r_ulonglong(0x7ff) << 52 + uint = exp | r_ulonglong(mant) | r_ulonglong(sign) result = longlong2float(cast(LONGLONG, uint)) return result else: From noreply at buildbot.pypy.org Fri Nov 6 09:38:34 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 6 Nov 2015 15:38:34 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: another 32 bit fix Message-ID: <20151106143835.0B0AB1C2122@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80567:457f9caf2efa Date: 2015-11-06 16:38 +0200 http://bitbucket.org/pypy/pypy/changeset/457f9caf2efa/ Log: another 32 bit fix diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -148,7 +148,7 @@ mant = r_ulonglong(0) exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): - asint = float2longlong(x) + asint = cast(ULONGLONG, float2longlong(x)) mant = asint & ((r_ulonglong(1) << 52) - 1) sign = asint < 0 # shift off lower bits, perhaps losing data @@ -212,7 +212,7 @@ mant = r_ulonglong(0) exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): # rfloat.isnan(x): - asint = float2longlong(x) + asint = cast(ULONGLONG, float2longlong(x)) mant = asint & ((r_ulonglong(1) << 52) - 1) sign = asint < 0 exp = MAX_EXP - MIN_EXP + 2 From noreply at buildbot.pypy.org Fri Nov 6 09:46:01 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 6 Nov 2015 15:46:01 +0100 (CET) Subject: [pypy-commit] benchmarks default: add optimized lee router Message-ID: <20151106144601.3A2771C2185@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r339:08504e346e20 Date: 2015-11-06 15:47 +0100 http://bitbucket.org/pypy/benchmarks/changeset/08504e346e20/ Log: add optimized lee router This version's goal is to work well with TM. The original benchmark violated the assumption that the write-set of a transaction should be relatively small. The benchmark was writing to LeeThread.tempgrid, which is always old and contains thousands of small list-objects. In this version, I switched the implementation of the grid to a one- dimensional list. This change improved the performance for standard PyPy, too. However, pypy-stm crashes immediately in the JIT -> investigate. diff --git a/multithread/lee_routing/lee_router_tm.py b/multithread/lee_routing/lee_router_tm.py new file mode 100755 --- /dev/null +++ b/multithread/lee_routing/lee_router_tm.py @@ -0,0 +1,513 @@ +#!/usr/bin/python + +# +# BSD License +# +# Copyright (c) 2007, The University of Manchester (UK) +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# - Neither the name of the University of Manchester nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Simple Lee's Routing Algorithm +# Author: IW +# Translated from Java to Python by Remi Meier + + +import time, Tkinter +import sys, math +import threading + +DEBUG = True + +CYAN = "#00FFFF" +MAGENTA = "#FF00FF" +YELLOW = "#FFFF00" +GREEN = "#00FF00" +RED = "#FF0000" +BLUE = "#0000FF" + +GRID_SIZE = 600 +EMPTY = 0 +TEMP_EMPTY = 10000 +OCC = 5120 +VIA = 6000 +BVIA = 6001 +TRACK = 8192 +MAX_WEIGHT = 1 + +# used as loop indices to look at neighbouring cells +NEIGHBOUR_OFFS = ((1,0), (-1,0), (0,1), (0,-1)) + +class Grid(object): + + def __init__(self, width, height, depth): + self.width = width + self.height = height + self.depth = depth + # self._data = [[[0 for _ in range(depth)] + # for _ in range(height)] + # for _ in range(width)] + self._data = None + self.reset(EMPTY) + + def _idx(self, x, y, z): + return (x * self.height + y) * self.depth + z + + def __getitem__(self, args): + #x, y, z = args + #return self._data[x][y][z] + return self._data[self._idx(*args)] + + def __setitem__(self, args, value): + self._data[self._idx(*args)] = value + # x, y, z = args + # self._data[x][y][z] = value + + def reset(self, val): + self._data = [val] * (self.width * self.height * self.depth) + # for col in self._data: + # for r in range(len(col)): + # col[r] = [val] * self.depth + + def occupy(self, lo_x, lo_y, up_x, up_y): + for x in range(lo_x, up_x + 1): + for y in range(lo_y, up_y + 1): + for c in range(len(self.depth)): + self[x, y, c] = OCC + # depth = self._data[x][y] + # for c in range(len(depth)): + # depth[c] = OCC + + + def add_weights(self): + for i in range(MAX_WEIGHT): + # this loop iteratively propagates weights + # if for MAX_WEIGHT > 1... + for z in range(self.depth): + for x in range(1, self.width - 1): + for y in range(1, self.height - 1): + val = self[x, y, z] + if val == OCC: + # for OCC fields, we set EMPTY neighbours to + # MAX_WEIGHT + for dx, dy in NEIGHBOUR_OFFS: + if self[x + dx, y + dy, z] == EMPTY: + self[x + dx, y + dy, z] = MAX_WEIGHT + elif val != EMPTY: + # for MAX_WEIGHT fields, set EMPTY neighbours to + # "our value - 1" --> 0 = EMPTY if MAX_WEIGHT is 1 + for dx, dy in NEIGHBOUR_OFFS: + if self[x + dx, y + dy, z] == EMPTY: + self[x + dx, y + dy, z] = val - 1 + + + + +class WorkQueue(object): + def __init__(self, xx1=0, yy1=0, xx2=0, yy2=0, n=0): + self.next = None + self.x1 = xx1 + self.y1 = yy1 + self.x2 = xx2 + self.y2 = yy2 + self.nn = n + + def enqueue(self, x1, y1, x2, y2, n): + q = WorkQueue(x1, y1, x2, y2, n) + q.next = self.next + return q + + def dequeue(self): + q = self.next + self.next = self.next.next + return q + + # def length(self): + # curr = self.next + # retval = 0 + # while curr is not None: + # retval += 1 + # curr = curr.next + # return retval + + def _less(self, other): + return (((self.x2 - self.x1) * (self.x2 - self.x1) + + (self.y2 - self.y1) * (self.y2 - self.y1)) + > ((other.x2 - other.x1) * (other.x2 - other.x1) + + (other.y2 - other.y1) * (other.y2 - other.y1))) + + def _pass(self): + done = True + ent = self + a = ent.next + while a.next is not None: + b = a.next + if a._less(b): + ent.next = b + a.next = b.next + b.next = a + done = False + ent = a + a = b + b = b.next + return done + + def sort(self): + while not self._pass(): + pass + + + + +class LeeThread(threading.Thread): + + def __init__(self, lr): + super(LeeThread, self).__init__() + self.lr = lr + self.wq = None + self.tempgrid = Grid(GRID_SIZE, GRID_SIZE, 2) + + def run(self): + while True: + with atomic: + self.wq = self.lr.get_next_track() + # + if self.wq is None: + print "finished" + return + # + #self.tempgrid = Grid(GRID_SIZE, GRID_SIZE, 2) + self.lr.lay_next_track(self.wq, self.tempgrid) + + + +from pypystm import atomic, hint_commit_soon + +class LeeRouter(object): + + def __init__(self, file): + self.grid = Grid(GRID_SIZE, GRID_SIZE, 2) + self.work = WorkQueue() + self.net_no = 0 + self._parse_data_file(file) + self.grid.add_weights() + self.work.sort() + self.queue_lock = threading.Lock() + self.grid_lock = atomic#threading.Lock() + self.view = Viewer() + + def _parse_data_file(self, file_name): + with open(file_name, 'r') as file: + for line in file: + line = line.strip() + line = line.split() + c, params = line[0], map(int, line[1:]) + if c == 'E': + break # end of file + elif c == 'C': + # chip bounding box + x0, y0, x1, y1 = params + self.grid.occupy(x0, y0, x1, y1) + elif c == 'P': + # pad + x0, y0 = params + self.grid.occupy(x0, y0, x0, y0) + elif c == 'J': + # join connection pts + x0, y0, x1, y1 = params + self.net_no += 1 + self.work.next = self.work.enqueue(x0, y0, x1, y1, self.net_no) + + def get_next_track(self): + with self.queue_lock: + if self.work.next is not None: + return self.work.dequeue() + return None + + def lay_next_track(self, wq, tempgrid): + # start transaction + with self.grid_lock: + done = self._connect(wq.x1, wq.y1, wq.x2, wq.y2, + wq.nn, tempgrid, self.grid) + return done # end transaction + + def create_thread(self): + return LeeThread(self) + + @staticmethod + def _expand_from_to(x, y, x_goal, y_goal, num, + tempgrid, grid): + # this method should use Lee's expansion algorithm from + # coordinate (x,y) to (x_goal, y_goal) for the num iterations + # it should return true if the goal is found and false if it is not + # reached within the number of iterations allowed. + # + # g[x_goal][y_goal][0] = EMPTY; // set goal as empty + # g[x_goal][y_goal][1] = EMPTY; // set goal as empty + front = [] + tmp_front = [] + tempgrid[x, y, 0] = 1 + tempgrid[x, y, 1] = 1 + # + front.append((x, y, 0, 0)) # (x y z dw) + front.append((x, y, 1, 0)) # we can start from either side + # + reached0, reached1 = False, False + while front: + while front: + fx, fy, fz, fdw = front.pop(0) + # + if fdw > 0: + tmp_front.append((fx, fy, fz, fdw - 1)) + else: + for dx, dy in NEIGHBOUR_OFFS: + fdx, fdy = fx + dx, fy + dy + + weight = grid[fdx, fdy, fz] + 1 + prev_val = tempgrid[fdx, fdy, fz] + reached = (fdx == x_goal) and (fdy == y_goal) + if reached or ( + prev_val > tempgrid[fx, fy, fz] + weight and weight < OCC): + # check that a point is actually within the bounds of grid array: + if 0 < fdx < GRID_SIZE - 1 and 0 < fdy < GRID_SIZE - 1: + tempgrid[fdx, fdy, fz] = tempgrid[fx, fy, fz] + weight + if not reached: + tmp_front.append((fdx, fdy, fz, 0)) + # + not_fz = 1 - fz + weight = grid[fx, fy, not_fz] + 1 + if tempgrid[fx, fy, not_fz] > tempgrid[fx, fy, fz] and weight < OCC: + tempgrid[fx, fy, not_fz] = tempgrid[fx, fy, fz] + tmp_front.append((fx, fy, not_fz, 0)) + # + # must check if found goal, if so, return True + reached0 = tempgrid[x_goal, y_goal, 0] != TEMP_EMPTY + reached1 = tempgrid[x_goal, y_goal, 1] != TEMP_EMPTY + if reached0 and reached1: # both + return True # (x_goal, y_goal) can be found in time + # + front, tmp_front = tmp_front, front + return False + + @staticmethod + def _path_from_other_side(tempgrid, x, y, z): + zo = 1 - z # other side + sqval = tempgrid[x, y, zo] + if sqval in (VIA, BVIA): + return False + # + if tempgrid[x, y, zo] <= tempgrid[x, y, z]: + return (tempgrid[x-1, y, zo] < sqval or tempgrid[x+1, y, zo] < sqval + or tempgrid[x, y-1, zo] < sqval or tempgrid[x, y+1, zo] < sqval) + return False + + @staticmethod + def _tlength(x1, y1, x2, y2): + sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + return math.sqrt(sq); + + def _backtrack_from(self, x_goal, y_goal, x_start, y_start, + track_no, tempgrid, grid): + # this method should backtrack from the goal position (x_goal, y_goal) + # back to the starting position (x_start, y_start) filling in the + # grid array g with the specified track number track_no ( + TRACK). + # *** + # CurrentPos = Goal + # Loop + # Find dir to start back from current position + # Loop + # Keep going in current dir and Fill in track (update currentPos) + # Until box number increases in this current dir + # Until back at starting point + # *** + distsofar = 0 + if abs(x_goal - x_start) > abs(y_goal - y_start): + z_goal = 0 + else: + z_goal = 1 + # + if tempgrid[x_goal, y_goal, z_goal] == TEMP_EMPTY: + z_goal = 1 - z_goal + # + # arrays used for looking NSEW: + DX = (( -1, 1, 0, 0 ), + ( 0, 0, -1, 1 )) + DY = (( 0, 0, -1, 1 ), + ( -1, 1, 0, 0 )) + # + temp_y, temp_x, temp_z = y_goal, x_goal, z_goal + while (temp_x != x_start) or (temp_y != y_start): # PDL: until back + # at starting point + advanced = False + min_dir = 0 + min_square = 100000 + for d in range(4): # PDL: find dir to start back from + # current position + temp_dx, temp_dy = temp_x + DX[temp_z][d], temp_y + DY[temp_z][d] + if (tempgrid[temp_dx, temp_dy, temp_z] < tempgrid[temp_x, temp_y, temp_z] + and tempgrid[temp_dx, temp_dy, temp_z] != TEMP_EMPTY): + if tempgrid[temp_dx, temp_dy, temp_z] < min_square: + min_square = tempgrid[temp_dx, temp_dy, temp_z] + min_dir = d + advanced = True + if advanced: + distsofar += 1 + # + if (self._path_from_other_side(tempgrid, temp_x, temp_y, temp_z) + # not preferred dir for this layer + and ((min_dir > 1 and distsofar > 15 + and self._tlength(temp_x, temp_y, x_start, y_start) > 15) + or (not advanced and + grid[temp_x, temp_y, temp_z] not in (VIA, BVIA) + ))): + t_z = 1 - temp_z + viat = VIA if advanced else BVIA # BVIA is nowhere else to go + # mark via + tempgrid[temp_x, temp_y, temp_z] = viat + grid[temp_x, temp_y, temp_z] = viat + # go to the other side: + temp_z = t_z + tempgrid[temp_x, temp_y, temp_z] = viat + grid[temp_x, temp_y, temp_z] = viat + distsofar = 0 + else: + if grid[temp_x, temp_y, temp_z] < OCC: + # PDL: fill in track unless connection point + grid[temp_x, temp_y, temp_z] = TRACK + # PDL: updating current position + temp_x = temp_x + DX[temp_z][min_dir]; + temp_y = temp_y + DY[temp_z][min_dir]; + + def _connect(self, xs, ys, xg, yg, net_no, tempgrid, grid): + # calls expand_from and backtrack_from to create connection + # This is the only real change needed to make the program + # transactional. + # Instead of using the grid 'in place' to do the expansion, we take a + # copy but the backtrack writes to the original grid. + # This is not a correctness issue. The transactions would still + # complete eventually without it. + # However the expansion writes are only temporary and do not logically + # conflict. + # There is a question as to whether a copy is really necessary as a + # transaction will anyway create + # its own copy. if we were then to distinguish between writes not to be + # committed (expansion) and + # those to be committed (backtrack), we would not need an explicit + # copy. + # Taking the copy is not really a computational(time) overhead because + # it avoids the grid 'reset' phase + # needed if we do the expansion in place. + tempgrid.reset(TEMP_EMPTY) + # call the expansion method to return found/not found boolean + found = self._expand_from_to(xs, ys, xg, yg, GRID_SIZE * 5, tempgrid, grid) + if found: + self._backtrack_from(xg, yg, xs, ys, net_no, tempgrid, grid) + return found + + def disp_grid(self, z): + laycol = (MAGENTA, GREEN)[z] + for y in reversed(range(GRID_SIZE)): #WTF + for x in range(GRID_SIZE): + gg = self.grid[x, y, z] + if gg == OCC: + self.view.point(x, y, CYAN) + elif gg == VIA: + self.view.point(x, y, YELLOW) + elif gg == BVIA: + self.view.point(x, y, RED) + elif gg == TRACK: + self.view.point(x, y, laycol) + + + +def main(args): + if len(args) != 2: + print "Params: [numthreads] [input-file]" + sys.exit(-1) + # + num_threads = int(args[0]) + filename = args[1] + lr = LeeRouter(filename) + # + # setup the benchmark + start_time = 0 + current_time = 0 + # + thread = [lr.create_thread() for _ in range(num_threads)] + start_time = time.time() + for t in thread: + t.start() + current_time = time.time() + for t in thread: + t.join() + # + elapsed_time = current_time - start_time + print "Numthreads:", num_threads + print "ElapsedTime:", elapsed_time, "s" + report(start_time) + if DEBUG: + lr.disp_grid(0) + lr.disp_grid(1) + lr.view.show() + + + +def report(start_time): + stop_time = time.time() + elapsed = stop_time - start_time + print "Elapsed time:", elapsed, "s" + print "-------------------------" + + + +class Viewer(object): + def __init__(self): + self.points = [] + + def point(self, x, y, col): + self.points.append((x, y, col)) + + def show(self, width=GRID_SIZE, height=GRID_SIZE): + master = Tkinter.Tk() + c = Tkinter.Canvas(master, width=width, height=height, + background="black") + c.pack() + img = Tkinter.PhotoImage(width=width, height=height) + c.create_image((width/2, height/2), image=img, + state="normal") + # draw + for (x, y, col) in self.points: + img.put(col, (x, y)) + #c.create_oval(x-1, y-1, x+1, y+1, fill=col, width=0) + Tkinter.mainloop() + + + +if __name__ == '__main__': + main(sys.argv[1:]) From noreply at buildbot.pypy.org Fri Nov 6 12:51:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 6 Nov 2015 18:51:11 +0100 (CET) Subject: [pypy-commit] cffi default: Give a warning instead of crashing; in this way we can call the next Message-ID: <20151106175111.C621E1C1422@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2374:be44fd9b3554 Date: 2015-11-06 18:36 +0100 http://bitbucket.org/cffi/cffi/changeset/be44fd9b3554/ Log: Give a warning instead of crashing; in this way we can call the next release 1.3.1 as planned and give some advance warning to users relying on this. diff --git a/cffi/model.py b/cffi/model.py --- a/cffi/model.py +++ b/cffi/model.py @@ -519,10 +519,12 @@ smallest_value = min(self.enumvalues) largest_value = max(self.enumvalues) else: - raise api.CDefError("%r has no values explicitly defined: " - "refusing to guess which integer type it is " - "meant to be (unsigned/signed, int/long)" - % self._get_c_name()) + import warnings + warnings.warn("%r has no values explicitly defined; next version " + "will refuse to guess which integer type it is " + "meant to be (unsigned/signed, int/long)" + % self._get_c_name()) + smallest_value = largest_value = 0 if smallest_value < 0: # needs a signed type sign = 1 candidate1 = PrimitiveType("int") diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -1351,6 +1351,9 @@ def test_opaque_enum(self): ffi = FFI(backend=self.Backend()) ffi.cdef("enum foo;") + from cffi import __version_info__ + if __version_info__ < (1, 4): + py.test.skip("re-enable me in version 1.4") e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) assert str(e.value) == ( "'enum foo' has no values explicitly defined: refusing to guess " From noreply at buildbot.pypy.org Fri Nov 6 12:54:12 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 6 Nov 2015 18:54:12 +0100 (CET) Subject: [pypy-commit] pypy default: Issue #2183: leak fix, untested so far Message-ID: <20151106175412.CA5021C1422@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80568:3b433cf781c7 Date: 2015-11-06 18:54 +0100 http://bitbucket.org/pypy/pypy/changeset/3b433cf781c7/ Log: Issue #2183: leak fix, untested so far diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -852,55 +852,58 @@ names = rffi.cast(GENERAL_NAMES, method[0].c_d2i( null, p_ptr, length)) - for j in range(libssl_sk_GENERAL_NAME_num(names)): - # Get a rendering of each name in the set of names + try: + for j in range(libssl_sk_GENERAL_NAME_num(names)): + # Get a rendering of each name in the set of names - name = libssl_sk_GENERAL_NAME_value(names, j) - gntype = intmask(name.c_type) - if gntype == GEN_DIRNAME: - # we special-case DirName as a tuple of tuples of - # attributes - dirname = libssl_pypy_GENERAL_NAME_dirn(name) - w_t = space.newtuple([ - space.wrap("DirName"), - _create_tuple_for_X509_NAME(space, dirname) - ]) - elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI): - # GENERAL_NAME_print() doesn't handle NULL bytes in - # ASN1_string correctly, CVE-2013-4238 - if gntype == GEN_EMAIL: - v = space.wrap("email") - elif gntype == GEN_DNS: - v = space.wrap("DNS") - elif gntype == GEN_URI: - v = space.wrap("URI") + name = libssl_sk_GENERAL_NAME_value(names, j) + gntype = intmask(name.c_type) + if gntype == GEN_DIRNAME: + # we special-case DirName as a tuple of tuples of + # attributes + dirname = libssl_pypy_GENERAL_NAME_dirn(name) + w_t = space.newtuple([ + space.wrap("DirName"), + _create_tuple_for_X509_NAME(space, dirname) + ]) + elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI): + # GENERAL_NAME_print() doesn't handle NULL bytes in + # ASN1_string correctly, CVE-2013-4238 + if gntype == GEN_EMAIL: + v = space.wrap("email") + elif gntype == GEN_DNS: + v = space.wrap("DNS") + elif gntype == GEN_URI: + v = space.wrap("URI") + else: + assert False + as_ = libssl_pypy_GENERAL_NAME_dirn(name) + as_ = rffi.cast(ASN1_STRING, as_) + buf = libssl_ASN1_STRING_data(as_) + length = libssl_ASN1_STRING_length(as_) + w_t = space.newtuple([ + v, space.wrap(rffi.charpsize2str(buf, length))]) else: - assert False - as_ = libssl_pypy_GENERAL_NAME_dirn(name) - as_ = rffi.cast(ASN1_STRING, as_) - buf = libssl_ASN1_STRING_data(as_) - length = libssl_ASN1_STRING_length(as_) - w_t = space.newtuple([ - v, space.wrap(rffi.charpsize2str(buf, length))]) - else: - # for everything else, we use the OpenSSL print form - if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY, - GEN_IPADD, GEN_RID): - space.warn(space.wrap("Unknown general name type"), - space.w_RuntimeWarning) - libssl_BIO_reset(biobuf) - libssl_GENERAL_NAME_print(biobuf, name) - with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf: - length = libssl_BIO_gets(biobuf, buf, 2047) - if length < 0: - raise _ssl_seterror(space, None, 0) + # for everything else, we use the OpenSSL print form + if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY, + GEN_IPADD, GEN_RID): + space.warn(space.wrap("Unknown general name type"), + space.w_RuntimeWarning) + libssl_BIO_reset(biobuf) + libssl_GENERAL_NAME_print(biobuf, name) + with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf: + length = libssl_BIO_gets(biobuf, buf, 2047) + if length < 0: + raise _ssl_seterror(space, None, 0) - v = rffi.charpsize2str(buf, length) - v1, v2 = v.split(':', 1) - w_t = space.newtuple([space.wrap(v1), - space.wrap(v2)]) + v = rffi.charpsize2str(buf, length) + v1, v2 = v.split(':', 1) + w_t = space.newtuple([space.wrap(v1), + space.wrap(v2)]) - alt_names_w.append(w_t) + alt_names_w.append(w_t) + finally: + libssl_pypy_GENERAL_NAME_pop_free(names) finally: libssl_BIO_free(biobuf) diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py --- a/rpython/rlib/ropenssl.py +++ b/rpython/rlib/ropenssl.py @@ -56,6 +56,7 @@ # So we replace an attribute access with a macro call. '#define pypy_GENERAL_NAME_dirn(name) (name->d.dirn)', '#define pypy_GENERAL_NAME_uri(name) (name->d.uniformResourceIdentifier)', + '#define pypy_GENERAL_NAME_pop_free(names) (sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free))', '#define pypy_X509_OBJECT_data_x509(obj) (obj->data.x509)', '#define pypy_DIST_POINT_fullname(obj) (obj->distpoint->name.fullname)', ], @@ -439,6 +440,8 @@ macro=True) ssl_external('sk_GENERAL_NAME_value', [GENERAL_NAMES, rffi.INT], GENERAL_NAME, macro=True) +ssl_external('pypy_GENERAL_NAME_pop_free', [GENERAL_NAMES], lltype.Void, + macro=True) ssl_external('sk_X509_OBJECT_num', [stack_st_X509_OBJECT], rffi.INT, macro=True) ssl_external('sk_X509_OBJECT_value', [stack_st_X509_OBJECT, rffi.INT], From noreply at buildbot.pypy.org Fri Nov 6 14:06:55 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 6 Nov 2015 20:06:55 +0100 (CET) Subject: [pypy-commit] pypy no-class-specialize: backout 26259e6794f : not useful and caused weird issues in normalizecalls.py Message-ID: <20151106190655.4DB501C1327@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: no-class-specialize Changeset: r80569:5d9032ae97f5 Date: 2015-11-06 19:07 +0000 http://bitbucket.org/pypy/pypy/changeset/5d9032ae97f5/ Log: backout 26259e6794f : not useful and caused weird issues in normalizecalls.py diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -360,7 +360,7 @@ if pyobj.__module__ == '__builtin__': # avoid making classdefs for builtin types result = self.getfrozen(pyobj) else: - return self._new_classdesc(pyobj) + result = ClassDesc(self, pyobj) elif isinstance(pyobj, types.MethodType): if pyobj.im_self is None: # unbound return self.getdesc(pyobj.im_func) @@ -417,12 +417,6 @@ def valueoftype(self, t): return annotationoftype(t, self) - def _new_classdesc(self, pycls): - result = ClassDesc(self, pycls) - self.descs[pycls] = result - result._init_classdef() - return result - def get_classpbc_attr_families(self, attrname): """Return the UnionFind for the ClassAttrFamilies corresponding to attributes of the given name. From noreply at buildbot.pypy.org Fri Nov 6 15:44:15 2015 From: noreply at buildbot.pypy.org (alex_gaynor) Date: Fri, 6 Nov 2015 21:44:15 +0100 (CET) Subject: [pypy-commit] pypy default: issue 2183 -- free a buffer that OpenSSL allocates when we're done with it Message-ID: <20151106204415.3C59F1C1392@cobra.cs.uni-duesseldorf.de> Author: Alex Gaynor Branch: Changeset: r80570:3851b04286c3 Date: 2015-11-06 15:44 -0500 http://bitbucket.org/pypy/pypy/changeset/3851b04286c3/ Log: issue 2183 -- free a buffer that OpenSSL allocates when we're done with it diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -924,8 +924,11 @@ length = libssl_ASN1_STRING_to_UTF8(buf_ptr, value) if length < 0: raise _ssl_seterror(space, None, 0) - w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length)) - w_value = space.call_method(w_value, "decode", space.wrap("utf-8")) + try: + w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length)) + w_value = space.call_method(w_value, "decode", space.wrap("utf-8")) + finally: + libssl_OPENSSL_free(buf_ptr[0]) return space.newtuple([w_name, w_value]) From noreply at buildbot.pypy.org Fri Nov 6 20:54:25 2015 From: noreply at buildbot.pypy.org (alex_gaynor) Date: Sat, 7 Nov 2015 02:54:25 +0100 (CET) Subject: [pypy-commit] pypy default: issue 2183 -- free sk_DIST_POINT in SSLSocket.getpeerert() Message-ID: <20151107015425.85BA21C1392@cobra.cs.uni-duesseldorf.de> Author: Alex Gaynor Branch: Changeset: r80571:2690aff7d7b0 Date: 2015-11-06 20:54 -0500 http://bitbucket.org/pypy/pypy/changeset/2690aff7d7b0/ Log: issue 2183 -- free sk_DIST_POINT in SSLSocket.getpeerert() diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -968,20 +968,24 @@ if not dps: return None - cdp_w = [] - for i in range(libssl_sk_DIST_POINT_num(dps)): - dp = libssl_sk_DIST_POINT_value(dps, i) - gns = libssl_pypy_DIST_POINT_fullname(dp) + try: + cdp_w = [] + for i in range(libssl_sk_DIST_POINT_num(dps)): + dp = libssl_sk_DIST_POINT_value(dps, i) + gns = libssl_pypy_DIST_POINT_fullname(dp) - for j in range(libssl_sk_GENERAL_NAME_num(gns)): - name = libssl_sk_GENERAL_NAME_value(gns, j) - gntype = intmask(name.c_type) - if gntype != GEN_URI: - continue - uri = libssl_pypy_GENERAL_NAME_uri(name) - length = intmask(uri.c_length) - s_uri = rffi.charpsize2str(uri.c_data, length) - cdp_w.append(space.wrap(s_uri)) + for j in range(libssl_sk_GENERAL_NAME_num(gns)): + name = libssl_sk_GENERAL_NAME_value(gns, j) + gntype = intmask(name.c_type) + if gntype != GEN_URI: + continue + uri = libssl_pypy_GENERAL_NAME_uri(name) + length = intmask(uri.c_length) + s_uri = rffi.charpsize2str(uri.c_data, length) + cdp_w.append(space.wrap(s_uri)) + finally: + if OPENSSL_VERSION_NUMBER < 0x10001000: + libssl_sk_DIST_POINT_free(dps) return space.newtuple(cdp_w[:]) def checkwait(space, w_sock, writing): diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py --- a/rpython/rlib/ropenssl.py +++ b/rpython/rlib/ropenssl.py @@ -452,6 +452,8 @@ macro=True) ssl_external('sk_DIST_POINT_value', [stack_st_DIST_POINT, rffi.INT], DIST_POINT, macro=True) +ssl_external('sk_DIST_POINT_free', [stack_st_DIST_POINT], lltype.Void, + macro=True) ssl_external('pypy_DIST_POINT_fullname', [DIST_POINT], GENERAL_NAMES, macro=True) ssl_external('sk_ACCESS_DESCRIPTION_num', [AUTHORITY_INFO_ACCESS], rffi.INT, From noreply at buildbot.pypy.org Sat Nov 7 08:33:23 2015 From: noreply at buildbot.pypy.org (fijal) Date: Sat, 7 Nov 2015 14:33:23 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: progress Message-ID: <20151107133323.E9FE11C08F6@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80572:0e7edf95c3c5 Date: 2015-11-07 13:18 +0000 http://bitbucket.org/pypy/pypy/changeset/0e7edf95c3c5/ Log: progress diff --git a/rpython/memory/gctransform/shadowstack.py b/rpython/memory/gctransform/shadowstack.py --- a/rpython/memory/gctransform/shadowstack.py +++ b/rpython/memory/gctransform/shadowstack.py @@ -74,14 +74,12 @@ self.decr_stack = decr_stack def walk_stack_root(callback, start, end): - # shadowstack[0] contains the vmprof stack gc = self.gc addr = end - addr -= sizeofaddr while addr != start: + addr -= sizeofaddr if gc.points_to_valid_gc_object(addr): callback(gc, addr) - addr -= sizeofaddr self.rootstackhook = walk_stack_root self.shadow_stack_pool = ShadowStackPool(gcdata) @@ -284,8 +282,7 @@ def start_fresh_new_state(self): self.gcdata.root_stack_base = self.unused_full_stack - # shadowstack[0] contains the vmprof stack - self.gcdata.root_stack_top = self.unused_full_stack + sizeofaddr + self.gcdata.root_stack_top = self.unused_full_stack self.unused_full_stack = llmemory.NULL def _cleanup(self, shadowstackref): @@ -312,14 +309,12 @@ SHADOWSTACKREFPTR.TO.become(SHADOWSTACKREF) def customtrace(gc, obj, callback, arg): - # we intentionally don't read shadowstack[0] obj = llmemory.cast_adr_to_ptr(obj, SHADOWSTACKREFPTR) addr = obj.top start = obj.base - addr -= sizeofaddr while addr != start: + addr -= sizeofaddr gc._trace_callback(callback, arg, addr) - addr -= sizeofaddr gc = gctransformer.gcdata.gc assert not hasattr(gc, 'custom_trace_dispatcher') diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -103,28 +103,25 @@ argnames = ", ".join(["arg%d" % i for i in range(len(token))]) target = target.join('trampoline_%s_%s.vmprof.c' % (name, token)) target.write(""" -typedef struct vmprof_stack { - struct vmprof_stack* next; - long value; -}; +#include "vmprof_stack.h" %(type)s %(cont_name)s(%(llargs)s); -%(type)s %(tramp_name)s(%(llargs)s, long unique_id, void** shadowstack_base) +%(type)s %(tramp_name)s(%(llargs)s, long unique_id) { %(type)s result; struct vmprof_stack node; node.value = unique_id; - node.next = (struct vmprof_stack*)shadowstack_base[0]; - shadowstack_base[0] = (void*)(&node); + node.next = vmprof_global_stack; + vmprof_global_stack = &node; result = %(cont_name)s(%(argnames)s); - shadowstack_base[0] = node.next; + vmprof_global_stack = node.next; return result; } """ % locals()) return finish_ll_trampoline(tramp_name, tramp_name, target, token, - restok, True) + restok) def make_trampoline_function(name, func, token, restok): from rpython.jit.backend import detect_cpu @@ -191,14 +188,11 @@ %(size_decl)s """ % locals()) return finish_ll_trampoline(orig_tramp_name, tramp_name, target, token, - restok, False) + restok) -def finish_ll_trampoline(orig_tramp_name, tramp_name, target, token, restok, - accepts_shadowstack): +def finish_ll_trampoline(orig_tramp_name, tramp_name, target, token, restok): extra_args = ['long'] - if accepts_shadowstack: - extra_args.append("void*") header = 'RPY_EXTERN %s %s(%s);\n' % ( token2ctype(restok), orig_tramp_name, @@ -223,8 +217,6 @@ ) ARGS = [token2lltype(tok) for tok in token] + [lltype.Signed] - if accepts_shadowstack: - ARGS.append(llmemory.Address) return rffi.llexternal( orig_tramp_name, ARGS, token2lltype(restok), diff --git a/rpython/rlib/rvmprof/rvmprof.py b/rpython/rlib/rvmprof/rvmprof.py --- a/rpython/rlib/rvmprof/rvmprof.py +++ b/rpython/rlib/rvmprof/rvmprof.py @@ -202,10 +202,9 @@ else: # this is the case of the stack if we_are_translated() and not jit.we_are_jitted(): unique_id = get_code_fn(*args)._vmprof_unique_id - shadowstack_0 = llop.gc_adr_of_root_stack_base(llmemory.Address) ll_args, token = lower(*args) ll_trampoline = get_ll_trampoline(token, True) - ll_result = ll_trampoline(*ll_args + (unique_id, shadowstack_0)) + ll_result = ll_trampoline(*ll_args + (unique_id,)) else: return func(*args) if result_class is not None: diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h --- a/rpython/rlib/rvmprof/src/vmprof_main.h +++ b/rpython/rlib/rvmprof/src/vmprof_main.h @@ -37,7 +37,7 @@ #include "vmprof_unwind.h" #endif #include "vmprof_mt.h" - +#include "vmprof_stack.h" /************************************************************/ @@ -144,6 +144,8 @@ #define VERSION_BASE '\x00' #define VERSION_THREAD_ID '\x01' +vmprof_stack* vmprof_global_stack = NULL; + struct prof_stacktrace_s { char padding[sizeof(long) - 1]; char marker; @@ -211,7 +213,13 @@ static int get_stack_trace(void **result, int max_depth, ucontext_t *ucontext) { - return 0; + // read the first slot of shadowstack + struct vmprof_stack* stack = vmprof_global_stack; + if (!stack) { + return 0; + } + result[0] = (void*)stack->value; + return 1; } static int xxx_get_stack_trace(void** result, int max_depth, ucontext_t *ucontext) From noreply at buildbot.pypy.org Sat Nov 7 08:33:26 2015 From: noreply at buildbot.pypy.org (fijal) Date: Sat, 7 Nov 2015 14:33:26 +0100 (CET) Subject: [pypy-commit] pypy default: a blind fix, will test on linux Message-ID: <20151107133326.1B8D21C1215@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: Changeset: r80573:92d9d1215d2a Date: 2015-11-07 13:33 +0000 http://bitbucket.org/pypy/pypy/changeset/92d9d1215d2a/ Log: a blind fix, will test on linux diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -1306,6 +1306,9 @@ return self + def __del__(self): + lbssl_SSL_CTX_free(self.ctx) + @unwrap_spec(server_side=int) def descr_wrap_socket(self, space, w_sock, server_side, w_server_hostname=None, w_ssl_sock=None): return _SSLSocket.descr_new(space, self, w_sock, server_side, w_server_hostname, w_ssl_sock) From noreply at buildbot.pypy.org Sat Nov 7 08:35:22 2015 From: noreply at buildbot.pypy.org (fijal) Date: Sat, 7 Nov 2015 14:35:22 +0100 (CET) Subject: [pypy-commit] pypy default: typo Message-ID: <20151107133522.74BF01C08F6@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: Changeset: r80574:6756dcc87ae5 Date: 2015-11-07 13:35 +0000 http://bitbucket.org/pypy/pypy/changeset/6756dcc87ae5/ Log: typo diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -1307,7 +1307,7 @@ return self def __del__(self): - lbssl_SSL_CTX_free(self.ctx) + libssl_SSL_CTX_free(self.ctx) @unwrap_spec(server_side=int) def descr_wrap_socket(self, space, w_sock, server_side, w_server_hostname=None, w_ssl_sock=None): From noreply at buildbot.pypy.org Sat Nov 7 09:45:38 2015 From: noreply at buildbot.pypy.org (fijal) Date: Sat, 7 Nov 2015 15:45:38 +0100 (CET) Subject: [pypy-commit] pypy default: a bit imperfect estimation on how much memory context takes (depending on the exact calls) Message-ID: <20151107144538.7E9BB1C12BE@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: Changeset: r80575:74a3de08b431 Date: 2015-11-07 14:45 +0000 http://bitbucket.org/pypy/pypy/changeset/74a3de08b431/ Log: a bit imperfect estimation on how much memory context takes (depending on the exact calls) diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -1,4 +1,4 @@ -from rpython.rlib import rpoll, rsocket, rthread, rweakref +from rpython.rlib import rpoll, rsocket, rthread, rweakref, rgc from rpython.rlib.rarithmetic import intmask, widen, r_uint from rpython.rlib.ropenssl import * from pypy.module._socket import interp_socket @@ -1280,6 +1280,7 @@ if not ctx: raise ssl_error(space, "failed to allocate SSL context") + rgc.add_memory_pressure(10 * 1024 * 1024) self = space.allocate_instance(_SSLContext, w_subtype) self.ctx = ctx self.check_hostname = False From noreply at buildbot.pypy.org Sat Nov 7 10:28:35 2015 From: noreply at buildbot.pypy.org (alex_gaynor) Date: Sat, 7 Nov 2015 16:28:35 +0100 (CET) Subject: [pypy-commit] pypy default: ensure the extension gets freed Message-ID: <20151107152835.81AE91C1215@cobra.cs.uni-duesseldorf.de> Author: Alex Gaynor Branch: Changeset: r80576:43b5395e293d Date: 2015-11-07 10:29 -0500 http://bitbucket.org/pypy/pypy/changeset/43b5395e293d/ Log: ensure the extension gets freed diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -936,9 +936,10 @@ def _get_aia_uri(space, certificate, nid): info = rffi.cast(AUTHORITY_INFO_ACCESS, libssl_X509_get_ext_d2i( certificate, NID_info_access, None, None)) - if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0: - return try: + if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0: + return + result_w = [] for i in range(libssl_sk_ACCESS_DESCRIPTION_num(info)): ad = libssl_sk_ACCESS_DESCRIPTION_value(info, i) From noreply at buildbot.pypy.org Sat Nov 7 10:32:04 2015 From: noreply at buildbot.pypy.org (fijal) Date: Sat, 7 Nov 2015 16:32:04 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: fixes, does not work untranslated but should mostly work translated Message-ID: <20151107153204.474351C1215@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80577:c7ff25c0c06e Date: 2015-11-07 15:32 +0000 http://bitbucket.org/pypy/pypy/changeset/c7ff25c0c06e/ Log: fixes, does not work untranslated but should mostly work translated diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -11,16 +11,14 @@ class VMProfPlatformUnsupported(Exception): pass +ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof') +SRC = ROOT.join('src') + def setup(): if not detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64): raise VMProfPlatformUnsupported("rvmprof only supports" " x86-64 CPUs for now") - - ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof') - SRC = ROOT.join('src') - - if sys.platform.startswith('linux'): libs = ['dl'] else: @@ -101,9 +99,10 @@ target = udir.join('module_cache') target.ensure(dir=1) argnames = ", ".join(["arg%d" % i for i in range(len(token))]) + vmprof_stack_h = SRC.join("vmprof_stack.h").read() target = target.join('trampoline_%s_%s.vmprof.c' % (name, token)) target.write(""" -#include "vmprof_stack.h" +%(vmprof_stack_h)s %(type)s %(cont_name)s(%(llargs)s); diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h --- a/rpython/rlib/rvmprof/src/vmprof_main.h +++ b/rpython/rlib/rvmprof/src/vmprof_main.h @@ -215,11 +215,13 @@ { // read the first slot of shadowstack struct vmprof_stack* stack = vmprof_global_stack; - if (!stack) { - return 0; + int n = 0; + while (n < max_depth && stack) { + result[n] = (void*)stack->value; + stack = stack->next; + n++; } - result[0] = (void*)stack->value; - return 1; + return n; } static int xxx_get_stack_trace(void** result, int max_depth, ucontext_t *ucontext) diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py --- a/rpython/rlib/rvmprof/test/test_rvmprof.py +++ b/rpython/rlib/rvmprof/test/test_rvmprof.py @@ -25,7 +25,7 @@ return 0 assert f() == 0 - fn = compile(f, [], gcpolicy="minimark") + fn = compile(f, []) assert fn() == 0 @@ -53,7 +53,7 @@ return 0 assert f() == 0 - fn = compile(f, [], gcpolicy="minimark") + fn = compile(f, []) assert fn() == 0 @@ -79,7 +79,7 @@ return 0 assert f() == 0 - fn = compile(f, [], gcpolicy="minimark") + fn = compile(f, []) assert fn() == 0 From noreply at buildbot.pypy.org Sat Nov 7 13:15:17 2015 From: noreply at buildbot.pypy.org (fijal) Date: Sat, 7 Nov 2015 19:15:17 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: add a missing file Message-ID: <20151107181517.39FAD1C1215@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80578:f637b4caf574 Date: 2015-11-07 18:15 +0000 http://bitbucket.org/pypy/pypy/changeset/f637b4caf574/ Log: add a missing file diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h new file mode 100644 --- /dev/null +++ b/rpython/rlib/rvmprof/src/vmprof_stack.h @@ -0,0 +1,7 @@ + +typedef struct vmprof_stack { + struct vmprof_stack* next; + long value; +} vmprof_stack; + +extern vmprof_stack* vmprof_global_stack; \ No newline at end of file From noreply at buildbot.pypy.org Sat Nov 7 13:18:53 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Sat, 7 Nov 2015 19:18:53 +0100 (CET) Subject: [pypy-commit] pypy no-class-specialize: Special handling for _immutable_fields_ in ClassDesc so that it works with mixins Message-ID: <20151107181853.E0B411C1215@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: no-class-specialize Changeset: r80579:15047fa335bd Date: 2015-11-07 18:19 +0000 http://bitbucket.org/pypy/pypy/changeset/15047fa335bd/ Log: Special handling for _immutable_fields_ in ClassDesc so that it works with mixins diff --git a/rpython/annotator/classdesc.py b/rpython/annotator/classdesc.py --- a/rpython/annotator/classdesc.py +++ b/rpython/annotator/classdesc.py @@ -512,6 +512,15 @@ elif baselist == [BaseException]: baselist = [Exception] + immutable_fields = cls.__dict__.get('_immutable_fields_', []) + # To prevent confusion, we forbid strings. Any other bona fide sequence + # of strings is OK. + if isinstance(immutable_fields, basestring): + raise AnnotatorError( + "In class %s, '_immutable_fields_' must be a sequence of " + "attribute names, not a string." % cls) + self.immutable_fields = set(immutable_fields) + mixins_before = [] mixins_after = [] base = object @@ -627,6 +636,10 @@ if name in skip: continue self.add_source_attribute(name, value, mixin=True) + if '_immutable_fields_' in base.__dict__: + self.immutable_fields.update( + set(base.__dict__['_immutable_fields_'])) + def add_sources_for_class(self, cls): for name, value in cls.__dict__.items(): @@ -794,8 +807,8 @@ search2 = '%s?[*]' % (attr,) cdesc = self while cdesc is not None: - immutable_fields = cdesc.get_param('_immutable_fields_', inherit=False) - if immutable_fields is not None: + immutable_fields = cdesc.immutable_fields + if immutable_fields: if (search1 in immutable_fields or search2 in immutable_fields): s_result.listdef.never_resize() s_copy = s_result.listdef.offspring() diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -3730,7 +3730,7 @@ def test_return_immutable_list(self): class A: - _immutable_fields_ = 'lst[*]' + _immutable_fields_ = ['lst[*]'] def f(n): a = A() l1 = [n, 0] @@ -3744,7 +3744,7 @@ def test_return_immutable_list_quasiimmut_field(self): class A: - _immutable_fields_ = 'lst?[*]' + _immutable_fields_ = ['lst?[*]'] def f(n): a = A() l1 = [n, 0] @@ -3758,7 +3758,7 @@ def test_immutable_list_is_actually_resized(self): class A: - _immutable_fields_ = 'lst[*]' + _immutable_fields_ = ['lst[*]'] def f(n): a = A() l1 = [n] @@ -3771,7 +3771,7 @@ def test_immutable_list_is_assigned_a_resizable_list(self): class A: - _immutable_fields_ = 'lst[*]' + _immutable_fields_ = ['lst[*]'] def f(n): a = A() foo = [] @@ -3783,7 +3783,7 @@ def test_can_merge_immutable_list_with_regular_list(self): class A: - _immutable_fields_ = 'lst[*]' + _immutable_fields_ = ['lst[*]'] def foo(lst): pass @@ -3821,7 +3821,7 @@ class Root: pass class A(Root): - _immutable_fields_ = '_my_lst[*]' + _immutable_fields_ = ['_my_lst[*]'] def __init__(self, lst): self._my_lst = lst def foo(x): diff --git a/rpython/annotator/test/test_description.py b/rpython/annotator/test/test_description.py --- a/rpython/annotator/test/test_description.py +++ b/rpython/annotator/test/test_description.py @@ -30,3 +30,14 @@ assert is_mixin(Mixin1) assert not is_mixin(A) + +def test_immutable_fields_collection(): + class Base(object): + _immutable_fields_ = ['a'] + class Mixin(object): + _mixin_ = True + _immutable_fields_ = ['b'] + class A(Base, Mixin): + _immutable_fields_ = ['c'] + bk = FakeBookkeeper() + assert bk.getdesc(A).immutable_fields == {'b', 'c'} diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py --- a/rpython/rtyper/rclass.py +++ b/rpython/rtyper/rclass.py @@ -2,7 +2,6 @@ import types from rpython.flowspace.model import Constant -from rpython.flowspace.operation import op from rpython.annotator import description, model as annmodel from rpython.rlib.objectmodel import UnboxedValue from rpython.tool.pairtype import pairtype, pair @@ -543,11 +542,9 @@ self.classdef,)) else: hints['immutable'] = True - self.immutable_field_set = set() # unless overwritten below - if classdesc.get_param('_immutable_fields_'): - own_fields = classdesc.get_param('_immutable_fields_', inherit=False) - if own_fields is not None: - self.immutable_field_set = set(own_fields) + self.immutable_field_set = classdesc.immutable_fields + if (classdesc.immutable_fields or + 'immutable_fields' in self.rbase.object_type._hints): accessor = FieldListAccessor() hints['immutable_fields'] = accessor return hints From noreply at buildbot.pypy.org Sat Nov 7 13:30:20 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 7 Nov 2015 19:30:20 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: Fix untranslated tests (hopefully without breaking translation) Message-ID: <20151107183020.0E88B1C1327@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: vmprof-newstack Changeset: r80580:a92f0641ba59 Date: 2015-11-07 19:29 +0100 http://bitbucket.org/pypy/pypy/changeset/a92f0641ba59/ Log: Fix untranslated tests (hopefully without breaking translation) diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -14,30 +14,31 @@ ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof') SRC = ROOT.join('src') +if sys.platform.startswith('linux'): + _libs = ['dl'] +else: + _libs = [] +eci_kwds = dict( + include_dirs = [SRC], + includes = ['rvmprof.h'], + libraries = _libs, + separate_module_files = [SRC.join('rvmprof.c')], + post_include_bits=['#define RPYTHON_VMPROF\n'], + ) +global_eci = ExternalCompilationInfo(**eci_kwds) + + def setup(): if not detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64): raise VMProfPlatformUnsupported("rvmprof only supports" " x86-64 CPUs for now") - if sys.platform.startswith('linux'): - libs = ['dl'] - else: - libs = [] - - eci_kwds = dict( - include_dirs = [SRC], - includes = ['rvmprof.h'], - libraries = libs, - separate_module_files = [SRC.join('rvmprof.c')], - post_include_bits=['#define RPYTHON_VMPROF\n'], - ) - eci = ExternalCompilationInfo(**eci_kwds) - platform.verify_eci(ExternalCompilationInfo( compile_extra=['-DRPYTHON_LL2CTYPES'], **eci_kwds)) + eci = global_eci vmprof_init = rffi.llexternal("vmprof_init", [rffi.INT, rffi.DOUBLE, rffi.CCHARP], rffi.CCHARP, compilation_info=eci) @@ -102,6 +103,7 @@ vmprof_stack_h = SRC.join("vmprof_stack.h").read() target = target.join('trampoline_%s_%s.vmprof.c' % (name, token)) target.write(""" +#include "src/precommondefs.h" %(vmprof_stack_h)s %(type)s %(cont_name)s(%(llargs)s); @@ -214,6 +216,7 @@ post_include_bits = [header], separate_module_files = [str(target)], ) + eci = eci.merge(global_eci) ARGS = [token2lltype(tok) for tok in token] + [lltype.Signed] return rffi.llexternal( diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h --- a/rpython/rlib/rvmprof/src/vmprof_stack.h +++ b/rpython/rlib/rvmprof/src/vmprof_stack.h @@ -4,4 +4,4 @@ long value; } vmprof_stack; -extern vmprof_stack* vmprof_global_stack; \ No newline at end of file +RPY_EXTERN vmprof_stack* vmprof_global_stack; From noreply at buildbot.pypy.org Sat Nov 7 15:58:48 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Sat, 7 Nov 2015 21:58:48 +0100 (CET) Subject: [pypy-commit] pypy no-class-specialize: Fix ann_override.py Message-ID: <20151107205848.645811C08F6@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: no-class-specialize Changeset: r80581:153b7fd05abd Date: 2015-11-07 20:59 +0000 http://bitbucket.org/pypy/pypy/changeset/153b7fd05abd/ Log: Fix ann_override.py diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -50,38 +50,18 @@ typ = (None, str) return funcdesc.cachedgraph(typ) - def _remember_immutable(self, t, cached): - # for jit benefit - if cached not in t._immutable_fields_: # accessed this way just - # for convenience - t._immutable_fields_.append(cached) - - def attach_lookup(self, t, attr): - cached = "cached_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup(attr)) - return True - return False - - def attach_lookup_in_type_where(self, t, attr): - cached = "cached_where_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup_where(attr)) - return True - return False - def consider_lookup(self, bookkeeper, attr): assert attr not in self.lookups from pypy.objspace.std import typeobject cached = "cached_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant(None) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups[attr] = True @@ -92,10 +72,12 @@ cached = "cached_where_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant((None, None)) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup_in_type_where(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup_where(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups_where[attr] = True @@ -137,13 +119,15 @@ self.pypytypes[x] = True #print "TYPE", x for attr in self.lookups: - if attr and self.attach_lookup(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_%s" % attr + setattr(x, cached, x._lookup(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) for attr in self.lookups_where: - if attr and self.attach_lookup_in_type_where(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_where_%s" % attr + setattr(x, cached, x._lookup_where(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) return From noreply at buildbot.pypy.org Sun Nov 8 03:52:42 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 8 Nov 2015 09:52:42 +0100 (CET) Subject: [pypy-commit] pypy default: Kill the resoperations GETFIELD_RAW_PURE and GETARRAYITEM_RAW_PURE. I Message-ID: <20151108085242.A05421C12D4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80582:fbf3fccc271a Date: 2015-11-08 09:35 +0100 http://bitbucket.org/pypy/pypy/changeset/fbf3fccc271a/ Log: Kill the resoperations GETFIELD_RAW_PURE and GETARRAYITEM_RAW_PURE. I could not find a single case where PyPy emits them, and it simplifies code a little bit. Replaced with logic in pyjitpl to detect from the descr if the read can be constant-folded or not; if not, always emit the regular non-PURE operation. (It is common to have the jitcode do a getfield_raw on a vtable, but this case can always be constant-folded.) Fixes a theoretical segfault when the unroller would see a GET*_RAW_PURE and runs it speculatively in the 2nd unrolled version of the loop. diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py --- a/rpython/jit/backend/arm/opassembler.py +++ b/rpython/jit/backend/arm/opassembler.py @@ -680,8 +680,6 @@ emit_op_getfield_gc_pure_f = _genop_getfield emit_op_getfield_raw_i = _genop_getfield emit_op_getfield_raw_f = _genop_getfield - emit_op_getfield_raw_pure_i = _genop_getfield - emit_op_getfield_raw_pure_f = _genop_getfield def emit_op_increment_debug_counter(self, op, arglocs, regalloc, fcond): base_loc, value_loc = arglocs @@ -825,8 +823,6 @@ emit_op_getarrayitem_gc_pure_f = _genop_getarrayitem emit_op_getarrayitem_raw_i = _genop_getarrayitem emit_op_getarrayitem_raw_f = _genop_getarrayitem - emit_op_getarrayitem_raw_pure_i = _genop_getarrayitem - emit_op_getarrayitem_raw_pure_f = _genop_getarrayitem def _load_from_mem(self, res_loc, base_loc, ofs_loc, scale, signed=False, fcond=c.AL): diff --git a/rpython/jit/backend/arm/regalloc.py b/rpython/jit/backend/arm/regalloc.py --- a/rpython/jit/backend/arm/regalloc.py +++ b/rpython/jit/backend/arm/regalloc.py @@ -847,8 +847,6 @@ prepare_op_getfield_gc_f = _prepare_op_getfield prepare_op_getfield_raw_i = _prepare_op_getfield prepare_op_getfield_raw_f = _prepare_op_getfield - prepare_op_getfield_raw_pure_i = _prepare_op_getfield - prepare_op_getfield_raw_pure_f = _prepare_op_getfield prepare_op_getfield_gc_pure_i = _prepare_op_getfield prepare_op_getfield_gc_pure_r = _prepare_op_getfield prepare_op_getfield_gc_pure_f = _prepare_op_getfield @@ -942,8 +940,6 @@ prepare_op_getarrayitem_gc_f = _prepare_op_getarrayitem prepare_op_getarrayitem_raw_i = _prepare_op_getarrayitem prepare_op_getarrayitem_raw_f = _prepare_op_getarrayitem - prepare_op_getarrayitem_raw_pure_i = _prepare_op_getarrayitem - prepare_op_getarrayitem_raw_pure_f = _prepare_op_getarrayitem prepare_op_getarrayitem_gc_pure_i = _prepare_op_getarrayitem prepare_op_getarrayitem_gc_pure_r = _prepare_op_getarrayitem prepare_op_getarrayitem_gc_pure_f = _prepare_op_getarrayitem diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -613,9 +613,6 @@ bh_getfield_gc_f = bh_getfield_gc bh_getfield_raw = bh_getfield_gc - bh_getfield_raw_pure_i = bh_getfield_raw - bh_getfield_raw_pure_r = bh_getfield_raw - bh_getfield_raw_pure_f = bh_getfield_raw bh_getfield_raw_i = bh_getfield_raw bh_getfield_raw_r = bh_getfield_raw bh_getfield_raw_f = bh_getfield_raw @@ -651,9 +648,6 @@ bh_getarrayitem_gc_f = bh_getarrayitem_gc bh_getarrayitem_raw = bh_getarrayitem_gc - bh_getarrayitem_raw_pure_i = bh_getarrayitem_raw - bh_getarrayitem_raw_pure_r = bh_getarrayitem_raw - bh_getarrayitem_raw_pure_f = bh_getarrayitem_raw bh_getarrayitem_raw_i = bh_getarrayitem_raw bh_getarrayitem_raw_r = bh_getarrayitem_raw bh_getarrayitem_raw_f = bh_getarrayitem_raw diff --git a/rpython/jit/backend/ppc/opassembler.py b/rpython/jit/backend/ppc/opassembler.py --- a/rpython/jit/backend/ppc/opassembler.py +++ b/rpython/jit/backend/ppc/opassembler.py @@ -803,8 +803,6 @@ emit_getfield_gc_pure_f = _genop_getfield emit_getfield_raw_i = _genop_getfield emit_getfield_raw_f = _genop_getfield - emit_getfield_raw_pure_i = _genop_getfield - emit_getfield_raw_pure_f = _genop_getfield SIZE2SCALE = dict([(1<<_i, _i) for _i in range(32)]) @@ -893,8 +891,6 @@ emit_getarrayitem_gc_pure_f = _genop_getarray_or_interiorfield emit_getarrayitem_raw_i = _genop_getarray_or_interiorfield emit_getarrayitem_raw_f = _genop_getarray_or_interiorfield - emit_getarrayitem_raw_pure_i = _genop_getarray_or_interiorfield - emit_getarrayitem_raw_pure_f = _genop_getarray_or_interiorfield emit_raw_store = emit_setarrayitem_gc emit_raw_load_i = _genop_getarray_or_interiorfield diff --git a/rpython/jit/backend/ppc/regalloc.py b/rpython/jit/backend/ppc/regalloc.py --- a/rpython/jit/backend/ppc/regalloc.py +++ b/rpython/jit/backend/ppc/regalloc.py @@ -711,8 +711,6 @@ prepare_getfield_gc_f = _prepare_getfield prepare_getfield_raw_i = _prepare_getfield prepare_getfield_raw_f = _prepare_getfield - prepare_getfield_raw_pure_i = _prepare_getfield - prepare_getfield_raw_pure_f = _prepare_getfield prepare_getfield_gc_pure_i = _prepare_getfield prepare_getfield_gc_pure_r = _prepare_getfield prepare_getfield_gc_pure_f = _prepare_getfield @@ -796,8 +794,6 @@ prepare_getarrayitem_gc_f = _prepare_getarrayitem prepare_getarrayitem_raw_i = _prepare_getarrayitem prepare_getarrayitem_raw_f = _prepare_getarrayitem - prepare_getarrayitem_raw_pure_i = _prepare_getarrayitem - prepare_getarrayitem_raw_pure_f = _prepare_getarrayitem prepare_getarrayitem_gc_pure_i = _prepare_getarrayitem prepare_getarrayitem_gc_pure_r = _prepare_getarrayitem prepare_getarrayitem_gc_pure_f = _prepare_getarrayitem diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1477,8 +1477,6 @@ genop_getfield_gc_f = _genop_getfield genop_getfield_raw_i = _genop_getfield genop_getfield_raw_f = _genop_getfield - genop_getfield_raw_pure_i = _genop_getfield - genop_getfield_raw_pure_f = _genop_getfield genop_getfield_gc_pure_i = _genop_getfield genop_getfield_gc_pure_r = _genop_getfield genop_getfield_gc_pure_f = _genop_getfield @@ -1499,8 +1497,6 @@ genop_getarrayitem_gc_pure_f = _genop_getarrayitem genop_getarrayitem_raw_i = _genop_getarrayitem genop_getarrayitem_raw_f = _genop_getarrayitem - genop_getarrayitem_raw_pure_i = _genop_getarrayitem - genop_getarrayitem_raw_pure_f = _genop_getarrayitem def _genop_raw_load(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, ofs, sign_loc = arglocs diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1141,8 +1141,6 @@ consider_getfield_gc_f = _consider_getfield consider_getfield_raw_i = _consider_getfield consider_getfield_raw_f = _consider_getfield - consider_getfield_raw_pure_i = _consider_getfield - consider_getfield_raw_pure_f = _consider_getfield consider_getfield_gc_pure_i = _consider_getfield consider_getfield_gc_pure_r = _consider_getfield consider_getfield_gc_pure_f = _consider_getfield @@ -1172,8 +1170,6 @@ consider_getarrayitem_gc_pure_i = _consider_getarrayitem consider_getarrayitem_gc_pure_r = _consider_getarrayitem consider_getarrayitem_gc_pure_f = _consider_getarrayitem - consider_getarrayitem_raw_pure_i = _consider_getarrayitem - consider_getarrayitem_raw_pure_f = _consider_getarrayitem consider_raw_load_i = _consider_getarrayitem consider_raw_load_f = _consider_getarrayitem diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -703,6 +703,12 @@ pure = '_pure' arraydescr = self.cpu.arraydescrof(ARRAY) kind = getkind(op.result.concretetype) + if ARRAY._gckind != 'gc': + assert ARRAY._gckind == 'raw' + if kind == 'r': + raise Exception("getarrayitem_raw_r not supported") + pure = '' # always redetected from pyjitpl.py: we don't need + # a '_pure' version of getarrayitem_raw return SpaceOperation('getarrayitem_%s_%s%s' % (ARRAY._gckind, kind[0], pure), [op.args[0], op.args[1], arraydescr], @@ -792,12 +798,17 @@ descr = self.cpu.fielddescrof(v_inst.concretetype.TO, c_fieldname.value) kind = getkind(RESULT)[0] + if argname != 'gc': + assert argname == 'raw' + if (kind, pure) == ('r', ''): + # note: a pure 'getfield_raw_r' is used e.g. to load class + # attributes that are GC objects, so that one is supported. + raise Exception("getfield_raw_r (without _pure) not supported") + pure = '' # always redetected from pyjitpl.py: we don't need + # a '_pure' version of getfield_raw + # op1 = SpaceOperation('getfield_%s_%s%s' % (argname, kind, pure), [v_inst, descr], op.result) - if op1.opname == 'getfield_raw_r': - # note: 'getfield_raw_r_pure' is used e.g. to load class - # attributes that are GC objects, so that one is supported. - raise Exception("getfield_raw_r (without _pure) not supported") # if immut in (IR_QUASIIMMUTABLE, IR_QUASIIMMUTABLE_ARRAY): op1.opname += "_pure" diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py --- a/rpython/jit/metainterp/blackhole.py +++ b/rpython/jit/metainterp/blackhole.py @@ -1266,9 +1266,6 @@ def bhimpl_getarrayitem_raw_f(cpu, array, index, arraydescr): return cpu.bh_getarrayitem_raw_f(array, index, arraydescr) - bhimpl_getarrayitem_raw_i_pure = bhimpl_getarrayitem_raw_i - bhimpl_getarrayitem_raw_f_pure = bhimpl_getarrayitem_raw_f - @arguments("cpu", "r", "i", "i", "d") def bhimpl_setarrayitem_gc_i(cpu, array, index, newvalue, arraydescr): cpu.bh_setarrayitem_gc_i(array, index, newvalue, arraydescr) @@ -1387,17 +1384,12 @@ def bhimpl_getfield_raw_i(cpu, struct, fielddescr): return cpu.bh_getfield_raw_i(struct, fielddescr) @arguments("cpu", "i", "d", returns="r") - def _bhimpl_getfield_raw_r(cpu, struct, fielddescr): - # only for 'getfield_raw_r_pure' + def bhimpl_getfield_raw_r(cpu, struct, fielddescr): # for pure only return cpu.bh_getfield_raw_r(struct, fielddescr) @arguments("cpu", "i", "d", returns="f") def bhimpl_getfield_raw_f(cpu, struct, fielddescr): return cpu.bh_getfield_raw_f(struct, fielddescr) - bhimpl_getfield_raw_i_pure = bhimpl_getfield_raw_i - bhimpl_getfield_raw_r_pure = _bhimpl_getfield_raw_r - bhimpl_getfield_raw_f_pure = bhimpl_getfield_raw_f - @arguments("cpu", "r", "i", "d") def bhimpl_setfield_gc_i(cpu, struct, newvalue, fielddescr): cpu.bh_setfield_gc_i(struct, newvalue, fielddescr) diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -500,16 +500,6 @@ arraydescr, arraybox, indexbox) @arguments("box", "box", "descr") - def opimpl_getarrayitem_raw_i_pure(self, arraybox, indexbox, arraydescr): - return self.execute_with_descr(rop.GETARRAYITEM_RAW_PURE_I, - arraydescr, arraybox, indexbox) - - @arguments("box", "box", "descr") - def opimpl_getarrayitem_raw_f_pure(self, arraybox, indexbox, arraydescr): - return self.execute_with_descr(rop.GETARRAYITEM_RAW_PURE_F, - arraydescr, arraybox, indexbox) - - @arguments("box", "box", "descr") def opimpl_getarrayitem_gc_i_pure(self, arraybox, indexbox, arraydescr): if isinstance(arraybox, ConstPtr) and isinstance(indexbox, ConstInt): # if the arguments are directly constants, bypass the heapcache @@ -792,19 +782,12 @@ def opimpl_getfield_raw_i(self, box, fielddescr): return self.execute_with_descr(rop.GETFIELD_RAW_I, fielddescr, box) @arguments("box", "descr") + def opimpl_getfield_raw_r(self, box, fielddescr): # for pure only + return self.execute_with_descr(rop.GETFIELD_RAW_R, fielddescr, box) + @arguments("box", "descr") def opimpl_getfield_raw_f(self, box, fielddescr): return self.execute_with_descr(rop.GETFIELD_RAW_F, fielddescr, box) - @arguments("box", "descr") - def opimpl_getfield_raw_i_pure(self, box, fielddescr): - return self.execute_with_descr(rop.GETFIELD_RAW_PURE_I, fielddescr, box) - @arguments("box", "descr") - def opimpl_getfield_raw_r_pure(self, box, fielddescr): - return self.execute_with_descr(rop.GETFIELD_RAW_PURE_R, fielddescr, box) - @arguments("box", "descr") - def opimpl_getfield_raw_f_pure(self, box, fielddescr): - return self.execute_with_descr(rop.GETFIELD_RAW_PURE_F, fielddescr, box) - @arguments("box", "box", "descr") def _opimpl_setfield_raw_any(self, box, valuebox, fielddescr): self.execute_with_descr(rop.SETFIELD_RAW, fielddescr, box, valuebox) @@ -2093,7 +2076,17 @@ profiler = self.staticdata.profiler profiler.count_ops(opnum) resvalue = executor.execute(self.cpu, self, opnum, descr, *argboxes) - if rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST: + # + is_pure = rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST + if not is_pure: + if (opnum == rop.GETFIELD_RAW_I or + opnum == rop.GETFIELD_RAW_R or + opnum == rop.GETFIELD_RAW_F or + opnum == rop.GETARRAYITEM_RAW_I or + opnum == rop.GETARRAYITEM_RAW_F): + is_pure = descr.is_always_pure() + # + if is_pure: return self._record_helper_pure(opnum, resvalue, descr, *argboxes) if rop._OVF_FIRST <= opnum <= rop._OVF_LAST: return self._record_helper_ovf(opnum, resvalue, descr, *argboxes) diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1091,9 +1091,9 @@ 'STRLEN/1/i', 'STRGETITEM/2/i', 'GETFIELD_GC_PURE/1d/rfi', - 'GETFIELD_RAW_PURE/1d/rfi', 'GETARRAYITEM_GC_PURE/2d/rfi', - 'GETARRAYITEM_RAW_PURE/2d/fi', + #'GETFIELD_RAW_PURE/1d/rfi', these two operations not useful and + #'GETARRAYITEM_RAW_PURE/2d/fi', dangerous when unrolling speculatively 'UNICODELEN/1/i', 'UNICODEGETITEM/2/i', # @@ -1371,8 +1371,6 @@ rop.GETARRAYITEM_GC_F: rop.VEC_GETARRAYITEM_GC_F, # note that there is no _PURE operation for vector operations. # reason: currently we do not care if it is pure or not! - rop.GETARRAYITEM_RAW_PURE_I: rop.VEC_GETARRAYITEM_RAW_I, - rop.GETARRAYITEM_RAW_PURE_F: rop.VEC_GETARRAYITEM_RAW_F, rop.GETARRAYITEM_GC_PURE_I: rop.VEC_GETARRAYITEM_GC_I, rop.GETARRAYITEM_GC_PURE_F: rop.VEC_GETARRAYITEM_GC_F, rop.RAW_STORE: rop.VEC_RAW_STORE, diff --git a/rpython/jit/metainterp/test/test_immutable.py b/rpython/jit/metainterp/test/test_immutable.py --- a/rpython/jit/metainterp/test/test_immutable.py +++ b/rpython/jit/metainterp/test/test_immutable.py @@ -136,15 +136,15 @@ # res = self.interp_operations(f, [0], disable_optimizations=True) assert res == 42 - self.check_operations_history(getfield_raw_pure_i=1, - getarrayitem_raw_pure_i=1, + self.check_operations_history(getfield_raw_i=1, + getarrayitem_raw_i=1, int_mul=1) # # second try, in which we get num=0 constant-folded through f() res = self.interp_operations(f, [-1], disable_optimizations=True) assert res == 42 - self.check_operations_history(getfield_raw_pure_i=0, - getarrayitem_raw_pure_i=0, + self.check_operations_history(getfield_raw_i=0, + getarrayitem_raw_i=0, int_mul=0) def test_read_on_promoted(self): From noreply at buildbot.pypy.org Sun Nov 8 04:37:45 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 8 Nov 2015 10:37:45 +0100 (CET) Subject: [pypy-commit] pypy default: Add null protection at one place. I think that non-pure Message-ID: <20151108093745.9E3811C13F7@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80583:81f34fcd3105 Date: 2015-11-08 10:21 +0100 http://bitbucket.org/pypy/pypy/changeset/81f34fcd3105/ Log: Add null protection at one place. I think that non-pure {get,set}{field,arrayitem}_gc can always go forward, even if they are done on a GC object of a wrong type. It will make caches to record these "reads" and "writes" that would never actually occur anyway. I think the only bad thing that occurred is the AssertionError when the GC object is NULL (now turned into InvalidLoop). diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py --- a/rpython/jit/metainterp/optimizeopt/info.py +++ b/rpython/jit/metainterp/optimizeopt/info.py @@ -6,6 +6,7 @@ from rpython.rtyper.lltypesystem import lltype from rpython.jit.metainterp.optimizeopt.rawbuffer import RawBuffer, InvalidRawOperation from rpython.jit.metainterp.executor import execute +from rpython.jit.metainterp.optimize import InvalidLoop INFO_NULL = 0 @@ -674,6 +675,7 @@ def _get_info(self, descr, optheap): ref = self._const.getref_base() + if not ref: raise InvalidLoop # null protection info = optheap.const_infos.get(ref, None) if info is None: info = StructPtrInfo(descr) @@ -682,6 +684,7 @@ def _get_array_info(self, descr, optheap): ref = self._const.getref_base() + if not ref: raise InvalidLoop # null protection info = optheap.const_infos.get(ref, None) if info is None: info = ArrayPtrInfo(descr) diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -8939,6 +8939,94 @@ # (this test was written to show it would previously crash) self.optimize_loop(ops, ops) + def test_unroll_constant_null_1(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getfield_gc_i(p0, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_2(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setfield_gc(p0, i1, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_3(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getarrayitem_gc_i(p0, 5, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_4(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setarrayitem_gc(p0, 5, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_5(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getarrayitem_gc_i(p0, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + expected = """ + [i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getarrayitem_gc_i(NULL, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.optimize_loop(ops, expected) + + def test_unroll_constant_null_6(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setarrayitem_gc(p0, i1, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + expected = """ + [i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setarrayitem_gc(NULL, i1, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.optimize_loop(ops, expected) + class TestLLtype(OptimizeOptTest, LLtypeMixin): pass From noreply at buildbot.pypy.org Sun Nov 8 04:53:23 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 8 Nov 2015 10:53:23 +0100 (CET) Subject: [pypy-commit] pypy default: Add (skipped, failing) tests for the constant_fold() done in pure.py on Message-ID: <20151108095323.E171D1C13F7@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80584:97dbcab3e9a0 Date: 2015-11-08 10:52 +0100 http://bitbucket.org/pypy/pypy/changeset/97dbcab3e9a0/ Log: Add (skipped, failing) tests for the constant_fold() done in pure.py on possibly invalid GC pointers diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -638,6 +638,7 @@ def bh_getarrayitem_gc(self, a, index, descr): a = support.cast_arg(lltype.Ptr(descr.A), a) array = a._obj + assert index >= 0 return support.cast_result(descr.A.OF, array.getitem(index)) bh_getarrayitem_gc_pure_i = bh_getarrayitem_gc @@ -743,6 +744,7 @@ return s._obj.container.chars.getlength() def bh_strgetitem(self, s, item): + assert item >= 0 return ord(s._obj.container.chars.getitem(item)) def bh_strsetitem(self, s, item, v): @@ -764,6 +766,7 @@ return string._obj.container.chars.getlength() def bh_unicodegetitem(self, string, index): + assert index >= 0 return ord(string._obj.container.chars.getitem(index)) def bh_unicodesetitem(self, string, index, newvalue): diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -409,7 +409,7 @@ def make_execute_function(name, func): # Make a wrapper for 'func'. The func is a simple bhimpl_xxx function # from the BlackholeInterpreter class. The wrapper is a new function - # that receives and returns boxed values. + # that receives boxed values (but returns a non-boxed value). for argtype in func.argtypes: if argtype not in ('i', 'r', 'f', 'd', 'cpu'): return None diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -9027,6 +9027,138 @@ # may either raise InvalidLoop or compile; it's a rare case self.optimize_loop(ops, expected) + def test_unroll_pure_on_bogus_object_1(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getfield_gc_pure_i(p0, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_2(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getfield_gc_pure_i(p0, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr3), i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_3(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(p0, 5, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_4(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(p0, 5, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr3), i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_5(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(p0, 125, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(ConstPtr(arrayref), i3) # too short, length < 126! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_6(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(ConstPtr(arrayref), i0, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(125, i3) # arrayref is too short, length < 126! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_7(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(ConstPtr(arrayref), i0, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(-1, i3) # cannot access array item -1! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_8(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem(p0, 125) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_9(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem(p0, 125) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr), i3) # not a string at all + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_10(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem("foobar", i0) + i3 = int_sub(i1, 1) + jump(125, i3) # string is too short! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_11(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem("foobar", i0) + i3 = int_sub(i1, 1) + jump(-1, i3) # cannot access character -1! + """ + self.optimize_loop(ops, ops) + class TestLLtype(OptimizeOptTest, LLtypeMixin): pass From noreply at buildbot.pypy.org Sun Nov 8 05:22:36 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 8 Nov 2015 11:22:36 +0100 (CET) Subject: [pypy-commit] pypy default: improve the test to show more clearly what is wrong Message-ID: <20151108102236.5CF901C12D4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80585:fc6c84172739 Date: 2015-11-08 11:03 +0100 http://bitbucket.org/pypy/pypy/changeset/fc6c84172739/ Log: improve the test to show more clearly what is wrong diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py --- a/pypy/interpreter/test/test_zzpickle_and_slow.py +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py @@ -390,15 +390,20 @@ def test_pickle_enum(self): import pickle - e = enumerate(range(10)) + e = enumerate(range(100, 106)) e.next() e.next() pckl = pickle.dumps(e) result = pickle.loads(pckl) - e.next() - result.next() + res = e.next() + assert res == (2, 102) + res = result.next() + assert res == (2, 102) assert type(e) is type(result) - assert list(e) == list(result) + res = list(e) + assert res == [(3, 103), (4, 104), (5, 105)] + res = list(result) + assert res == [(3, 103), (4, 104), (5, 105)] def test_pickle_xrangeiter(self): import pickle From noreply at buildbot.pypy.org Sun Nov 8 05:22:38 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 8 Nov 2015 11:22:38 +0100 (CET) Subject: [pypy-commit] pypy default: Fix for test_zzpickle_and_slow:test_pickle_enum Message-ID: <20151108102238.7B76A1C12D4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80586:8ea90c2bd2c9 Date: 2015-11-08 11:23 +0100 http://bitbucket.org/pypy/pypy/changeset/8ea90c2bd2c9/ Log: Fix for test_zzpickle_and_slow:test_pickle_enum diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py --- a/pypy/module/__builtin__/functional.py +++ b/pypy/module/__builtin__/functional.py @@ -231,28 +231,33 @@ class W_Enumerate(W_Root): - def __init__(self, space, w_iterable, w_start): - from pypy.objspace.std.listobject import W_ListObject - w_iter = space.iter(w_iterable) - if space.is_w(space.type(w_start), space.w_int): - self.index = space.int_w(w_start) - self.w_index = None - if self.index == 0 and type(w_iterable) is W_ListObject: - w_iter = w_iterable - else: - self.index = -1 - self.w_index = w_start - self.w_iter_or_list = w_iter - if self.w_index is not None: - assert not type(self.w_iter_or_list) is W_ListObject + def __init__(self, w_iter_or_list, start, w_start): + # 'w_index' should never be a wrapped int here; if it would be, + # then it is actually None and the unwrapped int is in 'index'. + self.w_iter_or_list = w_iter_or_list + self.index = start + self.w_index = w_start def descr___new__(space, w_subtype, w_iterable, w_start=None): - self = space.allocate_instance(W_Enumerate, w_subtype) + from pypy.objspace.std.listobject import W_ListObject + if w_start is None: - w_start = space.wrap(0) + start = 0 else: w_start = space.index(w_start) - self.__init__(space, w_iterable, w_start) + if space.is_w(space.type(w_start), space.w_int): + start = space.int_w(w_start) + w_start = None + else: + start = -1 + + if start == 0 and type(w_iterable) is W_ListObject: + w_iter = w_iterable + else: + w_iter = space.iter(w_iterable) + + self = space.allocate_instance(W_Enumerate, w_subtype) + self.__init__(w_iter, start, w_start) return space.wrap(self) def descr___iter__(self, space): @@ -298,14 +303,17 @@ w_index = self.w_index if w_index is None: w_index = space.wrap(self.index) - else: - w_index = self.w_index w_info = space.newtuple([self.w_iter_or_list, w_index]) return space.newtuple([w_new_inst, w_info]) # exported through _pickle_support -def _make_enumerate(space, w_iter, w_index): - return space.wrap(W_Enumerate(space, w_iter, w_index)) +def _make_enumerate(space, w_iter_or_list, w_index): + if space.is_w(space.type(w_index), space.w_int): + index = space.int_w(w_index) + w_index = None + else: + index = -1 + return space.wrap(W_Enumerate(w_iter_or_list, index, w_index)) W_Enumerate.typedef = TypeDef("enumerate", __new__=interp2app(W_Enumerate.descr___new__.im_func), From noreply at buildbot.pypy.org Sun Nov 8 11:18:16 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 17:18:16 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: we can really only store up to 52 bits of mantissa in a nan, bit 53 is special Message-ID: <20151108161816.5B84A1C12D4@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80587:5632cebfe86b Date: 2015-11-07 21:06 +0200 http://bitbucket.org/pypy/pypy/changeset/5632cebfe86b/ Log: we can really only store up to 52 bits of mantissa in a nan, bit 53 is special diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1857,7 +1857,7 @@ # convert_to_float64 -> convert_to_float16 -> uint16 # even for float16 various float16 nans from numpy import array, arange - all_f16 = arange(0xfe00, 0xfe08, dtype='uint16') + all_f16 = arange(0xfe00, 0xffff, dtype='uint16') all_f16.dtype = 'float16' all_f32 = array(all_f16, dtype='float32') b = array(all_f32, dtype='float16') diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -64,10 +64,10 @@ if mant == 0: result = rfloat.INFINITY else: - # preserve mant value but pad w/zeros + # preserve at most 52 bits of mant value, but pad w/zeros exp = r_ulonglong(0x7ff) << 52 sign = r_ulonglong(sign) << 63 - mant = r_ulonglong(mant) << (53 - MANT_DIG) + mant = r_ulonglong(mant) << (52 - MANT_DIG) uint = exp | mant | sign result = longlong2float(cast(LONGLONG, uint)) return result @@ -150,9 +150,10 @@ elif rfloat.isnan(x): asint = cast(ULONGLONG, float2longlong(x)) mant = asint & ((r_ulonglong(1) << 52) - 1) - sign = asint < 0 + sign = asint >> 63 # shift off lower bits, perhaps losing data - mant = mant >> (53 - MANT_DIG) + if MANT_DIG <= 52: + mant = mant >> (52 - MANT_DIG) if mant == 0: mant = r_ulonglong(1) << (MANT_DIG-2) exp = MAX_EXP - MIN_EXP + 2 From noreply at buildbot.pypy.org Sun Nov 8 11:18:18 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 17:18:18 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: fix off-by-one in edge case Message-ID: <20151108161818.75CFD1C140F@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80588:9ea713544f54 Date: 2015-11-08 08:34 +0200 http://bitbucket.org/pypy/pypy/changeset/9ea713544f54/ Log: fix off-by-one in edge case diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1853,10 +1853,14 @@ assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02' def test_half_conversions(self): + from numpy import array, arange + from math import isnan, isinf + e = array([0, -1, -float('inf'), float('nan'), 6], dtype='float16') + assert map(isnan, e) == [False, False, False, True, False] + assert map(isinf, e) == [False, False, True, False, False] # numpy preserves value for uint16 -> cast_as_float16 -> # convert_to_float64 -> convert_to_float16 -> uint16 # even for float16 various float16 nans - from numpy import array, arange all_f16 = arange(0xfe00, 0xffff, dtype='uint16') all_f16.dtype = 'float16' all_f32 = array(all_f16, dtype='float32') diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -149,13 +149,13 @@ exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): asint = cast(ULONGLONG, float2longlong(x)) - mant = asint & ((r_ulonglong(1) << 52) - 1) + mant = asint & ((r_ulonglong(1) << 51) - 1) sign = asint >> 63 # shift off lower bits, perhaps losing data if MANT_DIG <= 52: mant = mant >> (52 - MANT_DIG) if mant == 0: - mant = r_ulonglong(1) << (MANT_DIG-2) + mant = r_ulonglong(1) << (MANT_DIG - 2) - 1 exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) @@ -214,7 +214,9 @@ exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): # rfloat.isnan(x): asint = cast(ULONGLONG, float2longlong(x)) - mant = asint & ((r_ulonglong(1) << 52) - 1) + mant = asint & ((r_ulonglong(1) << 51) - 1) + if mant == 0: + mant = r_ulonglong(1) << (MANT_DIG-2) - 1 sign = asint < 0 exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: From noreply at buildbot.pypy.org Sun Nov 8 11:18:20 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 17:18:20 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: avoid using ne on nans by adding argmax, argmin to types Message-ID: <20151108161820.9D9831C15B6@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80589:50e5f751fee5 Date: 2015-11-08 18:18 +0200 http://bitbucket.org/pypy/pypy/changeset/50e5f751fee5/ Log: avoid using ne on nans by adding argmax, argmin to types diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -534,10 +534,10 @@ while not inner_iter.done(inner_state): arg_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = inner_iter.getitem(inner_state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val inner_state = inner_iter.next(inner_state) idx += 1 result = get_dtype_cache(space).w_longdtype.box(result) @@ -557,17 +557,17 @@ while not iter.done(state): arg_flat_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = iter.getitem(state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val state = iter.next(state) idx += 1 return result return argmin_argmax, argmin_argmax_flat -argmin, argmin_flat = _new_argmin_argmax('min') -argmax, argmax_flat = _new_argmin_argmax('max') +argmin, argmin_flat = _new_argmin_argmax('argmin') +argmax, argmax_flat = _new_argmin_argmax('argmax') dot_driver = jit.JitDriver(name = 'numpy_dot', greens = ['dtype'], diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1858,6 +1858,7 @@ e = array([0, -1, -float('inf'), float('nan'), 6], dtype='float16') assert map(isnan, e) == [False, False, False, True, False] assert map(isinf, e) == [False, False, True, False, False] + assert e.argmax() == 3 # numpy preserves value for uint16 -> cast_as_float16 -> # convert_to_float64 -> convert_to_float16 -> uint16 # even for float16 various float16 nans diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -345,6 +345,14 @@ def min(self, v1, v2): return min(v1, v2) + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 + @raw_unary_op def rint(self, v): float64 = Float64(self.space) @@ -820,6 +828,14 @@ def min(self, v1, v2): return v1 if v1 <= v2 or rfloat.isnan(v1) else v2 + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 or rfloat.isnan(v1) + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 or rfloat.isnan(v1) + @simple_binary_op def fmax(self, v1, v2): return v1 if v1 >= v2 or rfloat.isnan(v2) else v2 @@ -1407,6 +1423,16 @@ return v1 return v2 + def argmin(self, v1, v2): + if self.le(v1, v2) or self.isnan(v1): + return True + return False + + def argmax(self, v1, v2): + if self.ge(v1, v2) or self.isnan(v1): + return True + return False + @complex_binary_op def floordiv(self, v1, v2): (r1, i1), (r2, i2) = v1, v2 @@ -1927,6 +1953,18 @@ return v1 return v2 + @raw_binary_op + def argmax(self, v1, v2): + if self.space.is_true(self.space.ge(v1, v2)): + return True + return False + + @raw_binary_op + def argmin(self, v1, v2): + if self.space.is_true(self.space.le(v1, v2)): + return True + return False + @raw_unary_op def bool(self,v): return self._obool(v) From noreply at buildbot.pypy.org Sun Nov 8 13:10:59 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 19:10:59 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: merge default into branch Message-ID: <20151108181059.DC7CC1C1034@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80590:2d4bc6d7641d Date: 2015-11-08 19:50 +0200 http://bitbucket.org/pypy/pypy/changeset/2d4bc6d7641d/ Log: merge default into branch diff too long, truncating to 2000 out of 2541 lines diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py --- a/lib_pypy/cffi/cffi_opcode.py +++ b/lib_pypy/cffi/cffi_opcode.py @@ -110,6 +110,8 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/lib_pypy/cffi/commontypes.py b/lib_pypy/cffi/commontypes.py --- a/lib_pypy/cffi/commontypes.py +++ b/lib_pypy/cffi/commontypes.py @@ -2,10 +2,17 @@ from . import api, model -COMMON_TYPES = { - 'FILE': model.unknown_type('FILE', '_IO_FILE'), - 'bool': '_Bool', - } +COMMON_TYPES = {} + +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: if _type.endswith('_t'): @@ -14,212 +21,35 @@ _CACHE = {} -def resolve_common_type(commontype): +def resolve_common_type(parser, commontype): try: return _CACHE[commontype] except KeyError: - result = COMMON_TYPES.get(commontype, commontype) - if not isinstance(result, str): - pass # result is already a BaseType - elif result.endswith(' *'): - if result.startswith('const '): - result = model.ConstPointerType( - resolve_common_type(result[6:-2])) - else: - result = model.PointerType(resolve_common_type(result[:-2])) - elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES: - result = model.PrimitiveType(result) - elif result == 'set-unicode-needed': + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': raise api.FFIError("The Windows type %r is only available after " "you call ffi.set_unicode()" % (commontype,)) else: - if commontype == result: + if commontype == cdecl: raise api.FFIError("Unsupported type: %r. Please file a bug " "if you think it should be." % (commontype,)) - result = resolve_common_type(result) # recursively + result, quals = parser.parse_type_and_quals(cdecl) # recursive + assert isinstance(result, model.BaseTypeByIdentity) - _CACHE[commontype] = result - return result + _CACHE[commontype] = result, quals + return result, quals # ____________________________________________________________ -# Windows common types +# extra types for Windows (most of them are in commontypes.c) -def win_common_types(maxsize): - result = {} - if maxsize < (1<<32): - result.update({ # Windows 32-bits - 'HALF_PTR': 'short', - 'INT_PTR': 'int', - 'LONG_PTR': 'long', - 'UHALF_PTR': 'unsigned short', - 'UINT_PTR': 'unsigned int', - 'ULONG_PTR': 'unsigned long', - }) - else: - result.update({ # Windows 64-bits - 'HALF_PTR': 'int', - 'INT_PTR': 'long long', - 'LONG_PTR': 'long long', - 'UHALF_PTR': 'unsigned int', - 'UINT_PTR': 'unsigned long long', - 'ULONG_PTR': 'unsigned long long', - }) - result.update({ - "BYTE": "unsigned char", - "BOOL": "int", - "CCHAR": "char", - "CHAR": "char", - "DWORD": "unsigned long", - "DWORD32": "unsigned int", - "DWORD64": "unsigned long long", - "FLOAT": "float", - "INT": "int", - "INT8": "signed char", - "INT16": "short", - "INT32": "int", - "INT64": "long long", - "LONG": "long", - "LONGLONG": "long long", - "LONG32": "int", - "LONG64": "long long", - "WORD": "unsigned short", - "PVOID": model.voidp_type, - "ULONGLONG": "unsigned long long", - "WCHAR": "wchar_t", - "SHORT": "short", - "UCHAR": "unsigned char", - "UINT": "unsigned int", - "UINT8": "unsigned char", - "UINT16": "unsigned short", - "UINT32": "unsigned int", - "UINT64": "unsigned long long", - "ULONG": "unsigned long", - "ULONG32": "unsigned int", - "ULONG64": "unsigned long long", - "USHORT": "unsigned short", - - "SIZE_T": "ULONG_PTR", - "SSIZE_T": "LONG_PTR", - "ATOM": "WORD", - "BOOLEAN": "BYTE", - "COLORREF": "DWORD", - - "HANDLE": "PVOID", - "DWORDLONG": "ULONGLONG", - "DWORD_PTR": "ULONG_PTR", - "HACCEL": "HANDLE", - - "HBITMAP": "HANDLE", - "HBRUSH": "HANDLE", - "HCOLORSPACE": "HANDLE", - "HCONV": "HANDLE", - "HCONVLIST": "HANDLE", - "HDC": "HANDLE", - "HDDEDATA": "HANDLE", - "HDESK": "HANDLE", - "HDROP": "HANDLE", - "HDWP": "HANDLE", - "HENHMETAFILE": "HANDLE", - "HFILE": "int", - "HFONT": "HANDLE", - "HGDIOBJ": "HANDLE", - "HGLOBAL": "HANDLE", - "HHOOK": "HANDLE", - "HICON": "HANDLE", - "HCURSOR": "HICON", - "HINSTANCE": "HANDLE", - "HKEY": "HANDLE", - "HKL": "HANDLE", - "HLOCAL": "HANDLE", - "HMENU": "HANDLE", - "HMETAFILE": "HANDLE", - "HMODULE": "HINSTANCE", - "HMONITOR": "HANDLE", - "HPALETTE": "HANDLE", - "HPEN": "HANDLE", - "HRESULT": "LONG", - "HRGN": "HANDLE", - "HRSRC": "HANDLE", - "HSZ": "HANDLE", - "WINSTA": "HANDLE", - "HWND": "HANDLE", - - "LANGID": "WORD", - "LCID": "DWORD", - "LCTYPE": "DWORD", - "LGRPID": "DWORD", - "LPARAM": "LONG_PTR", - "LPBOOL": "BOOL *", - "LPBYTE": "BYTE *", - "LPCOLORREF": "DWORD *", - "LPCSTR": "const char *", - - "LPCVOID": model.const_voidp_type, - "LPCWSTR": "const WCHAR *", - "LPDWORD": "DWORD *", - "LPHANDLE": "HANDLE *", - "LPINT": "int *", - "LPLONG": "long *", - "LPSTR": "CHAR *", - "LPWSTR": "WCHAR *", - "LPVOID": model.voidp_type, - "LPWORD": "WORD *", - "LRESULT": "LONG_PTR", - "PBOOL": "BOOL *", - "PBOOLEAN": "BOOLEAN *", - "PBYTE": "BYTE *", - "PCHAR": "CHAR *", - "PCSTR": "const CHAR *", - "PCWSTR": "const WCHAR *", - "PDWORD": "DWORD *", - "PDWORDLONG": "DWORDLONG *", - "PDWORD_PTR": "DWORD_PTR *", - "PDWORD32": "DWORD32 *", - "PDWORD64": "DWORD64 *", - "PFLOAT": "FLOAT *", - "PHALF_PTR": "HALF_PTR *", - "PHANDLE": "HANDLE *", - "PHKEY": "HKEY *", - "PINT": "int *", - "PINT_PTR": "INT_PTR *", - "PINT8": "INT8 *", - "PINT16": "INT16 *", - "PINT32": "INT32 *", - "PINT64": "INT64 *", - "PLCID": "PDWORD", - "PLONG": "LONG *", - "PLONGLONG": "LONGLONG *", - "PLONG_PTR": "LONG_PTR *", - "PLONG32": "LONG32 *", - "PLONG64": "LONG64 *", - "PSHORT": "SHORT *", - "PSIZE_T": "SIZE_T *", - "PSSIZE_T": "SSIZE_T *", - "PSTR": "CHAR *", - "PUCHAR": "UCHAR *", - "PUHALF_PTR": "UHALF_PTR *", - "PUINT": "UINT *", - "PUINT_PTR": "UINT_PTR *", - "PUINT8": "UINT8 *", - "PUINT16": "UINT16 *", - "PUINT32": "UINT32 *", - "PUINT64": "UINT64 *", - "PULONG": "ULONG *", - "PULONGLONG": "ULONGLONG *", - "PULONG_PTR": "ULONG_PTR *", - "PULONG32": "ULONG32 *", - "PULONG64": "ULONG64 *", - "PUSHORT": "USHORT *", - "PWCHAR": "WCHAR *", - "PWORD": "WORD *", - "PWSTR": "WCHAR *", - "QWORD": "unsigned long long", - "SC_HANDLE": "HANDLE", - "SC_LOCK": "LPVOID", - "SERVICE_STATUS_HANDLE": "HANDLE", - +def win_common_types(): + return { "UNICODE_STRING": model.StructType( "_UNICODE_STRING", ["Length", @@ -232,10 +62,6 @@ "PUNICODE_STRING": "UNICODE_STRING *", "PCUNICODE_STRING": "const UNICODE_STRING *", - "USN": "LONGLONG", - "VOID": model.void_type, - "WPARAM": "UINT_PTR", - "TBYTE": "set-unicode-needed", "TCHAR": "set-unicode-needed", "LPCTSTR": "set-unicode-needed", @@ -244,9 +70,7 @@ "PTSTR": "set-unicode-needed", "PTBYTE": "set-unicode-needed", "PTCHAR": "set-unicode-needed", - }) - return result - + } if sys.platform == 'win32': - COMMON_TYPES.update(win_common_types(sys.maxsize)) + COMMON_TYPES.update(win_common_types()) diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -29,6 +29,8 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") def _get_parser(): global _parser_cache @@ -36,6 +38,46 @@ _parser_cache = pycparser.CParser() return _parser_cache +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + for i in xrange(endpos, len(csource)): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + return ''.join(parts) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -47,6 +89,10 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) + # # BIG HACK: replace WINAPI or __stdcall with "volatile const". # It doesn't make sense for the return type of a function to be # "volatile volatile const", so we abuse it to detect __stdcall... @@ -320,13 +366,15 @@ self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] assert not macros exprnode = ast.ext[-1].type.args.params[0] if isinstance(exprnode, pycparser.c_ast.ID): raise api.CDefError("unknown identifier '%s'" % (exprnode.name,)) - tp, quals = self._get_type_and_quals(exprnode.type) - return tp + return self._get_type_and_quals(exprnode.type) def _declare(self, name, obj, included=False, quals=0): if name in self._declarations: @@ -348,6 +396,8 @@ pycparser.c_ast.PtrDecl)): if 'const' in type.quals: quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE if 'restrict' in type.quals: quals |= model.Q_RESTRICT return quals @@ -422,7 +472,8 @@ if ident == '__dotdotdot__': raise api.FFIError(':%d: bad usage of "..."' % typenode.coord.line) - return resolve_common_type(ident), quals + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) # if isinstance(type, pycparser.c_ast.Struct): # 'struct foobar' @@ -456,6 +507,13 @@ def _parse_function_type(self, typenode, funcname=None): params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise api.CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) ellipsis = ( len(params) > 0 and isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -7,10 +7,13 @@ # type qualifiers Q_CONST = 0x01 Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 def qualify(quals, replace_with): if quals & Q_CONST: replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() if quals & Q_RESTRICT: # It seems that __restrict is supported by gcc and msvc. # If you hit some different compiler, add a #define in diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -83,6 +83,8 @@ #define _CFFI__UNKNOWN_FLOAT_PRIM (-2) #define _CFFI__UNKNOWN_LONG_DOUBLE (-3) +#define _CFFI__IO_FILE_STRUCT (-1) + struct _cffi_global_s { const char *name; diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -76,10 +76,10 @@ if "cppyy" in working_modules: working_modules.remove("cppyy") # depends on ctypes -if sys.platform.startswith("linux"): - _mach = os.popen('uname -m', 'r').read().strip() - if _mach.startswith('ppc'): - working_modules.remove("_continuation") +#if sys.platform.startswith("linux"): +# _mach = os.popen('uname -m', 'r').read().strip() +# if _mach.startswith(...): +# working_modules.remove("_continuation") module_dependencies = { diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst --- a/pypy/doc/build.rst +++ b/pypy/doc/build.rst @@ -85,13 +85,16 @@ _ssl libssl +gdbm + libgdbm-dev + Make sure to have these libraries (with development headers) installed before building PyPy, otherwise the resulting binary will not contain these modules. On Debian, this is the command to install all build-time dependencies:: apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \ - libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev + libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev For the optional lzma module on PyPy3 you will also need ``liblzma-dev``. diff --git a/pypy/doc/whatsnew-4.0.0.rst b/pypy/doc/whatsnew-4.0.0.rst --- a/pypy/doc/whatsnew-4.0.0.rst +++ b/pypy/doc/whatsnew-4.0.0.rst @@ -6,12 +6,12 @@ .. startrev: 3a8f5481dab4 .. branch: keys_with_hash -Improve the performance of dict.update() and a bunch of methods from +Improve the performance of ``dict.update()`` and a bunch of methods from sets, by reusing the hash value stored in one dict when inspecting or changing another dict with that key. .. branch: optresult-unroll -A major refactoring of the ResOperations that kills Box. Also rewrote +A major refactoring of the ``ResOperations`` that kills Box. Also rewrote unrolling to enable future enhancements. Should improve warmup time by 20% or so. @@ -24,7 +24,7 @@ .. branch: gc-more-incremental Remove a source of non-incremental-ness in the GC: now -external_malloc() no longer runs gc_step_until() any more. If there +``external_malloc()`` no longer runs ``gc_step_until()`` any more. If there is a currently-running major collection, we do only so many steps before returning. This number of steps depends on the size of the allocated object. It is controlled by tracking the general progress @@ -55,7 +55,7 @@ floats, cf. issue #2148. .. branch: cffi-stdcall -Win32: support '__stdcall' in CFFI. +Win32: support ``__stdcall`` in CFFI. .. branch: callfamily @@ -67,19 +67,19 @@ .. branch: type_system-cleanup -Remove some remnants of the old ootypesystem vs lltypesystem dichotomy. +Remove some remnants of the old ``ootypesystem`` vs ``lltypesystem`` dichotomy. .. branch: cffi-handle-lifetime -ffi.new_handle() returns handles that work more like CPython's: they +``ffi.new_handle()`` returns handles that work more like CPython's: they remain valid as long as the target exists (unlike the previous -version, where handles become invalid *before* the __del__ is called). +version, where handles become invalid *before* the ``__del__`` is called). .. branch: ufunc-casting -allow automatic casting in ufuncs (and frompypyfunc) to cast the +allow automatic casting in ufuncs (and ``frompypyfunc``) to cast the arguments to the allowed function type declarations, fixes various -failures in linalg cffi functions +failures in linalg CFFI functions .. branch: vecopt .. branch: vecopt-merge @@ -94,4 +94,5 @@ .. branch: lazy-fast2locals improve the performance of simple trace functions by lazily calling -fast2locals and locals2fast only if f_locals is actually accessed. +``fast2locals`` and ``locals2fast`` only if ``f_locals`` is actually accessed. + diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -8,3 +8,13 @@ .. branch: 2174-fix-osx-10-11-translation Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py --- a/pypy/module/__builtin__/functional.py +++ b/pypy/module/__builtin__/functional.py @@ -8,7 +8,7 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault from pypy.interpreter.typedef import TypeDef -from rpython.rlib import jit +from rpython.rlib import jit, rarithmetic from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_uint, intmask from rpython.rlib.rbigint import rbigint @@ -229,10 +229,22 @@ return min_max(space, __args__, "min") + class W_Enumerate(W_Root): - def __init__(self, w_iter, w_start): - self.w_iter = w_iter - self.w_index = w_start + def __init__(self, space, w_iterable, w_start): + from pypy.objspace.std.listobject import W_ListObject + w_iter = space.iter(w_iterable) + if space.is_w(space.type(w_start), space.w_int): + self.index = space.int_w(w_start) + self.w_index = None + if self.index == 0 and type(w_iterable) is W_ListObject: + w_iter = w_iterable + else: + self.index = -1 + self.w_index = w_start + self.w_iter_or_list = w_iter + if self.w_index is not None: + assert not type(self.w_iter_or_list) is W_ListObject def descr___new__(space, w_subtype, w_iterable, w_start=None): self = space.allocate_instance(W_Enumerate, w_subtype) @@ -240,16 +252,42 @@ w_start = space.wrap(0) else: w_start = space.index(w_start) - self.__init__(space.iter(w_iterable), w_start) + self.__init__(space, w_iterable, w_start) return space.wrap(self) def descr___iter__(self, space): return space.wrap(self) def descr_next(self, space): - w_item = space.next(self.w_iter) + from pypy.objspace.std.listobject import W_ListObject w_index = self.w_index - self.w_index = space.add(w_index, space.wrap(1)) + w_iter_or_list = self.w_iter_or_list + w_item = None + if w_index is None: + index = self.index + if type(w_iter_or_list) is W_ListObject: + try: + w_item = w_iter_or_list.getitem(index) + except IndexError: + self.w_iter_or_list = None + raise OperationError(space.w_StopIteration, space.w_None) + self.index = index + 1 + elif w_iter_or_list is None: + raise OperationError(space.w_StopIteration, space.w_None) + else: + try: + newval = rarithmetic.ovfcheck(index + 1) + except OverflowError: + w_index = space.wrap(index) + self.w_index = space.add(w_index, space.wrap(1)) + self.index = -1 + else: + self.index = newval + w_index = space.wrap(index) + else: + self.w_index = space.add(w_index, space.wrap(1)) + if w_item is None: + w_item = space.next(self.w_iter_or_list) return space.newtuple([w_index, w_item]) def descr___reduce__(self, space): @@ -257,12 +295,17 @@ w_mod = space.getbuiltinmodule('_pickle_support') mod = space.interp_w(MixedModule, w_mod) w_new_inst = mod.get('enumerate_new') - w_info = space.newtuple([self.w_iter, self.w_index]) + w_index = self.w_index + if w_index is None: + w_index = space.wrap(self.index) + else: + w_index = self.w_index + w_info = space.newtuple([self.w_iter_or_list, w_index]) return space.newtuple([w_new_inst, w_info]) # exported through _pickle_support def _make_enumerate(space, w_iter, w_index): - return space.wrap(W_Enumerate(w_iter, w_index)) + return space.wrap(W_Enumerate(space, w_iter, w_index)) W_Enumerate.typedef = TypeDef("enumerate", __new__=interp2app(W_Enumerate.descr___new__.im_func), diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py --- a/pypy/module/__builtin__/test/test_builtin.py +++ b/pypy/module/__builtin__/test/test_builtin.py @@ -264,6 +264,7 @@ raises(StopIteration,x.next) def test_enumerate(self): + import sys seq = range(2,4) enum = enumerate(seq) assert enum.next() == (0, 2) @@ -274,6 +275,15 @@ enum = enumerate(range(5), 2) assert list(enum) == zip(range(2, 7), range(5)) + enum = enumerate(range(2), 2**100) + assert list(enum) == [(2**100, 0), (2**100+1, 1)] + + enum = enumerate(range(2), sys.maxint) + assert list(enum) == [(sys.maxint, 0), (sys.maxint+1, 1)] + + raises(TypeError, enumerate, range(2), 5.5) + + def test_next(self): x = iter(['a', 'b', 'c']) assert next(x) == 'a' diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -43,6 +43,7 @@ 'newp_handle': 'handle.newp_handle', 'from_handle': 'handle.from_handle', '_get_types': 'func._get_types', + '_get_common_types': 'func._get_common_types', 'from_buffer': 'func.from_buffer', 'string': 'func.string', diff --git a/pypy/module/_cffi_backend/cffi_opcode.py b/pypy/module/_cffi_backend/cffi_opcode.py --- a/pypy/module/_cffi_backend/cffi_opcode.py +++ b/pypy/module/_cffi_backend/cffi_opcode.py @@ -110,6 +110,9 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py --- a/pypy/module/_cffi_backend/func.py +++ b/pypy/module/_cffi_backend/func.py @@ -84,6 +84,20 @@ # ____________________________________________________________ +def _get_common_types(space, w_dict): + from pypy.module._cffi_backend.parse_c_type import ll_enum_common_types + index = 0 + while True: + p = ll_enum_common_types(rffi.cast(rffi.INT, index)) + if not p: + break + key = rffi.charp2str(p) + value = rffi.charp2str(rffi.ptradd(p, len(key) + 1)) + space.setitem_str(w_dict, key, space.wrap(value)) + index += 1 + +# ____________________________________________________________ + def _fetch_as_read_buffer(space, w_x): # xxx do we really need to implement the same mess as in CPython 2.7 # w.r.t. buffers and memoryviews?? diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -87,6 +87,8 @@ ll_set_cdl_realize_global_int = llexternal('pypy_set_cdl_realize_global_int', [lltype.Ptr(GLOBAL_S)], lltype.Void) +ll_enum_common_types = llexternal('pypy_enum_common_types', + [rffi.INT], rffi.CCHARP) def parse_c_type(info, input): p_input = rffi.str2charp(input) diff --git a/pypy/module/_cffi_backend/realize_c_type.py b/pypy/module/_cffi_backend/realize_c_type.py --- a/pypy/module/_cffi_backend/realize_c_type.py +++ b/pypy/module/_cffi_backend/realize_c_type.py @@ -74,7 +74,15 @@ assert len(NAMES) == cffi_opcode._NUM_PRIM def __init__(self, space): + self.space = space self.all_primitives = [None] * cffi_opcode._NUM_PRIM + self.file_struct = None + + def get_file_struct(self): + if self.file_struct is None: + self.file_struct = ctypestruct.W_CTypeStruct(self.space, "FILE") + return self.file_struct + def get_primitive_type(ffi, num): space = ffi.space @@ -266,6 +274,10 @@ def _realize_c_struct_or_union(ffi, sindex): + if sindex == cffi_opcode._IO_FILE_STRUCT: + # returns a single global cached opaque type + return ffi.space.fromcache(RealizeCache).get_file_struct() + s = ffi.ctxobj.ctx.c_struct_unions[sindex] type_index = rffi.getintfield(s, 'c_type_index') if ffi.cached_types[type_index] is not None: @@ -281,7 +293,10 @@ x = ctypestruct.W_CTypeUnion(space, name) else: name = _realize_name("struct ", s.c_name) - x = ctypestruct.W_CTypeStruct(space, name) + if name == "struct _IO_FILE": + x = space.fromcache(RealizeCache).get_file_struct() + else: + x = ctypestruct.W_CTypeStruct(space, name) if (c_flags & cffi_opcode.F_OPAQUE) == 0: assert c_first_field_index >= 0 w_ctype = x diff --git a/pypy/module/_cffi_backend/src/commontypes.c b/pypy/module/_cffi_backend/src/commontypes.c new file mode 100644 --- /dev/null +++ b/pypy/module/_cffi_backend/src/commontypes.c @@ -0,0 +1,207 @@ +/* This file must be kept in alphabetical order. See test_commontypes.py */ + +#define EQ(key, value) key "\0" value /* string concatenation */ +#ifdef _WIN64 +# define W32_64(X,Y) Y +# else +# define W32_64(X,Y) X +# endif + + +static const char *common_simple_types[] = { + +#ifdef MS_WIN32 /* Windows types */ + EQ("ATOM", "WORD"), + EQ("BOOL", "int"), + EQ("BOOLEAN", "BYTE"), + EQ("BYTE", "unsigned char"), + EQ("CCHAR", "char"), + EQ("CHAR", "char"), + EQ("COLORREF", "DWORD"), + EQ("DWORD", "unsigned long"), + EQ("DWORD32", "unsigned int"), + EQ("DWORD64", "unsigned long long"), + EQ("DWORDLONG", "ULONGLONG"), + EQ("DWORD_PTR", "ULONG_PTR"), +#endif + + EQ("FILE", "struct _IO_FILE"), + +#ifdef MS_WIN32 /* more Windows types */ + EQ("FLOAT", "float"), + EQ("HACCEL", "HANDLE"), + EQ("HALF_PTR", W32_64("short","int")), + EQ("HANDLE", "PVOID"), + EQ("HBITMAP", "HANDLE"), + EQ("HBRUSH", "HANDLE"), + EQ("HCOLORSPACE", "HANDLE"), + EQ("HCONV", "HANDLE"), + EQ("HCONVLIST", "HANDLE"), + EQ("HCURSOR", "HICON"), + EQ("HDC", "HANDLE"), + EQ("HDDEDATA", "HANDLE"), + EQ("HDESK", "HANDLE"), + EQ("HDROP", "HANDLE"), + EQ("HDWP", "HANDLE"), + EQ("HENHMETAFILE", "HANDLE"), + EQ("HFILE", "int"), + EQ("HFONT", "HANDLE"), + EQ("HGDIOBJ", "HANDLE"), + EQ("HGLOBAL", "HANDLE"), + EQ("HHOOK", "HANDLE"), + EQ("HICON", "HANDLE"), + EQ("HINSTANCE", "HANDLE"), + EQ("HKEY", "HANDLE"), + EQ("HKL", "HANDLE"), + EQ("HLOCAL", "HANDLE"), + EQ("HMENU", "HANDLE"), + EQ("HMETAFILE", "HANDLE"), + EQ("HMODULE", "HINSTANCE"), + EQ("HMONITOR", "HANDLE"), + EQ("HPALETTE", "HANDLE"), + EQ("HPEN", "HANDLE"), + EQ("HRESULT", "LONG"), + EQ("HRGN", "HANDLE"), + EQ("HRSRC", "HANDLE"), + EQ("HSZ", "HANDLE"), + EQ("HWND", "HANDLE"), + EQ("INT", "int"), + EQ("INT16", "short"), + EQ("INT32", "int"), + EQ("INT64", "long long"), + EQ("INT8", "signed char"), + EQ("INT_PTR", W32_64("int","long long")), + EQ("LANGID", "WORD"), + EQ("LCID", "DWORD"), + EQ("LCTYPE", "DWORD"), + EQ("LGRPID", "DWORD"), + EQ("LONG", "long"), + EQ("LONG32", "int"), + EQ("LONG64", "long long"), + EQ("LONGLONG", "long long"), + EQ("LONG_PTR", W32_64("long","long long")), + EQ("LPARAM", "LONG_PTR"), + EQ("LPBOOL", "BOOL *"), + EQ("LPBYTE", "BYTE *"), + EQ("LPCOLORREF", "DWORD *"), + EQ("LPCSTR", "const char *"), + EQ("LPCVOID", "const void *"), + EQ("LPCWSTR", "const WCHAR *"), + EQ("LPDWORD", "DWORD *"), + EQ("LPHANDLE", "HANDLE *"), + EQ("LPINT", "int *"), + EQ("LPLONG", "long *"), + EQ("LPSTR", "CHAR *"), + EQ("LPVOID", "void *"), + EQ("LPWORD", "WORD *"), + EQ("LPWSTR", "WCHAR *"), + EQ("LRESULT", "LONG_PTR"), + EQ("PBOOL", "BOOL *"), + EQ("PBOOLEAN", "BOOLEAN *"), + EQ("PBYTE", "BYTE *"), + EQ("PCHAR", "CHAR *"), + EQ("PCSTR", "const CHAR *"), + EQ("PCWSTR", "const WCHAR *"), + EQ("PDWORD", "DWORD *"), + EQ("PDWORD32", "DWORD32 *"), + EQ("PDWORD64", "DWORD64 *"), + EQ("PDWORDLONG", "DWORDLONG *"), + EQ("PDWORD_PTR", "DWORD_PTR *"), + EQ("PFLOAT", "FLOAT *"), + EQ("PHALF_PTR", "HALF_PTR *"), + EQ("PHANDLE", "HANDLE *"), + EQ("PHKEY", "HKEY *"), + EQ("PINT", "int *"), + EQ("PINT16", "INT16 *"), + EQ("PINT32", "INT32 *"), + EQ("PINT64", "INT64 *"), + EQ("PINT8", "INT8 *"), + EQ("PINT_PTR", "INT_PTR *"), + EQ("PLCID", "PDWORD"), + EQ("PLONG", "LONG *"), + EQ("PLONG32", "LONG32 *"), + EQ("PLONG64", "LONG64 *"), + EQ("PLONGLONG", "LONGLONG *"), + EQ("PLONG_PTR", "LONG_PTR *"), + EQ("PSHORT", "SHORT *"), + EQ("PSIZE_T", "SIZE_T *"), + EQ("PSSIZE_T", "SSIZE_T *"), + EQ("PSTR", "CHAR *"), + EQ("PUCHAR", "UCHAR *"), + EQ("PUHALF_PTR", "UHALF_PTR *"), + EQ("PUINT", "UINT *"), + EQ("PUINT16", "UINT16 *"), + EQ("PUINT32", "UINT32 *"), + EQ("PUINT64", "UINT64 *"), + EQ("PUINT8", "UINT8 *"), + EQ("PUINT_PTR", "UINT_PTR *"), + EQ("PULONG", "ULONG *"), + EQ("PULONG32", "ULONG32 *"), + EQ("PULONG64", "ULONG64 *"), + EQ("PULONGLONG", "ULONGLONG *"), + EQ("PULONG_PTR", "ULONG_PTR *"), + EQ("PUSHORT", "USHORT *"), + EQ("PVOID", "void *"), + EQ("PWCHAR", "WCHAR *"), + EQ("PWORD", "WORD *"), + EQ("PWSTR", "WCHAR *"), + EQ("QWORD", "unsigned long long"), + EQ("SC_HANDLE", "HANDLE"), + EQ("SC_LOCK", "LPVOID"), + EQ("SERVICE_STATUS_HANDLE", "HANDLE"), + EQ("SHORT", "short"), + EQ("SIZE_T", "ULONG_PTR"), + EQ("SSIZE_T", "LONG_PTR"), + EQ("UCHAR", "unsigned char"), + EQ("UHALF_PTR", W32_64("unsigned short","unsigned int")), + EQ("UINT", "unsigned int"), + EQ("UINT16", "unsigned short"), + EQ("UINT32", "unsigned int"), + EQ("UINT64", "unsigned long long"), + EQ("UINT8", "unsigned char"), + EQ("UINT_PTR", W32_64("unsigned int","unsigned long long")), + EQ("ULONG", "unsigned long"), + EQ("ULONG32", "unsigned int"), + EQ("ULONG64", "unsigned long long"), + EQ("ULONGLONG", "unsigned long long"), + EQ("ULONG_PTR", W32_64("unsigned long","unsigned long long")), + EQ("USHORT", "unsigned short"), + EQ("USN", "LONGLONG"), + EQ("VOID", "void"), + EQ("WCHAR", "wchar_t"), + EQ("WINSTA", "HANDLE"), + EQ("WORD", "unsigned short"), + EQ("WPARAM", "UINT_PTR"), +#endif + + EQ("bool", "_Bool"), +}; + + +#undef EQ +#undef W32_64 + +#define num_common_simple_types \ + (sizeof(common_simple_types) / sizeof(common_simple_types[0])) + + +static const char *get_common_type(const char *search, size_t search_len) +{ + const char *entry; + int index = search_sorted(common_simple_types, sizeof(const char *), + num_common_simple_types, search, search_len); + if (index < 0) + return NULL; + + entry = common_simple_types[index]; + return entry + strlen(entry) + 1; +} + +RPY_EXTERN +char *pypy_enum_common_types(int index) +{ + if (index < num_common_simple_types) + return (char *)(common_simple_types[index]); + else + return NULL; +} diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -231,6 +231,8 @@ #define MAX_SSIZE_T (((size_t)-1) >> 1) static int parse_complete(token_t *tok); +static const char *get_common_type(const char *search, size_t search_len); +static int parse_common_type_replacement(token_t *tok, const char *replacement); static int parse_sequel(token_t *tok, int outer) { @@ -387,11 +389,18 @@ case TOK_INTEGER: errno = 0; -#ifndef _MSC_VER - if (sizeof(length) > sizeof(unsigned long)) + if (sizeof(length) > sizeof(unsigned long)) { +#ifdef MS_WIN32 +# ifdef _WIN64 + length = _strtoui64(tok->p, &endptr, 0); +# else + abort(); /* unreachable */ +# endif +#else length = strtoull(tok->p, &endptr, 0); +#endif + } else -#endif length = strtoul(tok->p, &endptr, 0); if (endptr != tok->p + tok->size) return parse_error(tok, "invalid number"); @@ -446,26 +455,34 @@ return _CFFI_GETARG(result); } +static int search_sorted(const char *const *base, + size_t item_size, int array_len, + const char *search, size_t search_len) +{ + int left = 0, right = array_len; + const char *baseptr = (const char *)base; -#define MAKE_SEARCH_FUNC(FIELD) \ - RPY_EXTERN int \ - pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx,\ - const char *search, size_t search_len) \ - { \ - int left = 0, right = ctx->num_##FIELD; \ - \ - while (left < right) { \ - int middle = (left + right) / 2; \ - const char *src = ctx->FIELD[middle].name; \ - int diff = strncmp(src, search, search_len); \ - if (diff == 0 && src[search_len] == '\0') \ - return middle; \ - else if (diff >= 0) \ - right = middle; \ - else \ - left = middle + 1; \ - } \ - return -1; \ + while (left < right) { + int middle = (left + right) / 2; + const char *src = *(const char *const *)(baseptr + middle * item_size); + int diff = strncmp(src, search, search_len); + if (diff == 0 && src[search_len] == '\0') + return middle; + else if (diff >= 0) + right = middle; + else + left = middle + 1; + } + return -1; +} + +#define MAKE_SEARCH_FUNC(FIELD) \ + RPY_EXTERN int \ + pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ + const char *search, size_t search_len) \ + { \ + return search_sorted(&ctx->FIELD->name, sizeof(*ctx->FIELD), \ + ctx->num_##FIELD, search, search_len); \ } MAKE_SEARCH_FUNC(globals) @@ -719,6 +736,7 @@ break; case TOK_IDENTIFIER: { + const char *replacement; int n = search_in_typenames(tok->info->ctx, tok->p, tok->size); if (n >= 0) { t1 = _CFFI_OP(_CFFI_OP_TYPENAME, n); @@ -729,6 +747,14 @@ t1 = _CFFI_OP(_CFFI_OP_PRIMITIVE, n); break; } + replacement = get_common_type(tok->p, tok->size); + if (replacement != NULL) { + n = parse_common_type_replacement(tok, replacement); + if (n < 0) + return parse_error(tok, "internal error, please report!"); + t1 = _CFFI_OP(_CFFI_OP_NOOP, n); + break; + } return parse_error(tok, "undefined type name"); } case TOK_STRUCT: @@ -740,10 +766,15 @@ return parse_error(tok, "struct or union name expected"); n = search_in_struct_unions(tok->info->ctx, tok->p, tok->size); - if (n < 0) - return parse_error(tok, "undefined struct/union name"); - if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) != 0) - ^ (kind == TOK_UNION)) + if (n < 0) { + if (kind == TOK_STRUCT && tok->size == 8 && + !memcmp(tok->p, "_IO_FILE", 8)) + n = _CFFI__IO_FILE_STRUCT; + else + return parse_error(tok, "undefined struct/union name"); + } + else if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) + != 0) ^ (kind == TOK_UNION)) return parse_error(tok, "wrong kind of tag: struct vs union"); t1 = _CFFI_OP(_CFFI_OP_STRUCT_UNION, n); @@ -773,8 +804,9 @@ } -RPY_EXTERN -int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input) +static +int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, + const char *input) { int result; token_t token; @@ -785,16 +817,33 @@ token.p = input; token.size = 0; token.output = info->output; - token.output_index = 0; + token.output_index = *output_index; next_token(&token); result = parse_complete(&token); + *output_index = token.output_index; if (token.kind != TOK_END) return parse_error(&token, "unexpected symbol"); return result; } +RPY_EXTERN +int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input) +{ + size_t output_index = 0; + return parse_c_type_from(info, &output_index, input); +} + +static +int parse_common_type_replacement(token_t *tok, const char *replacement) +{ + return parse_c_type_from(tok->info, &tok->output_index, replacement); +} + + +#include "commontypes.c" /* laziness hack: include this file here */ + /************************************************************/ /* extra from cdlopen.c */ diff --git a/pypy/module/_cffi_backend/src/parse_c_type.h b/pypy/module/_cffi_backend/src/parse_c_type.h --- a/pypy/module/_cffi_backend/src/parse_c_type.h +++ b/pypy/module/_cffi_backend/src/parse_c_type.h @@ -5,7 +5,7 @@ #define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8)) #define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode) -#define _CFFI_GETARG(cffi_opcode) (((uintptr_t)cffi_opcode) >> 8) +#define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8) #define _CFFI_OP_PRIMITIVE 1 #define _CFFI_OP_POINTER 3 @@ -25,6 +25,8 @@ #define _CFFI_OP_CONSTANT_INT 31 #define _CFFI_OP_GLOBAL_VAR 33 #define _CFFI_OP_DLOPEN_FUNC 35 +#define _CFFI_OP_DLOPEN_CONST 37 +#define _CFFI_OP_GLOBAL_VAR_F 39 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -77,6 +79,11 @@ #define _CFFI_PRIM_UINTMAX 47 #define _CFFI__NUM_PRIM 48 +#define _CFFI__UNKNOWN_PRIM (-1) +#define _CFFI__UNKNOWN_FLOAT_PRIM (-2) +#define _CFFI__UNKNOWN_LONG_DOUBLE (-3) + +#define _CFFI__IO_FILE_STRUCT (-1) struct _cffi_global_s { @@ -164,4 +171,6 @@ const char *search, size_t search_len); RPY_EXTERN void pypy_set_cdl_realize_global_int(struct _cffi_global_s *target); +RPY_EXTERN +char *pypy_enum_common_types(int index); #endif diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -3509,3 +3509,8 @@ assert repr(BFunc) == "" else: assert repr(BFunc) == "" + +def test_get_common_types(): + d = {} + _get_common_types(d) + assert d['bool'] == '_Bool' diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -424,3 +424,26 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) raises(MemoryError, alloc5, "int[5]") + + def test_bool_issue228(self): + import _cffi_backend as _cffi1_backend + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + + def test_FILE_issue228(self): + import _cffi_backend as _cffi1_backend + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + + def test_cast_from_int_type_to_bool(self): + import _cffi_backend as _cffi1_backend + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -28,6 +28,7 @@ module_name = '_CFFI_' + module_name rdir = udir.ensure('recompiler', dir=1) rdir.join('Python.h').write( + '#include \n' '#define PYPY_VERSION XX\n' '#define PyMODINIT_FUNC /*exported*/ void\n' ) @@ -1076,3 +1077,302 @@ raises(ffi.error, getattr, lib, 'my_value') e = raises(ffi.error, setattr, lib, 'my_value', 50) assert str(e.value) == "global variable 'my_value' is at address NULL" + + def test_const_fields(self): + ffi, lib = self.prepare( + """struct foo_s { const int a; void *const b; };""", + 'test_const_fields', + """struct foo_s { const int a; void *const b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int") + assert foo_s.fields[1][0] == 'b' + assert foo_s.fields[1][1].type is ffi.typeof("void *") + + def test_restrict_fields(self): + ffi, lib = self.prepare( + """struct foo_s { void * restrict b; };""", + 'test_restrict_fields', + """struct foo_s { void * __restrict b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + + def test_volatile_fields(self): + ffi, lib = self.prepare( + """struct foo_s { void * volatile b; };""", + 'test_volatile_fields', + """struct foo_s { void * volatile b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + + def test_const_array_fields(self): + ffi, lib = self.prepare( + """struct foo_s { const int a[4]; };""", + 'test_const_array_fields', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[4]") + + def test_const_array_fields_varlength(self): + ffi, lib = self.prepare( + """struct foo_s { const int a[]; ...; };""", + 'test_const_array_fields_varlength', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[]") + + def test_const_array_fields_unknownlength(self): + ffi, lb = self.prepare( + """struct foo_s { const int a[...]; ...; };""", + 'test_const_array_fields_unknownlength', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[4]") + + def test_const_function_args(self): + ffi, lib = self.prepare( + """int foobar(const int a, const int *b, const int c[]);""", + 'test_const_function_args', """ + int foobar(const int a, const int *b, const int c[]) { + return a + *b + *c; + } + """) + assert lib.foobar(100, ffi.new("int *", 40), ffi.new("int *", 2)) == 142 + + def test_const_function_type_args(self): + ffi, lib = self.prepare( + """int (*foobar)(const int a, const int *b, const int c[]);""", + 'test_const_function_type_args', """ + int (*foobar)(const int a, const int *b, const int c[]); + """) + t = ffi.typeof(lib.foobar) + assert t.args[0] is ffi.typeof("int") + assert t.args[1] is ffi.typeof("int *") + assert t.args[2] is ffi.typeof("int *") + + def test_const_constant(self): + ffi, lib = self.prepare( + """struct foo_s { int x,y; }; const struct foo_s myfoo;""", + 'test_const_constant', """ + struct foo_s { int x,y; }; const struct foo_s myfoo = { 40, 2 }; + """) + assert lib.myfoo.x == 40 + assert lib.myfoo.y == 2 + + def test_const_via_typedef(self): + ffi, lib = self.prepare( + """typedef const int const_t; const_t aaa;""", + 'test_const_via_typedef', """ + typedef const int const_t; + #define aaa 42 + """) + assert lib.aaa == 42 + raises(AttributeError, "lib.aaa = 43") + + def test_win32_calling_convention_0(self): + import sys + ffi, lib = self.prepare( + """ + int call1(int(__cdecl *cb)(int)); + int (*const call2)(int(__stdcall *cb)(int)); + """, + 'test_win32_calling_convention_0', r""" + #ifndef _MSC_VER + # define __stdcall /* nothing */ + #endif + int call1(int(*cb)(int)) { + int i, result = 0; + //printf("call1: cb = %p\n", cb); + for (i = 0; i < 1000; i++) + result += cb(i); + //printf("result = %d\n", result); + return result; + } + int call2(int(__stdcall *cb)(int)) { + int i, result = 0; + //printf("call2: cb = %p\n", cb); + for (i = 0; i < 1000; i++) + result += cb(-i); + //printf("result = %d\n", result); + return result; + } + """) + @ffi.callback("int(int)") + def cb1(x): + return x * 2 + @ffi.callback("int __stdcall(int)") + def cb2(x): + return x * 3 + res = lib.call1(cb1) + assert res == 500*999*2 + assert res == ffi.addressof(lib, 'call1')(cb1) + res = lib.call2(cb2) + assert res == -500*999*3 + assert res == ffi.addressof(lib, 'call2')(cb2) + if sys.platform == 'win32' and not sys.maxsize > 2**32: + assert '__stdcall' in str(ffi.typeof(cb2)) + assert '__stdcall' not in str(ffi.typeof(cb1)) + raises(TypeError, lib.call1, cb2) + raises(TypeError, lib.call2, cb1) + else: + assert '__stdcall' not in str(ffi.typeof(cb2)) + assert ffi.typeof(cb2) is ffi.typeof(cb1) + + def test_win32_calling_convention_1(self): + ffi, lib = self.prepare(""" + int __cdecl call1(int(__cdecl *cb)(int)); + int __stdcall call2(int(__stdcall *cb)(int)); + int (__cdecl *const cb1)(int); + int (__stdcall *const cb2)(int); + """, 'test_win32_calling_convention_1', r""" + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + int __cdecl cb1(int x) { return x * 2; } + int __stdcall cb2(int x) { return x * 3; } + + int __cdecl call1(int(__cdecl *cb)(int)) { + int i, result = 0; + //printf("here1\n"); + //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1); + for (i = 0; i < 1000; i++) + result += cb(i); + //printf("result = %d\n", result); + return result; + } + int __stdcall call2(int(__stdcall *cb)(int)) { + int i, result = 0; + //printf("here1\n"); + //printf("cb = %p, cb2 = %p\n", cb, (void *)cb2); + for (i = 0; i < 1000; i++) + result += cb(-i); + //printf("result = %d\n", result); + return result; + } + """) + #print '<<< cb1 =', ffi.addressof(lib, 'cb1') + ptr_call1 = ffi.addressof(lib, 'call1') + assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + #print '<<< cb2 =', ffi.addressof(lib, 'cb2') + ptr_call2 = ffi.addressof(lib, 'call2') + assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + assert ptr_call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + #print '<<< done' + + def test_win32_calling_convention_2(self): + import sys + # any mistake in the declaration of plain function (including the + # precise argument types and, here, the calling convention) are + # automatically corrected. But this does not apply to the 'cb' + # function pointer argument. + ffi, lib = self.prepare(""" + int __stdcall call1(int(__cdecl *cb)(int)); + int __cdecl call2(int(__stdcall *cb)(int)); + int (__cdecl *const cb1)(int); + int (__stdcall *const cb2)(int); + """, 'test_win32_calling_convention_2', """ + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + int __cdecl call1(int(__cdecl *cb)(int)) { + int i, result = 0; + for (i = 0; i < 1000; i++) + result += cb(i); + return result; + } + int __stdcall call2(int(__stdcall *cb)(int)) { + int i, result = 0; + for (i = 0; i < 1000; i++) + result += cb(-i); + return result; + } + int __cdecl cb1(int x) { return x * 2; } + int __stdcall cb2(int x) { return x * 3; } + """) + ptr_call1 = ffi.addressof(lib, 'call1') + ptr_call2 = ffi.addressof(lib, 'call2') + if sys.platform == 'win32' and not sys.maxsize > 2**32: + raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + assert ptr_call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + + def test_win32_calling_convention_3(self): + import sys + ffi, lib = self.prepare(""" + struct point { int x, y; }; + + int (*const cb1)(struct point); + int (__stdcall *const cb2)(struct point); + + struct point __stdcall call1(int(*cb)(struct point)); + struct point call2(int(__stdcall *cb)(struct point)); + """, 'test_win32_calling_convention_3', r""" + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + struct point { int x, y; }; + int cb1(struct point pt) { return pt.x + 10 * pt.y; } + int __stdcall cb2(struct point pt) { return pt.x + 100 * pt.y; } + struct point __stdcall call1(int(__cdecl *cb)(struct point)) { + int i; + struct point result = { 0, 0 }; + //printf("here1\n"); + //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1); + for (i = 0; i < 1000; i++) { + struct point p = { i, -i }; + int r = cb(p); + result.x += r; + result.y -= r; + } + return result; + } + struct point __cdecl call2(int(__stdcall *cb)(struct point)) { + int i; + struct point result = { 0, 0 }; + for (i = 0; i < 1000; i++) { + struct point p = { -i, i }; + int r = cb(p); + result.x += r; + result.y -= r; + } + return result; + } + """) + ptr_call1 = ffi.addressof(lib, 'call1') + ptr_call2 = ffi.addressof(lib, 'call2') + if sys.platform == 'win32' and not sys.maxsize > 2**32: + raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + pt = lib.call1(ffi.addressof(lib, 'cb1')) + assert (pt.x, pt.y) == (-9*500*999, 9*500*999) + pt = ptr_call1(ffi.addressof(lib, 'cb1')) + assert (pt.x, pt.y) == (-9*500*999, 9*500*999) + pt = lib.call2(ffi.addressof(lib, 'cb2')) + assert (pt.x, pt.y) == (99*500*999, -99*500*999) + pt = ptr_call2(ffi.addressof(lib, 'cb2')) + assert (pt.x, pt.y) == (99*500*999, -99*500*999) + + def test_share_FILE(self): + ffi1, lib1 = self.prepare("void do_stuff(FILE *);", + 'test_share_FILE_a', + "void do_stuff(FILE *f) { (void)f; }") + ffi2, lib2 = self.prepare("FILE *barize(void);", + 'test_share_FILE_b', + "FILE *barize(void) { return NULL; }") + lib1.do_stuff(lib2.barize()) diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -1,4 +1,4 @@ -from rpython.rlib import rpoll, rsocket, rthread, rweakref +from rpython.rlib import rpoll, rsocket, rthread, rweakref, rgc from rpython.rlib.rarithmetic import intmask, widen, r_uint from rpython.rlib.ropenssl import * from pypy.module._socket import interp_socket @@ -852,55 +852,58 @@ names = rffi.cast(GENERAL_NAMES, method[0].c_d2i( null, p_ptr, length)) - for j in range(libssl_sk_GENERAL_NAME_num(names)): - # Get a rendering of each name in the set of names + try: + for j in range(libssl_sk_GENERAL_NAME_num(names)): + # Get a rendering of each name in the set of names - name = libssl_sk_GENERAL_NAME_value(names, j) - gntype = intmask(name.c_type) - if gntype == GEN_DIRNAME: - # we special-case DirName as a tuple of tuples of - # attributes - dirname = libssl_pypy_GENERAL_NAME_dirn(name) - w_t = space.newtuple([ - space.wrap("DirName"), - _create_tuple_for_X509_NAME(space, dirname) - ]) - elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI): - # GENERAL_NAME_print() doesn't handle NULL bytes in - # ASN1_string correctly, CVE-2013-4238 - if gntype == GEN_EMAIL: - v = space.wrap("email") - elif gntype == GEN_DNS: - v = space.wrap("DNS") - elif gntype == GEN_URI: - v = space.wrap("URI") + name = libssl_sk_GENERAL_NAME_value(names, j) + gntype = intmask(name.c_type) + if gntype == GEN_DIRNAME: + # we special-case DirName as a tuple of tuples of + # attributes + dirname = libssl_pypy_GENERAL_NAME_dirn(name) + w_t = space.newtuple([ + space.wrap("DirName"), + _create_tuple_for_X509_NAME(space, dirname) + ]) + elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI): + # GENERAL_NAME_print() doesn't handle NULL bytes in + # ASN1_string correctly, CVE-2013-4238 + if gntype == GEN_EMAIL: + v = space.wrap("email") + elif gntype == GEN_DNS: + v = space.wrap("DNS") + elif gntype == GEN_URI: + v = space.wrap("URI") + else: + assert False + as_ = libssl_pypy_GENERAL_NAME_dirn(name) + as_ = rffi.cast(ASN1_STRING, as_) + buf = libssl_ASN1_STRING_data(as_) + length = libssl_ASN1_STRING_length(as_) + w_t = space.newtuple([ + v, space.wrap(rffi.charpsize2str(buf, length))]) else: - assert False - as_ = libssl_pypy_GENERAL_NAME_dirn(name) - as_ = rffi.cast(ASN1_STRING, as_) - buf = libssl_ASN1_STRING_data(as_) - length = libssl_ASN1_STRING_length(as_) - w_t = space.newtuple([ - v, space.wrap(rffi.charpsize2str(buf, length))]) - else: - # for everything else, we use the OpenSSL print form - if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY, - GEN_IPADD, GEN_RID): - space.warn(space.wrap("Unknown general name type"), - space.w_RuntimeWarning) - libssl_BIO_reset(biobuf) - libssl_GENERAL_NAME_print(biobuf, name) - with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf: - length = libssl_BIO_gets(biobuf, buf, 2047) - if length < 0: - raise _ssl_seterror(space, None, 0) + # for everything else, we use the OpenSSL print form + if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY, + GEN_IPADD, GEN_RID): + space.warn(space.wrap("Unknown general name type"), + space.w_RuntimeWarning) + libssl_BIO_reset(biobuf) + libssl_GENERAL_NAME_print(biobuf, name) + with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf: + length = libssl_BIO_gets(biobuf, buf, 2047) + if length < 0: + raise _ssl_seterror(space, None, 0) - v = rffi.charpsize2str(buf, length) - v1, v2 = v.split(':', 1) - w_t = space.newtuple([space.wrap(v1), - space.wrap(v2)]) + v = rffi.charpsize2str(buf, length) + v1, v2 = v.split(':', 1) + w_t = space.newtuple([space.wrap(v1), + space.wrap(v2)]) - alt_names_w.append(w_t) + alt_names_w.append(w_t) + finally: + libssl_pypy_GENERAL_NAME_pop_free(names) finally: libssl_BIO_free(biobuf) @@ -921,8 +924,11 @@ length = libssl_ASN1_STRING_to_UTF8(buf_ptr, value) if length < 0: raise _ssl_seterror(space, None, 0) - w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length)) - w_value = space.call_method(w_value, "decode", space.wrap("utf-8")) + try: + w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length)) + w_value = space.call_method(w_value, "decode", space.wrap("utf-8")) + finally: + libssl_OPENSSL_free(buf_ptr[0]) return space.newtuple([w_name, w_value]) @@ -930,9 +936,10 @@ def _get_aia_uri(space, certificate, nid): info = rffi.cast(AUTHORITY_INFO_ACCESS, libssl_X509_get_ext_d2i( certificate, NID_info_access, None, None)) - if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0: - return try: + if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0: + return + result_w = [] for i in range(libssl_sk_ACCESS_DESCRIPTION_num(info)): ad = libssl_sk_ACCESS_DESCRIPTION_value(info, i) @@ -962,20 +969,24 @@ if not dps: return None - cdp_w = [] - for i in range(libssl_sk_DIST_POINT_num(dps)): - dp = libssl_sk_DIST_POINT_value(dps, i) - gns = libssl_pypy_DIST_POINT_fullname(dp) + try: + cdp_w = [] + for i in range(libssl_sk_DIST_POINT_num(dps)): + dp = libssl_sk_DIST_POINT_value(dps, i) + gns = libssl_pypy_DIST_POINT_fullname(dp) - for j in range(libssl_sk_GENERAL_NAME_num(gns)): - name = libssl_sk_GENERAL_NAME_value(gns, j) - gntype = intmask(name.c_type) - if gntype != GEN_URI: - continue - uri = libssl_pypy_GENERAL_NAME_uri(name) - length = intmask(uri.c_length) - s_uri = rffi.charpsize2str(uri.c_data, length) - cdp_w.append(space.wrap(s_uri)) + for j in range(libssl_sk_GENERAL_NAME_num(gns)): + name = libssl_sk_GENERAL_NAME_value(gns, j) + gntype = intmask(name.c_type) + if gntype != GEN_URI: + continue + uri = libssl_pypy_GENERAL_NAME_uri(name) + length = intmask(uri.c_length) + s_uri = rffi.charpsize2str(uri.c_data, length) + cdp_w.append(space.wrap(s_uri)) + finally: + if OPENSSL_VERSION_NUMBER < 0x10001000: + libssl_sk_DIST_POINT_free(dps) return space.newtuple(cdp_w[:]) def checkwait(space, w_sock, writing): @@ -1270,6 +1281,7 @@ if not ctx: raise ssl_error(space, "failed to allocate SSL context") + rgc.add_memory_pressure(10 * 1024 * 1024) self = space.allocate_instance(_SSLContext, w_subtype) self.ctx = ctx self.check_hostname = False @@ -1296,6 +1308,9 @@ return self + def __del__(self): + libssl_SSL_CTX_free(self.ctx) + @unwrap_spec(server_side=int) def descr_wrap_socket(self, space, w_sock, server_side, w_server_hostname=None, w_ssl_sock=None): return _SSLSocket.descr_new(space, self, w_sock, server_side, w_server_hostname, w_ssl_sock) diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py --- a/pypy/module/micronumpy/test/test_object_arrays.py +++ b/pypy/module/micronumpy/test/test_object_arrays.py @@ -178,6 +178,7 @@ assert 'a' * 100 in str(a) b = a.astype('U') assert b.dtype == 'U100' + assert 'a' * 100 in str(b) a = np.array([123], dtype='U') assert a[0] == u'123' diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -2259,7 +2259,10 @@ def coerce(self, space, dtype, w_item): if isinstance(w_item, boxes.W_UnicodeBox): return w_item - value = space.unicode_w(space.unicode_from_object(w_item)) + if isinstance(w_item, boxes.W_ObjectBox): + value = space.unicode_w(space.unicode_from_object(w_item.w_obj)) + else: + value = space.unicode_w(space.unicode_from_object(w_item)) return boxes.W_UnicodeBox(value) def store(self, arr, i, offset, box, native): diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -248,3 +248,23 @@ loop, = log.loops_by_filename(self.filepath) ops = loop.ops_by_id('getitem', include_guard_not_invalidated=False) assert log.opnames(ops) == [] + + def test_enumerate_list(self): + def main(n): + for a, b in enumerate([1, 2] * 1000): + a + b + + log = self.run(main, [1000]) + loop, = log.loops_by_filename(self.filepath) + opnames = log.opnames(loop.allops()) + assert opnames.count('new_with_vtable') == 0 + + def test_enumerate(self): + def main(n): + for a, b in enumerate("abc" * 1000): + a + ord(b) + + log = self.run(main, [1000]) + loop, = log.loops_by_filename(self.filepath) + opnames = log.opnames(loop.allops()) + assert opnames.count('new_with_vtable') == 0 diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -757,10 +757,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py @@ -262,7 +262,8 @@ ffi = FFI() ffi.cdef("typedef int bool, *FILE;") assert repr(ffi.cast("bool", 123)) == "" - assert repr(ffi.cast("FILE", 123)) == "" + assert re.match(r"", + repr(ffi.cast("FILE", 123))) ffi = FFI() ffi.cdef("typedef bool (*fn_t)(bool, bool);") # "bool," but within "( )" @@ -273,6 +274,13 @@ ffi = FFI() ffi.cdef("typedef _Bool bool; void f(bool);") +def test_unknown_argument_type(): + ffi = FFI() + e = py.test.raises(CDefError, ffi.cdef, "void f(foobarbazzz);") + assert str(e.value) == ("f arg 1: unknown type 'foobarbazzz' (if you meant" + " to use the old C syntax of giving untyped" + " arguments, it is not supported)") + def test_void_renamed_as_only_arg(): ffi = FFI() ffi.cdef("typedef void void_t1;" @@ -280,38 +288,16 @@ "typedef int (*func_t)(void_t);") assert ffi.typeof("func_t").args == () -def test_win_common_types(): - from cffi.commontypes import COMMON_TYPES, _CACHE - from cffi.commontypes import win_common_types, resolve_common_type - # - def clear_all(extra={}, old_dict=COMMON_TYPES.copy()): - COMMON_TYPES.clear() - COMMON_TYPES.update(old_dict) - COMMON_TYPES.update(extra) - _CACHE.clear() - # - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - for key in sorted(ct): - if ct[key] != 'set-unicode-needed': - resolve_common_type(key) - # assert did not crash - # now try to use e.g. WPARAM (-> UINT_PTR -> unsigned 32/64-bit) - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - ffi = FFI() - value = int(ffi.cast("WPARAM", -1)) - assert value == maxsize - # - clear_all() - def test_WPARAM_on_windows(): if sys.platform != 'win32': py.test.skip("Only for Windows") ffi = FFI() ffi.cdef("void f(WPARAM);") + # + # WPARAM -> UINT_PTR -> unsigned 32/64-bit integer + ffi = FFI() + value = int(ffi.cast("WPARAM", -42)) + assert value == sys.maxsize * 2 - 40 def test__is_constant_globalvar(): for input, expected_output in [ @@ -361,6 +347,41 @@ assert lst[0] == lst[2] assert lst[1] == lst[3] +def test_const_pointer_to_pointer(): + from cffi import model + ffi = FFI(backend=FakeBackend()) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * (* const)") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * (* const (*))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char (* const (* (*)))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * * const const") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * * volatile *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char * volatile restrict * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const volatile * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals( + "int(char*const*, short****const*)") + assert (str(tp), qual) == ( + "", 0) + tp, qual = ffi._parser.parse_type_and_quals( + "char*const*(short*const****)") + assert (str(tp), qual) == ( + "", 0) + def test_enum(): ffi = FFI() ffi.cdef(""" diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -396,3 +396,23 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) py.test.raises(MemoryError, alloc5, "int[5]") + +def test_bool_issue228(): + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + +def test_FILE_issue228(): + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + +def test_cast_from_int_type_to_bool(): + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 From noreply at buildbot.pypy.org Sun Nov 8 13:11:01 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 19:11:01 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: document branch Message-ID: <20151108181101.F16E61C1034@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80591:7f5bf5bfbd40 Date: 2015-11-08 19:54 +0200 http://bitbucket.org/pypy/pypy/changeset/7f5bf5bfbd40/ Log: document branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -18,3 +18,10 @@ .. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + From noreply at buildbot.pypy.org Sun Nov 8 13:11:04 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 19:11:04 +0100 (CET) Subject: [pypy-commit] pypy propogate-nans: close branch to be merged Message-ID: <20151108181104.0FEE01C1034@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: propogate-nans Changeset: r80592:94c71981f270 Date: 2015-11-08 19:54 +0200 http://bitbucket.org/pypy/pypy/changeset/94c71981f270/ Log: close branch to be merged From noreply at buildbot.pypy.org Sun Nov 8 13:11:06 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 19:11:06 +0100 (CET) Subject: [pypy-commit] pypy default: merge propogate-nans, which tries harder to preserve nan mantissa values across float conversions Message-ID: <20151108181106.2C6F11C1034@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80593:fd1672bd10fe Date: 2015-11-08 19:57 +0200 http://bitbucket.org/pypy/pypy/changeset/fd1672bd10fe/ Log: merge propogate-nans, which tries harder to preserve nan mantissa values across float conversions diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -18,3 +18,10 @@ .. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -534,10 +534,10 @@ while not inner_iter.done(inner_state): arg_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = inner_iter.getitem(inner_state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val inner_state = inner_iter.next(inner_state) idx += 1 result = get_dtype_cache(space).w_longdtype.box(result) @@ -557,17 +557,17 @@ while not iter.done(state): arg_flat_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = iter.getitem(state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val state = iter.next(state) idx += 1 return result return argmin_argmax, argmin_argmax_flat -argmin, argmin_flat = _new_argmin_argmax('min') -argmax, argmax_flat = _new_argmin_argmax('max') +argmin, argmin_flat = _new_argmin_argmax('argmin') +argmax, argmax_flat = _new_argmin_argmax('argmax') dot_driver = jit.JitDriver(name = 'numpy_dot', greens = ['dtype'], diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1852,6 +1852,24 @@ a = array([(1, 2)], dtype=[('a', 'int64'), ('b', 'int64')]) assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02' + def test_half_conversions(self): + from numpy import array, arange + from math import isnan, isinf + e = array([0, -1, -float('inf'), float('nan'), 6], dtype='float16') + assert map(isnan, e) == [False, False, False, True, False] + assert map(isinf, e) == [False, False, True, False, False] + assert e.argmax() == 3 + # numpy preserves value for uint16 -> cast_as_float16 -> + # convert_to_float64 -> convert_to_float16 -> uint16 + # even for float16 various float16 nans + all_f16 = arange(0xfe00, 0xffff, dtype='uint16') + all_f16.dtype = 'float16' + all_f32 = array(all_f16, dtype='float32') + b = array(all_f32, dtype='float16') + c = b.view(dtype='uint16') + d = all_f16.view(dtype='uint16') + assert (c == d).all() + def test_ndarray_view_empty(self): from numpy import array, dtype x = array([], dtype=[('a', 'int8'), ('b', 'int8')]) diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -345,6 +345,14 @@ def min(self, v1, v2): return min(v1, v2) + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 + @raw_unary_op def rint(self, v): float64 = Float64(self.space) @@ -820,6 +828,14 @@ def min(self, v1, v2): return v1 if v1 <= v2 or rfloat.isnan(v1) else v2 + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 or rfloat.isnan(v1) + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 or rfloat.isnan(v1) + @simple_binary_op def fmax(self, v1, v2): return v1 if v1 >= v2 or rfloat.isnan(v2) else v2 @@ -1407,6 +1423,16 @@ return v1 return v2 + def argmin(self, v1, v2): + if self.le(v1, v2) or self.isnan(v1): + return True + return False + + def argmax(self, v1, v2): + if self.ge(v1, v2) or self.isnan(v1): + return True + return False + @complex_binary_op def floordiv(self, v1, v2): (r1, i1), (r2, i2) = v1, v2 @@ -1927,6 +1953,18 @@ return v1 return v2 + @raw_binary_op + def argmax(self, v1, v2): + if self.space.is_true(self.space.ge(v1, v2)): + return True + return False + + @raw_binary_op + def argmin(self, v1, v2): + if self.space.is_true(self.space.le(v1, v2)): + return True + return False + @raw_unary_op def bool(self,v): return self._obool(v) diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -5,7 +5,8 @@ import math from rpython.rlib import rarithmetic, rfloat, objectmodel, jit -from rpython.rlib.rarithmetic import r_ulonglong +from rpython.rtyper.lltypesystem.rffi import r_ulonglong, r_longlong, LONGLONG, ULONGLONG, cast +from rpython.rlib.longlong2float import longlong2float, float2longlong def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but @@ -60,7 +61,16 @@ if exp == MAX_EXP - MIN_EXP + 2: # nan or infinity - result = rfloat.NAN if mant else rfloat.INFINITY + if mant == 0: + result = rfloat.INFINITY + else: + # preserve at most 52 bits of mant value, but pad w/zeros + exp = r_ulonglong(0x7ff) << 52 + sign = r_ulonglong(sign) << 63 + mant = r_ulonglong(mant) << (52 - MANT_DIG) + uint = exp | mant | sign + result = longlong2float(cast(LONGLONG, uint)) + return result elif exp == 0: # subnormal or zero result = math.ldexp(mant, MIN_EXP - MANT_DIG) @@ -72,7 +82,7 @@ def float_unpack80(QQ, size): '''Unpack a (mant, exp) tuple of r_ulonglong in 80-bit extended format - into a long double float + into a python float (a double) ''' if size == 10 or size == 12 or size == 16: MIN_EXP = -16381 @@ -100,7 +110,13 @@ if exp == MAX_EXP - MIN_EXP + 2: # nan or infinity - result = rfloat.NAN if mant &((one << MANT_DIG - 1) - 1) else rfloat.INFINITY + if mant == 0: + result = rfloat.INFINITY + else: + exp = r_ulonglong(0x7ff) << 52 + uint = exp | r_ulonglong(mant) | r_ulonglong(sign) + result = longlong2float(cast(LONGLONG, uint)) + return result else: # normal result = math.ldexp(mant, exp + MIN_EXP - MANT_DIG - 1) @@ -128,13 +144,19 @@ raise ValueError("invalid size value") sign = rfloat.copysign(1.0, x) < 0.0 - if not rfloat.isfinite(x): - if rfloat.isinf(x): - mant = r_ulonglong(0) - exp = MAX_EXP - MIN_EXP + 2 - else: # rfloat.isnan(x): - mant = r_ulonglong(1) << (MANT_DIG-2) # other values possible - exp = MAX_EXP - MIN_EXP + 2 + if rfloat.isinf(x): + mant = r_ulonglong(0) + exp = MAX_EXP - MIN_EXP + 2 + elif rfloat.isnan(x): + asint = cast(ULONGLONG, float2longlong(x)) + mant = asint & ((r_ulonglong(1) << 51) - 1) + sign = asint >> 63 + # shift off lower bits, perhaps losing data + if MANT_DIG <= 52: + mant = mant >> (52 - MANT_DIG) + if mant == 0: + mant = r_ulonglong(1) << (MANT_DIG - 2) - 1 + exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) exp = 0 @@ -167,7 +189,7 @@ # check constraints if not objectmodel.we_are_translated(): - assert 0 <= mant < 1 << MANT_DIG - 1 + assert 0 <= mant <= (1 << MANT_DIG) - 1 assert 0 <= exp <= MAX_EXP - MIN_EXP + 2 assert 0 <= sign <= 1 exp = r_ulonglong(exp) @@ -187,13 +209,16 @@ raise ValueError("invalid size value") sign = rfloat.copysign(1.0, x) < 0.0 - if not rfloat.isfinite(x): - if rfloat.isinf(x): - mant = r_ulonglong(0) - exp = MAX_EXP - MIN_EXP + 2 - else: # rfloat.isnan(x): - mant = (r_ulonglong(1) << (MANT_DIG-2)) - 1 # other values possible - exp = MAX_EXP - MIN_EXP + 2 + if rfloat.isinf(x): + mant = r_ulonglong(0) + exp = MAX_EXP - MIN_EXP + 2 + elif rfloat.isnan(x): # rfloat.isnan(x): + asint = cast(ULONGLONG, float2longlong(x)) + mant = asint & ((r_ulonglong(1) << 51) - 1) + if mant == 0: + mant = r_ulonglong(1) << (MANT_DIG-2) - 1 + sign = asint < 0 + exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) exp = 0 @@ -221,12 +246,12 @@ if exp >= MAX_EXP - MIN_EXP + 2: raise OverflowError("float too large to pack in this format") + mant = mant << 1 # check constraints if not objectmodel.we_are_translated(): - assert 0 <= mant < 1 << MANT_DIG - 1 + assert 0 <= mant <= (1 << MANT_DIG) - 1 assert 0 <= exp <= MAX_EXP - MIN_EXP + 2 assert 0 <= sign <= 1 - mant = mant << 1 exp = r_ulonglong(exp) sign = r_ulonglong(sign) return (mant, (sign << BITS - MANT_DIG - 1) | exp) diff --git a/rpython/rlib/rstruct/test/test_ieee.py b/rpython/rlib/rstruct/test/test_ieee.py --- a/rpython/rlib/rstruct/test/test_ieee.py +++ b/rpython/rlib/rstruct/test/test_ieee.py @@ -168,15 +168,31 @@ def test_random(self): # construct a Python float from random integer, using struct + mantissa_mask = (1 << 53) - 1 for _ in xrange(10000): Q = random.randrange(2**64) x = struct.unpack('= 1 << 11: continue self.check_float(x) + def test_various_nans(self): + # check patterns that should preserve the mantissa across nan conversions + maxmant64 = (1 << 52) - 1 # maximum double mantissa + maxmant16 = (1 << 10) - 1 # maximum float16 mantissa + assert maxmant64 >> 42 == maxmant16 + exp = 0xfff << 52 + for i in range(20): + val_to_preserve = exp | ((maxmant16 - i) << 42) + a = ieee.float_unpack(val_to_preserve, 8) + assert isnan(a), 'i %d, maxmant %s' % (i, hex(val_to_preserve)) + b = ieee.float_pack(a, 8) + assert b == val_to_preserve, 'i %d, val %s b %s' % (i, hex(val_to_preserve), hex(b)) + b = ieee.float_pack(a, 2) + assert b == 0xffff - i, 'i %d, b%s' % (i, hex(b)) class TestCompiled: def test_pack_float(self): From noreply at buildbot.pypy.org Sun Nov 8 13:11:09 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 19:11:09 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151108181109.1036E1C1034@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80594:b2a2f75dc940 Date: 2015-11-08 20:11 +0200 http://bitbucket.org/pypy/pypy/changeset/b2a2f75dc940/ Log: merge heads diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py --- a/pypy/interpreter/test/test_zzpickle_and_slow.py +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py @@ -390,15 +390,20 @@ def test_pickle_enum(self): import pickle - e = enumerate(range(10)) + e = enumerate(range(100, 106)) e.next() e.next() pckl = pickle.dumps(e) result = pickle.loads(pckl) - e.next() - result.next() + res = e.next() + assert res == (2, 102) + res = result.next() + assert res == (2, 102) assert type(e) is type(result) - assert list(e) == list(result) + res = list(e) + assert res == [(3, 103), (4, 104), (5, 105)] + res = list(result) + assert res == [(3, 103), (4, 104), (5, 105)] def test_pickle_xrangeiter(self): import pickle diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py --- a/pypy/module/__builtin__/functional.py +++ b/pypy/module/__builtin__/functional.py @@ -231,28 +231,33 @@ class W_Enumerate(W_Root): - def __init__(self, space, w_iterable, w_start): - from pypy.objspace.std.listobject import W_ListObject - w_iter = space.iter(w_iterable) - if space.is_w(space.type(w_start), space.w_int): - self.index = space.int_w(w_start) - self.w_index = None - if self.index == 0 and type(w_iterable) is W_ListObject: - w_iter = w_iterable - else: - self.index = -1 - self.w_index = w_start - self.w_iter_or_list = w_iter - if self.w_index is not None: - assert not type(self.w_iter_or_list) is W_ListObject + def __init__(self, w_iter_or_list, start, w_start): + # 'w_index' should never be a wrapped int here; if it would be, + # then it is actually None and the unwrapped int is in 'index'. + self.w_iter_or_list = w_iter_or_list + self.index = start + self.w_index = w_start def descr___new__(space, w_subtype, w_iterable, w_start=None): - self = space.allocate_instance(W_Enumerate, w_subtype) + from pypy.objspace.std.listobject import W_ListObject + if w_start is None: - w_start = space.wrap(0) + start = 0 else: w_start = space.index(w_start) - self.__init__(space, w_iterable, w_start) + if space.is_w(space.type(w_start), space.w_int): + start = space.int_w(w_start) + w_start = None + else: + start = -1 + + if start == 0 and type(w_iterable) is W_ListObject: + w_iter = w_iterable + else: + w_iter = space.iter(w_iterable) + + self = space.allocate_instance(W_Enumerate, w_subtype) + self.__init__(w_iter, start, w_start) return space.wrap(self) def descr___iter__(self, space): @@ -298,14 +303,17 @@ w_index = self.w_index if w_index is None: w_index = space.wrap(self.index) - else: - w_index = self.w_index w_info = space.newtuple([self.w_iter_or_list, w_index]) return space.newtuple([w_new_inst, w_info]) # exported through _pickle_support -def _make_enumerate(space, w_iter, w_index): - return space.wrap(W_Enumerate(space, w_iter, w_index)) +def _make_enumerate(space, w_iter_or_list, w_index): + if space.is_w(space.type(w_index), space.w_int): + index = space.int_w(w_index) + w_index = None + else: + index = -1 + return space.wrap(W_Enumerate(w_iter_or_list, index, w_index)) W_Enumerate.typedef = TypeDef("enumerate", __new__=interp2app(W_Enumerate.descr___new__.im_func), diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py --- a/rpython/jit/backend/arm/opassembler.py +++ b/rpython/jit/backend/arm/opassembler.py @@ -680,8 +680,6 @@ emit_op_getfield_gc_pure_f = _genop_getfield emit_op_getfield_raw_i = _genop_getfield emit_op_getfield_raw_f = _genop_getfield - emit_op_getfield_raw_pure_i = _genop_getfield - emit_op_getfield_raw_pure_f = _genop_getfield def emit_op_increment_debug_counter(self, op, arglocs, regalloc, fcond): base_loc, value_loc = arglocs @@ -825,8 +823,6 @@ emit_op_getarrayitem_gc_pure_f = _genop_getarrayitem emit_op_getarrayitem_raw_i = _genop_getarrayitem emit_op_getarrayitem_raw_f = _genop_getarrayitem - emit_op_getarrayitem_raw_pure_i = _genop_getarrayitem - emit_op_getarrayitem_raw_pure_f = _genop_getarrayitem def _load_from_mem(self, res_loc, base_loc, ofs_loc, scale, signed=False, fcond=c.AL): diff --git a/rpython/jit/backend/arm/regalloc.py b/rpython/jit/backend/arm/regalloc.py --- a/rpython/jit/backend/arm/regalloc.py +++ b/rpython/jit/backend/arm/regalloc.py @@ -847,8 +847,6 @@ prepare_op_getfield_gc_f = _prepare_op_getfield prepare_op_getfield_raw_i = _prepare_op_getfield prepare_op_getfield_raw_f = _prepare_op_getfield - prepare_op_getfield_raw_pure_i = _prepare_op_getfield - prepare_op_getfield_raw_pure_f = _prepare_op_getfield prepare_op_getfield_gc_pure_i = _prepare_op_getfield prepare_op_getfield_gc_pure_r = _prepare_op_getfield prepare_op_getfield_gc_pure_f = _prepare_op_getfield @@ -942,8 +940,6 @@ prepare_op_getarrayitem_gc_f = _prepare_op_getarrayitem prepare_op_getarrayitem_raw_i = _prepare_op_getarrayitem prepare_op_getarrayitem_raw_f = _prepare_op_getarrayitem - prepare_op_getarrayitem_raw_pure_i = _prepare_op_getarrayitem - prepare_op_getarrayitem_raw_pure_f = _prepare_op_getarrayitem prepare_op_getarrayitem_gc_pure_i = _prepare_op_getarrayitem prepare_op_getarrayitem_gc_pure_r = _prepare_op_getarrayitem prepare_op_getarrayitem_gc_pure_f = _prepare_op_getarrayitem diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -613,9 +613,6 @@ bh_getfield_gc_f = bh_getfield_gc bh_getfield_raw = bh_getfield_gc - bh_getfield_raw_pure_i = bh_getfield_raw - bh_getfield_raw_pure_r = bh_getfield_raw - bh_getfield_raw_pure_f = bh_getfield_raw bh_getfield_raw_i = bh_getfield_raw bh_getfield_raw_r = bh_getfield_raw bh_getfield_raw_f = bh_getfield_raw @@ -641,6 +638,7 @@ def bh_getarrayitem_gc(self, a, index, descr): a = support.cast_arg(lltype.Ptr(descr.A), a) array = a._obj + assert index >= 0 return support.cast_result(descr.A.OF, array.getitem(index)) bh_getarrayitem_gc_pure_i = bh_getarrayitem_gc @@ -651,9 +649,6 @@ bh_getarrayitem_gc_f = bh_getarrayitem_gc bh_getarrayitem_raw = bh_getarrayitem_gc - bh_getarrayitem_raw_pure_i = bh_getarrayitem_raw - bh_getarrayitem_raw_pure_r = bh_getarrayitem_raw - bh_getarrayitem_raw_pure_f = bh_getarrayitem_raw bh_getarrayitem_raw_i = bh_getarrayitem_raw bh_getarrayitem_raw_r = bh_getarrayitem_raw bh_getarrayitem_raw_f = bh_getarrayitem_raw @@ -749,6 +744,7 @@ return s._obj.container.chars.getlength() def bh_strgetitem(self, s, item): + assert item >= 0 return ord(s._obj.container.chars.getitem(item)) def bh_strsetitem(self, s, item, v): @@ -770,6 +766,7 @@ return string._obj.container.chars.getlength() def bh_unicodegetitem(self, string, index): + assert index >= 0 return ord(string._obj.container.chars.getitem(index)) def bh_unicodesetitem(self, string, index, newvalue): diff --git a/rpython/jit/backend/ppc/opassembler.py b/rpython/jit/backend/ppc/opassembler.py --- a/rpython/jit/backend/ppc/opassembler.py +++ b/rpython/jit/backend/ppc/opassembler.py @@ -803,8 +803,6 @@ emit_getfield_gc_pure_f = _genop_getfield emit_getfield_raw_i = _genop_getfield emit_getfield_raw_f = _genop_getfield - emit_getfield_raw_pure_i = _genop_getfield - emit_getfield_raw_pure_f = _genop_getfield SIZE2SCALE = dict([(1<<_i, _i) for _i in range(32)]) @@ -893,8 +891,6 @@ emit_getarrayitem_gc_pure_f = _genop_getarray_or_interiorfield emit_getarrayitem_raw_i = _genop_getarray_or_interiorfield emit_getarrayitem_raw_f = _genop_getarray_or_interiorfield - emit_getarrayitem_raw_pure_i = _genop_getarray_or_interiorfield - emit_getarrayitem_raw_pure_f = _genop_getarray_or_interiorfield emit_raw_store = emit_setarrayitem_gc emit_raw_load_i = _genop_getarray_or_interiorfield diff --git a/rpython/jit/backend/ppc/regalloc.py b/rpython/jit/backend/ppc/regalloc.py --- a/rpython/jit/backend/ppc/regalloc.py +++ b/rpython/jit/backend/ppc/regalloc.py @@ -711,8 +711,6 @@ prepare_getfield_gc_f = _prepare_getfield prepare_getfield_raw_i = _prepare_getfield prepare_getfield_raw_f = _prepare_getfield - prepare_getfield_raw_pure_i = _prepare_getfield - prepare_getfield_raw_pure_f = _prepare_getfield prepare_getfield_gc_pure_i = _prepare_getfield prepare_getfield_gc_pure_r = _prepare_getfield prepare_getfield_gc_pure_f = _prepare_getfield @@ -796,8 +794,6 @@ prepare_getarrayitem_gc_f = _prepare_getarrayitem prepare_getarrayitem_raw_i = _prepare_getarrayitem prepare_getarrayitem_raw_f = _prepare_getarrayitem - prepare_getarrayitem_raw_pure_i = _prepare_getarrayitem - prepare_getarrayitem_raw_pure_f = _prepare_getarrayitem prepare_getarrayitem_gc_pure_i = _prepare_getarrayitem prepare_getarrayitem_gc_pure_r = _prepare_getarrayitem prepare_getarrayitem_gc_pure_f = _prepare_getarrayitem diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1477,8 +1477,6 @@ genop_getfield_gc_f = _genop_getfield genop_getfield_raw_i = _genop_getfield genop_getfield_raw_f = _genop_getfield - genop_getfield_raw_pure_i = _genop_getfield - genop_getfield_raw_pure_f = _genop_getfield genop_getfield_gc_pure_i = _genop_getfield genop_getfield_gc_pure_r = _genop_getfield genop_getfield_gc_pure_f = _genop_getfield @@ -1499,8 +1497,6 @@ genop_getarrayitem_gc_pure_f = _genop_getarrayitem genop_getarrayitem_raw_i = _genop_getarrayitem genop_getarrayitem_raw_f = _genop_getarrayitem - genop_getarrayitem_raw_pure_i = _genop_getarrayitem - genop_getarrayitem_raw_pure_f = _genop_getarrayitem def _genop_raw_load(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, ofs, sign_loc = arglocs diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1141,8 +1141,6 @@ consider_getfield_gc_f = _consider_getfield consider_getfield_raw_i = _consider_getfield consider_getfield_raw_f = _consider_getfield - consider_getfield_raw_pure_i = _consider_getfield - consider_getfield_raw_pure_f = _consider_getfield consider_getfield_gc_pure_i = _consider_getfield consider_getfield_gc_pure_r = _consider_getfield consider_getfield_gc_pure_f = _consider_getfield @@ -1172,8 +1170,6 @@ consider_getarrayitem_gc_pure_i = _consider_getarrayitem consider_getarrayitem_gc_pure_r = _consider_getarrayitem consider_getarrayitem_gc_pure_f = _consider_getarrayitem - consider_getarrayitem_raw_pure_i = _consider_getarrayitem - consider_getarrayitem_raw_pure_f = _consider_getarrayitem consider_raw_load_i = _consider_getarrayitem consider_raw_load_f = _consider_getarrayitem diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -703,6 +703,12 @@ pure = '_pure' arraydescr = self.cpu.arraydescrof(ARRAY) kind = getkind(op.result.concretetype) + if ARRAY._gckind != 'gc': + assert ARRAY._gckind == 'raw' + if kind == 'r': + raise Exception("getarrayitem_raw_r not supported") + pure = '' # always redetected from pyjitpl.py: we don't need + # a '_pure' version of getarrayitem_raw return SpaceOperation('getarrayitem_%s_%s%s' % (ARRAY._gckind, kind[0], pure), [op.args[0], op.args[1], arraydescr], @@ -792,12 +798,17 @@ descr = self.cpu.fielddescrof(v_inst.concretetype.TO, c_fieldname.value) kind = getkind(RESULT)[0] + if argname != 'gc': + assert argname == 'raw' + if (kind, pure) == ('r', ''): + # note: a pure 'getfield_raw_r' is used e.g. to load class + # attributes that are GC objects, so that one is supported. + raise Exception("getfield_raw_r (without _pure) not supported") + pure = '' # always redetected from pyjitpl.py: we don't need + # a '_pure' version of getfield_raw + # op1 = SpaceOperation('getfield_%s_%s%s' % (argname, kind, pure), [v_inst, descr], op.result) - if op1.opname == 'getfield_raw_r': - # note: 'getfield_raw_r_pure' is used e.g. to load class - # attributes that are GC objects, so that one is supported. - raise Exception("getfield_raw_r (without _pure) not supported") # if immut in (IR_QUASIIMMUTABLE, IR_QUASIIMMUTABLE_ARRAY): op1.opname += "_pure" diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py --- a/rpython/jit/metainterp/blackhole.py +++ b/rpython/jit/metainterp/blackhole.py @@ -1266,9 +1266,6 @@ def bhimpl_getarrayitem_raw_f(cpu, array, index, arraydescr): return cpu.bh_getarrayitem_raw_f(array, index, arraydescr) - bhimpl_getarrayitem_raw_i_pure = bhimpl_getarrayitem_raw_i - bhimpl_getarrayitem_raw_f_pure = bhimpl_getarrayitem_raw_f - @arguments("cpu", "r", "i", "i", "d") def bhimpl_setarrayitem_gc_i(cpu, array, index, newvalue, arraydescr): cpu.bh_setarrayitem_gc_i(array, index, newvalue, arraydescr) @@ -1387,17 +1384,12 @@ def bhimpl_getfield_raw_i(cpu, struct, fielddescr): return cpu.bh_getfield_raw_i(struct, fielddescr) @arguments("cpu", "i", "d", returns="r") - def _bhimpl_getfield_raw_r(cpu, struct, fielddescr): - # only for 'getfield_raw_r_pure' + def bhimpl_getfield_raw_r(cpu, struct, fielddescr): # for pure only return cpu.bh_getfield_raw_r(struct, fielddescr) @arguments("cpu", "i", "d", returns="f") def bhimpl_getfield_raw_f(cpu, struct, fielddescr): return cpu.bh_getfield_raw_f(struct, fielddescr) - bhimpl_getfield_raw_i_pure = bhimpl_getfield_raw_i - bhimpl_getfield_raw_r_pure = _bhimpl_getfield_raw_r - bhimpl_getfield_raw_f_pure = bhimpl_getfield_raw_f - @arguments("cpu", "r", "i", "d") def bhimpl_setfield_gc_i(cpu, struct, newvalue, fielddescr): cpu.bh_setfield_gc_i(struct, newvalue, fielddescr) diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -409,7 +409,7 @@ def make_execute_function(name, func): # Make a wrapper for 'func'. The func is a simple bhimpl_xxx function # from the BlackholeInterpreter class. The wrapper is a new function - # that receives and returns boxed values. + # that receives boxed values (but returns a non-boxed value). for argtype in func.argtypes: if argtype not in ('i', 'r', 'f', 'd', 'cpu'): return None diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py --- a/rpython/jit/metainterp/optimizeopt/info.py +++ b/rpython/jit/metainterp/optimizeopt/info.py @@ -6,6 +6,7 @@ from rpython.rtyper.lltypesystem import lltype from rpython.jit.metainterp.optimizeopt.rawbuffer import RawBuffer, InvalidRawOperation from rpython.jit.metainterp.executor import execute +from rpython.jit.metainterp.optimize import InvalidLoop INFO_NULL = 0 @@ -674,6 +675,7 @@ def _get_info(self, descr, optheap): ref = self._const.getref_base() + if not ref: raise InvalidLoop # null protection info = optheap.const_infos.get(ref, None) if info is None: info = StructPtrInfo(descr) @@ -682,6 +684,7 @@ def _get_array_info(self, descr, optheap): ref = self._const.getref_base() + if not ref: raise InvalidLoop # null protection info = optheap.const_infos.get(ref, None) if info is None: info = ArrayPtrInfo(descr) diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -8939,6 +8939,226 @@ # (this test was written to show it would previously crash) self.optimize_loop(ops, ops) + def test_unroll_constant_null_1(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getfield_gc_i(p0, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_2(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setfield_gc(p0, i1, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_3(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getarrayitem_gc_i(p0, 5, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_4(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setarrayitem_gc(p0, 5, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_constant_null_5(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getarrayitem_gc_i(p0, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + expected = """ + [i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = getarrayitem_gc_i(NULL, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.optimize_loop(ops, expected) + + def test_unroll_constant_null_6(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setarrayitem_gc(p0, i1, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + expected = """ + [i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + setarrayitem_gc(NULL, i1, i1, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(i3) + """ + # may either raise InvalidLoop or compile; it's a rare case + self.optimize_loop(ops, expected) + + def test_unroll_pure_on_bogus_object_1(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getfield_gc_pure_i(p0, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_2(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getfield_gc_pure_i(p0, descr=valuedescr) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr3), i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_3(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(p0, 5, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_4(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(p0, 5, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr3), i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_5(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(p0, 125, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(ConstPtr(arrayref), i3) # too short, length < 126! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_6(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(ConstPtr(arrayref), i0, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(125, i3) # arrayref is too short, length < 126! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_7(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + getarrayitem_gc_pure_i(ConstPtr(arrayref), i0, descr=arraydescr) + i3 = int_sub(i1, 1) + jump(-1, i3) # cannot access array item -1! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_8(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem(p0, 125) + i3 = int_sub(i1, 1) + jump(NULL, i3) + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_9(self): + py.test.skip("FIXME") + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem(p0, 125) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr), i3) # not a string at all + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_10(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem("foobar", i0) + i3 = int_sub(i1, 1) + jump(125, i3) # string is too short! + """ + self.optimize_loop(ops, ops) + + def test_unroll_pure_on_bogus_object_11(self): + py.test.skip("FIXME") + ops = """ + [i0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = strgetitem("foobar", i0) + i3 = int_sub(i1, 1) + jump(-1, i3) # cannot access character -1! + """ + self.optimize_loop(ops, ops) + class TestLLtype(OptimizeOptTest, LLtypeMixin): pass diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -500,16 +500,6 @@ arraydescr, arraybox, indexbox) @arguments("box", "box", "descr") - def opimpl_getarrayitem_raw_i_pure(self, arraybox, indexbox, arraydescr): - return self.execute_with_descr(rop.GETARRAYITEM_RAW_PURE_I, - arraydescr, arraybox, indexbox) - - @arguments("box", "box", "descr") - def opimpl_getarrayitem_raw_f_pure(self, arraybox, indexbox, arraydescr): - return self.execute_with_descr(rop.GETARRAYITEM_RAW_PURE_F, - arraydescr, arraybox, indexbox) - - @arguments("box", "box", "descr") def opimpl_getarrayitem_gc_i_pure(self, arraybox, indexbox, arraydescr): if isinstance(arraybox, ConstPtr) and isinstance(indexbox, ConstInt): # if the arguments are directly constants, bypass the heapcache @@ -792,19 +782,12 @@ def opimpl_getfield_raw_i(self, box, fielddescr): return self.execute_with_descr(rop.GETFIELD_RAW_I, fielddescr, box) @arguments("box", "descr") + def opimpl_getfield_raw_r(self, box, fielddescr): # for pure only + return self.execute_with_descr(rop.GETFIELD_RAW_R, fielddescr, box) + @arguments("box", "descr") def opimpl_getfield_raw_f(self, box, fielddescr): return self.execute_with_descr(rop.GETFIELD_RAW_F, fielddescr, box) - @arguments("box", "descr") - def opimpl_getfield_raw_i_pure(self, box, fielddescr): - return self.execute_with_descr(rop.GETFIELD_RAW_PURE_I, fielddescr, box) - @arguments("box", "descr") - def opimpl_getfield_raw_r_pure(self, box, fielddescr): - return self.execute_with_descr(rop.GETFIELD_RAW_PURE_R, fielddescr, box) - @arguments("box", "descr") - def opimpl_getfield_raw_f_pure(self, box, fielddescr): - return self.execute_with_descr(rop.GETFIELD_RAW_PURE_F, fielddescr, box) - @arguments("box", "box", "descr") def _opimpl_setfield_raw_any(self, box, valuebox, fielddescr): self.execute_with_descr(rop.SETFIELD_RAW, fielddescr, box, valuebox) @@ -2093,7 +2076,17 @@ profiler = self.staticdata.profiler profiler.count_ops(opnum) resvalue = executor.execute(self.cpu, self, opnum, descr, *argboxes) - if rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST: + # + is_pure = rop._ALWAYS_PURE_FIRST <= opnum <= rop._ALWAYS_PURE_LAST + if not is_pure: + if (opnum == rop.GETFIELD_RAW_I or + opnum == rop.GETFIELD_RAW_R or + opnum == rop.GETFIELD_RAW_F or + opnum == rop.GETARRAYITEM_RAW_I or + opnum == rop.GETARRAYITEM_RAW_F): + is_pure = descr.is_always_pure() + # + if is_pure: return self._record_helper_pure(opnum, resvalue, descr, *argboxes) if rop._OVF_FIRST <= opnum <= rop._OVF_LAST: return self._record_helper_ovf(opnum, resvalue, descr, *argboxes) diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1091,9 +1091,9 @@ 'STRLEN/1/i', 'STRGETITEM/2/i', 'GETFIELD_GC_PURE/1d/rfi', - 'GETFIELD_RAW_PURE/1d/rfi', 'GETARRAYITEM_GC_PURE/2d/rfi', - 'GETARRAYITEM_RAW_PURE/2d/fi', + #'GETFIELD_RAW_PURE/1d/rfi', these two operations not useful and + #'GETARRAYITEM_RAW_PURE/2d/fi', dangerous when unrolling speculatively 'UNICODELEN/1/i', 'UNICODEGETITEM/2/i', # @@ -1371,8 +1371,6 @@ rop.GETARRAYITEM_GC_F: rop.VEC_GETARRAYITEM_GC_F, # note that there is no _PURE operation for vector operations. # reason: currently we do not care if it is pure or not! - rop.GETARRAYITEM_RAW_PURE_I: rop.VEC_GETARRAYITEM_RAW_I, - rop.GETARRAYITEM_RAW_PURE_F: rop.VEC_GETARRAYITEM_RAW_F, rop.GETARRAYITEM_GC_PURE_I: rop.VEC_GETARRAYITEM_GC_I, rop.GETARRAYITEM_GC_PURE_F: rop.VEC_GETARRAYITEM_GC_F, rop.RAW_STORE: rop.VEC_RAW_STORE, diff --git a/rpython/jit/metainterp/test/test_immutable.py b/rpython/jit/metainterp/test/test_immutable.py --- a/rpython/jit/metainterp/test/test_immutable.py +++ b/rpython/jit/metainterp/test/test_immutable.py @@ -136,15 +136,15 @@ # res = self.interp_operations(f, [0], disable_optimizations=True) assert res == 42 - self.check_operations_history(getfield_raw_pure_i=1, - getarrayitem_raw_pure_i=1, + self.check_operations_history(getfield_raw_i=1, + getarrayitem_raw_i=1, int_mul=1) # # second try, in which we get num=0 constant-folded through f() res = self.interp_operations(f, [-1], disable_optimizations=True) assert res == 42 - self.check_operations_history(getfield_raw_pure_i=0, - getarrayitem_raw_pure_i=0, + self.check_operations_history(getfield_raw_i=0, + getarrayitem_raw_i=0, int_mul=0) def test_read_on_promoted(self): From noreply at buildbot.pypy.org Sun Nov 8 14:50:51 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 20:50:51 +0100 (CET) Subject: [pypy-commit] pypy array_interface: merge default into branch Message-ID: <20151108195051.0740E1C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: array_interface Changeset: r80595:1d8bad5c3fca Date: 2015-11-08 20:13 +0200 http://bitbucket.org/pypy/pypy/changeset/1d8bad5c3fca/ Log: merge default into branch diff too long, truncating to 2000 out of 3508 lines diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py --- a/lib_pypy/cffi/cffi_opcode.py +++ b/lib_pypy/cffi/cffi_opcode.py @@ -110,6 +110,8 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/lib_pypy/cffi/commontypes.py b/lib_pypy/cffi/commontypes.py --- a/lib_pypy/cffi/commontypes.py +++ b/lib_pypy/cffi/commontypes.py @@ -2,10 +2,17 @@ from . import api, model -COMMON_TYPES = { - 'FILE': model.unknown_type('FILE', '_IO_FILE'), - 'bool': '_Bool', - } +COMMON_TYPES = {} + +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: if _type.endswith('_t'): @@ -14,212 +21,35 @@ _CACHE = {} -def resolve_common_type(commontype): +def resolve_common_type(parser, commontype): try: return _CACHE[commontype] except KeyError: - result = COMMON_TYPES.get(commontype, commontype) - if not isinstance(result, str): - pass # result is already a BaseType - elif result.endswith(' *'): - if result.startswith('const '): - result = model.ConstPointerType( - resolve_common_type(result[6:-2])) - else: - result = model.PointerType(resolve_common_type(result[:-2])) - elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES: - result = model.PrimitiveType(result) - elif result == 'set-unicode-needed': + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': raise api.FFIError("The Windows type %r is only available after " "you call ffi.set_unicode()" % (commontype,)) else: - if commontype == result: + if commontype == cdecl: raise api.FFIError("Unsupported type: %r. Please file a bug " "if you think it should be." % (commontype,)) - result = resolve_common_type(result) # recursively + result, quals = parser.parse_type_and_quals(cdecl) # recursive + assert isinstance(result, model.BaseTypeByIdentity) - _CACHE[commontype] = result - return result + _CACHE[commontype] = result, quals + return result, quals # ____________________________________________________________ -# Windows common types +# extra types for Windows (most of them are in commontypes.c) -def win_common_types(maxsize): - result = {} - if maxsize < (1<<32): - result.update({ # Windows 32-bits - 'HALF_PTR': 'short', - 'INT_PTR': 'int', - 'LONG_PTR': 'long', - 'UHALF_PTR': 'unsigned short', - 'UINT_PTR': 'unsigned int', - 'ULONG_PTR': 'unsigned long', - }) - else: - result.update({ # Windows 64-bits - 'HALF_PTR': 'int', - 'INT_PTR': 'long long', - 'LONG_PTR': 'long long', - 'UHALF_PTR': 'unsigned int', - 'UINT_PTR': 'unsigned long long', - 'ULONG_PTR': 'unsigned long long', - }) - result.update({ - "BYTE": "unsigned char", - "BOOL": "int", - "CCHAR": "char", - "CHAR": "char", - "DWORD": "unsigned long", - "DWORD32": "unsigned int", - "DWORD64": "unsigned long long", - "FLOAT": "float", - "INT": "int", - "INT8": "signed char", - "INT16": "short", - "INT32": "int", - "INT64": "long long", - "LONG": "long", - "LONGLONG": "long long", - "LONG32": "int", - "LONG64": "long long", - "WORD": "unsigned short", - "PVOID": model.voidp_type, - "ULONGLONG": "unsigned long long", - "WCHAR": "wchar_t", - "SHORT": "short", - "UCHAR": "unsigned char", - "UINT": "unsigned int", - "UINT8": "unsigned char", - "UINT16": "unsigned short", - "UINT32": "unsigned int", - "UINT64": "unsigned long long", - "ULONG": "unsigned long", - "ULONG32": "unsigned int", - "ULONG64": "unsigned long long", - "USHORT": "unsigned short", - - "SIZE_T": "ULONG_PTR", - "SSIZE_T": "LONG_PTR", - "ATOM": "WORD", - "BOOLEAN": "BYTE", - "COLORREF": "DWORD", - - "HANDLE": "PVOID", - "DWORDLONG": "ULONGLONG", - "DWORD_PTR": "ULONG_PTR", - "HACCEL": "HANDLE", - - "HBITMAP": "HANDLE", - "HBRUSH": "HANDLE", - "HCOLORSPACE": "HANDLE", - "HCONV": "HANDLE", - "HCONVLIST": "HANDLE", - "HDC": "HANDLE", - "HDDEDATA": "HANDLE", - "HDESK": "HANDLE", - "HDROP": "HANDLE", - "HDWP": "HANDLE", - "HENHMETAFILE": "HANDLE", - "HFILE": "int", - "HFONT": "HANDLE", - "HGDIOBJ": "HANDLE", - "HGLOBAL": "HANDLE", - "HHOOK": "HANDLE", - "HICON": "HANDLE", - "HCURSOR": "HICON", - "HINSTANCE": "HANDLE", - "HKEY": "HANDLE", - "HKL": "HANDLE", - "HLOCAL": "HANDLE", - "HMENU": "HANDLE", - "HMETAFILE": "HANDLE", - "HMODULE": "HINSTANCE", - "HMONITOR": "HANDLE", - "HPALETTE": "HANDLE", - "HPEN": "HANDLE", - "HRESULT": "LONG", - "HRGN": "HANDLE", - "HRSRC": "HANDLE", - "HSZ": "HANDLE", - "WINSTA": "HANDLE", - "HWND": "HANDLE", - - "LANGID": "WORD", - "LCID": "DWORD", - "LCTYPE": "DWORD", - "LGRPID": "DWORD", - "LPARAM": "LONG_PTR", - "LPBOOL": "BOOL *", - "LPBYTE": "BYTE *", - "LPCOLORREF": "DWORD *", - "LPCSTR": "const char *", - - "LPCVOID": model.const_voidp_type, - "LPCWSTR": "const WCHAR *", - "LPDWORD": "DWORD *", - "LPHANDLE": "HANDLE *", - "LPINT": "int *", - "LPLONG": "long *", - "LPSTR": "CHAR *", - "LPWSTR": "WCHAR *", - "LPVOID": model.voidp_type, - "LPWORD": "WORD *", - "LRESULT": "LONG_PTR", - "PBOOL": "BOOL *", - "PBOOLEAN": "BOOLEAN *", - "PBYTE": "BYTE *", - "PCHAR": "CHAR *", - "PCSTR": "const CHAR *", - "PCWSTR": "const WCHAR *", - "PDWORD": "DWORD *", - "PDWORDLONG": "DWORDLONG *", - "PDWORD_PTR": "DWORD_PTR *", - "PDWORD32": "DWORD32 *", - "PDWORD64": "DWORD64 *", - "PFLOAT": "FLOAT *", - "PHALF_PTR": "HALF_PTR *", - "PHANDLE": "HANDLE *", - "PHKEY": "HKEY *", - "PINT": "int *", - "PINT_PTR": "INT_PTR *", - "PINT8": "INT8 *", - "PINT16": "INT16 *", - "PINT32": "INT32 *", - "PINT64": "INT64 *", - "PLCID": "PDWORD", - "PLONG": "LONG *", - "PLONGLONG": "LONGLONG *", - "PLONG_PTR": "LONG_PTR *", - "PLONG32": "LONG32 *", - "PLONG64": "LONG64 *", - "PSHORT": "SHORT *", - "PSIZE_T": "SIZE_T *", - "PSSIZE_T": "SSIZE_T *", - "PSTR": "CHAR *", - "PUCHAR": "UCHAR *", - "PUHALF_PTR": "UHALF_PTR *", - "PUINT": "UINT *", - "PUINT_PTR": "UINT_PTR *", - "PUINT8": "UINT8 *", - "PUINT16": "UINT16 *", - "PUINT32": "UINT32 *", - "PUINT64": "UINT64 *", - "PULONG": "ULONG *", - "PULONGLONG": "ULONGLONG *", - "PULONG_PTR": "ULONG_PTR *", - "PULONG32": "ULONG32 *", - "PULONG64": "ULONG64 *", - "PUSHORT": "USHORT *", - "PWCHAR": "WCHAR *", - "PWORD": "WORD *", - "PWSTR": "WCHAR *", - "QWORD": "unsigned long long", - "SC_HANDLE": "HANDLE", - "SC_LOCK": "LPVOID", - "SERVICE_STATUS_HANDLE": "HANDLE", - +def win_common_types(): + return { "UNICODE_STRING": model.StructType( "_UNICODE_STRING", ["Length", @@ -232,10 +62,6 @@ "PUNICODE_STRING": "UNICODE_STRING *", "PCUNICODE_STRING": "const UNICODE_STRING *", - "USN": "LONGLONG", - "VOID": model.void_type, - "WPARAM": "UINT_PTR", - "TBYTE": "set-unicode-needed", "TCHAR": "set-unicode-needed", "LPCTSTR": "set-unicode-needed", @@ -244,9 +70,7 @@ "PTSTR": "set-unicode-needed", "PTBYTE": "set-unicode-needed", "PTCHAR": "set-unicode-needed", - }) - return result - + } if sys.platform == 'win32': - COMMON_TYPES.update(win_common_types(sys.maxsize)) + COMMON_TYPES.update(win_common_types()) diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -29,6 +29,8 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") def _get_parser(): global _parser_cache @@ -36,6 +38,46 @@ _parser_cache = pycparser.CParser() return _parser_cache +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + for i in xrange(endpos, len(csource)): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + return ''.join(parts) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -47,6 +89,10 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) + # # BIG HACK: replace WINAPI or __stdcall with "volatile const". # It doesn't make sense for the return type of a function to be # "volatile volatile const", so we abuse it to detect __stdcall... @@ -320,13 +366,15 @@ self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] assert not macros exprnode = ast.ext[-1].type.args.params[0] if isinstance(exprnode, pycparser.c_ast.ID): raise api.CDefError("unknown identifier '%s'" % (exprnode.name,)) - tp, quals = self._get_type_and_quals(exprnode.type) - return tp + return self._get_type_and_quals(exprnode.type) def _declare(self, name, obj, included=False, quals=0): if name in self._declarations: @@ -348,6 +396,8 @@ pycparser.c_ast.PtrDecl)): if 'const' in type.quals: quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE if 'restrict' in type.quals: quals |= model.Q_RESTRICT return quals @@ -422,7 +472,8 @@ if ident == '__dotdotdot__': raise api.FFIError(':%d: bad usage of "..."' % typenode.coord.line) - return resolve_common_type(ident), quals + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) # if isinstance(type, pycparser.c_ast.Struct): # 'struct foobar' @@ -456,6 +507,13 @@ def _parse_function_type(self, typenode, funcname=None): params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise api.CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) ellipsis = ( len(params) > 0 and isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -7,10 +7,13 @@ # type qualifiers Q_CONST = 0x01 Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 def qualify(quals, replace_with): if quals & Q_CONST: replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() if quals & Q_RESTRICT: # It seems that __restrict is supported by gcc and msvc. # If you hit some different compiler, add a #define in diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -83,6 +83,8 @@ #define _CFFI__UNKNOWN_FLOAT_PRIM (-2) #define _CFFI__UNKNOWN_LONG_DOUBLE (-3) +#define _CFFI__IO_FILE_STRUCT (-1) + struct _cffi_global_s { const char *name; diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -76,10 +76,10 @@ if "cppyy" in working_modules: working_modules.remove("cppyy") # depends on ctypes -if sys.platform.startswith("linux"): - _mach = os.popen('uname -m', 'r').read().strip() - if _mach.startswith('ppc'): - working_modules.remove("_continuation") +#if sys.platform.startswith("linux"): +# _mach = os.popen('uname -m', 'r').read().strip() +# if _mach.startswith(...): +# working_modules.remove("_continuation") module_dependencies = { diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst --- a/pypy/doc/build.rst +++ b/pypy/doc/build.rst @@ -85,13 +85,16 @@ _ssl libssl +gdbm + libgdbm-dev + Make sure to have these libraries (with development headers) installed before building PyPy, otherwise the resulting binary will not contain these modules. On Debian, this is the command to install all build-time dependencies:: apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \ - libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev + libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev For the optional lzma module on PyPy3 you will also need ``liblzma-dev``. diff --git a/pypy/doc/whatsnew-4.0.0.rst b/pypy/doc/whatsnew-4.0.0.rst --- a/pypy/doc/whatsnew-4.0.0.rst +++ b/pypy/doc/whatsnew-4.0.0.rst @@ -6,12 +6,12 @@ .. startrev: 3a8f5481dab4 .. branch: keys_with_hash -Improve the performance of dict.update() and a bunch of methods from +Improve the performance of ``dict.update()`` and a bunch of methods from sets, by reusing the hash value stored in one dict when inspecting or changing another dict with that key. .. branch: optresult-unroll -A major refactoring of the ResOperations that kills Box. Also rewrote +A major refactoring of the ``ResOperations`` that kills Box. Also rewrote unrolling to enable future enhancements. Should improve warmup time by 20% or so. @@ -24,7 +24,7 @@ .. branch: gc-more-incremental Remove a source of non-incremental-ness in the GC: now -external_malloc() no longer runs gc_step_until() any more. If there +``external_malloc()`` no longer runs ``gc_step_until()`` any more. If there is a currently-running major collection, we do only so many steps before returning. This number of steps depends on the size of the allocated object. It is controlled by tracking the general progress @@ -55,7 +55,7 @@ floats, cf. issue #2148. .. branch: cffi-stdcall -Win32: support '__stdcall' in CFFI. +Win32: support ``__stdcall`` in CFFI. .. branch: callfamily @@ -67,19 +67,19 @@ .. branch: type_system-cleanup -Remove some remnants of the old ootypesystem vs lltypesystem dichotomy. +Remove some remnants of the old ``ootypesystem`` vs ``lltypesystem`` dichotomy. .. branch: cffi-handle-lifetime -ffi.new_handle() returns handles that work more like CPython's: they +``ffi.new_handle()`` returns handles that work more like CPython's: they remain valid as long as the target exists (unlike the previous -version, where handles become invalid *before* the __del__ is called). +version, where handles become invalid *before* the ``__del__`` is called). .. branch: ufunc-casting -allow automatic casting in ufuncs (and frompypyfunc) to cast the +allow automatic casting in ufuncs (and ``frompypyfunc``) to cast the arguments to the allowed function type declarations, fixes various -failures in linalg cffi functions +failures in linalg CFFI functions .. branch: vecopt .. branch: vecopt-merge @@ -94,4 +94,5 @@ .. branch: lazy-fast2locals improve the performance of simple trace functions by lazily calling -fast2locals and locals2fast only if f_locals is actually accessed. +``fast2locals`` and ``locals2fast`` only if ``f_locals`` is actually accessed. + diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -8,3 +8,20 @@ .. branch: 2174-fix-osx-10-11-translation Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py --- a/pypy/interpreter/test/test_zzpickle_and_slow.py +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py @@ -390,15 +390,20 @@ def test_pickle_enum(self): import pickle - e = enumerate(range(10)) + e = enumerate(range(100, 106)) e.next() e.next() pckl = pickle.dumps(e) result = pickle.loads(pckl) - e.next() - result.next() + res = e.next() + assert res == (2, 102) + res = result.next() + assert res == (2, 102) assert type(e) is type(result) - assert list(e) == list(result) + res = list(e) + assert res == [(3, 103), (4, 104), (5, 105)] + res = list(result) + assert res == [(3, 103), (4, 104), (5, 105)] def test_pickle_xrangeiter(self): import pickle diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py --- a/pypy/module/__builtin__/functional.py +++ b/pypy/module/__builtin__/functional.py @@ -8,7 +8,7 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault from pypy.interpreter.typedef import TypeDef -from rpython.rlib import jit +from rpython.rlib import jit, rarithmetic from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_uint, intmask from rpython.rlib.rbigint import rbigint @@ -229,27 +229,70 @@ return min_max(space, __args__, "min") + class W_Enumerate(W_Root): - def __init__(self, w_iter, w_start): - self.w_iter = w_iter + def __init__(self, w_iter_or_list, start, w_start): + # 'w_index' should never be a wrapped int here; if it would be, + # then it is actually None and the unwrapped int is in 'index'. + self.w_iter_or_list = w_iter_or_list + self.index = start self.w_index = w_start def descr___new__(space, w_subtype, w_iterable, w_start=None): - self = space.allocate_instance(W_Enumerate, w_subtype) + from pypy.objspace.std.listobject import W_ListObject + if w_start is None: - w_start = space.wrap(0) + start = 0 else: w_start = space.index(w_start) - self.__init__(space.iter(w_iterable), w_start) + if space.is_w(space.type(w_start), space.w_int): + start = space.int_w(w_start) + w_start = None + else: + start = -1 + + if start == 0 and type(w_iterable) is W_ListObject: + w_iter = w_iterable + else: + w_iter = space.iter(w_iterable) + + self = space.allocate_instance(W_Enumerate, w_subtype) + self.__init__(w_iter, start, w_start) return space.wrap(self) def descr___iter__(self, space): return space.wrap(self) def descr_next(self, space): - w_item = space.next(self.w_iter) + from pypy.objspace.std.listobject import W_ListObject w_index = self.w_index - self.w_index = space.add(w_index, space.wrap(1)) + w_iter_or_list = self.w_iter_or_list + w_item = None + if w_index is None: + index = self.index + if type(w_iter_or_list) is W_ListObject: + try: + w_item = w_iter_or_list.getitem(index) + except IndexError: + self.w_iter_or_list = None + raise OperationError(space.w_StopIteration, space.w_None) + self.index = index + 1 + elif w_iter_or_list is None: + raise OperationError(space.w_StopIteration, space.w_None) + else: + try: + newval = rarithmetic.ovfcheck(index + 1) + except OverflowError: + w_index = space.wrap(index) + self.w_index = space.add(w_index, space.wrap(1)) + self.index = -1 + else: + self.index = newval + w_index = space.wrap(index) + else: + self.w_index = space.add(w_index, space.wrap(1)) + if w_item is None: + w_item = space.next(self.w_iter_or_list) return space.newtuple([w_index, w_item]) def descr___reduce__(self, space): @@ -257,12 +300,20 @@ w_mod = space.getbuiltinmodule('_pickle_support') mod = space.interp_w(MixedModule, w_mod) w_new_inst = mod.get('enumerate_new') - w_info = space.newtuple([self.w_iter, self.w_index]) + w_index = self.w_index + if w_index is None: + w_index = space.wrap(self.index) + w_info = space.newtuple([self.w_iter_or_list, w_index]) return space.newtuple([w_new_inst, w_info]) # exported through _pickle_support -def _make_enumerate(space, w_iter, w_index): - return space.wrap(W_Enumerate(w_iter, w_index)) +def _make_enumerate(space, w_iter_or_list, w_index): + if space.is_w(space.type(w_index), space.w_int): + index = space.int_w(w_index) + w_index = None + else: + index = -1 + return space.wrap(W_Enumerate(w_iter_or_list, index, w_index)) W_Enumerate.typedef = TypeDef("enumerate", __new__=interp2app(W_Enumerate.descr___new__.im_func), diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py --- a/pypy/module/__builtin__/test/test_builtin.py +++ b/pypy/module/__builtin__/test/test_builtin.py @@ -264,6 +264,7 @@ raises(StopIteration,x.next) def test_enumerate(self): + import sys seq = range(2,4) enum = enumerate(seq) assert enum.next() == (0, 2) @@ -274,6 +275,15 @@ enum = enumerate(range(5), 2) assert list(enum) == zip(range(2, 7), range(5)) + enum = enumerate(range(2), 2**100) + assert list(enum) == [(2**100, 0), (2**100+1, 1)] + + enum = enumerate(range(2), sys.maxint) + assert list(enum) == [(sys.maxint, 0), (sys.maxint+1, 1)] + + raises(TypeError, enumerate, range(2), 5.5) + + def test_next(self): x = iter(['a', 'b', 'c']) assert next(x) == 'a' diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -43,6 +43,7 @@ 'newp_handle': 'handle.newp_handle', 'from_handle': 'handle.from_handle', '_get_types': 'func._get_types', + '_get_common_types': 'func._get_common_types', 'from_buffer': 'func.from_buffer', 'string': 'func.string', diff --git a/pypy/module/_cffi_backend/cffi_opcode.py b/pypy/module/_cffi_backend/cffi_opcode.py --- a/pypy/module/_cffi_backend/cffi_opcode.py +++ b/pypy/module/_cffi_backend/cffi_opcode.py @@ -110,6 +110,9 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py --- a/pypy/module/_cffi_backend/func.py +++ b/pypy/module/_cffi_backend/func.py @@ -84,6 +84,20 @@ # ____________________________________________________________ +def _get_common_types(space, w_dict): + from pypy.module._cffi_backend.parse_c_type import ll_enum_common_types + index = 0 + while True: + p = ll_enum_common_types(rffi.cast(rffi.INT, index)) + if not p: + break + key = rffi.charp2str(p) + value = rffi.charp2str(rffi.ptradd(p, len(key) + 1)) + space.setitem_str(w_dict, key, space.wrap(value)) + index += 1 + +# ____________________________________________________________ + def _fetch_as_read_buffer(space, w_x): # xxx do we really need to implement the same mess as in CPython 2.7 # w.r.t. buffers and memoryviews?? diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -87,6 +87,8 @@ ll_set_cdl_realize_global_int = llexternal('pypy_set_cdl_realize_global_int', [lltype.Ptr(GLOBAL_S)], lltype.Void) +ll_enum_common_types = llexternal('pypy_enum_common_types', + [rffi.INT], rffi.CCHARP) def parse_c_type(info, input): p_input = rffi.str2charp(input) diff --git a/pypy/module/_cffi_backend/realize_c_type.py b/pypy/module/_cffi_backend/realize_c_type.py --- a/pypy/module/_cffi_backend/realize_c_type.py +++ b/pypy/module/_cffi_backend/realize_c_type.py @@ -74,7 +74,15 @@ assert len(NAMES) == cffi_opcode._NUM_PRIM def __init__(self, space): + self.space = space self.all_primitives = [None] * cffi_opcode._NUM_PRIM + self.file_struct = None + + def get_file_struct(self): + if self.file_struct is None: + self.file_struct = ctypestruct.W_CTypeStruct(self.space, "FILE") + return self.file_struct + def get_primitive_type(ffi, num): space = ffi.space @@ -266,6 +274,10 @@ def _realize_c_struct_or_union(ffi, sindex): + if sindex == cffi_opcode._IO_FILE_STRUCT: + # returns a single global cached opaque type + return ffi.space.fromcache(RealizeCache).get_file_struct() + s = ffi.ctxobj.ctx.c_struct_unions[sindex] type_index = rffi.getintfield(s, 'c_type_index') if ffi.cached_types[type_index] is not None: @@ -281,7 +293,10 @@ x = ctypestruct.W_CTypeUnion(space, name) else: name = _realize_name("struct ", s.c_name) - x = ctypestruct.W_CTypeStruct(space, name) + if name == "struct _IO_FILE": + x = space.fromcache(RealizeCache).get_file_struct() + else: + x = ctypestruct.W_CTypeStruct(space, name) if (c_flags & cffi_opcode.F_OPAQUE) == 0: assert c_first_field_index >= 0 w_ctype = x diff --git a/pypy/module/_cffi_backend/src/commontypes.c b/pypy/module/_cffi_backend/src/commontypes.c new file mode 100644 --- /dev/null +++ b/pypy/module/_cffi_backend/src/commontypes.c @@ -0,0 +1,207 @@ +/* This file must be kept in alphabetical order. See test_commontypes.py */ + +#define EQ(key, value) key "\0" value /* string concatenation */ +#ifdef _WIN64 +# define W32_64(X,Y) Y +# else +# define W32_64(X,Y) X +# endif + + +static const char *common_simple_types[] = { + +#ifdef MS_WIN32 /* Windows types */ + EQ("ATOM", "WORD"), + EQ("BOOL", "int"), + EQ("BOOLEAN", "BYTE"), + EQ("BYTE", "unsigned char"), + EQ("CCHAR", "char"), + EQ("CHAR", "char"), + EQ("COLORREF", "DWORD"), + EQ("DWORD", "unsigned long"), + EQ("DWORD32", "unsigned int"), + EQ("DWORD64", "unsigned long long"), + EQ("DWORDLONG", "ULONGLONG"), + EQ("DWORD_PTR", "ULONG_PTR"), +#endif + + EQ("FILE", "struct _IO_FILE"), + +#ifdef MS_WIN32 /* more Windows types */ + EQ("FLOAT", "float"), + EQ("HACCEL", "HANDLE"), + EQ("HALF_PTR", W32_64("short","int")), + EQ("HANDLE", "PVOID"), + EQ("HBITMAP", "HANDLE"), + EQ("HBRUSH", "HANDLE"), + EQ("HCOLORSPACE", "HANDLE"), + EQ("HCONV", "HANDLE"), + EQ("HCONVLIST", "HANDLE"), + EQ("HCURSOR", "HICON"), + EQ("HDC", "HANDLE"), + EQ("HDDEDATA", "HANDLE"), + EQ("HDESK", "HANDLE"), + EQ("HDROP", "HANDLE"), + EQ("HDWP", "HANDLE"), + EQ("HENHMETAFILE", "HANDLE"), + EQ("HFILE", "int"), + EQ("HFONT", "HANDLE"), + EQ("HGDIOBJ", "HANDLE"), + EQ("HGLOBAL", "HANDLE"), + EQ("HHOOK", "HANDLE"), + EQ("HICON", "HANDLE"), + EQ("HINSTANCE", "HANDLE"), + EQ("HKEY", "HANDLE"), + EQ("HKL", "HANDLE"), + EQ("HLOCAL", "HANDLE"), + EQ("HMENU", "HANDLE"), + EQ("HMETAFILE", "HANDLE"), + EQ("HMODULE", "HINSTANCE"), + EQ("HMONITOR", "HANDLE"), + EQ("HPALETTE", "HANDLE"), + EQ("HPEN", "HANDLE"), + EQ("HRESULT", "LONG"), + EQ("HRGN", "HANDLE"), + EQ("HRSRC", "HANDLE"), + EQ("HSZ", "HANDLE"), + EQ("HWND", "HANDLE"), + EQ("INT", "int"), + EQ("INT16", "short"), + EQ("INT32", "int"), + EQ("INT64", "long long"), + EQ("INT8", "signed char"), + EQ("INT_PTR", W32_64("int","long long")), + EQ("LANGID", "WORD"), + EQ("LCID", "DWORD"), + EQ("LCTYPE", "DWORD"), + EQ("LGRPID", "DWORD"), + EQ("LONG", "long"), + EQ("LONG32", "int"), + EQ("LONG64", "long long"), + EQ("LONGLONG", "long long"), + EQ("LONG_PTR", W32_64("long","long long")), + EQ("LPARAM", "LONG_PTR"), + EQ("LPBOOL", "BOOL *"), + EQ("LPBYTE", "BYTE *"), + EQ("LPCOLORREF", "DWORD *"), + EQ("LPCSTR", "const char *"), + EQ("LPCVOID", "const void *"), + EQ("LPCWSTR", "const WCHAR *"), + EQ("LPDWORD", "DWORD *"), + EQ("LPHANDLE", "HANDLE *"), + EQ("LPINT", "int *"), + EQ("LPLONG", "long *"), + EQ("LPSTR", "CHAR *"), + EQ("LPVOID", "void *"), + EQ("LPWORD", "WORD *"), + EQ("LPWSTR", "WCHAR *"), + EQ("LRESULT", "LONG_PTR"), + EQ("PBOOL", "BOOL *"), + EQ("PBOOLEAN", "BOOLEAN *"), + EQ("PBYTE", "BYTE *"), + EQ("PCHAR", "CHAR *"), + EQ("PCSTR", "const CHAR *"), + EQ("PCWSTR", "const WCHAR *"), + EQ("PDWORD", "DWORD *"), + EQ("PDWORD32", "DWORD32 *"), + EQ("PDWORD64", "DWORD64 *"), + EQ("PDWORDLONG", "DWORDLONG *"), + EQ("PDWORD_PTR", "DWORD_PTR *"), + EQ("PFLOAT", "FLOAT *"), + EQ("PHALF_PTR", "HALF_PTR *"), + EQ("PHANDLE", "HANDLE *"), + EQ("PHKEY", "HKEY *"), + EQ("PINT", "int *"), + EQ("PINT16", "INT16 *"), + EQ("PINT32", "INT32 *"), + EQ("PINT64", "INT64 *"), + EQ("PINT8", "INT8 *"), + EQ("PINT_PTR", "INT_PTR *"), + EQ("PLCID", "PDWORD"), + EQ("PLONG", "LONG *"), + EQ("PLONG32", "LONG32 *"), + EQ("PLONG64", "LONG64 *"), + EQ("PLONGLONG", "LONGLONG *"), + EQ("PLONG_PTR", "LONG_PTR *"), + EQ("PSHORT", "SHORT *"), + EQ("PSIZE_T", "SIZE_T *"), + EQ("PSSIZE_T", "SSIZE_T *"), + EQ("PSTR", "CHAR *"), + EQ("PUCHAR", "UCHAR *"), + EQ("PUHALF_PTR", "UHALF_PTR *"), + EQ("PUINT", "UINT *"), + EQ("PUINT16", "UINT16 *"), + EQ("PUINT32", "UINT32 *"), + EQ("PUINT64", "UINT64 *"), + EQ("PUINT8", "UINT8 *"), + EQ("PUINT_PTR", "UINT_PTR *"), + EQ("PULONG", "ULONG *"), + EQ("PULONG32", "ULONG32 *"), + EQ("PULONG64", "ULONG64 *"), + EQ("PULONGLONG", "ULONGLONG *"), + EQ("PULONG_PTR", "ULONG_PTR *"), + EQ("PUSHORT", "USHORT *"), + EQ("PVOID", "void *"), + EQ("PWCHAR", "WCHAR *"), + EQ("PWORD", "WORD *"), + EQ("PWSTR", "WCHAR *"), + EQ("QWORD", "unsigned long long"), + EQ("SC_HANDLE", "HANDLE"), + EQ("SC_LOCK", "LPVOID"), + EQ("SERVICE_STATUS_HANDLE", "HANDLE"), + EQ("SHORT", "short"), + EQ("SIZE_T", "ULONG_PTR"), + EQ("SSIZE_T", "LONG_PTR"), + EQ("UCHAR", "unsigned char"), + EQ("UHALF_PTR", W32_64("unsigned short","unsigned int")), + EQ("UINT", "unsigned int"), + EQ("UINT16", "unsigned short"), + EQ("UINT32", "unsigned int"), + EQ("UINT64", "unsigned long long"), + EQ("UINT8", "unsigned char"), + EQ("UINT_PTR", W32_64("unsigned int","unsigned long long")), + EQ("ULONG", "unsigned long"), + EQ("ULONG32", "unsigned int"), + EQ("ULONG64", "unsigned long long"), + EQ("ULONGLONG", "unsigned long long"), + EQ("ULONG_PTR", W32_64("unsigned long","unsigned long long")), + EQ("USHORT", "unsigned short"), + EQ("USN", "LONGLONG"), + EQ("VOID", "void"), + EQ("WCHAR", "wchar_t"), + EQ("WINSTA", "HANDLE"), + EQ("WORD", "unsigned short"), + EQ("WPARAM", "UINT_PTR"), +#endif + + EQ("bool", "_Bool"), +}; + + +#undef EQ +#undef W32_64 + +#define num_common_simple_types \ + (sizeof(common_simple_types) / sizeof(common_simple_types[0])) + + +static const char *get_common_type(const char *search, size_t search_len) +{ + const char *entry; + int index = search_sorted(common_simple_types, sizeof(const char *), + num_common_simple_types, search, search_len); + if (index < 0) + return NULL; + + entry = common_simple_types[index]; + return entry + strlen(entry) + 1; +} + +RPY_EXTERN +char *pypy_enum_common_types(int index) +{ + if (index < num_common_simple_types) + return (char *)(common_simple_types[index]); + else + return NULL; +} diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -231,6 +231,8 @@ #define MAX_SSIZE_T (((size_t)-1) >> 1) static int parse_complete(token_t *tok); +static const char *get_common_type(const char *search, size_t search_len); +static int parse_common_type_replacement(token_t *tok, const char *replacement); static int parse_sequel(token_t *tok, int outer) { @@ -387,11 +389,18 @@ case TOK_INTEGER: errno = 0; -#ifndef _MSC_VER - if (sizeof(length) > sizeof(unsigned long)) + if (sizeof(length) > sizeof(unsigned long)) { +#ifdef MS_WIN32 +# ifdef _WIN64 + length = _strtoui64(tok->p, &endptr, 0); +# else + abort(); /* unreachable */ +# endif +#else length = strtoull(tok->p, &endptr, 0); +#endif + } else -#endif length = strtoul(tok->p, &endptr, 0); if (endptr != tok->p + tok->size) return parse_error(tok, "invalid number"); @@ -446,26 +455,34 @@ return _CFFI_GETARG(result); } +static int search_sorted(const char *const *base, + size_t item_size, int array_len, + const char *search, size_t search_len) +{ + int left = 0, right = array_len; + const char *baseptr = (const char *)base; -#define MAKE_SEARCH_FUNC(FIELD) \ - RPY_EXTERN int \ - pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx,\ - const char *search, size_t search_len) \ - { \ - int left = 0, right = ctx->num_##FIELD; \ - \ - while (left < right) { \ - int middle = (left + right) / 2; \ - const char *src = ctx->FIELD[middle].name; \ - int diff = strncmp(src, search, search_len); \ - if (diff == 0 && src[search_len] == '\0') \ - return middle; \ - else if (diff >= 0) \ - right = middle; \ - else \ - left = middle + 1; \ - } \ - return -1; \ + while (left < right) { + int middle = (left + right) / 2; + const char *src = *(const char *const *)(baseptr + middle * item_size); + int diff = strncmp(src, search, search_len); + if (diff == 0 && src[search_len] == '\0') + return middle; + else if (diff >= 0) + right = middle; + else + left = middle + 1; + } + return -1; +} + +#define MAKE_SEARCH_FUNC(FIELD) \ + RPY_EXTERN int \ + pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ + const char *search, size_t search_len) \ + { \ + return search_sorted(&ctx->FIELD->name, sizeof(*ctx->FIELD), \ + ctx->num_##FIELD, search, search_len); \ } MAKE_SEARCH_FUNC(globals) @@ -719,6 +736,7 @@ break; case TOK_IDENTIFIER: { + const char *replacement; int n = search_in_typenames(tok->info->ctx, tok->p, tok->size); if (n >= 0) { t1 = _CFFI_OP(_CFFI_OP_TYPENAME, n); @@ -729,6 +747,14 @@ t1 = _CFFI_OP(_CFFI_OP_PRIMITIVE, n); break; } + replacement = get_common_type(tok->p, tok->size); + if (replacement != NULL) { + n = parse_common_type_replacement(tok, replacement); + if (n < 0) + return parse_error(tok, "internal error, please report!"); + t1 = _CFFI_OP(_CFFI_OP_NOOP, n); + break; + } return parse_error(tok, "undefined type name"); } case TOK_STRUCT: @@ -740,10 +766,15 @@ return parse_error(tok, "struct or union name expected"); n = search_in_struct_unions(tok->info->ctx, tok->p, tok->size); - if (n < 0) - return parse_error(tok, "undefined struct/union name"); - if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) != 0) - ^ (kind == TOK_UNION)) + if (n < 0) { + if (kind == TOK_STRUCT && tok->size == 8 && + !memcmp(tok->p, "_IO_FILE", 8)) + n = _CFFI__IO_FILE_STRUCT; + else + return parse_error(tok, "undefined struct/union name"); + } + else if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) + != 0) ^ (kind == TOK_UNION)) return parse_error(tok, "wrong kind of tag: struct vs union"); t1 = _CFFI_OP(_CFFI_OP_STRUCT_UNION, n); @@ -773,8 +804,9 @@ } -RPY_EXTERN -int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input) +static +int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, + const char *input) { int result; token_t token; @@ -785,16 +817,33 @@ token.p = input; token.size = 0; token.output = info->output; - token.output_index = 0; + token.output_index = *output_index; next_token(&token); result = parse_complete(&token); + *output_index = token.output_index; if (token.kind != TOK_END) return parse_error(&token, "unexpected symbol"); return result; } +RPY_EXTERN +int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input) +{ + size_t output_index = 0; + return parse_c_type_from(info, &output_index, input); +} + +static +int parse_common_type_replacement(token_t *tok, const char *replacement) +{ + return parse_c_type_from(tok->info, &tok->output_index, replacement); +} + + +#include "commontypes.c" /* laziness hack: include this file here */ + /************************************************************/ /* extra from cdlopen.c */ diff --git a/pypy/module/_cffi_backend/src/parse_c_type.h b/pypy/module/_cffi_backend/src/parse_c_type.h --- a/pypy/module/_cffi_backend/src/parse_c_type.h +++ b/pypy/module/_cffi_backend/src/parse_c_type.h @@ -5,7 +5,7 @@ #define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8)) #define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode) -#define _CFFI_GETARG(cffi_opcode) (((uintptr_t)cffi_opcode) >> 8) +#define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8) #define _CFFI_OP_PRIMITIVE 1 #define _CFFI_OP_POINTER 3 @@ -25,6 +25,8 @@ #define _CFFI_OP_CONSTANT_INT 31 #define _CFFI_OP_GLOBAL_VAR 33 #define _CFFI_OP_DLOPEN_FUNC 35 +#define _CFFI_OP_DLOPEN_CONST 37 +#define _CFFI_OP_GLOBAL_VAR_F 39 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -77,6 +79,11 @@ #define _CFFI_PRIM_UINTMAX 47 #define _CFFI__NUM_PRIM 48 +#define _CFFI__UNKNOWN_PRIM (-1) +#define _CFFI__UNKNOWN_FLOAT_PRIM (-2) +#define _CFFI__UNKNOWN_LONG_DOUBLE (-3) + +#define _CFFI__IO_FILE_STRUCT (-1) struct _cffi_global_s { @@ -164,4 +171,6 @@ const char *search, size_t search_len); RPY_EXTERN void pypy_set_cdl_realize_global_int(struct _cffi_global_s *target); +RPY_EXTERN +char *pypy_enum_common_types(int index); #endif diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -3509,3 +3509,8 @@ assert repr(BFunc) == "" else: assert repr(BFunc) == "" + +def test_get_common_types(): + d = {} + _get_common_types(d) + assert d['bool'] == '_Bool' diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -424,3 +424,26 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) raises(MemoryError, alloc5, "int[5]") + + def test_bool_issue228(self): + import _cffi_backend as _cffi1_backend + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + + def test_FILE_issue228(self): + import _cffi_backend as _cffi1_backend + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + + def test_cast_from_int_type_to_bool(self): + import _cffi_backend as _cffi1_backend + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -28,6 +28,7 @@ module_name = '_CFFI_' + module_name rdir = udir.ensure('recompiler', dir=1) rdir.join('Python.h').write( + '#include \n' '#define PYPY_VERSION XX\n' '#define PyMODINIT_FUNC /*exported*/ void\n' ) @@ -1076,3 +1077,302 @@ raises(ffi.error, getattr, lib, 'my_value') e = raises(ffi.error, setattr, lib, 'my_value', 50) assert str(e.value) == "global variable 'my_value' is at address NULL" + + def test_const_fields(self): + ffi, lib = self.prepare( + """struct foo_s { const int a; void *const b; };""", + 'test_const_fields', + """struct foo_s { const int a; void *const b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int") + assert foo_s.fields[1][0] == 'b' + assert foo_s.fields[1][1].type is ffi.typeof("void *") + + def test_restrict_fields(self): + ffi, lib = self.prepare( + """struct foo_s { void * restrict b; };""", + 'test_restrict_fields', + """struct foo_s { void * __restrict b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + + def test_volatile_fields(self): + ffi, lib = self.prepare( + """struct foo_s { void * volatile b; };""", + 'test_volatile_fields', + """struct foo_s { void * volatile b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + + def test_const_array_fields(self): + ffi, lib = self.prepare( + """struct foo_s { const int a[4]; };""", + 'test_const_array_fields', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[4]") + + def test_const_array_fields_varlength(self): + ffi, lib = self.prepare( + """struct foo_s { const int a[]; ...; };""", + 'test_const_array_fields_varlength', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[]") + + def test_const_array_fields_unknownlength(self): + ffi, lb = self.prepare( + """struct foo_s { const int a[...]; ...; };""", + 'test_const_array_fields_unknownlength', + """struct foo_s { const int a[4]; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'a' + assert foo_s.fields[0][1].type is ffi.typeof("int[4]") + + def test_const_function_args(self): + ffi, lib = self.prepare( + """int foobar(const int a, const int *b, const int c[]);""", + 'test_const_function_args', """ + int foobar(const int a, const int *b, const int c[]) { + return a + *b + *c; + } + """) + assert lib.foobar(100, ffi.new("int *", 40), ffi.new("int *", 2)) == 142 + + def test_const_function_type_args(self): + ffi, lib = self.prepare( + """int (*foobar)(const int a, const int *b, const int c[]);""", + 'test_const_function_type_args', """ + int (*foobar)(const int a, const int *b, const int c[]); + """) + t = ffi.typeof(lib.foobar) + assert t.args[0] is ffi.typeof("int") + assert t.args[1] is ffi.typeof("int *") + assert t.args[2] is ffi.typeof("int *") + + def test_const_constant(self): + ffi, lib = self.prepare( + """struct foo_s { int x,y; }; const struct foo_s myfoo;""", + 'test_const_constant', """ + struct foo_s { int x,y; }; const struct foo_s myfoo = { 40, 2 }; + """) + assert lib.myfoo.x == 40 + assert lib.myfoo.y == 2 + + def test_const_via_typedef(self): + ffi, lib = self.prepare( + """typedef const int const_t; const_t aaa;""", + 'test_const_via_typedef', """ + typedef const int const_t; + #define aaa 42 + """) + assert lib.aaa == 42 + raises(AttributeError, "lib.aaa = 43") + + def test_win32_calling_convention_0(self): + import sys + ffi, lib = self.prepare( + """ + int call1(int(__cdecl *cb)(int)); + int (*const call2)(int(__stdcall *cb)(int)); + """, + 'test_win32_calling_convention_0', r""" + #ifndef _MSC_VER + # define __stdcall /* nothing */ + #endif + int call1(int(*cb)(int)) { + int i, result = 0; + //printf("call1: cb = %p\n", cb); + for (i = 0; i < 1000; i++) + result += cb(i); + //printf("result = %d\n", result); + return result; + } + int call2(int(__stdcall *cb)(int)) { + int i, result = 0; + //printf("call2: cb = %p\n", cb); + for (i = 0; i < 1000; i++) + result += cb(-i); + //printf("result = %d\n", result); + return result; + } + """) + @ffi.callback("int(int)") + def cb1(x): + return x * 2 + @ffi.callback("int __stdcall(int)") + def cb2(x): + return x * 3 + res = lib.call1(cb1) + assert res == 500*999*2 + assert res == ffi.addressof(lib, 'call1')(cb1) + res = lib.call2(cb2) + assert res == -500*999*3 + assert res == ffi.addressof(lib, 'call2')(cb2) + if sys.platform == 'win32' and not sys.maxsize > 2**32: + assert '__stdcall' in str(ffi.typeof(cb2)) + assert '__stdcall' not in str(ffi.typeof(cb1)) + raises(TypeError, lib.call1, cb2) + raises(TypeError, lib.call2, cb1) + else: + assert '__stdcall' not in str(ffi.typeof(cb2)) + assert ffi.typeof(cb2) is ffi.typeof(cb1) + + def test_win32_calling_convention_1(self): + ffi, lib = self.prepare(""" + int __cdecl call1(int(__cdecl *cb)(int)); + int __stdcall call2(int(__stdcall *cb)(int)); + int (__cdecl *const cb1)(int); + int (__stdcall *const cb2)(int); + """, 'test_win32_calling_convention_1', r""" + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + int __cdecl cb1(int x) { return x * 2; } + int __stdcall cb2(int x) { return x * 3; } + + int __cdecl call1(int(__cdecl *cb)(int)) { + int i, result = 0; + //printf("here1\n"); + //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1); + for (i = 0; i < 1000; i++) + result += cb(i); + //printf("result = %d\n", result); + return result; + } + int __stdcall call2(int(__stdcall *cb)(int)) { + int i, result = 0; + //printf("here1\n"); + //printf("cb = %p, cb2 = %p\n", cb, (void *)cb2); + for (i = 0; i < 1000; i++) + result += cb(-i); + //printf("result = %d\n", result); + return result; + } + """) + #print '<<< cb1 =', ffi.addressof(lib, 'cb1') + ptr_call1 = ffi.addressof(lib, 'call1') + assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + #print '<<< cb2 =', ffi.addressof(lib, 'cb2') + ptr_call2 = ffi.addressof(lib, 'call2') + assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + assert ptr_call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + #print '<<< done' + + def test_win32_calling_convention_2(self): + import sys + # any mistake in the declaration of plain function (including the + # precise argument types and, here, the calling convention) are + # automatically corrected. But this does not apply to the 'cb' + # function pointer argument. + ffi, lib = self.prepare(""" + int __stdcall call1(int(__cdecl *cb)(int)); + int __cdecl call2(int(__stdcall *cb)(int)); + int (__cdecl *const cb1)(int); + int (__stdcall *const cb2)(int); + """, 'test_win32_calling_convention_2', """ + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + int __cdecl call1(int(__cdecl *cb)(int)) { + int i, result = 0; + for (i = 0; i < 1000; i++) + result += cb(i); + return result; + } + int __stdcall call2(int(__stdcall *cb)(int)) { + int i, result = 0; + for (i = 0; i < 1000; i++) + result += cb(-i); + return result; + } + int __cdecl cb1(int x) { return x * 2; } + int __stdcall cb2(int x) { return x * 3; } + """) + ptr_call1 = ffi.addressof(lib, 'call1') + ptr_call2 = ffi.addressof(lib, 'call2') + if sys.platform == 'win32' and not sys.maxsize > 2**32: + raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 + assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + assert ptr_call2(ffi.addressof(lib, 'cb2')) == -500*999*3 + + def test_win32_calling_convention_3(self): + import sys + ffi, lib = self.prepare(""" + struct point { int x, y; }; + + int (*const cb1)(struct point); + int (__stdcall *const cb2)(struct point); + + struct point __stdcall call1(int(*cb)(struct point)); + struct point call2(int(__stdcall *cb)(struct point)); + """, 'test_win32_calling_convention_3', r""" + #ifndef _MSC_VER + # define __cdecl + # define __stdcall + #endif + struct point { int x, y; }; + int cb1(struct point pt) { return pt.x + 10 * pt.y; } + int __stdcall cb2(struct point pt) { return pt.x + 100 * pt.y; } + struct point __stdcall call1(int(__cdecl *cb)(struct point)) { + int i; + struct point result = { 0, 0 }; + //printf("here1\n"); + //printf("cb = %p, cb1 = %p\n", cb, (void *)cb1); + for (i = 0; i < 1000; i++) { + struct point p = { i, -i }; + int r = cb(p); + result.x += r; + result.y -= r; + } + return result; + } + struct point __cdecl call2(int(__stdcall *cb)(struct point)) { + int i; + struct point result = { 0, 0 }; + for (i = 0; i < 1000; i++) { + struct point p = { -i, i }; + int r = cb(p); + result.x += r; + result.y -= r; + } + return result; + } + """) + ptr_call1 = ffi.addressof(lib, 'call1') + ptr_call2 = ffi.addressof(lib, 'call2') + if sys.platform == 'win32' and not sys.maxsize > 2**32: + raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + pt = lib.call1(ffi.addressof(lib, 'cb1')) + assert (pt.x, pt.y) == (-9*500*999, 9*500*999) + pt = ptr_call1(ffi.addressof(lib, 'cb1')) + assert (pt.x, pt.y) == (-9*500*999, 9*500*999) + pt = lib.call2(ffi.addressof(lib, 'cb2')) + assert (pt.x, pt.y) == (99*500*999, -99*500*999) + pt = ptr_call2(ffi.addressof(lib, 'cb2')) + assert (pt.x, pt.y) == (99*500*999, -99*500*999) + + def test_share_FILE(self): + ffi1, lib1 = self.prepare("void do_stuff(FILE *);", + 'test_share_FILE_a', + "void do_stuff(FILE *f) { (void)f; }") + ffi2, lib2 = self.prepare("FILE *barize(void);", + 'test_share_FILE_b', + "FILE *barize(void) { return NULL; }") + lib1.do_stuff(lib2.barize()) diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py --- a/pypy/module/_ssl/interp_ssl.py +++ b/pypy/module/_ssl/interp_ssl.py @@ -1,4 +1,4 @@ -from rpython.rlib import rpoll, rsocket, rthread, rweakref +from rpython.rlib import rpoll, rsocket, rthread, rweakref, rgc from rpython.rlib.rarithmetic import intmask, widen, r_uint from rpython.rlib.ropenssl import * from pypy.module._socket import interp_socket @@ -852,55 +852,58 @@ names = rffi.cast(GENERAL_NAMES, method[0].c_d2i( null, p_ptr, length)) - for j in range(libssl_sk_GENERAL_NAME_num(names)): - # Get a rendering of each name in the set of names + try: + for j in range(libssl_sk_GENERAL_NAME_num(names)): + # Get a rendering of each name in the set of names - name = libssl_sk_GENERAL_NAME_value(names, j) - gntype = intmask(name.c_type) - if gntype == GEN_DIRNAME: - # we special-case DirName as a tuple of tuples of - # attributes - dirname = libssl_pypy_GENERAL_NAME_dirn(name) - w_t = space.newtuple([ - space.wrap("DirName"), - _create_tuple_for_X509_NAME(space, dirname) - ]) - elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI): - # GENERAL_NAME_print() doesn't handle NULL bytes in - # ASN1_string correctly, CVE-2013-4238 - if gntype == GEN_EMAIL: - v = space.wrap("email") - elif gntype == GEN_DNS: - v = space.wrap("DNS") - elif gntype == GEN_URI: - v = space.wrap("URI") + name = libssl_sk_GENERAL_NAME_value(names, j) + gntype = intmask(name.c_type) + if gntype == GEN_DIRNAME: + # we special-case DirName as a tuple of tuples of + # attributes + dirname = libssl_pypy_GENERAL_NAME_dirn(name) + w_t = space.newtuple([ + space.wrap("DirName"), + _create_tuple_for_X509_NAME(space, dirname) + ]) + elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI): + # GENERAL_NAME_print() doesn't handle NULL bytes in + # ASN1_string correctly, CVE-2013-4238 + if gntype == GEN_EMAIL: + v = space.wrap("email") + elif gntype == GEN_DNS: + v = space.wrap("DNS") + elif gntype == GEN_URI: + v = space.wrap("URI") + else: + assert False + as_ = libssl_pypy_GENERAL_NAME_dirn(name) + as_ = rffi.cast(ASN1_STRING, as_) + buf = libssl_ASN1_STRING_data(as_) + length = libssl_ASN1_STRING_length(as_) + w_t = space.newtuple([ + v, space.wrap(rffi.charpsize2str(buf, length))]) else: - assert False - as_ = libssl_pypy_GENERAL_NAME_dirn(name) - as_ = rffi.cast(ASN1_STRING, as_) - buf = libssl_ASN1_STRING_data(as_) - length = libssl_ASN1_STRING_length(as_) - w_t = space.newtuple([ - v, space.wrap(rffi.charpsize2str(buf, length))]) - else: - # for everything else, we use the OpenSSL print form - if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY, - GEN_IPADD, GEN_RID): - space.warn(space.wrap("Unknown general name type"), - space.w_RuntimeWarning) - libssl_BIO_reset(biobuf) - libssl_GENERAL_NAME_print(biobuf, name) - with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf: - length = libssl_BIO_gets(biobuf, buf, 2047) - if length < 0: - raise _ssl_seterror(space, None, 0) + # for everything else, we use the OpenSSL print form + if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY, + GEN_IPADD, GEN_RID): + space.warn(space.wrap("Unknown general name type"), + space.w_RuntimeWarning) + libssl_BIO_reset(biobuf) + libssl_GENERAL_NAME_print(biobuf, name) + with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf: + length = libssl_BIO_gets(biobuf, buf, 2047) + if length < 0: + raise _ssl_seterror(space, None, 0) - v = rffi.charpsize2str(buf, length) - v1, v2 = v.split(':', 1) - w_t = space.newtuple([space.wrap(v1), - space.wrap(v2)]) + v = rffi.charpsize2str(buf, length) + v1, v2 = v.split(':', 1) + w_t = space.newtuple([space.wrap(v1), + space.wrap(v2)]) - alt_names_w.append(w_t) + alt_names_w.append(w_t) + finally: + libssl_pypy_GENERAL_NAME_pop_free(names) finally: libssl_BIO_free(biobuf) @@ -921,8 +924,11 @@ length = libssl_ASN1_STRING_to_UTF8(buf_ptr, value) if length < 0: raise _ssl_seterror(space, None, 0) - w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length)) - w_value = space.call_method(w_value, "decode", space.wrap("utf-8")) + try: + w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length)) + w_value = space.call_method(w_value, "decode", space.wrap("utf-8")) + finally: + libssl_OPENSSL_free(buf_ptr[0]) return space.newtuple([w_name, w_value]) @@ -930,9 +936,10 @@ def _get_aia_uri(space, certificate, nid): info = rffi.cast(AUTHORITY_INFO_ACCESS, libssl_X509_get_ext_d2i( certificate, NID_info_access, None, None)) - if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0: - return try: + if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0: + return + result_w = [] for i in range(libssl_sk_ACCESS_DESCRIPTION_num(info)): ad = libssl_sk_ACCESS_DESCRIPTION_value(info, i) @@ -962,20 +969,24 @@ if not dps: return None - cdp_w = [] - for i in range(libssl_sk_DIST_POINT_num(dps)): - dp = libssl_sk_DIST_POINT_value(dps, i) - gns = libssl_pypy_DIST_POINT_fullname(dp) + try: + cdp_w = [] + for i in range(libssl_sk_DIST_POINT_num(dps)): + dp = libssl_sk_DIST_POINT_value(dps, i) + gns = libssl_pypy_DIST_POINT_fullname(dp) - for j in range(libssl_sk_GENERAL_NAME_num(gns)): - name = libssl_sk_GENERAL_NAME_value(gns, j) - gntype = intmask(name.c_type) - if gntype != GEN_URI: - continue - uri = libssl_pypy_GENERAL_NAME_uri(name) - length = intmask(uri.c_length) - s_uri = rffi.charpsize2str(uri.c_data, length) - cdp_w.append(space.wrap(s_uri)) + for j in range(libssl_sk_GENERAL_NAME_num(gns)): + name = libssl_sk_GENERAL_NAME_value(gns, j) + gntype = intmask(name.c_type) + if gntype != GEN_URI: + continue + uri = libssl_pypy_GENERAL_NAME_uri(name) + length = intmask(uri.c_length) + s_uri = rffi.charpsize2str(uri.c_data, length) + cdp_w.append(space.wrap(s_uri)) + finally: + if OPENSSL_VERSION_NUMBER < 0x10001000: + libssl_sk_DIST_POINT_free(dps) return space.newtuple(cdp_w[:]) def checkwait(space, w_sock, writing): @@ -1270,6 +1281,7 @@ if not ctx: raise ssl_error(space, "failed to allocate SSL context") + rgc.add_memory_pressure(10 * 1024 * 1024) self = space.allocate_instance(_SSLContext, w_subtype) self.ctx = ctx self.check_hostname = False @@ -1296,6 +1308,9 @@ return self + def __del__(self): + libssl_SSL_CTX_free(self.ctx) + @unwrap_spec(server_side=int) def descr_wrap_socket(self, space, w_sock, server_side, w_server_hostname=None, w_ssl_sock=None): return _SSLSocket.descr_new(space, self, w_sock, server_side, w_server_hostname, w_ssl_sock) diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -534,10 +534,10 @@ while not inner_iter.done(inner_state): arg_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = inner_iter.getitem(inner_state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val inner_state = inner_iter.next(inner_state) idx += 1 result = get_dtype_cache(space).w_longdtype.box(result) @@ -557,17 +557,17 @@ while not iter.done(state): arg_flat_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = iter.getitem(state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val state = iter.next(state) idx += 1 return result return argmin_argmax, argmin_argmax_flat -argmin, argmin_flat = _new_argmin_argmax('min') -argmax, argmax_flat = _new_argmin_argmax('max') +argmin, argmin_flat = _new_argmin_argmax('argmin') +argmax, argmax_flat = _new_argmin_argmax('argmax') dot_driver = jit.JitDriver(name = 'numpy_dot', greens = ['dtype'], diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1852,6 +1852,24 @@ a = array([(1, 2)], dtype=[('a', 'int64'), ('b', 'int64')]) assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02' + def test_half_conversions(self): + from numpy import array, arange + from math import isnan, isinf + e = array([0, -1, -float('inf'), float('nan'), 6], dtype='float16') + assert map(isnan, e) == [False, False, False, True, False] + assert map(isinf, e) == [False, False, True, False, False] + assert e.argmax() == 3 + # numpy preserves value for uint16 -> cast_as_float16 -> + # convert_to_float64 -> convert_to_float16 -> uint16 + # even for float16 various float16 nans + all_f16 = arange(0xfe00, 0xffff, dtype='uint16') + all_f16.dtype = 'float16' + all_f32 = array(all_f16, dtype='float32') + b = array(all_f32, dtype='float16') + c = b.view(dtype='uint16') + d = all_f16.view(dtype='uint16') + assert (c == d).all() + def test_ndarray_view_empty(self): from numpy import array, dtype x = array([], dtype=[('a', 'int8'), ('b', 'int8')]) diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py --- a/pypy/module/micronumpy/test/test_object_arrays.py +++ b/pypy/module/micronumpy/test/test_object_arrays.py @@ -178,6 +178,7 @@ assert 'a' * 100 in str(a) b = a.astype('U') assert b.dtype == 'U100' + assert 'a' * 100 in str(b) a = np.array([123], dtype='U') assert a[0] == u'123' diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -345,6 +345,14 @@ def min(self, v1, v2): return min(v1, v2) + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 + @raw_unary_op def rint(self, v): float64 = Float64(self.space) @@ -820,6 +828,14 @@ def min(self, v1, v2): return v1 if v1 <= v2 or rfloat.isnan(v1) else v2 + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 or rfloat.isnan(v1) + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 or rfloat.isnan(v1) + @simple_binary_op def fmax(self, v1, v2): return v1 if v1 >= v2 or rfloat.isnan(v2) else v2 @@ -1407,6 +1423,16 @@ return v1 return v2 + def argmin(self, v1, v2): + if self.le(v1, v2) or self.isnan(v1): + return True + return False + + def argmax(self, v1, v2): + if self.ge(v1, v2) or self.isnan(v1): + return True + return False + @complex_binary_op def floordiv(self, v1, v2): (r1, i1), (r2, i2) = v1, v2 @@ -1927,6 +1953,18 @@ return v1 return v2 + @raw_binary_op + def argmax(self, v1, v2): + if self.space.is_true(self.space.ge(v1, v2)): + return True + return False + + @raw_binary_op + def argmin(self, v1, v2): + if self.space.is_true(self.space.le(v1, v2)): + return True + return False + @raw_unary_op def bool(self,v): return self._obool(v) @@ -2221,7 +2259,10 @@ def coerce(self, space, dtype, w_item): if isinstance(w_item, boxes.W_UnicodeBox): return w_item - value = space.unicode_w(space.unicode_from_object(w_item)) + if isinstance(w_item, boxes.W_ObjectBox): + value = space.unicode_w(space.unicode_from_object(w_item.w_obj)) + else: + value = space.unicode_w(space.unicode_from_object(w_item)) return boxes.W_UnicodeBox(value) def store(self, arr, i, offset, box, native): diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -248,3 +248,23 @@ From noreply at buildbot.pypy.org Sun Nov 8 14:50:53 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 20:50:53 +0100 (CET) Subject: [pypy-commit] pypy array_interface: start support for strides argument (use-case needed to implement more) Message-ID: <20151108195053.2DCBE1C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: array_interface Changeset: r80596:fed39e09394c Date: 2015-11-08 21:37 +0200 http://bitbucket.org/pypy/pypy/changeset/fed39e09394c/ Log: start support for strides argument (use-case needed to implement more) diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -71,9 +71,10 @@ if w_descr is not None: raise oefmt(space.w_NotImplementedError, "__array_interface__ descr not supported yet") - if w_strides is not None: - raise oefmt(space.w_NotImplementedError, - "__array_interface__ strides not supported yet") + if w_strides is None or space.is_w(w_strides, space.w_None): + strides = None + else: + strides = [space.int_w(i) for i in space.listview(w_strides)] shape = [space.int_w(i) for i in space.listview(w_shape)] dtype = descriptor.decode_w_dtype(space, w_dtype) if dtype is None: @@ -85,7 +86,8 @@ data = rffi.cast(RAW_STORAGE_PTR, space.int_w(data_w[0])) read_only = True # XXX why not space.is_true(data_w[1]) offset = 0 - return W_NDimArray.from_shape_and_storage(space, shape, data, dtype, start=offset), read_only + return W_NDimArray.from_shape_and_storage(space, shape, data, + dtype, strides=strides, start=offset), read_only if w_data is None: data = w_object else: @@ -96,6 +98,9 @@ else: offset = space.int_w(w_offset) #print 'create view from shape',shape,'dtype',dtype,'data',data + if strides is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ strides not fully supported yet") arr = frombuffer(space, data, dtype, support.product(shape), offset) new_impl = arr.implementation.reshape(arr, shape) return W_NDimArray(new_impl), False diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -3070,7 +3070,7 @@ assert (b == zeros(10)).all() def test_array_interface(self): - from numpy import array + from numpy import array, ones a = array(2.5) i = a.__array_interface__ assert isinstance(i['data'][0], int) @@ -3105,9 +3105,7 @@ raises(TypeError, array, Dummy({'version': 3, 'typestr': 'f8', 'shape': ('a', 3)})) a = array([1, 2, 3]) - interface_a = a.__array_interface__ - interface_a.pop('strides') - b = array(Dummy(interface_a)) + b = array(Dummy(a.__array_interface__)) b[1] = 200 assert a[1] == 2 # upstream compatibility, is this a bug? interface_a = a.__array_interface__ @@ -3124,6 +3122,12 @@ assert b.dtype == 'uint8' assert b.shape == (50,) + a = ones((1,), dtype='float16') + b = Dummy(a.__array_interface__) + c = array(b) + assert c.dtype == 'float16' + assert (a == c).all() + def test_array_indexing_one_elem(self): from numpy import array, arange raises(IndexError, 'arange(3)[array([3.5])]') From noreply at buildbot.pypy.org Sun Nov 8 14:50:55 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 20:50:55 +0100 (CET) Subject: [pypy-commit] pypy array_interface: document branch Message-ID: <20151108195055.388D71C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: array_interface Changeset: r80597:b827317e595b Date: 2015-11-08 21:39 +0200 http://bitbucket.org/pypy/pypy/changeset/b827317e595b/ Log: document branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -25,3 +25,7 @@ preserves all int16 values, even across nan conversions. Also fix argmax, argmin for nan comparisons +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + From noreply at buildbot.pypy.org Sun Nov 8 14:50:57 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 20:50:57 +0100 (CET) Subject: [pypy-commit] pypy array_interface: close branch to be merged Message-ID: <20151108195057.439651C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: array_interface Changeset: r80598:90a7e35242e1 Date: 2015-11-08 21:39 +0200 http://bitbucket.org/pypy/pypy/changeset/90a7e35242e1/ Log: close branch to be merged From noreply at buildbot.pypy.org Sun Nov 8 14:50:59 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 8 Nov 2015 20:50:59 +0100 (CET) Subject: [pypy-commit] pypy default: merge array_interface which implements common usages of __array_interface__ Message-ID: <20151108195059.695411C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80599:8633f40661db Date: 2015-11-08 21:40 +0200 http://bitbucket.org/pypy/pypy/changeset/8633f40661db/ Log: merge array_interface which implements common usages of __array_interface__ diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -25,3 +25,7 @@ preserves all int16 values, even across nan conversions. Also fix argmax, argmin for nan comparisons +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -371,6 +371,8 @@ @specialize.arg(2) def call_method(self, w_obj, s, *args): # XXX even the hacks have hacks + if s == 'size': # used in _array() but never called by tests + return IntObject(0) return getattr(w_obj, 'descr_' + s)(self, *args) @specialize.arg(1) diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -2,6 +2,7 @@ from pypy.interpreter.gateway import unwrap_spec, WrappedDefault from rpython.rlib.buffer import SubBuffer from rpython.rlib.rstring import strip_spaces +from rpython.rlib.rawstorage import RAW_STORAGE_PTR from rpython.rtyper.lltypesystem import lltype, rffi from pypy.module.micronumpy import descriptor, loop, support @@ -45,7 +46,7 @@ try: w_interface = space.getattr(w_object, space.wrap("__array_interface__")) if w_interface is None: - return None + return None, False version_w = space.finditem(w_interface, space.wrap("version")) if version_w is None: raise oefmt(space.w_ValueError, "__array_interface__ found without" @@ -67,19 +68,46 @@ raise oefmt(space.w_ValueError, "__array_interface__ missing one or more required keys: shape, typestr" ) - raise oefmt(space.w_NotImplementedError, - "creating array from __array_interface__ not supported yet") - ''' - data_w = space.listview() + if w_descr is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ descr not supported yet") + if w_strides is None or space.is_w(w_strides, space.w_None): + strides = None + else: + strides = [space.int_w(i) for i in space.listview(w_strides)] shape = [space.int_w(i) for i in space.listview(w_shape)] dtype = descriptor.decode_w_dtype(space, w_dtype) - rw = space.is_true(data_w[1]) - ''' - #print 'create view from shape',shape,'dtype',dtype,'descr',w_descr,'data',data_w[0],'rw',rw - return None + if dtype is None: + raise oefmt(space.w_ValueError, + "__array_interface__ could not decode dtype %R", w_dtype + ) + if w_data is not None and (space.isinstance_w(w_data, space.w_tuple) or space.isinstance_w(w_data, space.w_list)): + data_w = space.listview(w_data) + data = rffi.cast(RAW_STORAGE_PTR, space.int_w(data_w[0])) + read_only = True # XXX why not space.is_true(data_w[1]) + offset = 0 + return W_NDimArray.from_shape_and_storage(space, shape, data, + dtype, strides=strides, start=offset), read_only + if w_data is None: + data = w_object + else: + data = w_data + w_offset = space.finditem(w_interface, space.wrap('offset')) + if w_offset is None: + offset = 0 + else: + offset = space.int_w(w_offset) + #print 'create view from shape',shape,'dtype',dtype,'data',data + if strides is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ strides not fully supported yet") + arr = frombuffer(space, data, dtype, support.product(shape), offset) + new_impl = arr.implementation.reshape(arr, shape) + return W_NDimArray(new_impl), False + except OperationError as e: if e.match(space, space.w_AttributeError): - return None + return None, False raise @@ -103,19 +131,20 @@ if space.isinstance_w(w_object, space.w_type): raise oefmt(space.w_ValueError, "cannot create ndarray from type instance") # for anything that isn't already an array, try __array__ method first + dtype = descriptor.decode_w_dtype(space, w_dtype) if not isinstance(w_object, W_NDimArray): w_array = try_array_method(space, w_object, w_dtype) if w_array is not None: # continue with w_array, but do further operations in place w_object = w_array copy = False + dtype = w_object.get_dtype() if not isinstance(w_object, W_NDimArray): - w_array = try_interface_method(space, w_object) + w_array, _copy = try_interface_method(space, w_object) if w_array is not None: w_object = w_array - copy = False - dtype = descriptor.decode_w_dtype(space, w_dtype) - + copy = _copy + dtype = w_object.get_dtype() if isinstance(w_object, W_NDimArray): npy_order = order_converter(space, w_order, NPY.ANYORDER) diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -3070,7 +3070,7 @@ assert (b == zeros(10)).all() def test_array_interface(self): - from numpy import array + from numpy import array, ones a = array(2.5) i = a.__array_interface__ assert isinstance(i['data'][0], int) @@ -3093,7 +3093,7 @@ class Dummy(object): def __init__(self, aif=None): - if aif: + if aif is not None: self.__array_interface__ = aif a = array(Dummy()) @@ -3102,6 +3102,31 @@ raises(ValueError, array, Dummy({'version': 0})) raises(ValueError, array, Dummy({'version': 'abc'})) raises(ValueError, array, Dummy({'version': 3})) + raises(TypeError, array, Dummy({'version': 3, 'typestr': 'f8', 'shape': ('a', 3)})) + + a = array([1, 2, 3]) + b = array(Dummy(a.__array_interface__)) + b[1] = 200 + assert a[1] == 2 # upstream compatibility, is this a bug? + interface_a = a.__array_interface__ + interface_b = b.__array_interface__ + # only the data[0] value should differ + assert interface_a['data'][0] != interface_b['data'][0] + assert interface_b['data'][1] == interface_a['data'][1] + interface_b.pop('data') + interface_a.pop('data') + assert interface_a == interface_b + + b = array(Dummy({'version':3, 'shape': (50,), 'typestr': 'u1', + 'data': 'a'*100})) + assert b.dtype == 'uint8' + assert b.shape == (50,) + + a = ones((1,), dtype='float16') + b = Dummy(a.__array_interface__) + c = array(b) + assert c.dtype == 'float16' + assert (a == c).all() def test_array_indexing_one_elem(self): from numpy import array, arange From noreply at buildbot.pypy.org Sun Nov 8 18:23:02 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 9 Nov 2015 00:23:02 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: update numpypy to be compatible with upstream numpy 1.10 Message-ID: <20151108232302.1C5BA1C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80600:327f054b2c5d Date: 2015-11-08 23:58 +0200 http://bitbucket.org/pypy/pypy/changeset/327f054b2c5d/ Log: update numpypy to be compatible with upstream numpy 1.10 From noreply at buildbot.pypy.org Sun Nov 8 18:23:04 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 9 Nov 2015 00:23:04 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: fix tests for -A with numpy 1.10 Message-ID: <20151108232304.5067F1C13F7@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80601:e1c02aa1e188 Date: 2015-11-09 01:02 +0200 http://bitbucket.org/pypy/pypy/changeset/e1c02aa1e188/ Log: fix tests for -A with numpy 1.10 diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -349,9 +349,8 @@ pass assert np.dtype(xyz).name == 'xyz' # another obscure API, used in numpy record.py - # it seems numpy throws away the subclass type and parses the spec a = np.dtype((xyz, [('x', 'int32'), ('y', 'float32')])) - assert repr(a) == "dtype([('x', ' Author: mattip Branch: numpy-1.10 Changeset: r80602:899918ecdeea Date: 2015-11-09 01:23 +0200 http://bitbucket.org/pypy/pypy/changeset/899918ecdeea/ Log: fix more tests, will ignore test_complex corner case failures for now diff --git a/pypy/module/micronumpy/test/test_scalar.py b/pypy/module/micronumpy/test/test_scalar.py --- a/pypy/module/micronumpy/test/test_scalar.py +++ b/pypy/module/micronumpy/test/test_scalar.py @@ -142,7 +142,7 @@ assert f.round() == 13. assert f.round(decimals=-1) == 10. assert f.round(decimals=1) == 13.4 - assert b.round(decimals=5) is b + raises(TypeError, b.round, decimals=5) assert f.round(decimals=1, out=None) == 13.4 assert b.round() == 1.0 @@ -404,8 +404,8 @@ def _do_test(np_type, orig_val, exp_val): val = np_type(orig_val) assert val == orig_val - assert val.swapaxes(10, 20) == exp_val - assert type(val.swapaxes(0, 1)) is np_type + raises(ValueError, val.swapaxes, 10, 20) + raises(ValueError, val.swapaxes, 0, 1) raises(TypeError, val.swapaxes, 0, ()) for t in int8, int16, int32, int64: diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py --- a/pypy/module/micronumpy/test/test_ufuncs.py +++ b/pypy/module/micronumpy/test/test_ufuncs.py @@ -123,7 +123,7 @@ res = int_func12(a) assert len(res) == 2 assert isinstance(res, tuple) - assert (res[0] == a).all() + assert all([r is None for r in res[0]]) # ??? no warning or error, just a fail? res = sumdiff(2 * a, a) assert (res[0] == 3 * a).all() assert (res[1] == a).all() From noreply at buildbot.pypy.org Mon Nov 9 02:35:46 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 9 Nov 2015 08:35:46 +0100 (CET) Subject: [pypy-commit] pypy default: fix more off-by-one shifts, and float_unpack80 Message-ID: <20151109073546.4D8C61C135C@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80603:68fb53f1589c Date: 2015-11-09 09:19 +0200 http://bitbucket.org/pypy/pypy/changeset/68fb53f1589c/ Log: fix more off-by-one shifts, and float_unpack80 diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -67,9 +67,13 @@ # preserve at most 52 bits of mant value, but pad w/zeros exp = r_ulonglong(0x7ff) << 52 sign = r_ulonglong(sign) << 63 - mant = r_ulonglong(mant) << (52 - MANT_DIG) - uint = exp | mant | sign - result = longlong2float(cast(LONGLONG, uint)) + if MANT_DIG < 53: + mant = r_ulonglong(mant) << (53 - MANT_DIG) + if mant == 0: + result = rfloat.NAN + else: + uint = exp | mant | sign + result = longlong2float(cast(LONGLONG, uint)) return result elif exp == 0: # subnormal or zero @@ -114,8 +118,12 @@ result = rfloat.INFINITY else: exp = r_ulonglong(0x7ff) << 52 - uint = exp | r_ulonglong(mant) | r_ulonglong(sign) - result = longlong2float(cast(LONGLONG, uint)) + mant = r_ulonglong(mant) >> size + 1 + if mant == 0: + result = rfloat.NAN + else: + uint = exp | r_ulonglong(mant) | r_ulonglong(sign) + result = longlong2float(cast(LONGLONG, uint)) return result else: # normal @@ -149,13 +157,13 @@ exp = MAX_EXP - MIN_EXP + 2 elif rfloat.isnan(x): asint = cast(ULONGLONG, float2longlong(x)) - mant = asint & ((r_ulonglong(1) << 51) - 1) sign = asint >> 63 # shift off lower bits, perhaps losing data - if MANT_DIG <= 52: - mant = mant >> (52 - MANT_DIG) + mant = asint & ((r_ulonglong(1) << 52) - 1) + if MANT_DIG < 53: + mant = mant >> (53 - MANT_DIG) if mant == 0: - mant = r_ulonglong(1) << (MANT_DIG - 2) - 1 + mant = r_ulonglong(1) << (MANT_DIG - 1) - 1 exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) @@ -216,7 +224,7 @@ asint = cast(ULONGLONG, float2longlong(x)) mant = asint & ((r_ulonglong(1) << 51) - 1) if mant == 0: - mant = r_ulonglong(1) << (MANT_DIG-2) - 1 + mant = r_ulonglong(1) << (MANT_DIG - 1) - 1 sign = asint < 0 exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: From noreply at buildbot.pypy.org Mon Nov 9 02:52:38 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 08:52:38 +0100 (CET) Subject: [pypy-commit] pypy default: fix test Message-ID: <20151109075238.21F981C023F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80604:2e371c1bb8f8 Date: 2015-11-09 08:46 +0100 http://bitbucket.org/pypy/pypy/changeset/2e371c1bb8f8/ Log: fix test diff --git a/rpython/jit/backend/llsupport/descr.py b/rpython/jit/backend/llsupport/descr.py --- a/rpython/jit/backend/llsupport/descr.py +++ b/rpython/jit/backend/llsupport/descr.py @@ -41,11 +41,11 @@ def __init__(self, size, gc_fielddescrs=None, all_fielddescrs=None, vtable=lltype.nullptr(rclass.OBJECT_VTABLE), immutable_flag=False): + assert lltype.typeOf(vtable) == lltype.Ptr(rclass.OBJECT_VTABLE) self.size = size self.gc_fielddescrs = gc_fielddescrs self.all_fielddescrs = all_fielddescrs self.vtable = vtable - assert vtable is not None self.immutable_flag = immutable_flag def get_all_fielddescrs(self): diff --git a/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py b/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py --- a/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py +++ b/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py @@ -34,8 +34,8 @@ rclass = getclassrepr(rtyper, classdef) rinstance = getinstancerepr(rtyper, classdef) LLB = rinstance.lowleveltype.TO - vtable_B = rclass.getvtable() - adr_vtable_B = llmemory.cast_ptr_to_adr(vtable_B) + ptr_vtable_B = rclass.getvtable() + adr_vtable_B = llmemory.cast_ptr_to_adr(ptr_vtable_B) vtable_B = llmemory.cast_adr_to_int(adr_vtable_B, mode="symbolic") CPU = getcpuclass() @@ -46,7 +46,7 @@ finaldescr = BasicFinalDescr() faildescr = BasicFailDescr() - descr_B = cpu.sizeof(LLB, vtable_B) + descr_B = cpu.sizeof(LLB, ptr_vtable_B) typeid_B = descr_B.get_type_id() loop1 = parse(""" From noreply at buildbot.pypy.org Mon Nov 9 02:52:40 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 08:52:40 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151109075240.D6B421C023F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80605:04570c9524ed Date: 2015-11-09 08:53 +0100 http://bitbucket.org/pypy/pypy/changeset/04570c9524ed/ Log: merge heads diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -18,3 +18,14 @@ .. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -371,6 +371,8 @@ @specialize.arg(2) def call_method(self, w_obj, s, *args): # XXX even the hacks have hacks + if s == 'size': # used in _array() but never called by tests + return IntObject(0) return getattr(w_obj, 'descr_' + s)(self, *args) @specialize.arg(1) diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -2,6 +2,7 @@ from pypy.interpreter.gateway import unwrap_spec, WrappedDefault from rpython.rlib.buffer import SubBuffer from rpython.rlib.rstring import strip_spaces +from rpython.rlib.rawstorage import RAW_STORAGE_PTR from rpython.rtyper.lltypesystem import lltype, rffi from pypy.module.micronumpy import descriptor, loop, support @@ -45,7 +46,7 @@ try: w_interface = space.getattr(w_object, space.wrap("__array_interface__")) if w_interface is None: - return None + return None, False version_w = space.finditem(w_interface, space.wrap("version")) if version_w is None: raise oefmt(space.w_ValueError, "__array_interface__ found without" @@ -67,19 +68,46 @@ raise oefmt(space.w_ValueError, "__array_interface__ missing one or more required keys: shape, typestr" ) - raise oefmt(space.w_NotImplementedError, - "creating array from __array_interface__ not supported yet") - ''' - data_w = space.listview() + if w_descr is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ descr not supported yet") + if w_strides is None or space.is_w(w_strides, space.w_None): + strides = None + else: + strides = [space.int_w(i) for i in space.listview(w_strides)] shape = [space.int_w(i) for i in space.listview(w_shape)] dtype = descriptor.decode_w_dtype(space, w_dtype) - rw = space.is_true(data_w[1]) - ''' - #print 'create view from shape',shape,'dtype',dtype,'descr',w_descr,'data',data_w[0],'rw',rw - return None + if dtype is None: + raise oefmt(space.w_ValueError, + "__array_interface__ could not decode dtype %R", w_dtype + ) + if w_data is not None and (space.isinstance_w(w_data, space.w_tuple) or space.isinstance_w(w_data, space.w_list)): + data_w = space.listview(w_data) + data = rffi.cast(RAW_STORAGE_PTR, space.int_w(data_w[0])) + read_only = True # XXX why not space.is_true(data_w[1]) + offset = 0 + return W_NDimArray.from_shape_and_storage(space, shape, data, + dtype, strides=strides, start=offset), read_only + if w_data is None: + data = w_object + else: + data = w_data + w_offset = space.finditem(w_interface, space.wrap('offset')) + if w_offset is None: + offset = 0 + else: + offset = space.int_w(w_offset) + #print 'create view from shape',shape,'dtype',dtype,'data',data + if strides is not None: + raise oefmt(space.w_NotImplementedError, + "__array_interface__ strides not fully supported yet") + arr = frombuffer(space, data, dtype, support.product(shape), offset) + new_impl = arr.implementation.reshape(arr, shape) + return W_NDimArray(new_impl), False + except OperationError as e: if e.match(space, space.w_AttributeError): - return None + return None, False raise @@ -103,19 +131,20 @@ if space.isinstance_w(w_object, space.w_type): raise oefmt(space.w_ValueError, "cannot create ndarray from type instance") # for anything that isn't already an array, try __array__ method first + dtype = descriptor.decode_w_dtype(space, w_dtype) if not isinstance(w_object, W_NDimArray): w_array = try_array_method(space, w_object, w_dtype) if w_array is not None: # continue with w_array, but do further operations in place w_object = w_array copy = False + dtype = w_object.get_dtype() if not isinstance(w_object, W_NDimArray): - w_array = try_interface_method(space, w_object) + w_array, _copy = try_interface_method(space, w_object) if w_array is not None: w_object = w_array - copy = False - dtype = descriptor.decode_w_dtype(space, w_dtype) - + copy = _copy + dtype = w_object.get_dtype() if isinstance(w_object, W_NDimArray): npy_order = order_converter(space, w_order, NPY.ANYORDER) diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -534,10 +534,10 @@ while not inner_iter.done(inner_state): arg_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = inner_iter.getitem(inner_state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val inner_state = inner_iter.next(inner_state) idx += 1 result = get_dtype_cache(space).w_longdtype.box(result) @@ -557,17 +557,17 @@ while not iter.done(state): arg_flat_driver.jit_merge_point(shapelen=shapelen, dtype=dtype) w_val = iter.getitem(state) - new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) - if dtype.itemtype.ne(new_best, cur_best): + old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val) + if not old_best: result = idx - cur_best = new_best + cur_best = w_val state = iter.next(state) idx += 1 return result return argmin_argmax, argmin_argmax_flat -argmin, argmin_flat = _new_argmin_argmax('min') -argmax, argmax_flat = _new_argmin_argmax('max') +argmin, argmin_flat = _new_argmin_argmax('argmin') +argmax, argmax_flat = _new_argmin_argmax('argmax') dot_driver = jit.JitDriver(name = 'numpy_dot', greens = ['dtype'], diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1852,6 +1852,24 @@ a = array([(1, 2)], dtype=[('a', 'int64'), ('b', 'int64')]) assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02' + def test_half_conversions(self): + from numpy import array, arange + from math import isnan, isinf + e = array([0, -1, -float('inf'), float('nan'), 6], dtype='float16') + assert map(isnan, e) == [False, False, False, True, False] + assert map(isinf, e) == [False, False, True, False, False] + assert e.argmax() == 3 + # numpy preserves value for uint16 -> cast_as_float16 -> + # convert_to_float64 -> convert_to_float16 -> uint16 + # even for float16 various float16 nans + all_f16 = arange(0xfe00, 0xffff, dtype='uint16') + all_f16.dtype = 'float16' + all_f32 = array(all_f16, dtype='float32') + b = array(all_f32, dtype='float16') + c = b.view(dtype='uint16') + d = all_f16.view(dtype='uint16') + assert (c == d).all() + def test_ndarray_view_empty(self): from numpy import array, dtype x = array([], dtype=[('a', 'int8'), ('b', 'int8')]) @@ -3052,7 +3070,7 @@ assert (b == zeros(10)).all() def test_array_interface(self): - from numpy import array + from numpy import array, ones a = array(2.5) i = a.__array_interface__ assert isinstance(i['data'][0], int) @@ -3075,7 +3093,7 @@ class Dummy(object): def __init__(self, aif=None): - if aif: + if aif is not None: self.__array_interface__ = aif a = array(Dummy()) @@ -3084,6 +3102,31 @@ raises(ValueError, array, Dummy({'version': 0})) raises(ValueError, array, Dummy({'version': 'abc'})) raises(ValueError, array, Dummy({'version': 3})) + raises(TypeError, array, Dummy({'version': 3, 'typestr': 'f8', 'shape': ('a', 3)})) + + a = array([1, 2, 3]) + b = array(Dummy(a.__array_interface__)) + b[1] = 200 + assert a[1] == 2 # upstream compatibility, is this a bug? + interface_a = a.__array_interface__ + interface_b = b.__array_interface__ + # only the data[0] value should differ + assert interface_a['data'][0] != interface_b['data'][0] + assert interface_b['data'][1] == interface_a['data'][1] + interface_b.pop('data') + interface_a.pop('data') + assert interface_a == interface_b + + b = array(Dummy({'version':3, 'shape': (50,), 'typestr': 'u1', + 'data': 'a'*100})) + assert b.dtype == 'uint8' + assert b.shape == (50,) + + a = ones((1,), dtype='float16') + b = Dummy(a.__array_interface__) + c = array(b) + assert c.dtype == 'float16' + assert (a == c).all() def test_array_indexing_one_elem(self): from numpy import array, arange diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -345,6 +345,14 @@ def min(self, v1, v2): return min(v1, v2) + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 + @raw_unary_op def rint(self, v): float64 = Float64(self.space) @@ -820,6 +828,14 @@ def min(self, v1, v2): return v1 if v1 <= v2 or rfloat.isnan(v1) else v2 + @raw_binary_op + def argmax(self, v1, v2): + return v1 >= v2 or rfloat.isnan(v1) + + @raw_binary_op + def argmin(self, v1, v2): + return v1 <= v2 or rfloat.isnan(v1) + @simple_binary_op def fmax(self, v1, v2): return v1 if v1 >= v2 or rfloat.isnan(v2) else v2 @@ -1407,6 +1423,16 @@ return v1 return v2 + def argmin(self, v1, v2): + if self.le(v1, v2) or self.isnan(v1): + return True + return False + + def argmax(self, v1, v2): + if self.ge(v1, v2) or self.isnan(v1): + return True + return False + @complex_binary_op def floordiv(self, v1, v2): (r1, i1), (r2, i2) = v1, v2 @@ -1927,6 +1953,18 @@ return v1 return v2 + @raw_binary_op + def argmax(self, v1, v2): + if self.space.is_true(self.space.ge(v1, v2)): + return True + return False + + @raw_binary_op + def argmin(self, v1, v2): + if self.space.is_true(self.space.le(v1, v2)): + return True + return False + @raw_unary_op def bool(self,v): return self._obool(v) diff --git a/rpython/rlib/rstruct/ieee.py b/rpython/rlib/rstruct/ieee.py --- a/rpython/rlib/rstruct/ieee.py +++ b/rpython/rlib/rstruct/ieee.py @@ -5,7 +5,8 @@ import math from rpython.rlib import rarithmetic, rfloat, objectmodel, jit -from rpython.rlib.rarithmetic import r_ulonglong +from rpython.rtyper.lltypesystem.rffi import r_ulonglong, r_longlong, LONGLONG, ULONGLONG, cast +from rpython.rlib.longlong2float import longlong2float, float2longlong def round_to_nearest(x): """Python 3 style round: round a float x to the nearest int, but @@ -60,7 +61,20 @@ if exp == MAX_EXP - MIN_EXP + 2: # nan or infinity - result = rfloat.NAN if mant else rfloat.INFINITY + if mant == 0: + result = rfloat.INFINITY + else: + # preserve at most 52 bits of mant value, but pad w/zeros + exp = r_ulonglong(0x7ff) << 52 + sign = r_ulonglong(sign) << 63 + if MANT_DIG < 53: + mant = r_ulonglong(mant) << (53 - MANT_DIG) + if mant == 0: + result = rfloat.NAN + else: + uint = exp | mant | sign + result = longlong2float(cast(LONGLONG, uint)) + return result elif exp == 0: # subnormal or zero result = math.ldexp(mant, MIN_EXP - MANT_DIG) @@ -72,7 +86,7 @@ def float_unpack80(QQ, size): '''Unpack a (mant, exp) tuple of r_ulonglong in 80-bit extended format - into a long double float + into a python float (a double) ''' if size == 10 or size == 12 or size == 16: MIN_EXP = -16381 @@ -100,7 +114,17 @@ if exp == MAX_EXP - MIN_EXP + 2: # nan or infinity - result = rfloat.NAN if mant &((one << MANT_DIG - 1) - 1) else rfloat.INFINITY + if mant == 0: + result = rfloat.INFINITY + else: + exp = r_ulonglong(0x7ff) << 52 + mant = r_ulonglong(mant) >> size + 1 + if mant == 0: + result = rfloat.NAN + else: + uint = exp | r_ulonglong(mant) | r_ulonglong(sign) + result = longlong2float(cast(LONGLONG, uint)) + return result else: # normal result = math.ldexp(mant, exp + MIN_EXP - MANT_DIG - 1) @@ -128,13 +152,19 @@ raise ValueError("invalid size value") sign = rfloat.copysign(1.0, x) < 0.0 - if not rfloat.isfinite(x): - if rfloat.isinf(x): - mant = r_ulonglong(0) - exp = MAX_EXP - MIN_EXP + 2 - else: # rfloat.isnan(x): - mant = r_ulonglong(1) << (MANT_DIG-2) # other values possible - exp = MAX_EXP - MIN_EXP + 2 + if rfloat.isinf(x): + mant = r_ulonglong(0) + exp = MAX_EXP - MIN_EXP + 2 + elif rfloat.isnan(x): + asint = cast(ULONGLONG, float2longlong(x)) + sign = asint >> 63 + # shift off lower bits, perhaps losing data + mant = asint & ((r_ulonglong(1) << 52) - 1) + if MANT_DIG < 53: + mant = mant >> (53 - MANT_DIG) + if mant == 0: + mant = r_ulonglong(1) << (MANT_DIG - 1) - 1 + exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) exp = 0 @@ -167,7 +197,7 @@ # check constraints if not objectmodel.we_are_translated(): - assert 0 <= mant < 1 << MANT_DIG - 1 + assert 0 <= mant <= (1 << MANT_DIG) - 1 assert 0 <= exp <= MAX_EXP - MIN_EXP + 2 assert 0 <= sign <= 1 exp = r_ulonglong(exp) @@ -187,13 +217,16 @@ raise ValueError("invalid size value") sign = rfloat.copysign(1.0, x) < 0.0 - if not rfloat.isfinite(x): - if rfloat.isinf(x): - mant = r_ulonglong(0) - exp = MAX_EXP - MIN_EXP + 2 - else: # rfloat.isnan(x): - mant = (r_ulonglong(1) << (MANT_DIG-2)) - 1 # other values possible - exp = MAX_EXP - MIN_EXP + 2 + if rfloat.isinf(x): + mant = r_ulonglong(0) + exp = MAX_EXP - MIN_EXP + 2 + elif rfloat.isnan(x): # rfloat.isnan(x): + asint = cast(ULONGLONG, float2longlong(x)) + mant = asint & ((r_ulonglong(1) << 51) - 1) + if mant == 0: + mant = r_ulonglong(1) << (MANT_DIG - 1) - 1 + sign = asint < 0 + exp = MAX_EXP - MIN_EXP + 2 elif x == 0.0: mant = r_ulonglong(0) exp = 0 @@ -221,12 +254,12 @@ if exp >= MAX_EXP - MIN_EXP + 2: raise OverflowError("float too large to pack in this format") + mant = mant << 1 # check constraints if not objectmodel.we_are_translated(): - assert 0 <= mant < 1 << MANT_DIG - 1 + assert 0 <= mant <= (1 << MANT_DIG) - 1 assert 0 <= exp <= MAX_EXP - MIN_EXP + 2 assert 0 <= sign <= 1 - mant = mant << 1 exp = r_ulonglong(exp) sign = r_ulonglong(sign) return (mant, (sign << BITS - MANT_DIG - 1) | exp) diff --git a/rpython/rlib/rstruct/test/test_ieee.py b/rpython/rlib/rstruct/test/test_ieee.py --- a/rpython/rlib/rstruct/test/test_ieee.py +++ b/rpython/rlib/rstruct/test/test_ieee.py @@ -168,15 +168,31 @@ def test_random(self): # construct a Python float from random integer, using struct + mantissa_mask = (1 << 53) - 1 for _ in xrange(10000): Q = random.randrange(2**64) x = struct.unpack('= 1 << 11: continue self.check_float(x) + def test_various_nans(self): + # check patterns that should preserve the mantissa across nan conversions + maxmant64 = (1 << 52) - 1 # maximum double mantissa + maxmant16 = (1 << 10) - 1 # maximum float16 mantissa + assert maxmant64 >> 42 == maxmant16 + exp = 0xfff << 52 + for i in range(20): + val_to_preserve = exp | ((maxmant16 - i) << 42) + a = ieee.float_unpack(val_to_preserve, 8) + assert isnan(a), 'i %d, maxmant %s' % (i, hex(val_to_preserve)) + b = ieee.float_pack(a, 8) + assert b == val_to_preserve, 'i %d, val %s b %s' % (i, hex(val_to_preserve), hex(b)) + b = ieee.float_pack(a, 2) + assert b == 0xffff - i, 'i %d, b%s' % (i, hex(b)) class TestCompiled: def test_pack_float(self): From noreply at buildbot.pypy.org Mon Nov 9 03:35:41 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 09:35:41 +0100 (CET) Subject: [pypy-commit] pypy default: Before constant-folding pure GC heap operations, check in detail that it Message-ID: <20151109083541.36FFF1C12D4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80606:ebe258311483 Date: 2015-11-09 09:23 +0100 http://bitbucket.org/pypy/pypy/changeset/ebe258311483/ Log: Before constant-folding pure GC heap operations, check in detail that it is valid (not a wrong-typed or out-of-bound access). We can only do it exactly if supports_guard_gc_type, but that's the only case in which we should get examples that fail the check (even if rarely): when optimizing the unrolled loop. diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -7,6 +7,7 @@ from rpython.jit.metainterp.history import INT, REF, FLOAT, VOID from rpython.jit.metainterp.resoperation import rop from rpython.jit.metainterp.optimizeopt import intbounds +from rpython.jit.metainterp.optimize import SpeculativeError from rpython.jit.codewriter import longlong, heaptracker from rpython.jit.codewriter.effectinfo import EffectInfo @@ -197,6 +198,7 @@ return intbounds.get_integer_max( not _is_signed_kind(self.FIELD), rffi.sizeof(self.FIELD)) + def _is_signed_kind(TYPE): return (TYPE is not lltype.Bool and isinstance(TYPE, lltype.Number) and rffi.cast(TYPE, -1) == -1) @@ -949,6 +951,35 @@ def store_fail_descr(self, deadframe, descr): pass # I *think* + def protect_speculative_field(self, p, fielddescr): + if not p: + raise SpeculativeError + p = p._obj.container._as_ptr() + try: + lltype.cast_pointer(lltype.Ptr(fielddescr.S), p) + except lltype.InvalidCast: + raise SpeculativeError + + def protect_speculative_array(self, p, arraydescr): + if not p: + raise SpeculativeError + p = p._obj.container + if lltype.typeOf(p) != arraydescr.A: + raise SpeculativeError + + def protect_speculative_string(self, p): + if not p: + raise SpeculativeError + p = p._obj.container + if lltype.typeOf(p) != rstr.STR: + raise SpeculativeError + + def protect_speculative_unicode(self, p): + if not p: + raise SpeculativeError + p = p._obj.container + if lltype.typeOf(p) != rstr.UNICODE: + raise SpeculativeError class LLDeadFrame(object): diff --git a/rpython/jit/backend/llsupport/descr.py b/rpython/jit/backend/llsupport/descr.py --- a/rpython/jit/backend/llsupport/descr.py +++ b/rpython/jit/backend/llsupport/descr.py @@ -57,6 +57,16 @@ def is_object(self): return bool(self.vtable) + def is_valid_class_for(self, struct): + objptr = lltype.cast_opaque_ptr(rclass.OBJECTPTR, struct) + cls = llmemory.cast_adr_to_ptr( + heaptracker.int2adr(self.get_vtable()), + lltype.Ptr(rclass.OBJECT_VTABLE)) + # this first comparison is necessary, since we want to make sure + # that vtable for JitVirtualRef is the same without actually reading + # fields + return objptr.typeptr == cls or rclass.ll_isinstance(objptr, cls) + def is_immutable(self): return self.immutable_flag @@ -129,18 +139,11 @@ def __repr__(self): return 'FieldDescr<%s>' % (self.name,) - def check_correct_type(self, struct): + def assert_correct_type(self, struct): + # similar to cpu.protect_speculative_field(), but works also + # if supports_guard_gc_type is false (and is allowed to crash). if self.parent_descr.is_object(): - cls = llmemory.cast_adr_to_ptr( - heaptracker.int2adr(self.parent_descr.get_vtable()), - lltype.Ptr(rclass.OBJECT_VTABLE)) - tpptr = lltype.cast_opaque_ptr(rclass.OBJECTPTR, struct).typeptr - # this comparison is necessary, since we want to make sure - # that vtable for JitVirtualRef is the same without actually reading - # fields - if tpptr != cls: - assert rclass.ll_isinstance(lltype.cast_opaque_ptr( - rclass.OBJECTPTR, struct), cls) + assert self.parent_descr.is_valid_class_for(struct) else: pass diff --git a/rpython/jit/backend/llsupport/gc.py b/rpython/jit/backend/llsupport/gc.py --- a/rpython/jit/backend/llsupport/gc.py +++ b/rpython/jit/backend/llsupport/gc.py @@ -729,7 +729,8 @@ return (infobits_offset, self._T_IS_RPYTHON_INSTANCE_BYTE) def get_actual_typeid(self, gcptr): - # Read the whole GC header word. The typeid is the lower half-word. + # Read the whole GC header word. Return the typeid from the + # lower half-word. hdr = rffi.cast(self.HDRPTR, gcptr) type_id = llop.extract_ushort(llgroup.HALFWORD, hdr.tid) return llop.combine_ushort(lltype.Signed, type_id, 0) diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -6,6 +6,7 @@ from rpython.rtyper.llannotation import lltype_to_annotation from rpython.rlib.objectmodel import we_are_translated, specialize from rpython.jit.metainterp import history, compile +from rpython.jit.metainterp.optimize import SpeculativeError from rpython.jit.codewriter import heaptracker, longlong from rpython.jit.backend.model import AbstractCPU from rpython.jit.backend.llsupport import symbolic, jitframe @@ -529,6 +530,34 @@ assert self.supports_guard_gc_type return self.gc_ll_descr.get_actual_typeid(gcptr) + def protect_speculative_field(self, gcptr, fielddescr): + if not gcptr: + raise SpeculativeError + if self.supports_guard_gc_type: + assert isinstance(fielddescr, FieldDescr) + sizedescr = fielddescr.parent_descr + if sizedescr.is_object(): + if (not self.check_is_object(gcptr) or + not sizedescr.is_valid_class_for(gcptr)): + raise SpeculativeError + else: + if self.get_actual_typeid(gcptr) != sizedescr.tid: + raise SpeculativeError + + def protect_speculative_array(self, gcptr, arraydescr): + if not gcptr: + raise SpeculativeError + if self.supports_guard_gc_type: + assert isinstance(arraydescr, ArrayDescr) + if self.get_actual_typeid(gcptr) != arraydescr.tid: + raise SpeculativeError + + def protect_speculative_string(self, gcptr): + self.protect_speculative_array(gcptr, self.gc_ll_descr.str_descr) + + def protect_speculative_unicode(self, gcptr): + self.protect_speculative_array(gcptr, self.gc_ll_descr.unicode_descr) + # ____________________________________________________________ def bh_arraylen_gc(self, array, arraydescr): @@ -633,21 +662,21 @@ def bh_getfield_gc_i(self, struct, fielddescr): ofs, size, sign = self.unpack_fielddescr_size(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): - fielddescr.check_correct_type(struct) + fielddescr.assert_correct_type(struct) return self.read_int_at_mem(struct, ofs, size, sign) @specialize.argtype(1) def bh_getfield_gc_r(self, struct, fielddescr): ofs = self.unpack_fielddescr(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): - fielddescr.check_correct_type(struct) + fielddescr.assert_correct_type(struct) return self.read_ref_at_mem(struct, ofs) @specialize.argtype(1) def bh_getfield_gc_f(self, struct, fielddescr): ofs = self.unpack_fielddescr(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): - fielddescr.check_correct_type(struct) + fielddescr.assert_correct_type(struct) return self.read_float_at_mem(struct, ofs) bh_getfield_raw_i = bh_getfield_gc_i @@ -658,20 +687,20 @@ def bh_setfield_gc_i(self, struct, newvalue, fielddescr): ofs, size, _ = self.unpack_fielddescr_size(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): - fielddescr.check_correct_type(struct) + fielddescr.assert_correct_type(struct) self.write_int_at_mem(struct, ofs, size, newvalue) def bh_setfield_gc_r(self, struct, newvalue, fielddescr): ofs = self.unpack_fielddescr(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): - fielddescr.check_correct_type(struct) + fielddescr.assert_correct_type(struct) self.write_ref_at_mem(struct, ofs, newvalue) @specialize.argtype(1) def bh_setfield_gc_f(self, struct, newvalue, fielddescr): ofs = self.unpack_fielddescr(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): - fielddescr.check_correct_type(struct) + fielddescr.assert_correct_type(struct) self.write_float_at_mem(struct, ofs, newvalue) bh_setfield_raw_i = bh_setfield_gc_i diff --git a/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py b/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py --- a/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py +++ b/rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py @@ -3,6 +3,7 @@ from rpython.jit.metainterp.history import JitCellToken, NoStats from rpython.jit.metainterp.history import BasicFinalDescr, BasicFailDescr from rpython.jit.metainterp.gc import get_description +from rpython.jit.metainterp.optimize import SpeculativeError from rpython.annotator.listdef import s_list_of_strings from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from rpython.rtyper.rclass import getclassrepr, getinstancerepr @@ -19,7 +20,7 @@ class C(B): pass def main(argv): - A(); B(); C() + A(); B().foo = len(argv); C() return 0 t = TranslationContext() @@ -48,6 +49,14 @@ descr_B = cpu.sizeof(LLB, ptr_vtable_B) typeid_B = descr_B.get_type_id() + fielddescr_B = cpu.fielddescrof(LLB, 'inst_foo') + + LLD = lltype.GcStruct('D', ('dd', lltype.Signed)) + descr_D = cpu.sizeof(LLD) + fielddescr_D = cpu.fielddescrof(LLD, 'dd') + + ARRAY = lltype.GcArray(lltype.Signed) + arraydescr = cpu.arraydescrof(ARRAY) loop1 = parse(""" [p0] @@ -123,6 +132,38 @@ if token is token3: # guard_is_object print int(cpu.check_is_object(p0)) + for p0 in [lltype.nullptr(llmemory.GCREF.TO), + rffi.cast(llmemory.GCREF, A()), + rffi.cast(llmemory.GCREF, B()), + rffi.cast(llmemory.GCREF, C()), + rffi.cast(llmemory.GCREF, lltype.malloc(LLD)), + rffi.cast(llmemory.GCREF, lltype.malloc(ARRAY, 5)), + rffi.cast(llmemory.GCREF, "foobar"), + rffi.cast(llmemory.GCREF, u"foobaz")]: + results = ['B', 'D', 'A', 'S', 'U'] + try: + cpu.protect_speculative_field(p0, fielddescr_B) + except SpeculativeError: + results[0] = '-' + try: + cpu.protect_speculative_field(p0, fielddescr_D) + except SpeculativeError: + results[1] = '-' + try: + cpu.protect_speculative_array(p0, arraydescr) + except SpeculativeError: + results[2] = '-' + try: + cpu.protect_speculative_string(p0) + except SpeculativeError: + results[3] = '-' + try: + cpu.protect_speculative_unicode(p0) + except SpeculativeError: + results[4] = '-' + print ''.join(results) + + call_initial_function(t, g) cbuilder = genc.CStandaloneBuilder(t, main, t.config) @@ -145,7 +186,17 @@ 'fail\n' 'match\n' - 'match\n') + 'match\n' + + '-----\n' # null + '-----\n' # instance of A + 'B----\n' # instance of B + 'B----\n' # instance of C + '-D---\n' + '--A--\n' + '---S-\n' + '----U\n' + ) def test_guards_translated_with_gctypeptr(): diff --git a/rpython/jit/metainterp/optimize.py b/rpython/jit/metainterp/optimize.py --- a/rpython/jit/metainterp/optimize.py +++ b/rpython/jit/metainterp/optimize.py @@ -12,3 +12,7 @@ debug_print(msg) debug_stop("jit-abort") self.msg = msg + +class SpeculativeError(JitException): + """Raised when speculative heap access would be ill-typed, + which should only occur when optimizing the unrolled loop.""" diff --git a/rpython/jit/metainterp/optimizeopt/pure.py b/rpython/jit/metainterp/optimizeopt/pure.py --- a/rpython/jit/metainterp/optimizeopt/pure.py +++ b/rpython/jit/metainterp/optimizeopt/pure.py @@ -3,6 +3,7 @@ ResOperation from rpython.jit.metainterp.optimizeopt.util import make_dispatcher_method from rpython.jit.metainterp.optimizeopt.shortpreamble import PreambleOp +from rpython.jit.metainterp.optimize import SpeculativeError class RecentPureOps(object): @@ -93,6 +94,7 @@ break else: # all constant arguments: constant-fold away + self.protect_speculative_operation(op) resbox = self.optimizer.constant_fold(op) # note that INT_xxx_OVF is not done from here, and the # overflows in the INT_xxx operations are ignored @@ -117,6 +119,59 @@ if nextop: self.emit_operation(nextop) + def protect_speculative_operation(self, op): + """When constant-folding a pure operation that reads memory from + a gcref, make sure that the gcref is non-null and of a valid type. + Otherwise, raise SpeculativeError. This should only occur when + unrolling and optimizing the unrolled loop. Note that if + cpu.supports_guard_gc_type is false, we can't really do this + check at all, but then we don't unroll in that case. + """ + opnum = op.getopnum() + cpu = self.optimizer.cpu + + if (opnum == rop.GETFIELD_GC_PURE_I or + opnum == rop.GETFIELD_GC_PURE_R or + opnum == rop.GETFIELD_GC_PURE_F): + fielddescr = op.getdescr() + ref = self.get_constant_box(op.getarg(0)).getref_base() + cpu.protect_speculative_field(ref, fielddescr) + return + + elif (opnum == rop.GETARRAYITEM_GC_PURE_I or + opnum == rop.GETARRAYITEM_GC_PURE_R or + opnum == rop.GETARRAYITEM_GC_PURE_F or + opnum == rop.ARRAYLEN_GC): + arraydescr = op.getdescr() + array = self.get_constant_box(op.getarg(0)).getref_base() + cpu.protect_speculative_array(array, arraydescr) + if opnum == rop.ARRAYLEN_GC: + return + arraylength = cpu.bh_arraylen_gc(array, arraydescr) + + elif (opnum == rop.STRGETITEM or + opnum == rop.STRLEN): + string = self.get_constant_box(op.getarg(0)).getref_base() + cpu.protect_speculative_string(string) + if opnum == rop.STRLEN: + return + arraylength = cpu.bh_strlen(string) + + elif (opnum == rop.UNICODEGETITEM or + opnum == rop.UNICODELEN): + unicode = self.get_constant_box(op.getarg(0)).getref_base() + cpu.protect_speculative_unicode(unicode) + if opnum == rop.UNICODELEN: + return + arraylength = cpu.bh_unicodelen(unicode) + + else: + return + + index = self.get_constant_box(op.getarg(1)).getint() + if not (0 <= index < arraylength): + raise SpeculativeError + def getrecentops(self, opnum): if rop._OVF_FIRST <= opnum <= rop._OVF_LAST: opnum = opnum - rop._OVF_FIRST diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -9028,7 +9028,6 @@ self.optimize_loop(ops, expected) def test_unroll_pure_on_bogus_object_1(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) @@ -9037,22 +9036,20 @@ i3 = int_sub(i1, 1) jump(NULL, i3) """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_2(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) guard_true(i2) [] getfield_gc_pure_i(p0, descr=valuedescr) i3 = int_sub(i1, 1) - jump(ConstPtr(myptr3), i3) - """ - self.optimize_loop(ops, ops) + jump(ConstPtr(myptr4), i3) + """ + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_3(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) @@ -9061,10 +9058,9 @@ i3 = int_sub(i1, 1) jump(NULL, i3) """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_4(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) @@ -9073,10 +9069,9 @@ i3 = int_sub(i1, 1) jump(ConstPtr(myptr3), i3) """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_5(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) @@ -9085,10 +9080,9 @@ i3 = int_sub(i1, 1) jump(ConstPtr(arrayref), i3) # too short, length < 126! """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_6(self): - py.test.skip("FIXME") ops = """ [i0, i1] i2 = int_gt(i1, 0) @@ -9097,10 +9091,9 @@ i3 = int_sub(i1, 1) jump(125, i3) # arrayref is too short, length < 126! """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_7(self): - py.test.skip("FIXME") ops = """ [i0, i1] i2 = int_gt(i1, 0) @@ -9109,10 +9102,9 @@ i3 = int_sub(i1, 1) jump(-1, i3) # cannot access array item -1! """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_8(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) @@ -9121,10 +9113,9 @@ i3 = int_sub(i1, 1) jump(NULL, i3) """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_9(self): - py.test.skip("FIXME") ops = """ [p0, i1] i2 = int_gt(i1, 0) @@ -9133,10 +9124,20 @@ i3 = int_sub(i1, 1) jump(ConstPtr(myptr), i3) # not a string at all """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) + + def test_unroll_pure_on_bogus_object_9_unicode(self): + ops = """ + [p0, i1] + i2 = int_gt(i1, 0) + guard_true(i2) [] + i4 = unicodegetitem(p0, 125) + i3 = int_sub(i1, 1) + jump(ConstPtr(myptr), i3) # not a unicode at all + """ + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_10(self): - py.test.skip("FIXME") ops = """ [i0, i1] i2 = int_gt(i1, 0) @@ -9145,10 +9146,9 @@ i3 = int_sub(i1, 1) jump(125, i3) # string is too short! """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) def test_unroll_pure_on_bogus_object_11(self): - py.test.skip("FIXME") ops = """ [i0, i1] i2 = int_gt(i1, 0) @@ -9157,7 +9157,7 @@ i3 = int_sub(i1, 1) jump(-1, i3) # cannot access character -1! """ - self.optimize_loop(ops, ops) + py.test.raises(InvalidLoop, self.optimize_loop, ops, ops) class TestLLtype(OptimizeOptTest, LLtypeMixin): diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py --- a/rpython/jit/metainterp/optimizeopt/test/test_util.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py @@ -139,7 +139,10 @@ myptr2 = lltype.cast_opaque_ptr(llmemory.GCREF, mynode2) mynode3 = lltype.malloc(NODE2) mynode3.parent.parent.typeptr = node_vtable2 - myptr3 = lltype.cast_opaque_ptr(llmemory.GCREF, mynode3) + myptr3 = lltype.cast_opaque_ptr(llmemory.GCREF, mynode3) # a NODE2 + mynode4 = lltype.malloc(NODE3) + mynode4.parent.typeptr = node_vtable3 + myptr4 = lltype.cast_opaque_ptr(llmemory.GCREF, mynode4) # a NODE3 nullptr = lltype.nullptr(llmemory.GCREF.TO) #nodebox2 = InputArgRef(lltype.cast_opaque_ptr(llmemory.GCREF, node2)) nodesize = cpu.sizeof(NODE, node_vtable) diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -4,7 +4,7 @@ from rpython.jit.metainterp.optimizeopt.shortpreamble import ShortBoxes,\ ShortPreambleBuilder, ExtendedShortPreambleBuilder, PreambleOp from rpython.jit.metainterp.optimizeopt import info, intutils -from rpython.jit.metainterp.optimize import InvalidLoop +from rpython.jit.metainterp.optimize import InvalidLoop, SpeculativeError from rpython.jit.metainterp.optimizeopt.optimizer import Optimizer,\ Optimization, LoopInfo, MININT, MAXINT, BasicLoopInfo from rpython.jit.metainterp.optimizeopt.vstring import StrPtrInfo @@ -144,9 +144,12 @@ raise InvalidLoop("Cannot import state, virtual states don't match") self.potential_extra_ops = {} self.optimizer.init_inparg_dict_from(label_args) - info, _ = self.optimizer.propagate_all_forward( - start_label.getarglist()[:], ops, call_pure_results, False, - flush=False) + try: + info, _ = self.optimizer.propagate_all_forward( + start_label.getarglist()[:], ops, call_pure_results, False, + flush=False) + except SpeculativeError: + raise InvalidLoop("Speculative heap access would be ill-typed") label_op = ResOperation(rop.LABEL, label_args, start_label.getdescr()) for a in end_jump.getarglist(): self.optimizer.force_box_for_end_of_preamble( From noreply at buildbot.pypy.org Mon Nov 9 08:11:15 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:15 +0100 (CET) Subject: [pypy-commit] pypy default: clean up Message-ID: <20151109131115.ACC1C1C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80607:1d9276ab70a4 Date: 2015-11-09 12:24 +0100 http://bitbucket.org/pypy/pypy/changeset/1d9276ab70a4/ Log: clean up diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py --- a/rpython/jit/metainterp/optimizeopt/optimizer.py +++ b/rpython/jit/metainterp/optimizeopt/optimizer.py @@ -253,7 +253,6 @@ self.pendingfields = None # set temporarily to a list, normally by # heap.py, as we're about to generate a guard self.quasi_immutable_deps = None - self.opaque_pointers = {} self.replaces_guard = {} self._newoperations = [] self.optimizer = self From noreply at buildbot.pypy.org Mon Nov 9 08:11:17 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:17 +0100 (CET) Subject: [pypy-commit] pypy default: A missing optimization: it's hard to test but the front-end doesn't Message-ID: <20151109131117.C7CDC1C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80608:47e7d26dea93 Date: 2015-11-09 12:58 +0100 http://bitbucket.org/pypy/pypy/changeset/47e7d26dea93/ Log: A missing optimization: it's hard to test but the front-end doesn't always manage to avoid this: i5 = int_le(...); guard_true(i5) [... i5 ...] So in rewrite.py, change it to: i0 = same_as_i(0); i5 = int_le(...); guard_true(i5) [... i0 ...] diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -181,13 +181,35 @@ return op.is_ovf() # int_xxx_ovf() / guard_no_overflow() if i + 1 >= len(operations): return False - if (operations[i + 1].getopnum() != rop.GUARD_TRUE and - operations[i + 1].getopnum() != rop.GUARD_FALSE): + next_op = operations[i + 1] + opnum = next_op.getopnum() + if not (opnum == rop.GUARD_TRUE or + opnum == rop.GUARD_FALSE or + opnum == rop.COND_CALL): return False - if operations[i + 1].getarg(0) is not op: + if next_op.getarg(0) is not op: return False + self.remove_tested_failarg(next_op) return True + def remove_tested_failarg(self, op): + opnum = op.getopnum() + if not (opnum == rop.GUARD_TRUE or opnum == rop.GUARD_FALSE): + return + try: + i = op.getfailargs().index(op.getarg(0)) + except ValueError: + return + # The checked value is also in the failargs. The front-end + # tries not to produce it, but doesn't always succeed (and + # it's hard to test all cases). Rewrite it away. + value = (opnum == rop.GUARD_FALSE) + op1 = ResOperation(rop.SAME_AS_I, [ConstInt(value)]) + self.emit_op(op1) + lst = op.getfailargs()[:] + lst[i] = op1 + op.setfailargs(lst) + # ---------- def handle_getfield_gc(self, op): diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -1055,3 +1055,29 @@ p1 = getfield_gc_r(p0, descr=tdescr) jump(p1) """) + + def test_remove_tested_failarg(self): + self.check_rewrite(""" + [i5] + i2 = int_ge(i5, 10) + guard_true(i2) [i5, i2] + jump() + """, """ + [i5] + i0 = same_as_i(0) + i2 = int_ge(i5, 10) + guard_true(i2) [i5, i0] + jump() + """) + self.check_rewrite(""" + [i5] + i2 = int_ge(i5, 10) + guard_false(i2) [i5, i2] + jump() + """, """ + [i5] + i0 = same_as_i(1) + i2 = int_ge(i5, 10) + guard_false(i2) [i5, i0] + jump() + """) From noreply at buildbot.pypy.org Mon Nov 9 08:11:19 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:19 +0100 (CET) Subject: [pypy-commit] pypy default: Fix for guard_true/guard_false with vector argument. Add an assert Message-ID: <20151109131119.F23FC1C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80609:2ba6394918d5 Date: 2015-11-09 13:27 +0100 http://bitbucket.org/pypy/pypy/changeset/2ba6394918d5/ Log: Fix for guard_true/guard_false with vector argument. Add an assert that guard_true/guard_false is otherwise only used on values 0 or 1, not any integer. diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -1150,11 +1150,13 @@ def _test_true(self, arg): if isinstance(arg, list): return all(arg) + assert arg in (0, 1) return arg def _test_false(self, arg): if isinstance(arg, list): return any(arg) + assert arg in (0, 1) return arg def execute_guard_true(self, descr, arg): diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -196,6 +196,8 @@ opnum = op.getopnum() if not (opnum == rop.GUARD_TRUE or opnum == rop.GUARD_FALSE): return + if op.getarg(0).is_vector: + return try: i = op.getfailargs().index(op.getarg(0)) except ValueError: diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -4897,7 +4897,8 @@ force_spill(i7) force_spill(i8) force_spill(i9) - guard_true(i9) [i3, i4, i5, i6, i7, i8, i9] + i10 = int_is_true(i9) + guard_true(i10) [i3, i4, i5, i6, i7, i8, i9] finish(i9, descr=finaldescr) """, namespace={'finaldescr': BasicFinalDescr(42), 'faildescr2': BasicFailDescr(1), diff --git a/rpython/jit/backend/test/test_random.py b/rpython/jit/backend/test/test_random.py --- a/rpython/jit/backend/test/test_random.py +++ b/rpython/jit/backend/test/test_random.py @@ -800,6 +800,10 @@ "Got %r, expected %r" % (fail, self.should_fail_by.getdescr())) for i, v in enumerate(self.get_fail_args()): + if v not in self.expected: + assert v.getopnum() == rop.SAME_AS_I # special case + assert isinstance(v.getarg(0), ConstInt) + self.expected[v] = v.getarg(0).getint() if v.type == FLOAT: value = cpu.get_float_value(deadframe, i) else: From noreply at buildbot.pypy.org Mon Nov 9 08:11:22 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:22 +0100 (CET) Subject: [pypy-commit] pypy default: small performance Message-ID: <20151109131122.319081C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80610:0b8ce582d79f Date: 2015-11-09 13:28 +0100 http://bitbucket.org/pypy/pypy/changeset/0b8ce582d79f/ Log: small performance diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1079,9 +1079,9 @@ if result_loc is ebp: self.guard_success_cc = cond else: + self.mc.MOV_ri(result_loc.value, 0) rl = result_loc.lowest8bits() self.mc.SET_ir(cond, rl.value) - self.mc.MOVZX8_rr(result_loc.value, rl.value) def _cmpop(cond, rev_cond): cond = rx86.Conditions[cond] From noreply at buildbot.pypy.org Mon Nov 9 08:11:24 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:24 +0100 (CET) Subject: [pypy-commit] pypy default: argh Message-ID: <20151109131124.4A3521C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80611:db505329b810 Date: 2015-11-09 13:32 +0100 http://bitbucket.org/pypy/pypy/changeset/db505329b810/ Log: argh diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -196,7 +196,7 @@ opnum = op.getopnum() if not (opnum == rop.GUARD_TRUE or opnum == rop.GUARD_FALSE): return - if op.getarg(0).is_vector: + if op.getarg(0).is_vector(): return try: i = op.getfailargs().index(op.getarg(0)) From noreply at buildbot.pypy.org Mon Nov 9 08:11:26 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:26 +0100 (CET) Subject: [pypy-commit] pypy default: Fix for test_random Message-ID: <20151109131126.576B51C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80612:6eddbb5218e6 Date: 2015-11-09 13:51 +0100 http://bitbucket.org/pypy/pypy/changeset/6eddbb5218e6/ Log: Fix for test_random diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -207,6 +207,7 @@ # it's hard to test all cases). Rewrite it away. value = (opnum == rop.GUARD_FALSE) op1 = ResOperation(rop.SAME_AS_I, [ConstInt(value)]) + op1.setint(value) self.emit_op(op1) lst = op.getfailargs()[:] lst[i] = op1 From noreply at buildbot.pypy.org Mon Nov 9 08:11:28 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 9 Nov 2015 14:11:28 +0100 (CET) Subject: [pypy-commit] pypy default: Another test fix Message-ID: <20151109131128.63CDF1C1034@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80613:21cd9596d1b4 Date: 2015-11-09 13:07 +0000 http://bitbucket.org/pypy/pypy/changeset/21cd9596d1b4/ Log: Another test fix diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -205,7 +205,7 @@ # The checked value is also in the failargs. The front-end # tries not to produce it, but doesn't always succeed (and # it's hard to test all cases). Rewrite it away. - value = (opnum == rop.GUARD_FALSE) + value = int(opnum == rop.GUARD_FALSE) op1 = ResOperation(rop.SAME_AS_I, [ConstInt(value)]) op1.setint(value) self.emit_op(op1) From noreply at buildbot.pypy.org Mon Nov 9 10:23:04 2015 From: noreply at buildbot.pypy.org (fijal) Date: Mon, 9 Nov 2015 16:23:04 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: merge default Message-ID: <20151109152304.668041C1437@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80614:3347461ef618 Date: 2015-11-07 18:49 +0000 http://bitbucket.org/pypy/pypy/changeset/3347461ef618/ Log: merge default diff too long, truncating to 2000 out of 6502 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), - ('type_specifier -> SHORT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',711), - ('type_specifier -> INT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',712), - ('type_specifier -> LONG','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',713), - ('type_specifier -> FLOAT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',714), - ('type_specifier -> DOUBLE','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',715), - ('type_specifier -> _COMPLEX','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',716), - ('type_specifier -> SIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',717), - ('type_specifier -> UNSIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',718), - ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',723), - ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',724), - ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',725), - ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',730), - ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',731), - ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',732), - ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list_1','../pycparser/c_parser.py',737), - ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list_1','../pycparser/c_parser.py',738), - ('init_declarator_list -> EQUALS initializer','init_declarator_list',2,'p_init_declarator_list_2','../pycparser/c_parser.py',748), - ('init_declarator_list -> abstract_declarator','init_declarator_list',1,'p_init_declarator_list_3','../pycparser/c_parser.py',756), - ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','../pycparser/c_parser.py',764), - ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','../pycparser/c_parser.py',765), - ('specifier_qualifier_list -> type_qualifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','../pycparser/c_parser.py',770), - ('specifier_qualifier_list -> type_specifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','../pycparser/c_parser.py',775), - ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',783), - ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',784), - ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','../pycparser/c_parser.py',793), - ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',802), - ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',803), - ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',812), - ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',813), - ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','../pycparser/c_parser.py',820), - ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','../pycparser/c_parser.py',821), - ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','../pycparser/c_parser.py',826), - ('struct_declaration -> specifier_qualifier_list abstract_declarator SEMI','struct_declaration',3,'p_struct_declaration_2','../pycparser/c_parser.py',864), - ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','../pycparser/c_parser.py',878), - ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','../pycparser/c_parser.py',879), - ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','../pycparser/c_parser.py',887), - ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','../pycparser/c_parser.py',892), - ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','../pycparser/c_parser.py',893), - ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',901), - ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',902), - ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','../pycparser/c_parser.py',907), - ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',912), - ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',913), - ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','../pycparser/c_parser.py',918), - ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','../pycparser/c_parser.py',919), - ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','../pycparser/c_parser.py',920), - ('enumerator -> ID','enumerator',1,'p_enumerator','../pycparser/c_parser.py',931), - ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','../pycparser/c_parser.py',932), - ('declarator -> direct_declarator','declarator',1,'p_declarator_1','../pycparser/c_parser.py',947), - ('declarator -> pointer direct_declarator','declarator',2,'p_declarator_2','../pycparser/c_parser.py',952), - ('declarator -> pointer TYPEID','declarator',2,'p_declarator_3','../pycparser/c_parser.py',961), - ('direct_declarator -> ID','direct_declarator',1,'p_direct_declarator_1','../pycparser/c_parser.py',972), - ('direct_declarator -> LPAREN declarator RPAREN','direct_declarator',3,'p_direct_declarator_2','../pycparser/c_parser.py',981), - ('direct_declarator -> direct_declarator LBRACKET assignment_expression_opt RBRACKET','direct_declarator',4,'p_direct_declarator_3','../pycparser/c_parser.py',986), - ('direct_declarator -> direct_declarator LBRACKET TIMES RBRACKET','direct_declarator',4,'p_direct_declarator_4','../pycparser/c_parser.py',998), - ('direct_declarator -> direct_declarator LPAREN parameter_type_list RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1008), - ('direct_declarator -> direct_declarator LPAREN identifier_list_opt RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1009), - ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','../pycparser/c_parser.py',1036), - ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','../pycparser/c_parser.py',1037), - ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','../pycparser/c_parser.py',1047), - ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','../pycparser/c_parser.py',1048), - ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','../pycparser/c_parser.py',1053), - ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','../pycparser/c_parser.py',1054), - ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','../pycparser/c_parser.py',1062), - ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','../pycparser/c_parser.py',1063), - ('parameter_declaration -> declaration_specifiers declarator','parameter_declaration',2,'p_parameter_declaration_1','../pycparser/c_parser.py',1072), - ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','../pycparser/c_parser.py',1083), - ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','../pycparser/c_parser.py',1113), - ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','../pycparser/c_parser.py',1114), - ('initializer -> assignment_expression','initializer',1,'p_initializer_1','../pycparser/c_parser.py',1123), - ('initializer -> brace_open initializer_list brace_close','initializer',3,'p_initializer_2','../pycparser/c_parser.py',1128), - ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','../pycparser/c_parser.py',1129), - ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','../pycparser/c_parser.py',1134), - ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','../pycparser/c_parser.py',1135), - ('designation -> designator_list EQUALS','designation',2,'p_designation','../pycparser/c_parser.py',1146), - ('designator_list -> designator','designator_list',1,'p_designator_list','../pycparser/c_parser.py',1154), - ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','../pycparser/c_parser.py',1155), - ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','../pycparser/c_parser.py',1160), - ('designator -> PERIOD identifier','designator',2,'p_designator','../pycparser/c_parser.py',1161), - ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','../pycparser/c_parser.py',1166), - ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','../pycparser/c_parser.py',1182), - ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','../pycparser/c_parser.py',1190), - ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','../pycparser/c_parser.py',1195), - ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','../pycparser/c_parser.py',1205), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','../pycparser/c_parser.py',1209), - ('direct_abstract_declarator -> LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_3','../pycparser/c_parser.py',1219), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','../pycparser/c_parser.py',1227), - ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','../pycparser/c_parser.py',1237), - ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','../pycparser/c_parser.py',1245), - ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','../pycparser/c_parser.py',1255), - ('block_item -> declaration','block_item',1,'p_block_item','../pycparser/c_parser.py',1266), - ('block_item -> statement','block_item',1,'p_block_item','../pycparser/c_parser.py',1267), - ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','../pycparser/c_parser.py',1274), - ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','../pycparser/c_parser.py',1275), - ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','../pycparser/c_parser.py',1281), - ('labeled_statement -> ID COLON statement','labeled_statement',3,'p_labeled_statement_1','../pycparser/c_parser.py',1287), - ('labeled_statement -> CASE constant_expression COLON statement','labeled_statement',4,'p_labeled_statement_2','../pycparser/c_parser.py',1291), - ('labeled_statement -> DEFAULT COLON statement','labeled_statement',3,'p_labeled_statement_3','../pycparser/c_parser.py',1295), - ('selection_statement -> IF LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_1','../pycparser/c_parser.py',1299), - ('selection_statement -> IF LPAREN expression RPAREN statement ELSE statement','selection_statement',7,'p_selection_statement_2','../pycparser/c_parser.py',1303), - ('selection_statement -> SWITCH LPAREN expression RPAREN statement','selection_statement',5,'p_selection_statement_3','../pycparser/c_parser.py',1307), - ('iteration_statement -> WHILE LPAREN expression RPAREN statement','iteration_statement',5,'p_iteration_statement_1','../pycparser/c_parser.py',1312), - ('iteration_statement -> DO statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','../pycparser/c_parser.py',1316), - ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN statement','iteration_statement',9,'p_iteration_statement_3','../pycparser/c_parser.py',1320), - ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement','iteration_statement',8,'p_iteration_statement_4','../pycparser/c_parser.py',1324), - ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','../pycparser/c_parser.py',1328), From noreply at buildbot.pypy.org Mon Nov 9 10:23:06 2015 From: noreply at buildbot.pypy.org (fijal) Date: Mon, 9 Nov 2015 16:23:06 +0100 (CET) Subject: [pypy-commit] pypy vmprof-newstack: in progress Message-ID: <20151109152306.86CA01C1437@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: vmprof-newstack Changeset: r80615:cda9b080c6aa Date: 2015-11-09 16:23 +0100 http://bitbucket.org/pypy/pypy/changeset/cda9b080c6aa/ Log: in progress diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -114,6 +114,7 @@ struct vmprof_stack node; node.value = unique_id; + node.kind = VMPROF_CODE_TAG; node.next = vmprof_global_stack; vmprof_global_stack = &node; result = %(cont_name)s(%(argnames)s); diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h --- a/rpython/rlib/rvmprof/src/vmprof_main.h +++ b/rpython/rlib/rvmprof/src/vmprof_main.h @@ -143,6 +143,7 @@ #define VERSION_BASE '\x00' #define VERSION_THREAD_ID '\x01' +#define VERSION_TAG '\x02' vmprof_stack* vmprof_global_stack = NULL; @@ -216,10 +217,11 @@ // read the first slot of shadowstack struct vmprof_stack* stack = vmprof_global_stack; int n = 0; - while (n < max_depth && stack) { - result[n] = (void*)stack->value; + while (n < max_depth - 1 && stack) { + result[n] = (void*)stack->kind; + result[n + 1] = (void*)stack->value; stack = stack->next; - n++; + n += 2; } return n; } @@ -311,9 +313,9 @@ struct prof_stacktrace_s *st = (struct prof_stacktrace_s *)p->data; st->marker = MARKER_STACKTRACE; st->count = 1; - st->stack[0] = GetPC((ucontext_t*)ucontext); - depth = get_stack_trace(st->stack+1, MAX_STACK_DEPTH-2, ucontext); - depth++; // To account for pc value in stack[0]; + //st->stack[0] = GetPC((ucontext_t*)ucontext); + depth = get_stack_trace(st->stack, MAX_STACK_DEPTH-2, ucontext); + //depth++; // To account for pc value in stack[0]; st->depth = depth; st->stack[depth++] = get_current_thread_id(); p->data_offset = offsetof(struct prof_stacktrace_s, marker); @@ -459,7 +461,7 @@ header.hdr[4] = 0; header.interp_name[0] = MARKER_HEADER; header.interp_name[1] = '\x00'; - header.interp_name[2] = VERSION_THREAD_ID; + header.interp_name[2] = VERSION_TAG; header.interp_name[3] = namelen; memcpy(&header.interp_name[4], interp_name, namelen); return _write_all(&header, 5 * sizeof(long) + 4 + namelen); diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h b/rpython/rlib/rvmprof/src/vmprof_stack.h --- a/rpython/rlib/rvmprof/src/vmprof_stack.h +++ b/rpython/rlib/rvmprof/src/vmprof_stack.h @@ -1,7 +1,25 @@ + +#define VMPROF_CODE_TAG 1 +#define VMPROF_BLACKHOLE_TAG 2 +#define VMPROF_JITTED_TAG 3 +#define VMPROF_JITTING_TAG 4 +#define VMPROF_GC_TAG 5 +// whatever we want here typedef struct vmprof_stack { struct vmprof_stack* next; long value; + long kind; } vmprof_stack; +// the kind is WORD so we consume exactly 3 WORDs and we don't have +// to worry too much. There is a potential for squeezing it with bit +// patterns into one WORD, but I don't want to care RIGHT NOW, potential +// for future optimization potential + RPY_EXTERN vmprof_stack* vmprof_global_stack; + +RPY_EXTERN void *vmprof_address_of_global_stack(void) +{ + return (void*)&vmprof_global_stack; +} \ No newline at end of file From noreply at buildbot.pypy.org Mon Nov 9 13:47:54 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Mon, 9 Nov 2015 19:47:54 +0100 (CET) Subject: [pypy-commit] pypy no-class-specialize: Remove obsolete references to ctr_location Message-ID: <20151109184754.4F1831C12D4@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: no-class-specialize Changeset: r80616:a63fa0ceb9a9 Date: 2015-11-09 18:48 +0000 http://bitbucket.org/pypy/pypy/changeset/a63fa0ceb9a9/ Log: Remove obsolete references to ctr_location diff --git a/pypy/module/marshal/interp_marshal.py b/pypy/module/marshal/interp_marshal.py --- a/pypy/module/marshal/interp_marshal.py +++ b/pypy/module/marshal/interp_marshal.py @@ -156,9 +156,6 @@ put_tuple_w(TYPE, tuple_w) puts tuple_w, an unwrapped list of wrapped objects """ - # _annspecialcase_ = "specialize:ctr_location" # polymorphic - # does not work with subclassing - def __init__(self, space, writer, version): self.space = space ## self.put = putfunc diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -3244,22 +3244,6 @@ a = self.RPythonAnnotator() py.test.raises(AnnotatorError, a.build_types, f, []) - def test_ctr_location(self): - class A: - _annspecialcase_ = 'specialize:ctr_location' - def __init__(self, x): - self.x = x - - def f(n): - a = A(2 * n) - a.x = n - b = A("") - b.x = str(n) - return len(b.x) + a.x - a = self.RPythonAnnotator() - with py.test.raises(annmodel.AnnotatorError): - s = a.build_types(f, [int]) - def test_weakref(self): import weakref From noreply at buildbot.pypy.org Tue Nov 10 09:02:38 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 10 Nov 2015 15:02:38 +0100 (CET) Subject: [pypy-commit] cffi ffi_closure_alloc: Using the official interface from ffi to get closure memory Message-ID: <20151110140238.ADF9A1C0EB1@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ffi_closure_alloc Changeset: r2375:c19672f5a532 Date: 2015-11-10 15:03 +0100 http://bitbucket.org/cffi/cffi/changeset/c19672f5a532/ Log: Using the official interface from ffi to get closure memory From noreply at buildbot.pypy.org Tue Nov 10 09:02:40 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 10 Nov 2015 15:02:40 +0100 (CET) Subject: [pypy-commit] cffi ffi_closure_alloc: try Message-ID: <20151110140240.BBD541C0EB1@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ffi_closure_alloc Changeset: r2376:4406e3b72133 Date: 2015-11-10 15:03 +0100 http://bitbucket.org/cffi/cffi/changeset/4406e3b72133/ Log: try diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -58,8 +58,6 @@ # endif #endif -#include "malloc_closure.h" - #if PY_MAJOR_VERSION >= 3 # define STR_OR_BYTES "bytes" # define PyText_Type PyUnicode_Type @@ -1614,7 +1612,7 @@ ffi_closure *closure = (ffi_closure *)cd->c_data; PyObject *args = (PyObject *)(closure->user_data); Py_XDECREF(args); - cffi_closure_free(closure); + ffi_closure_free(closure); } else if (cd->c_type->ct_flags & CT_IS_UNSIZED_CHAR_A) { /* from_buffer */ Py_buffer *view = ((CDataObject_owngc_frombuf *)cd)->bufferview; @@ -5091,6 +5089,7 @@ PyObject *py_rawerr, *infotuple = NULL; cif_description_t *cif_descr; ffi_closure *closure; + void *closure_ex; Py_ssize_t size; if (!PyArg_ParseTuple(args, "O!O|OO:callback", &CTypeDescr_Type, &ct, &ob, @@ -5135,7 +5134,7 @@ if (infotuple == NULL) return NULL; - closure = cffi_closure_alloc(); + closure = ffi_closure_alloc(sizeof(ffi_closure), &closure_ex); cd = PyObject_GC_New(CDataObject, &CDataOwningGC_Type); if (cd == NULL) @@ -5153,8 +5152,8 @@ "return type or with '...'", ct->ct_name); goto error; } - if (ffi_prep_closure(closure, &cif_descr->cif, - invoke_callback, infotuple) != FFI_OK) { + if (ffi_prep_closure_loc(closure, &cif_descr->cif, invoke_callback, + infotuple, closure_ex) != FFI_OK) { PyErr_SetString(PyExc_SystemError, "libffi failed to build this callback"); goto error; @@ -5168,7 +5167,7 @@ error: closure->user_data = NULL; if (cd == NULL) - cffi_closure_free(closure); + ffi_closure_free(closure); else Py_DECREF(cd); Py_XDECREF(infotuple); diff --git a/c/malloc_closure.h b/c/libffi_msvc/malloc_closure.c rename from c/malloc_closure.h rename to c/libffi_msvc/malloc_closure.c --- a/c/malloc_closure.h +++ b/c/libffi_msvc/malloc_closure.c @@ -3,63 +3,8 @@ * and has received some edits. */ +#include #include -#ifdef MS_WIN32 -#include -#else -#include -#include -# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -# define MAP_ANONYMOUS MAP_ANON -# endif -#endif - -/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. - - This is, apparently, an undocumented change to ffi_prep_closure(): - depending on the Linux kernel we're running on, we must give it a - mmap that is either PROT_READ|PROT_WRITE|PROT_EXEC or only - PROT_READ|PROT_WRITE. In the latter case, just trying to obtain a - mmap with PROT_READ|PROT_WRITE|PROT_EXEC would kill our process(!), - but in that situation libffi is fine with only PROT_READ|PROT_WRITE. - There is nothing in the libffi API to know that, though, so we have - to guess by parsing /proc/self/status. "Meh." - */ -#ifdef __linux__ -#include - -static int emutramp_enabled = -1; - -static int -emutramp_enabled_check (void) -{ - char *buf = NULL; - size_t len = 0; - FILE *f; - int ret; - f = fopen ("/proc/self/status", "r"); - if (f == NULL) - return 0; - ret = 0; - - while (getline (&buf, &len, f) != -1) - if (!strncmp (buf, "PaX:", 4)) - { - char emutramp; - if (sscanf (buf, "%*s %*c%c", &emutramp) == 1) - ret = (emutramp == 'E'); - break; - } - free (buf); - fclose (f); - return ret; -} - -#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ - : (emutramp_enabled = emutramp_enabled_check ())) -#else -#define is_emutramp_enabled() 0 -#endif /* 'allocate_num_pages' is dynamically adjusted starting from one @@ -90,24 +35,14 @@ union mmaped_block *item; Py_ssize_t count, i; -/* determine the pagesize */ -#ifdef MS_WIN32 + /* determine the pagesize */ if (!_pagesize) { SYSTEM_INFO systeminfo; GetSystemInfo(&systeminfo); _pagesize = systeminfo.dwPageSize; + if (_pagesize <= 0) + _pagesize = 4096; } -#else - if (!_pagesize) { -#ifdef _SC_PAGESIZE - _pagesize = sysconf(_SC_PAGESIZE); -#else - _pagesize = getpagesize(); -#endif - } -#endif - if (_pagesize <= 0) - _pagesize = 4096; /* bump 'allocate_num_pages' */ allocate_num_pages = 1 + ( @@ -117,28 +52,12 @@ count = (allocate_num_pages * _pagesize) / sizeof(union mmaped_block); /* allocate a memory block */ -#ifdef MS_WIN32 item = (union mmaped_block *)VirtualAlloc(NULL, count * sizeof(union mmaped_block), MEM_COMMIT, PAGE_EXECUTE_READWRITE); if (item == NULL) return; -#else - { - int prot = PROT_READ | PROT_WRITE | PROT_EXEC; - if (is_emutramp_enabled ()) - prot &= ~PROT_EXEC; - item = (union mmaped_block *)mmap(NULL, - allocate_num_pages * _pagesize, - prot, - MAP_PRIVATE | MAP_ANONYMOUS, - -1, - 0); - if (item == (void *)MAP_FAILED) - return; - } -#endif #ifdef MALLOC_CLOSURE_DEBUG printf("block at %p allocated (%ld bytes), %ld mmaped_blocks\n", @@ -155,7 +74,7 @@ /******************************************************************/ /* put the item back into the free list */ -static void cffi_closure_free(ffi_closure *p) +void ffi_closure_free(void *p) { union mmaped_block *item = (union mmaped_block *)p; item->next = free_list; @@ -163,14 +82,18 @@ } /* return one item from the free list, allocating more if needed */ -static ffi_closure *cffi_closure_alloc(void) +void *ffi_closure_alloc (size_t size, void **code) { union mmaped_block *item; + void *result; + assert(size == sizeof(ffi_closure)); if (!free_list) more_core(); if (!free_list) return NULL; item = free_list; free_list = item->next; - return &item->closure; + result = &item->closure; + *code = result; + return result; } diff --git a/c/misc_win32.h b/c/misc_win32.h --- a/c/misc_win32.h +++ b/c/misc_win32.h @@ -234,8 +234,3 @@ sprintf(buf, "error 0x%x", (unsigned int)dw); return buf; } - -/************************************************************/ -/* obscure */ - -#define ffi_prep_closure(a,b,c,d) ffi_prep_closure_loc(a,b,c,d,a) From noreply at buildbot.pypy.org Tue Nov 10 10:23:26 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 10 Nov 2015 16:23:26 +0100 (CET) Subject: [pypy-commit] cffi ffi_closure_alloc: Fix the logic: must store 'closure_exec' in the c_data field, and the Message-ID: <20151110152326.E9A8B1C089E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: ffi_closure_alloc Changeset: r2377:6e95445ccc62 Date: 2015-11-10 16:24 +0100 http://bitbucket.org/cffi/cffi/changeset/6e95445ccc62/ Log: Fix the logic: must store 'closure_exec' in the c_data field, and the 'closure' in some other new field. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -245,6 +245,11 @@ } CDataObject_gcp; typedef struct { + CDataObject head; + ffi_closure *closure; +} CDataObject_closure; + +typedef struct { ffi_cif cif; /* the following information is used when doing the call: - a buffer of size 'exchange_size' is malloced @@ -1609,8 +1614,8 @@ Py_DECREF(x); } else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) { /* a callback */ - ffi_closure *closure = (ffi_closure *)cd->c_data; - PyObject *args = (PyObject *)(closure->user_data); + ffi_closure *closure = ((CDataObject_closure *)cd)->closure; + PyObject *args = (PyObject *)closure->user_data; Py_XDECREF(args); ffi_closure_free(closure); } @@ -1629,8 +1634,8 @@ Py_VISIT(x); } else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) { /* a callback */ - ffi_closure *closure = (ffi_closure *)cd->c_data; - PyObject *args = (PyObject *)(closure->user_data); + ffi_closure *closure = ((CDataObject_closure *)cd)->closure; + PyObject *args = (PyObject *)closure->user_data; Py_VISIT(args); } else if (cd->c_type->ct_flags & CT_IS_UNSIZED_CHAR_A) { /* from_buffer */ @@ -1649,8 +1654,8 @@ Py_DECREF(x); } else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) { /* a callback */ - ffi_closure *closure = (ffi_closure *)cd->c_data; - PyObject *args = (PyObject *)(closure->user_data); + ffi_closure *closure = ((CDataObject_closure *)cd)->closure; + PyObject *args = (PyObject *)closure->user_data; closure->user_data = NULL; Py_XDECREF(args); } @@ -1837,7 +1842,8 @@ return _cdata_repr2(cd, "handle to", x); } else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) { /* a callback */ - PyObject *args = (PyObject *)((ffi_closure *)cd->c_data)->user_data; + ffi_closure *closure = ((CDataObject_closure *)cd)->closure; + PyObject *args = (PyObject *)closure->user_data; if (args == NULL) return cdata_repr(cd); else @@ -5084,12 +5090,12 @@ static PyObject *b_callback(PyObject *self, PyObject *args) { CTypeDescrObject *ct, *ctresult; - CDataObject *cd; + CDataObject_closure *cd; PyObject *ob, *error_ob = Py_None, *onerror_ob = Py_None; PyObject *py_rawerr, *infotuple = NULL; cif_description_t *cif_descr; ffi_closure *closure; - void *closure_ex; + void *closure_exec; Py_ssize_t size; if (!PyArg_ParseTuple(args, "O!O|OO:callback", &CTypeDescr_Type, &ct, &ob, @@ -5134,15 +5140,20 @@ if (infotuple == NULL) return NULL; - closure = ffi_closure_alloc(sizeof(ffi_closure), &closure_ex); - - cd = PyObject_GC_New(CDataObject, &CDataOwningGC_Type); + closure = ffi_closure_alloc(sizeof(ffi_closure), &closure_exec); + if (closure == NULL) { + Py_DECREF(infotuple); + return NULL; + } + + cd = PyObject_GC_New(CDataObject_closure, &CDataOwningGC_Type); if (cd == NULL) goto error; Py_INCREF(ct); - cd->c_type = ct; - cd->c_data = (char *)closure; - cd->c_weakreflist = NULL; + cd->head.c_type = ct; + cd->head.c_data = (char *)closure_exec; + cd->head.c_weakreflist = NULL; + cd->closure = closure; PyObject_GC_Track(cd); cif_descr = (cif_description_t *)ct->ct_extra; @@ -5153,7 +5164,7 @@ goto error; } if (ffi_prep_closure_loc(closure, &cif_descr->cif, invoke_callback, - infotuple, closure_ex) != FFI_OK) { + infotuple, closure_exec) != FFI_OK) { PyErr_SetString(PyExc_SystemError, "libffi failed to build this callback"); goto error; From noreply at buildbot.pypy.org Tue Nov 10 13:02:15 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 10 Nov 2015 19:02:15 +0100 (CET) Subject: [pypy-commit] pypy no-class-specialize: Close branch no-class-specialize Message-ID: <20151110180215.4778E1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: no-class-specialize Changeset: r80617:e064edccbcbe Date: 2015-11-10 18:03 +0000 http://bitbucket.org/pypy/pypy/changeset/e064edccbcbe/ Log: Close branch no-class-specialize From noreply at buildbot.pypy.org Tue Nov 10 13:02:29 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 10 Nov 2015 19:02:29 +0100 (CET) Subject: [pypy-commit] pypy default: Merged in no-class-specialize (pull request #356) Message-ID: <20151110180229.4B47D1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80618:35771aeee5fc Date: 2015-11-10 18:03 +0000 http://bitbucket.org/pypy/pypy/changeset/35771aeee5fc/ Log: Merged in no-class-specialize (pull request #356) Some refactoring of class handling in the annotator. Remove class specialisation and _settled_ flag. diff too long, truncating to 2000 out of 2956 lines diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -28,7 +28,6 @@ """This is the abstract root class of all wrapped objects that live in a 'normal' object space like StdObjSpace.""" __slots__ = () - _settled_ = True user_overridden_class = False def getdict(self, space): diff --git a/pypy/module/_minimal_curses/interp_curses.py b/pypy/module/_minimal_curses/interp_curses.py --- a/pypy/module/_minimal_curses/interp_curses.py +++ b/pypy/module/_minimal_curses/interp_curses.py @@ -13,7 +13,7 @@ def __init__(self, msg): self.msg = msg -from rpython.annotator.description import FORCE_ATTRIBUTES_INTO_CLASSES +from rpython.annotator.classdesc import FORCE_ATTRIBUTES_INTO_CLASSES from rpython.annotator.model import SomeString # this is necessary due to annmixlevel diff --git a/pypy/module/marshal/interp_marshal.py b/pypy/module/marshal/interp_marshal.py --- a/pypy/module/marshal/interp_marshal.py +++ b/pypy/module/marshal/interp_marshal.py @@ -156,9 +156,6 @@ put_tuple_w(TYPE, tuple_w) puts tuple_w, an unwrapped list of wrapped objects """ - # _annspecialcase_ = "specialize:ctr_location" # polymorphic - # does not work with subclassing - def __init__(self, space, writer, version): self.space = space ## self.put = putfunc diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -2,6 +2,7 @@ from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant from rpython.annotator import specialize +from rpython.annotator.classdesc import InstanceSource, ClassDef @@ -20,7 +21,6 @@ def specialize__wrap(self, funcdesc, args_s): from pypy.interpreter.baseobjspace import W_Root - from rpython.annotator.classdef import ClassDef W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root) typ = args_s[1].knowntype if isinstance(typ, ClassDef): @@ -50,54 +50,34 @@ typ = (None, str) return funcdesc.cachedgraph(typ) - def _remember_immutable(self, t, cached): - # for jit benefit - if cached not in t._immutable_fields_: # accessed this way just - # for convenience - t._immutable_fields_.append(cached) - - def attach_lookup(self, t, attr): - cached = "cached_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup(attr)) - return True - return False - - def attach_lookup_in_type_where(self, t, attr): - cached = "cached_where_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup_where(attr)) - return True - return False - def consider_lookup(self, bookkeeper, attr): - from rpython.annotator.classdef import InstanceSource assert attr not in self.lookups from pypy.objspace.std import typeobject cached = "cached_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant(None) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups[attr] = True def consider_lookup_in_type_where(self, bookkeeper, attr): - from rpython.annotator.classdef import InstanceSource assert attr not in self.lookups_where from pypy.objspace.std import typeobject cached = "cached_where_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant((None, None)) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup_in_type_where(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup_where(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups_where[attr] = True @@ -135,18 +115,19 @@ def event(self, bookkeeper, what, x): from pypy.objspace.std import typeobject if isinstance(x, typeobject.W_TypeObject): - from rpython.annotator.classdef import InstanceSource clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) self.pypytypes[x] = True #print "TYPE", x for attr in self.lookups: - if attr and self.attach_lookup(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_%s" % attr + setattr(x, cached, x._lookup(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) for attr in self.lookups_where: - if attr and self.attach_lookup_in_type_where(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_where_%s" % attr + setattr(x, cached, x._lookup_where(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) return diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -14,8 +14,8 @@ SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint, s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked, - SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty, AnnotatorError) -from rpython.annotator.classdef import InstanceSource, ClassDef + SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty) +from rpython.annotator.classdesc import ClassDef, ClassDesc from rpython.annotator.listdef import ListDef, ListItem from rpython.annotator.dictdef import DictDef from rpython.annotator import description @@ -23,7 +23,6 @@ from rpython.annotator.argument import simple_args from rpython.rlib.objectmodel import r_dict, r_ordereddict, Symbolic from rpython.tool.algo.unionfind import UnionFind -from rpython.tool.flattenrec import FlattenRecursion from rpython.rtyper import extregistry @@ -163,9 +162,7 @@ s_callable.consider_call_site(args, s_result, call_op) def getuniqueclassdef(self, cls): - """Get the ClassDef associated with the given user cls. - Avoid using this! It breaks for classes that must be specialized. - """ + """Get the ClassDef associated with the given user cls.""" assert cls is not object desc = self.getdesc(cls) return desc.getuniqueclassdef() @@ -334,8 +331,9 @@ and x.__class__.__module__ != '__builtin__': if hasattr(x, '_cleanup_'): x._cleanup_() - self.see_mutable(x) - result = SomeInstance(self.getuniqueclassdef(x.__class__)) + classdef = self.getuniqueclassdef(x.__class__) + classdef.see_instance(x) + result = SomeInstance(classdef) elif x is None: return s_None else: @@ -362,7 +360,7 @@ if pyobj.__module__ == '__builtin__': # avoid making classdefs for builtin types result = self.getfrozen(pyobj) else: - result = description.ClassDesc(self, pyobj) + result = ClassDesc(self, pyobj) elif isinstance(pyobj, types.MethodType): if pyobj.im_self is None: # unbound return self.getdesc(pyobj.im_func) @@ -375,11 +373,11 @@ self.getdesc(pyobj.im_self)) # frozendesc else: # regular method origincls, name = origin_of_meth(pyobj) - self.see_mutable(pyobj.im_self) + classdef = self.getuniqueclassdef(pyobj.im_class) + classdef.see_instance(pyobj.im_self) assert pyobj == getattr(pyobj.im_self, name), ( "%r is not %s.%s ??" % (pyobj, pyobj.im_self, name)) # emulate a getattr to make sure it's on the classdef - classdef = self.getuniqueclassdef(pyobj.im_class) classdef.find_attribute(name) result = self.getmethoddesc( self.getdesc(pyobj.im_func), # funcdesc @@ -400,15 +398,6 @@ self.descs[pyobj] = result return result - def have_seen(self, x): - # this might need to expand some more. - if x in self.descs: - return True - elif (x.__class__, x) in self.seen_mutable: - return True - else: - return False - def getfrozen(self, pyobj): return description.FrozenDesc(self, pyobj) @@ -425,22 +414,6 @@ self.methoddescs[key] = result return result - _see_mutable_flattenrec = FlattenRecursion() - - def see_mutable(self, x): - key = (x.__class__, x) - if key in self.seen_mutable: - return - clsdef = self.getuniqueclassdef(x.__class__) - self.seen_mutable[key] = True - self.event('mutable', x) - source = InstanceSource(self, x) - def delayed(): - for attr in source.all_instance_attributes(): - clsdef.add_source_for_attribute(attr, source) - # ^^^ can trigger reflowing - self._see_mutable_flattenrec(delayed) - def valueoftype(self, t): return annotationoftype(t, self) @@ -495,6 +468,20 @@ return s_result + def getattr_locations(self, clsdesc, attrname): + attrdef = clsdesc.classdef.find_attribute(attrname) + return attrdef.read_locations + + def record_getattr(self, clsdesc, attrname): + locations = self.getattr_locations(clsdesc, attrname) + locations.add(self.position_key) + + def update_attr(self, clsdef, attrdef): + locations = self.getattr_locations(clsdef.classdesc, attrdef.name) + for position in locations: + self.annotator.reflowfromposition(position) + attrdef.validate(homedef=clsdef) + def pbc_call(self, pbc, args, emulated=None): """Analyse a call to a SomePBC() with the given args (list of annotations). diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -5,13 +5,14 @@ from collections import OrderedDict from rpython.annotator.model import ( - SomeInteger, SomeObject, SomeChar, SomeBool, SomeString, SomeTuple, + SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple, SomeUnicodeCodePoint, SomeFloat, unionof, SomeUnicodeString, SomePBC, SomeInstance, SomeDict, SomeList, SomeWeakRef, SomeIterator, SomeOrderedDict, SomeByteArray, add_knowntypedata, s_ImpossibleValue,) from rpython.annotator.bookkeeper import ( getbookkeeper, immutablevalue, BUILTIN_ANALYZERS, analyzer_for) from rpython.annotator import description +from rpython.annotator.classdesc import ClassDef from rpython.flowspace.model import Constant import rpython.rlib.rarithmetic import rpython.rlib.objectmodel @@ -124,7 +125,6 @@ def our_issubclass(cls1, cls2): """ we're going to try to be less silly in the face of old-style classes""" - from rpython.annotator.classdef import ClassDef if cls2 is object: return True def classify(cls): diff --git a/rpython/annotator/classdef.py b/rpython/annotator/classdef.py deleted file mode 100644 --- a/rpython/annotator/classdef.py +++ /dev/null @@ -1,434 +0,0 @@ -""" -Type inference for user-defined classes. -""" -from rpython.annotator.model import ( - SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError) -from rpython.annotator import description - - -# The main purpose of a ClassDef is to collect information about class/instance -# attributes as they are really used. An Attribute object is stored in the -# most general ClassDef where an attribute of that name is read/written: -# classdef.attrs = {'attrname': Attribute()} -# -# The following invariants hold: -# -# (A) if an attribute is read/written on an instance of class A, then the -# classdef of A or a parent class of A has an Attribute object corresponding -# to that name. -# -# (I) if B is a subclass of A, then they don't both have an Attribute for the -# same name. (All information from B's Attribute must be merged into A's.) -# -# Additionally, each ClassDef records an 'attr_sources': it maps attribute names -# to a list of 'source' objects that want to provide a constant value for this -# attribute at the level of this class. The attr_sources provide information -# higher in the class hierarchy than concrete Attribute()s. It is for the case -# where (so far or definitely) the user program only reads/writes the attribute -# at the level of a subclass, but a value for this attribute could possibly -# exist in the parent class or in an instance of a parent class. -# -# The point of not automatically forcing the Attribute instance up to the -# parent class which has a class attribute of the same name is apparent with -# multiple subclasses: -# -# A -# attr=s1 -# / \ -# / \ -# B C -# attr=s2 attr=s3 -# -# XXX this does not seem to be correct, but I don't know how to phrase -# it correctly. See test_specific_attributes in test_annrpython -# -# In this case, as long as 'attr' is only read/written from B or C, the -# Attribute on B says that it can be 's1 or s2', and the Attribute on C says -# it can be 's1 or s3'. Merging them into a single Attribute on A would give -# the more imprecise 's1 or s2 or s3'. -# -# The following invariant holds: -# -# (II) if a class A has an Attribute, the 'attr_sources' for the same name is -# empty. It is also empty on all subclasses of A. (The information goes -# into the Attribute directly in this case.) -# -# The following invariant holds: -# -# (III) for a class A, each attrsource that comes from the class (as opposed to -# from a prebuilt instance) must be merged into all Attributes of the -# same name in all subclasses of A, if any. (Parent class attributes can -# be visible in reads from instances of subclasses.) - -class Attribute(object): - # readonly-ness - # SomeThing-ness - # NB. an attribute is readonly if it is a constant class attribute. - # Both writing to the instance attribute and discovering prebuilt - # instances that have the attribute set will turn off readonly-ness. - - def __init__(self, name, bookkeeper): - assert name != '__class__' - self.name = name - self.bookkeeper = bookkeeper - self.s_value = s_ImpossibleValue - self.readonly = True - self.attr_allowed = True - self.read_locations = {} - - def add_constant_source(self, classdef, source): - s_value = source.s_get_value(classdef, self.name) - if source.instance_level: - # a prebuilt instance source forces readonly=False, see above - self.modified(classdef) - s_new_value = unionof(self.s_value, s_value) # XXX "source %r attr %s" % (source, self.name), - self.s_value = s_new_value - - def getvalue(self): - # Same as 'self.s_value' for historical reasons. - return self.s_value - - def merge(self, other, classdef='?'): - assert self.name == other.name - s_new_value = unionof(self.s_value, other.s_value) # XXX "%s attr %s" % (classdef, self.name) - self.s_value = s_new_value - if not other.readonly: - self.modified(classdef) - self.read_locations.update(other.read_locations) - - def mutated(self, homedef): # reflow from attr read positions - s_newvalue = self.getvalue() - - for position in self.read_locations: - self.bookkeeper.annotator.reflowfromposition(position) - - # check for method demotion and after-the-fact method additions - if isinstance(s_newvalue, SomePBC): - attr = self.name - if s_newvalue.getKind() == description.MethodDesc: - # is method - if homedef.classdesc.read_attribute(attr, None) is None: - if not homedef.check_missing_attribute_update(attr): - for desc in s_newvalue.descriptions: - if desc.selfclassdef is None: - if homedef.classdesc.settled: - raise AnnotatorError( - "demoting method %s to settled class " - "%s not allowed" % (self.name, homedef) - ) - break - - # check for attributes forbidden by slots or _attrs_ - if homedef.classdesc.all_enforced_attrs is not None: - if self.name not in homedef.classdesc.all_enforced_attrs: - self.attr_allowed = False - if not self.readonly: - raise NoSuchAttrError( - "the attribute %r goes here to %r, " - "but it is forbidden here" % ( - self.name, homedef)) - - def modified(self, classdef='?'): - self.readonly = False - if not self.attr_allowed: - raise NoSuchAttrError( - "Attribute %r on %r should be read-only.\n" % (self.name, - classdef) + - "This error can be caused by another 'getattr' that promoted\n" - "the attribute here; the list of read locations is:\n" + - '\n'.join([str(loc[0]) for loc in self.read_locations])) - -class ClassDef(object): - "Wraps a user class." - - def __init__(self, bookkeeper, classdesc): - self.bookkeeper = bookkeeper - self.attrs = {} # {name: Attribute} - self.classdesc = classdesc - self.name = self.classdesc.name - self.shortname = self.name.split('.')[-1] - self.subdefs = [] - self.attr_sources = {} # {name: list-of-sources} - self.read_locations_of__class__ = {} - self.repr = None - self.extra_access_sets = {} - - if classdesc.basedesc: - self.basedef = classdesc.basedesc.getuniqueclassdef() - self.basedef.subdefs.append(self) - self.basedef.see_new_subclass(self) - else: - self.basedef = None - - self.parentdefs = dict.fromkeys(self.getmro()) - - def setup(self, sources): - # collect the (supposed constant) class attributes - for name, source in sources.items(): - self.add_source_for_attribute(name, source) - if self.bookkeeper: - self.bookkeeper.event('classdef_setup', self) - - def add_source_for_attribute(self, attr, source): - """Adds information about a constant source for an attribute. - """ - for cdef in self.getmro(): - if attr in cdef.attrs: - # the Attribute() exists already for this class (or a parent) - attrdef = cdef.attrs[attr] - s_prev_value = attrdef.s_value - attrdef.add_constant_source(self, source) - # we should reflow from all the reader's position, - # but as an optimization we try to see if the attribute - # has really been generalized - if attrdef.s_value != s_prev_value: - attrdef.mutated(cdef) # reflow from all read positions - return - else: - # remember the source in self.attr_sources - sources = self.attr_sources.setdefault(attr, []) - sources.append(source) - # register the source in any Attribute found in subclasses, - # to restore invariant (III) - # NB. add_constant_source() may discover new subdefs but the - # right thing will happen to them because self.attr_sources - # was already updated - if not source.instance_level: - for subdef in self.getallsubdefs(): - if attr in subdef.attrs: - attrdef = subdef.attrs[attr] - s_prev_value = attrdef.s_value - attrdef.add_constant_source(self, source) - if attrdef.s_value != s_prev_value: - attrdef.mutated(subdef) # reflow from all read positions - - def locate_attribute(self, attr): - while True: - for cdef in self.getmro(): - if attr in cdef.attrs: - return cdef - self.generalize_attr(attr) - # the return value will likely be 'self' now, but not always -- see - # test_annrpython.test_attr_moving_from_subclass_to_class_to_parent - - def find_attribute(self, attr): - return self.locate_attribute(attr).attrs[attr] - - def __repr__(self): - return "" % (self.name,) - - def has_no_attrs(self): - for clsdef in self.getmro(): - if clsdef.attrs: - return False - return True - - def commonbase(self, other): - while other is not None and not self.issubclass(other): - other = other.basedef - return other - - def getmro(self): - while self is not None: - yield self - self = self.basedef - - def issubclass(self, otherclsdef): - return otherclsdef in self.parentdefs - - def getallsubdefs(self): - pending = [self] - seen = {} - for clsdef in pending: - yield clsdef - for sub in clsdef.subdefs: - if sub not in seen: - pending.append(sub) - seen[sub] = True - - def _generalize_attr(self, attr, s_value): - # first remove the attribute from subclasses -- including us! - # invariant (I) - subclass_attrs = [] - constant_sources = [] # [(classdef-of-origin, source)] - for subdef in self.getallsubdefs(): - if attr in subdef.attrs: - subclass_attrs.append(subdef.attrs[attr]) - del subdef.attrs[attr] - if attr in subdef.attr_sources: - # accumulate attr_sources for this attribute from all subclasses - lst = subdef.attr_sources[attr] - for source in lst: - constant_sources.append((subdef, source)) - del lst[:] # invariant (II) - - # accumulate attr_sources for this attribute from all parents, too - # invariant (III) - for superdef in self.getmro(): - if attr in superdef.attr_sources: - for source in superdef.attr_sources[attr]: - if not source.instance_level: - constant_sources.append((superdef, source)) - - # create the Attribute and do the generalization asked for - newattr = Attribute(attr, self.bookkeeper) - if s_value: - #if newattr.name == 'intval' and getattr(s_value, 'unsigned', False): - # import pdb; pdb.set_trace() - newattr.s_value = s_value - - # keep all subattributes' values - for subattr in subclass_attrs: - newattr.merge(subattr, classdef=self) - - # store this new Attribute, generalizing the previous ones from - # subclasses -- invariant (A) - self.attrs[attr] = newattr - - # add the values of the pending constant attributes - # completes invariants (II) and (III) - for origin_classdef, source in constant_sources: - newattr.add_constant_source(origin_classdef, source) - - # reflow from all read positions - newattr.mutated(self) - - def generalize_attr(self, attr, s_value=None): - # if the attribute exists in a superclass, generalize there, - # as imposed by invariant (I) - for clsdef in self.getmro(): - if attr in clsdef.attrs: - clsdef._generalize_attr(attr, s_value) - break - else: - self._generalize_attr(attr, s_value) - - def about_attribute(self, name): - """This is the interface for the code generators to ask about - the annotation given to a attribute.""" - for cdef in self.getmro(): - if name in cdef.attrs: - s_result = cdef.attrs[name].s_value - if s_result != s_ImpossibleValue: - return s_result - else: - return None - return None - - def lookup_filter(self, pbc, name=None, flags={}): - """Selects the methods in the pbc that could possibly be seen by - a lookup performed on an instance of 'self', removing the ones - that cannot appear. - """ - d = [] - uplookup = None - updesc = None - for desc in pbc.descriptions: - # pick methods but ignore already-bound methods, which can come - # from an instance attribute - if (isinstance(desc, description.MethodDesc) - and desc.selfclassdef is None): - methclassdef = desc.originclassdef - if methclassdef is not self and methclassdef.issubclass(self): - pass # subclasses methods are always candidates - elif self.issubclass(methclassdef): - # upward consider only the best match - if uplookup is None or methclassdef.issubclass(uplookup): - uplookup = methclassdef - updesc = desc - continue - # for clsdef1 >= clsdef2, we guarantee that - # clsdef1.lookup_filter(pbc) includes - # clsdef2.lookup_filter(pbc) (see formal proof...) - else: - continue # not matching - # bind the method by giving it a selfclassdef. Use the - # more precise subclass that it's coming from. - desc = desc.bind_self(methclassdef, flags) - d.append(desc) - if uplookup is not None: - d.append(updesc.bind_self(self, flags)) - - if d: - return SomePBC(d, can_be_None=pbc.can_be_None) - elif pbc.can_be_None: - return s_None - else: - return s_ImpossibleValue - - def check_missing_attribute_update(self, name): - # haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaack - # sometimes, new methods can show up on classes, added - # e.g. by W_TypeObject._freeze_() -- the multimethod - # implementations. Check that here... - found = False - parents = list(self.getmro()) - parents.reverse() - for base in parents: - if base.check_attr_here(name): - found = True - return found - - def check_attr_here(self, name): - source = self.classdesc.find_source_for(name) - if source is not None: - # oups! new attribute showed up - self.add_source_for_attribute(name, source) - # maybe it also showed up in some subclass? - for subdef in self.getallsubdefs(): - if subdef is not self: - subdef.check_attr_here(name) - return True - else: - return False - - def see_new_subclass(self, classdef): - for position in self.read_locations_of__class__: - self.bookkeeper.annotator.reflowfromposition(position) - if self.basedef is not None: - self.basedef.see_new_subclass(classdef) - - def read_attr__class__(self): - position = self.bookkeeper.position_key - self.read_locations_of__class__[position] = True - return SomePBC([subdef.classdesc for subdef in self.getallsubdefs()]) - - def _freeze_(self): - raise Exception("ClassDefs are used as knowntype for instances but cannot be used as immutablevalue arguments directly") - -# ____________________________________________________________ - -class InstanceSource(object): - instance_level = True - - def __init__(self, bookkeeper, obj): - self.bookkeeper = bookkeeper - self.obj = obj - - def s_get_value(self, classdef, name): - try: - v = getattr(self.obj, name) - except AttributeError: - all_enforced_attrs = classdef.classdesc.all_enforced_attrs - if all_enforced_attrs and name in all_enforced_attrs: - return s_ImpossibleValue - raise - s_value = self.bookkeeper.immutablevalue(v) - return s_value - - def all_instance_attributes(self): - result = getattr(self.obj, '__dict__', {}).keys() - tp = self.obj.__class__ - if isinstance(tp, type): - for basetype in tp.__mro__: - slots = basetype.__dict__.get('__slots__') - if slots: - if isinstance(slots, str): - result.append(slots) - else: - result.extend(slots) - return result - -class NoSuchAttrError(AnnotatorError): - """Raised when an attribute is found on a class where __slots__ - or _attrs_ forbits it.""" diff --git a/rpython/annotator/classdesc.py b/rpython/annotator/classdesc.py new file mode 100644 --- /dev/null +++ b/rpython/annotator/classdesc.py @@ -0,0 +1,944 @@ +""" +Type inference for user-defined classes. +""" +from __future__ import absolute_import +import types + +from rpython.flowspace.model import Constant +from rpython.tool.flattenrec import FlattenRecursion +from rpython.tool.sourcetools import func_with_new_name +from rpython.tool.uid import Hashable +from rpython.annotator.model import ( + SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError, SomeInteger, + SomeString, SomeImpossibleValue, SomeList, HarmlesslyBlocked) +from rpython.annotator.description import ( + Desc, FunctionDesc, MethodDesc, NODEFAULT) + + +# The main purpose of a ClassDef is to collect information about class/instance +# attributes as they are really used. An Attribute object is stored in the +# most general ClassDef where an attribute of that name is read/written: +# classdef.attrs = {'attrname': Attribute()} +# +# The following invariants hold: +# +# (A) if an attribute is read/written on an instance of class A, then the +# classdef of A or a parent class of A has an Attribute object corresponding +# to that name. +# +# (I) if B is a subclass of A, then they don't both have an Attribute for the +# same name. (All information from B's Attribute must be merged into A's.) +# +# Additionally, each ClassDef records an 'attr_sources': it maps attribute names +# to a list of 'source' objects that want to provide a constant value for this +# attribute at the level of this class. The attr_sources provide information +# higher in the class hierarchy than concrete Attribute()s. It is for the case +# where (so far or definitely) the user program only reads/writes the attribute +# at the level of a subclass, but a value for this attribute could possibly +# exist in the parent class or in an instance of a parent class. +# +# The point of not automatically forcing the Attribute instance up to the +# parent class which has a class attribute of the same name is apparent with +# multiple subclasses: +# +# A +# attr=s1 +# / \ +# / \ +# B C +# attr=s2 attr=s3 +# +# XXX this does not seem to be correct, but I don't know how to phrase +# it correctly. See test_specific_attributes in test_annrpython +# +# In this case, as long as 'attr' is only read/written from B or C, the +# Attribute on B says that it can be 's1 or s2', and the Attribute on C says +# it can be 's1 or s3'. Merging them into a single Attribute on A would give +# the more imprecise 's1 or s2 or s3'. +# +# The following invariant holds: +# +# (II) if a class A has an Attribute, the 'attr_sources' for the same name is +# empty. It is also empty on all subclasses of A. (The information goes +# into the Attribute directly in this case.) +# +# The following invariant holds: +# +# (III) for a class A, each attrsource that comes from the class (as opposed to +# from a prebuilt instance) must be merged into all Attributes of the +# same name in all subclasses of A, if any. (Parent class attributes can +# be visible in reads from instances of subclasses.) + +class Attribute(object): + # readonly-ness + # SomeThing-ness + # NB. an attribute is readonly if it is a constant class attribute. + # Both writing to the instance attribute and discovering prebuilt + # instances that have the attribute set will turn off readonly-ness. + + def __init__(self, name): + assert name != '__class__' + self.name = name + self.s_value = s_ImpossibleValue + self.readonly = True + self.attr_allowed = True + self.read_locations = set() + + def add_constant_source(self, classdef, source): + s_value = source.s_get_value(classdef, self.name) + if source.instance_level: + # a prebuilt instance source forces readonly=False, see above + self.modified(classdef) + s_new_value = unionof(self.s_value, s_value) + self.s_value = s_new_value + + def merge(self, other, classdef): + assert self.name == other.name + s_new_value = unionof(self.s_value, other.s_value) + self.s_value = s_new_value + if not other.readonly: + self.modified(classdef) + self.read_locations.update(other.read_locations) + + def validate(self, homedef): + s_newvalue = self.s_value + # check for after-the-fact method additions + if isinstance(s_newvalue, SomePBC): + attr = self.name + if s_newvalue.getKind() == MethodDesc: + # is method + if homedef.classdesc.read_attribute(attr, None) is None: + homedef.check_missing_attribute_update(attr) + + # check for attributes forbidden by slots or _attrs_ + if homedef.classdesc.all_enforced_attrs is not None: + if self.name not in homedef.classdesc.all_enforced_attrs: + self.attr_allowed = False + if not self.readonly: + raise NoSuchAttrError( + "the attribute %r goes here to %r, but it is " + "forbidden here" % (self.name, homedef)) + + def modified(self, classdef='?'): + self.readonly = False + if not self.attr_allowed: + from rpython.annotator.bookkeeper import getbookkeeper + bk = getbookkeeper() + classdesc = classdef.classdesc + locations = bk.getattr_locations(classdesc, self.name) + raise NoSuchAttrError( + "Attribute %r on %r should be read-only.\n" % (self.name, + classdef) + + "This error can be caused by another 'getattr' that promoted\n" + "the attribute here; the list of read locations is:\n" + + '\n'.join([str(loc[0]) for loc in locations])) + +class ClassDef(object): + "Wraps a user class." + + def __init__(self, bookkeeper, classdesc): + self.bookkeeper = bookkeeper + self.attrs = {} # {name: Attribute} + self.classdesc = classdesc + self.name = self.classdesc.name + self.shortname = self.name.split('.')[-1] + self.subdefs = [] + self.attr_sources = {} # {name: list-of-sources} + self.read_locations_of__class__ = {} + self.repr = None + self.extra_access_sets = {} + self.instances_seen = set() + + if classdesc.basedesc: + self.basedef = classdesc.basedesc.getuniqueclassdef() + self.basedef.subdefs.append(self) + self.basedef.see_new_subclass(self) + else: + self.basedef = None + + self.parentdefs = dict.fromkeys(self.getmro()) + + def setup(self, sources): + # collect the (supposed constant) class attributes + for name, source in sources.items(): + self.add_source_for_attribute(name, source) + if self.bookkeeper: + self.bookkeeper.event('classdef_setup', self) + + def s_getattr(self, attrname, flags): + attrdef = self.find_attribute(attrname) + s_result = attrdef.s_value + # hack: if s_result is a set of methods, discard the ones + # that can't possibly apply to an instance of self. + # XXX do it more nicely + if isinstance(s_result, SomePBC): + s_result = self.lookup_filter(s_result, attrname, flags) + elif isinstance(s_result, SomeImpossibleValue): + self.check_missing_attribute_update(attrname) + # blocking is harmless if the attribute is explicitly listed + # in the class or a parent class. + for basedef in self.getmro(): + if basedef.classdesc.all_enforced_attrs is not None: + if attrname in basedef.classdesc.all_enforced_attrs: + raise HarmlesslyBlocked("get enforced attr") + elif isinstance(s_result, SomeList): + s_result = self.classdesc.maybe_return_immutable_list( + attrname, s_result) + return s_result + + def add_source_for_attribute(self, attr, source): + """Adds information about a constant source for an attribute. + """ + for cdef in self.getmro(): + if attr in cdef.attrs: + # the Attribute() exists already for this class (or a parent) + attrdef = cdef.attrs[attr] + s_prev_value = attrdef.s_value + attrdef.add_constant_source(self, source) + # we should reflow from all the reader's position, + # but as an optimization we try to see if the attribute + # has really been generalized + if attrdef.s_value != s_prev_value: + self.bookkeeper.update_attr(cdef, attrdef) + return + else: + # remember the source in self.attr_sources + sources = self.attr_sources.setdefault(attr, []) + sources.append(source) + # register the source in any Attribute found in subclasses, + # to restore invariant (III) + # NB. add_constant_source() may discover new subdefs but the + # right thing will happen to them because self.attr_sources + # was already updated + if not source.instance_level: + for subdef in self.getallsubdefs(): + if attr in subdef.attrs: + attrdef = subdef.attrs[attr] + s_prev_value = attrdef.s_value + attrdef.add_constant_source(self, source) + if attrdef.s_value != s_prev_value: + self.bookkeeper.update_attr(subdef, attrdef) + + def get_owner(self, attrname): + """Return the classdef owning the attribute `attrname`.""" + for cdef in self.getmro(): + if attrname in cdef.attrs: + return cdef + else: + return None + + + def locate_attribute(self, attr): + cdef = self.get_owner(attr) + if cdef: + return cdef + else: + self._generalize_attr(attr, s_value=None) + return self + + def find_attribute(self, attr): + return self.locate_attribute(attr).attrs[attr] + + def __repr__(self): + return "" % (self.name,) + + def has_no_attrs(self): + for clsdef in self.getmro(): + if clsdef.attrs: + return False + return True + + def commonbase(self, other): + while other is not None and not self.issubclass(other): + other = other.basedef + return other + + def getmro(self): + while self is not None: + yield self + self = self.basedef + + def issubclass(self, otherclsdef): + return otherclsdef in self.parentdefs + + def getallsubdefs(self): + pending = [self] + seen = {} + for clsdef in pending: + yield clsdef + for sub in clsdef.subdefs: + if sub not in seen: + pending.append(sub) + seen[sub] = True + + def _generalize_attr(self, attr, s_value): + # create the Attribute and do the generalization asked for + newattr = Attribute(attr) + if s_value: + newattr.s_value = s_value + + # remove the attribute from subclasses -- including us! + # invariant (I) + constant_sources = [] # [(classdef-of-origin, source)] + for subdef in self.getallsubdefs(): + if attr in subdef.attrs: + subattr = subdef.attrs[attr] + newattr.merge(subattr, classdef=self) + del subdef.attrs[attr] + if attr in subdef.attr_sources: + # accumulate attr_sources for this attribute from all subclasses + lst = subdef.attr_sources[attr] + for source in lst: + constant_sources.append((subdef, source)) + del lst[:] # invariant (II) + + # accumulate attr_sources for this attribute from all parents, too + # invariant (III) + for superdef in self.getmro(): + if attr in superdef.attr_sources: + for source in superdef.attr_sources[attr]: + if not source.instance_level: + constant_sources.append((superdef, source)) + + # store this new Attribute, generalizing the previous ones from + # subclasses -- invariant (A) + self.attrs[attr] = newattr + + # add the values of the pending constant attributes + # completes invariants (II) and (III) + for origin_classdef, source in constant_sources: + newattr.add_constant_source(origin_classdef, source) + + # reflow from all read positions + self.bookkeeper.update_attr(self, newattr) + + def generalize_attr(self, attr, s_value=None): + # if the attribute exists in a superclass, generalize there, + # as imposed by invariant (I) + clsdef = self.get_owner(attr) + if clsdef: + clsdef._generalize_attr(attr, s_value) + else: + self._generalize_attr(attr, s_value) + + def about_attribute(self, name): + """This is the interface for the code generators to ask about + the annotation given to a attribute.""" + for cdef in self.getmro(): + if name in cdef.attrs: + s_result = cdef.attrs[name].s_value + if s_result != s_ImpossibleValue: + return s_result + else: + return None + return None + + def lookup_filter(self, pbc, name=None, flags={}): + """Selects the methods in the pbc that could possibly be seen by + a lookup performed on an instance of 'self', removing the ones + that cannot appear. + """ + d = [] + uplookup = None + updesc = None + for desc in pbc.descriptions: + # pick methods but ignore already-bound methods, which can come + # from an instance attribute + if (isinstance(desc, MethodDesc) and desc.selfclassdef is None): + methclassdef = desc.originclassdef + if methclassdef is not self and methclassdef.issubclass(self): + pass # subclasses methods are always candidates + elif self.issubclass(methclassdef): + # upward consider only the best match + if uplookup is None or methclassdef.issubclass(uplookup): + uplookup = methclassdef + updesc = desc + continue + # for clsdef1 >= clsdef2, we guarantee that + # clsdef1.lookup_filter(pbc) includes + # clsdef2.lookup_filter(pbc) (see formal proof...) + else: + continue # not matching + # bind the method by giving it a selfclassdef. Use the + # more precise subclass that it's coming from. + desc = desc.bind_self(methclassdef, flags) + d.append(desc) + if uplookup is not None: + d.append(updesc.bind_self(self, flags)) + + if d: + return SomePBC(d, can_be_None=pbc.can_be_None) + elif pbc.can_be_None: + return s_None + else: + return s_ImpossibleValue + + def check_missing_attribute_update(self, name): + # haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaack + # sometimes, new methods can show up on classes, added + # e.g. by W_TypeObject._freeze_() -- the multimethod + # implementations. Check that here... + found = False + parents = list(self.getmro()) + parents.reverse() + for base in parents: + if base.check_attr_here(name): + found = True + return found + + def check_attr_here(self, name): + source = self.classdesc.find_source_for(name) + if source is not None: + # oups! new attribute showed up + self.add_source_for_attribute(name, source) + # maybe it also showed up in some subclass? + for subdef in self.getallsubdefs(): + if subdef is not self: + subdef.check_attr_here(name) + return True + else: + return False + + _see_instance_flattenrec = FlattenRecursion() + + def see_instance(self, x): + assert isinstance(x, self.classdesc.pyobj) + key = Hashable(x) + if key in self.instances_seen: + return + self.instances_seen.add(key) + self.bookkeeper.event('mutable', x) + source = InstanceSource(self.bookkeeper, x) + def delayed(): + for attr in source.all_instance_attributes(): + self.add_source_for_attribute(attr, source) + # ^^^ can trigger reflowing + self._see_instance_flattenrec(delayed) + + def see_new_subclass(self, classdef): + for position in self.read_locations_of__class__: + self.bookkeeper.annotator.reflowfromposition(position) + if self.basedef is not None: + self.basedef.see_new_subclass(classdef) + + def read_attr__class__(self): + position = self.bookkeeper.position_key + self.read_locations_of__class__[position] = True + return SomePBC([subdef.classdesc for subdef in self.getallsubdefs()]) + + def _freeze_(self): + raise Exception("ClassDefs are used as knowntype for instances but " + "cannot be used as immutablevalue arguments directly") + +# ____________________________________________________________ + +class InstanceSource(object): + instance_level = True + + def __init__(self, bookkeeper, obj): + self.bookkeeper = bookkeeper + self.obj = obj + + def s_get_value(self, classdef, name): + try: + v = getattr(self.obj, name) + except AttributeError: + all_enforced_attrs = classdef.classdesc.all_enforced_attrs + if all_enforced_attrs and name in all_enforced_attrs: + return s_ImpossibleValue + raise + s_value = self.bookkeeper.immutablevalue(v) + return s_value + + def all_instance_attributes(self): + result = getattr(self.obj, '__dict__', {}).keys() + tp = self.obj.__class__ + if isinstance(tp, type): + for basetype in tp.__mro__: + slots = basetype.__dict__.get('__slots__') + if slots: + if isinstance(slots, str): + result.append(slots) + else: + result.extend(slots) + return result + +class NoSuchAttrError(AnnotatorError): + """Raised when an attribute is found on a class where __slots__ + or _attrs_ forbits it.""" + + +def is_mixin(cls): + return cls.__dict__.get('_mixin_', False) + + +class ClassDesc(Desc): + knowntype = type + instance_level = False + all_enforced_attrs = None # or a set + _detect_invalid_attrs = None + + def __init__(self, bookkeeper, cls, + name=None, basedesc=None, classdict=None): + super(ClassDesc, self).__init__(bookkeeper, cls) + if '__NOT_RPYTHON__' in cls.__dict__: + raise AnnotatorError('Bad class') + + if name is None: + name = cls.__module__ + '.' + cls.__name__ + self.name = name + self.basedesc = basedesc + if classdict is None: + classdict = {} # populated below + self.classdict = classdict # {attr: Constant-or-Desc} + if cls.__dict__.get('_annspecialcase_', ''): + raise AnnotatorError( + "Class specialization has been removed. The " + "'_annspecialcase_' class tag is now unsupported.") + self.classdef = None + + if is_mixin(cls): + raise AnnotatorError("cannot use directly the class %r because " + "it is a _mixin_" % (cls,)) + + assert cls.__module__ != '__builtin__' + baselist = list(cls.__bases__) + + # special case: skip BaseException, and pretend + # that all exceptions ultimately inherit from Exception instead + # of BaseException (XXX hack) + if cls is Exception: + baselist = [] + elif baselist == [BaseException]: + baselist = [Exception] + + immutable_fields = cls.__dict__.get('_immutable_fields_', []) + # To prevent confusion, we forbid strings. Any other bona fide sequence + # of strings is OK. + if isinstance(immutable_fields, basestring): + raise AnnotatorError( + "In class %s, '_immutable_fields_' must be a sequence of " + "attribute names, not a string." % cls) + self.immutable_fields = set(immutable_fields) + + mixins_before = [] + mixins_after = [] + base = object + for b1 in baselist: + if b1 is object: + continue + if is_mixin(b1): + if base is object: + mixins_before.append(b1) + else: + mixins_after.append(b1) + else: + assert base is object, ("multiple inheritance only supported " + "with _mixin_: %r" % (cls,)) + base = b1 + if mixins_before and mixins_after: + raise Exception("unsupported: class %r has mixin bases both" + " before and after the regular base" % (self,)) + self.add_mixins(mixins_after, check_not_in=base) + self.add_mixins(mixins_before) + self.add_sources_for_class(cls) + + if base is not object: + self.basedesc = bookkeeper.getdesc(base) + + if '__slots__' in cls.__dict__ or '_attrs_' in cls.__dict__: + attrs = {} + for decl in ('__slots__', '_attrs_'): + decl = cls.__dict__.get(decl, []) + if isinstance(decl, str): + decl = (decl,) + decl = dict.fromkeys(decl) + attrs.update(decl) + if self.basedesc is not None: + if self.basedesc.all_enforced_attrs is None: + raise Exception("%r has slots or _attrs_, " + "but not its base class" % (cls,)) + attrs.update(self.basedesc.all_enforced_attrs) + self.all_enforced_attrs = attrs + + if (self.is_builtin_exception_class() and + self.all_enforced_attrs is None): + if cls not in FORCE_ATTRIBUTES_INTO_CLASSES: + self.all_enforced_attrs = [] # no attribute allowed + + def add_source_attribute(self, name, value, mixin=False): + if isinstance(value, property): + # special case for property object + if value.fget is not None: + newname = name + '__getter__' + func = func_with_new_name(value.fget, newname) + self.add_source_attribute(newname, func, mixin) + if value.fset is not None: + newname = name + '__setter__' + func = func_with_new_name(value.fset, newname) + self.add_source_attribute(newname, func, mixin) + self.classdict[name] = Constant(value) + return + + if isinstance(value, types.FunctionType): + # for debugging + if not hasattr(value, 'class_'): + value.class_ = self.pyobj + if mixin: + # make a new copy of the FunctionDesc for this class, + # but don't specialize further for all subclasses + funcdesc = FunctionDesc(self.bookkeeper, value) + self.classdict[name] = funcdesc + return + # NB. if value is, say, AssertionError.__init__, then we + # should not use getdesc() on it. Never. The problem is + # that the py lib has its own AssertionError.__init__ which + # is of type FunctionType. But bookkeeper.immutablevalue() + # will do the right thing in s_get_value(). + if isinstance(value, staticmethod) and mixin: + # make a new copy of staticmethod + func = value.__get__(42) + value = staticmethod(func_with_new_name(func, func.__name__)) + + if type(value) in MemberDescriptorTypes: + # skip __slots__, showing up in the class as 'member' objects + return + if name == '__init__' and self.is_builtin_exception_class(): + # pretend that built-in exceptions have no __init__, + # unless explicitly specified in builtin.py + from rpython.annotator.builtin import BUILTIN_ANALYZERS + value = getattr(value, 'im_func', value) + if value not in BUILTIN_ANALYZERS: + return + self.classdict[name] = Constant(value) + + def add_mixins(self, mixins, check_not_in=object): + if not mixins: + return + A = type('tmp', tuple(mixins) + (object,), {}) + mro = A.__mro__ + assert mro[0] is A and mro[-1] is object + mro = mro[1:-1] + # + skip = set() + def add(cls): + if cls is not object: + for base in cls.__bases__: + add(base) + for name in cls.__dict__: + skip.add(name) + add(check_not_in) + # + for base in reversed(mro): + assert is_mixin(base), ( + "Mixin class %r has non mixin base class %r" % (mixins, base)) + for name, value in base.__dict__.items(): + if name in skip: + continue + self.add_source_attribute(name, value, mixin=True) + if '_immutable_fields_' in base.__dict__: + self.immutable_fields.update( + set(base.__dict__['_immutable_fields_'])) + + + def add_sources_for_class(self, cls): + for name, value in cls.__dict__.items(): + self.add_source_attribute(name, value) + + def getclassdef(self, key): + return self.getuniqueclassdef() + + def _init_classdef(self): + classdef = ClassDef(self.bookkeeper, self) + self.bookkeeper.classdefs.append(classdef) + self.classdef = classdef + + # forced attributes + cls = self.pyobj + if cls in FORCE_ATTRIBUTES_INTO_CLASSES: + for name, s_value in FORCE_ATTRIBUTES_INTO_CLASSES[cls].items(): + classdef.generalize_attr(name, s_value) + classdef.find_attribute(name).modified(classdef) + + # register all class attributes as coming from this ClassDesc + # (as opposed to prebuilt instances) + classsources = {} + for attr in self.classdict: + classsources[attr] = self # comes from this ClassDesc + classdef.setup(classsources) + # look for a __del__ method and annotate it if it's there + if '__del__' in self.classdict: + from rpython.annotator.model import s_None, SomeInstance + s_func = self.s_read_attribute('__del__') + args_s = [SomeInstance(classdef)] + s = self.bookkeeper.emulate_pbc_call(classdef, s_func, args_s) + assert s_None.contains(s) + return classdef + + def getuniqueclassdef(self): + if self.classdef is None: + self._init_classdef() + return self.classdef + + def pycall(self, whence, args, s_previous_result, op=None): + from rpython.annotator.model import SomeInstance, SomeImpossibleValue + classdef = self.getuniqueclassdef() + s_instance = SomeInstance(classdef) + # look up __init__ directly on the class, bypassing the normal + # lookup mechanisms ClassDef (to avoid influencing Attribute placement) + s_init = self.s_read_attribute('__init__') + if isinstance(s_init, SomeImpossibleValue): + # no __init__: check that there are no constructor args + if not self.is_exception_class(): + try: + args.fixedunpack(0) + except ValueError: + raise Exception("default __init__ takes no argument" + " (class %s)" % (self.name,)) + elif self.pyobj is Exception: + # check explicitly against "raise Exception, x" where x + # is a low-level exception pointer + try: + [s_arg] = args.fixedunpack(1) + except ValueError: + pass + else: + from rpython.rtyper.llannotation import SomePtr + assert not isinstance(s_arg, SomePtr) + else: + # call the constructor + args = args.prepend(s_instance) + s_init.call(args) + return s_instance + + def is_exception_class(self): + return issubclass(self.pyobj, BaseException) + + def is_builtin_exception_class(self): + if self.is_exception_class(): + if self.pyobj.__module__ == 'exceptions': + return True + if issubclass(self.pyobj, AssertionError): + return True + return False + + def lookup(self, name): + cdesc = self + while name not in cdesc.classdict: + cdesc = cdesc.basedesc + if cdesc is None: + return None + else: + return cdesc + + def get_param(self, name, default=None, inherit=True): + cls = self.pyobj + if inherit: + return getattr(cls, name, default) + else: + return cls.__dict__.get(name, default) + + def read_attribute(self, name, default=NODEFAULT): + cdesc = self.lookup(name) + if cdesc is None: + if default is NODEFAULT: + raise AttributeError + else: + return default + else: + return cdesc.classdict[name] + + def s_read_attribute(self, name): + # look up an attribute in the class + cdesc = self.lookup(name) + if cdesc is None: + return s_ImpossibleValue + else: + # delegate to s_get_value to turn it into an annotation + return cdesc.s_get_value(None, name) + + def s_get_value(self, classdef, name): + obj = self.classdict[name] + if isinstance(obj, Constant): + value = obj.value + if isinstance(value, staticmethod): # special case + value = value.__get__(42) + classdef = None # don't bind + elif isinstance(value, classmethod): + raise AnnotatorError("classmethods are not supported") + s_value = self.bookkeeper.immutablevalue(value) + if classdef is not None: + s_value = s_value.bind_callables_under(classdef, name) + elif isinstance(obj, Desc): + if classdef is not None: + obj = obj.bind_under(classdef, name) + s_value = SomePBC([obj]) + else: + raise TypeError("classdict should not contain %r" % (obj,)) + return s_value + + def create_new_attribute(self, name, value): + assert name not in self.classdict, "name clash: %r" % (name,) + self.classdict[name] = Constant(value) + + def find_source_for(self, name): + if name in self.classdict: + return self + # check whether there is a new attribute + cls = self.pyobj + if name in cls.__dict__: + self.add_source_attribute(name, cls.__dict__[name]) + if name in self.classdict: + return self + return None + + def maybe_return_immutable_list(self, attr, s_result): + # hack: 'x.lst' where lst is listed in _immutable_fields_ as + # either 'lst[*]' or 'lst?[*]' + # should really return an immutable list as a result. Implemented + # by changing the result's annotation (but not, of course, doing an + # actual copy in the rtyper). Tested in rpython.rtyper.test.test_rlist, + # test_immutable_list_out_of_instance. + if self._detect_invalid_attrs and attr in self._detect_invalid_attrs: + raise Exception("field %r was migrated to %r from a subclass in " + "which it was declared as _immutable_fields_" % + (attr, self.pyobj)) + search1 = '%s[*]' % (attr,) + search2 = '%s?[*]' % (attr,) + cdesc = self + while cdesc is not None: + immutable_fields = cdesc.immutable_fields + if immutable_fields: + if (search1 in immutable_fields or search2 in immutable_fields): + s_result.listdef.never_resize() + s_copy = s_result.listdef.offspring() + s_copy.listdef.mark_as_immutable() + # + cdesc = cdesc.basedesc + while cdesc is not None: + if cdesc._detect_invalid_attrs is None: + cdesc._detect_invalid_attrs = set() + cdesc._detect_invalid_attrs.add(attr) + cdesc = cdesc.basedesc + # + return s_copy + cdesc = cdesc.basedesc + return s_result # common case + + @staticmethod + def consider_call_site(descs, args, s_result, op): + descs[0].getcallfamily() + descs[0].mergecallfamilies(*descs[1:]) + from rpython.annotator.model import SomeInstance, SomePBC, s_None + if len(descs) == 1: + # call to a single class, look at the result annotation + # in case it was specialized + if not isinstance(s_result, SomeInstance): + raise Exception("calling a class didn't return an instance??") + classdefs = [s_result.classdef] + else: + # call to multiple classes: specialization not supported + classdefs = [desc.getuniqueclassdef() for desc in descs] + # If some of the classes have an __init__ and others not, then + # we complain, even though in theory it could work if all the + # __init__s take no argument. But it's messy to implement, so + # let's just say it is not RPython and you have to add an empty + # __init__ to your base class. + has_init = False + for desc in descs: + s_init = desc.s_read_attribute('__init__') + has_init |= isinstance(s_init, SomePBC) + basedesc = ClassDesc.getcommonbase(descs) + s_init = basedesc.s_read_attribute('__init__') + parent_has_init = isinstance(s_init, SomePBC) + if has_init and not parent_has_init: + raise AnnotatorError( + "some subclasses among %r declare __init__()," + " but not the common parent class" % (descs,)) + # make a PBC of MethodDescs, one for the __init__ of each class + initdescs = [] + for desc, classdef in zip(descs, classdefs): + s_init = desc.s_read_attribute('__init__') + if isinstance(s_init, SomePBC): + assert len(s_init.descriptions) == 1, ( + "unexpected dynamic __init__?") + initfuncdesc, = s_init.descriptions + if isinstance(initfuncdesc, FunctionDesc): + from rpython.annotator.bookkeeper import getbookkeeper + initmethdesc = getbookkeeper().getmethoddesc( + initfuncdesc, classdef, classdef, '__init__') + initdescs.append(initmethdesc) + # register a call to exactly these __init__ methods + if initdescs: + initdescs[0].mergecallfamilies(*initdescs[1:]) + MethodDesc.consider_call_site(initdescs, args, s_None, op) + + def getallbases(self): + desc = self + while desc is not None: + yield desc + desc = desc.basedesc + + @staticmethod + def getcommonbase(descs): + commondesc = descs[0] + for desc in descs[1:]: + allbases = set(commondesc.getallbases()) + while desc not in allbases: + assert desc is not None, "no common base for %r" % (descs,) + desc = desc.basedesc + commondesc = desc + return commondesc + + def rowkey(self): + return self + + def getattrfamily(self, attrname): + "Get the ClassAttrFamily object for attrname. Possibly creates one." + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + _, _, attrfamily = access_sets.find(self) + return attrfamily + + def queryattrfamily(self, attrname): + """Retrieve the ClassAttrFamily object for attrname if there is one, + otherwise return None.""" + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + try: + return access_sets[self] + except KeyError: + return None + + def mergeattrfamilies(self, others, attrname): + """Merge the attr families of the given Descs into one.""" + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + changed, rep, attrfamily = access_sets.find(self) + for desc in others: + changed1, rep, attrfamily = access_sets.union(rep, desc) + changed = changed or changed1 + return changed + +# ____________________________________________________________ + +class Sample(object): + __slots__ = 'x' +MemberDescriptorTypes = [type(Sample.x)] +del Sample +try: + MemberDescriptorTypes.append(type(OSError.errno)) +except AttributeError: # on CPython <= 2.4 + pass + +# ____________________________________________________________ + +FORCE_ATTRIBUTES_INTO_CLASSES = { + EnvironmentError: {'errno': SomeInteger(), + 'strerror': SomeString(can_be_None=True), + 'filename': SomeString(can_be_None=True)}, +} + +try: + WindowsError +except NameError: + pass +else: + FORCE_ATTRIBUTES_INTO_CLASSES[WindowsError] = {'winerror': SomeInteger()} diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py --- a/rpython/annotator/description.py +++ b/rpython/annotator/description.py @@ -2,13 +2,12 @@ import types from rpython.annotator.signature import ( enforce_signature_args, enforce_signature_return, finish_type) -from rpython.flowspace.model import Constant, FunctionGraph +from rpython.flowspace.model import FunctionGraph from rpython.flowspace.bytecode import cpython_code_signature from rpython.annotator.argument import rawshape, ArgErr, simple_args -from rpython.tool.sourcetools import valid_identifier, func_with_new_name +from rpython.tool.sourcetools import valid_identifier from rpython.tool.pairtype import extendabletype -from rpython.annotator.model import ( - AnnotatorError, SomeInteger, SomeString, s_ImpossibleValue) +from rpython.annotator.model import AnnotatorError, s_ImpossibleValue class CallFamily(object): """A family of Desc objects that could be called from common call sites. @@ -188,6 +187,8 @@ class NoStandardGraph(Exception): """The function doesn't have a single standard non-specialized graph.""" +NODEFAULT = object() + class FunctionDesc(Desc): knowntype = types.FunctionType @@ -404,469 +405,6 @@ return s_sigs -def is_mixin(cls): - return cls.__dict__.get('_mixin_', False) - -NODEFAULT = object() - -class ClassDesc(Desc): - knowntype = type - instance_level = False - all_enforced_attrs = None # or a set - settled = False - _detect_invalid_attrs = None - - def __init__(self, bookkeeper, cls, - name=None, basedesc=None, classdict=None, - specialize=None): - super(ClassDesc, self).__init__(bookkeeper, cls) - if '__NOT_RPYTHON__' in cls.__dict__: - raise AnnotatorError('Bad class') - - if name is None: - name = cls.__module__ + '.' + cls.__name__ - self.name = name - self.basedesc = basedesc - if classdict is None: - classdict = {} # populated below - self.classdict = classdict # {attr: Constant-or-Desc} - if specialize is None: - specialize = cls.__dict__.get('_annspecialcase_', '') - self.specialize = specialize - self._classdefs = {} - - if is_mixin(cls): - raise AnnotatorError("cannot use directly the class %r because " - "it is a _mixin_" % (cls,)) - - assert cls.__module__ != '__builtin__' - baselist = list(cls.__bases__) - - # special case: skip BaseException, and pretend - # that all exceptions ultimately inherit from Exception instead - # of BaseException (XXX hack) - if cls is Exception: - baselist = [] - elif baselist == [BaseException]: - baselist = [Exception] - - mixins_before = [] - mixins_after = [] - base = object - for b1 in baselist: - if b1 is object: - continue - if is_mixin(b1): - if base is object: - mixins_before.append(b1) - else: - mixins_after.append(b1) - else: - assert base is object, ("multiple inheritance only supported " - "with _mixin_: %r" % (cls,)) - base = b1 - if mixins_before and mixins_after: - raise Exception("unsupported: class %r has mixin bases both" - " before and after the regular base" % (self,)) - self.add_mixins(mixins_after, check_not_in=base) - self.add_mixins(mixins_before) - self.add_sources_for_class(cls) - - if base is not object: - self.basedesc = bookkeeper.getdesc(base) - - if '_settled_' in cls.__dict__: - self.settled = bool(cls.__dict__['_settled_']) - - if '__slots__' in cls.__dict__ or '_attrs_' in cls.__dict__: - attrs = {} - for decl in ('__slots__', '_attrs_'): - decl = cls.__dict__.get(decl, []) - if isinstance(decl, str): - decl = (decl,) - decl = dict.fromkeys(decl) - attrs.update(decl) - if self.basedesc is not None: - if self.basedesc.all_enforced_attrs is None: - raise Exception("%r has slots or _attrs_, " - "but not its base class" % (cls,)) - attrs.update(self.basedesc.all_enforced_attrs) - self.all_enforced_attrs = attrs - - if (self.is_builtin_exception_class() and - self.all_enforced_attrs is None): - if cls not in FORCE_ATTRIBUTES_INTO_CLASSES: - self.all_enforced_attrs = [] # no attribute allowed - - def add_source_attribute(self, name, value, mixin=False): - if isinstance(value, property): - # special case for property object - if value.fget is not None: - newname = name + '__getter__' - func = func_with_new_name(value.fget, newname) - self.add_source_attribute(newname, func, mixin) - if value.fset is not None: - newname = name + '__setter__' - func = func_with_new_name(value.fset, newname) - self.add_source_attribute(newname, func, mixin) - self.classdict[name] = Constant(value) - return - - if isinstance(value, types.FunctionType): - # for debugging - if not hasattr(value, 'class_'): - value.class_ = self.pyobj - if self.specialize: - # make a custom funcdesc that specializes on its first - # argument (i.e. 'self'). - from rpython.annotator.specialize import specialize_argtype - def argtype0(funcdesc, args_s): - return specialize_argtype(funcdesc, args_s, 0) - funcdesc = FunctionDesc(self.bookkeeper, value, - specializer=argtype0) - self.classdict[name] = funcdesc - return - if mixin: - # make a new copy of the FunctionDesc for this class, - # but don't specialize further for all subclasses - funcdesc = FunctionDesc(self.bookkeeper, value) - self.classdict[name] = funcdesc - return - # NB. if value is, say, AssertionError.__init__, then we - # should not use getdesc() on it. Never. The problem is - # that the py lib has its own AssertionError.__init__ which - # is of type FunctionType. But bookkeeper.immutablevalue() - # will do the right thing in s_get_value(). - if isinstance(value, staticmethod) and mixin: - # make a new copy of staticmethod - func = value.__get__(42) - value = staticmethod(func_with_new_name(func, func.__name__)) - - if type(value) in MemberDescriptorTypes: - # skip __slots__, showing up in the class as 'member' objects - return - if name == '__init__' and self.is_builtin_exception_class(): - # pretend that built-in exceptions have no __init__, - # unless explicitly specified in builtin.py - from rpython.annotator.builtin import BUILTIN_ANALYZERS - value = getattr(value, 'im_func', value) - if value not in BUILTIN_ANALYZERS: - return - self.classdict[name] = Constant(value) - - def add_mixins(self, mixins, check_not_in=object): - if not mixins: - return - A = type('tmp', tuple(mixins) + (object,), {}) - mro = A.__mro__ - assert mro[0] is A and mro[-1] is object - mro = mro[1:-1] - # - skip = set() - def add(cls): - if cls is not object: - for base in cls.__bases__: - add(base) - for name in cls.__dict__: - skip.add(name) - add(check_not_in) - # - for base in reversed(mro): - assert is_mixin(base), ( - "Mixin class %r has non mixin base class %r" % (mixins, base)) - for name, value in base.__dict__.items(): - if name in skip: - continue - self.add_source_attribute(name, value, mixin=True) - - def add_sources_for_class(self, cls): - for name, value in cls.__dict__.items(): - self.add_source_attribute(name, value) - - def getallclassdefs(self): - return self._classdefs.values() - - def getclassdef(self, key): - try: - return self._classdefs[key] - except KeyError: - from rpython.annotator.classdef import ClassDef - classdef = ClassDef(self.bookkeeper, self) - self.bookkeeper.classdefs.append(classdef) - self._classdefs[key] = classdef - - # forced attributes - cls = self.pyobj - if cls in FORCE_ATTRIBUTES_INTO_CLASSES: - for name, s_value in FORCE_ATTRIBUTES_INTO_CLASSES[cls].items(): - classdef.generalize_attr(name, s_value) - classdef.find_attribute(name).modified(classdef) - - # register all class attributes as coming from this ClassDesc - # (as opposed to prebuilt instances) - classsources = {} - for attr in self.classdict: - classsources[attr] = self # comes from this ClassDesc - classdef.setup(classsources) - # look for a __del__ method and annotate it if it's there - if '__del__' in self.classdict: - from rpython.annotator.model import s_None, SomeInstance - s_func = self.s_read_attribute('__del__') - args_s = [SomeInstance(classdef)] - s = self.bookkeeper.emulate_pbc_call(classdef, s_func, args_s) - assert s_None.contains(s) - return classdef - - def getuniqueclassdef(self): - if self.specialize: - raise Exception("not supported on class %r because it needs " - "specialization" % (self.name,)) - return self.getclassdef(None) - - def pycall(self, whence, args, s_previous_result, op=None): - from rpython.annotator.model import SomeInstance, SomeImpossibleValue - if self.specialize: - if self.specialize == 'specialize:ctr_location': - # We use the SomeInstance annotation returned the last time - # to make sure we use the same ClassDef this time. - if isinstance(s_previous_result, SomeInstance): - classdef = s_previous_result.classdef - else: - classdef = self.getclassdef(object()) - else: - raise Exception("unsupported specialization tag: %r" % ( - self.specialize,)) - else: - classdef = self.getuniqueclassdef() - s_instance = SomeInstance(classdef) - # look up __init__ directly on the class, bypassing the normal - # lookup mechanisms ClassDef (to avoid influencing Attribute placement) - s_init = self.s_read_attribute('__init__') - if isinstance(s_init, SomeImpossibleValue): - # no __init__: check that there are no constructor args - if not self.is_exception_class(): - try: - args.fixedunpack(0) - except ValueError: - raise Exception("default __init__ takes no argument" - " (class %s)" % (self.name,)) - elif self.pyobj is Exception: - # check explicitly against "raise Exception, x" where x - # is a low-level exception pointer - try: - [s_arg] = args.fixedunpack(1) - except ValueError: - pass - else: - from rpython.rtyper.llannotation import SomePtr - assert not isinstance(s_arg, SomePtr) - else: - # call the constructor - args = args.prepend(s_instance) - s_init.call(args) - return s_instance - - def is_exception_class(self): - return issubclass(self.pyobj, BaseException) - - def is_builtin_exception_class(self): - if self.is_exception_class(): - if self.pyobj.__module__ == 'exceptions': - return True - if issubclass(self.pyobj, AssertionError): - return True - return False - - def lookup(self, name): - cdesc = self - while name not in cdesc.classdict: - cdesc = cdesc.basedesc - if cdesc is None: - return None - else: - return cdesc - - def read_attribute(self, name, default=NODEFAULT): - cdesc = self.lookup(name) - if cdesc is None: From noreply at buildbot.pypy.org Tue Nov 10 13:06:50 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 10 Nov 2015 19:06:50 +0100 (CET) Subject: [pypy-commit] pypy default: document merged branch Message-ID: <20151110180650.E17621C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80619:900729848e53 Date: 2015-11-10 18:07 +0000 http://bitbucket.org/pypy/pypy/changeset/900729848e53/ Log: document merged branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -29,3 +29,7 @@ Support common use-cases for __array_interface__, passes upstream tests +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. From noreply at buildbot.pypy.org Tue Nov 10 13:50:29 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 10 Nov 2015 19:50:29 +0100 (CET) Subject: [pypy-commit] pypy default: Make imports of OrderedDict unconditional, since we only support 2.7 now. Message-ID: <20151110185029.BF44A1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80620:8e96ccf1c83d Date: 2015-11-10 18:44 +0000 http://bitbucket.org/pypy/pypy/changeset/8e96ccf1c83d/ Log: Make imports of OrderedDict unconditional, since we only support 2.7 now. diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -1,6 +1,8 @@ from __future__ import with_statement import py.test import sys +from collections import OrderedDict + from rpython.conftest import option from rpython.annotator import model as annmodel @@ -4265,10 +4267,6 @@ assert ("format() is not RPython" in exc.value.msg) def test_prebuilt_ordered_dict(self): - try: - from collections import OrderedDict - except ImportError: - py.test.skip("Please upgrade to python 2.7") d = OrderedDict([("aa", 1)]) def f(): diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py --- a/rpython/rlib/objectmodel.py +++ b/rpython/rlib/objectmodel.py @@ -9,6 +9,8 @@ import types import math import inspect +from collections import OrderedDict + from rpython.tool.sourcetools import rpython_wrapper, func_with_new_name from rpython.rtyper.extregistry import ExtRegistryEntry from rpython.flowspace.specialcase import register_flow_sc @@ -744,8 +746,6 @@ class r_ordereddict(r_dict): def _newdict(self): - from collections import OrderedDict - return OrderedDict() class _r_dictkey(object): diff --git a/rpython/rlib/test/test_objectmodel.py b/rpython/rlib/test/test_objectmodel.py --- a/rpython/rlib/test/test_objectmodel.py +++ b/rpython/rlib/test/test_objectmodel.py @@ -1,3 +1,4 @@ +from collections import OrderedDict import py from rpython.rlib.objectmodel import * from rpython.rlib import types @@ -330,10 +331,6 @@ assert res == 42 # "did not crash" def test_prepare_dict_update_2(self): - try: - from collections import OrderedDict - except ImportError: # Python 2.6 - py.test.skip("requires collections.OrderedDict") def g(n): d = OrderedDict() prepare_dict_update(d, n) diff --git a/rpython/rtyper/test/test_rordereddict.py b/rpython/rtyper/test/test_rordereddict.py --- a/rpython/rtyper/test/test_rordereddict.py +++ b/rpython/rtyper/test/test_rordereddict.py @@ -1,9 +1,7 @@ import py -try: - from collections import OrderedDict -except ImportError: # Python 2.6 - py.test.skip("requires collections.OrderedDict") +from collections import OrderedDict + from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.lltypesystem import rordereddict, rstr from rpython.rlib.rarithmetic import intmask diff --git a/rpython/translator/c/test/test_genc.py b/rpython/translator/c/test/test_genc.py --- a/rpython/translator/c/test/test_genc.py +++ b/rpython/translator/c/test/test_genc.py @@ -1,4 +1,5 @@ import ctypes +from collections import OrderedDict import py @@ -573,11 +574,6 @@ assert fn(True) def test_ordered_dict(): - try: - from collections import OrderedDict - except ImportError: - py.test.skip("Please update to Python 2.7") - expected = [('ea', 1), ('bb', 2), ('c', 3), ('d', 4), ('e', 5), ('ef', 6)] d = OrderedDict(expected) From noreply at buildbot.pypy.org Tue Nov 10 14:42:27 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 10 Nov 2015 20:42:27 +0100 (CET) Subject: [pypy-commit] pypy default: Avoid unnecessary dependency on py.test Message-ID: <20151110194227.C15AC1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80621:3a7694159dfb Date: 2015-11-10 19:43 +0000 http://bitbucket.org/pypy/pypy/changeset/3a7694159dfb/ Log: Avoid unnecessary dependency on py.test diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py --- a/rpython/rlib/rgc.py +++ b/rpython/rlib/rgc.py @@ -46,7 +46,7 @@ """ _pinned_objects.append(obj) return True - + class PinEntry(ExtRegistryEntry): _about_ = pin @@ -533,12 +533,8 @@ def _fetch_ffi(): global _ffi_cache if _ffi_cache is None: - try: - import _cffi_backend - _ffi_cache = _cffi_backend.FFI() - except (ImportError, AttributeError): - import py - py.test.skip("need CFFI >= 1.0") + import _cffi_backend + _ffi_cache = _cffi_backend.FFI() return _ffi_cache @jit.dont_look_inside @@ -816,7 +812,7 @@ pending.extend(get_rpy_referents(gcref)) all_typeids = {} - + def get_typeid(obj): raise Exception("does not work untranslated") From noreply at buildbot.pypy.org Tue Nov 10 15:47:15 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 10 Nov 2015 21:47:15 +0100 (CET) Subject: [pypy-commit] pypy default: Make these failing tests actually run, so that they're not completely useless Message-ID: <20151110204715.4551B1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80622:d140679b2a00 Date: 2015-11-10 20:46 +0000 http://bitbucket.org/pypy/pypy/changeset/d140679b2a00/ Log: Make these failing tests actually run, so that they're not completely useless diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -793,8 +793,8 @@ s = a.build_types(f, [B]) assert s.classdef is a.bookkeeper.getuniqueclassdef(C) + @py.test.mark.xfail def test_union_type_some_pbc(self): - py.test.skip("is there a point? f() can return self.__class__ instead") class A(object): name = "A" @@ -4414,8 +4414,9 @@ with py.test.raises(UnionError) as exc: a.build_types(f2, [int]) + @py.test.mark.xfail(reason="May produce garbage annotations instead of " + "raising AnnotatorError, depending on annotation order") def test_property_union_2(self): - py.test.xfail("FIX ME") class Base(object): pass @@ -4443,8 +4444,9 @@ with py.test.raises(AnnotatorError): a.build_types(f, [int]) + @py.test.mark.xfail(reason="May produce garbage annotations instead of " + "raising AnnotatorError, depending on annotation order") def test_property_union_3(self): - py.test.xfail("FIX ME") class Base(object): pass class A(Base): diff --git a/rpython/rtyper/test/test_generator.py b/rpython/rtyper/test/test_generator.py --- a/rpython/rtyper/test/test_generator.py +++ b/rpython/rtyper/test/test_generator.py @@ -76,8 +76,8 @@ res = self.interpret(f, []) assert res == 358 + @py.test.mark.xfail def test_different_exception(self): - py.test.skip("generators broken") def h(c): if c == 8: raise ValueError From noreply at buildbot.pypy.org Tue Nov 10 18:24:18 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:18 +0100 (CET) Subject: [pypy-commit] pypy anntype: Simplify SomeType union Message-ID: <20151110232418.EC5B91C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80623:141328501110 Date: 2015-11-08 03:33 +0000 http://bitbucket.org/pypy/pypy/changeset/141328501110/ Log: Simplify SomeType union diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -145,19 +145,13 @@ def union((obj1, obj2)): result = SomeType() - is_type_of1 = getattr(obj1, 'is_type_of', None) - is_type_of2 = getattr(obj2, 'is_type_of', None) + is_type_of1 = getattr(obj1, 'is_type_of', []) + is_type_of2 = getattr(obj2, 'is_type_of', []) if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const: result.const = obj1.const - is_type_of = {} - if is_type_of1: - for v in is_type_of1: - is_type_of[v] = True - if is_type_of2: - for v in is_type_of2: - is_type_of[v] = True + is_type_of = set(is_type_of1) | set(is_type_of2) if is_type_of: - result.is_type_of = is_type_of.keys() + result.is_type_of = list(is_type_of) else: if is_type_of1 and is_type_of1 == is_type_of2: result.is_type_of = is_type_of1 From noreply at buildbot.pypy.org Tue Nov 10 18:24:21 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:21 +0100 (CET) Subject: [pypy-commit] pypy anntype: Try to clean up follow_link() a bit Message-ID: <20151110232421.0E92D1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80624:c2a6e9cfb77c Date: 2015-11-08 07:14 +0000 http://bitbucket.org/pypy/pypy/changeset/c2a6e9cfb77c/ Log: Try to clean up follow_link() a bit diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -500,15 +500,14 @@ issubclass(link.exitcase, BaseException)): assert v_last_exc_type and v_last_exc_value s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase) - s_last_exc_type = annmodel.SomeType() - if isinstance(v_last_exc_type, Constant): - s_last_exc_type.const = v_last_exc_type.value - s_last_exc_type.is_type_of = [v_last_exc_value] + if isinstance(v_last_exc_value, Variable): + self.setbinding(v_last_exc_value, s_last_exc_value) + if isinstance(v_last_exc_type, Variable): - self.setbinding(v_last_exc_type, s_last_exc_type) - if isinstance(v_last_exc_value, Variable): - self.setbinding(v_last_exc_value, s_last_exc_value) + s_etype = annmodel.SomeType() + s_etype.is_type_of = [v_last_exc_value] + self.setbinding(v_last_exc_type, s_etype) s_last_exc_type = annmodel.SomeType() if isinstance(v_last_exc_type, Constant): From noreply at buildbot.pypy.org Tue Nov 10 18:24:23 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:23 +0100 (CET) Subject: [pypy-commit] pypy anntype: Create SomeTypeOf Message-ID: <20151110232423.3D3541C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80625:e0901d853668 Date: 2015-11-09 01:45 +0000 http://bitbucket.org/pypy/pypy/changeset/e0901d853668/ Log: Create SomeTypeOf diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -6,10 +6,10 @@ from rpython.tool.pairtype import pair from rpython.tool.error import (format_blocked_annotation_error, gather_error, source_lines) -from rpython.flowspace.model import ( - Variable, Constant, FunctionGraph, checkgraph) +from rpython.flowspace.model import Variable, Constant, checkgraph from rpython.translator import simplify, transform from rpython.annotator import model as annmodel, signature +from rpython.annotator.model import SomeTypeOf from rpython.annotator.bookkeeper import Bookkeeper from rpython.rtyper.normalizecalls import perform_normalizations @@ -503,11 +503,8 @@ if isinstance(v_last_exc_value, Variable): self.setbinding(v_last_exc_value, s_last_exc_value) - if isinstance(v_last_exc_type, Variable): - s_etype = annmodel.SomeType() - s_etype.is_type_of = [v_last_exc_value] - self.setbinding(v_last_exc_type, s_etype) + self.setbinding(v_last_exc_type, SomeTypeOf(v_last_exc_value)) s_last_exc_type = annmodel.SomeType() if isinstance(v_last_exc_type, Constant): diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -138,6 +138,11 @@ def can_be_none(self): return False +class SomeTypeOf(SomeType): + """The type of a variable""" + def __init__(self, v_arg): + self.is_type_of = [v_arg] + class SomeFloat(SomeObject): "Stands for a float or an integer." diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -11,7 +11,7 @@ from rpython.annotator.model import (SomeObject, SomeInteger, SomeBool, SomeString, SomeChar, SomeList, SomeDict, SomeTuple, SomeImpossibleValue, SomeUnicodeCodePoint, SomeInstance, SomeBuiltin, SomeBuiltinMethod, - SomeFloat, SomeIterator, SomePBC, SomeNone, SomeType, s_ImpossibleValue, + SomeFloat, SomeIterator, SomePBC, SomeNone, SomeTypeOf, s_ImpossibleValue, s_Bool, s_None, s_Int, unionof, add_knowntypedata, SomeWeakRef, SomeUnicodeString, SomeByteArray) from rpython.annotator.bookkeeper import getbookkeeper, immutablevalue @@ -26,11 +26,11 @@ if oper.dispatch == 1]) UNARY_OPERATIONS.remove('contains') + @op.type.register(SomeObject) -def type_SomeObject(annotator, arg): - r = SomeType() - r.is_type_of = [arg] - return r +def type_SomeObject(annotator, v_arg): + return SomeTypeOf(v_arg) + @op.bool.register(SomeObject) def bool_SomeObject(annotator, obj): From noreply at buildbot.pypy.org Tue Nov 10 18:24:25 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:25 +0100 (CET) Subject: [pypy-commit] pypy anntype: Implement SomeTypeOf union Message-ID: <20151110232425.57A101C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80626:d38e7b673e7e Date: 2015-11-09 05:03 +0000 http://bitbucket.org/pypy/pypy/changeset/d38e7b673e7e/ Log: Implement SomeTypeOf union diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -9,7 +9,7 @@ SomeTuple, SomeImpossibleValue, s_ImpossibleValue, SomeInstance, SomeBuiltinMethod, SomeIterator, SomePBC, SomeNone, SomeFloat, s_None, SomeByteArray, SomeWeakRef, SomeSingleFloat, - SomeLongFloat, SomeType, SomeConstantType, unionof, UnionError, + SomeLongFloat, SomeType, SomeTypeOf, SomeConstantType, unionof, UnionError, read_can_only_throw, add_knowntypedata, merge_knowntypedata,) from rpython.annotator.bookkeeper import immutablevalue @@ -157,6 +157,17 @@ result.is_type_of = is_type_of1 return result +class __extend__(pairtype(SomeTypeOf, SomeTypeOf)): + def union((s_obj1, s_obj2)): + if s_obj1 == s_obj2: + return s_obj1 + else: + s_1 = SomeType() + s_1.is_type_of = s_obj1.is_type_of + s_2 = SomeType() + s_2.is_type_of = s_obj2.is_type_of + return unionof(s_1, s_2) + # cloning a function with identical code, for the can_only_throw attribute def _clone(f, can_only_throw = None): diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -141,8 +141,11 @@ class SomeTypeOf(SomeType): """The type of a variable""" def __init__(self, v_arg): - self.is_type_of = [v_arg] + self.v_arg = v_arg + @property + def is_type_of(self): + return [self.v_arg] class SomeFloat(SomeObject): "Stands for a float or an integer." From noreply at buildbot.pypy.org Tue Nov 10 18:24:27 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:27 +0100 (CET) Subject: [pypy-commit] pypy anntype: Don't unify unrelated SomeTypes Message-ID: <20151110232427.6B0F01C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80627:52d90ac2df20 Date: 2015-11-09 17:46 +0000 http://bitbucket.org/pypy/pypy/changeset/52d90ac2df20/ Log: Don't unify unrelated SomeTypes diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -149,12 +149,8 @@ is_type_of2 = getattr(obj2, 'is_type_of', []) if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const: result.const = obj1.const - is_type_of = set(is_type_of1) | set(is_type_of2) - if is_type_of: - result.is_type_of = list(is_type_of) - else: - if is_type_of1 and is_type_of1 == is_type_of2: - result.is_type_of = is_type_of1 + if is_type_of1 and is_type_of1 == is_type_of2: + result.is_type_of = is_type_of1 return result class __extend__(pairtype(SomeTypeOf, SomeTypeOf)): From noreply at buildbot.pypy.org Tue Nov 10 18:24:29 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:29 +0100 (CET) Subject: [pypy-commit] pypy anntype: Turn knowntypedata into a dict of dicts Message-ID: <20151110232429.838F01C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80628:789ca6e9fa3b Date: 2015-11-10 05:16 +0000 http://bitbucket.org/pypy/pypy/changeset/789ca6e9fa3b/ Log: Turn knowntypedata into a dict of dicts diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -479,7 +479,7 @@ # that can be attached to booleans, exitswitches knowntypedata = {} if isinstance(block.exitswitch, Variable): - knowntypedata = getattr(self.binding(block.exitswitch), + knowntypedata = getattr(block.exitswitch.annotation, "knowntypedata", {}) for link in exits: self.follow_link(graph, link, knowntypedata) @@ -527,14 +527,14 @@ last_exc_value_vars.append(v_input) else: s_out = self.annotation(v_out) - if (link.exitcase, v_out) in knowntypedata: - knownvarvalue = knowntypedata[(link.exitcase, v_out)] + if link.exitcase in knowntypedata and v_out in knowntypedata[link.exitcase]: + knownvarvalue = knowntypedata[link.exitcase][v_out] s_out = pair(s_out, knownvarvalue).improve() # ignore links that try to pass impossible values if s_out == annmodel.s_ImpossibleValue: ignore_link = True - if hasattr(s_out,'is_type_of'): + if hasattr(s_out, 'is_type_of'): renamed_is_type_of = [] for v in s_out.is_type_of: new_vs = renaming.get(v, []) @@ -548,10 +548,12 @@ if hasattr(s_out, 'knowntypedata'): renamed_knowntypedata = {} - for (value, v), s in s_out.knowntypedata.items(): - new_vs = renaming.get(v, []) - for new_v in new_vs: - renamed_knowntypedata[value, new_v] = s + for value, constraints in s_out.knowntypedata.items(): + renamed_knowntypedata[value] = {} + for v, s in constraints.items(): + new_vs = renaming.get(v, []) + for new_v in new_vs: + renamed_knowntypedata[value][new_v] = s assert isinstance(s_out, annmodel.SomeBool) newcell = annmodel.SomeBool() if s_out.is_constant(): diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -1,6 +1,7 @@ """ Binary operations between SomeValues. """ +from collections import defaultdict from rpython.tool.pairtype import pair, pairtype from rpython.annotator.model import ( @@ -35,7 +36,7 @@ elif s_obj1.is_constant(): if s_obj1.const is None and not s_obj2.can_be_none(): r.const = False - knowntypedata = {} + knowntypedata = defaultdict(dict) bk = annotator.bookkeeper def bind(src_obj, tgt_obj): @@ -264,7 +265,7 @@ if not (rarithmetic.signedtype(s_int1.knowntype) and rarithmetic.signedtype(s_int2.knowntype)): return r - knowntypedata = {} + knowntypedata = defaultdict(dict) def tointtype(s_int0): if s_int0.knowntype is bool: return int diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -2,7 +2,7 @@ Built-in functions. """ import sys -from collections import OrderedDict +from collections import OrderedDict, defaultdict from rpython.annotator.model import ( SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple, @@ -188,7 +188,7 @@ variables = [op.args[1]] for variable in variables: assert bk.annotator.binding(variable) == s_obj - knowntypedata = {} + knowntypedata = defaultdict(dict) if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC): add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ)) r.set_knowntypedata(knowntypedata) diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -32,7 +32,7 @@ import inspect import weakref from types import BuiltinFunctionType, MethodType -from collections import OrderedDict +from collections import OrderedDict, defaultdict import rpython from rpython.tool import descriptor @@ -690,14 +690,15 @@ def add_knowntypedata(ktd, truth, vars, s_obj): for v in vars: - ktd[(truth, v)] = s_obj + ktd[truth][v] = s_obj def merge_knowntypedata(ktd1, ktd2): - r = {} - for truth_v in ktd1: - if truth_v in ktd2: - r[truth_v] = unionof(ktd1[truth_v], ktd2[truth_v]) + r = defaultdict(dict) + for truth, constraints in ktd1.items(): + for v in constraints: + if truth in ktd2 and v in ktd2[truth]: + r[truth][v] = unionof(ktd1[truth][v], ktd2[truth][v]) return r diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -1,8 +1,9 @@ """ Unary operations on SomeValues. """ +from __future__ import absolute_import -from __future__ import absolute_import +from collections import defaultdict from rpython.tool.pairtype import pair from rpython.flowspace.operation import op @@ -39,7 +40,7 @@ s_nonnone_obj = annotator.annotation(obj) if s_nonnone_obj.can_be_none(): s_nonnone_obj = s_nonnone_obj.nonnoneify() - knowntypedata = {} + knowntypedata = defaultdict(dict) add_knowntypedata(knowntypedata, True, [obj], s_nonnone_obj) r.set_knowntypedata(knowntypedata) return r @@ -520,7 +521,7 @@ def contains_String(annotator, string, char): if annotator.annotation(char).is_constant() and annotator.annotation(char).const == "\0": r = SomeBool() - knowntypedata = {} + knowntypedata = defaultdict(dict) add_knowntypedata(knowntypedata, False, [string], annotator.annotation(string).nonnulify()) r.set_knowntypedata(knowntypedata) From noreply at buildbot.pypy.org Tue Nov 10 18:24:31 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 00:24:31 +0100 (CET) Subject: [pypy-commit] pypy anntype: Extract the relevant part of knowntypedata before calling follow_link() Message-ID: <20151110232431.937DA1C0530@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80629:6ac4b45795c0 Date: 2015-11-10 05:42 +0000 http://bitbucket.org/pypy/pypy/changeset/6ac4b45795c0/ Log: Extract the relevant part of knowntypedata before calling follow_link() diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -482,7 +482,8 @@ knowntypedata = getattr(block.exitswitch.annotation, "knowntypedata", {}) for link in exits: - self.follow_link(graph, link, knowntypedata) + constraints = knowntypedata.get(link.exitcase, {}) + self.follow_link(graph, link, constraints) if block in self.notify: # reflow from certain positions when this block is done for callback in self.notify[block]: @@ -491,7 +492,7 @@ else: callback() - def follow_link(self, graph, link, knowntypedata): + def follow_link(self, graph, link, constraints): in_except_block = False v_last_exc_type = link.last_exception # may be None for non-exception link v_last_exc_value = link.last_exc_value # may be None for non-exception link @@ -527,9 +528,9 @@ last_exc_value_vars.append(v_input) else: s_out = self.annotation(v_out) - if link.exitcase in knowntypedata and v_out in knowntypedata[link.exitcase]: - knownvarvalue = knowntypedata[link.exitcase][v_out] - s_out = pair(s_out, knownvarvalue).improve() + if v_out in constraints: + s_constraint = constraints[v_out] + s_out = pair(s_out, s_constraint).improve() # ignore links that try to pass impossible values if s_out == annmodel.s_ImpossibleValue: ignore_link = True From noreply at buildbot.pypy.org Wed Nov 11 09:45:59 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 11 Nov 2015 15:45:59 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: freed r12 of its burden as a base pointer, saving the pool address (it is known when jumping to a label) to the bridge pool instead of on the stack Message-ID: <20151111144559.6F0151C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80630:a45f6bccf61b Date: 2015-11-05 11:27 +0100 http://bitbucket.org/pypy/pypy/changeset/a45f6bccf61b/ Log: freed r12 of its burden as a base pointer, saving the pool address (it is known when jumping to a label) to the bridge pool instead of on the stack diff --git a/rpython/jit/backend/zarch/arch.py b/rpython/jit/backend/zarch/arch.py --- a/rpython/jit/backend/zarch/arch.py +++ b/rpython/jit/backend/zarch/arch.py @@ -17,7 +17,6 @@ GPR_STACK_SAVE_IN_BYTES = 120 STD_FRAME_SIZE_IN_BYTES = 140 -BSP_STACK_OFFSET = 128 THREADLOCAL_ADDR_OFFSET = 8 assert STD_FRAME_SIZE_IN_BYTES % 2 == 0 @@ -63,3 +62,6 @@ RECOVERY_TARGET_POOL_OFFSET = 0 RECOVERY_GCMAP_POOL_OFFSET = 8 + +JUMPABS_TARGET_ADDR__POOL_OFFSET = 0 +JUMPABS_POOL_ADDR_POOL_OFFSET = 8 diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -12,7 +12,8 @@ from rpython.jit.backend.zarch.arch import (WORD, STD_FRAME_SIZE_IN_BYTES, GPR_STACK_SAVE_IN_BYTES, THREADLOCAL_ADDR_OFFSET, RECOVERY_GCMAP_POOL_OFFSET, - RECOVERY_TARGET_POOL_OFFSET) + RECOVERY_TARGET_POOL_OFFSET, JUMPABS_TARGET_ADDR__POOL_OFFSET, + JUMPABS_POOL_ADDR_POOL_OFFSET) from rpython.jit.backend.zarch.opassembler import (IntOpAssembler, FloatOpAssembler, GuardOpAssembler) from rpython.jit.backend.zarch.regalloc import Regalloc @@ -352,6 +353,7 @@ def fixup_target_tokens(self, rawstart): for targettoken in self.target_tokens_currently_compiling: targettoken._ll_loop_code += rawstart + targettoken._ll_loop_pool += rawstart self.target_tokens_currently_compiling = None def _assemble(self, regalloc, inputargs, operations): @@ -516,7 +518,6 @@ # Build a new stackframe of size STD_FRAME_SIZE_IN_BYTES self.mc.STMG(r.r6, r.r15, l.addr(-GPR_STACK_SAVE_IN_BYTES, r.SP)) self.mc.AGHI(r.SP, l.imm(-STD_FRAME_SIZE_IN_BYTES)) - self.mc.LGR(r.BSP, r.SP) # save r4, the second argument, to THREADLOCAL_ADDR_OFFSET #self.mc.STG(r.r3, l.addr(THREADLOCAL_ADDR_OFFSET, r.SP)) @@ -578,13 +579,16 @@ self.mc.b_offset(descr._ll_loop_code) else: # restore the pool address - offset = self.pool.get_descr_offset(descr) + offset = self.pool.get_descr_offset(descr) + \ + JUMPABS_TARGET_ADDR__POOL_OFFSET + offset_pool = offset + JUMPABS_POOL_ADDR_POOL_OFFSET self.mc.LG(r.SCRATCH, l.pool(offset)) - self.mc.LG(r.POOL, l.addr(0, r.BSP)) - self.mc.AGHI(r.BSP, l.imm(8)) + # the pool address of the target is saved in the bridge's pool + self.mc.LG(r.POOL, l.pool(offset_pool)) self.mc.BCR(c.ANY, r.SCRATCH) - print "writing", hex(descr._ll_loop_code) + self.pool.overwrite_64(self.mc, offset, descr._ll_loop_code) + self.pool.overwrite_64(self.mc, offset_pool, descr._ll_loop_pool) def emit_finish(self, op, arglocs, regalloc): diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -27,12 +27,12 @@ if descr not in asm.target_tokens_currently_compiling: # this is a 'long' jump instead of a relative jump self.offset_map[descr] = self.size - self.reserve_literal(8) + self.reserve_literal(16) elif op.getopnum() == rop.LABEL: descr = op.getdescr() + descr._ll_loop_pool = self.pool_start if descr not in asm.target_tokens_currently_compiling: # this is a 'long' jump instead of a relative jump - descr._ll_loop_code = self.pool_start self.offset_map[descr] = self.size for arg in op.getarglist(): if arg.is_constant(): @@ -68,6 +68,8 @@ # the current solution (gcc does the same), use a literal pool # located at register r13. This one can easily offset with 20 # bit signed values (should be enough) + self.pool_start = asm.mc.get_relative_pos() + \ + asm.mc.BRAS_byte_count for op in operations: self.ensure_can_hold_constants(asm, op) if self.size == 0: @@ -78,14 +80,8 @@ # self.size += 1 jump_offset = self.size+asm.mc.BRAS_byte_count assert jump_offset < 2**15-1 - if bridge: - asm.mc.LGR(r.SCRATCH, r.POOL) asm.mc.BRAS(r.POOL, l.imm(jump_offset)) - self.pool_start = asm.mc.get_relative_pos() asm.mc.write('\xFF' * self.size) - if bridge: - asm.mc.STG(r.SCRATCH, l.addr(-8, r.BSP)) - asm.mc.AGHI(r.BSP, l.imm(-8)) print "pool with %d quad words" % (self.size // 8) def overwrite_64(self, mc, index, value): diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -7,10 +7,9 @@ [r0,r1,r2,r3,r4,r5,r6,r7,r8, r9,r10,r11,r12,r13,r14,r15] = registers -MANAGED_REGS = [r0,r1,r4,r5,r6,r7,r8,r9,r10] -VOLATILES = [r6,r7,r8,r9,r10] +MANAGED_REGS = [r0,r1,r4,r5,r6,r7,r8,r9,r10,r12] +VOLATILES = [r6,r7,r8,r9,r10,r12] SP = r15 -BSP = r12 RETURN = r14 POOL = r13 SPP = r11 From noreply at buildbot.pypy.org Wed Nov 11 09:46:01 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 11 Nov 2015 15:46:01 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: label now loads the constant pool when it is entered. the jump back within the same loop (peeled loop does not reload the literal pool, because it is not changed) Message-ID: <20151111144601.AA6AC1C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80631:45f50d672a78 Date: 2015-11-09 12:07 +0100 http://bitbucket.org/pypy/pypy/changeset/45f50d672a78/ Log: label now loads the constant pool when it is entered. the jump back within the same loop (peeled loop does not reload the literal pool, because it is not changed) diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -245,11 +245,13 @@ regalloc = Regalloc(assembler=self) # + self.pool.pre_assemble(self, operations) + entrypos = self.mc.get_relative_pos() + self.mc.LARL(r.POOL, l.halfword(self.pool.pool_start - entrypos)) self._call_header_with_stack_check() operations = regalloc.prepare_loop(inputargs, operations, looptoken, clt.allgcrefs) looppos = self.mc.get_relative_pos() - self.pool.pre_assemble(self, operations) frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, operations) self.update_frame_depth(frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) @@ -278,7 +280,7 @@ looptoken._zarch_rawstart = rawstart looptoken._zarch_fullsize = full_size looptoken._zarch_ops_offset = ops_offset - looptoken._ll_function_addr = rawstart + looptoken._ll_function_addr = rawstart + entrypos if logger: logger.log_loop(inputargs, operations, 0, "rewritten", name=loopname, ops_offset=ops_offset) @@ -308,13 +310,14 @@ arglocs = self.rebuild_faillocs_from_descr(faildescr, inputargs) regalloc = Regalloc(assembler=self) + self.pool.pre_assemble(self, operations, bridge=True) startpos = self.mc.get_relative_pos() + self.mc.LARL(r.POOL, l.halfword(self.pool.pool_start - startpos)) operations = regalloc.prepare_bridge(inputargs, arglocs, operations, self.current_clt.allgcrefs, self.current_clt.frame_info) self._check_frame_depth(self.mc, regalloc.get_gcmap()) - self.pool.pre_assemble(self, operations, bridge=True) frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, operations) codeendpos = self.mc.get_relative_pos() self.pool.post_assemble(self) @@ -326,7 +329,7 @@ debug_bridge(descr_number, rawstart, codeendpos) self.patch_pending_failure_recoveries(rawstart) # patch the jump from original guard - self.patch_jump_for_descr(faildescr, rawstart) + self.patch_jump_for_descr(faildescr, rawstart + startpos) ops_offset = self.mc.ops_offset frame_depth = max(self.current_clt.frame_info.jfi_frame_depth, frame_depth_no_fixed_size + JITFRAME_FIXED_SIZE) @@ -345,7 +348,6 @@ # Updates the pool address mc = InstrBuilder() mc.write_i64(adr_new_target) - print "addr is", hex(adr_new_target), "writing to", hex(faildescr.adr_jump_offset) mc.copy_to_raw_memory(faildescr.adr_jump_offset) assert faildescr.adr_jump_offset != 0 faildescr.adr_jump_offset = 0 # means "patched" @@ -353,7 +355,6 @@ def fixup_target_tokens(self, rawstart): for targettoken in self.target_tokens_currently_compiling: targettoken._ll_loop_code += rawstart - targettoken._ll_loop_pool += rawstart self.target_tokens_currently_compiling = None def _assemble(self, regalloc, inputargs, operations): @@ -561,7 +562,9 @@ pass # TODO def emit_label(self, op, arglocs, regalloc): - pass + offset = self.pool.pool_start - self.mc.get_relative_pos() + # load the pool address at each label + self.mc.LARL(r.POOL, l.halfword(offset)) def emit_jump(self, op, arglocs, regalloc): # The backend's logic assumes that the target code is in a piece of @@ -576,19 +579,18 @@ assert my_nbargs == target_nbargs if descr in self.target_tokens_currently_compiling: - self.mc.b_offset(descr._ll_loop_code) + # a label has a LARL instruction that does not need + # to be executed, thus remove the first opcode + self.mc.b_offset(descr._ll_loop_code + self.mc.LARL_byte_count) else: # restore the pool address offset = self.pool.get_descr_offset(descr) + \ JUMPABS_TARGET_ADDR__POOL_OFFSET offset_pool = offset + JUMPABS_POOL_ADDR_POOL_OFFSET self.mc.LG(r.SCRATCH, l.pool(offset)) - # the pool address of the target is saved in the bridge's pool - self.mc.LG(r.POOL, l.pool(offset_pool)) self.mc.BCR(c.ANY, r.SCRATCH) self.pool.overwrite_64(self.mc, offset, descr._ll_loop_code) - self.pool.overwrite_64(self.mc, offset_pool, descr._ll_loop_pool) def emit_finish(self, op, arglocs, regalloc): diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -9,6 +9,8 @@ return 0 if arg.startswith('i') or arg.startswith('u'): return 0 + if arg.startswith('h'): + return 0 return loc.addr(0) class builder(object): @@ -31,6 +33,7 @@ bidl - index base displacement (20 bit) l4bd - length base displacement (4 bit) l8bd - length base displacement (8 bit) + h32 - halfwords 32 bit (e.g. LARL, or other relative instr.) note that a suffix 'l' means long, and a prefix length """ @@ -174,9 +177,9 @@ func._arguments_[1] = 'u16' return func -def build_ril(mnemonic, (opcode,halfopcode)): +def build_ril(mnemonic, (opcode,halfopcode), args='r/m,i32'): br = is_branch_relative(mnemonic) - @builder.arguments('r/m,i32') + @builder.arguments(args) def encode_ri(self, reg_or_mask, imm32): self.writechar(opcode) byte = (reg_or_mask & 0xf) << 4 | (ord(halfopcode) & 0xf) @@ -348,7 +351,7 @@ newargs[i] = 0 elif arg == 'r' or arg == 'r/m' or arg == 'f': newargs[i] = args[i].value - elif arg.startswith('i') or arg.startswith('u'): + elif arg.startswith('i') or arg.startswith('u') or arg.startswith('h'): newargs[i] = args[i].value else: newargs[i] = args[i] diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -87,6 +87,7 @@ 'LR': ('rr', ['\x18']), 'LGR': ('rre', ['\xB9','\x04']), 'LG': ('rxy', ['\xE3','\x04']), + 'LARL': ('ril', ['\xC0','\x00'], 'r/m,h32'), # store memory 'STMG': ('rsy', ['\xEB','\x24']), diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py --- a/rpython/jit/backend/zarch/locations.py +++ b/rpython/jit/backend/zarch/locations.py @@ -217,9 +217,11 @@ return ImmLocation(i) def pool(off, float=False): - print "loading pool", off return PoolLoc(off, float) +def halfword(value): + return ImmLocation(value//2) + def get_fp_offset(base_ofs, position): from rpython.jit.backend.zarch.registers import JITFRAME_FIXED_SIZE return base_ofs + WORD * (position + JITFRAME_FIXED_SIZE) diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -27,7 +27,7 @@ if descr not in asm.target_tokens_currently_compiling: # this is a 'long' jump instead of a relative jump self.offset_map[descr] = self.size - self.reserve_literal(16) + self.reserve_literal(8) elif op.getopnum() == rop.LABEL: descr = op.getdescr() descr._ll_loop_pool = self.pool_start @@ -68,8 +68,7 @@ # the current solution (gcc does the same), use a literal pool # located at register r13. This one can easily offset with 20 # bit signed values (should be enough) - self.pool_start = asm.mc.get_relative_pos() + \ - asm.mc.BRAS_byte_count + self.pool_start = asm.mc.get_relative_pos() for op in operations: self.ensure_can_hold_constants(asm, op) if self.size == 0: @@ -78,9 +77,6 @@ assert self.size % 2 == 0 #if self.size % 2 == 1: # self.size += 1 - jump_offset = self.size+asm.mc.BRAS_byte_count - assert jump_offset < 2**15-1 - asm.mc.BRAS(r.POOL, l.imm(jump_offset)) asm.mc.write('\xFF' * self.size) print "pool with %d quad words" % (self.size // 8) From noreply at buildbot.pypy.org Wed Nov 11 09:46:03 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 11 Nov 2015 15:46:03 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added division opcode, multiply opcode, int32 imm add and sub, started to implement int_mul, int_div. Message-ID: <20151111144603.CB56C1C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80632:f7d3b4343ec7 Date: 2015-11-11 10:40 +0100 http://bitbucket.org/pypy/pypy/changeset/f7d3b4343ec7/ Log: added division opcode, multiply opcode, int32 imm add and sub, started to implement int_mul, int_div. for int_mul followed by an overlfow we probably need a different solution overflow condition is not set by multiply (or multiply single), can be checked for the a unsigned integer case with just one compare diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -7,13 +7,16 @@ return lower_bound <= i <= upper_bound return False -def prepare_int_add_or_mul(self, op): +def check_imm32(arg): + return check_imm(arg, -2**31, 2**31-1) + +def prepare_int_add(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - if check_imm(a0): + if check_imm32(a0): a0, a1 = a1, a0 l0 = self.ensure_reg(a0) - if check_imm(a1): + if check_imm32(a1): l1 = imm(a1.getint()) else: l1 = self.ensure_reg(a1) @@ -21,6 +24,40 @@ self.free_op_vars() return [l0, l1] +def prepare_int_mul(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + if check_imm32(a0): + a0, a1 = a1, a0 + l0 = self.ensure_reg(a0) + if check_imm32(a1): + l1 = imm(a1.getint()) + else: + l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0, l1] + +def prepare_int_div(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + l0,lr = self.ensure_even_odd_pair(a0) + l1 = self.ensure_reg(a1) + xxx + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0, l1] + +def prepare_int_mod(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + l0,lr = self.ensure_even_odd_pair(a0) + l1 = self.ensure_reg(a1) + self.force_arg_to_(op, a0) + self.free_op_vars() + return [l0, l1] + + def prepare_int_sub(self, op): a0 = op.getarg(0) a1 = op.getarg(1) diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -5,7 +5,7 @@ def dummy_argument(arg): """ NOT_RPYTHON """ - if arg in ('r', 'r/m', 'm', 'f', '-'): + if arg in ('r', 'r/m', 'm', 'f', '-', 'eo'): return 0 if arg.startswith('i') or arg.startswith('u'): return 0 @@ -24,6 +24,7 @@ f - floating point register r - register m - mask + eo - even odd pair (= the even register) r/m - register or mask iX - immediate X bits (signed) uX - immediate X bits (unsigend) @@ -147,8 +148,8 @@ encode_index_base_displace(self, reg_or_mask, idxbasedisp) return encode_rx -def build_rxy(mnemonic, (opcode1,opcode2)): - @builder.arguments('r/m,bidl') +def build_rxy(mnemonic, (opcode1,opcode2), arguments='r/m,bidl'): + @builder.arguments(arguments) def encode_rxy(self, reg_or_mask, idxbasedisp): self.writechar(opcode1) index = idxbasedisp.index @@ -184,7 +185,7 @@ self.writechar(opcode) byte = (reg_or_mask & 0xf) << 4 | (ord(halfopcode) & 0xf) self.writechar(chr(byte)) - if br: + if br or mnemonic == 'LARL': imm32 = imm32 >> 1 # half word boundary, addressing bytes self.write_i32(imm32 & BIT_MASK_32) diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -9,13 +9,28 @@ } arith_mnemonic_codes = { + # add 'AR': ('rr', ['\x1A']), 'AGR': ('rre', ['\xB9','\x08']), 'AGFR': ('rre', ['\xB9','\x18']), 'A': ('rx', ['\x5A']), + 'AGFI': ('ril', ['\xC2','\x08']), + + # sub 'SR': ('rr', ['\x1B']), 'SG': ('rxy', ['\xE3','\x09']), 'SGR': ('rre', ['\xB9','\x09']), + # mul + 'MSGR': ('rre', ['\xB9','\x0C']), + 'MSG': ('rxy', ['\xE3','\x0C']), + 'MSGFI': ('ril', ['\xC2','\x00']), + # div/mod + 'DSGR': ('rre', ['\xB9','\x0D'], 'eo,r'), + 'DSG': ('rxy', ['\xE3','\x0D'], 'eo,bidl'), + # there is no immidiate divide + + + # div 'AY': ('rxy', ['\xE3','\x5A']), 'AG': ('rxy', ['\xE3','\x08']), diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -16,6 +16,15 @@ else: self.mc.AGR(l0, l1) + def emit_int_mul(self, op, arglocs, regalloc): + l0, l1 = arglocs + if l1.is_imm(): + self.mc.AGHI(l0, l1) + elif l1.is_in_pool(): + self.mc.AG(l0, l1) + else: + self.mc.AGR(l0, l1) + def emit_int_sub(self, op, arglocs, regalloc): l0, l1 = arglocs if l1.is_in_pool(): diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -463,9 +463,12 @@ def prepare_increment_debug_counter(self, op): pass # XXX - prepare_int_add = helper.prepare_int_add_or_mul + prepare_int_add = helper.prepare_int_add prepare_int_sub = helper.prepare_int_sub - prepare_int_mul = helper.prepare_int_add_or_mul + prepare_int_mul = helper.prepare_int_mul + prepare_int_floordiv = helper.prepare_div + prepare_uint_floordiv = helper.prepare_div + prepare_int_mod = helper.prepare_mod prepare_int_le = helper.prepare_cmp_op prepare_int_lt = helper.prepare_cmp_op diff --git a/rpython/jit/backend/zarch/test/test_auto_encoding.py b/rpython/jit/backend/zarch/test/test_auto_encoding.py --- a/rpython/jit/backend/zarch/test/test_auto_encoding.py +++ b/rpython/jit/backend/zarch/test/test_auto_encoding.py @@ -112,6 +112,12 @@ maximum = 2**bits return [0,1,maximum-1] + [random.randrange(0,maximum) for i in range(count)] +def range_of_halfword_bits(bits, signed=True, count=24): + elems = range_of_bits(bits, signed, count) + for i,e in enumerate(elems): + elems[i] = (e // 2) >> 1 + return elems + def build_fake(clazz, *arg_bits): possibilities = itertools.product(*[range_of_bits(b) for b in arg_bits]) results = [] @@ -124,6 +130,7 @@ return results REGS = range(16) +EVEN_REGS = range(0,16,2) REGNAMES = ['%%r%d' % i for i in REGS] FP_REGS = range(16) FP_REGNAMES = ['%%f%d' % i for i in FP_REGS] @@ -131,6 +138,7 @@ '-': [], 'r': REGS, 'f': FP_REGS, + 'eo': EVEN_REGS, 'r/m': REGS, 'm': range_of_bits(4), 'i4': range_of_bits(4, signed=True), @@ -138,6 +146,7 @@ 'i16': range_of_bits(16, signed=True), 'i32': range_of_bits(32, signed=True), 'i64': range_of_bits(64, signed=True), + 'h32': range_of_halfword_bits(32, signed=True), 'u4': range_of_bits(4), 'u8': range_of_bits(8), 'u16': range_of_bits(16), @@ -165,6 +174,7 @@ def operand_combinations(self, methodname, modes, arguments): mapping = { 'r': (lambda num: REGNAMES[num]), + 'eo': (lambda num: REGNAMES[num]), 'r/m': (lambda num: REGNAMES[num]), 'f': (lambda num: FP_REGNAMES[num]), } From noreply at buildbot.pypy.org Wed Nov 11 09:46:05 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 11 Nov 2015 15:46:05 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: logical division for ufloor_div, added some methods for to get two registers next to each other from the reg alloc (not yet complete) Message-ID: <20151111144605.F184C1C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80633:6db64d28c955 Date: 2015-11-11 13:08 +0100 http://bitbucket.org/pypy/pypy/changeset/6db64d28c955/ Log: logical division for ufloor_div, added some methods for to get two registers next to each other from the reg alloc (not yet complete) started to write a test to explicitly stress division and multiplication diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -41,21 +41,20 @@ def prepare_int_div(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - l0,lr = self.ensure_even_odd_pair(a0) + lr,lq = self.ensure_even_odd_pair(a0) l1 = self.ensure_reg(a1) - xxx - self.force_result_in_reg(op, a0) + self.force_result_in_odd_reg(op, a0) self.free_op_vars() - return [l0, l1] + return [lr, lq, l1] def prepare_int_mod(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - l0,lr = self.ensure_even_odd_pair(a0) + lr,lq = self.ensure_even_odd_pair(a0) l1 = self.ensure_reg(a1) - self.force_arg_to_(op, a0) + self.force_result_in_even_reg(op, a0) self.free_op_vars() - return [l0, l1] + return [lr, lq, l1] def prepare_int_sub(self, op): diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -27,6 +27,9 @@ # div/mod 'DSGR': ('rre', ['\xB9','\x0D'], 'eo,r'), 'DSG': ('rxy', ['\xE3','\x0D'], 'eo,bidl'), + 'DLGR': ('rre', ['\xB9','\x97'], 'eo,r'), + 'DLG': ('rxy', ['\xE3','\x87'], 'eo,bidl'), + # there is no immidiate divide diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py --- a/rpython/jit/backend/zarch/locations.py +++ b/rpython/jit/backend/zarch/locations.py @@ -48,6 +48,12 @@ def is_reg(self): return True + def is_even(self): + return self.value % 2 == 0 + + def is_odd(self): + return self.value % 2 == 1 + def as_key(self): # 0 <= as_key <= 15 return self.value diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -10,7 +10,7 @@ def emit_int_add(self, op, arglocs, regalloc): l0, l1 = arglocs if l1.is_imm(): - self.mc.AGHI(l0, l1) + self.mc.AGFI(l0, l1) elif l1.is_in_pool(): self.mc.AG(l0, l1) else: @@ -19,11 +19,37 @@ def emit_int_mul(self, op, arglocs, regalloc): l0, l1 = arglocs if l1.is_imm(): - self.mc.AGHI(l0, l1) - elif l1.is_in_pool(): - self.mc.AG(l0, l1) + self.mc.MSFI(l0, l1) + if l1.is_in_pool(): + self.mc.MSG(l0, l1) else: - self.mc.AGR(l0, l1) + self.mc.MSGR(l0, l1) + + def emit_int_floordiv(self, op, arglocs, regalloc): + lr, lq, l1 = arglocs # lr == remainer, lq == quotient + # when entering the function lr contains the dividend + # after this operation either lr or lq is used further + assert not l1.is_imm() , "imm divider not supported" + # remainer is always a even register r0, r2, ... , r14 + assert lr.is_even() + assert lq.is_odd() + if l1.is_in_pool(): + self.mc.DSG(lr, l1) + else: + self.mc.DSGR(lr, l1) + + def emit_int_ufloordiv(self, op, arglocs, regalloc): + lr, lq, l1 = arglocs # lr == remainer, lq == quotient + # when entering the function lr contains the dividend + # after this operation either lr or lq is used further + assert not l1.is_imm() , "imm divider not supported" + # remainer is always a even register r0, r2, ... , r14 + assert lr.is_even() + assert lq.is_odd() + if l1.is_in_pool(): + self.mc.DLG(lr, l1) + else: + self.mc.DLGR(lr, l1) def emit_int_sub(self, op, arglocs, regalloc): l0, l1 = arglocs diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -135,6 +135,30 @@ self.temp_boxes.append(box) return reg + def ensure_even_odd_pair(self, var): + self.rm.ensure__check_type(var) + prev_loc = self.loc(var, must_exist=True) + if prev_loc is self.frame_reg: + return prev_loc + if not prev_loc.is_even(): + # we need to move it ... + pass + loc = self.force_allocate_reg(v, forbidden_vars, selected_reg, + need_lower_byte=need_lower_byte) + if prev_loc is not loc: + self.assembler.regalloc_mov(prev_loc, loc) + return loc + + + def force_result_in_even_reg(self, result_v, loc, forbidden_vars=[]): + xxx + pass + + def force_result_in_odd_reg(self, result_v, loc, forbidden_vars=[]): + xxx + pass + + class ZARCHFrameManager(FrameManager): def __init__(self, base_ofs): diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -23,3 +23,20 @@ cpu = CPU_S390_64(rtyper=None, stats=FakeStats()) cpu.setup_once() return cpu + + @py.test.parametrize('input,opcode,result', + [30,'i1 = int_mul(i0, 2)',60] + ) + def test_int_arithmetic_and_logic(self, input, opcode, result): + loop = parse(""" + [i0] + {opcode} + finish(i1, descr=faildescr) + """.format(opcode=opcode),namespace={"faildescr": BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, input) + fail = self.cpu.get_latest_descr(deadframe) + res = self.cpu.get_int_value(deadframe, 0) + assert res == result + assert fail.identifier == 1 From noreply at buildbot.pypy.org Wed Nov 11 09:46:08 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 11 Nov 2015 15:46:08 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: implemented int_mul, int_floordiv, uint_floordiv and int_mod Message-ID: <20151111144608.21E1D1C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80634:5a93f832d42a Date: 2015-11-11 15:46 +0100 http://bitbucket.org/pypy/pypy/changeset/5a93f832d42a/ Log: implemented int_mul, int_floordiv, uint_floordiv and int_mod added test case to ensure the correct register allocation (e.g. division takes a pair of even odd registers) not yet all cases covered for pair allocation diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -41,18 +41,18 @@ def prepare_int_div(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - lr,lq = self.ensure_even_odd_pair(a0) + lr,lq = self.rm.ensure_even_odd_pair(a0, bind_first=False) l1 = self.ensure_reg(a1) - self.force_result_in_odd_reg(op, a0) + self.rm.force_result_in_reg(op, a0) self.free_op_vars() return [lr, lq, l1] def prepare_int_mod(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - lr,lq = self.ensure_even_odd_pair(a0) + lr,lq = self.rm.ensure_even_odd_pair(a0, bind_first=True) l1 = self.ensure_reg(a1) - self.force_result_in_even_reg(op, a0) + self.rm.force_result_in_reg(op, a0) self.free_op_vars() return [lr, lq, l1] diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -185,7 +185,7 @@ self.writechar(opcode) byte = (reg_or_mask & 0xf) << 4 | (ord(halfopcode) & 0xf) self.writechar(chr(byte)) - if br or mnemonic == 'LARL': + if br: imm32 = imm32 >> 1 # half word boundary, addressing bytes self.write_i32(imm32 & BIT_MASK_32) @@ -350,7 +350,7 @@ for i,arg in enumerate(unrolling_iterable(func._arguments_)): if arg == '-': newargs[i] = 0 - elif arg == 'r' or arg == 'r/m' or arg == 'f': + elif arg == 'r' or arg == 'r/m' or arg == 'f' or arg == 'eo': newargs[i] = args[i].value elif arg.startswith('i') or arg.startswith('u') or arg.startswith('h'): newargs[i] = args[i].value diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -19,8 +19,8 @@ def emit_int_mul(self, op, arglocs, regalloc): l0, l1 = arglocs if l1.is_imm(): - self.mc.MSFI(l0, l1) - if l1.is_in_pool(): + self.mc.MSGFI(l0, l1) + elif l1.is_in_pool(): self.mc.MSG(l0, l1) else: self.mc.MSGR(l0, l1) @@ -29,7 +29,7 @@ lr, lq, l1 = arglocs # lr == remainer, lq == quotient # when entering the function lr contains the dividend # after this operation either lr or lq is used further - assert not l1.is_imm() , "imm divider not supported" + assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" # remainer is always a even register r0, r2, ... , r14 assert lr.is_even() assert lq.is_odd() @@ -38,18 +38,32 @@ else: self.mc.DSGR(lr, l1) - def emit_int_ufloordiv(self, op, arglocs, regalloc): + def emit_uint_floordiv(self, op, arglocs, regalloc): lr, lq, l1 = arglocs # lr == remainer, lq == quotient # when entering the function lr contains the dividend # after this operation either lr or lq is used further - assert not l1.is_imm() , "imm divider not supported" + assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" + # remainer is always a even register r0, r2, ... , r14 + assert lr.is_even() + assert lq.is_odd() + self.mc.XGR(lr, lr) + if l1.is_in_pool(): + self.mc.DLG(lr, l1) + else: + self.mc.DLGR(lr, l1) + + def emit_int_mod(self, op, arglocs, regalloc): + lr, lq, l1 = arglocs # lr == remainer, lq == quotient + # when entering the function lr contains the dividend + # after this operation either lr or lq is used further + assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" # remainer is always a even register r0, r2, ... , r14 assert lr.is_even() assert lq.is_odd() if l1.is_in_pool(): - self.mc.DLG(lr, l1) + self.mc.DSG(lr, l1) else: - self.mc.DLGR(lr, l1) + self.mc.DSGR(lr, l1) def emit_int_sub(self, op, arglocs, regalloc): l0, l1 = arglocs diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -135,27 +135,73 @@ self.temp_boxes.append(box) return reg - def ensure_even_odd_pair(self, var): - self.rm.ensure__check_type(var) + def ensure_even_odd_pair(self, var, bind_first=True): + self._check_type(var) prev_loc = self.loc(var, must_exist=True) + var2 = TempVar() + self.temp_boxes.append(var2) if prev_loc is self.frame_reg: return prev_loc - if not prev_loc.is_even(): - # we need to move it ... - pass - loc = self.force_allocate_reg(v, forbidden_vars, selected_reg, - need_lower_byte=need_lower_byte) - if prev_loc is not loc: - self.assembler.regalloc_mov(prev_loc, loc) + if bind_first: + loc, loc2 = self.force_allocate_reg_pair(var, var2, self.temp_boxes) + else: + loc, loc2 = self.force_allocate_reg_pair(var2, var, self.temp_boxes) + assert loc.is_even() and loc2.is_odd() + if prev_loc is not loc2: + # TODO is this true for each op? + # works for division -> if not parametrize + self.assembler.regalloc_mov(prev_loc, loc2) + return loc, loc2 + + def force_allocate_reg_pair(self, var, var2, forbidden_vars=[], selected_reg=None): + """ Forcibly allocate a register for the new variable v. + It must not be used so far. If we don't have a free register, + spill some other variable, according to algorithm described in + '_pick_variable_to_spill'. + + Will not spill a variable from 'forbidden_vars'. + """ + self._check_type(var) + self._check_type(var2) + if isinstance(var, TempVar): + self.longevity[var] = (self.position, self.position) + if isinstance(var2, TempVar): + self.longevity[var2] = (self.position, self.position) + even, odd = None, None + REGS = r.registers + i = len(self.free_regs)-1 + while i >= 0: + even = self.free_regs[i] + if even.is_even(): + odd = REGS[even.value+1] + print even, "is even", odd + if odd not in self.free_regs: + print odd, "is NOT free" + continue + print odd, "is free" + self.reg_bindings[var] = even + self.reg_bindings[var2] = odd + del self.free_regs[i] + i = self.free_regs.index(odd) + del self.free_regs[i] + return even, odd + i += 1 + + import pdb; pdb.set_trace() + xxx + loc = self._spill_var(v, forbidden_vars, selected_reg, + need_lower_byte=need_lower_byte) + prev_loc = self.reg_bindings.get(v, None) + if prev_loc is not None: + self.free_regs.append(prev_loc) + self.reg_bindings[v] = loc return loc def force_result_in_even_reg(self, result_v, loc, forbidden_vars=[]): - xxx pass def force_result_in_odd_reg(self, result_v, loc, forbidden_vars=[]): - xxx pass @@ -490,9 +536,9 @@ prepare_int_add = helper.prepare_int_add prepare_int_sub = helper.prepare_int_sub prepare_int_mul = helper.prepare_int_mul - prepare_int_floordiv = helper.prepare_div - prepare_uint_floordiv = helper.prepare_div - prepare_int_mod = helper.prepare_mod + prepare_int_floordiv = helper.prepare_int_div + prepare_uint_floordiv = helper.prepare_int_div + prepare_int_mod = helper.prepare_int_mod prepare_int_le = helper.prepare_cmp_op prepare_int_lt = helper.prepare_cmp_op diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -24,10 +24,18 @@ cpu.setup_once() return cpu - @py.test.parametrize('input,opcode,result', - [30,'i1 = int_mul(i0, 2)',60] - ) - def test_int_arithmetic_and_logic(self, input, opcode, result): + @py.test.mark.parametrize('value,opcode,result', + [ (30,'i1 = int_mul(i0, 2)',60), + (30,'i1 = int_floordiv(i0, 2)',15), + (2**31,'i1 = int_floordiv(i0, 15)',2**31//15), + (0,'i1 = int_floordiv(i0, 1)', 0), + (1,'i1 = int_floordiv(i0, 1)', 1), + (0,'i1 = uint_floordiv(i0, 1)', 0), + (1,'i1 = uint_floordiv(i0, 1)', 1), + (30,'i1 = int_mod(i0, 2)', 0), + (1,'i1 = int_mod(i0, 2)', 1), + ]) + def test_int_arithmetic_and_logic(self, value, opcode, result): loop = parse(""" [i0] {opcode} @@ -35,7 +43,7 @@ """.format(opcode=opcode),namespace={"faildescr": BasicFinalDescr(1)}) looptoken = JitCellToken() self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, input) + deadframe = self.cpu.execute_token(looptoken, value) fail = self.cpu.get_latest_descr(deadframe) res = self.cpu.get_int_value(deadframe, 0) assert res == result From noreply at buildbot.pypy.org Wed Nov 11 09:47:59 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 11 Nov 2015 15:47:59 +0100 (CET) Subject: [pypy-commit] pypy py3.3: pseudo fix of this test, I would remove it. maybe someone wants to review this test? Message-ID: <20151111144759.1ABFA1C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: py3.3 Changeset: r80635:14fcbf845d84 Date: 2015-11-05 17:49 +0100 http://bitbucket.org/pypy/pypy/changeset/14fcbf845d84/ Log: pseudo fix of this test, I would remove it. maybe someone wants to review this test? diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py --- a/pypy/module/imp/test/test_app.py +++ b/pypy/module/imp/test/test_app.py @@ -166,6 +166,13 @@ def test_path_importer_cache(self): import os import sys + # this is the only way this makes sense. _bootstrap + # will eventually load os from lib_pypy and place + # a file finder in path_importer_cache. + # XXX Why not remove this test? XXX + sys.path_importer_cache.clear() + import sys # sys is looked up in pypy/module thus + # lib_pypy will not end up in sys.path_impoter_cache lib_pypy = os.path.abspath( os.path.join(self.file_module, "..", "..", "..", "..", "..", "lib_pypy") From noreply at buildbot.pypy.org Wed Nov 11 11:34:54 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 11 Nov 2015 17:34:54 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: merge default Message-ID: <20151111163455.0D45C1C069F@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80636:3b4f8d55d26f Date: 2015-11-09 17:00 +0100 http://bitbucket.org/pypy/pypy/changeset/3b4f8d55d26f/ Log: merge default diff too long, truncating to 2000 out of 40731 lines diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ .hg .svn +# VIM +*.swp +*.swo + *.pyc *.pyo *~ +__pycache__/ bin/pypy-c include/*.h @@ -22,4 +27,6 @@ pypy/translator/goal/pypy-c pypy/translator/goal/target*-c release/ +!pypy/tool/release/ rpython/_cache/ +__pycache__/ diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), - ('type_specifier -> SHORT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',711), - ('type_specifier -> INT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',712), - ('type_specifier -> LONG','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',713), - ('type_specifier -> FLOAT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',714), - ('type_specifier -> DOUBLE','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',715), - ('type_specifier -> _COMPLEX','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',716), - ('type_specifier -> SIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',717), - ('type_specifier -> UNSIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',718), - ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',723), - ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',724), - ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',725), - ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',730), - ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',731), - ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',732), - ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list_1','../pycparser/c_parser.py',737), - ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list_1','../pycparser/c_parser.py',738), - ('init_declarator_list -> EQUALS initializer','init_declarator_list',2,'p_init_declarator_list_2','../pycparser/c_parser.py',748), - ('init_declarator_list -> abstract_declarator','init_declarator_list',1,'p_init_declarator_list_3','../pycparser/c_parser.py',756), - ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','../pycparser/c_parser.py',764), - ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','../pycparser/c_parser.py',765), - ('specifier_qualifier_list -> type_qualifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','../pycparser/c_parser.py',770), - ('specifier_qualifier_list -> type_specifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','../pycparser/c_parser.py',775), - ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',783), - ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',784), - ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','../pycparser/c_parser.py',793), - ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',802), - ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',803), - ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',812), - ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',813), - ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','../pycparser/c_parser.py',820), - ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','../pycparser/c_parser.py',821), - ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','../pycparser/c_parser.py',826), - ('struct_declaration -> specifier_qualifier_list abstract_declarator SEMI','struct_declaration',3,'p_struct_declaration_2','../pycparser/c_parser.py',864), - ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','../pycparser/c_parser.py',878), - ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','../pycparser/c_parser.py',879), - ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','../pycparser/c_parser.py',887), - ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','../pycparser/c_parser.py',892), - ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','../pycparser/c_parser.py',893), - ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',901), - ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',902), - ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','../pycparser/c_parser.py',907), - ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',912), - ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',913), - ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','../pycparser/c_parser.py',918), - ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','../pycparser/c_parser.py',919), - ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','../pycparser/c_parser.py',920), - ('enumerator -> ID','enumerator',1,'p_enumerator','../pycparser/c_parser.py',931), - ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','../pycparser/c_parser.py',932), - ('declarator -> direct_declarator','declarator',1,'p_declarator_1','../pycparser/c_parser.py',947), - ('declarator -> pointer direct_declarator','declarator',2,'p_declarator_2','../pycparser/c_parser.py',952), - ('declarator -> pointer TYPEID','declarator',2,'p_declarator_3','../pycparser/c_parser.py',961), - ('direct_declarator -> ID','direct_declarator',1,'p_direct_declarator_1','../pycparser/c_parser.py',972), - ('direct_declarator -> LPAREN declarator RPAREN','direct_declarator',3,'p_direct_declarator_2','../pycparser/c_parser.py',981), - ('direct_declarator -> direct_declarator LBRACKET assignment_expression_opt RBRACKET','direct_declarator',4,'p_direct_declarator_3','../pycparser/c_parser.py',986), - ('direct_declarator -> direct_declarator LBRACKET TIMES RBRACKET','direct_declarator',4,'p_direct_declarator_4','../pycparser/c_parser.py',998), - ('direct_declarator -> direct_declarator LPAREN parameter_type_list RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1008), - ('direct_declarator -> direct_declarator LPAREN identifier_list_opt RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1009), - ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','../pycparser/c_parser.py',1036), - ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','../pycparser/c_parser.py',1037), - ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','../pycparser/c_parser.py',1047), - ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','../pycparser/c_parser.py',1048), - ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','../pycparser/c_parser.py',1053), - ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','../pycparser/c_parser.py',1054), - ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','../pycparser/c_parser.py',1062), - ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','../pycparser/c_parser.py',1063), - ('parameter_declaration -> declaration_specifiers declarator','parameter_declaration',2,'p_parameter_declaration_1','../pycparser/c_parser.py',1072), - ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','../pycparser/c_parser.py',1083), - ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','../pycparser/c_parser.py',1113), - ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','../pycparser/c_parser.py',1114), - ('initializer -> assignment_expression','initializer',1,'p_initializer_1','../pycparser/c_parser.py',1123), - ('initializer -> brace_open initializer_list brace_close','initializer',3,'p_initializer_2','../pycparser/c_parser.py',1128), - ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','../pycparser/c_parser.py',1129), - ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','../pycparser/c_parser.py',1134), - ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','../pycparser/c_parser.py',1135), - ('designation -> designator_list EQUALS','designation',2,'p_designation','../pycparser/c_parser.py',1146), - ('designator_list -> designator','designator_list',1,'p_designator_list','../pycparser/c_parser.py',1154), - ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','../pycparser/c_parser.py',1155), - ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','../pycparser/c_parser.py',1160), - ('designator -> PERIOD identifier','designator',2,'p_designator','../pycparser/c_parser.py',1161), - ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','../pycparser/c_parser.py',1166), - ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','../pycparser/c_parser.py',1182), From noreply at buildbot.pypy.org Wed Nov 11 11:34:57 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 11 Nov 2015 17:34:57 +0100 (CET) Subject: [pypy-commit] pypy default: improvements to bytearray Message-ID: <20151111163457.1CEB41C069F@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: Changeset: r80637:0ab30523c9ce Date: 2015-11-11 17:35 +0100 http://bitbucket.org/pypy/pypy/changeset/0ab30523c9ce/ Log: improvements to bytearray diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -1231,6 +1231,21 @@ def setitem(self, index, char): self.data[index] = char + def getslice(self, start, stop, step, size): + if size == 0: + return "" + if step == 1: + assert 0 <= start <= stop + if start == 0 and stop == len(self.data): + return "".join(self.data) + return "".join(self.data[start:stop]) + return Buffer.getslice(self, start, stop, step, size) + + def setslice(self, start, string): + # No bounds checks. + for i in range(len(string)): + self.data[start + i] = string[i] + @specialize.argtype(1) def _memcmp(selfvalue, buffer, length): From noreply at buildbot.pypy.org Wed Nov 11 14:28:26 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 11 Nov 2015 20:28:26 +0100 (CET) Subject: [pypy-commit] pypy anntype: Separate more clearly raising links from regular links in flowin() Message-ID: <20151111192826.69D441C12F0@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80638:9ff39582e23f Date: 2015-11-11 18:55 +0000 http://bitbucket.org/pypy/pypy/changeset/9ff39582e23f/ Log: Separate more clearly raising links from regular links in flowin() diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -456,34 +456,35 @@ exits = [link for link in exits if link.exitcase == s_exitswitch.const] - # filter out those exceptions which cannot - # occour for this specific, typed operation. if block.canraise: op = block.raising_op can_only_throw = op.get_can_only_throw(self) if can_only_throw is not None: + # filter out those exceptions which cannot + # occur for this specific, typed operation. candidates = can_only_throw - candidate_exits = exits - exits = [] - for link in candidate_exits: + for link in exits: case = link.exitcase if case is None: - exits.append(link) + self.follow_link(graph, link, {}) continue covered = [c for c in candidates if issubclass(c, case)] if covered: - exits.append(link) + self.follow_link(graph, link, {}) candidates = [c for c in candidates if c not in covered] + else: + for link in exits: + self.follow_link(graph, link, {}) + else: + if isinstance(block.exitswitch, Variable): + knowntypedata = getattr(block.exitswitch.annotation, + "knowntypedata", {}) + else: + knowntypedata = {} + for link in exits: + constraints = knowntypedata.get(link.exitcase, {}) + self.follow_link(graph, link, constraints) - # mapping (exitcase, variable) -> s_annotation - # that can be attached to booleans, exitswitches - knowntypedata = {} - if isinstance(block.exitswitch, Variable): - knowntypedata = getattr(block.exitswitch.annotation, - "knowntypedata", {}) - for link in exits: - constraints = knowntypedata.get(link.exitcase, {}) - self.follow_link(graph, link, constraints) if block in self.notify: # reflow from certain positions when this block is done for callback in self.notify[block]: From noreply at buildbot.pypy.org Wed Nov 11 14:47:09 2015 From: noreply at buildbot.pypy.org (mattip) Date: Wed, 11 Nov 2015 20:47:09 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: str(np.dtype('c')) == '|S1', but str(np.dtype('c8') == 'complex64'. Go figure Message-ID: <20151111194709.CDB781C0413@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80639:f3c95cf1784f Date: 2015-11-09 19:34 +0200 http://bitbucket.org/pypy/pypy/changeset/f3c95cf1784f/ Log: str(np.dtype('c')) == '|S1', but str(np.dtype('c8') == 'complex64'. Go figure diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py --- a/pypy/module/micronumpy/descriptor.py +++ b/pypy/module/micronumpy/descriptor.py @@ -497,6 +497,8 @@ return self.descr_get_name(space) def descr_repr(self, space): + if isinstance(self.itemtype, types.CharType): + return space.wrap("dtype('S1')") if self.fields: r = self.descr_get_descr(space, style='repr') elif self.subdtype is not None: @@ -1122,7 +1124,7 @@ size = int(name[1:]) except ValueError: raise oefmt(space.w_TypeError, "data type not understood") - if char == NPY.CHARLTR: + if char == NPY.CHARLTR and size == 0: return W_Dtype( types.CharType(space), elsize=1, @@ -1133,7 +1135,7 @@ return new_unicode_dtype(space, size) elif char == NPY.VOIDLTR: return new_void_dtype(space, size) - assert False + raise oefmt(space.w_TypeError, 'data type "%s" not understood', name) def new_string_dtype(space, size): diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -1056,6 +1056,7 @@ assert d.char == 'c' assert d.kind == 'S' assert d.str == '|S1' + assert repr(d) == "dtype('S1')" class AppTestRecordDtypes(BaseNumpyAppTest): spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"]) From noreply at buildbot.pypy.org Wed Nov 11 14:47:12 2015 From: noreply at buildbot.pypy.org (mattip) Date: Wed, 11 Nov 2015 20:47:12 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: fix for most all of the 1.10 changes Message-ID: <20151111194712.1C3091C0413@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80640:d8f179999b92 Date: 2015-11-11 21:34 +0200 http://bitbucket.org/pypy/pypy/changeset/d8f179999b92/ Log: fix for most all of the 1.10 changes diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py --- a/pypy/module/micronumpy/base.py +++ b/pypy/module/micronumpy/base.py @@ -44,7 +44,7 @@ from pypy.module.micronumpy.strides import calc_strides if len(shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: ovfcheck(support.product_check(shape) * dtype.elsize) except OverflowError as e: @@ -69,7 +69,7 @@ isize = dtype.elsize if len(shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: totalsize = ovfcheck(support.product_check(shape) * isize) except OverflowError as e: diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py --- a/pypy/module/micronumpy/boxes.py +++ b/pypy/module/micronumpy/boxes.py @@ -444,7 +444,7 @@ @unwrap_spec(axis1=int, axis2=int) def descr_swapaxes(self, space, axis1, axis2): - return self + raise oefmt(space.w_ValueError, 'bad axis1 argument to swapaxes') def descr_fill(self, space, w_value): self.get_dtype(space).coerce(space, w_value) @@ -573,7 +573,7 @@ try: ofs, dtype = self.dtype.fields[item] except KeyError: - raise oefmt(space.w_IndexError, "invalid index") + raise oefmt(space.w_ValueError, "no field of name %s", item) from pypy.module.micronumpy.types import VoidType if isinstance(dtype.itemtype, VoidType): diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py --- a/pypy/module/micronumpy/concrete.py +++ b/pypy/module/micronumpy/concrete.py @@ -457,7 +457,7 @@ def set_shape(self, space, orig_array, new_shape): if len(new_shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: ovfcheck(support.product_check(new_shape) * self.dtype.elsize) except OverflowError as e: @@ -601,7 +601,7 @@ def set_shape(self, space, orig_array, new_shape): if len(new_shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: ovfcheck(support.product_check(new_shape) * self.dtype.elsize) except OverflowError as e: diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -18,7 +18,7 @@ raise oefmt(space.w_TypeError, "argument 1 must be numpy.dtype, not %T", w_dtype) if w_dtype.elsize == 0: - raise oefmt(space.w_ValueError, "itemsize cannot be zero") + raise oefmt(space.w_TypeError, "Empty data-type") if not space.isinstance_w(w_state, space.w_str): raise oefmt(space.w_TypeError, "initializing object must be a string") if space.len_w(w_state) != w_dtype.elsize: diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py --- a/pypy/module/micronumpy/descriptor.py +++ b/pypy/module/micronumpy/descriptor.py @@ -217,6 +217,8 @@ endian = ignore if self.num == NPY.UNICODE: size >>= 2 + if self.num == NPY.OBJECT: + return "%s%s" %(endian, basic) return "%s%s%s" % (endian, basic, size) def descr_get_descr(self, space, style='descr', force_dict=False): @@ -485,7 +487,12 @@ def descr_str(self, space): if self.fields: - return space.str(self.descr_get_descr(space, style='str')) + r = self.descr_get_descr(space, style='str') + name = space.str_w(space.str(self.w_box_type)) + if name != "": + boxname = space.str(self.w_box_type) + r = space.newtuple([self.w_box_type, r]) + return space.str(r) elif self.subdtype is not None: return space.str(space.newtuple([ self.subdtype.descr_get_str(space), @@ -501,6 +508,9 @@ return space.wrap("dtype('S1')") if self.fields: r = self.descr_get_descr(space, style='repr') + name = space.str_w(space.str(self.w_box_type)) + if name != "": + r = space.newtuple([space.wrap(self.w_box_type), r]) elif self.subdtype is not None: r = space.newtuple([self.subdtype.descr_get_str(space), self.descr_get_shape(space)]) @@ -944,7 +954,7 @@ shape_w = space.fixedview(w_shape) if len(shape_w) < 1: return None - elif len(shape_w) == 1 and space.isinstance_w(shape_w[0], space.w_tuple): + elif space.isinstance_w(shape_w[0], space.w_tuple): # (base_dtype, new_dtype) dtype spectification return None shape = [] @@ -999,12 +1009,16 @@ if len(spec) > 0: # this is (base_dtype, new_dtype) so just make it a union by setting both # parts' offset to 0 - try: - dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment) - except: - raise - raise oefmt(space.w_NotImplementedError, - "(base_dtype, new_dtype) dtype spectification discouraged, not implemented") + w_dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment) + assert isinstance(w_dtype, W_Dtype) + assert isinstance(w_dtype1, W_Dtype) + if (w_dtype.elsize != 0 and w_dtype1.elsize != 0 and + w_dtype1.elsize != w_dtype.elsize): + raise oefmt(space.w_ValueError, + 'mismatch in size of old and new data-descriptor') + retval = W_Dtype(w_dtype.itemtype, w_dtype.w_box_type, + names=w_dtype1.names[:], fields=w_dtype1.fields.copy()) + return retval if space.is_none(w_dtype): return cache.w_float64dtype if space.isinstance_w(w_dtype, w_subtype): @@ -1034,19 +1048,22 @@ elif space.isinstance_w(w_dtype, space.w_tuple): w_dtype0 = space.getitem(w_dtype, space.wrap(0)) w_dtype1 = space.getitem(w_dtype, space.wrap(1)) - if space.isinstance_w(w_dtype0, space.w_type) and \ - space.isinstance_w(w_dtype1, space.w_list): - #obscure api - (subclass, spec). Ignore the subclass - return make_new_dtype(space, w_subtype, w_dtype1, alignment, - copy=copy, w_shape=w_shape, w_metadata=w_metadata) - subdtype = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy) - assert isinstance(subdtype, W_Dtype) - if subdtype.elsize == 0: - name = "%s%d" % (subdtype.kind, space.int_w(w_dtype1)) + # create a new dtype object + l_side = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy) + assert isinstance(l_side, W_Dtype) + if l_side.elsize == 0 and space.isinstance_w(w_dtype1, space.w_int): + #(flexible_dtype, itemsize) + name = "%s%d" % (l_side.kind, space.int_w(w_dtype1)) retval = make_new_dtype(space, w_subtype, space.wrap(name), alignment, copy) - else: - retval = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy, w_shape=w_dtype1) - return _set_metadata_and_copy(space, w_metadata, retval, copy) + return _set_metadata_and_copy(space, w_metadata, retval, copy) + elif (space.isinstance_w(w_dtype1, space.w_int) or + space.isinstance_w(w_dtype1, space.w_tuple) or + space.isinstance_w(w_dtype1, space.w_list) or + isinstance(w_dtype1, W_NDimArray)): + #(fixed_dtype, shape) or (base_dtype, new_dtype) + retval = make_new_dtype(space, w_subtype, l_side, alignment, + copy, w_shape=w_dtype1) + return _set_metadata_and_copy(space, w_metadata, retval, copy) elif space.isinstance_w(w_dtype, space.w_dict): return _set_metadata_and_copy(space, w_metadata, dtype_from_dict(space, w_dtype, alignment), copy) diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -278,7 +278,7 @@ def getfield(self, space, field): dtype = self.get_dtype() if field not in dtype.fields: - raise oefmt(space.w_ValueError, "field named %s not found", field) + raise oefmt(space.w_ValueError, "no field of name %s", field) arr = self.implementation ofs, subdtype = arr.dtype.fields[field][:2] # ofs only changes start @@ -489,10 +489,8 @@ numpy.swapaxes : equivalent function """ if axis1 == axis2: - return self + return self.descr_view(space) n = self.ndims() - if n <= 1: - return self if axis1 < 0: axis1 += n if axis2 < 0: @@ -501,6 +499,8 @@ raise oefmt(space.w_ValueError, "bad axis1 argument to swapaxes") if axis2 < 0 or axis2 >= n: raise oefmt(space.w_ValueError, "bad axis2 argument to swapaxes") + if n <= 1: + return self return self.implementation.swapaxes(space, self, axis1, axis2) def descr_nonzero(self, space): @@ -899,7 +899,7 @@ if cur_shape[i] != 1: raise OperationError(space.w_ValueError, space.wrap( "cannot select an axis to squeeze out " - "which has size greater than one")) + "which has size not equal to one")) else: new_shape.append(cur_shape[i]) else: @@ -1374,7 +1374,7 @@ shape = shape_converter(space, w_shape, dtype) if len(shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) if not space.is_none(w_buffer): if (not space.is_none(w_strides)): strides = [space.int_w(w_i) for w_i in diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -487,10 +487,6 @@ for o in [object, O]: assert np.dtype(o).str == '|O' # Issue gh-2798 - if '__pypy__' in sys.builtin_module_names: - a = np.array(['a'], dtype="O") - raises(NotImplementedError, a.astype, ("O", [("name", "O")])) - skip("(base_dtype, new_dtype) dtype specification discouraged") a = np.array(['a'], dtype="O").astype(("O", [("name", "O")])) assert a[0] == 'a' assert a != 'a' diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -838,13 +838,19 @@ def test_build_scalar(self): from numpy import dtype + import sys try: from numpy.core.multiarray import scalar except ImportError: from numpy import scalar exc = raises(TypeError, scalar, int, 2) assert exc.value[0] == 'argument 1 must be numpy.dtype, not type' - a = scalar(dtype('void'), 'abc') + if '__pypy__' in sys.builtin_module_names: + exc = raises(TypeError, scalar, dtype('void'), 'abc') + else: + a = scalar(dtype('void'), 'abc') + exc = raises(TypeError, str, a) + assert exc.value[0] == 'Empty data-type' exc = raises(TypeError, scalar, dtype(float), 2.5) assert exc.value[0] == 'initializing object must be a string' exc = raises(ValueError, scalar, dtype(float), 'abc') @@ -2398,6 +2404,7 @@ def test_data(self): from numpy import array + import sys a = array([1, 2, 3, 4], dtype='i4') assert a.data[0] == '\x01' assert a.data[1] == '\x00' diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py --- a/pypy/module/micronumpy/types.py +++ b/pypy/module/micronumpy/types.py @@ -450,10 +450,12 @@ @specialize.argtype(1) def round(self, v, decimals=0): - if decimals != 0: - # numpy 1.9.0 compatible - return v - return Float64(self.space).box(self.unbox(v)) + if decimals == 0: + return Float64(self.space).box(self.unbox(v)) + # numpy 1.10 compatibility + raise oefmt(self.space.w_TypeError, "ufunc casting failure") + + class Integer(Primitive): _mixin_ = True From noreply at buildbot.pypy.org Thu Nov 12 01:47:41 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 07:47:41 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictiter: ready to merge Message-ID: <20151112064741.73BB51C0530@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictiter Changeset: r80641:a4e036ee9e22 Date: 2015-11-12 07:47 +0100 http://bitbucket.org/pypy/pypy/changeset/a4e036ee9e22/ Log: ready to merge From noreply at buildbot.pypy.org Thu Nov 12 01:47:44 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 07:47:44 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: hg merge stmgc-c8-dictiter Message-ID: <20151112064744.6314A1C0530@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8 Changeset: r80642:8c3e06db1827 Date: 2015-11-12 07:48 +0100 http://bitbucket.org/pypy/pypy/changeset/8c3e06db1827/ Log: hg merge stmgc-c8-dictiter Iterators over stm dictionaries. diff --git a/pypy/module/pypystm/hashtable.py b/pypy/module/pypystm/hashtable.py --- a/pypy/module/pypystm/hashtable.py +++ b/pypy/module/pypystm/hashtable.py @@ -2,6 +2,7 @@ The class pypystm.hashtable, mapping integers to objects. """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault @@ -78,6 +79,55 @@ for i in range(count)] return space.newlist(lst_w) + def iterkeys_w(self, space): + return W_HashtableIterKeys(self.h) + + def itervalues_w(self, space): + return W_HashtableIterValues(self.h) + + def iteritems_w(self, space): + return W_HashtableIterItems(self.h) + + +class W_BaseHashtableIter(W_Root): + _immutable_fields_ = ["hiter"] + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx overestimate: doesn't remove the items already yielded, + # and uses the faster len_estimate() + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + return self.get_final_value(space, entry) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +class W_HashtableIterKeys(W_BaseHashtableIter): + def get_final_value(self, space, entry): + return space.wrap(intmask(entry.index)) + +class W_HashtableIterValues(W_BaseHashtableIter): + def get_final_value(self, space, entry): + return cast_gcref_to_instance(W_Root, entry.object) + +class W_HashtableIterItems(W_BaseHashtableIter): + def get_final_value(self, space, entry): + return space.newtuple([ + space.wrap(intmask(entry.index)), + cast_gcref_to_instance(W_Root, entry.object)]) + def W_Hashtable___new__(space, w_subtype): r = space.allocate_instance(W_Hashtable, w_subtype) @@ -98,4 +148,16 @@ keys = interp2app(W_Hashtable.keys_w), values = interp2app(W_Hashtable.values_w), items = interp2app(W_Hashtable.items_w), + + __iter__ = interp2app(W_Hashtable.iterkeys_w), + iterkeys = interp2app(W_Hashtable.iterkeys_w), + itervalues = interp2app(W_Hashtable.itervalues_w), + iteritems = interp2app(W_Hashtable.iteritems_w), ) + +W_BaseHashtableIter.typedef = TypeDef( + "hashtable_iter", + __iter__ = interp2app(W_BaseHashtableIter.descr_iter), + next = interp2app(W_BaseHashtableIter.descr_next), + __length_hint__ = interp2app(W_BaseHashtableIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -2,6 +2,7 @@ The class pypystm.stmdict, giving a part of the regular 'dict' interface """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault @@ -215,10 +216,6 @@ def len_w(self, space): return space.wrap(self.get_length()) - def iter_w(self, space): - # not a real lazy iterator! - return space.iter(self.keys_w(space)) - def keys_w(self, space): return space.newlist(self.get_keys_values_w(offset=0)) @@ -228,6 +225,70 @@ def items_w(self, space): return space.newlist(self.get_items_w(space)) + def iterkeys_w(self, space): + return W_STMDictIterKeys(self.h) + + def itervalues_w(self, space): + return W_STMDictIterValues(self.h) + + def iteritems_w(self, space): + return W_STMDictIterItems(self.h) + + +class W_BaseSTMDictIter(W_Root): + _immutable_fields_ = ["hiter"] + next_from_same_hash = 0 + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx estimate: doesn't remove the items already yielded, + # and uses the faster len_estimate(); on the other hand, + # counts only one for every 64-bit hash value + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + else: + index = self.next_from_same_hash + array = self.next_array + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 2: # uncommon case + self.next_from_same_hash = index + 2 + self.next_array = array + # + return self.get_final_value(space, array, index) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +class W_STMDictIterKeys(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return cast_gcref_to_instance(W_Root, array[index]) + +class W_STMDictIterValues(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return cast_gcref_to_instance(W_Root, array[index + 1]) + +class W_STMDictIterItems(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return space.newtuple([ + cast_gcref_to_instance(W_Root, array[index]), + cast_gcref_to_instance(W_Root, array[index + 1])]) + def W_STMDict___new__(space, w_subtype): r = space.allocate_instance(W_STMDict, w_subtype) @@ -246,8 +307,19 @@ setdefault = interp2app(W_STMDict.setdefault_w), __len__ = interp2app(W_STMDict.len_w), - __iter__ = interp2app(W_STMDict.iter_w), keys = interp2app(W_STMDict.keys_w), values = interp2app(W_STMDict.values_w), items = interp2app(W_STMDict.items_w), + + __iter__ = interp2app(W_STMDict.iterkeys_w), + iterkeys = interp2app(W_STMDict.iterkeys_w), + itervalues = interp2app(W_STMDict.itervalues_w), + iteritems = interp2app(W_STMDict.iteritems_w), ) + +W_BaseSTMDictIter.typedef = TypeDef( + "stmdict_iter", + __iter__ = interp2app(W_BaseSTMDictIter.descr_iter), + next = interp2app(W_BaseSTMDictIter.descr_next), + __length_hint__ = interp2app(W_BaseSTMDictIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/stmset.py b/pypy/module/pypystm/stmset.py --- a/pypy/module/pypystm/stmset.py +++ b/pypy/module/pypystm/stmset.py @@ -2,6 +2,7 @@ The class pypystm.stmset, giving a part of the regular 'set' interface """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app @@ -150,8 +151,48 @@ return space.wrap(self.get_length()) def iter_w(self, space): - # not a real lazy iterator! - return space.iter(space.newlist(self.get_items_w())) + return W_STMSetIter(self.h) + + +class W_STMSetIter(W_Root): + _immutable_fields_ = ["hiter"] + next_from_same_hash = 0 + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx estimate: doesn't remove the items already yielded, + # and uses the faster len_estimate(); on the other hand, + # counts only one for every 64-bit hash value + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + else: + index = self.next_from_same_hash + array = self.next_array + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 1: # uncommon case + self.next_from_same_hash = index + 1 + self.next_array = array + # + return cast_gcref_to_instance(W_Root, array[index]) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) def W_STMSet___new__(space, w_subtype): @@ -170,3 +211,10 @@ __len__ = interp2app(W_STMSet.len_w), __iter__ = interp2app(W_STMSet.iter_w), ) + +W_STMSetIter.typedef = TypeDef( + "stmset_iter", + __iter__ = interp2app(W_STMSetIter.descr_iter), + next = interp2app(W_STMSetIter.descr_next), + __length_hint__ = interp2app(W_STMSetIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/test/test_hashtable.py b/pypy/module/pypystm/test/test_hashtable.py --- a/pypy/module/pypystm/test/test_hashtable.py +++ b/pypy/module/pypystm/test/test_hashtable.py @@ -55,3 +55,13 @@ assert sorted(h.keys()) == [42, 43] assert sorted(h.values()) == ["bar", "foo"] assert sorted(h.items()) == [(42, "foo"), (43, "bar")] + + def test_iterator(self): + import pypystm + h = pypystm.hashtable() + h[42] = "foo" + h[43] = "bar" + assert sorted(h) == [42, 43] + assert sorted(h.iterkeys()) == [42, 43] + assert sorted(h.itervalues()) == ["bar", "foo"] + assert sorted(h.iteritems()) == [(42, "foo"), (43, "bar")] diff --git a/pypy/module/pypystm/test/test_stmdict.py b/pypy/module/pypystm/test/test_stmdict.py --- a/pypy/module/pypystm/test/test_stmdict.py +++ b/pypy/module/pypystm/test/test_stmdict.py @@ -158,3 +158,24 @@ assert a not in d assert b not in d assert d.keys() == [] + + + def test_iterator(self): + import pypystm + class A(object): + def __hash__(self): + return 42 + class B(object): + pass + d = pypystm.stmdict() + a1 = A() + a2 = A() + b0 = B() + d[a1] = "foo" + d[a2] = None + d[b0] = "bar" + assert sorted(d) == sorted([a1, a2, b0]) + assert sorted(d.iterkeys()) == sorted([a1, a2, b0]) + assert sorted(d.itervalues()) == [None, "bar", "foo"] + assert sorted(d.iteritems()) == sorted([(a1, "foo"), (a2, None), + (b0, "bar")]) diff --git a/pypy/module/pypystm/test/test_stmset.py b/pypy/module/pypystm/test/test_stmset.py --- a/pypy/module/pypystm/test/test_stmset.py +++ b/pypy/module/pypystm/test/test_stmset.py @@ -83,3 +83,19 @@ assert len(s) == 2 items = list(s) assert items == [42.5, key3] or items == [key3, 42.5] + + def test_iterator(self): + import pypystm + class A(object): + def __hash__(self): + return 42 + class B(object): + pass + d = pypystm.stmset() + a1 = A() + a2 = A() + b0 = B() + d.add(a1) + d.add(a2) + d.add(b0) + assert sorted(d) == sorted([a1, a2, b0]) diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -223,11 +223,13 @@ # ____________________________________________________________ _STM_HASHTABLE_P = rffi.COpaquePtr('stm_hashtable_t') +_STM_HASHTABLE_TABLE_P = rffi.COpaquePtr('stm_hashtable_table_t') _STM_HASHTABLE_ENTRY = lltype.GcStruct('HASHTABLE_ENTRY', ('index', lltype.Unsigned), ('object', llmemory.GCREF)) _STM_HASHTABLE_ENTRY_P = lltype.Ptr(_STM_HASHTABLE_ENTRY) +_STM_HASHTABLE_ENTRY_PP = rffi.CArrayPtr(_STM_HASHTABLE_ENTRY_P) _STM_HASHTABLE_ENTRY_ARRAY = lltype.GcArray(_STM_HASHTABLE_ENTRY_P) @dont_look_inside @@ -245,6 +247,11 @@ lltype.nullptr(_STM_HASHTABLE_ENTRY_ARRAY)) @dont_look_inside +def _ll_hashtable_len_estimate(h): + return llop.stm_hashtable_length_upper_bound(lltype.Signed, + h.ll_raw_hashtable) + + at dont_look_inside def _ll_hashtable_list(h): upper_bound = llop.stm_hashtable_length_upper_bound(lltype.Signed, h.ll_raw_hashtable) @@ -264,6 +271,28 @@ def _ll_hashtable_writeobj(h, entry, value): llop.stm_hashtable_write_entry(lltype.Void, h, entry, value) + at dont_look_inside +def _ll_hashtable_iterentries(h): + rgc.register_custom_trace_hook(_HASHTABLE_ITER_OBJ, + lambda_hashtable_iter_trace) + table = llop.stm_hashtable_iter(_STM_HASHTABLE_TABLE_P, h.ll_raw_hashtable) + hiter = lltype.malloc(_HASHTABLE_ITER_OBJ) + hiter.hashtable = h # for keepalive + hiter.table = table + hiter.prev = lltype.nullptr(_STM_HASHTABLE_ENTRY_PP.TO) + return hiter + + at dont_look_inside +def _ll_hashiter_next(hiter): + entrypp = llop.stm_hashtable_iter_next(_STM_HASHTABLE_ENTRY_PP, + hiter.hashtable, + hiter.table, + hiter.prev) + if not entrypp: + raise StopIteration + hiter.prev = entrypp + return entrypp[0] + _HASHTABLE_OBJ = lltype.GcStruct('HASHTABLE_OBJ', ('ll_raw_hashtable', _STM_HASHTABLE_P), hints={'immutable': True}, @@ -271,11 +300,19 @@ adtmeths={'get': _ll_hashtable_get, 'set': _ll_hashtable_set, 'len': _ll_hashtable_len, + 'len_estimate': _ll_hashtable_len_estimate, 'list': _ll_hashtable_list, 'lookup': _ll_hashtable_lookup, - 'writeobj': _ll_hashtable_writeobj}) + 'writeobj': _ll_hashtable_writeobj, + 'iterentries': _ll_hashtable_iterentries}) NULL_HASHTABLE = lltype.nullptr(_HASHTABLE_OBJ) +_HASHTABLE_ITER_OBJ = lltype.GcStruct('HASHTABLE_ITER_OBJ', + ('hashtable', lltype.Ptr(_HASHTABLE_OBJ)), + ('table', _STM_HASHTABLE_TABLE_P), + ('prev', _STM_HASHTABLE_ENTRY_PP), + adtmeths={'next': _ll_hashiter_next}) + def _ll_hashtable_trace(gc, obj, callback, arg): from rpython.memory.gctransform.stmframework import get_visit_function visit_fn = get_visit_function(callback, arg) @@ -288,6 +325,15 @@ llop.stm_hashtable_free(lltype.Void, h.ll_raw_hashtable) lambda_hashtable_finlz = lambda: _ll_hashtable_finalizer +def _ll_hashtable_iter_trace(gc, obj, callback, arg): + from rpython.memory.gctransform.stmframework import get_visit_function + addr = obj + llmemory.offsetof(_HASHTABLE_ITER_OBJ, 'hashtable') + gc._trace_callback(callback, arg, addr) + visit_fn = get_visit_function(callback, arg) + addr = obj + llmemory.offsetof(_HASHTABLE_ITER_OBJ, 'table') + llop.stm_hashtable_iter_tracefn(lltype.Void, addr.address[0], visit_fn) +lambda_hashtable_iter_trace = lambda: _ll_hashtable_iter_trace + _false = CDefinedIntSymbolic('0', default=0) # remains in the C code @dont_look_inside @@ -344,6 +390,9 @@ items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] return len(items) + def len_estimate(self): + return len(self._content) + def list(self): items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] count = len(items) @@ -359,6 +408,9 @@ assert isinstance(entry, EntryObjectForTest) self.set(entry.key, nvalue) + def iterentries(self): + return IterEntriesForTest(self, self._content.itervalues()) + class EntryObjectForTest(object): def __init__(self, hashtable, key): self.hashtable = hashtable @@ -374,6 +426,14 @@ object = property(_getobj, _setobj) +class IterEntriesForTest(object): + def __init__(self, hashtable, iterator): + self.hashtable = hashtable + self.iterator = iterator + + def next(self): + return next(self.iterator) + # ____________________________________________________________ _STM_QUEUE_P = rffi.COpaquePtr('stm_queue_t') diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -486,6 +486,10 @@ 'stm_hashtable_list' : LLOp(), 'stm_hashtable_tracefn': LLOp(), + 'stm_hashtable_iter': LLOp(), + 'stm_hashtable_iter_next': LLOp(), + 'stm_hashtable_iter_tracefn': LLOp(), + 'stm_queue_create': LLOp(), 'stm_queue_free': LLOp(), 'stm_queue_get': LLOp(canmallocgc=True), # push roots! diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -398,9 +398,28 @@ arg0 = funcgen.expr(op.args[0]) arg1 = funcgen.expr(op.args[1]) arg2 = funcgen.expr(op.args[2]) - return ('stm_hashtable_tracefn(%s, (stm_hashtable_t *)%s, ' + return ('stm_hashtable_tracefn(%s, (stm_hashtable_t *)%s,' ' (void(*)(object_t**))%s);' % (arg0, arg1, arg2)) +def stm_hashtable_iter(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + result = funcgen.expr(op.result) + return '%s = stm_hashtable_iter(%s);' % (result, arg0) + +def stm_hashtable_iter_next(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + arg1 = funcgen.expr(op.args[1]) + arg2 = funcgen.expr(op.args[2]) + result = funcgen.expr(op.result) + return ('%s = stm_hashtable_iter_next(%s, %s, %s);' % + (result, arg0, arg1, arg2)) + +def stm_hashtable_iter_tracefn(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + arg1 = funcgen.expr(op.args[1]) + return ('stm_hashtable_iter_tracefn((stm_hashtable_table_t *)%s,' + ' (void(*)(object_t**))%s);' % (arg0, arg1)) + def stm_queue_create(funcgen, op): result = funcgen.expr(op.result) return '%s = stm_queue_create();' % (result,) diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision --- a/rpython/translator/stm/src_stm/revision +++ b/rpython/translator/stm/src_stm/revision @@ -1,1 +1,1 @@ -41227d7659ac +72facb6e4533 diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c --- a/rpython/translator/stm/src_stm/stm/core.c +++ b/rpython/translator/stm/src_stm/stm/core.c @@ -1374,6 +1374,8 @@ from its segment. Better do it as soon as possible, because other threads might be spin-looping, waiting for the -1 to disappear. */ + /* but first, emit commit-event of this thread: */ + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_COMMIT); STM_SEGMENT->running_thread = NULL; write_fence(); assert(_stm_detached_inevitable_from_thread == -1); diff --git a/rpython/translator/stm/src_stm/stm/detach.c b/rpython/translator/stm/src_stm/stm/detach.c --- a/rpython/translator/stm/src_stm/stm/detach.c +++ b/rpython/translator/stm/src_stm/stm/detach.c @@ -127,6 +127,7 @@ // XXX: not sure if the next line is a good idea tl->last_associated_segment_num = remote_seg_num; ensure_gs_register(remote_seg_num); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); } dprintf(("reattach_transaction: start a new transaction\n")); @@ -185,6 +186,7 @@ assert(segnum > 0); ensure_gs_register(segnum); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); ensure_gs_register(mysegnum); } diff --git a/rpython/translator/stm/src_stm/stm/finalizer.c b/rpython/translator/stm/src_stm/stm/finalizer.c --- a/rpython/translator/stm/src_stm/stm/finalizer.c +++ b/rpython/translator/stm/src_stm/stm/finalizer.c @@ -501,7 +501,17 @@ /* XXX: become inevitable, bc. otherwise, we would need to keep around the original g_finalizers.run_finalizers to restore it in case of an abort. */ - _stm_become_inevitable("finalizer-Tx"); + _stm_become_inevitable(MSG_INEV_DONT_SLEEP); + /* did it work? */ + if (STM_PSEGMENT->transaction_state != TS_INEVITABLE) { /* no */ + /* avoid blocking here, waiting for another INEV transaction. + If we did that, application code could not proceed (start the + next transaction) and it will not be obvious from the profile + why we were WAITing. */ + _stm_commit_transaction(); + stm_rewind_jmp_leaveframe(tl, &rjbuf); + return; + } while (__sync_lock_test_and_set(&g_finalizers.lock, 1) != 0) { /* somebody is adding more finalizers (_commit_finalizer()) */ diff --git a/rpython/translator/stm/src_stm/stm/gcpage.c b/rpython/translator/stm/src_stm/stm/gcpage.c --- a/rpython/translator/stm/src_stm/stm/gcpage.c +++ b/rpython/translator/stm/src_stm/stm/gcpage.c @@ -224,6 +224,9 @@ version and thus don't need tracing. */ static struct list_s *marked_objects_to_trace; +/* a list of hobj/hashtable pairs for all hashtables seen */ +static struct list_s *all_hashtables_seen = NULL; + /* we use the sharing seg0's pages for the GCFLAG_VISITED flag */ static inline struct object_s *mark_loc(object_t *obj) @@ -301,8 +304,6 @@ } -#define TRACE_FOR_MAJOR_COLLECTION (&mark_record_trace) - static void mark_and_trace( object_t *obj, char *segment_base, /* to trace obj in */ @@ -791,6 +792,7 @@ /* marking */ LIST_CREATE(marked_objects_to_trace); + LIST_CREATE(all_hashtables_seen); mark_visit_from_modified_objects(); mark_visit_from_markers(); mark_visit_from_roots(); @@ -815,6 +817,10 @@ sweep_large_objects(); sweep_small_objects(); + /* hashtables */ + stm_compact_hashtables(); + LIST_FREE(all_hashtables_seen); + dprintf((" | used after collection: %ld\n", (long)pages_ctl.total_allocated)); dprintf((" `----------------------------------------------\n")); diff --git a/rpython/translator/stm/src_stm/stm/hashtable.c b/rpython/translator/stm/src_stm/stm/hashtable.c --- a/rpython/translator/stm/src_stm/stm/hashtable.c +++ b/rpython/translator/stm/src_stm/stm/hashtable.c @@ -49,8 +49,12 @@ #define PERTURB_SHIFT 5 #define RESIZING_LOCK 0 -typedef struct { - uintptr_t mask; +#define TRACE_FLAG_OFF 0 +#define TRACE_FLAG_ONCE 1 +#define TRACE_FLAG_KEEPALIVE 2 + +struct stm_hashtable_table_s { + uintptr_t mask; /* 'mask' is always immutable. */ /* 'resize_counter' start at an odd value, and is decremented (by 6) for every new item put in 'items'. When it crosses 0, we @@ -63,8 +67,10 @@ */ uintptr_t resize_counter; + uint8_t trace_flag; + stm_hashtable_entry_t *items[INITIAL_HASHTABLE_SIZE]; -} stm_hashtable_table_t; +}; #define IS_EVEN(p) (((p) & 1) == 0) @@ -79,6 +85,7 @@ { table->mask = itemcount - 1; table->resize_counter = itemcount * 4 + 1; + table->trace_flag = TRACE_FLAG_OFF; memset(table->items, 0, itemcount * sizeof(stm_hashtable_entry_t *)); } @@ -162,6 +169,7 @@ assert(biggertable); // XXX stm_hashtable_table_t *table = hashtable->table; + table->trace_flag = TRACE_FLAG_ONCE; table->resize_counter = (uintptr_t)biggertable; /* ^^^ this unlocks the table by writing a non-zero value to table->resize_counter, but the new value is a pointer to the @@ -485,6 +493,41 @@ static void _stm_compact_hashtable(struct object_s *hobj, stm_hashtable_t *hashtable) { + /* Walk the chained list that starts at 'hashtable->initial_table' + and follows the 'resize_counter' fields. Remove all tables + except (1) the initial one, (2) the most recent one, and (3) + the ones on which stm_hashtable_iter_tracefn() was called. + */ + stm_hashtable_table_t *most_recent_table = hashtable->table; + assert(!IS_EVEN(most_recent_table->resize_counter)); + /* set the "don't free me" flag on the most recent table */ + most_recent_table->trace_flag = TRACE_FLAG_KEEPALIVE; + + stm_hashtable_table_t *known_alive = &hashtable->initial_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + /* a KEEPALIVE flag is ignored on the initial table: it is never + individually freed anyway */ + + while (known_alive != most_recent_table) { + uintptr_t rc = known_alive->resize_counter; + assert(IS_EVEN(rc)); + assert(rc != RESIZING_LOCK); + + stm_hashtable_table_t *next_table = (stm_hashtable_table_t *)rc; + if (next_table->trace_flag != TRACE_FLAG_KEEPALIVE) { + /* free this next table and relink the chained list to skip it */ + assert(IS_EVEN(next_table->resize_counter)); + known_alive->resize_counter = next_table->resize_counter; + free(next_table); + } + else { + /* this next table is kept alive */ + known_alive = next_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + } + } + /* done the first part */ + stm_hashtable_table_t *table = hashtable->table; uintptr_t rc = table->resize_counter; assert(!IS_EVEN(rc)); @@ -515,35 +558,24 @@ dprintf(("compact with %ld items:\n", num_entries_times_6 / 6)); _stm_rehash_hashtable(hashtable, count, segnum); } +} - table = hashtable->table; - assert(!IS_EVEN(table->resize_counter)); - - if (table != &hashtable->initial_table) { - uintptr_t rc = hashtable->initial_table.resize_counter; - while (1) { - assert(IS_EVEN(rc)); - assert(rc != RESIZING_LOCK); - - stm_hashtable_table_t *old_table = (stm_hashtable_table_t *)rc; - if (old_table == table) - break; - rc = old_table->resize_counter; - free(old_table); - } - hashtable->initial_table.resize_counter = (uintptr_t)table; - assert(IS_EVEN(hashtable->initial_table.resize_counter)); +static void stm_compact_hashtables(void) +{ + uintptr_t i = all_hashtables_seen->count; + while (i > 0) { + i -= 2; + _stm_compact_hashtable( + (struct object_s *)all_hashtables_seen->items[i], + (stm_hashtable_t *)all_hashtables_seen->items[i + 1]); } } -void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, - void trace(object_t **)) +static void _hashtable_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) { - if (trace == TRACE_FOR_MAJOR_COLLECTION) - _stm_compact_hashtable(hobj, hashtable); - - stm_hashtable_table_t *table; - table = VOLATILE_HASHTABLE(hashtable)->table; + if (table->trace_flag == TRACE_FLAG_ONCE) + table->trace_flag = TRACE_FLAG_OFF; uintptr_t j, mask = table->mask; for (j = 0; j <= mask; j++) { @@ -554,3 +586,105 @@ } } } + +void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, + void trace(object_t **)) +{ + if (all_hashtables_seen != NULL) + all_hashtables_seen = list_append2(all_hashtables_seen, + (uintptr_t)hobj, + (uintptr_t)hashtable); + + _hashtable_tracefn(VOLATILE_HASHTABLE(hashtable)->table, trace); +} + + +/* Hashtable iterators */ + +/* TRACE_FLAG_ONCE: the table must be traced once if it supports an iterator + TRACE_FLAG_OFF: the table is the most recent table, or has already been + traced once + TRACE_FLAG_KEEPALIVE: during major collection only: mark tables that + must be kept alive because there are iterators +*/ + +struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *hashtable) +{ + /* Get the table. No synchronization is needed: we may miss some + entries that are being added, but they would contain NULL in + this segment anyway. */ + return VOLATILE_HASHTABLE(hashtable)->table; +} + +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, + stm_hashtable_entry_t **previous) +{ + /* Set the read marker on hobj for every item, in case we have + transaction breaks in-between. + */ + stm_read(hobj); + + /* Get the bounds of the part of the 'stm_hashtable_entry_t *' array + that we have to check */ + stm_hashtable_entry_t **pp, **last; + if (previous == NULL) + pp = table->items; + else + pp = previous + 1; + last = table->items + table->mask; + + /* Find the first non-null entry */ + stm_hashtable_entry_t *entry; + + while (pp <= last) { + entry = *(stm_hashtable_entry_t *volatile *)pp; + if (entry != NULL) { + stm_read((object_t *)entry); + if (entry->object != NULL) { + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, pp); + return pp; + } + } + ++pp; + } + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, NULL); + return NULL; +} + +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) +{ + if (all_hashtables_seen == NULL) { /* for minor collections */ + + /* During minor collection, tracing the table is only required + the first time: if it contains young objects, they must be + kept alive and have their address updated. We use + TRACE_FLAG_ONCE to know that. We don't need to do it if + our 'table' is the latest version, because in that case it + will be done by stm_hashtable_tracefn(). That's why + TRACE_FLAG_ONCE is only set when a more recent table is + attached. + + It is only needed once: non-latest-version tables are + immutable. We mark once all the entries as old, and + then these now-old objects stay alive until the next + major collection. + + Checking the flag can be done without synchronization: it + never wrong to call _hashtable_tracefn() too much, and the + only case where it *has to* be called occurs if the + hashtable object is still young (and not seen by other + threads). + */ + if (table->trace_flag == TRACE_FLAG_ONCE) + _hashtable_tracefn(table, trace); + } + else { /* for major collections */ + + /* Set this flag for _stm_compact_hashtable() */ + table->trace_flag = TRACE_FLAG_KEEPALIVE; + } +} diff --git a/rpython/translator/stm/src_stm/stm/hashtable.h b/rpython/translator/stm/src_stm/stm/hashtable.h new file mode 100644 --- /dev/null +++ b/rpython/translator/stm/src_stm/stm/hashtable.h @@ -0,0 +1,2 @@ +/* Imported by rpython/translator/stm/import_stmgc.py */ +static void stm_compact_hashtables(void); diff --git a/rpython/translator/stm/src_stm/stmgc.c b/rpython/translator/stm/src_stm/stmgc.c --- a/rpython/translator/stm/src_stm/stmgc.c +++ b/rpython/translator/stm/src_stm/stmgc.c @@ -20,6 +20,7 @@ #include "stm/finalizer.h" #include "stm/locks.h" #include "stm/detach.h" +#include "stm/hashtable.h" #include "stm/queue.h" #include "stm/misc.c" #include "stm/list.c" diff --git a/rpython/translator/stm/src_stm/stmgc.h b/rpython/translator/stm/src_stm/stmgc.h --- a/rpython/translator/stm/src_stm/stmgc.h +++ b/rpython/translator/stm/src_stm/stmgc.h @@ -100,6 +100,8 @@ #define _stm_detach_inevitable_transaction(tl) do { \ write_fence(); \ assert(_stm_detached_inevitable_from_thread == 0); \ + if (stmcb_timing_event != NULL && tl->self_or_0_if_atomic != 0) \ + {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ _stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \ } while (0) void _stm_reattach_transaction(intptr_t); @@ -416,69 +418,6 @@ #endif -/* Entering and leaving a "transactional code zone": a (typically very - large) section in the code where we are running a transaction. - This is the STM equivalent to "acquire the GIL" and "release the - GIL", respectively. stm_read(), stm_write(), stm_allocate(), and - other functions should only be called from within a transaction. - - Note that transactions, in the STM sense, cover _at least_ one - transactional code zone. They may be longer; for example, if one - thread does a lot of stm_enter_transactional_zone() + - stm_become_inevitable() + stm_leave_transactional_zone(), as is - typical in a thread that does a lot of C function calls, then we - get only a few bigger inevitable transactions that cover the many - short transactional zones. This is done by having - stm_leave_transactional_zone() turn the current transaction - inevitable and detach it from the running thread (if there is no - other inevitable transaction running so far). Then - stm_enter_transactional_zone() will try to reattach to it. This is - far more efficient than constantly starting and committing - transactions. - - stm_enter_transactional_zone() and stm_leave_transactional_zone() - preserve the value of errno. -*/ -#ifdef STM_DEBUGPRINT -#include -#endif -static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { - intptr_t self = tl->self_or_0_if_atomic; - if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, - self, 0)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_enter_transactional_zone fast path\n"); -#endif - } - else { - _stm_reattach_transaction(self); - /* _stm_detached_inevitable_from_thread should be 0 here, but - it can already have been changed from a parallel thread - (assuming we're not inevitable ourselves) */ - } -} -static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { - assert(STM_SEGMENT->running_thread == tl); - if (stm_is_inevitable(tl)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_leave_transactional_zone fast path\n"); -#endif - _stm_detach_inevitable_transaction(tl); - } - else { - _stm_leave_noninevitable_transactional_zone(); - } -} - -/* stm_force_transaction_break() is in theory equivalent to - stm_leave_transactional_zone() immediately followed by - stm_enter_transactional_zone(); however, it is supposed to be - called in CPU-heavy threads that had a transaction run for a while, - and so it *always* forces a commit and starts the next transaction. - The new transaction is never inevitable. See also - stm_should_break_transaction(). */ -void stm_force_transaction_break(stm_thread_local_t *tl); - /* Abort the currently running transaction. This function never returns: it jumps back to the start of the transaction (which must not be inevitable). */ @@ -596,6 +535,10 @@ STM_TRANSACTION_COMMIT, STM_TRANSACTION_ABORT, + /* DETACH/REATTACH is used for leaving/reentering the transactional */ + STM_TRANSACTION_DETACH, + STM_TRANSACTION_REATTACH, + /* inevitable contention: all threads that try to become inevitable have a STM_BECOME_INEVITABLE event with a position marker. Then, if it waits it gets a STM_WAIT_OTHER_INEVITABLE. It is possible @@ -688,6 +631,75 @@ } while (0) + +/* Entering and leaving a "transactional code zone": a (typically very + large) section in the code where we are running a transaction. + This is the STM equivalent to "acquire the GIL" and "release the + GIL", respectively. stm_read(), stm_write(), stm_allocate(), and + other functions should only be called from within a transaction. + + Note that transactions, in the STM sense, cover _at least_ one + transactional code zone. They may be longer; for example, if one + thread does a lot of stm_enter_transactional_zone() + + stm_become_inevitable() + stm_leave_transactional_zone(), as is + typical in a thread that does a lot of C function calls, then we + get only a few bigger inevitable transactions that cover the many + short transactional zones. This is done by having + stm_leave_transactional_zone() turn the current transaction + inevitable and detach it from the running thread (if there is no + other inevitable transaction running so far). Then + stm_enter_transactional_zone() will try to reattach to it. This is + far more efficient than constantly starting and committing + transactions. + + stm_enter_transactional_zone() and stm_leave_transactional_zone() + preserve the value of errno. +*/ +#ifdef STM_DEBUGPRINT +#include +#endif +static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { + intptr_t self = tl->self_or_0_if_atomic; + if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, + self, 0)) { + if (self != 0 && stmcb_timing_event != NULL) { + /* for atomic transactions, we don't emit DETACH/REATTACH */ + stmcb_timing_event(tl, STM_TRANSACTION_REATTACH, NULL); + } +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_enter_transactional_zone fast path\n"); +#endif + } + else { + _stm_reattach_transaction(self); + /* _stm_detached_inevitable_from_thread should be 0 here, but + it can already have been changed from a parallel thread + (assuming we're not inevitable ourselves) */ + } +} +static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { + assert(STM_SEGMENT->running_thread == tl); + if (stm_is_inevitable(tl)) { +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_leave_transactional_zone fast path\n"); +#endif + _stm_detach_inevitable_transaction(tl); + } + else { + _stm_leave_noninevitable_transactional_zone(); + } +} + +/* stm_force_transaction_break() is in theory equivalent to + stm_leave_transactional_zone() immediately followed by + stm_enter_transactional_zone(); however, it is supposed to be + called in CPU-heavy threads that had a transaction run for a while, + and so it *always* forces a commit and starts the next transaction. + The new transaction is never inevitable. See also + stm_should_break_transaction(). */ +void stm_force_transaction_break(stm_thread_local_t *tl); + + /* Support for light finalizers. This is a simple version of finalizers that guarantees not to do anything fancy, like not resurrecting objects. */ @@ -755,6 +767,21 @@ object_t *object; }; +/* Hashtable iterators. You get a raw 'table' pointer when you make + an iterator, which you pass to stm_hashtable_iter_next(). This may + or may not return items added after stm_hashtable_iter() was + called; there is no logic so far to detect changes (unlike Python's + RuntimeError). When the GC traces, you must keep the table pointer + alive with stm_hashtable_iter_tracefn(). The original hashtable + object must also be kept alive. */ +typedef struct stm_hashtable_table_s stm_hashtable_table_t; +stm_hashtable_table_t *stm_hashtable_iter(stm_hashtable_t *); +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, + stm_hashtable_entry_t **previous); +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)); + /* Queues. The items you put() and get() back are in random order. Like hashtables, the type 'stm_queue_t' is not an object type at From noreply at buildbot.pypy.org Thu Nov 12 03:23:49 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 09:23:49 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: Trying to use stm dicts as the general dictmultiobject strategy Message-ID: <20151112082349.115511C02A6@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80643:5f07ab86204e Date: 2015-11-12 07:49 +0100 http://bitbucket.org/pypy/pypy/changeset/5f07ab86204e/ Log: Trying to use stm dicts as the general dictmultiobject strategy From noreply at buildbot.pypy.org Thu Nov 12 03:23:51 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 09:23:51 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: started, not working at all---we need prebuilt stmdicts... Message-ID: <20151112082351.8A25A1C0413@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80644:0a32e67e5682 Date: 2015-11-12 09:23 +0100 http://bitbucket.org/pypy/pypy/changeset/0a32e67e5682/ Log: started, not working at all---we need prebuilt stmdicts... diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -273,6 +273,11 @@ default=False, # weakrefs needed, because of get_subclasses() requires=[("translation.rweakref", True)]), + + BoolOption("withstmdict", + "for stm: make all dicts be conflict-aware", + default=False, + requires=[("translation.stm", True)]), ]), ]) @@ -326,7 +331,7 @@ # it creates many conflicts # if config.objspace.std.withmapdict: # config.objspace.std.withmethodcache = True #False - pass + config.objspace.std.suggest(withstmdict=True) def enable_allworkingmodules(config): diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -101,38 +101,50 @@ return w_value +def create(): + return rstm.create_hashtable() + +def getitem(space, h, w_key): + entry, array, i = really_find_equal_item(space, h, w_key) + if array and i >= 0: + return cast_gcref_to_instance(W_Root, array[i + 1]) + space.raise_key_error(w_key) + +def setitem(space, h, w_key, w_value): + entry, array, i = really_find_equal_item(space, h, w_key) + if array: + if i >= 0: + # already there, update the value + array[i + 1] = cast_instance_to_gcref(w_value) + return + L = len(array) + narray = lltype.malloc(ARRAY, L + 2) + ll_arraycopy(array, narray, 0, 0, L) + else: + narray = lltype.malloc(ARRAY, 2) + L = 0 + narray[L] = cast_instance_to_gcref(w_key) + narray[L + 1] = cast_instance_to_gcref(w_value) + h.writeobj(entry, lltype.cast_opaque_ptr(llmemory.GCREF, narray)) + +def delitem(space, h, w_key): + if pop_from_entry(h, space, w_key) is None: + space.raise_key_error(w_key) + class W_STMDict(W_Root): def __init__(self): - self.h = rstm.create_hashtable() + self.h = create() def getitem_w(self, space, w_key): - entry, array, i = really_find_equal_item(space, self.h, w_key) - if array and i >= 0: - return cast_gcref_to_instance(W_Root, array[i + 1]) - space.raise_key_error(w_key) + return getitem(space, self.h, w_key) def setitem_w(self, space, w_key, w_value): - entry, array, i = really_find_equal_item(space, self.h, w_key) - if array: - if i >= 0: - # already there, update the value - array[i + 1] = cast_instance_to_gcref(w_value) - return - L = len(array) - narray = lltype.malloc(ARRAY, L + 2) - ll_arraycopy(array, narray, 0, 0, L) - else: - narray = lltype.malloc(ARRAY, 2) - L = 0 - narray[L] = cast_instance_to_gcref(w_key) - narray[L + 1] = cast_instance_to_gcref(w_value) - self.h.writeobj(entry, lltype.cast_opaque_ptr(llmemory.GCREF, narray)) + setitem(space, self.h, w_key, w_value) def delitem_w(self, space, w_key): - if pop_from_entry(self.h, space, w_key) is None: - space.raise_key_error(w_key) + delitem(space, self.h, w_key) def contains_w(self, space, w_key): entry, array, i = really_find_equal_item(space, self.h, w_key) diff --git a/pypy/objspace/std/celldict.py b/pypy/objspace/std/celldict.py --- a/pypy/objspace/std/celldict.py +++ b/pypy/objspace/std/celldict.py @@ -149,12 +149,9 @@ def switch_to_object_strategy(self, w_dict): space = self.space d = self.unerase(w_dict.dstorage) - strategy = space.fromcache(ObjectDictStrategy) - d_new = strategy.unerase(strategy.get_empty_storage()) + strategy = DictStrategy.make_empty_with_object_strategy(space, w_dict) for key, cell in d.iteritems(): - d_new[_wrapkey(space, key)] = unwrap_cell(self.space, cell) - w_dict.strategy = strategy - w_dict.dstorage = strategy.erase(d_new) + strategy.setitem_str(w_dict, key, unwrap_cell(space, cell)) def getiterkeys(self, w_dict): return self.unerase(w_dict.dstorage).iterkeys() diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py --- a/pypy/objspace/std/dictmultiobject.py +++ b/pypy/objspace/std/dictmultiobject.py @@ -55,13 +55,16 @@ elif space.config.objspace.std.withmapdict and instance: from pypy.objspace.std.mapdict import MapDictStrategy strategy = space.fromcache(MapDictStrategy) - elif instance or strdict or module: - assert w_type is None - strategy = space.fromcache(BytesDictStrategy) elif kwargs: assert w_type is None from pypy.objspace.std.kwargsdict import EmptyKwargsDictStrategy strategy = space.fromcache(EmptyKwargsDictStrategy) + elif space.config.objspace.std.withstmdict: + from pypy.objspace.std.stmdict import StmDictStrategy + strategy = space.fromcache(StmDictStrategy) + elif instance or strdict or module: + assert w_type is None + strategy = space.fromcache(BytesDictStrategy) else: strategy = space.fromcache(EmptyDictStrategy) if w_type is None: @@ -528,12 +531,30 @@ def prepare_update(self, w_dict, num_extra): pass + @staticmethod + def make_empty_with_object_strategy(space, w_dict): + if space.config.objspace.std.withstmdict: + from pypy.objspace.std.stmdict import StmDictStrategy + Cls = StmDictStrategy + else: + Cls = ObjectDictStrategy + strategy = space.fromcache(Cls) + storage = strategy.get_empty_storage() + w_dict.strategy = strategy + w_dict.dstorage = storage + return strategy + class EmptyDictStrategy(DictStrategy): erase, unerase = rerased.new_erasing_pair("empty") erase = staticmethod(erase) unerase = staticmethod(unerase) + def __init__(self, space): + DictStrategy.__init__(self, space) + assert not space.config.objspace.std.withstmdict, ( + "withstmdict: should not use EmptyDictStrategy at all") + def get_empty_storage(self): return self.erase(None) @@ -579,10 +600,7 @@ w_dict.dstorage = storage def switch_to_object_strategy(self, w_dict): - strategy = self.space.fromcache(ObjectDictStrategy) - storage = strategy.get_empty_storage() - w_dict.strategy = strategy - w_dict.dstorage = storage + DictStrategy.make_empty_with_object_strategy(self.space, w_dict) def getitem(self, w_dict, w_key): #return w_value or None @@ -840,6 +858,11 @@ class AbstractTypedStrategy(object): _mixin_ = True + def __init__(self, space): + DictStrategy.__init__(self, space) + assert not space.config.objspace.std.withstmdict, ( + "withstmdict: should not use %s at all" % self.__class__.__name__) + @staticmethod def erase(storage): raise NotImplementedError("abstract base class") diff --git a/pypy/objspace/std/stmdict.py b/pypy/objspace/std/stmdict.py new file mode 100644 --- /dev/null +++ b/pypy/objspace/std/stmdict.py @@ -0,0 +1,17 @@ +from rpython.rlib import rerased +from pypy.objspace.std.dictmultiobject import (DictStrategy, + create_iterator_classes) +from pypy.module.pypystm import stmdict + + +class StmDictStrategy(DictStrategy): + erase, unerase = rerased.new_erasing_pair("stm") + erase = staticmethod(erase) + unerase = staticmethod(unerase) + + def get_empty_storage(self): + return self.erase(stmdict.create()) + + def setitem(self, w_dict, w_key, w_value): + h = self.unerase(w_dict.dstorage) + stmdict.setitem(self.space, h, w_key, w_value) diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py --- a/pypy/objspace/std/test/test_dictmultiobject.py +++ b/pypy/objspace/std/test/test_dictmultiobject.py @@ -1118,6 +1118,7 @@ withmethodcache = False withidentitydict = False withmapdict = False + withstmdict = False FakeSpace.config = Config() diff --git a/pypy/objspace/std/test/test_stmdict.py b/pypy/objspace/std/test/test_stmdict.py new file mode 100644 --- /dev/null +++ b/pypy/objspace/std/test/test_stmdict.py @@ -0,0 +1,8 @@ +import py +from pypy.objspace.std.stmdict import StmDictStrategy +from pypy.objspace.std.test.test_dictmultiobject import ( + BaseTestRDictImplementation) + + +class TestStmDictImplementation(BaseTestRDictImplementation): + StrategyClass = StmDictStrategy From noreply at buildbot.pypy.org Thu Nov 12 04:25:05 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 10:25:05 +0100 (CET) Subject: [pypy-commit] pypy default: Kill a few remaining references to CALL_RELEASE_GIL_R Message-ID: <20151112092505.183D11C089E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80645:a28496435030 Date: 2015-11-12 10:25 +0100 http://bitbucket.org/pypy/pypy/changeset/a28496435030/ Log: Kill a few remaining references to CALL_RELEASE_GIL_R diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py --- a/rpython/jit/backend/arm/opassembler.py +++ b/rpython/jit/backend/arm/opassembler.py @@ -1169,7 +1169,6 @@ self._emit_call(op, arglocs, is_call_release_gil=True) return fcond emit_op_call_release_gil_i = _genop_call_release_gil - emit_op_call_release_gil_r = _genop_call_release_gil emit_op_call_release_gil_f = _genop_call_release_gil emit_op_call_release_gil_n = _genop_call_release_gil diff --git a/rpython/jit/backend/arm/regalloc.py b/rpython/jit/backend/arm/regalloc.py --- a/rpython/jit/backend/arm/regalloc.py +++ b/rpython/jit/backend/arm/regalloc.py @@ -1234,7 +1234,6 @@ return self._prepare_call(op, save_all_regs=True, first_arg_index=2) prepare_op_call_release_gil_i = _prepare_op_call_release_gil - prepare_op_call_release_gil_r = _prepare_op_call_release_gil prepare_op_call_release_gil_f = _prepare_op_call_release_gil prepare_op_call_release_gil_n = _prepare_op_call_release_gil diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -1365,7 +1365,6 @@ execute_call_release_gil_n = _execute_call_release_gil execute_call_release_gil_i = _execute_call_release_gil - execute_call_release_gil_r = _execute_call_release_gil execute_call_release_gil_f = _execute_call_release_gil def _new_execute_call_assembler(def_val): diff --git a/rpython/jit/backend/ppc/opassembler.py b/rpython/jit/backend/ppc/opassembler.py --- a/rpython/jit/backend/ppc/opassembler.py +++ b/rpython/jit/backend/ppc/opassembler.py @@ -638,7 +638,6 @@ self._emit_call(op, arglocs, is_call_release_gil=True) emit_call_release_gil_i = _genop_call_release_gil - emit_call_release_gil_r = _genop_call_release_gil emit_call_release_gil_f = _genop_call_release_gil emit_call_release_gil_n = _genop_call_release_gil diff --git a/rpython/jit/backend/ppc/regalloc.py b/rpython/jit/backend/ppc/regalloc.py --- a/rpython/jit/backend/ppc/regalloc.py +++ b/rpython/jit/backend/ppc/regalloc.py @@ -1050,7 +1050,6 @@ prepare_call_may_force_n = _prepare_call_may_force prepare_call_release_gil_i = _prepare_call_may_force - prepare_call_release_gil_r = _prepare_call_may_force prepare_call_release_gil_f = _prepare_call_may_force prepare_call_release_gil_n = _prepare_call_may_force diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -2106,7 +2106,6 @@ self._store_force_index(self._find_nearby_operation(+1)) self._genop_call(op, arglocs, result_loc, is_call_release_gil=True) genop_call_release_gil_i = _genop_call_release_gil - genop_call_release_gil_r = _genop_call_release_gil genop_call_release_gil_f = _genop_call_release_gil genop_call_release_gil_n = _genop_call_release_gil diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -902,7 +902,6 @@ # [Const(save_err), func_addr, args...] self._consider_call(op, guard_not_forced=True, first_arg_index=2) consider_call_release_gil_i = _consider_call_release_gil - consider_call_release_gil_r = _consider_call_release_gil consider_call_release_gil_f = _consider_call_release_gil consider_call_release_gil_n = _consider_call_release_gil diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -376,7 +376,6 @@ rop.SETARRAYITEM_RAW, rop.SETINTERIORFIELD_RAW, rop.CALL_RELEASE_GIL_I, - rop.CALL_RELEASE_GIL_R, rop.CALL_RELEASE_GIL_F, rop.CALL_RELEASE_GIL_N, rop.QUASIIMMUT_FIELD, diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1170,7 +1170,7 @@ 'CALL_ASSEMBLER/*d/rfin', # call already compiled assembler 'CALL_MAY_FORCE/*d/rfin', 'CALL_LOOPINVARIANT/*d/rfin', - 'CALL_RELEASE_GIL/*d/rfin', + 'CALL_RELEASE_GIL/*d/fin', # release the GIL and "close the stack" for asmgcc 'CALL_PURE/*d/rfin', # removed before it's passed to the backend 'CALL_MALLOC_GC/*d/r', # like CALL, but NULL => propagate MemoryError @@ -1597,8 +1597,8 @@ @staticmethod def is_call_release_gil(opnum): + # no R returning call_release_gil return (opnum == rop.CALL_RELEASE_GIL_I or - opnum == rop.CALL_RELEASE_GIL_R or opnum == rop.CALL_RELEASE_GIL_F or opnum == rop.CALL_RELEASE_GIL_N) From noreply at buildbot.pypy.org Thu Nov 12 07:40:44 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 12 Nov 2015 13:40:44 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added regalloc/assembler for shift & logic operations, tested them in a very basic trace Message-ID: <20151112124044.8B1091C089E@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80646:ec0e146d57f6 Date: 2015-11-12 13:41 +0100 http://bitbucket.org/pypy/pypy/changeset/ec0e146d57f6/ Log: added regalloc/assembler for shift & logic operations, tested them in a very basic trace diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py --- a/rpython/jit/backend/zarch/helper/assembler.py +++ b/rpython/jit/backend/zarch/helper/assembler.py @@ -67,3 +67,25 @@ def f(self, op, arglocs, regalloc): do_emit_cmp_op(self, arglocs, condition, signed, fp) return f + +def gen_emit_shift(func): + def f(self, op, arglocs, regalloc): + l0, l1 = arglocs + if not l1.is_imm() or l1.is_in_pool(): + assert "shift imm must NOT reside in pool!" + getattr(self.mc, func)(l0, l0, l1) + return f + +def gen_emit_rr_or_rpool(rr_func, rp_func): + """ the parameters can either be both in registers or + the first is in the register, second in literal pool. + """ + def f(self, op, arglocs, regalloc): + l0, l1 = arglocs + if l1.is_imm(): + assert "logical imm must reside in pool!" + elif l1.is_in_pool(): + getattr(self.mc, rp_func)(l0, l1) + else: + getattr(self.mc, rr_func)(l0, l1) + return f diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -1,5 +1,5 @@ from rpython.jit.metainterp.history import ConstInt, FLOAT -from rpython.jit.backend.zarch.locations import imm +from rpython.jit.backend.zarch.locations import imm, addr def check_imm(arg, lower_bound=-2**15, upper_bound=2**15-1): if isinstance(arg, ConstInt): @@ -10,6 +10,9 @@ def check_imm32(arg): return check_imm(arg, -2**31, 2**31-1) +def check_imm20(arg): + return check_imm(arg, -2**19, 2**19-1) + def prepare_int_add(self, op): a0 = op.getarg(0) a1 = op.getarg(1) @@ -56,7 +59,6 @@ self.free_op_vars() return [lr, lq, l1] - def prepare_int_sub(self, op): a0 = op.getarg(0) a1 = op.getarg(1) @@ -68,6 +70,31 @@ self.free_op_vars() return [l0, l1] +def prepare_int_logic(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + if isinstance(a0, ConstInt): + a0, a1 = a1, a0 + l0 = self.ensure_reg(a0) + l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0, l1] + +def prepare_int_shift(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + assert isinstance(a1, ConstInt) + l1 = self.ensure_reg(a1) + assert check_imm20(a1) + l0 = self.ensure_reg(a0) + # note that the shift value is stored + # in the addr part of the instruction + l1 = addr(a1.getint()) + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0, l1] + def prepare_cmp_op(self, op): a0 = op.getarg(0) a1 = op.getarg(1) diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -29,8 +29,13 @@ 'DSG': ('rxy', ['\xE3','\x0D'], 'eo,bidl'), 'DLGR': ('rre', ['\xB9','\x97'], 'eo,r'), 'DLG': ('rxy', ['\xE3','\x87'], 'eo,bidl'), + # there is no immidiate divide - # there is no immidiate divide + # shifting + 'SRAG': ('rsy', ['\xEB','\x0A']), + 'SLAG': ('rsy', ['\xEB','\x0B']), + 'SRLG': ('rsy', ['\xEB','\x0C']), + 'SLLG': ('rsy', ['\xEB','\x0D']), # div diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -1,4 +1,5 @@ -from rpython.jit.backend.zarch.helper.assembler import gen_emit_cmp_op +from rpython.jit.backend.zarch.helper.assembler import (gen_emit_cmp_op, + gen_emit_rr_or_rpool, gen_emit_shift) from rpython.jit.backend.zarch.codebuilder import ZARCHGuardToken import rpython.jit.backend.zarch.conditions as c import rpython.jit.backend.zarch.registers as r @@ -72,6 +73,14 @@ else: self.mc.SGR(l0, l1) + emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") + emit_int_or = gen_emit_rr_or_rpool("OGR", "OG") + emit_int_xor = gen_emit_rr_or_rpool("XGR", "XG") + + emit_int_rshift = gen_emit_shift("SRAG") + emit_int_lshift = gen_emit_shift("SLAG") + emit_uint_rshift = gen_emit_shift("SRLG") + emit_int_le = gen_emit_cmp_op(c.LE) emit_int_lt = gen_emit_cmp_op(c.LT) emit_int_gt = gen_emit_cmp_op(c.GT) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -540,6 +540,14 @@ prepare_uint_floordiv = helper.prepare_int_div prepare_int_mod = helper.prepare_int_mod + prepare_int_and = helper.prepare_int_logic + prepare_int_or = helper.prepare_int_logic + prepare_int_xor = helper.prepare_int_logic + + prepare_int_rshift = helper.prepare_int_shift + prepare_int_lshift = helper.prepare_int_shift + prepare_uint_rshift = helper.prepare_int_shift + prepare_int_le = helper.prepare_cmp_op prepare_int_lt = helper.prepare_cmp_op prepare_int_ge = helper.prepare_cmp_op diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -34,6 +34,14 @@ (1,'i1 = uint_floordiv(i0, 1)', 1), (30,'i1 = int_mod(i0, 2)', 0), (1,'i1 = int_mod(i0, 2)', 1), + (1,'i1 = int_lshift(i0, 4)', 16), + (1,'i1 = int_lshift(i0, 0)', 1), + (4,'i1 = int_rshift(i0, 0)', 4), + (4,'i1 = int_rshift(i0, 1)', 2), + (-1,'i1 = int_rshift(i0, 0)', -1), + (-1,'i1 = int_lshift(i0, 1)', -2), + (-2**35,'i1 = int_lshift(i0, 1)', (-2**35)*2), + (2**64-1,'i1 = uint_rshift(i0, 2)', (2**64-1)//4), ]) def test_int_arithmetic_and_logic(self, value, opcode, result): loop = parse(""" From noreply at buildbot.pypy.org Thu Nov 12 08:33:14 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 12 Nov 2015 14:33:14 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added helper to prepare regalloc for an unary value, added load positive and load negative instruction Message-ID: <20151112133314.1FA681C02A6@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80647:56dc6a5d2a55 Date: 2015-11-12 14:33 +0100 http://bitbucket.org/pypy/pypy/changeset/56dc6a5d2a55/ Log: added helper to prepare regalloc for an unary value, added load positive and load negative instruction diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -117,3 +117,11 @@ self.force_result_in_reg(op, a0) self.free_op_vars() return [l0, l1] + +def prepare_unary(self, op): + a0 = op.getarg(0) + assert not a0.is_imm() + l0 = self.ensure_reg(a0) + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0] diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -37,6 +37,11 @@ 'SRLG': ('rsy', ['\xEB','\x0C']), 'SLLG': ('rsy', ['\xEB','\x0D']), + # invert & negative & absolute + 'LPGR': ('rre', ['\xB9','\x00']), + 'LNGR': ('rre', ['\xB9','\x01']), + + # div diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -555,6 +555,12 @@ prepare_int_eq = helper.prepare_cmp_op prepare_int_ne = helper.prepare_cmp_op + prepare_int_is_zero = helper.prepare_unary_op + prepare_int_is_true = helper.prepare_unary_op + prepare_int_neg = helper.prepare_unary_op + prepare_int_invert = helper.prepare_unary_op + prepare_int_force_ge_zero = helper.prepare_unary_op + prepare_float_add = helper.prepare_binary_op prepare_float_sub = helper.prepare_binary_op prepare_float_mul = helper.prepare_binary_op @@ -696,11 +702,29 @@ prepare_oplist = [notimplemented] * (rop._LAST + 1) +implemented_count = 0 +total_count = 0 +missing = [] for key, value in rop.__dict__.items(): key = key.lower() if key.startswith('_'): continue + total_count += 1 methname = 'prepare_%s' % key if hasattr(Regalloc, methname): func = getattr(Regalloc, methname).im_func prepare_oplist[value] = func + implemented_count += 1 + else: + missing.append(methname) + +if __name__ == '__main__': + for m in missing: + print(" " * 4 + m) + print + print("regalloc implements %.2f%% of all resops" % \ + (100.0 * implemented_count / total_count)) + +del implemented_count +del total_count +del missing From noreply at buildbot.pypy.org Thu Nov 12 09:38:42 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 15:38:42 +0100 (CET) Subject: [pypy-commit] pypy default: Move this helper function in C, where it can be defined with the correct Message-ID: <20151112143843.019811C0385@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80648:7134b379b87c Date: 2015-11-12 15:38 +0100 http://bitbucket.org/pypy/pypy/changeset/7134b379b87c/ Log: Move this helper function in C, where it can be defined with the correct "const" diff --git a/rpython/memory/gctransform/asmgcroot.py b/rpython/memory/gctransform/asmgcroot.py --- a/rpython/memory/gctransform/asmgcroot.py +++ b/rpython/memory/gctransform/asmgcroot.py @@ -633,7 +633,7 @@ qsort(gcmapstart, rffi.cast(rffi.SIZE_T, count), rffi.cast(rffi.SIZE_T, arrayitemsize), - llhelper(QSORT_CALLBACK_PTR, _compare_gcmap_entries)) + c_compare_gcmap_entries) def replace_dead_entries_with_nulls(start, end): # replace the dead entries (null value) with a null key. @@ -661,17 +661,6 @@ def win32_follow_gcmap_jmp(start, end): pass -def _compare_gcmap_entries(addr1, addr2): - key1 = addr1.address[0] - key2 = addr2.address[0] - if key1 < key2: - result = -1 - elif key1 == key2: - result = 0 - else: - result = 1 - return rffi.cast(rffi.INT, result) - # ____________________________________________________________ class ShapeDecompressor: @@ -821,7 +810,20 @@ gcrootanchor.next = gcrootanchor c_gcrootanchor = Constant(gcrootanchor, ASM_FRAMEDATA_HEAD_PTR) -eci = ExternalCompilationInfo(compile_extra=['-DPYPY_USE_ASMGCC']) +eci = ExternalCompilationInfo(compile_extra=['-DPYPY_USE_ASMGCC'], + post_include_bits=[""" +static int pypy_compare_gcmap_entries(const void *addr1, const void *addr2) +{ + char *key1 = * (char * const *) addr1; + char *key2 = * (char * const *) addr2; + if (key1 < key2) + return -1; + else if (key1 == key2) + return 0; + else + return 1; +} +"""]) pypy_asm_stackwalk = rffi.llexternal('pypy_asm_stackwalk', [ASM_CALLBACK_PTR, @@ -849,6 +851,10 @@ QSORT_CALLBACK_PTR = lltype.Ptr(lltype.FuncType([llmemory.Address, llmemory.Address], rffi.INT)) +c_compare_gcmap_entries = rffi.llexternal('pypy_compare_gcmap_entries', + [llmemory.Address, llmemory.Address], + rffi.INT, compilation_info=eci, + _nowrapper=True, sandboxsafe=True) qsort = rffi.llexternal('qsort', [llmemory.Address, rffi.SIZE_T, From noreply at buildbot.pypy.org Thu Nov 12 10:39:08 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 16:39:08 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Trying to implement issue #232 Message-ID: <20151112153908.DD1F31C02A6@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2378:f0c68a561ddd Date: 2015-11-12 15:43 +0100 http://bitbucket.org/cffi/cffi/changeset/f0c68a561ddd/ Log: Trying to implement issue #232 From noreply at buildbot.pypy.org Thu Nov 12 10:39:10 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 16:39:10 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Parsing CFFI_CALL_PYTHON in the cdef Message-ID: <20151112153910.DAA0A1C02A6@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2379:162bd2e749a1 Date: 2015-11-12 16:39 +0100 http://bitbucket.org/cffi/cffi/changeset/162bd2e749a1/ Log: Parsing CFFI_CALL_PYTHON in the cdef diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -29,6 +29,7 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_cffi_call_python = re.compile(r"\bCFFI_CALL_PYTHON\b") _r_star_const_space = re.compile( # matches "* const " r"[*]\s*((const|volatile|restrict)\b\s*)+") @@ -101,8 +102,13 @@ csource = _r_stdcall2.sub(' volatile volatile const(', csource) csource = _r_stdcall1.sub(' volatile volatile const ', csource) csource = _r_cdecl.sub(' ', csource) + # + # Replace "CFFI_CALL_PYTHON" with "void CFFI_CALL_PYTHON;" + csource = _r_cffi_call_python.sub('void CFFI_CALL_PYTHON;', csource) + # # Replace "[...]" with "[__dotdotdotarray__]" csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) + # # Replace "...}" with "__dotdotdotNUM__}". This construction should # occur only at the end of enums; at the end of structs we have "...;}" # and at the end of vararg functions "...);". Also replace "=...[,}]" @@ -255,7 +261,9 @@ break # try: + self._found_cffi_call_python = False for decl in iterator: + old_cffi_call_python = self._found_cffi_call_python if isinstance(decl, pycparser.c_ast.Decl): self._parse_decl(decl) elif isinstance(decl, pycparser.c_ast.Typedef): @@ -278,6 +286,8 @@ self._declare('typedef ' + decl.name, realtype, quals=quals) else: raise api.CDefError("unrecognized construct", decl) + if old_cffi_call_python and self._found_cffi_call_python: + raise api.CDefError("CFFI_CALL_PYTHON misplaced") except api.FFIError as e: msg = self._convert_pycparser_error(e, csource) if msg: @@ -324,13 +334,20 @@ ' #define %s %s' % (key, key, key, value)) + def _declare_function(self, tp, quals, decl): + tp = self._get_type_pointer(tp, quals) + if self._found_cffi_call_python: + self._declare('call_python ' + decl.name, tp) + self._found_cffi_call_python = False + else: + self._declare('function ' + decl.name, tp) + def _parse_decl(self, decl): node = decl.type if isinstance(node, pycparser.c_ast.FuncDecl): tp, quals = self._get_type_and_quals(node, name=decl.name) assert isinstance(tp, model.RawFunctionType) - tp = self._get_type_pointer(tp, quals) - self._declare('function ' + decl.name, tp) + self._declare_function(tp, quals, decl) else: if isinstance(node, pycparser.c_ast.Struct): self._get_struct_union_enum_type('struct', node) @@ -346,8 +363,7 @@ tp, quals = self._get_type_and_quals(node, partial_length_ok=True) if tp.is_raw_function: - tp = self._get_type_pointer(tp, quals) - self._declare('function ' + decl.name, tp) + self._declare_function(tp, quals, decl) elif (tp.is_integer_type() and hasattr(decl, 'init') and hasattr(decl.init, 'value') and @@ -360,6 +376,11 @@ _r_int_literal.match(decl.init.expr.value)): self._add_integer_constant(decl.name, '-' + decl.init.expr.value) + elif tp is model.void_type and decl.name == 'CFFI_CALL_PYTHON': + # hack: "CFFI_CALL_PYTHON" in the C source is replaced + # with "void CFFI_CALL_PYTHON;", which when parsed arrives + # at this point and sets this flag: + self._found_cffi_call_python = True elif (quals & model.Q_CONST) and not tp.is_array_type: self._declare('constant ' + decl.name, tp, quals=quals) else: diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -405,3 +405,17 @@ "" % (stdcall, stdcall)) + +def test_CFFI_CALL_PYTHON(): + ffi = FFI() + ffi.cdef(""" + int baz(int, int); + CFFI_CALL_PYTHON int foobar(int, int); + """) + assert 'variable CFFI_CALL_PYTHON' not in ffi._parser._declarations + assert 'function baz' in ffi._parser._declarations + assert 'call_python baz' not in ffi._parser._declarations + assert 'function foobar' not in ffi._parser._declarations + assert 'call_python foobar' in ffi._parser._declarations + assert (ffi._parser._declarations['function baz'] == + ffi._parser._declarations['call_python foobar']) From noreply at buildbot.pypy.org Thu Nov 12 11:47:14 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 12 Nov 2015 17:47:14 +0100 (CET) Subject: [pypy-commit] pypy default: issue #2188: win32 fix? Message-ID: <20151112164714.0D9C11C02A6@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80649:1f6cd10a1947 Date: 2015-11-12 17:47 +0100 http://bitbucket.org/pypy/pypy/changeset/1f6cd10a1947/ Log: issue #2188: win32 fix? diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py --- a/pypy/module/_multiprocessing/interp_win32.py +++ b/pypy/module/_multiprocessing/interp_win32.py @@ -17,7 +17,7 @@ NMPWAIT_WAIT_FOREVER ERROR_PIPE_CONNECTED ERROR_SEM_TIMEOUT ERROR_PIPE_BUSY ERROR_NO_SYSTEM_RESOURCES ERROR_BROKEN_PIPE ERROR_MORE_DATA - ERROR_ALREADY_EXISTS + ERROR_ALREADY_EXISTS ERROR_NO_DATA """.split() class CConfig: From noreply at buildbot.pypy.org Thu Nov 12 13:54:23 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 12 Nov 2015 19:54:23 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added regalloc/assembler for int_neg, int_invert Message-ID: <20151112185423.E80891C0385@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80650:54d56775dc1e Date: 2015-11-12 19:54 +0100 http://bitbucket.org/pypy/pypy/changeset/54d56775dc1e/ Log: added regalloc/assembler for int_neg, int_invert diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -118,9 +118,9 @@ self.free_op_vars() return [l0, l1] -def prepare_unary(self, op): +def prepare_unary_op(self, op): a0 = op.getarg(0) - assert not a0.is_imm() + assert not isinstance(a0, ConstInt) l0 = self.ensure_reg(a0) self.force_result_in_reg(op, a0) self.free_op_vars() diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -40,6 +40,7 @@ # invert & negative & absolute 'LPGR': ('rre', ['\xB9','\x00']), 'LNGR': ('rre', ['\xB9','\x01']), + 'LCGR': ('rre', ['\xB9','\x03']), @@ -58,6 +59,7 @@ 'CLGR': ('rre', ['\xB9','\x21']), 'CLG': ('rxy', ['\xE3','\x21']), 'CGHI': ('ri', ['\xA7','\x0F']), + 'CGFI': ('ril', ['\xC2','\x0E']), } logic_mnemonic_codes = { diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -3,8 +3,24 @@ from rpython.jit.backend.zarch.codebuilder import ZARCHGuardToken import rpython.jit.backend.zarch.conditions as c import rpython.jit.backend.zarch.registers as r +import rpython.jit.backend.zarch.locations as l from rpython.jit.backend.llsupport.gcmap import allocate_gcmap +def flush_cc(asm, condition, result_loc): + # After emitting an instruction that leaves a boolean result in + # a condition code (cc), call this. In the common case, result_loc + # will be set to 'fp' by the regalloc, which in this case means + # "propagate it between this operation and the next guard by keeping + # it in the cc". In the uncommon case, result_loc is another + # register, and we emit a load from the cc into this register. + assert asm.guard_success_cc == c.cond_none + if result_loc is r.SPP: + asm.guard_success_cc = condition + else: + xxx + #asm.mc.MOV_ri(result_loc.value, 1, condition) + #asm.mc.MOV_ri(result_loc.value, 0, c.get_opposite_of(condition)) + class IntOpAssembler(object): _mixin_ = True @@ -73,6 +89,26 @@ else: self.mc.SGR(l0, l1) + def emit_int_invert(self, op, arglocs, regalloc): + l0 = arglocs[0] + assert not l0.is_imm() + self.mc.XG(l0, l.pool(self.pool.constant_64_ones)) + + def emit_int_neg(self, op, arglocs, regalloc): + l0 = arglocs[0] + self.mc.LNGR(l0, l0) + + def emit_int_is_zero(self, op, arglocs, regalloc): + l0 = arglocs[0] + self.mc.CGHI(l0, l.imm(0)) + flush_cc(self, l0, c.EQ) + + def emit_int_is_true(self, op, arglocs, regalloc): + l0 = arglocs[0] + self.mc.CGHI(l0, l.imm(0)) + flush_cc(self, l0, c.NE) + + emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") emit_int_or = gen_emit_rr_or_rpool("OGR", "OG") emit_int_xor = gen_emit_rr_or_rpool("XGR", "XG") diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -15,6 +15,8 @@ self.label_offset = 0 self.label_count = 0 self.offset_map = {} + self.constant_64_zeros = -1 + self.constant_64_ones = -1 def ensure_can_hold_constants(self, asm, op): if op.is_guard(): @@ -34,6 +36,8 @@ if descr not in asm.target_tokens_currently_compiling: # this is a 'long' jump instead of a relative jump self.offset_map[descr] = self.size + elif op.getopnum() == rop.INT_INVERT: + self.constant_64_ones = 1 # we need constant ones!!! for arg in op.getarglist(): if arg.is_constant(): self.offset_map[arg] = self.size @@ -71,13 +75,23 @@ self.pool_start = asm.mc.get_relative_pos() for op in operations: self.ensure_can_hold_constants(asm, op) - if self.size == 0: + if self.size == 0 and written != 0: # no pool needed! return assert self.size % 2 == 0 #if self.size % 2 == 1: # self.size += 1 asm.mc.write('\xFF' * self.size) + written = 0 + if self.constant_64_ones: + asm.mc.write('\xFF' * 8) + self.constant_64_ones = self.size + written += 8 + if self.constant_64_zeros: + asm.mc.write('\x00' * 8) + self.constant_64_zeros = self.size + written += 8 + self.size += written print "pool with %d quad words" % (self.size // 8) def overwrite_64(self, mc, index, value): diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -42,6 +42,16 @@ (-1,'i1 = int_lshift(i0, 1)', -2), (-2**35,'i1 = int_lshift(i0, 1)', (-2**35)*2), (2**64-1,'i1 = uint_rshift(i0, 2)', (2**64-1)//4), + (-1,'i1 = int_neg(i0)', -1), + (1,'i1 = int_neg(i0)', -1), + (2**63-1,'i1 = int_neg(i0)', -(2**63-1)), + (1,'i1 = int_invert(i0)', ~1), + (15,'i1 = int_invert(i0)', ~15), + (-1,'i1 = int_invert(i0)', ~(-1)), + (0,'i1 = int_is_zero(i0)', 1), + (50,'i1 = int_is_zero(i0)', 0), + (-1,'i1 = int_is_true(i0)', 1), + (0,'i1 = int_is_true(i0)', 0), ]) def test_int_arithmetic_and_logic(self, value, opcode, result): loop = parse(""" From noreply at buildbot.pypy.org Thu Nov 12 17:52:26 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 12 Nov 2015 23:52:26 +0100 (CET) Subject: [pypy-commit] pypy anntype: Split follow_link() into 2 methods and remove in_except_block flag Message-ID: <20151112225226.4BD391C20C0@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80651:e68525cab1b0 Date: 2015-11-11 23:21 +0000 http://bitbucket.org/pypy/pypy/changeset/e68525cab1b0/ Log: Split follow_link() into 2 methods and remove in_except_block flag diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -470,11 +470,14 @@ continue covered = [c for c in candidates if issubclass(c, case)] if covered: - self.follow_link(graph, link, {}) + self.follow_raise_link(graph, link, {}) candidates = [c for c in candidates if c not in covered] else: for link in exits: - self.follow_link(graph, link, {}) + if link.exitcase is None: + self.follow_link(graph, link, {}) + else: + self.follow_raise_link(graph, link, {}) else: if isinstance(block.exitswitch, Variable): knowntypedata = getattr(block.exitswitch.annotation, @@ -494,25 +497,76 @@ callback() def follow_link(self, graph, link, constraints): - in_except_block = False - v_last_exc_type = link.last_exception # may be None for non-exception link - v_last_exc_value = link.last_exc_value # may be None for non-exception link + assert not (isinstance(link.exitcase, (types.ClassType, type)) and + issubclass(link.exitcase, BaseException)) - if (isinstance(link.exitcase, (types.ClassType, type)) and - issubclass(link.exitcase, BaseException)): - assert v_last_exc_type and v_last_exc_value - s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase) - if isinstance(v_last_exc_value, Variable): - self.setbinding(v_last_exc_value, s_last_exc_value) + ignore_link = False + inputs_s = [] + renaming = {} + for v_out, v_input in zip(link.args, link.target.inputargs): + renaming.setdefault(v_out, []).append(v_input) + for v_out in link.args: + s_out = self.annotation(v_out) + if v_out in constraints: + s_constraint = constraints[v_out] + s_out = pair(s_out, s_constraint).improve() + # ignore links that try to pass impossible values + if s_out == annmodel.s_ImpossibleValue: + ignore_link = True - if isinstance(v_last_exc_type, Variable): - self.setbinding(v_last_exc_type, SomeTypeOf(v_last_exc_value)) + if hasattr(s_out, 'is_type_of'): + renamed_is_type_of = [] + for v in s_out.is_type_of: + new_vs = renaming.get(v, []) + renamed_is_type_of += new_vs + assert s_out.knowntype is type + newcell = annmodel.SomeType() + if s_out.is_constant(): + newcell.const = s_out.const + s_out = newcell + s_out.is_type_of = renamed_is_type_of - s_last_exc_type = annmodel.SomeType() - if isinstance(v_last_exc_type, Constant): - s_last_exc_type.const = v_last_exc_type.value - last_exc_value_vars = [] - in_except_block = True + if hasattr(s_out, 'knowntypedata'): + renamed_knowntypedata = {} + for value, constraints in s_out.knowntypedata.items(): + renamed_knowntypedata[value] = {} + for v, s in constraints.items(): + new_vs = renaming.get(v, []) + for new_v in new_vs: + renamed_knowntypedata[value][new_v] = s + assert isinstance(s_out, annmodel.SomeBool) + newcell = annmodel.SomeBool() + if s_out.is_constant(): + newcell.const = s_out.const + s_out = newcell + s_out.set_knowntypedata(renamed_knowntypedata) + + inputs_s.append(s_out) + if ignore_link: + return + + self.links_followed[link] = True + self.addpendingblock(graph, link.target, inputs_s) + + def follow_raise_link(self, graph, link, constraints): + v_last_exc_type = link.last_exception + v_last_exc_value = link.last_exc_value + + assert (isinstance(link.exitcase, (types.ClassType, type)) and + issubclass(link.exitcase, BaseException)) + + assert v_last_exc_type and v_last_exc_value + s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase) + if isinstance(v_last_exc_value, Variable): + self.setbinding(v_last_exc_value, s_last_exc_value) + + if isinstance(v_last_exc_type, Variable): + self.setbinding(v_last_exc_type, SomeTypeOf(v_last_exc_value)) + + s_last_exc_type = annmodel.SomeType() + if isinstance(v_last_exc_type, Constant): + s_last_exc_type.const = v_last_exc_type.value + last_exc_value_vars = [] ignore_link = False inputs_s = [] @@ -521,10 +575,8 @@ renaming.setdefault(v_out, []).append(v_input) for v_out, v_input in zip(link.args, link.target.inputargs): if v_out == v_last_exc_type: - assert in_except_block inputs_s.append(s_last_exc_type) elif v_out == v_last_exc_value: - assert in_except_block inputs_s.append(s_last_exc_value) last_exc_value_vars.append(v_input) else: @@ -566,9 +618,8 @@ inputs_s.append(s_out) if ignore_link: return + s_last_exc_type.is_type_of = last_exc_value_vars - if in_except_block: - s_last_exc_type.is_type_of = last_exc_value_vars self.links_followed[link] = True self.addpendingblock(graph, link.target, inputs_s) From noreply at buildbot.pypy.org Thu Nov 12 17:52:28 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 12 Nov 2015 23:52:28 +0100 (CET) Subject: [pypy-commit] pypy anntype: Extract apply_renaming() from follow_link() and follow_raise_link() Message-ID: <20151112225228.69C7F1C210E@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80652:71d5ff68b414 Date: 2015-11-11 23:48 +0000 http://bitbucket.org/pypy/pypy/changeset/71d5ff68b414/ Log: Extract apply_renaming() from follow_link() and follow_raise_link() diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -387,6 +387,36 @@ if unions != oldcells: self.bindinputargs(graph, block, unions) + def apply_renaming(self, s_out, renaming): + if hasattr(s_out, 'is_type_of'): + renamed_is_type_of = [] + for v in s_out.is_type_of: + new_vs = renaming.get(v, []) + renamed_is_type_of += new_vs + assert s_out.knowntype is type + newcell = annmodel.SomeType() + if s_out.is_constant(): + newcell.const = s_out.const + s_out = newcell + s_out.is_type_of = renamed_is_type_of + + if hasattr(s_out, 'knowntypedata'): + renamed_knowntypedata = {} + for value, constraints in s_out.knowntypedata.items(): + renamed_knowntypedata[value] = {} + for v, s in constraints.items(): + new_vs = renaming.get(v, []) + for new_v in new_vs: + renamed_knowntypedata[value][new_v] = s + assert isinstance(s_out, annmodel.SomeBool) + newcell = annmodel.SomeBool() + if s_out.is_constant(): + newcell.const = s_out.const + s_out = newcell + s_out.set_knowntypedata(renamed_knowntypedata) + return s_out + + def whereami(self, position_key): graph, block, i = position_key blk = "" @@ -496,6 +526,7 @@ else: callback() + def follow_link(self, graph, link, constraints): assert not (isinstance(link.exitcase, (types.ClassType, type)) and issubclass(link.exitcase, BaseException)) @@ -513,34 +544,7 @@ # ignore links that try to pass impossible values if s_out == annmodel.s_ImpossibleValue: ignore_link = True - - if hasattr(s_out, 'is_type_of'): - renamed_is_type_of = [] - for v in s_out.is_type_of: - new_vs = renaming.get(v, []) - renamed_is_type_of += new_vs - assert s_out.knowntype is type - newcell = annmodel.SomeType() - if s_out.is_constant(): - newcell.const = s_out.const - s_out = newcell - s_out.is_type_of = renamed_is_type_of - - if hasattr(s_out, 'knowntypedata'): - renamed_knowntypedata = {} - for value, constraints in s_out.knowntypedata.items(): - renamed_knowntypedata[value] = {} - for v, s in constraints.items(): - new_vs = renaming.get(v, []) - for new_v in new_vs: - renamed_knowntypedata[value][new_v] = s - assert isinstance(s_out, annmodel.SomeBool) - newcell = annmodel.SomeBool() - if s_out.is_constant(): - newcell.const = s_out.const - s_out = newcell - s_out.set_knowntypedata(renamed_knowntypedata) - + s_out = self.apply_renaming(s_out, renaming) inputs_s.append(s_out) if ignore_link: return @@ -587,34 +591,7 @@ # ignore links that try to pass impossible values if s_out == annmodel.s_ImpossibleValue: ignore_link = True - - if hasattr(s_out, 'is_type_of'): - renamed_is_type_of = [] - for v in s_out.is_type_of: - new_vs = renaming.get(v, []) - renamed_is_type_of += new_vs - assert s_out.knowntype is type - newcell = annmodel.SomeType() - if s_out.is_constant(): - newcell.const = s_out.const - s_out = newcell - s_out.is_type_of = renamed_is_type_of - - if hasattr(s_out, 'knowntypedata'): - renamed_knowntypedata = {} - for value, constraints in s_out.knowntypedata.items(): - renamed_knowntypedata[value] = {} - for v, s in constraints.items(): - new_vs = renaming.get(v, []) - for new_v in new_vs: - renamed_knowntypedata[value][new_v] = s - assert isinstance(s_out, annmodel.SomeBool) - newcell = annmodel.SomeBool() - if s_out.is_constant(): - newcell.const = s_out.const - s_out = newcell - s_out.set_knowntypedata(renamed_knowntypedata) - + s_out = self.apply_renaming(s_out, renaming) inputs_s.append(s_out) if ignore_link: return From noreply at buildbot.pypy.org Thu Nov 12 17:52:30 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 12 Nov 2015 23:52:30 +0100 (CET) Subject: [pypy-commit] pypy anntype: simplify code Message-ID: <20151112225230.81F741C2141@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80653:288e262d9eef Date: 2015-11-12 22:53 +0000 http://bitbucket.org/pypy/pypy/changeset/288e262d9eef/ Log: simplify code diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -1,6 +1,7 @@ from __future__ import absolute_import import types +from collections import defaultdict from rpython.tool.ansi_print import ansi_log from rpython.tool.pairtype import pair @@ -391,8 +392,7 @@ if hasattr(s_out, 'is_type_of'): renamed_is_type_of = [] for v in s_out.is_type_of: - new_vs = renaming.get(v, []) - renamed_is_type_of += new_vs + renamed_is_type_of += renaming[v] assert s_out.knowntype is type newcell = annmodel.SomeType() if s_out.is_constant(): @@ -533,9 +533,10 @@ ignore_link = False inputs_s = [] - renaming = {} + renaming = defaultdict(list) for v_out, v_input in zip(link.args, link.target.inputargs): - renaming.setdefault(v_out, []).append(v_input) + renaming[v_out].append(v_input) + for v_out in link.args: s_out = self.annotation(v_out) if v_out in constraints: @@ -567,22 +568,20 @@ if isinstance(v_last_exc_type, Variable): self.setbinding(v_last_exc_type, SomeTypeOf(v_last_exc_value)) - s_last_exc_type = annmodel.SomeType() - if isinstance(v_last_exc_type, Constant): - s_last_exc_type.const = v_last_exc_type.value - last_exc_value_vars = [] ignore_link = False inputs_s = [] - renaming = {} + renaming = defaultdict(list) for v_out, v_input in zip(link.args, link.target.inputargs): - renaming.setdefault(v_out, []).append(v_input) + renaming[v_out].append(v_input) + for v_out, v_input in zip(link.args, link.target.inputargs): if v_out == v_last_exc_type: - inputs_s.append(s_last_exc_type) - elif v_out == v_last_exc_value: - inputs_s.append(s_last_exc_value) - last_exc_value_vars.append(v_input) + s_out = annmodel.SomeType() + s_out.is_type_of = renaming[v_last_exc_value] + if isinstance(v_last_exc_type, Constant): + s_out.const = v_last_exc_type.value + inputs_s.append(s_out) else: s_out = self.annotation(v_out) if v_out in constraints: @@ -595,7 +594,6 @@ inputs_s.append(s_out) if ignore_link: return - s_last_exc_type.is_type_of = last_exc_value_vars self.links_followed[link] = True self.addpendingblock(graph, link.target, inputs_s) From noreply at buildbot.pypy.org Fri Nov 13 03:15:05 2015 From: noreply at buildbot.pypy.org (krono) Date: Fri, 13 Nov 2015 09:15:05 +0100 (CET) Subject: [pypy-commit] pypy default: Remove get_display_text override Message-ID: <20151113081505.2C9F41C1238@cobra.cs.uni-duesseldorf.de> Author: Tobias Pape Branch: Changeset: r80654:56da80b53db3 Date: 2015-11-13 09:08 +0100 http://bitbucket.org/pypy/pypy/changeset/56da80b53db3/ Log: Remove get_display_text override (seems to be a hg merge artifact) diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py --- a/rpython/jit/metainterp/history.py +++ b/rpython/jit/metainterp/history.py @@ -541,9 +541,6 @@ self.name, ', '.join([box.repr(memo) for box in self.inputargs])) - def get_display_text(self): # for graphpage.py - return self.name + '\n' + repr(self.inputargs) - def show(self, errmsg=None): "NOT_RPYTHON" from rpython.jit.metainterp.graphpage import display_procedures From noreply at buildbot.pypy.org Fri Nov 13 04:18:17 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Fri, 13 Nov 2015 10:18:17 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: completed implementation for int_is_true, int_is_zero. added flush_cc method and fixed the LARL problem (test suite provided wrong number to gnu asm) Message-ID: <20151113091817.C6FEF1C0290@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80655:7e4f29d5c048 Date: 2015-11-13 10:18 +0100 http://bitbucket.org/pypy/pypy/changeset/7e4f29d5c048/ Log: completed implementation for int_is_true, int_is_zero. added flush_cc method and fixed the LARL problem (test suite provided wrong number to gnu asm) diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -357,6 +357,26 @@ targettoken._ll_loop_code += rawstart self.target_tokens_currently_compiling = None + def flush_cc(self, condition, result_loc): + # After emitting an instruction that leaves a boolean result in + # a condition code (cc), call this. In the common case, result_loc + # will be set to 'fp' by the regalloc, which in this case means + # "propagate it between this operation and the next guard by keeping + # it in the cc". In the uncommon case, result_loc is another + # register, and we emit a load from the cc into this register. + assert self.guard_success_cc == c.cond_none + if result_loc is r.SPP: + self.guard_success_cc = condition + else: + # sadly we cannot use LOCGHI + # it is included in some extension that seem to be NOT installed + # by default. + self.mc.LGHI(r.SCRATCH, l.imm(1)) + self.mc.LOCGR(result_loc, r.SCRATCH, condition) + self.mc.LGHI(r.SCRATCH, l.imm(0)) + self.mc.LOCGR(result_loc, r.SCRATCH, c.negate(condition)) + + def _assemble(self, regalloc, inputargs, operations): self._regalloc = regalloc self.guard_success_cc = c.cond_none diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -133,13 +133,13 @@ def build_rre(mnemonic, (opcode1,opcode2), argtypes='r,r'): @builder.arguments(argtypes) - def encode_rr(self, reg1, reg2): + def encode_rre(self, reg1, reg2): self.writechar(opcode1) self.writechar(opcode2) self.writechar('\x00') operands = ((reg1 & 0x0f) << 4) | (reg2 & 0xf) self.writechar(chr(operands)) - return encode_rr + return encode_rre def build_rx(mnemonic, (opcode,)): @builder.arguments('r/m,bid') @@ -277,14 +277,24 @@ encode_base_displace(self, base_displace) return encode_rs -def build_rsy(mnemonic, (opcode1,opcode2)): + at always_inline +def _encode_rsy(self, opcode1, opcode2, reg1, reg3, base_displace): + self.writechar(opcode1) + self.writechar(chr((reg1 & BIT_MASK_4) << 4 | reg3 & BIT_MASK_4)) + encode_base_displace_long(self, base_displace) + self.writechar(opcode2) + +def build_rsy_a(mnemonic, (opcode1,opcode2)): @builder.arguments('r,r,bdl') - def encode_ssa(self, reg1, reg3, base_displace): - self.writechar(opcode1) - self.writechar(chr((reg1 & BIT_MASK_4) << 4 | reg3 & BIT_MASK_4)) - encode_base_displace_long(self, base_displace) - self.writechar(opcode2) - return encode_ssa + def encode_rsy(self, reg1, reg3, base_displace): + _encode_rsy(self, opcode1, opcode2, reg1, reg3, base_displace) + return encode_rsy + +def build_rsy_b(mnemonic, (opcode1,opcode2)): + @builder.arguments('r,bdl,r') + def encode_rsy(self, reg1, base_displace, reg3): + _encode_rsy(self, opcode1, opcode2, reg1, reg3, base_displace) + return encode_rsy def build_rsi(mnemonic, (opcode,)): br = is_branch_relative(mnemonic) @@ -298,10 +308,10 @@ self.write_i16(imm16 & BIT_MASK_16) return encode_ri -def build_rie(mnemonic, (opcode1,opcode2)): +def build_rie_e(mnemonic, (opcode1,opcode2)): br = is_branch_relative(mnemonic) @builder.arguments('r,r,i16') - def encode_ri(self, reg1, reg2, imm16): + def encode_rie_e(self, reg1, reg2, imm16): self.writechar(opcode1) byte = (reg1 & BIT_MASK_4) << 4 | (reg2 & BIT_MASK_4) self.writechar(chr(byte)) @@ -310,18 +320,45 @@ self.write_i16(imm16 & BIT_MASK_16) self.writechar(chr(0x0)) self.writechar(opcode2) - return encode_ri + return encode_rie_e -def build_rrf(mnemonic, (opcode1,opcode2), argtypes): +def build_rie_a(mnemonic, (opcode1,opcode2)): + br = is_branch_relative(mnemonic) + @builder.arguments('r,i16,r/m') + def encode_rie_a(self, reg1, imm16, mask): + self.writechar(opcode1) + byte = (reg1 & BIT_MASK_4) << 4 | (mask & BIT_MASK_4) + self.writechar(chr(byte)) + if br: + imm16 = imm16 >> 1 + self.write_i16(imm16 & BIT_MASK_16) + self.writechar(chr(0x0)) + self.writechar(opcode2) + return encode_rie_a + +build_rie_g = build_rie_a + + at always_inline +def _encode_rrf(self, opcode1, opcode2, r1, r2, rm3, rm4): + self.writechar(opcode1) + self.writechar(opcode2) + byte = (rm3 & BIT_MASK_4) << 4 | (rm4 & BIT_MASK_4) + self.writechar(chr(byte)) + byte = (r1 & BIT_MASK_4) << 4 | (r2 & BIT_MASK_4) + self.writechar(chr(byte)) + +def build_rrf_c(mnemonic, (opcode1,opcode2), argtypes='r,r,r/m,-'): @builder.arguments(argtypes) - def encode_rrf(self, r1, rm3, r2, rm4): - self.writechar(opcode1) - self.writechar(opcode2) - byte = (rm3 & BIT_MASK_4) << 4 | (rm4 & BIT_MASK_4) - self.writechar(chr(byte)) - byte = (r1 & BIT_MASK_4) << 4 | (r2 & BIT_MASK_4) - self.writechar(chr(byte)) - return encode_rrf + def encode_rrf_b(self, r1, r2, rm3, rm4): + _encode_rrf(self, opcode1, opcode2, r1, r2, rm3, rm4) + return encode_rrf_b + +def build_rrf_e(mnemonic, (opcode1,opcode2), argtypes): + @builder.arguments(argtypes) + def encode_rrf_e(self, r1, rm3, r2, rm4): + _encode_rrf(self, opcode1, opcode2, r1, r2, rm3, rm4) + return encode_rrf_e +build_rrf_b = build_rrf_e def build_rxe(mnemonic, (opcode1,opcode2), argtypes): @builder.arguments(argtypes) diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -27,15 +27,15 @@ # div/mod 'DSGR': ('rre', ['\xB9','\x0D'], 'eo,r'), 'DSG': ('rxy', ['\xE3','\x0D'], 'eo,bidl'), - 'DLGR': ('rre', ['\xB9','\x97'], 'eo,r'), + 'DLGR': ('rre', ['\xB9','\x87'], 'eo,r'), 'DLG': ('rxy', ['\xE3','\x87'], 'eo,bidl'), # there is no immidiate divide # shifting - 'SRAG': ('rsy', ['\xEB','\x0A']), - 'SLAG': ('rsy', ['\xEB','\x0B']), - 'SRLG': ('rsy', ['\xEB','\x0C']), - 'SLLG': ('rsy', ['\xEB','\x0D']), + 'SRAG': ('rsy_a', ['\xEB','\x0A']), + 'SLAG': ('rsy_a', ['\xEB','\x0B']), + 'SRLG': ('rsy_a', ['\xEB','\x0C']), + 'SLLG': ('rsy_a', ['\xEB','\x0D']), # invert & negative & absolute 'LPGR': ('rre', ['\xB9','\x00']), @@ -59,7 +59,7 @@ 'CLGR': ('rre', ['\xB9','\x21']), 'CLG': ('rxy', ['\xE3','\x21']), 'CGHI': ('ri', ['\xA7','\x0F']), - 'CGFI': ('ril', ['\xC2','\x0E']), + 'CGFI': ('ril', ['\xC2','\x0C']), } logic_mnemonic_codes = { @@ -111,7 +111,7 @@ # load memory 'LMD': ('sse', ['\xEF']), - 'LMG': ('rsy', ['\xEB','\x04']), + 'LMG': ('rsy_a', ['\xEB','\x04']), 'LHI': ('ri', ['\xA7','\x08']), 'LGHI': ('ri', ['\xA7','\x09']), 'LR': ('rr', ['\x18']), @@ -119,8 +119,12 @@ 'LG': ('rxy', ['\xE3','\x04']), 'LARL': ('ril', ['\xC0','\x00'], 'r/m,h32'), + # load on condition + 'LOCGR': ('rrf_c', ['\xB9','\xE2']), + 'LOCG': ('rsy_b', ['\xEB','\xE2']), + # store memory - 'STMG': ('rsy', ['\xEB','\x24']), + 'STMG': ('rsy_a', ['\xEB','\x24']), 'ST': ('rx', ['\x50']), 'STG': ('rxy', ['\xE3','\x24']), 'STY': ('rxy', ['\xE3','\x50']), @@ -155,12 +159,12 @@ } floatingpoint_mnemonic_codes = { - 'FIEBR': ('rrf', ['\xB3','\x57'], 'r,u4,r,-'), - 'FIDBR': ('rrf', ['\xB3','\x5F'], 'r,u4,r,-'), + 'FIEBR': ('rrf_e', ['\xB3','\x57'], 'r,u4,r,-'), + 'FIDBR': ('rrf_e', ['\xB3','\x5F'], 'r,u4,r,-'), # convert to fixed - 'CGEBR': ('rrf', ['\xB3','\xA8'], 'r,u4,r,-'), - 'CGDBR': ('rrf', ['\xB3','\xA9'], 'r,u4,r,-'), + 'CGEBR': ('rrf_e', ['\xB3','\xA8'], 'r,u4,r,-'), + 'CGDBR': ('rrf_e', ['\xB3','\xA9'], 'r,u4,r,-'), # convert from fixed 'CEGBR': ('rre', ['\xB3','\xA4']), @@ -190,8 +194,8 @@ 'DDB': ('rxe', ['\xED','\x1D'], 'r,bidl,-'), # DIVIDE (+mod) - 'DIEBR': ('rrf', ['\xB3','\x53'], 'r,r,r,m'), - 'DIDBR': ('rrf', ['\xB3','\x5B'], 'r,r,r,m'), + 'DIEBR': ('rrf_b', ['\xB3','\x53'], 'r,r,r,m'), + 'DIDBR': ('rrf_b', ['\xB3','\x5B'], 'r,r,r,m'), # COMPARISON 'CEBR': ('rre', ['\xB3','\x09']), @@ -204,9 +208,9 @@ all_mnemonic_codes = { # 'BXH': ('rs', ['\x86']), - 'BXHG': ('rsy', ['\xEB','\x44']), + 'BXHG': ('rsy_a', ['\xEB','\x44']), 'BRXH': ('rsi', ['\x84']), - 'BRXLG': ('rie', ['\xEC','\x45']), + 'BRXLG': ('rie_e', ['\xEC','\x45']), # 'NI': ('si', ['\x94']), 'NIY': ('siy', ['\xEB','\x54']), diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -6,21 +6,6 @@ import rpython.jit.backend.zarch.locations as l from rpython.jit.backend.llsupport.gcmap import allocate_gcmap -def flush_cc(asm, condition, result_loc): - # After emitting an instruction that leaves a boolean result in - # a condition code (cc), call this. In the common case, result_loc - # will be set to 'fp' by the regalloc, which in this case means - # "propagate it between this operation and the next guard by keeping - # it in the cc". In the uncommon case, result_loc is another - # register, and we emit a load from the cc into this register. - assert asm.guard_success_cc == c.cond_none - if result_loc is r.SPP: - asm.guard_success_cc = condition - else: - xxx - #asm.mc.MOV_ri(result_loc.value, 1, condition) - #asm.mc.MOV_ri(result_loc.value, 0, c.get_opposite_of(condition)) - class IntOpAssembler(object): _mixin_ = True @@ -101,12 +86,12 @@ def emit_int_is_zero(self, op, arglocs, regalloc): l0 = arglocs[0] self.mc.CGHI(l0, l.imm(0)) - flush_cc(self, l0, c.EQ) + self.flush_cc(c.EQ, l0) def emit_int_is_true(self, op, arglocs, regalloc): l0 = arglocs[0] self.mc.CGHI(l0, l.imm(0)) - flush_cc(self, l0, c.NE) + self.flush_cc(c.NE, l0) emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") diff --git a/rpython/jit/backend/zarch/test/test_auto_encoding.py b/rpython/jit/backend/zarch/test/test_auto_encoding.py --- a/rpython/jit/backend/zarch/test/test_auto_encoding.py +++ b/rpython/jit/backend/zarch/test/test_auto_encoding.py @@ -115,7 +115,7 @@ def range_of_halfword_bits(bits, signed=True, count=24): elems = range_of_bits(bits, signed, count) for i,e in enumerate(elems): - elems[i] = (e // 2) >> 1 + elems[i] = e >> 1 return elems def build_fake(clazz, *arg_bits): @@ -177,6 +177,7 @@ 'eo': (lambda num: REGNAMES[num]), 'r/m': (lambda num: REGNAMES[num]), 'f': (lambda num: FP_REGNAMES[num]), + 'h32': (lambda num: str(num << 1)), } arg_types = self.get_func_arg_types(methodname) for mode, args in zip(arg_types, arguments): From noreply at buildbot.pypy.org Fri Nov 13 04:39:37 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 13 Nov 2015 10:39:37 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: merge default Message-ID: <20151113093937.0FD8A1C0290@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80656:88df30df8622 Date: 2015-11-13 10:38 +0100 http://bitbucket.org/pypy/pypy/changeset/88df30df8622/ Log: merge default diff too long, truncating to 2000 out of 100667 lines diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ .hg .svn +# VIM +*.swp +*.swo + *.pyc *.pyo *~ +__pycache__/ bin/pypy-c include/*.h @@ -22,4 +27,6 @@ pypy/translator/goal/pypy-c pypy/translator/goal/target*-c release/ +!pypy/tool/release/ rpython/_cache/ +__pycache__/ diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -430,7 +430,7 @@ gdbm module, provided in the file lib_pypy/gdbm.py, is redistributed under the terms of the GPL license as well. -License for 'pypy/module/_vmprof/src' +License for 'rpython/rlib/rvmprof/src' -------------------------------------- The code is based on gperftools. You may see a copy of the License for it at diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py --- a/dotviewer/graphclient.py +++ b/dotviewer/graphclient.py @@ -127,16 +127,8 @@ return spawn_graphserver_handler((host, port)) def spawn_local_handler(): - if hasattr(sys, 'pypy_objspaceclass'): - # if 'python' is actually PyPy, e.g. in a virtualenv, then - # try hard to find a real CPython - try: - python = subprocess.check_output( - 'env -i $SHELL -l -c "which python"', shell=True).strip() - except subprocess.CalledProcessError: - # did not work, fall back to 'python' - python = 'python' - else: + python = os.getenv('PYPY_PYGAME_PYTHON') + if not python: python = sys.executable args = [python, '-u', GRAPHSERVER, '--stdio'] p = subprocess.Popen(args, diff --git a/lib-python/conftest.py b/lib-python/conftest.py --- a/lib-python/conftest.py +++ b/lib-python/conftest.py @@ -158,7 +158,7 @@ RegrTest('test_codecs.py', core=True, usemodules='_multibytecodec'), RegrTest('test_codeop.py', core=True), RegrTest('test_coding.py', core=True), - RegrTest('test_coercion.py', core=True), + RegrTest('test_coercion.py', core=True, usemodules='struct'), RegrTest('test_collections.py', usemodules='binascii struct'), RegrTest('test_colorsys.py'), RegrTest('test_commands.py'), @@ -303,7 +303,7 @@ RegrTest('test_memoryio.py'), RegrTest('test_memoryview.py'), RegrTest('test_md5.py'), - RegrTest('test_mhlib.py'), + RegrTest('test_mhlib.py', usemodules='binascii struct'), RegrTest('test_mimetools.py'), RegrTest('test_mimetypes.py'), RegrTest('test_MimeWriter.py', core=False, usemodules='binascii'), diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py --- a/lib_pypy/_curses.py +++ b/lib_pypy/_curses.py @@ -1026,16 +1026,22 @@ def tigetflag(capname): _ensure_initialised_setupterm() + if isinstance(capname, unicode): + capname = capname.encode('ascii') return lib.tigetflag(capname) def tigetnum(capname): _ensure_initialised_setupterm() + if isinstance(capname, unicode): + capname = capname.encode('ascii') return lib.tigetnum(capname) def tigetstr(capname): _ensure_initialised_setupterm() + if isinstance(capname, unicode): + capname = capname.encode('ascii') val = lib.tigetstr(capname) if int(ffi.cast("intptr_t", val)) in (0, -1): return None diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), From noreply at buildbot.pypy.org Fri Nov 13 04:39:39 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 13 Nov 2015 10:39:39 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: Merge Message-ID: <20151113093939.8EFAB1C0290@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80657:5a0d15e9f510 Date: 2015-11-13 10:40 +0100 http://bitbucket.org/pypy/pypy/changeset/5a0d15e9f510/ Log: Merge diff --git a/pypy/module/pypystm/hashtable.py b/pypy/module/pypystm/hashtable.py --- a/pypy/module/pypystm/hashtable.py +++ b/pypy/module/pypystm/hashtable.py @@ -2,6 +2,7 @@ The class pypystm.hashtable, mapping integers to objects. """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault @@ -78,6 +79,55 @@ for i in range(count)] return space.newlist(lst_w) + def iterkeys_w(self, space): + return W_HashtableIterKeys(self.h) + + def itervalues_w(self, space): + return W_HashtableIterValues(self.h) + + def iteritems_w(self, space): + return W_HashtableIterItems(self.h) + + +class W_BaseHashtableIter(W_Root): + _immutable_fields_ = ["hiter"] + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx overestimate: doesn't remove the items already yielded, + # and uses the faster len_estimate() + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + return self.get_final_value(space, entry) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +class W_HashtableIterKeys(W_BaseHashtableIter): + def get_final_value(self, space, entry): + return space.wrap(intmask(entry.index)) + +class W_HashtableIterValues(W_BaseHashtableIter): + def get_final_value(self, space, entry): + return cast_gcref_to_instance(W_Root, entry.object) + +class W_HashtableIterItems(W_BaseHashtableIter): + def get_final_value(self, space, entry): + return space.newtuple([ + space.wrap(intmask(entry.index)), + cast_gcref_to_instance(W_Root, entry.object)]) + def W_Hashtable___new__(space, w_subtype): r = space.allocate_instance(W_Hashtable, w_subtype) @@ -98,4 +148,16 @@ keys = interp2app(W_Hashtable.keys_w), values = interp2app(W_Hashtable.values_w), items = interp2app(W_Hashtable.items_w), + + __iter__ = interp2app(W_Hashtable.iterkeys_w), + iterkeys = interp2app(W_Hashtable.iterkeys_w), + itervalues = interp2app(W_Hashtable.itervalues_w), + iteritems = interp2app(W_Hashtable.iteritems_w), ) + +W_BaseHashtableIter.typedef = TypeDef( + "hashtable_iter", + __iter__ = interp2app(W_BaseHashtableIter.descr_iter), + next = interp2app(W_BaseHashtableIter.descr_next), + __length_hint__ = interp2app(W_BaseHashtableIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -2,6 +2,7 @@ The class pypystm.stmdict, giving a part of the regular 'dict' interface """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault @@ -215,10 +216,6 @@ def len_w(self, space): return space.wrap(self.get_length()) - def iter_w(self, space): - # not a real lazy iterator! - return space.iter(self.keys_w(space)) - def keys_w(self, space): return space.newlist(self.get_keys_values_w(offset=0)) @@ -228,6 +225,70 @@ def items_w(self, space): return space.newlist(self.get_items_w(space)) + def iterkeys_w(self, space): + return W_STMDictIterKeys(self.h) + + def itervalues_w(self, space): + return W_STMDictIterValues(self.h) + + def iteritems_w(self, space): + return W_STMDictIterItems(self.h) + + +class W_BaseSTMDictIter(W_Root): + _immutable_fields_ = ["hiter"] + next_from_same_hash = 0 + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx estimate: doesn't remove the items already yielded, + # and uses the faster len_estimate(); on the other hand, + # counts only one for every 64-bit hash value + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + else: + index = self.next_from_same_hash + array = self.next_array + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 2: # uncommon case + self.next_from_same_hash = index + 2 + self.next_array = array + # + return self.get_final_value(space, array, index) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +class W_STMDictIterKeys(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return cast_gcref_to_instance(W_Root, array[index]) + +class W_STMDictIterValues(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return cast_gcref_to_instance(W_Root, array[index + 1]) + +class W_STMDictIterItems(W_BaseSTMDictIter): + def get_final_value(self, space, array, index): + return space.newtuple([ + cast_gcref_to_instance(W_Root, array[index]), + cast_gcref_to_instance(W_Root, array[index + 1])]) + def W_STMDict___new__(space, w_subtype): r = space.allocate_instance(W_STMDict, w_subtype) @@ -246,8 +307,19 @@ setdefault = interp2app(W_STMDict.setdefault_w), __len__ = interp2app(W_STMDict.len_w), - __iter__ = interp2app(W_STMDict.iter_w), keys = interp2app(W_STMDict.keys_w), values = interp2app(W_STMDict.values_w), items = interp2app(W_STMDict.items_w), + + __iter__ = interp2app(W_STMDict.iterkeys_w), + iterkeys = interp2app(W_STMDict.iterkeys_w), + itervalues = interp2app(W_STMDict.itervalues_w), + iteritems = interp2app(W_STMDict.iteritems_w), ) + +W_BaseSTMDictIter.typedef = TypeDef( + "stmdict_iter", + __iter__ = interp2app(W_BaseSTMDictIter.descr_iter), + next = interp2app(W_BaseSTMDictIter.descr_next), + __length_hint__ = interp2app(W_BaseSTMDictIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/stmset.py b/pypy/module/pypystm/stmset.py --- a/pypy/module/pypystm/stmset.py +++ b/pypy/module/pypystm/stmset.py @@ -2,6 +2,7 @@ The class pypystm.stmset, giving a part of the regular 'set' interface """ +from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app @@ -150,8 +151,48 @@ return space.wrap(self.get_length()) def iter_w(self, space): - # not a real lazy iterator! - return space.iter(space.newlist(self.get_items_w())) + return W_STMSetIter(self.h) + + +class W_STMSetIter(W_Root): + _immutable_fields_ = ["hiter"] + next_from_same_hash = 0 + + def __init__(self, hobj): + self.hiter = hobj.iterentries() + + def descr_iter(self, space): + return self + + def descr_length_hint(self, space): + # xxx estimate: doesn't remove the items already yielded, + # and uses the faster len_estimate(); on the other hand, + # counts only one for every 64-bit hash value + return space.wrap(self.hiter.hashtable.len_estimate()) + + def descr_next(self, space): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + else: + index = self.next_from_same_hash + array = self.next_array + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 1: # uncommon case + self.next_from_same_hash = index + 1 + self.next_array = array + # + return cast_gcref_to_instance(W_Root, array[index]) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) def W_STMSet___new__(space, w_subtype): @@ -170,3 +211,10 @@ __len__ = interp2app(W_STMSet.len_w), __iter__ = interp2app(W_STMSet.iter_w), ) + +W_STMSetIter.typedef = TypeDef( + "stmset_iter", + __iter__ = interp2app(W_STMSetIter.descr_iter), + next = interp2app(W_STMSetIter.descr_next), + __length_hint__ = interp2app(W_STMSetIter.descr_length_hint), + ) diff --git a/pypy/module/pypystm/test/test_hashtable.py b/pypy/module/pypystm/test/test_hashtable.py --- a/pypy/module/pypystm/test/test_hashtable.py +++ b/pypy/module/pypystm/test/test_hashtable.py @@ -55,3 +55,13 @@ assert sorted(h.keys()) == [42, 43] assert sorted(h.values()) == ["bar", "foo"] assert sorted(h.items()) == [(42, "foo"), (43, "bar")] + + def test_iterator(self): + import pypystm + h = pypystm.hashtable() + h[42] = "foo" + h[43] = "bar" + assert sorted(h) == [42, 43] + assert sorted(h.iterkeys()) == [42, 43] + assert sorted(h.itervalues()) == ["bar", "foo"] + assert sorted(h.iteritems()) == [(42, "foo"), (43, "bar")] diff --git a/pypy/module/pypystm/test/test_stmdict.py b/pypy/module/pypystm/test/test_stmdict.py --- a/pypy/module/pypystm/test/test_stmdict.py +++ b/pypy/module/pypystm/test/test_stmdict.py @@ -158,3 +158,24 @@ assert a not in d assert b not in d assert d.keys() == [] + + + def test_iterator(self): + import pypystm + class A(object): + def __hash__(self): + return 42 + class B(object): + pass + d = pypystm.stmdict() + a1 = A() + a2 = A() + b0 = B() + d[a1] = "foo" + d[a2] = None + d[b0] = "bar" + assert sorted(d) == sorted([a1, a2, b0]) + assert sorted(d.iterkeys()) == sorted([a1, a2, b0]) + assert sorted(d.itervalues()) == [None, "bar", "foo"] + assert sorted(d.iteritems()) == sorted([(a1, "foo"), (a2, None), + (b0, "bar")]) diff --git a/pypy/module/pypystm/test/test_stmset.py b/pypy/module/pypystm/test/test_stmset.py --- a/pypy/module/pypystm/test/test_stmset.py +++ b/pypy/module/pypystm/test/test_stmset.py @@ -83,3 +83,19 @@ assert len(s) == 2 items = list(s) assert items == [42.5, key3] or items == [key3, 42.5] + + def test_iterator(self): + import pypystm + class A(object): + def __hash__(self): + return 42 + class B(object): + pass + d = pypystm.stmset() + a1 = A() + a2 = A() + b0 = B() + d.add(a1) + d.add(a2) + d.add(b0) + assert sorted(d) == sorted([a1, a2, b0]) diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -223,11 +223,13 @@ # ____________________________________________________________ _STM_HASHTABLE_P = rffi.COpaquePtr('stm_hashtable_t') +_STM_HASHTABLE_TABLE_P = rffi.COpaquePtr('stm_hashtable_table_t') _STM_HASHTABLE_ENTRY = lltype.GcStruct('HASHTABLE_ENTRY', ('index', lltype.Unsigned), ('object', llmemory.GCREF)) _STM_HASHTABLE_ENTRY_P = lltype.Ptr(_STM_HASHTABLE_ENTRY) +_STM_HASHTABLE_ENTRY_PP = rffi.CArrayPtr(_STM_HASHTABLE_ENTRY_P) _STM_HASHTABLE_ENTRY_ARRAY = lltype.GcArray(_STM_HASHTABLE_ENTRY_P) @dont_look_inside @@ -245,6 +247,11 @@ lltype.nullptr(_STM_HASHTABLE_ENTRY_ARRAY)) @dont_look_inside +def _ll_hashtable_len_estimate(h): + return llop.stm_hashtable_length_upper_bound(lltype.Signed, + h.ll_raw_hashtable) + + at dont_look_inside def _ll_hashtable_list(h): upper_bound = llop.stm_hashtable_length_upper_bound(lltype.Signed, h.ll_raw_hashtable) @@ -264,6 +271,28 @@ def _ll_hashtable_writeobj(h, entry, value): llop.stm_hashtable_write_entry(lltype.Void, h, entry, value) + at dont_look_inside +def _ll_hashtable_iterentries(h): + rgc.register_custom_trace_hook(_HASHTABLE_ITER_OBJ, + lambda_hashtable_iter_trace) + table = llop.stm_hashtable_iter(_STM_HASHTABLE_TABLE_P, h.ll_raw_hashtable) + hiter = lltype.malloc(_HASHTABLE_ITER_OBJ) + hiter.hashtable = h # for keepalive + hiter.table = table + hiter.prev = lltype.nullptr(_STM_HASHTABLE_ENTRY_PP.TO) + return hiter + + at dont_look_inside +def _ll_hashiter_next(hiter): + entrypp = llop.stm_hashtable_iter_next(_STM_HASHTABLE_ENTRY_PP, + hiter.hashtable, + hiter.table, + hiter.prev) + if not entrypp: + raise StopIteration + hiter.prev = entrypp + return entrypp[0] + _HASHTABLE_OBJ = lltype.GcStruct('HASHTABLE_OBJ', ('ll_raw_hashtable', _STM_HASHTABLE_P), hints={'immutable': True}, @@ -271,11 +300,19 @@ adtmeths={'get': _ll_hashtable_get, 'set': _ll_hashtable_set, 'len': _ll_hashtable_len, + 'len_estimate': _ll_hashtable_len_estimate, 'list': _ll_hashtable_list, 'lookup': _ll_hashtable_lookup, - 'writeobj': _ll_hashtable_writeobj}) + 'writeobj': _ll_hashtable_writeobj, + 'iterentries': _ll_hashtable_iterentries}) NULL_HASHTABLE = lltype.nullptr(_HASHTABLE_OBJ) +_HASHTABLE_ITER_OBJ = lltype.GcStruct('HASHTABLE_ITER_OBJ', + ('hashtable', lltype.Ptr(_HASHTABLE_OBJ)), + ('table', _STM_HASHTABLE_TABLE_P), + ('prev', _STM_HASHTABLE_ENTRY_PP), + adtmeths={'next': _ll_hashiter_next}) + def _ll_hashtable_trace(gc, obj, callback, arg): from rpython.memory.gctransform.stmframework import get_visit_function visit_fn = get_visit_function(callback, arg) @@ -288,6 +325,15 @@ llop.stm_hashtable_free(lltype.Void, h.ll_raw_hashtable) lambda_hashtable_finlz = lambda: _ll_hashtable_finalizer +def _ll_hashtable_iter_trace(gc, obj, callback, arg): + from rpython.memory.gctransform.stmframework import get_visit_function + addr = obj + llmemory.offsetof(_HASHTABLE_ITER_OBJ, 'hashtable') + gc._trace_callback(callback, arg, addr) + visit_fn = get_visit_function(callback, arg) + addr = obj + llmemory.offsetof(_HASHTABLE_ITER_OBJ, 'table') + llop.stm_hashtable_iter_tracefn(lltype.Void, addr.address[0], visit_fn) +lambda_hashtable_iter_trace = lambda: _ll_hashtable_iter_trace + _false = CDefinedIntSymbolic('0', default=0) # remains in the C code @dont_look_inside @@ -344,6 +390,9 @@ items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] return len(items) + def len_estimate(self): + return len(self._content) + def list(self): items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] count = len(items) @@ -359,6 +408,9 @@ assert isinstance(entry, EntryObjectForTest) self.set(entry.key, nvalue) + def iterentries(self): + return IterEntriesForTest(self, self._content.itervalues()) + class EntryObjectForTest(object): def __init__(self, hashtable, key): self.hashtable = hashtable @@ -374,6 +426,14 @@ object = property(_getobj, _setobj) +class IterEntriesForTest(object): + def __init__(self, hashtable, iterator): + self.hashtable = hashtable + self.iterator = iterator + + def next(self): + return next(self.iterator) + # ____________________________________________________________ _STM_QUEUE_P = rffi.COpaquePtr('stm_queue_t') diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -487,6 +487,10 @@ 'stm_hashtable_list' : LLOp(), 'stm_hashtable_tracefn': LLOp(), + 'stm_hashtable_iter': LLOp(), + 'stm_hashtable_iter_next': LLOp(), + 'stm_hashtable_iter_tracefn': LLOp(), + 'stm_queue_create': LLOp(), 'stm_queue_free': LLOp(), 'stm_queue_get': LLOp(canmallocgc=True), # push roots! diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -403,9 +403,28 @@ arg0 = funcgen.expr(op.args[0]) arg1 = funcgen.expr(op.args[1]) arg2 = funcgen.expr(op.args[2]) - return ('stm_hashtable_tracefn(%s, (stm_hashtable_t *)%s, ' + return ('stm_hashtable_tracefn(%s, (stm_hashtable_t *)%s,' ' (void(*)(object_t**))%s);' % (arg0, arg1, arg2)) +def stm_hashtable_iter(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + result = funcgen.expr(op.result) + return '%s = stm_hashtable_iter(%s);' % (result, arg0) + +def stm_hashtable_iter_next(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + arg1 = funcgen.expr(op.args[1]) + arg2 = funcgen.expr(op.args[2]) + result = funcgen.expr(op.result) + return ('%s = stm_hashtable_iter_next(%s, %s, %s);' % + (result, arg0, arg1, arg2)) + +def stm_hashtable_iter_tracefn(funcgen, op): + arg0 = funcgen.expr(op.args[0]) + arg1 = funcgen.expr(op.args[1]) + return ('stm_hashtable_iter_tracefn((stm_hashtable_table_t *)%s,' + ' (void(*)(object_t**))%s);' % (arg0, arg1)) + def stm_queue_create(funcgen, op): result = funcgen.expr(op.result) return '%s = stm_queue_create();' % (result,) diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision --- a/rpython/translator/stm/src_stm/revision +++ b/rpython/translator/stm/src_stm/revision @@ -1,1 +1,1 @@ -41227d7659ac +72facb6e4533 diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c --- a/rpython/translator/stm/src_stm/stm/core.c +++ b/rpython/translator/stm/src_stm/stm/core.c @@ -1374,6 +1374,8 @@ from its segment. Better do it as soon as possible, because other threads might be spin-looping, waiting for the -1 to disappear. */ + /* but first, emit commit-event of this thread: */ + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_COMMIT); STM_SEGMENT->running_thread = NULL; write_fence(); assert(_stm_detached_inevitable_from_thread == -1); diff --git a/rpython/translator/stm/src_stm/stm/detach.c b/rpython/translator/stm/src_stm/stm/detach.c --- a/rpython/translator/stm/src_stm/stm/detach.c +++ b/rpython/translator/stm/src_stm/stm/detach.c @@ -127,6 +127,7 @@ // XXX: not sure if the next line is a good idea tl->last_associated_segment_num = remote_seg_num; ensure_gs_register(remote_seg_num); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); } dprintf(("reattach_transaction: start a new transaction\n")); @@ -185,6 +186,7 @@ assert(segnum > 0); ensure_gs_register(segnum); + timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); ensure_gs_register(mysegnum); } diff --git a/rpython/translator/stm/src_stm/stm/finalizer.c b/rpython/translator/stm/src_stm/stm/finalizer.c --- a/rpython/translator/stm/src_stm/stm/finalizer.c +++ b/rpython/translator/stm/src_stm/stm/finalizer.c @@ -501,7 +501,17 @@ /* XXX: become inevitable, bc. otherwise, we would need to keep around the original g_finalizers.run_finalizers to restore it in case of an abort. */ - _stm_become_inevitable("finalizer-Tx"); + _stm_become_inevitable(MSG_INEV_DONT_SLEEP); + /* did it work? */ + if (STM_PSEGMENT->transaction_state != TS_INEVITABLE) { /* no */ + /* avoid blocking here, waiting for another INEV transaction. + If we did that, application code could not proceed (start the + next transaction) and it will not be obvious from the profile + why we were WAITing. */ + _stm_commit_transaction(); + stm_rewind_jmp_leaveframe(tl, &rjbuf); + return; + } while (__sync_lock_test_and_set(&g_finalizers.lock, 1) != 0) { /* somebody is adding more finalizers (_commit_finalizer()) */ diff --git a/rpython/translator/stm/src_stm/stm/gcpage.c b/rpython/translator/stm/src_stm/stm/gcpage.c --- a/rpython/translator/stm/src_stm/stm/gcpage.c +++ b/rpython/translator/stm/src_stm/stm/gcpage.c @@ -224,6 +224,9 @@ version and thus don't need tracing. */ static struct list_s *marked_objects_to_trace; +/* a list of hobj/hashtable pairs for all hashtables seen */ +static struct list_s *all_hashtables_seen = NULL; + /* we use the sharing seg0's pages for the GCFLAG_VISITED flag */ static inline struct object_s *mark_loc(object_t *obj) @@ -301,8 +304,6 @@ } -#define TRACE_FOR_MAJOR_COLLECTION (&mark_record_trace) - static void mark_and_trace( object_t *obj, char *segment_base, /* to trace obj in */ @@ -791,6 +792,7 @@ /* marking */ LIST_CREATE(marked_objects_to_trace); + LIST_CREATE(all_hashtables_seen); mark_visit_from_modified_objects(); mark_visit_from_markers(); mark_visit_from_roots(); @@ -815,6 +817,10 @@ sweep_large_objects(); sweep_small_objects(); + /* hashtables */ + stm_compact_hashtables(); + LIST_FREE(all_hashtables_seen); + dprintf((" | used after collection: %ld\n", (long)pages_ctl.total_allocated)); dprintf((" `----------------------------------------------\n")); diff --git a/rpython/translator/stm/src_stm/stm/hashtable.c b/rpython/translator/stm/src_stm/stm/hashtable.c --- a/rpython/translator/stm/src_stm/stm/hashtable.c +++ b/rpython/translator/stm/src_stm/stm/hashtable.c @@ -49,8 +49,12 @@ #define PERTURB_SHIFT 5 #define RESIZING_LOCK 0 -typedef struct { - uintptr_t mask; +#define TRACE_FLAG_OFF 0 +#define TRACE_FLAG_ONCE 1 +#define TRACE_FLAG_KEEPALIVE 2 + +struct stm_hashtable_table_s { + uintptr_t mask; /* 'mask' is always immutable. */ /* 'resize_counter' start at an odd value, and is decremented (by 6) for every new item put in 'items'. When it crosses 0, we @@ -63,8 +67,10 @@ */ uintptr_t resize_counter; + uint8_t trace_flag; + stm_hashtable_entry_t *items[INITIAL_HASHTABLE_SIZE]; -} stm_hashtable_table_t; +}; #define IS_EVEN(p) (((p) & 1) == 0) @@ -79,6 +85,7 @@ { table->mask = itemcount - 1; table->resize_counter = itemcount * 4 + 1; + table->trace_flag = TRACE_FLAG_OFF; memset(table->items, 0, itemcount * sizeof(stm_hashtable_entry_t *)); } @@ -162,6 +169,7 @@ assert(biggertable); // XXX stm_hashtable_table_t *table = hashtable->table; + table->trace_flag = TRACE_FLAG_ONCE; table->resize_counter = (uintptr_t)biggertable; /* ^^^ this unlocks the table by writing a non-zero value to table->resize_counter, but the new value is a pointer to the @@ -485,6 +493,41 @@ static void _stm_compact_hashtable(struct object_s *hobj, stm_hashtable_t *hashtable) { + /* Walk the chained list that starts at 'hashtable->initial_table' + and follows the 'resize_counter' fields. Remove all tables + except (1) the initial one, (2) the most recent one, and (3) + the ones on which stm_hashtable_iter_tracefn() was called. + */ + stm_hashtable_table_t *most_recent_table = hashtable->table; + assert(!IS_EVEN(most_recent_table->resize_counter)); + /* set the "don't free me" flag on the most recent table */ + most_recent_table->trace_flag = TRACE_FLAG_KEEPALIVE; + + stm_hashtable_table_t *known_alive = &hashtable->initial_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + /* a KEEPALIVE flag is ignored on the initial table: it is never + individually freed anyway */ + + while (known_alive != most_recent_table) { + uintptr_t rc = known_alive->resize_counter; + assert(IS_EVEN(rc)); + assert(rc != RESIZING_LOCK); + + stm_hashtable_table_t *next_table = (stm_hashtable_table_t *)rc; + if (next_table->trace_flag != TRACE_FLAG_KEEPALIVE) { + /* free this next table and relink the chained list to skip it */ + assert(IS_EVEN(next_table->resize_counter)); + known_alive->resize_counter = next_table->resize_counter; + free(next_table); + } + else { + /* this next table is kept alive */ + known_alive = next_table; + known_alive->trace_flag = TRACE_FLAG_OFF; + } + } + /* done the first part */ + stm_hashtable_table_t *table = hashtable->table; uintptr_t rc = table->resize_counter; assert(!IS_EVEN(rc)); @@ -515,35 +558,24 @@ dprintf(("compact with %ld items:\n", num_entries_times_6 / 6)); _stm_rehash_hashtable(hashtable, count, segnum); } +} - table = hashtable->table; - assert(!IS_EVEN(table->resize_counter)); - - if (table != &hashtable->initial_table) { - uintptr_t rc = hashtable->initial_table.resize_counter; - while (1) { - assert(IS_EVEN(rc)); - assert(rc != RESIZING_LOCK); - - stm_hashtable_table_t *old_table = (stm_hashtable_table_t *)rc; - if (old_table == table) - break; - rc = old_table->resize_counter; - free(old_table); - } - hashtable->initial_table.resize_counter = (uintptr_t)table; - assert(IS_EVEN(hashtable->initial_table.resize_counter)); +static void stm_compact_hashtables(void) +{ + uintptr_t i = all_hashtables_seen->count; + while (i > 0) { + i -= 2; + _stm_compact_hashtable( + (struct object_s *)all_hashtables_seen->items[i], + (stm_hashtable_t *)all_hashtables_seen->items[i + 1]); } } -void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, - void trace(object_t **)) +static void _hashtable_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) { - if (trace == TRACE_FOR_MAJOR_COLLECTION) - _stm_compact_hashtable(hobj, hashtable); - - stm_hashtable_table_t *table; - table = VOLATILE_HASHTABLE(hashtable)->table; + if (table->trace_flag == TRACE_FLAG_ONCE) + table->trace_flag = TRACE_FLAG_OFF; uintptr_t j, mask = table->mask; for (j = 0; j <= mask; j++) { @@ -554,3 +586,105 @@ } } } + +void stm_hashtable_tracefn(struct object_s *hobj, stm_hashtable_t *hashtable, + void trace(object_t **)) +{ + if (all_hashtables_seen != NULL) + all_hashtables_seen = list_append2(all_hashtables_seen, + (uintptr_t)hobj, + (uintptr_t)hashtable); + + _hashtable_tracefn(VOLATILE_HASHTABLE(hashtable)->table, trace); +} + + +/* Hashtable iterators */ + +/* TRACE_FLAG_ONCE: the table must be traced once if it supports an iterator + TRACE_FLAG_OFF: the table is the most recent table, or has already been + traced once + TRACE_FLAG_KEEPALIVE: during major collection only: mark tables that + must be kept alive because there are iterators +*/ + +struct stm_hashtable_table_s *stm_hashtable_iter(stm_hashtable_t *hashtable) +{ + /* Get the table. No synchronization is needed: we may miss some + entries that are being added, but they would contain NULL in + this segment anyway. */ + return VOLATILE_HASHTABLE(hashtable)->table; +} + +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, + stm_hashtable_entry_t **previous) +{ + /* Set the read marker on hobj for every item, in case we have + transaction breaks in-between. + */ + stm_read(hobj); + + /* Get the bounds of the part of the 'stm_hashtable_entry_t *' array + that we have to check */ + stm_hashtable_entry_t **pp, **last; + if (previous == NULL) + pp = table->items; + else + pp = previous + 1; + last = table->items + table->mask; + + /* Find the first non-null entry */ + stm_hashtable_entry_t *entry; + + while (pp <= last) { + entry = *(stm_hashtable_entry_t *volatile *)pp; + if (entry != NULL) { + stm_read((object_t *)entry); + if (entry->object != NULL) { + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, pp); + return pp; + } + } + ++pp; + } + //fprintf(stderr, "stm_hashtable_iter_next(%p, %p, %p) = %p\n", + // hobj, table, previous, NULL); + return NULL; +} + +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)) +{ + if (all_hashtables_seen == NULL) { /* for minor collections */ + + /* During minor collection, tracing the table is only required + the first time: if it contains young objects, they must be + kept alive and have their address updated. We use + TRACE_FLAG_ONCE to know that. We don't need to do it if + our 'table' is the latest version, because in that case it + will be done by stm_hashtable_tracefn(). That's why + TRACE_FLAG_ONCE is only set when a more recent table is + attached. + + It is only needed once: non-latest-version tables are + immutable. We mark once all the entries as old, and + then these now-old objects stay alive until the next + major collection. + + Checking the flag can be done without synchronization: it + never wrong to call _hashtable_tracefn() too much, and the + only case where it *has to* be called occurs if the + hashtable object is still young (and not seen by other + threads). + */ + if (table->trace_flag == TRACE_FLAG_ONCE) + _hashtable_tracefn(table, trace); + } + else { /* for major collections */ + + /* Set this flag for _stm_compact_hashtable() */ + table->trace_flag = TRACE_FLAG_KEEPALIVE; + } +} diff --git a/rpython/translator/stm/src_stm/stm/hashtable.h b/rpython/translator/stm/src_stm/stm/hashtable.h new file mode 100644 --- /dev/null +++ b/rpython/translator/stm/src_stm/stm/hashtable.h @@ -0,0 +1,2 @@ +/* Imported by rpython/translator/stm/import_stmgc.py */ +static void stm_compact_hashtables(void); diff --git a/rpython/translator/stm/src_stm/stmgc.c b/rpython/translator/stm/src_stm/stmgc.c --- a/rpython/translator/stm/src_stm/stmgc.c +++ b/rpython/translator/stm/src_stm/stmgc.c @@ -20,6 +20,7 @@ #include "stm/finalizer.h" #include "stm/locks.h" #include "stm/detach.h" +#include "stm/hashtable.h" #include "stm/queue.h" #include "stm/misc.c" #include "stm/list.c" diff --git a/rpython/translator/stm/src_stm/stmgc.h b/rpython/translator/stm/src_stm/stmgc.h --- a/rpython/translator/stm/src_stm/stmgc.h +++ b/rpython/translator/stm/src_stm/stmgc.h @@ -100,6 +100,8 @@ #define _stm_detach_inevitable_transaction(tl) do { \ write_fence(); \ assert(_stm_detached_inevitable_from_thread == 0); \ + if (stmcb_timing_event != NULL && tl->self_or_0_if_atomic != 0) \ + {stmcb_timing_event(tl, STM_TRANSACTION_DETACH, NULL);} \ _stm_detached_inevitable_from_thread = tl->self_or_0_if_atomic; \ } while (0) void _stm_reattach_transaction(intptr_t); @@ -416,69 +418,6 @@ #endif -/* Entering and leaving a "transactional code zone": a (typically very - large) section in the code where we are running a transaction. - This is the STM equivalent to "acquire the GIL" and "release the - GIL", respectively. stm_read(), stm_write(), stm_allocate(), and - other functions should only be called from within a transaction. - - Note that transactions, in the STM sense, cover _at least_ one - transactional code zone. They may be longer; for example, if one - thread does a lot of stm_enter_transactional_zone() + - stm_become_inevitable() + stm_leave_transactional_zone(), as is - typical in a thread that does a lot of C function calls, then we - get only a few bigger inevitable transactions that cover the many - short transactional zones. This is done by having - stm_leave_transactional_zone() turn the current transaction - inevitable and detach it from the running thread (if there is no - other inevitable transaction running so far). Then - stm_enter_transactional_zone() will try to reattach to it. This is - far more efficient than constantly starting and committing - transactions. - - stm_enter_transactional_zone() and stm_leave_transactional_zone() - preserve the value of errno. -*/ -#ifdef STM_DEBUGPRINT -#include -#endif -static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { - intptr_t self = tl->self_or_0_if_atomic; - if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, - self, 0)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_enter_transactional_zone fast path\n"); -#endif - } - else { - _stm_reattach_transaction(self); - /* _stm_detached_inevitable_from_thread should be 0 here, but - it can already have been changed from a parallel thread - (assuming we're not inevitable ourselves) */ - } -} -static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { - assert(STM_SEGMENT->running_thread == tl); - if (stm_is_inevitable(tl)) { -#ifdef STM_DEBUGPRINT - fprintf(stderr, "stm_leave_transactional_zone fast path\n"); -#endif - _stm_detach_inevitable_transaction(tl); - } - else { - _stm_leave_noninevitable_transactional_zone(); - } -} - -/* stm_force_transaction_break() is in theory equivalent to - stm_leave_transactional_zone() immediately followed by - stm_enter_transactional_zone(); however, it is supposed to be - called in CPU-heavy threads that had a transaction run for a while, - and so it *always* forces a commit and starts the next transaction. - The new transaction is never inevitable. See also - stm_should_break_transaction(). */ -void stm_force_transaction_break(stm_thread_local_t *tl); - /* Abort the currently running transaction. This function never returns: it jumps back to the start of the transaction (which must not be inevitable). */ @@ -596,6 +535,10 @@ STM_TRANSACTION_COMMIT, STM_TRANSACTION_ABORT, + /* DETACH/REATTACH is used for leaving/reentering the transactional */ + STM_TRANSACTION_DETACH, + STM_TRANSACTION_REATTACH, + /* inevitable contention: all threads that try to become inevitable have a STM_BECOME_INEVITABLE event with a position marker. Then, if it waits it gets a STM_WAIT_OTHER_INEVITABLE. It is possible @@ -688,6 +631,75 @@ } while (0) + +/* Entering and leaving a "transactional code zone": a (typically very + large) section in the code where we are running a transaction. + This is the STM equivalent to "acquire the GIL" and "release the + GIL", respectively. stm_read(), stm_write(), stm_allocate(), and + other functions should only be called from within a transaction. + + Note that transactions, in the STM sense, cover _at least_ one + transactional code zone. They may be longer; for example, if one + thread does a lot of stm_enter_transactional_zone() + + stm_become_inevitable() + stm_leave_transactional_zone(), as is + typical in a thread that does a lot of C function calls, then we + get only a few bigger inevitable transactions that cover the many + short transactional zones. This is done by having + stm_leave_transactional_zone() turn the current transaction + inevitable and detach it from the running thread (if there is no + other inevitable transaction running so far). Then + stm_enter_transactional_zone() will try to reattach to it. This is + far more efficient than constantly starting and committing + transactions. + + stm_enter_transactional_zone() and stm_leave_transactional_zone() + preserve the value of errno. +*/ +#ifdef STM_DEBUGPRINT +#include +#endif +static inline void stm_enter_transactional_zone(stm_thread_local_t *tl) { + intptr_t self = tl->self_or_0_if_atomic; + if (__sync_bool_compare_and_swap(&_stm_detached_inevitable_from_thread, + self, 0)) { + if (self != 0 && stmcb_timing_event != NULL) { + /* for atomic transactions, we don't emit DETACH/REATTACH */ + stmcb_timing_event(tl, STM_TRANSACTION_REATTACH, NULL); + } +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_enter_transactional_zone fast path\n"); +#endif + } + else { + _stm_reattach_transaction(self); + /* _stm_detached_inevitable_from_thread should be 0 here, but + it can already have been changed from a parallel thread + (assuming we're not inevitable ourselves) */ + } +} +static inline void stm_leave_transactional_zone(stm_thread_local_t *tl) { + assert(STM_SEGMENT->running_thread == tl); + if (stm_is_inevitable(tl)) { +#ifdef STM_DEBUGPRINT + fprintf(stderr, "stm_leave_transactional_zone fast path\n"); +#endif + _stm_detach_inevitable_transaction(tl); + } + else { + _stm_leave_noninevitable_transactional_zone(); + } +} + +/* stm_force_transaction_break() is in theory equivalent to + stm_leave_transactional_zone() immediately followed by + stm_enter_transactional_zone(); however, it is supposed to be + called in CPU-heavy threads that had a transaction run for a while, + and so it *always* forces a commit and starts the next transaction. + The new transaction is never inevitable. See also + stm_should_break_transaction(). */ +void stm_force_transaction_break(stm_thread_local_t *tl); + + /* Support for light finalizers. This is a simple version of finalizers that guarantees not to do anything fancy, like not resurrecting objects. */ @@ -755,6 +767,21 @@ object_t *object; }; +/* Hashtable iterators. You get a raw 'table' pointer when you make + an iterator, which you pass to stm_hashtable_iter_next(). This may + or may not return items added after stm_hashtable_iter() was + called; there is no logic so far to detect changes (unlike Python's + RuntimeError). When the GC traces, you must keep the table pointer + alive with stm_hashtable_iter_tracefn(). The original hashtable + object must also be kept alive. */ +typedef struct stm_hashtable_table_s stm_hashtable_table_t; +stm_hashtable_table_t *stm_hashtable_iter(stm_hashtable_t *); +stm_hashtable_entry_t ** +stm_hashtable_iter_next(object_t *hobj, stm_hashtable_table_t *table, + stm_hashtable_entry_t **previous); +void stm_hashtable_iter_tracefn(stm_hashtable_table_t *table, + void trace(object_t **)); + /* Queues. The items you put() and get() back are in random order. Like hashtables, the type 'stm_queue_t' is not an object type at From noreply at buildbot.pypy.org Fri Nov 13 05:29:43 2015 From: noreply at buildbot.pypy.org (yufeiz) Date: Fri, 13 Nov 2015 11:29:43 +0100 (CET) Subject: [pypy-commit] pypy default: pystrtod.py edited online with Bitbucket Message-ID: <20151113102943.1EA731C0290@cobra.cs.uni-duesseldorf.de> Author: Faye Zhao Branch: Changeset: r80658:4d1ea0f21109 Date: 2015-11-13 00:16 +0000 http://bitbucket.org/pypy/pypy/changeset/4d1ea0f21109/ Log: pystrtod.py edited online with Bitbucket diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -9,6 +9,18 @@ from rpython.rtyper.lltypesystem import rffi +# PyOS_double_to_string's "type", if non-NULL, will be set to one of: +Py_DTST_FINITE = 0 +Py_DTST_INFINITE = 1 +Py_DTST_NAN = 2 + +# Match the "type" back to values in CPython +DOUBLE_TO_STRING_TYPES_MAP = { + rfloat.DIST_FINITE: Py_DTST_FINITE, + rfloat.DIST_INFINITY: Py_DTST_INFINITE, + rfloat.DIST_NAN: Py_DTST_NAN +} + @cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0) @jit.dont_look_inside # direct use of _get_errno() def PyOS_string_to_double(space, s, endptr, w_overflow_exception): @@ -68,3 +80,40 @@ finally: if not user_endptr: lltype.free(endptr, flavor='raw') + + at cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP) +def PyOS_double_to_string(space, val, format_code, precision, flags, ptype): + """Convert a double val to a string using supplied + format_code, precision, and flags. + + format_code must be one of 'e', 'E', 'f', 'F', + 'g', 'G' or 'r'. For 'r', the supplied precision + must be 0 and is ignored. The 'r' format code specifies the + standard repr() format. + + flags can be zero or more of the values Py_DTSF_SIGN, + Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together: + + Py_DTSF_SIGN means to always precede the returned string with a sign + character, even if val is non-negative. + + Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look + like an integer. + + Py_DTSF_ALT means to apply "alternate" formatting rules. See the + documentation for the PyOS_snprintf() '#' specifier for + details. + + If ptype is non-NULL, then the value it points to will be set to one of + Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that + val is a finite number, an infinite number, or not a number, respectively. + + The return value is a pointer to buffer with the converted string or + NULL if the conversion failed. The caller is responsible for freeing the + returned string by calling PyMem_Free(). + """ + buffer, rtype = rfloat.double_to_string(val, format_code, precision, flags) + if ptype != lltype.nullptr(rffi.INTP.TO): + ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) + bufp = rffi.str2charp(buffer) + return bufp From noreply at buildbot.pypy.org Fri Nov 13 05:29:45 2015 From: noreply at buildbot.pypy.org (yufeiz) Date: Fri, 13 Nov 2015 11:29:45 +0100 (CET) Subject: [pypy-commit] pypy default: test_pystrtod.py edited online with Bitbucket Message-ID: <20151113102945.305F41C0290@cobra.cs.uni-duesseldorf.de> Author: Faye Zhao Branch: Changeset: r80659:1294e75456b2 Date: 2015-11-13 00:18 +0000 http://bitbucket.org/pypy/pypy/changeset/1294e75456b2/ Log: test_pystrtod.py edited online with Bitbucket diff --git a/pypy/module/cpyext/test/test_pystrtod.py b/pypy/module/cpyext/test/test_pystrtod.py --- a/pypy/module/cpyext/test/test_pystrtod.py +++ b/pypy/module/cpyext/test/test_pystrtod.py @@ -1,5 +1,6 @@ import math +from pypy.module.cpyext import pystrtod from pypy.module.cpyext.test.test_api import BaseApiTest from rpython.rtyper.lltypesystem import rffi from rpython.rtyper.lltypesystem import lltype @@ -91,3 +92,76 @@ api.PyErr_Clear() rffi.free_charp(s) lltype.free(endp, flavor='raw') + + +class TestPyOS_double_to_string(BaseApiTest): + + def test_format_code(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(150.0, 'e', 1, 0, ptype) + assert '1.5e+02' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_precision(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3.14159269397, 'g', 5, 0, ptype) + assert '3.1416' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_sign(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(-3.14, 'g', 3, 1, ptype) + assert '-3.14' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_add_dot_0(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3, 'g', 5, 2, ptype) + assert '3.0' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_alt(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(314., 'g', 3, 4, ptype) + assert '314.' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_nan(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(float('nan'), 'g', 3, 4, ptype) + assert 'nan' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_NAN == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_infinity(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(1e200 * 1e200, 'g', 0, 0, ptype) + assert 'inf' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_INFINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_null(self, api): + ptype = lltype.nullptr(rffi.INTP.TO) + r = api.PyOS_double_to_string(3.14, 'g', 3, 0, ptype) + assert '3.14' == rffi.charp2str(r) + assert ptype == lltype.nullptr(rffi.INTP.TO) + rffi.free_charp(r) \ No newline at end of file From noreply at buildbot.pypy.org Fri Nov 13 05:29:47 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 11:29:47 +0100 (CET) Subject: [pypy-commit] pypy default: Merged in yufeiz/pypy-pyos_double_to_string (pull request #357) Message-ID: <20151113102947.487B61C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80660:f686da796f5e Date: 2015-11-13 11:30 +0100 http://bitbucket.org/pypy/pypy/changeset/f686da796f5e/ Log: Merged in yufeiz/pypy-pyos_double_to_string (pull request #357) Add PyOS_double_to_string and unit tests to cpyext diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -9,6 +9,18 @@ from rpython.rtyper.lltypesystem import rffi +# PyOS_double_to_string's "type", if non-NULL, will be set to one of: +Py_DTST_FINITE = 0 +Py_DTST_INFINITE = 1 +Py_DTST_NAN = 2 + +# Match the "type" back to values in CPython +DOUBLE_TO_STRING_TYPES_MAP = { + rfloat.DIST_FINITE: Py_DTST_FINITE, + rfloat.DIST_INFINITY: Py_DTST_INFINITE, + rfloat.DIST_NAN: Py_DTST_NAN +} + @cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0) @jit.dont_look_inside # direct use of _get_errno() def PyOS_string_to_double(space, s, endptr, w_overflow_exception): @@ -68,3 +80,40 @@ finally: if not user_endptr: lltype.free(endptr, flavor='raw') + + at cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP) +def PyOS_double_to_string(space, val, format_code, precision, flags, ptype): + """Convert a double val to a string using supplied + format_code, precision, and flags. + + format_code must be one of 'e', 'E', 'f', 'F', + 'g', 'G' or 'r'. For 'r', the supplied precision + must be 0 and is ignored. The 'r' format code specifies the + standard repr() format. + + flags can be zero or more of the values Py_DTSF_SIGN, + Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together: + + Py_DTSF_SIGN means to always precede the returned string with a sign + character, even if val is non-negative. + + Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look + like an integer. + + Py_DTSF_ALT means to apply "alternate" formatting rules. See the + documentation for the PyOS_snprintf() '#' specifier for + details. + + If ptype is non-NULL, then the value it points to will be set to one of + Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that + val is a finite number, an infinite number, or not a number, respectively. + + The return value is a pointer to buffer with the converted string or + NULL if the conversion failed. The caller is responsible for freeing the + returned string by calling PyMem_Free(). + """ + buffer, rtype = rfloat.double_to_string(val, format_code, precision, flags) + if ptype != lltype.nullptr(rffi.INTP.TO): + ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) + bufp = rffi.str2charp(buffer) + return bufp diff --git a/pypy/module/cpyext/test/test_pystrtod.py b/pypy/module/cpyext/test/test_pystrtod.py --- a/pypy/module/cpyext/test/test_pystrtod.py +++ b/pypy/module/cpyext/test/test_pystrtod.py @@ -1,5 +1,6 @@ import math +from pypy.module.cpyext import pystrtod from pypy.module.cpyext.test.test_api import BaseApiTest from rpython.rtyper.lltypesystem import rffi from rpython.rtyper.lltypesystem import lltype @@ -91,3 +92,76 @@ api.PyErr_Clear() rffi.free_charp(s) lltype.free(endp, flavor='raw') + + +class TestPyOS_double_to_string(BaseApiTest): + + def test_format_code(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(150.0, 'e', 1, 0, ptype) + assert '1.5e+02' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_precision(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3.14159269397, 'g', 5, 0, ptype) + assert '3.1416' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_sign(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(-3.14, 'g', 3, 1, ptype) + assert '-3.14' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_add_dot_0(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3, 'g', 5, 2, ptype) + assert '3.0' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_alt(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(314., 'g', 3, 4, ptype) + assert '314.' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_nan(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(float('nan'), 'g', 3, 4, ptype) + assert 'nan' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_NAN == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_infinity(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(1e200 * 1e200, 'g', 0, 0, ptype) + assert 'inf' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_INFINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_null(self, api): + ptype = lltype.nullptr(rffi.INTP.TO) + r = api.PyOS_double_to_string(3.14, 'g', 3, 0, ptype) + assert '3.14' == rffi.charp2str(r) + assert ptype == lltype.nullptr(rffi.INTP.TO) + rffi.free_charp(r) \ No newline at end of file From noreply at buildbot.pypy.org Fri Nov 13 06:52:12 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Fri, 13 Nov 2015 12:52:12 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added test for an overflow operations, added regalloc for guards (overflow, exception). they are not yet fully functional Message-ID: <20151113115212.8BBF21C0290@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80661:d49e13685df3 Date: 2015-11-13 12:52 +0100 http://bitbucket.org/pypy/pypy/changeset/d49e13685df3/ Log: added test for an overflow operations, added regalloc for guards (overflow, exception). they are not yet fully functional diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -5,10 +5,11 @@ EQ = loc.imm(0x8) LT = loc.imm(0x4) GT = loc.imm(0x2) -OF = loc.imm(0x1) +OF = loc.imm(0x1) # overflow LE = loc.imm(EQ.value | LT.value) GE = loc.imm(EQ.value | GT.value) NE = loc.imm(LT.value | GT.value) +NO = loc.imm(0xe) # NO overflow ANY = loc.imm(0xf) cond_none = loc.imm(0x0) diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py --- a/rpython/jit/backend/zarch/helper/assembler.py +++ b/rpython/jit/backend/zarch/helper/assembler.py @@ -76,7 +76,7 @@ getattr(self.mc, func)(l0, l0, l1) return f -def gen_emit_rr_or_rpool(rr_func, rp_func): +def gen_emit_rr_or_rpool(rr_func, rp_func, overflow=False): """ the parameters can either be both in registers or the first is in the register, second in literal pool. """ @@ -88,4 +88,34 @@ getattr(self.mc, rp_func)(l0, l1) else: getattr(self.mc, rr_func)(l0, l1) + if overflow: + self.guard_success_cc = c.OF return f + +def gen_emit_imm_pool_rr(imm_func, pool_func, rr_func, overflow=False): + def emit(self, op, arglocs, regalloc): + l0, l1 = arglocs + if l1.is_in_pool(): + getattr(self.mc, pool_func)(l0, l1) + elif l1.is_imm(): + getattr(self.mc, imm_func)(l0, l1) + else: + getattr(self.mc, rr_func)(l0, l1) + if overflow: + self.guard_success_cc = c.OF + return emit + +def gen_emit_pool_or_rr_evenodd(pool_func, rr_func): + def emit(self, op, arglocs, regalloc): + lr, lq, l1 = arglocs # lr == remainer, lq == quotient + # when entering the function lr contains the dividend + # after this operation either lr or lq is used further + assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" + # remainer is always a even register r0, r2, ... , r14 + assert lr.is_even() + assert lq.is_odd() + if l1.is_in_pool(): + self.mc.DSG(lr, l1) + else: + self.mc.DSGR(lr, l1) + return emit diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -1,5 +1,6 @@ from rpython.jit.backend.zarch.helper.assembler import (gen_emit_cmp_op, - gen_emit_rr_or_rpool, gen_emit_shift) + gen_emit_rr_or_rpool, gen_emit_shift, gen_emit_pool_or_rr_evenodd, + gen_emit_imm_pool_rr) from rpython.jit.backend.zarch.codebuilder import ZARCHGuardToken import rpython.jit.backend.zarch.conditions as c import rpython.jit.backend.zarch.registers as r @@ -9,70 +10,17 @@ class IntOpAssembler(object): _mixin_ = True - def emit_int_add(self, op, arglocs, regalloc): - l0, l1 = arglocs - if l1.is_imm(): - self.mc.AGFI(l0, l1) - elif l1.is_in_pool(): - self.mc.AG(l0, l1) - else: - self.mc.AGR(l0, l1) + emit_int_add = gen_emit_imm_pool_rr('AGFI','AG','AGR') + emit_int_add_ovf = gen_emit_imm_pool_rr('AGFI','AG','AGR', overflow=True) + emit_int_sub = gen_emit_rr_or_rpool('SGR', 'SG') + emit_int_sub_ovf = gen_emit_rr_or_rpool('SGR', 'SG', overflow=True) + emit_int_mul = gen_emit_imm_pool_rr('MSGFI', 'MSG', 'MSGR') - def emit_int_mul(self, op, arglocs, regalloc): - l0, l1 = arglocs - if l1.is_imm(): - self.mc.MSGFI(l0, l1) - elif l1.is_in_pool(): - self.mc.MSG(l0, l1) - else: - self.mc.MSGR(l0, l1) - - def emit_int_floordiv(self, op, arglocs, regalloc): - lr, lq, l1 = arglocs # lr == remainer, lq == quotient - # when entering the function lr contains the dividend - # after this operation either lr or lq is used further - assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" - # remainer is always a even register r0, r2, ... , r14 - assert lr.is_even() - assert lq.is_odd() - if l1.is_in_pool(): - self.mc.DSG(lr, l1) - else: - self.mc.DSGR(lr, l1) - - def emit_uint_floordiv(self, op, arglocs, regalloc): - lr, lq, l1 = arglocs # lr == remainer, lq == quotient - # when entering the function lr contains the dividend - # after this operation either lr or lq is used further - assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" - # remainer is always a even register r0, r2, ... , r14 - assert lr.is_even() - assert lq.is_odd() - self.mc.XGR(lr, lr) - if l1.is_in_pool(): - self.mc.DLG(lr, l1) - else: - self.mc.DLGR(lr, l1) - - def emit_int_mod(self, op, arglocs, regalloc): - lr, lq, l1 = arglocs # lr == remainer, lq == quotient - # when entering the function lr contains the dividend - # after this operation either lr or lq is used further - assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" - # remainer is always a even register r0, r2, ... , r14 - assert lr.is_even() - assert lq.is_odd() - if l1.is_in_pool(): - self.mc.DSG(lr, l1) - else: - self.mc.DSGR(lr, l1) - - def emit_int_sub(self, op, arglocs, regalloc): - l0, l1 = arglocs - if l1.is_in_pool(): - self.mc.SG(l0, l1) - else: - self.mc.SGR(l0, l1) + emit_int_floordiv = gen_emit_pool_or_rr_evenodd('DSG','DSGR') + emit_uint_floordiv = gen_emit_pool_or_rr_evenodd('DLG','DLGR') + # NOTE division sets one register with the modulo value, thus + # the regalloc ensures the right register survives. + emit_int_mod = gen_emit_pool_or_rr_evenodd('DSG','DSGR') def emit_int_invert(self, op, arglocs, regalloc): l0 = arglocs[0] @@ -93,7 +41,6 @@ self.mc.CGHI(l0, l.imm(0)) self.flush_cc(c.NE, l0) - emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") emit_int_or = gen_emit_rr_or_rpool("OGR", "OG") emit_int_xor = gen_emit_rr_or_rpool("XGR", "XG") @@ -174,11 +121,11 @@ self._emit_guard(op, arglocs) def emit_guard_overflow(self, op, arglocs, regalloc): - self.guard_success_cc = c.SO + self.guard_success_cc = c.NO self._emit_guard(op, arglocs) def emit_guard_no_overflow(self, op, arglocs, regalloc): - self.guard_success_cc = c.NS + self.guard_success_cc = c.OF self._emit_guard(op, arglocs) def emit_guard_value(self, op, arglocs, regalloc): diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -534,7 +534,9 @@ pass # XXX prepare_int_add = helper.prepare_int_add + prepare_int_add_ovf = helper.prepare_int_add prepare_int_sub = helper.prepare_int_sub + prepare_int_sub_ovf = helper.prepare_int_sub prepare_int_mul = helper.prepare_int_mul prepare_int_floordiv = helper.prepare_int_div prepare_uint_floordiv = helper.prepare_int_div @@ -561,6 +563,7 @@ prepare_int_invert = helper.prepare_unary_op prepare_int_force_ge_zero = helper.prepare_unary_op + prepare_float_add = helper.prepare_binary_op prepare_float_sub = helper.prepare_binary_op prepare_float_mul = helper.prepare_binary_op @@ -598,6 +601,15 @@ prepare_guard_false = _prepare_guard_cc prepare_guard_nonnull = _prepare_guard_cc prepare_guard_isnull = _prepare_guard_cc + prepare_guard_overflow = _prepare_guard_cc + + def prepare_guard_no_exception(self, op): + arglocs = self._prepare_guard(op) + return arglocs + + prepare_guard_no_overflow = prepare_guard_no_exception + prepare_guard_overflow = prepare_guard_no_exception + prepare_guard_not_forced = prepare_guard_no_exception def prepare_label(self, op): descr = op.getdescr() diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -66,3 +66,32 @@ res = self.cpu.get_int_value(deadframe, 0) assert res == result assert fail.identifier == 1 + + @py.test.mark.parametrize('value,opcode,result,guard', + [ (-2**63, 'i1 = int_add_ovf(i0, 1)', -2**63, 'guard_no_overflow'), + (-2**63+1,'i1 = int_add_ovf(i0, 1)', -2**63, 'guard_no_overflow'), + (-2**63+1,'i1 = int_add_ovf(i0, 1)', -2**63+1, 'guard_overflow'), + ]) + def test_int_arithmetic_overflow(self, value, opcode, result, guard): + code = """ + [i0] + {opcode} + {guard}() [i0] + finish(i1, descr=faildescr) + """.format(opcode=opcode,guard=guard) + loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, value) + fail = self.cpu.get_latest_descr(deadframe) + res = self.cpu.get_int_value(deadframe, 0) + assert res == result + #assert fail.identifier == 1 + + def test_double_evenodd_pair(self): + # TODO + pass + + def test_double_evenodd_pair_spill(self): + # TODO + pass From noreply at buildbot.pypy.org Fri Nov 13 07:11:53 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 13:11:53 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Finally found a way to arrange the generated code Message-ID: <20151113121153.C1AAA1C11C2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2380:b506706f5a75 Date: 2015-11-13 13:12 +0100 http://bitbucket.org/cffi/cffi/changeset/b506706f5a75/ Log: Finally found a way to arrange the generated code diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -160,6 +160,17 @@ const char *error_message; }; +struct _cffi_callpy_s { + const char *name; + const struct _cffi_type_context_s *ctx; + int type_index; + void *direct_fn; + void *reserved; +}; + +extern void _cffi_call_python(struct _cffi_callpy_s *, void *); + + #ifdef _CFFI_INTERNAL static int parse_c_type(struct _cffi_parse_info_s *info, const char *input); static int search_in_globals(const struct _cffi_type_context_s *ctx, diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -227,6 +227,7 @@ self._lsts = {} for step_name in self.ALL_STEPS: self._lsts[step_name] = [] + self._callpy = [] self._seen_struct_unions = set() self._generate("ctx") self._add_missing_struct_unions() @@ -360,6 +361,9 @@ prnt('};') prnt() # + if self._callpy: + self._generate_delayed_callpy() + # # the init function base_module_name = self.module_name.split('.')[-1] prnt('#ifdef PYPY_VERSION') @@ -1108,6 +1112,71 @@ GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index))) # ---------- + # CFFI_CALL_PYTHON + + def _generate_cpy_call_python_collecttype(self, tp, name): + self._do_collect_type(tp.as_raw_function()) + + def _generate_cpy_call_python_decl(self, tp, name): + pass # the function is delayed and only generated later + + def _generate_cpy_call_python_ctx(self, tp, name): + if self.target_is_python: + raise ffiplatform.VerificationError( + "cannot use CFFI_CALL_PYTHON in the ABI mode") + if tp.ellipsis: + raise NotImplementedError("CFFI_CALL_PYTHON with a vararg function") + self._callpy.append((tp, name)) + + def _generate_delayed_callpy(self): + # + # Write static headers for all the call-python functions + prnt = self._prnt + function_sigs = [] + for tp, name in self._callpy: + arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' a%d' % i, context) + arguments.append(arg) + # + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s(%s)' % (name, repr_arguments) + context = 'result of %s' % name + sig = tp.result.get_c_name(name_and_arguments, context) + function_sigs.append(sig) + prnt('static %s;' % sig) + prnt() + # + # Write the _cffi_callpy array, which is not constant: a few + # fields (notably "reserved") can be modified by _cffi_backend + prnt('static struct _cffi_callpy_s _cffi_callpys[%d] = {' % + (len(self._callpy),)) + for tp, name in self._callpy: + type_index = self._typesdict[tp.as_raw_function()] + prnt(' { "%s", &_cffi_type_context, %d, (void *)&%s },' % ( + name, type_index, name)) + prnt('};') + prnt() + # + # Write the implementation of the functions declared above + for (tp, name), sig in zip(self._callpy, function_sigs): + prnt('static %s' % sig) + prnt('{') + prnt(' uint64_t a[%d];' % max(len(tp.args), 1)) + prnt(' char *p = (char *)a;') + for i, type in enumerate(tp.args): + prnt(' *(%s)(p + %d) = a%d;' % (type.get_c_name('*'), i*8, i)) + prnt(' _cffi_call_python(_cffi_callpys + 0, a);') + if isinstance(tp.result, model.VoidType): + prnt(' (void)p;') + else: + prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) + prnt('}') + prnt() + + # ---------- # emitting the opcodes for individual types def _emit_bytecode_VoidType(self, tp, index): diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1484,3 +1484,14 @@ assert (pt.x, pt.y) == (99*500*999, -99*500*999) pt = ptr_call2(ffi.addressof(lib, 'cb2')) assert (pt.x, pt.y) == (99*500*999, -99*500*999) + +def test_call_python_1(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int, int); + CFFI_CALL_PYTHON void baz(int, int); + CFFI_CALL_PYTHON int bok(void); + CFFI_CALL_PYTHON void boz(void); + """) + lib = verify(ffi, 'test_call_python_1', "") + XXX From noreply at buildbot.pypy.org Fri Nov 13 07:17:38 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 13 Nov 2015 13:17:38 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: fix to allow showing loops again Message-ID: <20151113121738.46F901C11C2@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80662:6612707f9f93 Date: 2015-11-13 13:19 +0100 http://bitbucket.org/pypy/pypy/changeset/6612707f9f93/ Log: fix to allow showing loops again diff --git a/rpython/jit/metainterp/graphpage.py b/rpython/jit/metainterp/graphpage.py --- a/rpython/jit/metainterp/graphpage.py +++ b/rpython/jit/metainterp/graphpage.py @@ -171,11 +171,13 @@ op = operations[opindex] op_repr = op.repr(self.memo, graytext=True) if op.getopnum() == rop.DEBUG_MERGE_POINT: - jd_sd = self.metainterp_sd.jitdrivers_sd[op.getarg(0).getint()] - if jd_sd._get_printable_location_ptr: - s = jd_sd.warmstate.get_location_str(op.getarglist()[3:]) - s = s.replace(',', '.') # we use comma for argument splitting - op_repr = "debug_merge_point(%d, %d, '%s')" % (op.getarg(1).getint(), op.getarg(2).getint(), s) + if self.metainterp_sd is not None: + jd_sd = self.metainterp_sd.jitdrivers_sd[op.getarg(0).getint()] + if jd_sd._get_printable_location_ptr: + s = jd_sd.warmstate.get_location_str(op.getarglist()[3:]) + s = s.replace(',', '.') # we use comma for argument splitting + op_repr = "debug_merge_point(%d, %d, '%s')" % (op.getarg(1).getint(), + op.getarg(2).getint(), s) lines.append(op_repr) if is_interesting_guard(op): tgt = op.getdescr()._debug_suboperations[0] diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py --- a/rpython/jit/metainterp/history.py +++ b/rpython/jit/metainterp/history.py @@ -545,9 +545,6 @@ self.name, ', '.join([box.repr(memo) for box in self.inputargs])) - def get_display_text(self): # for graphpage.py - return self.name + '\n' + repr(self.inputargs) - def show(self, errmsg=None): "NOT_RPYTHON" from rpython.jit.metainterp.graphpage import display_procedures From noreply at buildbot.pypy.org Fri Nov 13 07:18:06 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 13:18:06 +0100 (CET) Subject: [pypy-commit] cffi static-callback: fix Message-ID: <20151113121806.681291C11C2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2381:05685f1b6781 Date: 2015-11-13 13:19 +0100 http://bitbucket.org/cffi/cffi/changeset/05685f1b6781/ Log: fix diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -168,7 +168,7 @@ void *reserved; }; -extern void _cffi_call_python(struct _cffi_callpy_s *, void *); +extern void _cffi_call_python(struct _cffi_callpy_s *, char *); #ifdef _CFFI_INTERNAL diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1161,17 +1161,16 @@ prnt() # # Write the implementation of the functions declared above - for (tp, name), sig in zip(self._callpy, function_sigs): - prnt('static %s' % sig) + for j in range(len(self._callpy)): + tp, name = self._callpy[j] + prnt('static %s' % function_sigs[j]) prnt('{') prnt(' uint64_t a[%d];' % max(len(tp.args), 1)) prnt(' char *p = (char *)a;') for i, type in enumerate(tp.args): prnt(' *(%s)(p + %d) = a%d;' % (type.get_c_name('*'), i*8, i)) - prnt(' _cffi_call_python(_cffi_callpys + 0, a);') - if isinstance(tp.result, model.VoidType): - prnt(' (void)p;') - else: + prnt(' _cffi_call_python(_cffi_callpys + %d, p);' % j) + if not isinstance(tp.result, model.VoidType): prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) prnt('}') prnt() From noreply at buildbot.pypy.org Fri Nov 13 07:29:52 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 13:29:52 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Pass and return structs Message-ID: <20151113122952.F18A11C1242@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2382:414c0306b311 Date: 2015-11-13 13:30 +0100 http://bitbucket.org/cffi/cffi/changeset/414c0306b311/ Log: Pass and return structs diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1163,12 +1163,21 @@ # Write the implementation of the functions declared above for j in range(len(self._callpy)): tp, name = self._callpy[j] + size_of_a = max(len(tp.args), 1) + if isinstance(tp.result, model.StructOrUnion): + size_of_a = 'sizeof(%s) > %d ? (sizeof(%s) + 7) / 8 : %d' % ( + tp.result.get_c_name(''), 8 * size_of_a, + tp.result.get_c_name(''), size_of_a) prnt('static %s' % function_sigs[j]) prnt('{') - prnt(' uint64_t a[%d];' % max(len(tp.args), 1)) + prnt(' uint64_t a[%s];' % size_of_a) prnt(' char *p = (char *)a;') for i, type in enumerate(tp.args): - prnt(' *(%s)(p + %d) = a%d;' % (type.get_c_name('*'), i*8, i)) + arg = 'a%d' % i + if isinstance(type, model.StructOrUnion): + arg = '&' + arg + type = model.PointerType(type) + prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) prnt(' _cffi_call_python(_cffi_callpys + %d, p);' % j) if not isinstance(tp.result, model.VoidType): prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1495,3 +1495,15 @@ """) lib = verify(ffi, 'test_call_python_1', "") XXX + +def test_call_python_2(): + ffi = FFI() + ffi.cdef(""" + struct foo_s { int a, b, c; }; + CFFI_CALL_PYTHON int bar(int, struct foo_s, int); + CFFI_CALL_PYTHON struct foo_s baz(int, int); + CFFI_CALL_PYTHON struct foo_s bok(void); + """) + lib = verify(ffi, 'test_call_python_2', + "struct foo_s { int a, b, c; };") + XXX From noreply at buildbot.pypy.org Fri Nov 13 07:36:22 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 13:36:22 +0100 (CET) Subject: [pypy-commit] cffi static-callback: 'long double' is the only primitive type that doesn't necessarily fit Message-ID: <20151113123622.DE4321C1242@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2383:b07d81267db0 Date: 2015-11-13 13:37 +0100 http://bitbucket.org/cffi/cffi/changeset/b07d81267db0/ Log: 'long double' is the only primitive type that doesn't necessarily fit inside uint64_t, for now diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1161,9 +1161,14 @@ prnt() # # Write the implementation of the functions declared above + def may_need_128_bits(tp): + return tp.name == 'long double' + # for j in range(len(self._callpy)): tp, name = self._callpy[j] size_of_a = max(len(tp.args), 1) + if may_need_128_bits(tp.result): + size_of_a = max(size_of_a, 2) if isinstance(tp.result, model.StructOrUnion): size_of_a = 'sizeof(%s) > %d ? (sizeof(%s) + 7) / 8 : %d' % ( tp.result.get_c_name(''), 8 * size_of_a, @@ -1174,7 +1179,8 @@ prnt(' char *p = (char *)a;') for i, type in enumerate(tp.args): arg = 'a%d' % i - if isinstance(type, model.StructOrUnion): + if (isinstance(type, model.StructOrUnion) or + may_need_128_bits(type)): arg = '&' + arg type = model.PointerType(type) prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1507,3 +1507,13 @@ lib = verify(ffi, 'test_call_python_2', "struct foo_s { int a, b, c; };") XXX + +def test_call_python_3(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int, long double, int); + CFFI_CALL_PYTHON long double baz(int, int); + CFFI_CALL_PYTHON long double bok(void); + """) + lib = verify(ffi, 'test_call_python_3', "") + XXX From noreply at buildbot.pypy.org Fri Nov 13 07:42:37 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 13:42:37 +0100 (CET) Subject: [pypy-commit] cffi static-callback: fix Message-ID: <20151113124237.2D9341C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2384:98e2f9e1ab1c Date: 2015-11-13 13:43 +0100 http://bitbucket.org/cffi/cffi/changeset/98e2f9e1ab1c/ Log: fix diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1162,7 +1162,8 @@ # # Write the implementation of the functions declared above def may_need_128_bits(tp): - return tp.name == 'long double' + return (isinstance(tp, model.PrimitiveType) and + tp.name == 'long double') # for j in range(len(self._callpy)): tp, name = self._callpy[j] From noreply at buildbot.pypy.org Fri Nov 13 08:12:00 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 14:12:00 +0100 (CET) Subject: [pypy-commit] pypy default: Temporarily back out 3a7694159dfb until a solution is implemented to Message-ID: <20151113131200.7183B1C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80663:303dbcff1c35 Date: 2015-11-13 14:12 +0100 http://bitbucket.org/pypy/pypy/changeset/303dbcff1c35/ Log: Temporarily back out 3a7694159dfb until a solution is implemented to avoid the many failures reported by buildbot. diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py --- a/rpython/rlib/rgc.py +++ b/rpython/rlib/rgc.py @@ -46,7 +46,7 @@ """ _pinned_objects.append(obj) return True - + class PinEntry(ExtRegistryEntry): _about_ = pin @@ -533,8 +533,12 @@ def _fetch_ffi(): global _ffi_cache if _ffi_cache is None: - import _cffi_backend - _ffi_cache = _cffi_backend.FFI() + try: + import _cffi_backend + _ffi_cache = _cffi_backend.FFI() + except (ImportError, AttributeError): + import py + py.test.skip("need CFFI >= 1.0") return _ffi_cache @jit.dont_look_inside @@ -812,7 +816,7 @@ pending.extend(get_rpy_referents(gcref)) all_typeids = {} - + def get_typeid(obj): raise Exception("does not work untranslated") From noreply at buildbot.pypy.org Fri Nov 13 08:53:54 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 14:53:54 +0100 (CET) Subject: [pypy-commit] pypy default: In this rewriting step, make a copy of the guard before mangling its Message-ID: <20151113135354.F2C091C1243@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80664:e392b3d88ecf Date: 2015-11-13 14:43 +0100 http://bitbucket.org/pypy/pypy/changeset/e392b3d88ecf/ Log: In this rewriting step, make a copy of the guard before mangling its failargs. Avoids confusing log outputs. diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -120,7 +120,9 @@ # this case means between CALLs or unknown-size mallocs. # operations = self.remove_bridge_exception(operations) + self._source_operations = operations for i in range(len(operations)): + self._current_position = i op = operations[i] assert op.get_forwarded() is None if op.getopnum() == rop.DEBUG_MERGE_POINT: @@ -211,7 +213,11 @@ self.emit_op(op1) lst = op.getfailargs()[:] lst[i] = op1 - op.setfailargs(lst) + operations = self._source_operations + assert operations[self._current_position + 1] is op + newop = op.copy_and_change(opnum) + newop.setfailargs(lst) + operations[self._current_position + 1] = newop # ---------- From noreply at buildbot.pypy.org Fri Nov 13 09:33:34 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 15:33:34 +0100 (CET) Subject: [pypy-commit] cffi static-callback: simplify Message-ID: <20151113143334.EFDA91C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2385:58b06aefb5a7 Date: 2015-11-13 13:49 +0100 http://bitbucket.org/cffi/cffi/changeset/58b06aefb5a7/ Log: simplify diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1167,17 +1167,17 @@ # for j in range(len(self._callpy)): tp, name = self._callpy[j] - size_of_a = max(len(tp.args), 1) + size_of_a = max(len(tp.args)*8, 8) if may_need_128_bits(tp.result): - size_of_a = max(size_of_a, 2) + size_of_a = max(size_of_a, 16) if isinstance(tp.result, model.StructOrUnion): - size_of_a = 'sizeof(%s) > %d ? (sizeof(%s) + 7) / 8 : %d' % ( - tp.result.get_c_name(''), 8 * size_of_a, + size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( + tp.result.get_c_name(''), size_of_a, tp.result.get_c_name(''), size_of_a) prnt('static %s' % function_sigs[j]) prnt('{') - prnt(' uint64_t a[%s];' % size_of_a) - prnt(' char *p = (char *)a;') + prnt(' char a[%s];' % size_of_a) + prnt(' char *p = a;') for i, type in enumerate(tp.args): arg = 'a%d' % i if (isinstance(type, model.StructOrUnion) or From noreply at buildbot.pypy.org Fri Nov 13 09:33:37 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 15:33:37 +0100 (CET) Subject: [pypy-commit] cffi static-callback: tweak tweak tweak until we can at least read the function pointer out of Message-ID: <20151113143337.1949E1C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2386:716fcb19c96a Date: 2015-11-13 15:34 +0100 http://bitbucket.org/cffi/cffi/changeset/716fcb19c96a/ Log: tweak tweak tweak until we can at least read the function pointer out of the 'lib' object diff --git a/c/lib_obj.c b/c/lib_obj.c --- a/c/lib_obj.c +++ b/c/lib_obj.c @@ -364,6 +364,16 @@ break; } + case _CFFI_OP_CALL_PYTHON: + /* for reading 'lib.bar' where bar is declared with CFFI_CALL_PYTHON */ + ct = realize_c_type(types_builder, types_builder->ctx.types, + _CFFI_GETARG(g->type_op)); + if (ct == NULL) + return NULL; + x = convert_to_object(g->address, ct); + Py_DECREF(ct); + break; + default: PyErr_Format(PyExc_NotImplementedError, "in lib_build_attr: op=%d", (int)_CFFI_GETOP(g->type_op)); diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h --- a/cffi/_cffi_include.h +++ b/cffi/_cffi_include.h @@ -146,7 +146,9 @@ ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23]) #define _cffi_convert_array_from_object \ ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) -#define _CFFI_NUM_EXPORTS 25 +#define _cffi_call_python \ + ((void(*)(struct _cffi_callpy_s *, char *))_cffi_exports[25]) +#define _CFFI_NUM_EXPORTS 26 typedef struct _ctypedescr CTypeDescrObject; @@ -201,8 +203,10 @@ the others follow */ } +/********** end CPython-specific section **********/ +#else +extern void _cffi_call_python(struct _cffi_callpy_s *, char *); #endif -/********** end CPython-specific section **********/ #define _cffi_array_len(array) (sizeof(array) / sizeof((array)[0])) diff --git a/cffi/cffi_opcode.py b/cffi/cffi_opcode.py --- a/cffi/cffi_opcode.py +++ b/cffi/cffi_opcode.py @@ -54,6 +54,7 @@ OP_DLOPEN_FUNC = 35 OP_DLOPEN_CONST = 37 OP_GLOBAL_VAR_F = 39 +OP_CALL_PYTHON = 41 PRIM_VOID = 0 PRIM_BOOL = 1 diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -27,6 +27,7 @@ #define _CFFI_OP_DLOPEN_FUNC 35 #define _CFFI_OP_DLOPEN_CONST 37 #define _CFFI_OP_GLOBAL_VAR_F 39 +#define _CFFI_OP_CALL_PYTHON 41 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -162,15 +163,11 @@ struct _cffi_callpy_s { const char *name; - const struct _cffi_type_context_s *ctx; int type_index; - void *direct_fn; - void *reserved; + int reserved1; + void *reserved2, *reserved3; }; -extern void _cffi_call_python(struct _cffi_callpy_s *, char *); - - #ifdef _CFFI_INTERNAL static int parse_c_type(struct _cffi_parse_info_s *info, const char *input); static int search_in_globals(const struct _cffi_type_context_s *ctx, diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -227,7 +227,6 @@ self._lsts = {} for step_name in self.ALL_STEPS: self._lsts[step_name] = [] - self._callpy = [] self._seen_struct_unions = set() self._generate("ctx") self._add_missing_struct_unions() @@ -361,9 +360,6 @@ prnt('};') prnt() # - if self._callpy: - self._generate_delayed_callpy() - # # the init function base_module_name = self.module_name.split('.')[-1] prnt('#ifdef PYPY_VERSION') @@ -1115,10 +1111,54 @@ # CFFI_CALL_PYTHON def _generate_cpy_call_python_collecttype(self, tp, name): - self._do_collect_type(tp.as_raw_function()) + assert isinstance(tp, model.FunctionPtrType) + self._do_collect_type(tp) def _generate_cpy_call_python_decl(self, tp, name): - pass # the function is delayed and only generated later + prnt = self._prnt + type_index = self._typesdict[tp.as_raw_function()] + prnt('static struct _cffi_callpy_s _cffi_callpy__%s = { "%s", %d };' % ( + name, name, type_index)) + prnt() + # + arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' a%d' % i, context) + arguments.append(arg) + # + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s(%s)' % (name, repr_arguments) + # + def may_need_128_bits(tp): + return (isinstance(tp, model.PrimitiveType) and + tp.name == 'long double') + # + size_of_a = max(len(tp.args)*8, 8) + if may_need_128_bits(tp.result): + size_of_a = max(size_of_a, 16) + if isinstance(tp.result, model.StructOrUnion): + size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( + tp.result.get_c_name(''), size_of_a, + tp.result.get_c_name(''), size_of_a) + context = 'result of %s' % name + prnt('static %s' % tp.result.get_c_name(name_and_arguments, context)) + prnt('{') + prnt(' char a[%s];' % size_of_a) + prnt(' char *p = a;') + for i, type in enumerate(tp.args): + arg = 'a%d' % i + if (isinstance(type, model.StructOrUnion) or + may_need_128_bits(type)): + arg = '&' + arg + type = model.PointerType(type) + prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) + prnt(' _cffi_call_python(&_cffi_callpy__%s, p);' % name) + if not isinstance(tp.result, model.VoidType): + prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) + prnt('}') + prnt() def _generate_cpy_call_python_ctx(self, tp, name): if self.target_is_python: @@ -1126,70 +1166,10 @@ "cannot use CFFI_CALL_PYTHON in the ABI mode") if tp.ellipsis: raise NotImplementedError("CFFI_CALL_PYTHON with a vararg function") - self._callpy.append((tp, name)) - - def _generate_delayed_callpy(self): - # - # Write static headers for all the call-python functions - prnt = self._prnt - function_sigs = [] - for tp, name in self._callpy: - arguments = [] - context = 'argument of %s' % name - for i, type in enumerate(tp.args): - arg = type.get_c_name(' a%d' % i, context) - arguments.append(arg) - # - repr_arguments = ', '.join(arguments) - repr_arguments = repr_arguments or 'void' - name_and_arguments = '%s(%s)' % (name, repr_arguments) - context = 'result of %s' % name - sig = tp.result.get_c_name(name_and_arguments, context) - function_sigs.append(sig) - prnt('static %s;' % sig) - prnt() - # - # Write the _cffi_callpy array, which is not constant: a few - # fields (notably "reserved") can be modified by _cffi_backend - prnt('static struct _cffi_callpy_s _cffi_callpys[%d] = {' % - (len(self._callpy),)) - for tp, name in self._callpy: - type_index = self._typesdict[tp.as_raw_function()] - prnt(' { "%s", &_cffi_type_context, %d, (void *)&%s },' % ( - name, type_index, name)) - prnt('};') - prnt() - # - # Write the implementation of the functions declared above - def may_need_128_bits(tp): - return (isinstance(tp, model.PrimitiveType) and - tp.name == 'long double') - # - for j in range(len(self._callpy)): - tp, name = self._callpy[j] - size_of_a = max(len(tp.args)*8, 8) - if may_need_128_bits(tp.result): - size_of_a = max(size_of_a, 16) - if isinstance(tp.result, model.StructOrUnion): - size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( - tp.result.get_c_name(''), size_of_a, - tp.result.get_c_name(''), size_of_a) - prnt('static %s' % function_sigs[j]) - prnt('{') - prnt(' char a[%s];' % size_of_a) - prnt(' char *p = a;') - for i, type in enumerate(tp.args): - arg = 'a%d' % i - if (isinstance(type, model.StructOrUnion) or - may_need_128_bits(type)): - arg = '&' + arg - type = model.PointerType(type) - prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) - prnt(' _cffi_call_python(_cffi_callpys + %d, p);' % j) - if not isinstance(tp.result, model.VoidType): - prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) - prnt('}') - prnt() + type_index = self._typesdict[tp] + type_op = CffiOp(OP_CALL_PYTHON, type_index) + self._lsts["global"].append( + GlobalExpr(name, name, type_op, '&_cffi_callpy__%s' % name)) # ---------- # emitting the opcodes for individual types diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1494,6 +1494,7 @@ CFFI_CALL_PYTHON void boz(void); """) lib = verify(ffi, 'test_call_python_1', "") + assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") XXX def test_call_python_2(): From noreply at buildbot.pypy.org Fri Nov 13 09:54:48 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 15:54:48 +0100 (CET) Subject: [pypy-commit] cffi static-callback: in-progress Message-ID: <20151113145448.CC2141C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2387:9f653200584c Date: 2015-11-13 15:55 +0100 http://bitbucket.org/cffi/cffi/changeset/9f653200584c/ Log: in-progress diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -6306,6 +6306,9 @@ } #endif +struct _cffi_callpy_s; /* forward declaration */ +static void _cffi_call_python(struct _cffi_callpy_s *callpy, char *args); + static void *cffi_exports[] = { NULL, _cffi_to_c_i8, @@ -6337,6 +6340,7 @@ _cffi_to_c__Bool, _prepare_pointer_call_argument, convert_array_from_object, + _cffi_call_python, }; static struct { const char *name; int value; } all_dlopen_flags[] = { diff --git a/c/call_python.c b/c/call_python.c new file mode 100644 --- /dev/null +++ b/c/call_python.c @@ -0,0 +1,6 @@ + + +static void _cffi_call_python(struct _cffi_callpy_s *callpy, char *args) +{ + abort(); +} diff --git a/c/cffi1_module.c b/c/cffi1_module.c --- a/c/cffi1_module.c +++ b/c/cffi1_module.c @@ -16,6 +16,7 @@ #include "lib_obj.c" #include "cdlopen.c" #include "commontypes.c" +#include "call_python.c" static int init_ffi_lib(PyObject *m) @@ -149,7 +150,7 @@ PyObject *m, *modules_dict; FFIObject *ffi; LibObject *lib; - Py_ssize_t version; + Py_ssize_t version, num_exports; char *module_name, *exports, *module_name_with_lib; void **raw; const struct _cffi_type_context_s *ctx; @@ -172,7 +173,10 @@ } /* initialize the exports array */ - memcpy(exports, (char *)cffi_exports, sizeof(cffi_exports)); + num_exports = 25; + if (ctx->flags & 1) /* set to mean "uses _cffi_call_python" */ + num_exports = 26; + memcpy(exports, (char *)cffi_exports, num_exports * sizeof(void *)); /* make the module object */ m = _my_Py_InitModule(module_name); diff --git a/c/lib_obj.c b/c/lib_obj.c --- a/c/lib_obj.c +++ b/c/lib_obj.c @@ -370,7 +370,7 @@ _CFFI_GETARG(g->type_op)); if (ct == NULL) return NULL; - x = convert_to_object(g->address, ct); + x = convert_to_object((char *)&g->size_or_direct_fn, ct); Py_DECREF(ct); break; diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -118,6 +118,7 @@ class Recompiler: + _num_callpy = 0 def __init__(self, ffi, module_name, target_is_python=False): self.ffi = ffi @@ -356,7 +357,10 @@ else: prnt(' NULL, /* no includes */') prnt(' %d, /* num_types */' % (len(self.cffi_types),)) - prnt(' 0, /* flags */') + flags = 0 + if self._num_callpy: + flags |= 1 # set to mean "uses _cffi_call_python" + prnt(' %d, /* flags */' % flags) prnt('};') prnt() # @@ -1159,6 +1163,7 @@ prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) prnt('}') prnt() + self._num_callpy += 1 def _generate_cpy_call_python_ctx(self, tp, name): if self.target_is_python: @@ -1169,7 +1174,7 @@ type_index = self._typesdict[tp] type_op = CffiOp(OP_CALL_PYTHON, type_index) self._lsts["global"].append( - GlobalExpr(name, name, type_op, '&_cffi_callpy__%s' % name)) + GlobalExpr(name, '&_cffi_callpy__%s' % name, type_op, name)) # ---------- # emitting the opcodes for individual types diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1495,6 +1495,7 @@ """) lib = verify(ffi, 'test_call_python_1', "") assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") + lib.bar(4, 5) XXX def test_call_python_2(): From noreply at buildbot.pypy.org Fri Nov 13 09:55:26 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 15:55:26 +0100 (CET) Subject: [pypy-commit] pypy default: translation fix Message-ID: <20151113145526.BE0231C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80665:1181ca147d11 Date: 2015-11-13 14:01 +0000 http://bitbucket.org/pypy/pypy/changeset/1181ca147d11/ Log: translation fix diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -5,6 +5,7 @@ from rpython.rlib import rdtoa from rpython.rlib import rfloat from rpython.rlib import rposix, jit +from rpython.rlib.rarithmetic import intmask from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem import rffi @@ -112,7 +113,9 @@ NULL if the conversion failed. The caller is responsible for freeing the returned string by calling PyMem_Free(). """ - buffer, rtype = rfloat.double_to_string(val, format_code, precision, flags) + buffer, rtype = rfloat.double_to_string(val, format_code, + intmask(precision), + intmask(flags)) if ptype != lltype.nullptr(rffi.INTP.TO): ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) bufp = rffi.str2charp(buffer) From noreply at buildbot.pypy.org Fri Nov 13 10:31:27 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 16:31:27 +0100 (CET) Subject: [pypy-commit] cffi static-callback: in-progress Message-ID: <20151113153127.5AAD71C11C2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2388:e8bfa0e0f9c6 Date: 2015-11-13 16:32 +0100 http://bitbucket.org/cffi/cffi/changeset/e8bfa0e0f9c6/ Log: in-progress diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -1,6 +1,51 @@ - static void _cffi_call_python(struct _cffi_callpy_s *callpy, char *args) { + /* Invoked by the helpers generated from CFFI_CALL_PYTHON in the cdef. + + 'callpy' is a static structure that describes which of the + CFFI_CALL_PYTHON is called. It has got fields 'name' and + 'type_index' describing the function, and more reserved fields + that are initially zero. These reserved fields are set up by + ffi.call_python(), which invokes init_call_python() below. + + 'args' is a pointer to an array of 8-byte entries. Each entry + contains an argument. If an argument is less than 8 bytes, only + the part at the beginning of the entry is initialized. If an + argument is 'long double' or a struct/union, then it is passed + by reference. + + 'args' is also used as the place to write the result to. In all + cases, 'args' is at least 8 bytes in size. + */ + save_errno(); + { +#ifdef WITH_THREAD + PyGILState_STATE state = PyGILState_Ensure(); +#endif + const struct _cffi_type_context_s *ctx; + ctx = (const struct _cffi_type_context_s *)callpy->reserved1; + + if (ctx == NULL) { + /* uninitialized! */ + PyObject *f = PySys_GetObject("stderr"); + if (f != NULL) { + PyFile_WriteString("CFFI_CALL_PYTHON: function ", f); + PyFile_WriteString(callpy->name, f); + PyFile_WriteString("() called, but no code was attached " + "to it yet with ffi.call_python('", f); + PyFile_WriteString(callpy->name, f); + PyFile_WriteString("'). Returning 0.\n", f); + } + memset(args, 0, callpy->size_of_result); + return; + } + abort(); + +#ifdef WITH_THREAD + PyGILState_Release(state); +#endif + } + restore_errno(); } diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -164,8 +164,8 @@ struct _cffi_callpy_s { const char *name; int type_index; - int reserved1; - void *reserved2, *reserved3; + int size_of_result; + void *reserved1, *reserved2; }; #ifdef _CFFI_INTERNAL diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1121,8 +1121,14 @@ def _generate_cpy_call_python_decl(self, tp, name): prnt = self._prnt type_index = self._typesdict[tp.as_raw_function()] - prnt('static struct _cffi_callpy_s _cffi_callpy__%s = { "%s", %d };' % ( - name, name, type_index)) + if isinstance(tp.result, model.VoidType): + size_of_result = '0' + else: + context = 'result of %s' % name + size_of_result = '(int)sizeof(%s)' % ( + tp.result.get_c_name('', context),) + prnt('static struct _cffi_callpy_s _cffi_callpy__%s =' % name) + prnt(' { "%s", %d, %s };' % (name, type_index, size_of_result)) prnt() # arguments = [] @@ -1146,8 +1152,7 @@ size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( tp.result.get_c_name(''), size_of_a, tp.result.get_c_name(''), size_of_a) - context = 'result of %s' % name - prnt('static %s' % tp.result.get_c_name(name_and_arguments, context)) + prnt('static %s' % tp.result.get_c_name(name_and_arguments)) prnt('{') prnt(' char a[%s];' % size_of_a) prnt(' char *p = a;') From noreply at buildbot.pypy.org Fri Nov 13 10:47:09 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 16:47:09 +0100 (CET) Subject: [pypy-commit] pypy default: fix e392b3d88ecf: we must really not write back the modified operation Message-ID: <20151113154709.798E21C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80666:c03930410323 Date: 2015-11-13 15:51 +0000 http://bitbucket.org/pypy/pypy/changeset/c03930410323/ Log: fix e392b3d88ecf: we must really not write back the modified operation in any list, but just use it when building the _newops. diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -120,13 +120,14 @@ # this case means between CALLs or unknown-size mallocs. # operations = self.remove_bridge_exception(operations) - self._source_operations = operations + self._changed_op = None for i in range(len(operations)): - self._current_position = i op = operations[i] assert op.get_forwarded() is None if op.getopnum() == rop.DEBUG_MERGE_POINT: continue + if op is self._changed_op: + op = self._changed_op_to # ---------- GETFIELD_GC ---------- if op.getopnum() in (rop.GETFIELD_GC_I, rop.GETFIELD_GC_F, rop.GETFIELD_GC_R): @@ -213,11 +214,10 @@ self.emit_op(op1) lst = op.getfailargs()[:] lst[i] = op1 - operations = self._source_operations - assert operations[self._current_position + 1] is op newop = op.copy_and_change(opnum) newop.setfailargs(lst) - operations[self._current_position + 1] = newop + self._changed_op = op + self._changed_op_to = newop # ---------- From noreply at buildbot.pypy.org Fri Nov 13 11:36:29 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Fri, 13 Nov 2015 17:36:29 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: a branch where to improve the performance of rstruct Message-ID: <20151113163629.DBD541C0FDF@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80667:d9628e7cafa0 Date: 2015-11-13 17:20 +0100 http://bitbucket.org/pypy/pypy/changeset/d9628e7cafa0/ Log: a branch where to improve the performance of rstruct From noreply at buildbot.pypy.org Fri Nov 13 11:36:32 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Fri, 13 Nov 2015 17:36:32 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: introduce rawstorage.str_storage_getitem{, _unaligned}, which works as rawstorage.raw_storage_* but operates on RPython strings instead of raw buffers: since strings are immutable, we provide only the functions for reading out of them, not writing Message-ID: <20151113163632.1039F1C0FDF@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80668:84c49eed1754 Date: 2015-05-15 22:38 +0200 http://bitbucket.org/pypy/pypy/changeset/84c49eed1754/ Log: introduce rawstorage.str_storage_getitem{,_unaligned}, which works as rawstorage.raw_storage_* but operates on RPython strings instead of raw buffers: since strings are immutable, we provide only the functions for reading out of them, not writing diff --git a/rpython/rlib/rawstorage.py b/rpython/rlib/rawstorage.py --- a/rpython/rlib/rawstorage.py +++ b/rpython/rlib/rawstorage.py @@ -1,10 +1,13 @@ -from rpython.rlib.objectmodel import we_are_translated +from rpython.rlib.objectmodel import we_are_translated, keepalive_until_here from rpython.rtyper.extregistry import ExtRegistryEntry from rpython.rtyper.lltypesystem import lltype, rffi, llmemory from rpython.annotator import model as annmodel from rpython.rtyper.llannotation import lltype_to_annotation +from rpython.rlib import rgc from rpython.rlib.rgc import lltype_is_gc from rpython.rlib.objectmodel import specialize +from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf +from rpython.rtyper.annlowlevel import llstr RAW_STORAGE = rffi.CCHARP.TO RAW_STORAGE_PTR = rffi.CCHARP @@ -40,6 +43,29 @@ def free_raw_storage(storage, track_allocation=True): lltype.free(storage, flavor='raw', track_allocation=track_allocation) + + at rgc.no_collect +def str_storage_getitem(TP, s, index): + lls = llstr(s) + # from here, no GC operations can happen + buf = _get_raw_str_buf(STR, lls, 0) + storage = rffi.cast(RAW_STORAGE_PTR, buf) + res = raw_storage_getitem(TP, storage, index) + # end of "no GC" section + keepalive_until_here(lls) + return res + + at rgc.no_collect +def str_storage_getitem_unaligned(TP, s, index): + lls = llstr(s) + # from here, no GC operations can happen + buf = _get_raw_str_buf(STR, lls, 0) + storage = rffi.cast(RAW_STORAGE_PTR, buf) + res = raw_storage_getitem_unaligned(TP, storage, index) + # end of "no GC" section + keepalive_until_here(lls) + return res + # ____________________________________________________________ # # Support for possibly-unaligned accesses diff --git a/rpython/rlib/test/test_rawstorage.py b/rpython/rlib/test/test_rawstorage.py --- a/rpython/rlib/test/test_rawstorage.py +++ b/rpython/rlib/test/test_rawstorage.py @@ -4,7 +4,8 @@ from rpython.rlib import rawstorage from rpython.rlib.rawstorage import alloc_raw_storage, free_raw_storage,\ raw_storage_setitem, raw_storage_getitem, AlignmentError,\ - raw_storage_setitem_unaligned, raw_storage_getitem_unaligned + raw_storage_setitem_unaligned, raw_storage_getitem_unaligned,\ + str_storage_getitem, str_storage_getitem_unaligned from rpython.rtyper.test.tool import BaseRtypingTest from rpython.translator.c.test.test_genc import compile @@ -32,6 +33,26 @@ assert res == 3.14 free_raw_storage(r) +def test_untranslated_str_storage(): + import struct + buf = struct.pack('@lld', 42, 43, 123.0) + size = struct.calcsize('@l') + res = str_storage_getitem(lltype.Signed, buf, 0) + assert res == 42 + res = str_storage_getitem(lltype.Signed, buf, size) + assert res == 43 + res = str_storage_getitem(lltype.Float, buf, size*2) + assert res == 123.0 + +def test_untranslated_str_storage_unaligned(monkeypatch): + import struct + monkeypatch.setattr(rawstorage, 'misaligned_is_fine', False) + buf = 'foo' + struct.pack('@ll', 42, 43) + size = struct.calcsize('@l') + res = str_storage_getitem_unaligned(lltype.Signed, buf, 3) + assert res == 42 + res = str_storage_getitem_unaligned(lltype.Signed, buf, size+3) + assert res == 43 class TestRawStorage(BaseRtypingTest): @@ -46,6 +67,21 @@ x = self.interpret(f, [1<<30]) assert x == 1 << 30 + def test_str_storage_int(self): + import struct + buf = struct.pack('@ll', 42, 43) + size = struct.calcsize('@l') + + def f(i): + res = str_storage_getitem(lltype.Signed, buf, i) + return res + + x = self.interpret(f, [0]) + assert x == 42 + x = self.interpret(f, [8]) + assert x == 43 + + def test_storage_float_unaligned(self, monkeypatch): def f(v): r = alloc_raw_storage(24) diff --git a/rpython/rtyper/lltypesystem/rstr.py b/rpython/rtyper/lltypesystem/rstr.py --- a/rpython/rtyper/lltypesystem/rstr.py +++ b/rpython/rtyper/lltypesystem/rstr.py @@ -60,6 +60,13 @@ @signature(types.any(), types.any(), types.int(), returns=types.any()) @specialize.arg(0) def _get_raw_buf(TP, src, ofs): + """ + WARNING: dragons ahead. + Return the address of the internal char* buffer of the low level + string. The return value is valid as long as no GC operation occur, so + you must ensure that it will be used inside a "GC safe" section, for + example by marking your function with @rgc.no_collect + """ assert typeOf(src).TO == TP assert ofs >= 0 return llmemory.cast_ptr_to_adr(src) + _str_ofs(TP, ofs) @@ -129,11 +136,17 @@ copy_raw_to_string = func_with_new_name(copy_raw_to_string, 'copy_raw_to_%s' % name) - return copy_string_to_raw, copy_raw_to_string, copy_string_contents + return _get_raw_buf, copy_string_to_raw, copy_raw_to_string, copy_string_contents -copy_string_to_raw, copy_raw_to_string, copy_string_contents = _new_copy_contents_fun(STR, STR, Char, 'string') -copy_unicode_to_raw, copy_raw_to_unicode, copy_unicode_contents = _new_copy_contents_fun(UNICODE, UNICODE, - UniChar, 'unicode') +(_get_raw_str_buf, + copy_string_to_raw, + copy_raw_to_string, + copy_string_contents) = _new_copy_contents_fun(STR, STR, Char, 'string') + +(_get_raw_unicode_buf, + copy_unicode_to_raw, + copy_raw_to_unicode, + copy_unicode_contents) = _new_copy_contents_fun(UNICODE, UNICODE, UniChar, 'unicode') CONST_STR_CACHE = WeakValueDictionary() CONST_UNICODE_CACHE = WeakValueDictionary() From noreply at buildbot.pypy.org Fri Nov 13 11:36:34 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Fri, 13 Nov 2015 17:36:34 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: use the fast raw_storage way to read doubles and floats when rstruct is using native formats Message-ID: <20151113163634.19A311C0FDF@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80669:b790b4f590e3 Date: 2015-11-13 17:18 +0100 http://bitbucket.org/pypy/pypy/changeset/b790b4f590e3/ Log: use the fast raw_storage way to read doubles and floats when rstruct is using native formats diff --git a/rpython/rlib/rawstorage.py b/rpython/rlib/rawstorage.py --- a/rpython/rlib/rawstorage.py +++ b/rpython/rlib/rawstorage.py @@ -45,6 +45,7 @@ @rgc.no_collect + at specialize.ll() def str_storage_getitem(TP, s, index): lls = llstr(s) # from here, no GC operations can happen @@ -56,6 +57,7 @@ return res @rgc.no_collect + at specialize.ll() def str_storage_getitem_unaligned(TP, s, index): lls = llstr(s) # from here, no GC operations can happen diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py --- a/rpython/rlib/rstruct/nativefmttable.py +++ b/rpython/rlib/rstruct/nativefmttable.py @@ -10,6 +10,7 @@ from rpython.rlib.rstruct import standardfmttable as std from rpython.rlib.rstruct.error import StructError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.rawstorage import str_storage_getitem from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.tool import rffi_platform from rpython.translator.tool.cbuild import ExternalCompilationInfo @@ -27,9 +28,6 @@ # ____________________________________________________________ -double_buf = lltype.malloc(rffi.DOUBLEP.TO, 1, flavor='raw', immortal=True) -float_buf = lltype.malloc(rffi.FLOATP.TO, 1, flavor='raw', immortal=True) - range_8_unroll = unrolling_iterable(list(reversed(range(8)))) range_4_unroll = unrolling_iterable(list(reversed(range(4)))) @@ -48,10 +46,7 @@ @specialize.argtype(0) def unpack_double(fmtiter): input = fmtiter.read(sizeof_double) - p = rffi.cast(rffi.CCHARP, double_buf) - for i in range(sizeof_double): - p[i] = input[i] - doubleval = double_buf[0] + doubleval = str_storage_getitem(rffi.DOUBLE, input, 0) fmtiter.appendobj(doubleval) def pack_float(fmtiter): @@ -71,11 +66,8 @@ @specialize.argtype(0) def unpack_float(fmtiter): input = fmtiter.read(sizeof_float) - p = rffi.cast(rffi.CCHARP, float_buf) - for i in range(sizeof_float): - p[i] = input[i] - floatval = float_buf[0] - doubleval = float(floatval) + floatval = str_storage_getitem(rffi.FLOAT, input, 0) + doubleval = float(floatval) # convert from r_singlefloat to rpython's float fmtiter.appendobj(doubleval) # ____________________________________________________________ diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py --- a/rpython/rlib/rstruct/test/test_runpack.py +++ b/rpython/rlib/rstruct/test/test_runpack.py @@ -37,3 +37,21 @@ return runpack(">d", "testtest") assert fn() == struct.unpack(">d", "testtest")[0] assert self.interpret(fn, []) == struct.unpack(">d", "testtest")[0] + + def test_native_floats(self): + """ + Check the 'd' and 'f' format characters on native packing. + """ + d_data = struct.pack("d", 12.34) + f_data = struct.pack("f", 12.34) + def fn(): + d = runpack("@d", d_data) + f = runpack("@f", f_data) + return d, f + # + res = self.interpret(fn, []) + d = res.item0 + f = res.item1 # convert from r_singlefloat + assert d == 12.34 # no precision lost + assert f != 12.34 # precision lost + assert abs(f - 12.34) < 1E-6 From noreply at buildbot.pypy.org Fri Nov 13 11:50:30 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 17:50:30 +0100 (CET) Subject: [pypy-commit] cffi static-callback: passing test Message-ID: <20151113165030.5BA811C0FDF@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2389:7d025a85a48b Date: 2015-11-13 16:35 +0100 http://bitbucket.org/cffi/cffi/changeset/7d025a85a48b/ Log: passing test diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -4,6 +4,7 @@ from cffi import recompiler from testing.udir import udir from testing.support import u +from StringIO import StringIO def check_type_table(input, expected_output, included=None): @@ -1495,8 +1496,16 @@ """) lib = verify(ffi, 'test_call_python_1', "") assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") - lib.bar(4, 5) - XXX + old_stderr = sys.stderr + try: + sys.stderr = f = StringIO() + res = lib.bar(4, 5) + finally: + sys.stderr = old_stderr + assert res == 0 + assert f.getvalue() == ( + "CFFI_CALL_PYTHON: function bar() called, but no code was attached " + "to it yet with ffi.call_python('bar'). Returning 0.\n") def test_call_python_2(): ffi = FFI() From noreply at buildbot.pypy.org Fri Nov 13 11:50:32 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 17:50:32 +0100 (CET) Subject: [pypy-commit] cffi static-callback: ffi.call_python() Message-ID: <20151113165032.4C4681C0FDF@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2390:f1a86aeb8daf Date: 2015-11-13 17:51 +0100 http://bitbucket.org/cffi/cffi/changeset/f1a86aeb8daf/ Log: ffi.call_python() diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -4903,7 +4903,8 @@ static int convert_from_object_fficallback(char *result, CTypeDescrObject *ctype, - PyObject *pyobj) + PyObject *pyobj, + int encode_result_for_libffi) { /* work work work around a libffi irregularity: for integer return types we have to fill at least a complete 'ffi_arg'-sized result @@ -4919,6 +4920,8 @@ return -1; } } + if (!encode_result_for_libffi) + goto skip; if (ctype->ct_flags & CT_PRIMITIVE_SIGNED) { PY_LONG_LONG value; /* It's probably fine to always zero-extend, but you never @@ -4949,6 +4952,7 @@ #endif } } + skip: return convert_from_object(result, ctype, pyobj); } @@ -4983,14 +4987,9 @@ Py_XDECREF(tb); } -static void invoke_callback(ffi_cif *cif, void *result, void **args, - void *userdata) -{ - save_errno(); - { -#ifdef WITH_THREAD - PyGILState_STATE state = PyGILState_Ensure(); -#endif +static void general_invoke_callback(int decode_args_from_libffi, + void *result, char *args, void *userdata) +{ PyObject *cb_args = (PyObject *)userdata; CTypeDescrObject *ct = (CTypeDescrObject *)PyTuple_GET_ITEM(cb_args, 0); PyObject *signature = ct->ct_stuff; @@ -5012,7 +5011,20 @@ goto error; for (i=0; ict_flags & (CT_IS_LONGDOUBLE | CT_STRUCT | CT_UNION)) { + abort(); + } + } + a = convert_to_object(a_src, a_ct); if (a == NULL) goto error; PyTuple_SET_ITEM(py_args, i, a); @@ -5021,7 +5033,8 @@ py_res = PyObject_Call(py_ob, py_args, NULL); if (py_res == NULL) goto error; - if (convert_from_object_fficallback(result, SIGNATURE(1), py_res) < 0) { + if (convert_from_object_fficallback(result, SIGNATURE(1), py_res, + decode_args_from_libffi) < 0) { extra_error_line = "Trying to convert the result back to C:\n"; goto error; } @@ -5029,10 +5042,6 @@ Py_XDECREF(py_args); Py_XDECREF(py_res); Py_DECREF(cb_args); -#ifdef WITH_THREAD - PyGILState_Release(state); -#endif - restore_errno(); return; error: @@ -5057,7 +5066,8 @@ NULL); if (res1 != NULL) { if (res1 != Py_None) - convert_from_object_fficallback(result, SIGNATURE(1), res1); + convert_from_object_fficallback(result, SIGNATURE(1), res1, + decode_args_from_libffi); Py_DECREF(res1); } if (!PyErr_Occurred()) { @@ -5078,25 +5088,38 @@ } } goto done; - } #undef SIGNATURE } -static PyObject *b_callback(PyObject *self, PyObject *args) -{ - CTypeDescrObject *ct, *ctresult; - CDataObject *cd; - PyObject *ob, *error_ob = Py_None, *onerror_ob = Py_None; - PyObject *py_rawerr, *infotuple = NULL; - cif_description_t *cif_descr; - ffi_closure *closure; +static void invoke_callback(ffi_cif *cif, void *result, void **args, + void *userdata) +{ + save_errno(); + { +#ifdef WITH_THREAD + PyGILState_STATE state = PyGILState_Ensure(); +#endif + + general_invoke_callback(1, result, (char *)args, userdata); + +#ifdef WITH_THREAD + PyGILState_Release(state); +#endif + } + restore_errno(); +} + +static PyObject *prepare_callback_info_tuple(CTypeDescrObject *ct, + PyObject *ob, + PyObject *error_ob, + PyObject *onerror_ob, + int decode_args_from_libffi) +{ + CTypeDescrObject *ctresult; + PyObject *py_rawerr, *infotuple; Py_ssize_t size; - if (!PyArg_ParseTuple(args, "O!O|OO:callback", &CTypeDescr_Type, &ct, &ob, - &error_ob, &onerror_ob)) - return NULL; - if (!(ct->ct_flags & CT_FUNCTIONPTR)) { PyErr_Format(PyExc_TypeError, "expected a function ctype, got '%s'", ct->ct_name); @@ -5125,13 +5148,31 @@ memset(PyBytes_AS_STRING(py_rawerr), 0, size); if (error_ob != Py_None) { if (convert_from_object_fficallback( - PyBytes_AS_STRING(py_rawerr), ctresult, error_ob) < 0) { + PyBytes_AS_STRING(py_rawerr), ctresult, error_ob, + decode_args_from_libffi) < 0) { Py_DECREF(py_rawerr); return NULL; } } infotuple = Py_BuildValue("OOOO", ct, ob, py_rawerr, onerror_ob); Py_DECREF(py_rawerr); + return infotuple; +} + +static PyObject *b_callback(PyObject *self, PyObject *args) +{ + CTypeDescrObject *ct; + CDataObject *cd; + PyObject *ob, *error_ob = Py_None, *onerror_ob = Py_None; + PyObject *infotuple; + cif_description_t *cif_descr; + ffi_closure *closure; + + if (!PyArg_ParseTuple(args, "O!O|OO:callback", &CTypeDescr_Type, &ct, &ob, + &error_ob, &onerror_ob)) + return NULL; + + infotuple = prepare_callback_info_tuple(ct, ob, error_ob, onerror_ob, 1); if (infotuple == NULL) return NULL; diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -1,3 +1,62 @@ + +static PyObject *_ffi_call_python_decorator(PyObject *outer_args, PyObject *fn) +{ +#if PY_MAJOR_VERSION >= 3 +# error review! +#endif + char *s; + PyObject *error, *onerror, *infotuple, *x; + int index; + const struct _cffi_global_s *g; + struct _cffi_callpy_s *callpy; + CTypeDescrObject *ct; + FFIObject *ffi; + builder_c_t *types_builder; + + if (!PyArg_ParseTuple(outer_args, "OzOO", &ffi, &s, &error, &onerror)) + return NULL; + + if (s == NULL) { + abort(); + } + + types_builder = &ffi->types_builder; + index = search_in_globals(&types_builder->ctx, s, strlen(s)); + if (index < 0) + goto not_found; + g = &types_builder->ctx.globals[index]; + if (_CFFI_GETOP(g->type_op) != _CFFI_OP_CALL_PYTHON) + goto not_found; + + ct = realize_c_type(types_builder, types_builder->ctx.types, + _CFFI_GETARG(g->type_op)); + if (ct == NULL) + return NULL; + + infotuple = prepare_callback_info_tuple(ct, fn, error, onerror, 0); + if (infotuple == NULL) { + Py_DECREF(ct); + return NULL; + } + + /* attach infotuple to reserved1, where it will stay forever + unless a new version is attached later */ + callpy = (struct _cffi_callpy_s *)g->address; + x = (PyObject *)callpy->reserved1; + callpy->reserved1 = (void *)infotuple; + Py_XDECREF(x); + + /* return a cdata of type function-pointer, equal to the one + obtained by reading 'lib.bar' (see lib_obj.c) */ + x = convert_to_object((char *)&g->size_or_direct_fn, ct); + Py_DECREF(ct); + return x; + + not_found: + abort(); + return NULL; +} + static void _cffi_call_python(struct _cffi_callpy_s *callpy, char *args) { @@ -23,11 +82,9 @@ #ifdef WITH_THREAD PyGILState_STATE state = PyGILState_Ensure(); #endif - const struct _cffi_type_context_s *ctx; - ctx = (const struct _cffi_type_context_s *)callpy->reserved1; - if (ctx == NULL) { - /* uninitialized! */ + if (callpy->reserved1 == NULL) { + /* not initialized! */ PyObject *f = PySys_GetObject("stderr"); if (f != NULL) { PyFile_WriteString("CFFI_CALL_PYTHON: function ", f); @@ -38,10 +95,10 @@ PyFile_WriteString("'). Returning 0.\n", f); } memset(args, 0, callpy->size_of_result); - return; } - - abort(); + else { + general_invoke_callback(0, args, args, callpy->reserved1); + } #ifdef WITH_THREAD PyGILState_Release(state); diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -732,6 +732,35 @@ #define ffi_gc b_gcp /* ffi_gc() => b_gcp() from _cffi_backend.c */ +PyDoc_STRVAR(ffi_call_python_doc, +"XXX document me"); + +/* forward; see call_python.c */ +static PyObject *_ffi_call_python_decorator(PyObject *, PyObject *); + +static PyObject *ffi_call_python(FFIObject *self, PyObject *args, + PyObject *kwds) +{ + static PyMethodDef md = {"call_python_decorator", + (PyCFunction)_ffi_call_python_decorator, METH_O}; + PyObject *name = Py_None, *error = Py_None; + PyObject *res, *onerror = Py_None; + static char *keywords[] = {"name", "python_callable", "error", + "onerror", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO", keywords, + &name, &error, &onerror)) + return NULL; + + args = Py_BuildValue("(OOOO)", (PyObject *)self, name, error, onerror); + if (args == NULL) + return NULL; + + res = PyCFunction_New(&md, args); + Py_DECREF(args); + return res; +} + PyDoc_STRVAR(ffi_callback_doc, "Return a callback object or a decorator making such a callback object.\n" "'cdecl' must name a C function pointer type. The callback invokes the\n" @@ -875,6 +904,7 @@ {"addressof", (PyCFunction)ffi_addressof, METH_VARARGS, ffi_addressof_doc}, {"alignof", (PyCFunction)ffi_alignof, METH_O, ffi_alignof_doc}, {"buffer", (PyCFunction)ffi_buffer, METH_VKW, ffi_buffer_doc}, + {"call_python",(PyCFunction)ffi_call_python,METH_VKW, ffi_call_python_doc}, {"callback", (PyCFunction)ffi_callback, METH_VKW, ffi_callback_doc}, {"cast", (PyCFunction)ffi_cast, METH_VARARGS, ffi_cast_doc}, {"dlclose", (PyCFunction)ffi_dlclose, METH_VARARGS, ffi_dlclose_doc}, diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -163,8 +163,7 @@ struct _cffi_callpy_s { const char *name; - int type_index; - int size_of_result; + size_t size_of_result; void *reserved1, *reserved2; }; diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1120,7 +1120,6 @@ def _generate_cpy_call_python_decl(self, tp, name): prnt = self._prnt - type_index = self._typesdict[tp.as_raw_function()] if isinstance(tp.result, model.VoidType): size_of_result = '0' else: @@ -1128,7 +1127,7 @@ size_of_result = '(int)sizeof(%s)' % ( tp.result.get_c_name('', context),) prnt('static struct _cffi_callpy_s _cffi_callpy__%s =' % name) - prnt(' { "%s", %d, %s };' % (name, type_index, size_of_result)) + prnt(' { "%s", %s };' % (name, size_of_result)) prnt() # arguments = [] diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1507,6 +1507,16 @@ "CFFI_CALL_PYTHON: function bar() called, but no code was attached " "to it yet with ffi.call_python('bar'). Returning 0.\n") + @ffi.call_python("bar") + def my_bar(x, y): + seen.append((x, y)) + return x * y + assert my_bar == lib.bar + seen = [] + res = lib.bar(6, 7) + assert seen == [(6, 7)] + assert res == 42 + def test_call_python_2(): ffi = FFI() ffi.cdef(""" From noreply at buildbot.pypy.org Fri Nov 13 12:05:22 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 18:05:22 +0100 (CET) Subject: [pypy-commit] cffi static-callback: More tests, make the name optional in ffi.call_python() Message-ID: <20151113170522.CA7981C0FDF@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2391:90daaaedaab6 Date: 2015-11-13 18:06 +0100 http://bitbucket.org/cffi/cffi/changeset/90daaaedaab6/ Log: More tests, make the name optional in ffi.call_python() diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -12,12 +12,20 @@ CTypeDescrObject *ct; FFIObject *ffi; builder_c_t *types_builder; + PyObject *name = NULL; if (!PyArg_ParseTuple(outer_args, "OzOO", &ffi, &s, &error, &onerror)) return NULL; if (s == NULL) { - abort(); + PyObject *name = PyObject_GetAttrString(fn, "__name__"); + if (name == NULL) + return NULL; + s = PyString_AsString(name); + if (s == NULL) { + Py_DECREF(name); + return NULL; + } } types_builder = &ffi->types_builder; @@ -27,6 +35,7 @@ g = &types_builder->ctx.globals[index]; if (_CFFI_GETOP(g->type_op) != _CFFI_OP_CALL_PYTHON) goto not_found; + Py_XDECREF(name); ct = realize_c_type(types_builder, types_builder->ctx.types, _CFFI_GETARG(g->type_op)); @@ -53,7 +62,9 @@ return x; not_found: - abort(); + PyErr_Format(FFIError, "ffi.call_python('%s'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef", s); + Py_XDECREF(name); return NULL; } diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1509,14 +1509,54 @@ @ffi.call_python("bar") def my_bar(x, y): - seen.append((x, y)) + seen.append(("Bar", x, y)) return x * y assert my_bar == lib.bar seen = [] res = lib.bar(6, 7) - assert seen == [(6, 7)] + assert seen == [("Bar", 6, 7)] assert res == 42 + @ffi.call_python() + def baz(x, y): + seen.append(("Baz", x, y)) + seen = [] + res = baz(50L, 8L) + assert res is None + assert seen == [("Baz", 50, 8)] + assert type(seen[0][1]) is type(seen[0][2]) is int + assert baz == lib.baz + +def test_call_python_bogus_name(): + ffi = FFI() + ffi.cdef("int abc;") + lib = verify(ffi, 'test_call_python_bogus_name', "int abc;") + def fn(): + pass + py.test.raises(ffi.error, ffi.call_python("unknown_name"), fn) + py.test.raises(ffi.error, ffi.call_python("abc"), fn) + assert lib.abc == 0 + e = py.test.raises(ffi.error, ffi.call_python("abc"), fn) + assert str(e.value) == ("ffi.call_python('abc'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef") + e = py.test.raises(ffi.error, ffi.call_python(), fn) + assert str(e.value) == ("ffi.call_python('fn'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef") + # + py.test.raises(TypeError, ffi.call_python(42), fn) + py.test.raises((TypeError, AttributeError), ffi.call_python(), "foo") + class X: + pass + x = X() + x.__name__ = x + py.test.raises(TypeError, ffi.call_python(), x) + +def test_call_python_void_must_return_none(): + xxxx + +def test_call_python_redefine(): + xxxx + def test_call_python_2(): ffi = FFI() ffi.cdef(""" From noreply at buildbot.pypy.org Fri Nov 13 12:22:21 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 18:22:21 +0100 (CET) Subject: [pypy-commit] cffi static-callback: more tests Message-ID: <20151113172221.94CC21C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2392:e1642fe0c4e6 Date: 2015-11-13 18:13 +0100 http://bitbucket.org/cffi/cffi/changeset/e1642fe0c4e6/ Log: more tests diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1486,6 +1486,14 @@ pt = ptr_call2(ffi.addressof(lib, 'cb2')) assert (pt.x, pt.y) == (99*500*999, -99*500*999) +class StdErrCapture(object): + def __enter__(self): + self.old_stderr = sys.stderr + sys.stderr = f = StringIO() + return f + def __exit__(self, *args): + sys.stderr = self.old_stderr + def test_call_python_1(): ffi = FFI() ffi.cdef(""" @@ -1496,12 +1504,8 @@ """) lib = verify(ffi, 'test_call_python_1', "") assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") - old_stderr = sys.stderr - try: - sys.stderr = f = StringIO() + with StdErrCapture() as f: res = lib.bar(4, 5) - finally: - sys.stderr = old_stderr assert res == 0 assert f.getvalue() == ( "CFFI_CALL_PYTHON: function bar() called, but no code was attached " @@ -1527,6 +1531,21 @@ assert type(seen[0][1]) is type(seen[0][2]) is int assert baz == lib.baz + @ffi.call_python() + def bok(): + seen.append("Bok") + return 42 + seen = [] + assert lib.bok() == bok() == 42 + assert seen == ["Bok", "Bok"] + + @ffi.call_python() + def boz(): + seen.append("Boz") + seen = [] + assert lib.boz() is boz() is None + assert seen == ["Boz", "Boz"] + def test_call_python_bogus_name(): ffi = FFI() ffi.cdef("int abc;") @@ -1551,8 +1570,20 @@ x.__name__ = x py.test.raises(TypeError, ffi.call_python(), x) -def test_call_python_void_must_return_none(): - xxxx +def test_call_python_bogus_result_type(): + ffi = FFI() + ffi.cdef("CFFI_CALL_PYTHON void bar(int);") + lib = verify(ffi, 'test_call_python_void_must_return_none', "") + def bar(n): + return n * 10 + bar1 = ffi.call_python()(bar) + with StdErrCapture() as f: + res = bar1(321) + assert res is None + assert f.getvalue() == ( + "From cffi callback %r:\n" % (bar,) + + "Trying to convert the result back to C:\n" + "TypeError: callback with the return type 'void' must return None\n") def test_call_python_redefine(): xxxx From noreply at buildbot.pypy.org Fri Nov 13 12:22:23 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 13 Nov 2015 18:22:23 +0100 (CET) Subject: [pypy-commit] cffi static-callback: tests tests tests Message-ID: <20151113172223.881161C0290@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2393:2c51b78800b2 Date: 2015-11-13 18:23 +0100 http://bitbucket.org/cffi/cffi/changeset/2c51b78800b2/ Log: tests tests tests diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -5020,9 +5020,8 @@ } else { a_src = args + i * 8; - if (a_ct->ct_flags & (CT_IS_LONGDOUBLE | CT_STRUCT | CT_UNION)) { - abort(); - } + if (a_ct->ct_flags & (CT_IS_LONGDOUBLE | CT_STRUCT | CT_UNION)) + a_src = *(char **)a_src; } a = convert_to_object(a_src, a_ct); if (a == NULL) diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1573,7 +1573,8 @@ def test_call_python_bogus_result_type(): ffi = FFI() ffi.cdef("CFFI_CALL_PYTHON void bar(int);") - lib = verify(ffi, 'test_call_python_void_must_return_none', "") + lib = verify(ffi, 'test_call_python_bogus_result_type', "") + # def bar(n): return n * 10 bar1 = ffi.call_python()(bar) @@ -1586,9 +1587,21 @@ "TypeError: callback with the return type 'void' must return None\n") def test_call_python_redefine(): - xxxx + ffi = FFI() + ffi.cdef("CFFI_CALL_PYTHON int bar(int);") + lib = verify(ffi, 'test_call_python_redefine', "") + # + @ffi.call_python() + def bar(n): + return n * 10 + assert lib.bar(42) == 420 + # + @ffi.call_python() + def bar(n): + return -n + assert lib.bar(42) == -42 -def test_call_python_2(): +def test_call_python_struct(): ffi = FFI() ffi.cdef(""" struct foo_s { int a, b, c; }; @@ -1596,16 +1609,56 @@ CFFI_CALL_PYTHON struct foo_s baz(int, int); CFFI_CALL_PYTHON struct foo_s bok(void); """) - lib = verify(ffi, 'test_call_python_2', + lib = verify(ffi, 'test_call_python_struct', "struct foo_s { int a, b, c; };") - XXX + # + @ffi.call_python() + def bar(x, s, z): + return x + s.a + s.b + s.c + z + res = lib.bar(1000, [1001, 1002, 1004], 1008) + assert res == 5015 + # + @ffi.call_python() + def baz(x, y): + return [x + y, x - y, x * y] + res = lib.baz(1000, 42) + assert res.a == 1042 + assert res.b == 958 + assert res.c == 42000 + # + @ffi.call_python() + def bok(): + return [10, 20, 30] + res = lib.bok() + assert [res.a, res.b, res.c] == [10, 20, 30] -def test_call_python_3(): +def test_call_python_long_double(): ffi = FFI() ffi.cdef(""" CFFI_CALL_PYTHON int bar(int, long double, int); CFFI_CALL_PYTHON long double baz(int, int); CFFI_CALL_PYTHON long double bok(void); """) - lib = verify(ffi, 'test_call_python_3', "") - XXX + lib = verify(ffi, 'test_call_python_long_double', "") + # + @ffi.call_python() + def bar(x, l, z): + seen.append((x, l, z)) + return 6 + seen = [] + lib.bar(10, 3.5, 20) + expected = ffi.cast("long double", 3.5) + assert repr(seen) == repr([(10, expected, 20)]) + # + @ffi.call_python() + def baz(x, z): + assert x == 10 and z == 20 + return expected + res = lib.baz(10, 20) + assert repr(res) == repr(expected) + # + @ffi.call_python() + def bok(): + return expected + res = lib.bok() + assert repr(res) == repr(expected) From noreply at buildbot.pypy.org Fri Nov 13 13:00:59 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Fri, 13 Nov 2015 19:00:59 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: use the fast raw_storage unpacking also for integer types, when possible Message-ID: <20151113180059.F325A1C1242@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80670:9972a7f270d5 Date: 2015-11-13 19:01 +0100 http://bitbucket.org/pypy/pypy/changeset/9972a7f270d5/ Log: use the fast raw_storage unpacking also for integer types, when possible diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py --- a/rpython/rlib/rstruct/nativefmttable.py +++ b/rpython/rlib/rstruct/nativefmttable.py @@ -8,6 +8,7 @@ from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_singlefloat, widen from rpython.rlib.rstruct import standardfmttable as std +from rpython.rlib.rstruct.standardfmttable import native_is_bigendian from rpython.rlib.rstruct.error import StructError from rpython.rlib.unroll import unrolling_iterable from rpython.rlib.rawstorage import str_storage_getitem @@ -16,8 +17,6 @@ from rpython.translator.tool.cbuild import ExternalCompilationInfo -native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) - native_fmttable = { 'x': std.standard_fmttable['x'], 'c': std.standard_fmttable['c'], diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py --- a/rpython/rlib/rstruct/standardfmttable.py +++ b/rpython/rlib/rstruct/standardfmttable.py @@ -12,7 +12,11 @@ from rpython.rlib.rstruct import ieee from rpython.rlib.rstruct.error import StructError, StructOverflowError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.rawstorage import str_storage_getitem +from rpython.rlib import rarithmetic +from rpython.rtyper.lltypesystem import rffi +native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) def pack_pad(fmtiter, count): fmtiter.result.append_multiple_char('\x00', count) @@ -162,6 +166,15 @@ # ____________________________________________________________ +def get_rffi_int_type(size, signed): + for TYPE in rffi.platform.numbertype_to_rclass: + if (rffi.sizeof(TYPE) == size and + rarithmetic.is_signed_integer_type(TYPE) == signed): + return TYPE + raise KeyError("Cannot find an int type size=%d, signed=%d" % (size, signed)) + +UNPACK_ALLOW_RAW_STORAGE = True + def make_int_unpacker(size, signed, _memo={}): try: return _memo[size, signed] @@ -180,13 +193,20 @@ else: inttype = r_ulonglong unroll_range_size = unrolling_iterable(range(size)) + TYPE = get_rffi_int_type(size, signed) @specialize.argtype(0) def unpack_int(fmtiter): intvalue = inttype(0) s = fmtiter.read(size) idx = 0 - if fmtiter.bigendian: + if UNPACK_ALLOW_RAW_STORAGE and fmtiter.bigendian == native_is_bigendian: + # fast path, using the native raw_storage + intvalue = str_storage_getitem(TYPE, s, 0) + if not signed and size < native_int_size: + intvalue = rarithmetic.intmask(intvalue) + intvalue = inttype(intvalue) + elif fmtiter.bigendian: for i in unroll_range_size: x = ord(s[idx]) if signed and i == 0 and x >= 128: diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py --- a/rpython/rlib/rstruct/test/test_runpack.py +++ b/rpython/rlib/rstruct/test/test_runpack.py @@ -1,5 +1,6 @@ from rpython.rtyper.test.tool import BaseRtypingTest from rpython.rlib.rstruct.runpack import runpack +from rpython.rlib.rstruct import standardfmttable from rpython.rlib.rarithmetic import LONG_BIT import struct @@ -55,3 +56,37 @@ assert d == 12.34 # no precision lost assert f != 12.34 # precision lost assert abs(f - 12.34) < 1E-6 + + def test_unpack_standard_little(self): + def unpack(fmt, data): + def fn(): + return runpack(fmt, data) + return self.interpret(fn, []) + # + assert unpack("i", 'ABCD') == 0x41424344 + assert unpack(">i", '\xff\xff\xff\xfd') == -3 + assert unpack(">i", '\x80\x00\x00\x00') == -2147483648 + assert unpack(">I", '\x81BCD') == 0x81424344 + assert unpack(">q", 'ABCDEFGH') == 0x4142434445464748 + assert unpack(">q", '\xbeMLKJIHH') == -0x41B2B3B4B5B6B7B8 + assert unpack(">Q", '\x81BCDEFGH') == 0x8142434445464748 + + def test_unpack_standard_no_raw_storage(self, monkeypatch): + monkeypatch.setattr(standardfmttable, 'UNPACK_ALLOW_RAW_STORAGE', False) + self.test_unpack_standard_little() + self.test_unpack_standard_big() + From noreply at buildbot.pypy.org Fri Nov 13 20:08:17 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Sat, 14 Nov 2015 02:08:17 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: hg merge default Message-ID: <20151114010817.B087E1C0FDF@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80671:ec2db01088b1 Date: 2015-11-14 02:08 +0100 http://bitbucket.org/pypy/pypy/changeset/ec2db01088b1/ Log: hg merge default diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -5,6 +5,7 @@ from rpython.rlib import rdtoa from rpython.rlib import rfloat from rpython.rlib import rposix, jit +from rpython.rlib.rarithmetic import intmask from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem import rffi @@ -112,7 +113,9 @@ NULL if the conversion failed. The caller is responsible for freeing the returned string by calling PyMem_Free(). """ - buffer, rtype = rfloat.double_to_string(val, format_code, precision, flags) + buffer, rtype = rfloat.double_to_string(val, format_code, + intmask(precision), + intmask(flags)) if ptype != lltype.nullptr(rffi.INTP.TO): ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) bufp = rffi.str2charp(buffer) diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -120,13 +120,14 @@ # this case means between CALLs or unknown-size mallocs. # operations = self.remove_bridge_exception(operations) - self._source_operations = operations + self._changed_op = None for i in range(len(operations)): - self._current_position = i op = operations[i] assert op.get_forwarded() is None if op.getopnum() == rop.DEBUG_MERGE_POINT: continue + if op is self._changed_op: + op = self._changed_op_to # ---------- GETFIELD_GC ---------- if op.getopnum() in (rop.GETFIELD_GC_I, rop.GETFIELD_GC_F, rop.GETFIELD_GC_R): @@ -213,11 +214,10 @@ self.emit_op(op1) lst = op.getfailargs()[:] lst[i] = op1 - operations = self._source_operations - assert operations[self._current_position + 1] is op newop = op.copy_and_change(opnum) newop.setfailargs(lst) - operations[self._current_position + 1] = newop + self._changed_op = op + self._changed_op_to = newop # ---------- From noreply at buildbot.pypy.org Fri Nov 13 21:11:41 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Sat, 14 Nov 2015 03:11:41 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Reinstate the parts of specialize_exceptions() that add code branches. Message-ID: <20151114021141.CE6471C0290@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80672:5cdd77f61327 Date: 2015-11-13 20:04 +0000 http://bitbucket.org/pypy/pypy/changeset/5cdd77f61327/ Log: Reinstate the parts of specialize_exceptions() that add code branches. diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py --- a/rpython/translator/simplify.py +++ b/rpython/translator/simplify.py @@ -311,6 +311,36 @@ stack.extend(link.target.exits) seen[link.target] = True +def propagate_uncaught_exceptions(graph): + """Add the equivalent of: + except OverflowError: + raise + except Exception: + raise + to any try: except: suite that misses them.""" + for block in list(graph.iterblocks()): + if block.canraise: + op = block.raising_op + exits = list(block.exits) + if OverflowError in op.canraise: + if not any(issubclass(OverflowError, exit.exitcase) + for exit in block.exits[1:]): + v_etype = const(OverflowError) + v_exc = Variable('last_exc_value') + exit = Link([v_etype, v_exc], graph.exceptblock, OverflowError) + exit.extravars(v_etype, v_exc) + exits.append(exit) + if Exception in op.canraise: + if block.exits[-1].exitcase is not Exception: + v_etype = Variable('last_exception') + v_exc = Variable('last_exc_value') + exit = Link([v_etype, v_exc], graph.exceptblock, Exception) + exit.extravars(v_etype, v_exc) + exits.append(exit) + block.recloseblock(*exits) + if len(exits) == 1: + block.exitswitch = None + def remove_assertion_errors(graph): """Remove branches that go directly to raising an AssertionError, @@ -1053,6 +1083,7 @@ transform_ovfcheck, simplify_exceptions, remove_assertion_errors, + propagate_uncaught_exceptions, remove_dead_exceptions, join_blocks, ] From noreply at buildbot.pypy.org Sat Nov 14 08:07:25 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Sat, 14 Nov 2015 14:07:25 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: fix Message-ID: <20151114130725.F35FF1C11B3@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80673:e7449f376b4e Date: 2015-11-14 13:08 +0000 http://bitbucket.org/pypy/pypy/changeset/e7449f376b4e/ Log: fix diff --git a/rpython/rtyper/lltypesystem/rbytearray.py b/rpython/rtyper/lltypesystem/rbytearray.py --- a/rpython/rtyper/lltypesystem/rbytearray.py +++ b/rpython/rtyper/lltypesystem/rbytearray.py @@ -8,10 +8,10 @@ def mallocbytearray(size): return lltype.malloc(BYTEARRAY, size) -_, _, copy_bytearray_contents = rstr._new_copy_contents_fun(BYTEARRAY, BYTEARRAY, +_, _, _, copy_bytearray_contents = rstr._new_copy_contents_fun(BYTEARRAY, BYTEARRAY, lltype.Char, 'bytearray') -_, _, copy_bytearray_contents_from_str = rstr._new_copy_contents_fun(rstr.STR, +_, _, _, copy_bytearray_contents_from_str = rstr._new_copy_contents_fun(rstr.STR, BYTEARRAY, lltype.Char, 'bytearray_from_str') From noreply at buildbot.pypy.org Sat Nov 14 09:08:29 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 15:08:29 +0100 (CET) Subject: [pypy-commit] pypy default: update to cffi/be44fd9b3554 Message-ID: <20151114140830.063A21C11B3@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80674:a0c84a4e59b6 Date: 2015-11-14 15:08 +0100 http://bitbucket.org/pypy/pypy/changeset/a0c84a4e59b6/ Log: update to cffi/be44fd9b3554 diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -514,12 +514,17 @@ if self.baseinttype is not None: return self.baseinttype.get_cached_btype(ffi, finishlist) # + from . import api if self.enumvalues: smallest_value = min(self.enumvalues) largest_value = max(self.enumvalues) else: - smallest_value = 0 - largest_value = 0 + import warnings + warnings.warn("%r has no values explicitly defined; next version " + "will refuse to guess which integer type it is " + "meant to be (unsigned/signed, int/long)" + % self._get_c_name()) + smallest_value = largest_value = 0 if smallest_value < 0: # needs a signed type sign = 1 candidate1 = PrimitiveType("int") diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1336,7 +1336,8 @@ # these depend on user-defined data, so should not be shared assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo") assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*") - assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") + # the following test is an opaque enum, which we no longer support + #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") # sanity check: twice 'ffi1' assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *") @@ -1348,6 +1349,17 @@ assert ffi.getctype("pe") == 'e *' assert ffi.getctype("e1*") == 'e1 *' + def test_opaque_enum(self): + ffi = FFI(backend=self.Backend()) + ffi.cdef("enum foo;") + from cffi import __version_info__ + if __version_info__ < (1, 4): + py.test.skip("re-enable me in version 1.4") + e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) + assert str(e.value) == ( + "'enum foo' has no values explicitly defined: refusing to guess " + "which integer type it is meant to be (unsigned/signed, int/long)") + def test_new_ctype(self): ffi = FFI(backend=self.Backend()) p = ffi.new("int *") From noreply at buildbot.pypy.org Sat Nov 14 12:34:26 2015 From: noreply at buildbot.pypy.org (mjacob) Date: Sat, 14 Nov 2015 18:34:26 +0100 (CET) Subject: [pypy-commit] pypy default: Fix test if specialized_zip_2_lists isn't importable. Message-ID: <20151114173426.4965D1C11B3@cobra.cs.uni-duesseldorf.de> Author: Manuel Jacob Branch: Changeset: r80675:e2a9b91eb60c Date: 2015-11-14 18:34 +0100 http://bitbucket.org/pypy/pypy/changeset/e2a9b91eb60c/ Log: Fix test if specialized_zip_2_lists isn't importable. diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py --- a/pypy/objspace/std/test/test_tupleobject.py +++ b/pypy/objspace/std/test/test_tupleobject.py @@ -413,8 +413,9 @@ from __pypy__ import specialized_zip_2_lists except ImportError: specialized_zip_2_lists = zip - raises(TypeError, specialized_zip_2_lists, [], ()) - raises(TypeError, specialized_zip_2_lists, (), []) + else: + raises(TypeError, specialized_zip_2_lists, [], ()) + raises(TypeError, specialized_zip_2_lists, (), []) assert specialized_zip_2_lists([], []) == [ ] assert specialized_zip_2_lists([2, 3], []) == [ From noreply at buildbot.pypy.org Sat Nov 14 12:43:24 2015 From: noreply at buildbot.pypy.org (mjacob) Date: Sat, 14 Nov 2015 18:43:24 +0100 (CET) Subject: [pypy-commit] pypy py3k: hg merge 57c9a47c70f6 (last revision of default branch which got into 4.0.0 release). Message-ID: <20151114174324.178751C11B3@cobra.cs.uni-duesseldorf.de> Author: Manuel Jacob Branch: py3k Changeset: r80676:23a35d67b4bd Date: 2015-11-14 18:43 +0100 http://bitbucket.org/pypy/pypy/changeset/23a35d67b4bd/ Log: hg merge 57c9a47c70f6 (last revision of default branch which got into 4.0.0 release). diff too long, truncating to 2000 out of 91959 lines diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ .hg .svn +# VIM +*.swp +*.swo + *.pyc *.pyo *~ +__pycache__/ bin/pypy-c include/*.h @@ -22,4 +27,6 @@ pypy/translator/goal/pypy-c pypy/translator/goal/target*-c release/ +!pypy/tool/release/ rpython/_cache/ +__pycache__/ diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -15,3 +15,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 +f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -168,7 +168,6 @@ Michael Twomey Lucian Branescu Mihaila Yichao Yu - Anton Gulenko Gabriel Lavoie Olivier Dormond Jared Grubb @@ -215,6 +214,7 @@ Carl Meyer Karl Ramm Pieter Zieschang + Anton Gulenko Gabriel Lukas Vacek Andrew Dalke @@ -247,6 +247,7 @@ Toni Mattis Lucas Stadler Julian Berman + Markus Holtermann roberto at goyle Yury V. Zaytsev Anna Katrina Dominguez @@ -429,7 +430,7 @@ _gdbm module, provided in the file lib_pypy/_gdbm.py, is redistributed under the terms of the GPL license as well. -License for 'pypy/module/_vmprof/src' +License for 'rpython/rlib/rvmprof/src' -------------------------------------- The code is based on gperftools. You may see a copy of the License for it at diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py --- a/dotviewer/graphclient.py +++ b/dotviewer/graphclient.py @@ -127,16 +127,8 @@ return spawn_graphserver_handler((host, port)) def spawn_local_handler(): - if hasattr(sys, 'pypy_objspaceclass'): - # if 'python' is actually PyPy, e.g. in a virtualenv, then - # try hard to find a real CPython - try: - python = subprocess.check_output( - 'env -i $SHELL -l -c "which python"', shell=True).strip() - except subprocess.CalledProcessError: - # did not work, fall back to 'python' - python = 'python' - else: + python = os.getenv('PYPY_PYGAME_PYTHON') + if not python: python = sys.executable args = [python, '-u', GRAPHSERVER, '--stdio'] p = subprocess.Popen(args, diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -310,6 +310,22 @@ """ return self._backend.from_buffer(self.BCharA, python_buffer) + def memmove(self, dest, src, n): + """ffi.memmove(dest, src, n) copies n bytes of memory from src to dest. + + Like the C function memmove(), the memory areas may overlap; + apart from that it behaves like the C function memcpy(). + + 'src' can be any cdata ptr or array, or any Python buffer object. + 'dest' can be any cdata ptr or array, or a writable Python buffer + object. The size to copy, 'n', is always measured in bytes. + + Unlike other methods, this one supports all Python buffer including + byte strings and bytearrays---but it still does not support + non-contiguous buffers. + """ + return self._backend.memmove(dest, src, n) + def callback(self, cdecl, python_callable=None, error=None, onerror=None): """Return a callback object or a decorator making such a callback object. 'cdecl' must name a C function pointer type. @@ -609,7 +625,7 @@ def make_accessor_locked(name): key = 'function ' + name if key in ffi._parser._declarations: - tp = ffi._parser._declarations[key] + tp, _ = ffi._parser._declarations[key] BType = ffi._get_cached_btype(tp) try: value = backendlib.load_function(BType, name) @@ -620,7 +636,7 @@ # key = 'variable ' + name if key in ffi._parser._declarations: - tp = ffi._parser._declarations[key] + tp, _ = ffi._parser._declarations[key] BType = ffi._get_cached_btype(tp) read_variable = backendlib.read_variable write_variable = backendlib.write_variable @@ -631,12 +647,23 @@ # if not copied_enums: from . import model - for key, tp in ffi._parser._declarations.items(): + error = None + for key, (tp, _) in ffi._parser._declarations.items(): if not isinstance(tp, model.EnumType): continue + try: + tp.check_not_partial() + except Exception as e: + error = e + continue for enumname, enumval in zip(tp.enumerators, tp.enumvalues): if enumname not in library.__dict__: library.__dict__[enumname] = enumval + if error is not None: + if name in library.__dict__: + return # ignore error, about a different enum + raise error + for key, val in ffi._parser._int_constants.items(): if key not in library.__dict__: library.__dict__[key] = val diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -26,6 +26,9 @@ _r_words = re.compile(r"\w+|\S") _parser_cache = None _r_int_literal = re.compile(r"-?0?x?[0-9a-f]+[lu]*$", re.IGNORECASE) +_r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") +_r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") +_r_cdecl = re.compile(r"\b__cdecl\b") def _get_parser(): global _parser_cache @@ -44,6 +47,14 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + # BIG HACK: replace WINAPI or __stdcall with "volatile const". + # It doesn't make sense for the return type of a function to be + # "volatile volatile const", so we abuse it to detect __stdcall... + # Hack number 2 is that "int(volatile *fptr)();" is not valid C + # syntax, so we place the "volatile" before the opening parenthesis. + csource = _r_stdcall2.sub(' volatile volatile const(', csource) + csource = _r_stdcall1.sub(' volatile volatile const ', csource) + csource = _r_cdecl.sub(' ', csource) # Replace "[...]" with "[__dotdotdotarray__]" csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) # Replace "...}" with "__dotdotdotNUM__}". This construction should @@ -75,9 +86,13 @@ # but should be fine for all the common types. look_for_words = set(COMMON_TYPES) look_for_words.add(';') + look_for_words.add(',') + look_for_words.add('(') + look_for_words.add(')') look_for_words.add('typedef') words_used = set() is_typedef = False + paren = 0 previous_word = '' for word in _r_words.findall(csource): if word in look_for_words: @@ -88,6 +103,15 @@ is_typedef = False elif word == 'typedef': is_typedef = True + paren = 0 + elif word == '(': + paren += 1 + elif word == ')': + paren -= 1 + elif word == ',': + if is_typedef and paren == 0: + words_used.discard(previous_word) + look_for_words.discard(previous_word) else: # word in COMMON_TYPES words_used.add(word) previous_word = word @@ -192,6 +216,7 @@ if not decl.name: raise api.CDefError("typedef does not declare any name", decl) + quals = 0 if (isinstance(decl.type.type, pycparser.c_ast.IdentifierType) and decl.type.type.names[-1] == '__dotdotdot__'): realtype = self._get_unknown_type(decl) @@ -202,8 +227,9 @@ decl.type.type.type.names == ['__dotdotdot__']): realtype = model.unknown_ptr_type(decl.name) else: - realtype = self._get_type(decl.type, name=decl.name) - self._declare('typedef ' + decl.name, realtype) + realtype, quals = self._get_type_and_quals( + decl.type, name=decl.name) + self._declare('typedef ' + decl.name, realtype, quals=quals) else: raise api.CDefError("unrecognized construct", decl) except api.FFIError as e: @@ -255,9 +281,9 @@ def _parse_decl(self, decl): node = decl.type if isinstance(node, pycparser.c_ast.FuncDecl): - tp = self._get_type(node, name=decl.name) + tp, quals = self._get_type_and_quals(node, name=decl.name) assert isinstance(tp, model.RawFunctionType) - tp = self._get_type_pointer(tp) + tp = self._get_type_pointer(tp, quals) self._declare('function ' + decl.name, tp) else: if isinstance(node, pycparser.c_ast.Struct): @@ -271,9 +297,10 @@ decl) # if decl.name: - tp = self._get_type(node, partial_length_ok=True) + tp, quals = self._get_type_and_quals(node, + partial_length_ok=True) if tp.is_raw_function: - tp = self._get_type_pointer(tp) + tp = self._get_type_pointer(tp, quals) self._declare('function ' + decl.name, tp) elif (tp.is_integer_type() and hasattr(decl, 'init') and @@ -287,10 +314,10 @@ _r_int_literal.match(decl.init.expr.value)): self._add_integer_constant(decl.name, '-' + decl.init.expr.value) - elif self._is_constant_globalvar(node): - self._declare('constant ' + decl.name, tp) + elif (quals & model.Q_CONST) and not tp.is_array_type: + self._declare('constant ' + decl.name, tp, quals=quals) else: - self._declare('variable ' + decl.name, tp) + self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] @@ -298,40 +325,51 @@ exprnode = ast.ext[-1].type.args.params[0] if isinstance(exprnode, pycparser.c_ast.ID): raise api.CDefError("unknown identifier '%s'" % (exprnode.name,)) - return self._get_type(exprnode.type) + tp, quals = self._get_type_and_quals(exprnode.type) + return tp - def _declare(self, name, obj, included=False): + def _declare(self, name, obj, included=False, quals=0): if name in self._declarations: - if self._declarations[name] is obj: + prevobj, prevquals = self._declarations[name] + if prevobj is obj and prevquals == quals: return if not self._override: raise api.FFIError( "multiple declarations of %s (for interactive usage, " "try cdef(xx, override=True))" % (name,)) assert '__dotdotdot__' not in name.split() - self._declarations[name] = obj + self._declarations[name] = (obj, quals) if included: self._included_declarations.add(obj) - def _get_type_pointer(self, type, const=False, declname=None): + def _extract_quals(self, type): + quals = 0 + if isinstance(type, (pycparser.c_ast.TypeDecl, + pycparser.c_ast.PtrDecl)): + if 'const' in type.quals: + quals |= model.Q_CONST + if 'restrict' in type.quals: + quals |= model.Q_RESTRICT + return quals + + def _get_type_pointer(self, type, quals, declname=None): if isinstance(type, model.RawFunctionType): return type.as_function_pointer() if (isinstance(type, model.StructOrUnionOrEnum) and type.name.startswith('$') and type.name[1:].isdigit() and type.forcename is None and declname is not None): - return model.NamedPointerType(type, declname) - if const: - return model.ConstPointerType(type) - return model.PointerType(type) + return model.NamedPointerType(type, declname, quals) + return model.PointerType(type, quals) - def _get_type(self, typenode, name=None, partial_length_ok=False): + def _get_type_and_quals(self, typenode, name=None, partial_length_ok=False): # first, dereference typedefs, if we have it already parsed, we're good if (isinstance(typenode, pycparser.c_ast.TypeDecl) and isinstance(typenode.type, pycparser.c_ast.IdentifierType) and len(typenode.type.names) == 1 and ('typedef ' + typenode.type.names[0]) in self._declarations): - type = self._declarations['typedef ' + typenode.type.names[0]] - return type + tp, quals = self._declarations['typedef ' + typenode.type.names[0]] + quals |= self._extract_quals(typenode) + return tp, quals # if isinstance(typenode, pycparser.c_ast.ArrayDecl): # array type @@ -340,18 +378,19 @@ else: length = self._parse_constant( typenode.dim, partial_length_ok=partial_length_ok) - tp = self._get_type(typenode.type, + tp, quals = self._get_type_and_quals(typenode.type, partial_length_ok=partial_length_ok) - return model.ArrayType(tp, length) + return model.ArrayType(tp, length), quals # if isinstance(typenode, pycparser.c_ast.PtrDecl): # pointer type - const = (isinstance(typenode.type, pycparser.c_ast.TypeDecl) - and 'const' in typenode.type.quals) - return self._get_type_pointer(self._get_type(typenode.type), const, - declname=name) + itemtype, itemquals = self._get_type_and_quals(typenode.type) + tp = self._get_type_pointer(itemtype, itemquals, declname=name) + quals = self._extract_quals(typenode) + return tp, quals # if isinstance(typenode, pycparser.c_ast.TypeDecl): + quals = self._extract_quals(typenode) type = typenode.type if isinstance(type, pycparser.c_ast.IdentifierType): # assume a primitive type. get it from .names, but reduce @@ -379,35 +418,38 @@ names = newnames + names ident = ' '.join(names) if ident == 'void': - return model.void_type + return model.void_type, quals if ident == '__dotdotdot__': raise api.FFIError(':%d: bad usage of "..."' % typenode.coord.line) - return resolve_common_type(ident) + return resolve_common_type(ident), quals # if isinstance(type, pycparser.c_ast.Struct): # 'struct foobar' - return self._get_struct_union_enum_type('struct', type, name) + tp = self._get_struct_union_enum_type('struct', type, name) + return tp, quals # if isinstance(type, pycparser.c_ast.Union): # 'union foobar' - return self._get_struct_union_enum_type('union', type, name) + tp = self._get_struct_union_enum_type('union', type, name) + return tp, quals # if isinstance(type, pycparser.c_ast.Enum): # 'enum foobar' - return self._get_struct_union_enum_type('enum', type, name) + tp = self._get_struct_union_enum_type('enum', type, name) + return tp, quals # if isinstance(typenode, pycparser.c_ast.FuncDecl): # a function type - return self._parse_function_type(typenode, name) + return self._parse_function_type(typenode, name), 0 # # nested anonymous structs or unions end up here if isinstance(typenode, pycparser.c_ast.Struct): return self._get_struct_union_enum_type('struct', typenode, name, - nested=True) + nested=True), 0 if isinstance(typenode, pycparser.c_ast.Union): return self._get_struct_union_enum_type('union', typenode, name, - nested=True) + nested=True), 0 # raise api.FFIError(":%d: bad or unsupported type declaration" % typenode.coord.line) @@ -426,28 +468,28 @@ raise api.CDefError( "%s: a function with only '(...)' as argument" " is not correct C" % (funcname or 'in expression')) - args = [self._as_func_arg(self._get_type(argdeclnode.type)) + args = [self._as_func_arg(*self._get_type_and_quals(argdeclnode.type)) for argdeclnode in params] if not ellipsis and args == [model.void_type]: args = [] - result = self._get_type(typenode.type) - return model.RawFunctionType(tuple(args), result, ellipsis) + result, quals = self._get_type_and_quals(typenode.type) + # the 'quals' on the result type are ignored. HACK: we absure them + # to detect __stdcall functions: we textually replace "__stdcall" + # with "volatile volatile const" above. + abi = None + if hasattr(typenode.type, 'quals'): # else, probable syntax error anyway + if typenode.type.quals[-3:] == ['volatile', 'volatile', 'const']: + abi = '__stdcall' + return model.RawFunctionType(tuple(args), result, ellipsis, abi) - def _as_func_arg(self, type): + def _as_func_arg(self, type, quals): if isinstance(type, model.ArrayType): - return model.PointerType(type.item) + return model.PointerType(type.item, quals) elif isinstance(type, model.RawFunctionType): return type.as_function_pointer() else: return type - def _is_constant_globalvar(self, typenode): - if isinstance(typenode, pycparser.c_ast.PtrDecl): - return 'const' in typenode.quals - if isinstance(typenode, pycparser.c_ast.TypeDecl): - return 'const' in typenode.quals - return False - def _get_struct_union_enum_type(self, kind, type, name=None, nested=False): # First, a level of caching on the exact 'type' node of the AST. # This is obscure, but needed because pycparser "unrolls" declarations @@ -486,7 +528,7 @@ else: explicit_name = name key = '%s %s' % (kind, name) - tp = self._declarations.get(key, None) + tp, _ = self._declarations.get(key, (None, None)) # if tp is None: if kind == 'struct': @@ -528,6 +570,7 @@ fldnames = [] fldtypes = [] fldbitsize = [] + fldquals = [] for decl in type.decls: if (isinstance(decl.type, pycparser.c_ast.IdentifierType) and ''.join(decl.type.names) == '__dotdotdot__'): @@ -541,7 +584,8 @@ else: bitsize = self._parse_constant(decl.bitsize) self._partial_length = False - type = self._get_type(decl.type, partial_length_ok=True) + type, fqual = self._get_type_and_quals(decl.type, + partial_length_ok=True) if self._partial_length: self._make_partial(tp, nested) if isinstance(type, model.StructType) and type.partial: @@ -549,9 +593,11 @@ fldnames.append(decl.name or '') fldtypes.append(type) fldbitsize.append(bitsize) + fldquals.append(fqual) tp.fldnames = tuple(fldnames) tp.fldtypes = tuple(fldtypes) tp.fldbitsize = tuple(fldbitsize) + tp.fldquals = tuple(fldquals) if fldbitsize != [-1] * len(fldbitsize): if isinstance(tp, model.StructType) and tp.partial: raise NotImplementedError("%s: using both bitfields and '...;'" @@ -632,14 +678,12 @@ return tp def include(self, other): - for name, tp in other._declarations.items(): + for name, (tp, quals) in other._declarations.items(): if name.startswith('anonymous $enum_$'): continue # fix for test_anonymous_enum_include kind = name.split(' ', 1)[0] - if kind in ('struct', 'union', 'enum', 'anonymous'): - self._declare(name, tp, included=True) - elif kind == 'typedef': - self._declare(name, tp, included=True) + if kind in ('struct', 'union', 'enum', 'anonymous', 'typedef'): + self._declare(name, tp, included=True, quals=quals) for k, v in other._int_constants.items(): self._add_constants(k, v) diff --git a/lib_pypy/cffi/ffiplatform.py b/lib_pypy/cffi/ffiplatform.py --- a/lib_pypy/cffi/ffiplatform.py +++ b/lib_pypy/cffi/ffiplatform.py @@ -14,17 +14,7 @@ LIST_OF_FILE_NAMES = ['sources', 'include_dirs', 'library_dirs', 'extra_objects', 'depends'] -def _hack_at_distutils(): - # Windows-only workaround for some configurations: see - # https://bugs.python.org/issue23246 (Python 2.7.9) - if sys.platform == "win32": - try: - import setuptools # for side-effects, patches distutils - except ImportError: - pass - def get_extension(srcfilename, modname, sources=(), **kwds): - _hack_at_distutils() # *before* the following import from distutils.core import Extension allsources = [srcfilename] allsources.extend(sources) @@ -47,7 +37,6 @@ def _build(tmpdir, ext): # XXX compact but horrible :-( - _hack_at_distutils() from distutils.core import Distribution import distutils.errors # diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -1,14 +1,29 @@ -import types +import types, sys import weakref from .lock import allocate_lock +# type qualifiers +Q_CONST = 0x01 +Q_RESTRICT = 0x02 + +def qualify(quals, replace_with): + if quals & Q_CONST: + replace_with = ' const ' + replace_with.lstrip() + if quals & Q_RESTRICT: + # It seems that __restrict is supported by gcc and msvc. + # If you hit some different compiler, add a #define in + # _cffi_include.h for it (and in its copies, documented there) + replace_with = ' __restrict ' + replace_with.lstrip() + return replace_with + + class BaseTypeByIdentity(object): is_array_type = False is_raw_function = False - def get_c_name(self, replace_with='', context='a C file'): + def get_c_name(self, replace_with='', context='a C file', quals=0): result = self.c_name_with_marker assert result.count('&') == 1 # some logic duplication with ffi.getctype()... :-( @@ -18,6 +33,7 @@ replace_with = '(%s)' % replace_with elif not replace_with[0] in '[(': replace_with = ' ' + replace_with + replace_with = qualify(quals, replace_with) result = result.replace('&', replace_with) if '$' in result: from .ffiplatform import VerificationError @@ -177,18 +193,21 @@ class BaseFunctionType(BaseType): - _attrs_ = ('args', 'result', 'ellipsis') + _attrs_ = ('args', 'result', 'ellipsis', 'abi') - def __init__(self, args, result, ellipsis): + def __init__(self, args, result, ellipsis, abi=None): self.args = args self.result = result self.ellipsis = ellipsis + self.abi = abi # reprargs = [arg._get_c_name() for arg in self.args] if self.ellipsis: reprargs.append('...') reprargs = reprargs or ['void'] replace_with = self._base_pattern % (', '.join(reprargs),) + if abi is not None: + replace_with = replace_with[:1] + abi + ' ' + replace_with[1:] self.c_name_with_marker = ( self.result.c_name_with_marker.replace('&', replace_with)) @@ -206,7 +225,7 @@ "type, not a pointer-to-function type" % (self,)) def as_function_pointer(self): - return FunctionPtrType(self.args, self.result, self.ellipsis) + return FunctionPtrType(self.args, self.result, self.ellipsis, self.abi) class FunctionPtrType(BaseFunctionType): @@ -217,24 +236,29 @@ args = [] for tp in self.args: args.append(tp.get_cached_btype(ffi, finishlist)) + abi_args = () + if self.abi == "__stdcall": + if not self.ellipsis: # __stdcall ignored for variadic funcs + try: + abi_args = (ffi._backend.FFI_STDCALL,) + except AttributeError: + pass return global_cache(self, ffi, 'new_function_type', - tuple(args), result, self.ellipsis) + tuple(args), result, self.ellipsis, *abi_args) def as_raw_function(self): - return RawFunctionType(self.args, self.result, self.ellipsis) + return RawFunctionType(self.args, self.result, self.ellipsis, self.abi) class PointerType(BaseType): - _attrs_ = ('totype',) - _base_pattern = " *&" - _base_pattern_array = "(*&)" + _attrs_ = ('totype', 'quals') - def __init__(self, totype): + def __init__(self, totype, quals=0): self.totype = totype + self.quals = quals + extra = qualify(quals, " *&") if totype.is_array_type: - extra = self._base_pattern_array - else: - extra = self._base_pattern + extra = "(%s)" % (extra.lstrip(),) self.c_name_with_marker = totype.c_name_with_marker.replace('&', extra) def build_backend_type(self, ffi, finishlist): @@ -243,10 +267,8 @@ voidp_type = PointerType(void_type) - -class ConstPointerType(PointerType): - _base_pattern = " const *&" - _base_pattern_array = "(const *&)" +def ConstPointerType(totype): + return PointerType(totype, Q_CONST) const_voidp_type = ConstPointerType(void_type) @@ -254,8 +276,8 @@ class NamedPointerType(PointerType): _attrs_ = ('totype', 'name') - def __init__(self, totype, name): - PointerType.__init__(self, totype) + def __init__(self, totype, name, quals=0): + PointerType.__init__(self, totype, quals) self.name = name self.c_name_with_marker = name + '&' @@ -315,11 +337,12 @@ partial = False packed = False - def __init__(self, name, fldnames, fldtypes, fldbitsize): + def __init__(self, name, fldnames, fldtypes, fldbitsize, fldquals=None): self.name = name self.fldnames = fldnames self.fldtypes = fldtypes self.fldbitsize = fldbitsize + self.fldquals = fldquals self.build_c_name_with_marker() def has_anonymous_struct_fields(self): @@ -331,14 +354,17 @@ return False def enumfields(self): - for name, type, bitsize in zip(self.fldnames, self.fldtypes, - self.fldbitsize): + fldquals = self.fldquals + if fldquals is None: + fldquals = (0,) * len(self.fldnames) + for name, type, bitsize, quals in zip(self.fldnames, self.fldtypes, + self.fldbitsize, fldquals): if name == '' and isinstance(type, StructOrUnion): # nested anonymous struct/union for result in type.enumfields(): yield result else: - yield (name, type, bitsize) + yield (name, type, bitsize, quals) def force_flatten(self): # force the struct or union to have a declaration that lists @@ -347,13 +373,16 @@ names = [] types = [] bitsizes = [] - for name, type, bitsize in self.enumfields(): + fldquals = [] + for name, type, bitsize, quals in self.enumfields(): names.append(name) types.append(type) bitsizes.append(bitsize) + fldquals.append(quals) self.fldnames = tuple(names) self.fldtypes = tuple(types) self.fldbitsize = tuple(bitsizes) + self.fldquals = tuple(fldquals) def get_cached_btype(self, ffi, finishlist, can_delay=False): BType = StructOrUnionOrEnum.get_cached_btype(self, ffi, finishlist, diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -5,7 +5,7 @@ #define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8)) #define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode) -#define _CFFI_GETARG(cffi_opcode) (((uintptr_t)cffi_opcode) >> 8) +#define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8) #define _CFFI_OP_PRIMITIVE 1 #define _CFFI_OP_POINTER 3 diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py --- a/lib_pypy/cffi/recompiler.py +++ b/lib_pypy/cffi/recompiler.py @@ -195,17 +195,15 @@ elif isinstance(tp, model.StructOrUnion): if tp.fldtypes is not None and ( tp not in self.ffi._parser._included_declarations): - for name1, tp1, _ in tp.enumfields(): + for name1, tp1, _, _ in tp.enumfields(): self._do_collect_type(self._field_type(tp, name1, tp1)) else: for _, x in tp._get_items(): self._do_collect_type(x) - def _get_declarations(self): - return sorted(self.ffi._parser._declarations.items()) - def _generate(self, step_name): - for name, tp in self._get_declarations(): + lst = self.ffi._parser._declarations.items() + for name, (tp, quals) in sorted(lst): kind, realname = name.split(' ', 1) try: method = getattr(self, '_generate_cpy_%s_%s' % (kind, @@ -214,6 +212,7 @@ raise ffiplatform.VerificationError( "not implemented in recompile(): %r" % name) try: + self._current_quals = quals method(tp, realname) except Exception as e: model.attach_exception_info(e, name) @@ -608,7 +607,11 @@ call_arguments.append('x%d' % i) repr_arguments = ', '.join(arguments) repr_arguments = repr_arguments or 'void' - name_and_arguments = '_cffi_d_%s(%s)' % (name, repr_arguments) + if tp.abi: + abi = tp.abi + ' ' + else: + abi = '' + name_and_arguments = '%s_cffi_d_%s(%s)' % (abi, name, repr_arguments) prnt('static %s' % (tp.result.get_c_name(name_and_arguments),)) prnt('{') call_arguments = ', '.join(call_arguments) @@ -711,7 +714,8 @@ if difference: repr_arguments = ', '.join(arguments) repr_arguments = repr_arguments or 'void' - name_and_arguments = '_cffi_f_%s(%s)' % (name, repr_arguments) + name_and_arguments = '%s_cffi_f_%s(%s)' % (abi, name, + repr_arguments) prnt('static %s' % (tp_result.get_c_name(name_and_arguments),)) prnt('{') if result_decl: @@ -774,7 +778,7 @@ prnt('{') prnt(' /* only to generate compile-time warnings or errors */') prnt(' (void)p;') - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): try: if ftype.is_integer_type() or fbitsize >= 0: # accept all integers, but complain on float or double @@ -789,7 +793,8 @@ ftype = ftype.item fname = fname + '[0]' prnt(' { %s = &p->%s; (void)tmp; }' % ( - ftype.get_c_name('*tmp', 'field %r'%fname), fname)) + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) except ffiplatform.VerificationError as e: prnt(' /* %s */' % str(e)) # cannot verify it, ignore prnt('}') @@ -823,7 +828,7 @@ c_fields = [] if reason_for_not_expanding is None: enumfields = list(tp.enumfields()) - for fldname, fldtype, fbitsize in enumfields: + for fldname, fldtype, fbitsize, fqual in enumfields: fldtype = self._field_type(tp, fldname, fldtype) # cname is None for _add_missing_struct_unions() only op = OP_NOOP @@ -879,7 +884,9 @@ # because they don't have any known C name. Check that they are # not partial (we can't complete or verify them!) and emit them # anonymously. - for tp in list(self._struct_unions): + lst = list(self._struct_unions.items()) + lst.sort(key=lambda tp_order: tp_order[1]) + for tp, order in lst: if tp not in self._seen_struct_unions: if tp.partial: raise NotImplementedError("internal inconsistency: %r is " @@ -1004,6 +1011,8 @@ def _enum_ctx(self, tp, cname): type_index = self._typesdict[tp] type_op = CffiOp(OP_ENUM, -1) + if self.target_is_python: + tp.check_not_partial() for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): self._lsts["global"].append( GlobalExpr(enumerator, '_cffi_const_%s' % enumerator, type_op, @@ -1081,7 +1090,8 @@ # if 'tp' were a function type, but that is not possible here. # (If 'tp' is a function _pointer_ type, then casts from "fn_t # **" to "void *" are again no-ops, as far as I can tell.) - prnt('static ' + tp.get_c_name('*_cffi_var_%s(void)' % (name,))) + decl = '*_cffi_var_%s(void)' % (name,) + prnt('static ' + tp.get_c_name(decl, quals=self._current_quals)) prnt('{') prnt(' return %s(%s);' % (ampersand, name)) prnt('}') @@ -1130,7 +1140,13 @@ else: self.cffi_types[index] = CffiOp(OP_NOOP, realindex) index += 1 - self.cffi_types[index] = CffiOp(OP_FUNCTION_END, int(tp.ellipsis)) + flags = int(tp.ellipsis) + if tp.abi is not None: + if tp.abi == '__stdcall': + flags |= 2 + else: + raise NotImplementedError("abi=%r" % (tp.abi,)) + self.cffi_types[index] = CffiOp(OP_FUNCTION_END, flags) def _emit_bytecode_PointerType(self, tp, index): self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[tp.totype]) diff --git a/lib_pypy/cffi/vengine_cpy.py b/lib_pypy/cffi/vengine_cpy.py --- a/lib_pypy/cffi/vengine_cpy.py +++ b/lib_pypy/cffi/vengine_cpy.py @@ -197,7 +197,10 @@ return library def _get_declarations(self): - return sorted(self.ffi._parser._declarations.items()) + lst = [(key, tp) for (key, (tp, qual)) in + self.ffi._parser._declarations.items()] + lst.sort() + return lst def _generate(self, step_name): for name, tp in self._get_declarations(): @@ -468,7 +471,7 @@ prnt('{') prnt(' /* only to generate compile-time warnings or errors */') prnt(' (void)p;') - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): if (isinstance(ftype, model.PrimitiveType) and ftype.is_integer_type()) or fbitsize >= 0: # accept all integers, but complain on float or double @@ -477,7 +480,8 @@ # only accept exactly the type declared. try: prnt(' { %s = &p->%s; (void)tmp; }' % ( - ftype.get_c_name('*tmp', 'field %r'%fname), fname)) + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) except ffiplatform.VerificationError as e: prnt(' /* %s */' % str(e)) # cannot verify it, ignore prnt('}') @@ -488,7 +492,7 @@ prnt(' static Py_ssize_t nums[] = {') prnt(' sizeof(%s),' % cname) prnt(' offsetof(struct _cffi_aligncheck, y),') - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): if fbitsize >= 0: continue # xxx ignore fbitsize for now prnt(' offsetof(%s, %s),' % (cname, fname)) @@ -552,7 +556,7 @@ check(layout[0], ffi.sizeof(BStruct), "wrong total size") check(layout[1], ffi.alignof(BStruct), "wrong total alignment") i = 2 - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): if fbitsize >= 0: continue # xxx ignore fbitsize for now check(layout[i], ffi.offsetof(BStruct, fname), diff --git a/lib_pypy/cffi/vengine_gen.py b/lib_pypy/cffi/vengine_gen.py --- a/lib_pypy/cffi/vengine_gen.py +++ b/lib_pypy/cffi/vengine_gen.py @@ -87,7 +87,10 @@ return library def _get_declarations(self): - return sorted(self.ffi._parser._declarations.items()) + lst = [(key, tp) for (key, (tp, qual)) in + self.ffi._parser._declarations.items()] + lst.sort() + return lst def _generate(self, step_name): for name, tp in self._get_declarations(): @@ -156,7 +159,11 @@ arglist = ', '.join(arglist) or 'void' wrappername = '_cffi_f_%s' % name self.export_symbols.append(wrappername) - funcdecl = ' %s(%s)' % (wrappername, arglist) + if tp.abi: + abi = tp.abi + ' ' + else: + abi = '' + funcdecl = ' %s%s(%s)' % (abi, wrappername, arglist) context = 'result of %s' % name prnt(tpresult.get_c_name(funcdecl, context)) prnt('{') @@ -260,7 +267,7 @@ prnt('{') prnt(' /* only to generate compile-time warnings or errors */') prnt(' (void)p;') - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): if (isinstance(ftype, model.PrimitiveType) and ftype.is_integer_type()) or fbitsize >= 0: # accept all integers, but complain on float or double @@ -269,7 +276,8 @@ # only accept exactly the type declared. try: prnt(' { %s = &p->%s; (void)tmp; }' % ( - ftype.get_c_name('*tmp', 'field %r'%fname), fname)) + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) except ffiplatform.VerificationError as e: prnt(' /* %s */' % str(e)) # cannot verify it, ignore prnt('}') @@ -280,7 +288,7 @@ prnt(' static intptr_t nums[] = {') prnt(' sizeof(%s),' % cname) prnt(' offsetof(struct _cffi_aligncheck, y),') - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): if fbitsize >= 0: continue # xxx ignore fbitsize for now prnt(' offsetof(%s, %s),' % (cname, fname)) @@ -342,7 +350,7 @@ check(layout[0], ffi.sizeof(BStruct), "wrong total size") check(layout[1], ffi.alignof(BStruct), "wrong total alignment") i = 2 - for fname, ftype, fbitsize in tp.enumfields(): + for fname, ftype, fbitsize, fqual in tp.enumfields(): if fbitsize >= 0: continue # xxx ignore fbitsize for now check(layout[i], ffi.offsetof(BStruct, fname), diff --git a/lib_pypy/cffi/verifier.py b/lib_pypy/cffi/verifier.py --- a/lib_pypy/cffi/verifier.py +++ b/lib_pypy/cffi/verifier.py @@ -22,6 +22,16 @@ s = s.encode('ascii') super(NativeIO, self).write(s) +def _hack_at_distutils(): + # Windows-only workaround for some configurations: see + # https://bugs.python.org/issue23246 (Python 2.7 with + # a specific MS compiler suite download) + if sys.platform == "win32": + try: + import setuptools # for side-effects, patches distutils + except ImportError: + pass + class Verifier(object): @@ -112,6 +122,7 @@ return basename def get_extension(self): + _hack_at_distutils() # backward compatibility hack if not self._has_source: with self.ffi._lock: if not self._has_source: diff --git a/lib_pypy/greenlet.egg-info b/lib_pypy/greenlet.egg-info --- a/lib_pypy/greenlet.egg-info +++ b/lib_pypy/greenlet.egg-info @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: greenlet -Version: 0.4.7 +Version: 0.4.9 Summary: Lightweight in-process concurrent programming Home-page: https://github.com/python-greenlet/greenlet Author: Ralf Schmitt (for CPython), PyPy team diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py --- a/lib_pypy/greenlet.py +++ b/lib_pypy/greenlet.py @@ -2,7 +2,7 @@ import __pypy__ import _continuation -__version__ = "0.4.7" +__version__ = "0.4.9" # ____________________________________________________________ # Exceptions diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -40,7 +40,9 @@ "_csv", "_pypyjson", "_posixsubprocess", # "cppyy", "micronumpy" ]) -if sys.platform.startswith('linux') and os.uname()[4] == 'x86_64': +if ((sys.platform.startswith('linux') or sys.platform == 'darwin') + and os.uname()[4] == 'x86_64' and sys.maxint > 2**32): + # it's not enough that we get x86_64 working_modules.add('_vmprof') translation_modules = default_modules.copy() @@ -76,6 +78,11 @@ if "cppyy" in working_modules: working_modules.remove("cppyy") # depends on ctypes +if sys.platform.startswith("linux"): + _mach = os.popen('uname -m', 'r').read().strip() + if _mach.startswith('ppc'): + working_modules.remove("_continuation") + module_dependencies = { '_multiprocessing': [('objspace.usemodules.time', True), @@ -93,6 +100,8 @@ if sys.platform == "win32": module_suggests["cpyext"].append(("translation.shared", True)) + +# NOTE: this dictionary is not used any more module_import_dependencies = { # no _rawffi if importing rpython.rlib.clibffi raises ImportError # or CompilationError or py.test.skip.Exception @@ -109,6 +118,7 @@ } def get_module_validator(modname): + # NOTE: this function is not used any more if modname in module_import_dependencies: modlist = module_import_dependencies[modname] def validator(config): diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py --- a/pypy/doc/conf.py +++ b/pypy/doc/conf.py @@ -67,7 +67,7 @@ # The short X.Y version. version = '2.6' # The full version, including alpha/beta/rc tags. -release = '2.6.0' +release = '2.6.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -32,6 +32,7 @@ Lukas Diekmann Sven Hager Anders Lehmann + Richard Plangger Aurelien Campeas Remi Meier Niklaus Haldimann @@ -57,7 +58,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -138,7 +138,6 @@ Michael Twomey Lucian Branescu Mihaila Yichao Yu - Anton Gulenko Gabriel Lavoie Olivier Dormond Jared Grubb @@ -185,6 +184,7 @@ Carl Meyer Karl Ramm Pieter Zieschang + Anton Gulenko Gabriel Lukas Vacek Andrew Dalke @@ -217,6 +217,7 @@ Toni Mattis Lucas Stadler Julian Berman + Markus Holtermann roberto at goyle Yury V. Zaytsev Anna Katrina Dominguez @@ -252,6 +253,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey diff --git a/pypy/doc/embedding.rst b/pypy/doc/embedding.rst --- a/pypy/doc/embedding.rst +++ b/pypy/doc/embedding.rst @@ -20,10 +20,6 @@ It initializes the RPython/PyPy GC and does a bunch of necessary startup code. This function cannot fail. -.. function:: void pypy_init_threads(void); - - Initialize threads. Only need to be called if there are any threads involved - .. function:: int pypy_setup_home(char* home, int verbose); This function searches the PyPy standard library starting from the given @@ -38,6 +34,11 @@ Function returns 0 on success or -1 on failure, can be called multiple times until the library is found. +.. function:: void pypy_init_threads(void); + + Initialize threads. Only need to be called if there are any threads involved. + *Must be called after pypy_setup_home()* + .. function:: int pypy_execute_source(char* source); Execute the Python source code given in the ``source`` argument. In case of diff --git a/pypy/doc/extending.rst b/pypy/doc/extending.rst --- a/pypy/doc/extending.rst +++ b/pypy/doc/extending.rst @@ -5,8 +5,8 @@ with any external library. Right now, there are the following possibilities of providing -third-party modules for the PyPy python interpreter (in order of -usefulness): +third-party modules for the PyPy python interpreter (in order, from most +directly useful to most messy to use with PyPy): * Write them in pure Python and use CFFI_. @@ -83,7 +83,7 @@ RPython Mixed Modules -===================== +--------------------- This is the internal way to write built-in extension modules in PyPy. It cannot be used by any 3rd-party module: the extension modules are diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst --- a/pypy/doc/faq.rst +++ b/pypy/doc/faq.rst @@ -67,7 +67,7 @@ The other commands of ``setup.py`` are available too, like ``build``. .. _PyPI: https://pypi.python.org/pypi -.. _`use virtualenv (as documented here)`: getting-started.html#installing-using-virtualenv +.. _`use virtualenv (as documented here)`: install.html#installing-using-virtualenv Module xyz does not work in the sandboxed PyPy? diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst --- a/pypy/doc/index-of-release-notes.rst +++ b/pypy/doc/index-of-release-notes.rst @@ -6,6 +6,8 @@ .. toctree:: + release-4.0.0.rst + release-2.6.1.rst release-2.6.0.rst release-2.5.1.rst release-2.5.0.rst diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst --- a/pypy/doc/index-of-whatsnew.rst +++ b/pypy/doc/index-of-whatsnew.rst @@ -7,6 +7,7 @@ .. toctree:: whatsnew-head.rst + whatsnew-4.0.0.rst whatsnew-2.6.1.rst whatsnew-2.6.0.rst whatsnew-2.5.1.rst diff --git a/pypy/doc/jit-hooks.rst b/pypy/doc/jit-hooks.rst --- a/pypy/doc/jit-hooks.rst +++ b/pypy/doc/jit-hooks.rst @@ -5,19 +5,8 @@ understanding what's pypy's JIT doing while running your program. There are three functions related to that coming from the ``pypyjit`` module: -.. function:: set_optimize_hook(callable) - Set a compiling hook that will be called each time a loop is optimized, - but before assembler compilation. This allows adding additional - optimizations on Python level. - - The callable will be called with the ``pypyjit.JitLoopInfo`` object. - Refer to it's documentation for details. - - Result value will be the resulting list of operations, or None - - -.. function:: set_compile_hook(callable) +.. function:: set_compile_hook(callable, operations=True) Set a compiling hook that will be called each time a loop is compiled. @@ -28,6 +17,9 @@ inside the jit hook is itself jitted, it will get compiled, but the jit hook won't be called for that. + if operations=False, no list of operations will be available. Useful + if the hook is supposed to be very lighweight. + .. function:: set_abort_hook(hook) Set a hook (callable) that will be called each time there is tracing @@ -66,3 +58,25 @@ * ``loop_run_times`` - counters for number of times loops are run, only works when ``enable_debug`` is called. + +.. class:: JitLoopInfo + + A class containing information about the compiled loop. Usable attributes: + + * ``operations`` - list of operations, if requested + + * ``jitdriver_name`` - the name of jitdriver associated with this loop + + * ``greenkey`` - a key at which the loop got compiled (e.g. code position, + is_being_profiled, pycode tuple for python jitdriver) + + * ``loop_no`` - loop cardinal number + + * ``bridge_no`` - id of the fail descr + + * ``type`` - "entry bridge", "loop" or "bridge" + + * ``asmaddr`` - an address in raw memory where assembler resides + + * ``asmlen`` - length of raw memory with assembler associated + diff --git a/pypy/doc/release-2.6.1.rst b/pypy/doc/release-2.6.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-2.6.1.rst @@ -0,0 +1,129 @@ +========== +PyPy 2.6.1 +========== + +We're pleased to announce PyPy 2.6.1, an update to PyPy 2.6.0 released June 1. +We have updated stdlib to 2.7.10, `cffi`_ to version 1.3, extended support for +the new vmprof_ statistical profiler for multiple threads, and increased +functionality of numpy. + +You can download the PyPy 2.6.1 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project, and our volunteers and contributors. + +.. _`cffi`: https://cffi.readthedocs.org + +We would also like to encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ with making +RPython's JIT even better. + +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), +as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy +.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ +.. _`dynamic languages`: http://pypyjs.org + +Highlights +=========== + +* Bug Fixes + + * Revive non-SSE2 support + + * Fixes for detaching _io.Buffer* + + * On Windows, close (and flush) all open sockets on exiting + + * Drop support for ancient macOS v10.4 and before + + * Clear up contention in the garbage collector between trace-me-later and pinning + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy. + +* New features: + + * cffi was updated to version 1.3 + + * The python stdlib was updated to 2.7.10 from 2.7.9 + + * vmprof now supports multiple threads and OS X + + * The translation process builds cffi import libraries for some stdlib + packages, which should prevent confusion when package.py is not used + + * better support for gdb debugging + + * freebsd should be able to translate PyPy "out of the box" with no patches + +* Numpy: + + * Better support for record dtypes, including the ``align`` keyword + + * Implement casting and create output arrays accordingly (still missing some corner cases) + + * Support creation of unicode ndarrays + + * Better support ndarray.flags + + * Support ``axis`` argument in more functions + + * Refactor array indexing to support ellipses + + * Allow the docstrings of built-in numpy objects to be set at run-time + + * Support the ``buffered`` nditer creation keyword + +* Performance improvements: + + * Delay recursive calls to make them non-recursive + + * Skip loop unrolling if it compiles too much code + + * Tweak the heapcache + + * Add a list strategy for lists that store both floats and 32-bit integers. + The latter are encoded as nonstandard NaNs. Benchmarks show that the speed + of such lists is now very close to the speed of purely-int or purely-float + lists. + + * Simplify implementation of ffi.gc() to avoid most weakrefs + + * Massively improve the performance of map() with more than + one sequence argument + +.. _`vmprof`: https://vmprof.readthedocs.org +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-2.6.1.html + +Please try it out and let us know what you think. We welcome +success stories, `experiments`_, or `benchmarks`_, we know you are using PyPy, please tell us about it! + +Cheers + +The PyPy Team + +.. _`experiments`: https://morepypy.blogspot.com/2015/02/experiments-in-pyrlang-with-rpython.html +.. _`benchmarks`: https://mithrandi.net/blog/2015/03/axiom-benchmark-results-on-pypy-2-5-0 diff --git a/pypy/doc/release-4.0.0.rst b/pypy/doc/release-4.0.0.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-4.0.0.rst @@ -0,0 +1,210 @@ +============ +PyPy 4.0.0 +============ + +We're pleased and proud to unleash PyPy 4.0.0, a major update of the PyPy +python 2.7.10 compatible interpreter with a Just In Time compiler. +We have improved `warmup time and memory overhead used for tracing`_, added +`vectorization`_ for numpy and general loops where possible on x86 hardware +(disabled by default), +refactored rough edges in rpython, and increased functionality of numpy. + +You can download the PyPy 4.0.0 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project. + +We would also like to thank our contributors (7 new ones since PyPy 2.6.0) and +encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ +with making RPython's JIT even better. + +New Version Numbering +===================== + +Since the past release, PyPy 2.6.1, we decided to update the PyPy 2.x.x +versioning directly to PyPy 4.x.x, to avoid confusion with CPython 2.7 +and 3.5. Note that this version of PyPy uses the stdlib and implements the +syntax of CPython 2.7.10. + +Vectorization +============= + +Richard Plangger began work in March and continued over a Google Summer of Code +to add a `vectorization` step to the trace optimizer. The step recognizes common +constructs and emits SIMD code where possible, much as any modern compiler does. +This vectorization happens while tracing running code, so it is actually easier +at run-time to determine the +availability of possible vectorization than it is for ahead-of-time compilers. + +Availability of SIMD hardware is detected at run time, without needing to +precompile various code paths into the executable. + +The first version of the vectorization has been merged in this release, since +it is so new it is off by default. To enable the vectorization in built-in JIT +drivers (like numpy ufuncs), add `--jit vec=1`, to enable all implemented +vectorization add `--jit vec_all=1` + +Benchmarks and a summary of this work appear `here`_ + +Internal Refactoring and Warmup Time Improvement +================================================ + +Maciej Fijalkowski and Armin Rigo refactored internals of rpython that now allow +PyPy to more efficiently use `guards`_ in jitted code. They also rewrote unrolling, +leading to a warmup time improvement of 20% or so. + +Numpy +===== + +Our implementation of `numpy`_ continues to improve. ndarray and the numeric dtypes +are very close to feature-complete; record, string and unicode dtypes are mostly +supported. We have reimplemented numpy linalg, random and fft as cffi-1.0 +modules that call out to the same underlying libraries that upstream numpy uses. +Please try it out, especially using the new vectorization (via `--jit vec=1` on the +command line) and let us know what is missing for your code. + +CFFI +==== + +While not applicable only to PyPy, `cffi`_ is arguably our most significant +contribution to the python ecosystem. Armin Rigo continued improving it, +and PyPy reaps the benefits of `cffi-1.3`_: improved manangement of object +lifetimes, __stdcall on Win32, ffi.memmove(), and percolate ``const``, +``restrict`` keywords from cdef to C code. + +.. _`warmup time and memory overhead used for tracing`: http://morepypy.blogspot.com/2015/10/pypy-memory-and-warmup-improvements-2.html +.. _`vectorization`: http://pypyvecopt.blogspot.co.at/ +.. _`guards`: http://rpython.readthedocs.org/en/latest/glossary.html +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`cffi`: https://cffi.readthedocs.org +.. _`cffi-1.3`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-0 +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html +.. _`numpy`: https://bitbucket.org/pypy/numpy + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), +as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. + +We also introduce `support for the 64 bit PowerPC`_ hardware, specifically +Linux running the big- and little-endian variants of ppc64. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy +.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ +.. _`dynamic languages`: http://pypyjs.org +.. _`support for the 64 bit PowerPC`: http://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html +.. _`here`: http://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html + +Other Highlights (since 2.6.1 release two months ago) +===================================================== + +* Bug Fixes + + * Applied OPENBSD downstream fixes + + * Fix a crash on non-linux when running more than 20 threads + + * In cffi, ffi.new_handle() is more cpython compliant + + * Accept unicode in functions inside the _curses cffi backend exactly like cpython + + * Fix a segfault in itertools.islice() + + * Use gcrootfinder=shadowstack by default, asmgcc on linux only + + * Fix ndarray.copy() for upstream compatability when copying non-contiguous arrays + + * Fix assumption that lltype.UniChar is unsigned + + * Fix a subtle bug with stacklets on shadowstack + + * Improve support for the cpython capi in cpyext (our capi compatibility + layer). Fixing these issues inspired some thought about cpyext in general, + stay tuned for more improvements + + * When loading dynamic libraries, in case of a certain loading error, retry + loading the library assuming it is actually a linker script, like on Arch + and Gentoo + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy + +* New features: + + * Add an optimization pass to vectorize loops using x86 SIMD intrinsics. + + * Support __stdcall on Windows in CFFI + + * Improve debug logging when using PYPYLOG=??? + + * Deal with platforms with no RAND_egd() in OpenSSL + +* Numpy: + + * Add support for ndarray.ctypes + + * Fast path for mixing numpy scalars and floats + + * Add support for creating Fortran-ordered ndarrays + + * Fix casting failures in linalg (by extending ufunc casting) + + * Recognize and disallow (for now) pickling of ndarrays with objects + embedded in them + +* Performance improvements and refactorings: + + * Reuse hashed keys across dictionaries and sets + + * Refactor JIT interals to improve warmup time by 20% or so at the cost of a + minor regression in JIT speed + + * Recognize patterns of common sequences in the JIT backends and optimize them + + * Make the garbage collecter more incremental over external_malloc() calls + + * Share guard resume data where possible which reduces memory usage + + * Fast path for zip(list, list) + + * Reduce the number of checks in the JIT for lst[a:] + + * Move the non-optimizable part of callbacks outside the JIT + + * Factor in field immutability when invalidating heap information + + * Unroll itertools.izip_longest() with two sequences + + * Minor optimizations after analyzing output from `vmprof`_ and trace logs + + * Remove many class attributes in rpython classes + + * Handle getfield_gc_pure* and getfield_gc_* uniformly in heap.py + +.. _`vmprof`: https://vmprof.readthedocs.org +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-15.11.0.html + +Please try it out and let us know what you think. We welcome feedback, +we know you are using PyPy, please tell us about it! + +Cheers + +The PyPy Team + diff --git a/pypy/doc/test/test_whatsnew.py b/pypy/doc/test/test_whatsnew.py --- a/pypy/doc/test/test_whatsnew.py +++ b/pypy/doc/test/test_whatsnew.py @@ -102,3 +102,13 @@ assert not not_documented if branch == 'py3k': assert not not_merged + +def test_startrev_on_default(): + doc = ROOT.join('pypy', 'doc') + last_whatsnew = doc.join('whatsnew-head.rst').read() + startrev, documented = parse_doc(last_whatsnew) + errcode, wc_branch = getstatusoutput( + "hg log -r %s --template '{branch}'" % startrev) + if errcode != 0: + py.test.skip('no Mercurial repo') + assert wc_branch == 'default' diff --git a/pypy/doc/whatsnew-4.0.0.rst b/pypy/doc/whatsnew-4.0.0.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-4.0.0.rst @@ -0,0 +1,94 @@ +======================== +What's new in PyPy 4.0.0 +======================== + +.. this is a revision shortly after release-2.6.1 +.. startrev: 3a8f5481dab4 + +.. branch: keys_with_hash +Improve the performance of dict.update() and a bunch of methods from +sets, by reusing the hash value stored in one dict when inspecting +or changing another dict with that key. + +.. branch: optresult-unroll +A major refactoring of the ResOperations that kills Box. Also rewrote +unrolling to enable future enhancements. Should improve warmup time +by 20% or so. + +.. branch: optimize-cond-call +Optimize common sequences of operations like +``int_lt/cond_call`` in the JIT backends + +.. branch: missing_openssl_include +Fix for missing headers in OpenBSD, already applied in downstream ports + +.. branch: gc-more-incremental +Remove a source of non-incremental-ness in the GC: now +external_malloc() no longer runs gc_step_until() any more. If there +is a currently-running major collection, we do only so many steps +before returning. This number of steps depends on the size of the +allocated object. It is controlled by tracking the general progress +of these major collection steps and the size of old objects that +keep adding up between them. + +.. branch: remember-tracing-counts +Reenable jithooks + +.. branch: detect_egd2 + +.. branch: shadowstack-no-move-2 +Issue #2141: fix a crash on Windows and OS/X and ARM when running +at least 20 threads. + +.. branch: numpy-ctypes + +Add support for ndarray.ctypes property. + +.. branch: share-guard-info + +Share guard resume data between consecutive guards that have only +pure operations and guards in between. + +.. branch: issue-2148 + +Fix performance regression on operations mixing numpy scalars and Python +floats, cf. issue #2148. + +.. branch: cffi-stdcall +Win32: support '__stdcall' in CFFI. + +.. branch: callfamily + +Refactorings of annotation and rtyping of function calls. + +.. branch: fortran-order + +Allow creation of fortran-ordered ndarrays + +.. branch: type_system-cleanup + +Remove some remnants of the old ootypesystem vs lltypesystem dichotomy. + +.. branch: cffi-handle-lifetime + +ffi.new_handle() returns handles that work more like CPython's: they +remain valid as long as the target exists (unlike the previous +version, where handles become invalid *before* the __del__ is called). + +.. branch: ufunc-casting + +allow automatic casting in ufuncs (and frompypyfunc) to cast the +arguments to the allowed function type declarations, fixes various +failures in linalg cffi functions + +.. branch: vecopt +.. branch: vecopt-merge + +A new optimization pass to use emit vectorized loops + +.. branch: ppc-updated-backend + +The PowerPC JIT backend is merged. + +.. branch: osx-libffi + diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -1,7 +1,10 @@ -======================= -What's new in PyPy 2.6+ -======================= +========================= +What's new in PyPy 4.0.+ +========================= -.. this is a revision shortly after release-2.6.1 -.. startrev: 07769be4057b +.. this is a revision shortly after release-4.0.0 +.. startrev: 9397d7c6f5aa +.. branch: lazy-fast2locals +improve the performance of simple trace functions by lazily calling +fast2locals and locals2fast only if f_locals is actually accessed. diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1079,6 +1079,14 @@ args = Arguments.frompacked(self, w_args, w_kwds) return self.call_args(w_callable, args) + def _try_fetch_pycode(self, w_func): + from pypy.interpreter.function import Function, Method + if isinstance(w_func, Method): + w_func = w_func.w_function + if isinstance(w_func, Function): + return w_func.code + return None + def call_function(self, w_func, *args_w): nargs = len(args_w) # used for pruning funccall versions if not self.config.objspace.disable_call_speedhacks and nargs < 5: diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py --- a/pypy/interpreter/executioncontext.py +++ b/pypy/interpreter/executioncontext.py @@ -322,10 +322,14 @@ w_arg = space.newtuple([operr.w_type, w_value, space.wrap(operr.get_traceback())]) - frame.fast2locals() + d = frame.getorcreatedebug() + if d.w_locals is not None: + # only update the w_locals dict if it exists + # if it does not exist yet and the tracer accesses it via + # frame.f_locals, it is filled by PyFrame.getdictscope + frame.fast2locals() self.is_tracing += 1 try: - d = frame.getorcreatedebug() try: w_result = space.call_function(w_callback, space.wrap(frame), space.wrap(event), w_arg) if space.is_w(w_result, space.w_None): @@ -338,7 +342,8 @@ raise finally: self.is_tracing -= 1 - frame.locals2fast() + if d.w_locals is not None: + frame.locals2fast() # Profile cases if self.profilefunc is not None: diff --git a/pypy/interpreter/miscutils.py b/pypy/interpreter/miscutils.py --- a/pypy/interpreter/miscutils.py +++ b/pypy/interpreter/miscutils.py @@ -9,6 +9,7 @@ implementation for this feature, and patches 'space.threadlocals' when 'thread' is initialized. """ + _immutable_fields_ = ['_value?'] _value = None def get_ec(self): diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py --- a/pypy/interpreter/test/test_pyframe.py +++ b/pypy/interpreter/test/test_pyframe.py @@ -1,10 +1,14 @@ from rpython.tool import udir from pypy.conftest import option +from pypy.interpreter.gateway import interp2app +def check_no_w_locals(space, w_frame): + return space.wrap(w_frame.getorcreatedebug().w_locals is None) class AppTestPyFrame: def setup_class(cls): + space = cls.space cls.w_udir = cls.space.wrap(str(udir.udir)) cls.w_tempfile1 = cls.space.wrap(str(udir.udir.join('tempfile1'))) if not option.runappdirect: @@ -17,6 +21,8 @@ w_call_further.code.hidden_applevel = True # hack cls.w_call_further = w_call_further + cls.w_check_no_w_locals = space.wrap(interp2app(check_no_w_locals)) + # test for the presence of the attributes, not functionality def test_f_locals(self): @@ -463,6 +469,25 @@ (firstlineno + 3, 'line'), (firstlineno + 3, 'return')] + def test_fast2locals_called_lazily(self): + import sys + class FrameHolder: + pass + fh = FrameHolder() + def trace(frame, what, arg): + # trivial trace function, does not access f_locals + fh.frame = frame + return trace + def f(x): + x += 1 + return x + sys.settrace(trace) + res = f(1) + sys.settrace(None) + assert res == 2 + if hasattr(self, "check_no_w_locals"): # not appdirect + assert self.check_no_w_locals(fh.frame) + def test_set_unset_f_trace(self): import sys seen = [] diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py --- a/pypy/module/__pypy__/__init__.py +++ b/pypy/module/__pypy__/__init__.py @@ -109,7 +109,6 @@ 'interp_magic.mapdict_cache_counter') PYC_MAGIC = get_pyc_magic(self.space) self.extra_interpdef('PYC_MAGIC', 'space.wrap(%d)' % PYC_MAGIC) - # try: from rpython.jit.backend import detect_cpu model = detect_cpu.autodetect() @@ -119,7 +118,7 @@ raise else: pass # ok fine to ignore in this case - # + if self.space.config.translation.jit: features = detect_cpu.getcpufeatures(model) self.extra_interpdef('jit_backend_features', diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -1,9 +1,16 @@ import sys from pypy.interpreter.mixedmodule import MixedModule -from rpython.rlib import rdynload +from rpython.rlib import rdynload, clibffi VERSION = "1.3.0" +FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI +try: + FFI_STDCALL = clibffi.FFI_STDCALL + has_stdcall = True +except AttributeError: + has_stdcall = False + class Module(MixedModule): @@ -40,12 +47,13 @@ 'string': 'func.string', 'buffer': 'cbuffer.buffer', + 'memmove': 'func.memmove', 'get_errno': 'cerrno.get_errno', 'set_errno': 'cerrno.set_errno', - 'FFI_DEFAULT_ABI': 'ctypefunc._get_abi(space, "FFI_DEFAULT_ABI")', - 'FFI_CDECL': 'ctypefunc._get_abi(space,"FFI_DEFAULT_ABI")',#win32 name + 'FFI_DEFAULT_ABI': 'space.wrap(%d)' % FFI_DEFAULT_ABI, + 'FFI_CDECL': 'space.wrap(%d)' % FFI_DEFAULT_ABI, # win32 name # CFFI 1.0 'FFI': 'ffi_obj.W_FFIObject', @@ -53,6 +61,9 @@ if sys.platform == 'win32': interpleveldefs['getwinerror'] = 'cerrno.getwinerror' + if has_stdcall: + interpleveldefs['FFI_STDCALL'] = 'space.wrap(%d)' % FFI_STDCALL + def get_dict_rtld_constants(): found = {} diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py --- a/pypy/module/_cffi_backend/ccallback.py +++ b/pypy/module/_cffi_backend/ccallback.py @@ -1,11 +1,11 @@ """ Callbacks. """ -import sys, os +import sys, os, py -from rpython.rlib import clibffi, rweakref, jit, jit_libffi -from rpython.rlib.objectmodel import compute_unique_id, keepalive_until_here -from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rlib import clibffi, jit, jit_libffi, rgc, objectmodel +from rpython.rlib.objectmodel import keepalive_until_here +from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from pypy.interpreter.error import OperationError, oefmt from pypy.module._cffi_backend import cerrno, misc @@ -19,19 +19,52 @@ # ____________________________________________________________ + at jit.dont_look_inside +def make_callback(space, ctype, w_callable, w_error, w_onerror): + # Allocate a callback as a nonmovable W_CDataCallback instance, which + # we can cast to a plain VOIDP. As long as the object is not freed, + # we can cast the VOIDP back to a W_CDataCallback in reveal_callback(). + cdata = objectmodel.instantiate(W_CDataCallback, nonmovable=True) + gcref = rgc.cast_instance_to_gcref(cdata) + raw_cdata = rgc.hide_nonmovable_gcref(gcref) + cdata.__init__(space, ctype, w_callable, w_error, w_onerror, raw_cdata) + return cdata + +def reveal_callback(raw_ptr): + addr = rffi.cast(llmemory.Address, raw_ptr) + gcref = rgc.reveal_gcref(addr) + return rgc.try_cast_gcref_to_instance(W_CDataCallback, gcref) + + +class Closure(object): + """This small class is here to have a __del__ outside any cycle.""" + + ll_error = lltype.nullptr(rffi.CCHARP.TO) # set manually + + def __init__(self, ptr): From noreply at buildbot.pypy.org Sat Nov 14 12:56:37 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 18:56:37 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151114175637.180A51C123F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r653:91033b250e86 Date: 2015-11-14 18:57 +0100 http://bitbucket.org/pypy/pypy.org/changeset/91033b250e86/ Log: update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -15,7 +15,7 @@ - $61221 of $105000 (58.3%) + $61249 of $105000 (58.3%)
    @@ -23,7 +23,7 @@
  • From noreply at buildbot.pypy.org Sat Nov 14 13:45:51 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 19:45:51 +0100 (CET) Subject: [pypy-commit] cffi default: Document the SELinux issue with callbacks Message-ID: <20151114184551.818A01C11B3@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2394:56d35f3de7ca Date: 2015-11-14 19:44 +0100 http://bitbucket.org/cffi/cffi/changeset/56d35f3de7ca/ Log: Document the SELinux issue with callbacks diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -514,6 +514,16 @@ discouraged: using this a style, we are more likely to forget the callback object too early, when it is still in use. +.. warning:: + + **SELinux** requires that the setting ``deny_execmem`` is left to + its default setting of ``off`` to use callbacks. A fix in cffi was + attempted (see the ``ffi_closure_alloc`` branch), but this branch is + not merged because it creates potential memory corruption with + ``fork()``. For more information, `see here.`__ + +.. __: https://bugzilla.redhat.com/show_bug.cgi?id=1249685 + *New in version 1.2:* If you want to be sure to catch all exceptions, use ``ffi.callback(..., onerror=func)``. If an exception occurs and ``onerror`` is specified, then ``onerror(exception, exc_value, From noreply at buildbot.pypy.org Sat Nov 14 13:45:53 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 19:45:53 +0100 (CET) Subject: [pypy-commit] cffi default: update version to 1.3.1 Message-ID: <20151114184553.891541C11B3@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2395:e594798bca41 Date: 2015-11-14 19:46 +0100 http://bitbucket.org/cffi/cffi/changeset/e594798bca41/ Log: update version to 1.3.1 diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -6451,7 +6451,7 @@ if (v == NULL || PyModule_AddObject(m, "_C_API", v) < 0) INITERROR; - v = PyText_FromString("1.3.0"); + v = PyText_FromString("1.3.1"); if (v == NULL || PyModule_AddObject(m, "__version__", v) < 0) INITERROR; diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -12,7 +12,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): diff --git a/cffi/__init__.py b/cffi/__init__.py --- a/cffi/__init__.py +++ b/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/doc/source/conf.py b/doc/source/conf.py --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -47,7 +47,7 @@ # The short X.Y version. version = '1.3' # The full version, including alpha/beta/rc tags. -release = '1.3.0' +release = '1.3.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/installation.rst b/doc/source/installation.rst --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -51,11 +51,11 @@ Download and Installation: -* http://pypi.python.org/packages/source/c/cffi/cffi-1.3.0.tar.gz +* http://pypi.python.org/packages/source/c/cffi/cffi-1.3.1.tar.gz - - MD5: a40ed8c8ac653c8fc7d5603711b06eaf + - MD5: ... - - SHA: 54a0b2dbbc2f5d99131aa337e217b636652641a9 + - SHA: ... * Or grab the most current version from the `Bitbucket page`_: ``hg clone https://bitbucket.org/cffi/cffi`` diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -144,7 +144,7 @@ `Mailing list `_ """, - version='1.3.0', + version='1.3.1', packages=['cffi'] if cpython else [], package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h']} if cpython else {}, From noreply at buildbot.pypy.org Sat Nov 14 14:03:14 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 20:03:14 +0100 (CET) Subject: [pypy-commit] cffi default: Whatsnew in v1.3.1 Message-ID: <20151114190314.ED06A1C1205@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2396:47ac47b95bd6 Date: 2015-11-14 20:04 +0100 http://bitbucket.org/cffi/cffi/changeset/47ac47b95bd6/ Log: Whatsnew in v1.3.1 diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst --- a/doc/source/whatsnew.rst +++ b/doc/source/whatsnew.rst @@ -3,6 +3,22 @@ ====================== +v1.3.1 +====== + +* The optional typedefs (``bool``, ``FILE`` and all Windows types) were + not always available from out-of-line FFI objects. + +* Opaque enums are phased out from the cdefs: they now give a warning, + instead of (possibly wrongly) being assumed equal to ``unsigned int``. + Please report if you get a reasonable use case for them. + +* Some parsing details, notably ``volatile`` is passed along like + ``const`` and ``restrict``. Also, older versions of pycparser + mis-parse some pointer-to-pointer types like ``char * const *``: the + "const" ends up at the wrong place. Added a workaround. + + v1.3.0 ====== From noreply at buildbot.pypy.org Sat Nov 14 14:10:12 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 20:10:12 +0100 (CET) Subject: [pypy-commit] pypy default: update version of cffi Message-ID: <20151114191012.A3CD11C123F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80677:c9ed067d299f Date: 2015-11-14 20:06 +0100 http://bitbucket.org/pypy/pypy/changeset/c9ed067d299f/ Log: update version of cffi diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.3.0 +Version: 1.3.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -2,7 +2,7 @@ from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib import rdynload, clibffi -VERSION = "1.3.0" +VERSION = "1.3.1" FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI try: diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -1,7 +1,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): From noreply at buildbot.pypy.org Sat Nov 14 14:20:18 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 20:20:18 +0100 (CET) Subject: [pypy-commit] cffi default: py3 compat Message-ID: <20151114192018.B05FB1C12A2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2397:5631e450119f Date: 2015-11-14 20:17 +0100 http://bitbucket.org/cffi/cffi/changeset/5631e450119f/ Log: py3 compat diff --git a/c/commontypes.c b/c/commontypes.c --- a/c/commontypes.c +++ b/c/commontypes.c @@ -202,7 +202,7 @@ int i, err; for (i = 0; i < num_common_simple_types; i++) { const char *s = common_simple_types[i]; - PyObject *o = PyString_FromString(s + strlen(s) + 1); + PyObject *o = PyText_FromString(s + strlen(s) + 1); if (o == NULL) return NULL; err = PyDict_SetItemString(arg, s, o); diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -62,7 +62,8 @@ if csource.startswith('*', endpos): parts.append('('); closing += ')' level = 0 - for i in xrange(endpos, len(csource)): + i = endpos + while i < len(csource): c = csource[i] if c == '(': level += 1 @@ -73,6 +74,7 @@ elif c in ',;=': if level == 0: break + i += 1 csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) From noreply at buildbot.pypy.org Sat Nov 14 17:44:41 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sat, 14 Nov 2015 23:44:41 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151114224441.717001C11B3@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r654:e0c4dad68b21 Date: 2015-11-14 23:45 +0100 http://bitbucket.org/pypy/pypy.org/changeset/e0c4dad68b21/ Log: update the values diff --git a/don3.html b/don3.html --- a/don3.html +++ b/don3.html @@ -15,7 +15,7 @@ - $52617 of $60000 (87.7%) + $52636 of $60000 (87.7%)
    @@ -23,7 +23,7 @@
  • diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -17,7 +17,7 @@ 2nd call: - $29678 of $80000 (37.1%) + $29688 of $80000 (37.1%)
    @@ -25,7 +25,7 @@
  • From noreply at buildbot.pypy.org Sun Nov 15 02:25:36 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 08:25:36 +0100 (CET) Subject: [pypy-commit] cffi static-callback: tweak the pypy-only generated code Message-ID: <20151115072536.101E31C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2398:b679cab967ff Date: 2015-11-15 08:26 +0100 http://bitbucket.org/cffi/cffi/changeset/b679cab967ff/ Log: tweak the pypy-only generated code diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h --- a/cffi/_cffi_include.h +++ b/cffi/_cffi_include.h @@ -205,7 +205,8 @@ /********** end CPython-specific section **********/ #else -extern void _cffi_call_python(struct _cffi_callpy_s *, char *); +_CFFI_UNUSED_FN +static void (*_cffi_call_python)(struct _cffi_callpy_s *, char *); #endif diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -370,6 +370,9 @@ prnt('PyMODINIT_FUNC') prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) prnt('{') + prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') + prnt(' _cffi_call_python = p[1];') + prnt(' }') prnt(' p[0] = (const void *)%s;' % VERSION) prnt(' p[1] = &_cffi_type_context;') prnt('}') From noreply at buildbot.pypy.org Sun Nov 15 02:58:09 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 08:58:09 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: A branch to try to implement the "static-callback" branch of cffi Message-ID: <20151115075809.37A531C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80678:769e8bcf3c1d Date: 2015-11-14 19:31 +0100 http://bitbucket.org/pypy/pypy/changeset/769e8bcf3c1d/ Log: A branch to try to implement the "static-callback" branch of cffi (hopefully with good JIT support) From noreply at buildbot.pypy.org Sun Nov 15 02:58:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 08:58:11 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: in-progress Message-ID: <20151115075811.51AF41C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80679:5fc8adadad4c Date: 2015-11-15 08:58 +0100 http://bitbucket.org/pypy/pypy/changeset/5fc8adadad4c/ Log: in-progress diff --git a/pypy/module/_cffi_backend/cffi1_module.py b/pypy/module/_cffi_backend/cffi1_module.py --- a/pypy/module/_cffi_backend/cffi1_module.py +++ b/pypy/module/_cffi_backend/cffi1_module.py @@ -10,16 +10,19 @@ VERSION_MIN = 0x2601 VERSION_MAX = 0x26FF -VERSION_EXPORT = 0x0A02 +VERSION_EXPORT = 0x0A03 initfunctype = lltype.Ptr(lltype.FuncType([rffi.VOIDPP], lltype.Void)) def load_cffi1_module(space, name, path, initptr): # This is called from pypy.module.cpyext.api.load_extension_module() + from pypy.module._cffi_backend.call_python import get_cffi_call_python + initfunc = rffi.cast(initfunctype, initptr) - with lltype.scoped_alloc(rffi.VOIDPP.TO, 2) as p: + with lltype.scoped_alloc(rffi.VOIDPP.TO, 16, zero=True) as p: p[0] = rffi.cast(rffi.VOIDP, VERSION_EXPORT) + p[1] = rffi.cast(rffi.VOIDP, get_cffi_call_python()) initfunc(p) version = rffi.cast(lltype.Signed, p[0]) if not (VERSION_MIN <= version <= VERSION_MAX): diff --git a/pypy/module/_cffi_backend/cffi_opcode.py b/pypy/module/_cffi_backend/cffi_opcode.py --- a/pypy/module/_cffi_backend/cffi_opcode.py +++ b/pypy/module/_cffi_backend/cffi_opcode.py @@ -54,6 +54,7 @@ OP_DLOPEN_FUNC = 35 OP_DLOPEN_CONST = 37 OP_GLOBAL_VAR_F = 39 +OP_CALL_PYTHON = 41 PRIM_VOID = 0 PRIM_BOOL = 1 diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -10,7 +10,7 @@ from pypy.module._cffi_backend import parse_c_type, realize_c_type from pypy.module._cffi_backend import newtype, cerrno, ccallback, ctypearray from pypy.module._cffi_backend import ctypestruct, ctypeptr, handle -from pypy.module._cffi_backend import cbuffer, func, wrapper +from pypy.module._cffi_backend import cbuffer, func, wrapper, call_python from pypy.module._cffi_backend import cffi_opcode, allocator from pypy.module._cffi_backend.ctypeobj import W_CType from pypy.module._cffi_backend.cdataobj import W_CData @@ -633,6 +633,7 @@ addressof = interp2app(W_FFIObject.descr_addressof), alignof = interp2app(W_FFIObject.descr_alignof), buffer = interp2app(W_FFIObject.descr_buffer), + #call_python = interp2app(W_FFIObject.descr_call_python), callback = interp2app(W_FFIObject.descr_callback), cast = interp2app(W_FFIObject.descr_cast), dlclose = interp2app(W_FFIObject.descr_dlclose), diff --git a/pypy/module/_cffi_backend/lib_obj.py b/pypy/module/_cffi_backend/lib_obj.py --- a/pypy/module/_cffi_backend/lib_obj.py +++ b/pypy/module/_cffi_backend/lib_obj.py @@ -167,6 +167,14 @@ w_ctfnptr = w_ct.unwrap_as_fnptr(self.ffi) w_result = W_CData(self.space, ptr, w_ctfnptr) # + # + elif op == cffi_opcode.OP_CALL_PYTHON: + # for reading 'lib.bar' where bar is declared + # with CFFI_CALL_PYTHON + w_ct = realize_c_type.realize_c_type( + self.ffi, self.ctx.c_types, getarg(g.c_type_op)) + ptr = lltype.direct_fieldptr(g, 'c_size_or_direct_fn') + w_result = w_ct.convert_to_object(rffi.cast(rffi.CCHARP, ptr)) else: raise oefmt(space.w_NotImplementedError, "in lib_build_attr: op=%d", op) diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -71,6 +71,12 @@ ('error_location', rffi.SIZE_T), ('error_message', rffi.CCHARP)) +CALLPY_S = rffi.CStruct('_cffi_callpy_s', + ('name', rffi.CCHARP), + ('size_of_result', rffi.SIZE_T), + ('reserved1', rffi.VOIDP), + ('reserved2', rffi.VOIDP)) + GETCONST_S = rffi.CStruct('_cffi_getconst_s', ('value', rffi.ULONGLONG), ('ctx', PCTX), diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -1376,3 +1376,216 @@ 'test_share_FILE_b', "FILE *barize(void) { return NULL; }") lib1.do_stuff(lib2.barize()) + + def w_StdErrCapture(self, fd=False): + if fd: + # note: this is for a case where CPython prints to sys.stderr + # too, but not PyPy + import os + class MiniStringIO(object): + def __init__(self): + self._rd, self._wr = os.pipe() + self._result = None + def getvalue(self): + if self._result is None: + os.close(self._wr) + self._result = os.read(self._rd, 4096) + os.close(self._rd) + # xxx hack away these lines + while self._result.startswith('[platform:execute]'): + self._result = ''.join( + self._result.splitlines(True)[1:]) + return self._result + class StdErrCapture(object): + def __enter__(self): + f = MiniStringIO() + self.old_fd2 = os.dup(2) + os.dup2(f._wr, 2) + return f + def __exit__(self, *args): + os.dup2(self.old_fd2, 2) + os.close(self.old_fd2) + return StdErrCapture() + else: + import sys + class MiniStringIO(object): + def __init__(self): + self._lst = [] + self.write = self._lst.append + def getvalue(self): + return ''.join(self._lst) + class StdErrCapture(object): + def __enter__(self): + self.old_stderr = sys.stderr + sys.stderr = f = MiniStringIO() + return f + def __exit__(self, *args): + sys.stderr = self.old_stderr + return StdErrCapture() + + def test_call_python_1(self): + ffi, lib = self.prepare(""" + CFFI_CALL_PYTHON int bar(int, int); + CFFI_CALL_PYTHON void baz(int, int); + CFFI_CALL_PYTHON int bok(void); + CFFI_CALL_PYTHON void boz(void); + """, 'test_call_python_1', "") + assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") + with self.StdErrCapture(fd=True) as f: + res = lib.bar(4, 5) + assert res == 0 + assert f.getvalue() == ( + "CFFI_CALL_PYTHON: function bar() called, but no code was attached " + "to it yet with ffi.call_python('bar'). Returning 0.\n") + + @ffi.call_python("bar") + def my_bar(x, y): + seen.append(("Bar", x, y)) + return x * y + assert my_bar == lib.bar + seen = [] + res = lib.bar(6, 7) + assert seen == [("Bar", 6, 7)] + assert res == 42 + + @ffi.call_python() + def baz(x, y): + seen.append(("Baz", x, y)) + seen = [] + res = baz(50L, 8L) + assert res is None + assert seen == [("Baz", 50, 8)] + assert type(seen[0][1]) is type(seen[0][2]) is int + assert baz == lib.baz + + @ffi.call_python() + def bok(): + seen.append("Bok") + return 42 + seen = [] + assert lib.bok() == bok() == 42 + assert seen == ["Bok", "Bok"] + + @ffi.call_python() + def boz(): + seen.append("Boz") + seen = [] + assert lib.boz() is boz() is None + assert seen == ["Boz", "Boz"] + + def test_call_python_bogus_name(): + ffi = FFI() + ffi.cdef("int abc;") + lib = verify(ffi, 'test_call_python_bogus_name', "int abc;") + def fn(): + pass + py.test.raises(ffi.error, ffi.call_python("unknown_name"), fn) + py.test.raises(ffi.error, ffi.call_python("abc"), fn) + assert lib.abc == 0 + e = py.test.raises(ffi.error, ffi.call_python("abc"), fn) + assert str(e.value) == ("ffi.call_python('abc'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef") + e = py.test.raises(ffi.error, ffi.call_python(), fn) + assert str(e.value) == ("ffi.call_python('fn'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef") + # + py.test.raises(TypeError, ffi.call_python(42), fn) + py.test.raises((TypeError, AttributeError), ffi.call_python(), "foo") + class X: + pass + x = X() + x.__name__ = x + py.test.raises(TypeError, ffi.call_python(), x) + + def test_call_python_bogus_result_type(): + ffi = FFI() + ffi.cdef("CFFI_CALL_PYTHON void bar(int);") + lib = verify(ffi, 'test_call_python_bogus_result_type', "") + # + def bar(n): + return n * 10 + bar1 = ffi.call_python()(bar) + with StdErrCapture() as f: + res = bar1(321) + assert res is None + assert f.getvalue() == ( + "From cffi callback %r:\n" % (bar,) + + "Trying to convert the result back to C:\n" + "TypeError: callback with the return type 'void' must return None\n") + + def test_call_python_redefine(): + ffi = FFI() + ffi.cdef("CFFI_CALL_PYTHON int bar(int);") + lib = verify(ffi, 'test_call_python_redefine', "") + # + @ffi.call_python() + def bar(n): + return n * 10 + assert lib.bar(42) == 420 + # + @ffi.call_python() + def bar(n): + return -n + assert lib.bar(42) == -42 + + def test_call_python_struct(): + ffi = FFI() + ffi.cdef(""" + struct foo_s { int a, b, c; }; + CFFI_CALL_PYTHON int bar(int, struct foo_s, int); + CFFI_CALL_PYTHON struct foo_s baz(int, int); + CFFI_CALL_PYTHON struct foo_s bok(void); + """) + lib = verify(ffi, 'test_call_python_struct', + "struct foo_s { int a, b, c; };") + # + @ffi.call_python() + def bar(x, s, z): + return x + s.a + s.b + s.c + z + res = lib.bar(1000, [1001, 1002, 1004], 1008) + assert res == 5015 + # + @ffi.call_python() + def baz(x, y): + return [x + y, x - y, x * y] + res = lib.baz(1000, 42) + assert res.a == 1042 + assert res.b == 958 + assert res.c == 42000 + # + @ffi.call_python() + def bok(): + return [10, 20, 30] + res = lib.bok() + assert [res.a, res.b, res.c] == [10, 20, 30] + + def test_call_python_long_double(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int, long double, int); + CFFI_CALL_PYTHON long double baz(int, int); + CFFI_CALL_PYTHON long double bok(void); + """) + lib = verify(ffi, 'test_call_python_long_double', "") + # + @ffi.call_python() + def bar(x, l, z): + seen.append((x, l, z)) + return 6 + seen = [] + lib.bar(10, 3.5, 20) + expected = ffi.cast("long double", 3.5) + assert repr(seen) == repr([(10, expected, 20)]) + # + @ffi.call_python() + def baz(x, z): + assert x == 10 and z == 20 + return expected + res = lib.baz(10, 20) + assert repr(res) == repr(expected) + # + @ffi.call_python() + def bok(): + return expected + res = lib.bok() + assert repr(res) == repr(expected) From noreply at buildbot.pypy.org Sun Nov 15 03:12:05 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 09:12:05 +0100 (CET) Subject: [pypy-commit] cffi static-callback: More tests for what I thought would work because it uses the same code Message-ID: <20151115081205.DD6CA1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2399:e0c7c1c5c761 Date: 2015-11-15 09:12 +0100 http://bitbucket.org/cffi/cffi/changeset/e0c7c1c5c761/ Log: More tests for what I thought would work because it uses the same code as ffi.callback(). Alas, it didn't diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -745,10 +745,9 @@ (PyCFunction)_ffi_call_python_decorator, METH_O}; PyObject *name = Py_None, *error = Py_None; PyObject *res, *onerror = Py_None; - static char *keywords[] = {"name", "python_callable", "error", - "onerror", NULL}; + static char *keywords[] = {"name", "error", "onerror", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO", keywords, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOO", keywords, &name, &error, &onerror)) return NULL; diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1531,7 +1531,7 @@ assert type(seen[0][1]) is type(seen[0][2]) is int assert baz == lib.baz - @ffi.call_python() + @ffi.call_python(name="bok") def bok(): seen.append("Bok") return 42 @@ -1662,3 +1662,44 @@ return expected res = lib.bok() assert repr(res) == repr(expected) + +def test_call_python_signature(): + ffi = FFI() + lib = verify(ffi, 'test_call_python_signature', "") + py.test.raises(TypeError, ffi.call_python(425), None) + py.test.raises(TypeError, ffi.call_python, 'a', 'b', 'c', 'd') + +def test_call_python_errors(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int); + """) + lib = verify(ffi, 'test_call_python_errors', "") + + seen = [] + def oops(*args): + seen.append(args) + + @ffi.call_python(onerror=oops) + def bar(x): + return x + "" + assert bar(10) == 0 + + @ffi.call_python(name="bar", onerror=oops, error=-66) + def bar2(x): + return x + "" + assert bar(10) == -66 + + assert len(seen) == 2 + exc, val, tb = seen[0] + assert exc is TypeError + assert isinstance(val, TypeError) + assert tb.tb_frame.f_code.co_name == "bar" + exc, val, tb = seen[1] + assert exc is TypeError + assert isinstance(val, TypeError) + assert tb.tb_frame.f_code.co_name == "bar2" + # + # a case where 'onerror' is not callable + py.test.raises(TypeError, ffi.call_python(name='bar', onerror=42), + lambda x: x) From noreply at buildbot.pypy.org Sun Nov 15 05:06:37 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 11:06:37 +0100 (CET) Subject: [pypy-commit] cffi static-callback: hg merge default Message-ID: <20151115100637.19A681C120B@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2400:b3f8361175b7 Date: 2015-11-15 09:22 +0100 http://bitbucket.org/cffi/cffi/changeset/b3f8361175b7/ Log: hg merge default diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -6495,7 +6495,7 @@ if (v == NULL || PyModule_AddObject(m, "_C_API", v) < 0) INITERROR; - v = PyText_FromString("1.3.0"); + v = PyText_FromString("1.3.1"); if (v == NULL || PyModule_AddObject(m, "__version__", v) < 0) INITERROR; diff --git a/c/commontypes.c b/c/commontypes.c --- a/c/commontypes.c +++ b/c/commontypes.c @@ -202,7 +202,7 @@ int i, err; for (i = 0; i < num_common_simple_types; i++) { const char *s = common_simple_types[i]; - PyObject *o = PyString_FromString(s + strlen(s) + 1); + PyObject *o = PyText_FromString(s + strlen(s) + 1); if (o == NULL) return NULL; err = PyDict_SetItemString(arg, s, o); diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -12,7 +12,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): diff --git a/cffi/__init__.py b/cffi/__init__.py --- a/cffi/__init__.py +++ b/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -63,7 +63,8 @@ if csource.startswith('*', endpos): parts.append('('); closing += ')' level = 0 - for i in xrange(endpos, len(csource)): + i = endpos + while i < len(csource): c = csource[i] if c == '(': level += 1 @@ -74,6 +75,7 @@ elif c in ',;=': if level == 0: break + i += 1 csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) diff --git a/doc/source/conf.py b/doc/source/conf.py --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -47,7 +47,7 @@ # The short X.Y version. version = '1.3' # The full version, including alpha/beta/rc tags. -release = '1.3.0' +release = '1.3.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/installation.rst b/doc/source/installation.rst --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -51,11 +51,11 @@ Download and Installation: -* http://pypi.python.org/packages/source/c/cffi/cffi-1.3.0.tar.gz +* http://pypi.python.org/packages/source/c/cffi/cffi-1.3.1.tar.gz - - MD5: a40ed8c8ac653c8fc7d5603711b06eaf + - MD5: ... - - SHA: 54a0b2dbbc2f5d99131aa337e217b636652641a9 + - SHA: ... * Or grab the most current version from the `Bitbucket page`_: ``hg clone https://bitbucket.org/cffi/cffi`` diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -514,6 +514,16 @@ discouraged: using this a style, we are more likely to forget the callback object too early, when it is still in use. +.. warning:: + + **SELinux** requires that the setting ``deny_execmem`` is left to + its default setting of ``off`` to use callbacks. A fix in cffi was + attempted (see the ``ffi_closure_alloc`` branch), but this branch is + not merged because it creates potential memory corruption with + ``fork()``. For more information, `see here.`__ + +.. __: https://bugzilla.redhat.com/show_bug.cgi?id=1249685 + *New in version 1.2:* If you want to be sure to catch all exceptions, use ``ffi.callback(..., onerror=func)``. If an exception occurs and ``onerror`` is specified, then ``onerror(exception, exc_value, diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst --- a/doc/source/whatsnew.rst +++ b/doc/source/whatsnew.rst @@ -3,6 +3,22 @@ ====================== +v1.3.1 +====== + +* The optional typedefs (``bool``, ``FILE`` and all Windows types) were + not always available from out-of-line FFI objects. + +* Opaque enums are phased out from the cdefs: they now give a warning, + instead of (possibly wrongly) being assumed equal to ``unsigned int``. + Please report if you get a reasonable use case for them. + +* Some parsing details, notably ``volatile`` is passed along like + ``const`` and ``restrict``. Also, older versions of pycparser + mis-parse some pointer-to-pointer types like ``char * const *``: the + "const" ends up at the wrong place. Added a workaround. + + v1.3.0 ====== diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -144,7 +144,7 @@ `Mailing list `_ """, - version='1.3.0', + version='1.3.1', packages=['cffi'] if cpython else [], package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h']} if cpython else {}, From noreply at buildbot.pypy.org Sun Nov 15 05:06:39 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 11:06:39 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Write documentation about ffi.call_python(). Message-ID: <20151115100639.2B0621C120B@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2401:ff2c67fc1655 Date: 2015-11-15 11:07 +0100 http://bitbucket.org/cffi/cffi/changeset/ff2c67fc1655/ Log: Write documentation about ffi.call_python(). diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -422,8 +422,195 @@ with ``int foo();`` really means ``int foo(void);``.) -Callbacks ---------- +.. _`call_python`: + +Calling Python from C (new style) +--------------------------------- + +When the C code needs a pointer to a function which invokes back a +Python function of your choice, here is how you do it in the +out-of-line API mode. The next section about Callbacks_ describes the +ABI-mode solution. + +This is *new in version 1.4.* Use Callbacks_ if backward compatibility +is an issue. + +In the builder script, declare in the cdef a function prefixed with +``CFFI_CALL_PYTHON``:: + + ffi.cdef(""" + typedef ... footype_t; + CFFI_CALL_PYTHON int my_callback(footype_t *, int); + + void library_function(int(*callback)(footype_t *, int)); + """) + ffi.set_source("_my_example", """ + #include + """) + +The function ``my_callback()`` is not expected to be found in the C +code you pass with ``set_source()``. Instead, it is defined by CFFI +to call back some Python code. The Python code that is called is +attached at run-time, i.e. in the application's code:: + + from _my_example import ffi, lib + + @ffi.call_python() + def my_callback(fooptr, value): + return 42 + +Then any call to the C function ``my_callback`` will invoke the +corresponding Python function. From Python you can get a ```` +pointer-to-function object from either ``lib.my_callback`` or directly +from the decorated ``my_callback`` above. + +Note that there is only one C function per ``CFFI_CALL_PYTHON`` line +in the cdef. You can redefine the attached Python function by calling +``@ffi.call_python()`` again, but it changes the C logic to call the +new Python function; the C function pointer is always the same. This +is not suitable if you need a variable number of C function pointers. + +However, this result is not possible either in pure C code. For this +reason, it is usual for C to define callbacks with a ``void *data`` +argument. You can use ``ffi.new_handle()`` and ``ffi.from_handle()`` +to pass a Python object through this ``void *`` argument. For +example, if the C type of the callbacks is:: + + typedef void (*event_cb_t)(struct event *evt, void *userdata); + +and you register events by calling this function:: + + void event_cb_register(event_cb_t cb, void *userdata); + +Then you would write this in the build script:: + + ffi.cdef(""" + typedef void (*event_cb_t)(struct event *evt, void *userdata); + void event_cb_register(event_cb_t cb, void *userdata); + + CFFI_CALL_PYTHON void my_event_callback(struct event *, void *); + """) + ffi.set_source("_demo_cffi", """ + #include + """) + +and in your main application you register events like this:: + + from _demo_cffi import ffi, lib + + class Widget(object): + def __init__(self): + userdata = ffi.new_handle(self) + self._userdata = userdata # must keep this alive! + lib.event_cb_register(my_event_callback, userdata) + + def process_event(self, evt): + ... + + @ffi.call_python() + def my_event_callback(evt, userdata): + widget = ffi.from_handle(userdata) + widget.process_event(evt) + +Some other libraries don't have an explicit ``void *`` argument, but +let you attach the ``void *`` to an existing structure. For example, +the library might say that ``widget->userdata`` is a generic field +reserved for the application. If the event's signature is now this:: + + typedef void (*event_cb_t)(struct widget *w, struct event *evt); + +Then you can use the ``void *`` field in the low-level +``struct widget *`` like this:: + + from _demo_cffi import ffi, lib + + class Widget(object): + def __init__(self): + ll_widget = lib.new_widget(500, 500) + self.ll_widget = ll_widget # + userdata = ffi.new_handle(self) + ll_widget.userdata = userdata # this makes a copy of the "void *" + self._userdata = userdata # must *still* keep this alive! + lib.event_cb_register(ll_widget, my_event_callback) + + def process_event(self, evt): + ... + + @ffi.call_python() + def my_event_callback(ll_widget, evt): + widget = ffi.from_handle(ll_widget.userdata) + widget.process_event(evt) + +In case you want to access ``my_event_callback`` directly from the C +code written in ``set_source()``, you need to write a forward static +declaration (the real implementation of this function is added by CFFI +after this C code):: + + ffi.set_source("_demo_cffi", """ + #include + + static void my_event_callback(struct widget *, struct evt *); + + /* more C code which uses '&my_event_callback' or even + directly calls my_event_callback() */ + """) + +Note that ``CFFI_CALL_PYTHON`` cannot be a variadic function type +for now (this may be implemented in the future). + +Be careful when writing the Python callback function: if it returns an +object of the wrong type, or more generally raises an exception, then +the exception cannot be propagated. Instead, it is printed to stderr +and the C-level callback is made to return a default value. This can +be controlled with ``error`` and ``onerror``, described next. + +The ``@ffi.call_python()`` decorator takes these optional arguments: + +* ``name``: the name of the ``CFFI_CALL_PYTHON`` function declaration + from the cdef. Defaults to the name of the Python function you + decorate. + +.. _error_onerror: + +* ``error``: the returned value in case the Python function raises an + exception. It is 0 or null by default. The exception is still + printed to stderr, so this should be used only as a last-resort + solution. + +* ``onerror``: if you want to be sure to catch all exceptions, use + ``@ffi.call_python(onerror=func)``. If an exception occurs and + ``onerror`` is specified, then ``onerror(exception, exc_value, + traceback)`` is called. This is useful in some situations where you + cannot simply write ``try: except:`` in the main callback function, + because it might not catch exceptions raised by signal handlers: if + a signal occurs while in C, the signal handler is called as soon as + possible, i.e. after entering the callback function but *before* + even executing the ``try:``. If the signal handler raises, we are + not in the ``try: except:`` yet. + + If ``onerror`` is called and returns normally, then it is assumed + that it handled the exception on its own and nothing is printed to + stderr. If ``onerror`` raises, then both tracebacks are printed. + Finally, ``onerror`` can itself provide the result value of the + callback in C, but doesn't have to: if it simply returns None---or + if ``onerror`` itself fails---then the value of ``error`` will be + used, if any. + + Note the following hack: in ``onerror``, you can access the original + callback arguments as follows. First check if ``traceback`` is not + None (it is None e.g. if the whole function ran successfully but + there was an error converting the value returned: this occurs after + the call). If ``traceback`` is not None, then + ``traceback.tb_frame`` is the frame of the outermost function, + i.e. directly the one of the function decorated with + ``@ffi.call_python()``. So you can get the value of ``argname`` in + that frame by reading ``traceback.tb_frame.f_locals['argname']``. + + +.. _Callbacks: + +Callbacks (old style) +--------------------- Here is how to make a new ```` object that contains a pointer to a function, where that function invokes back a Python function of @@ -440,6 +627,20 @@ ``"int(int, int)"`` is a C *function* type. Either can be specified to ffi.callback() and the result is the same. +.. warning:: + + Callbacks are provided for the ABI mode or for backward + compatibility. If you are using the out-of-line API mode, it is + recommended to use the `call_python`_ mechanism instead of + callbacks: it gives faster and cleaner code. It also avoids a + SELinux issue whereby the setting of ``deny_execmem`` must be left + to ``off`` in order to use callbacks. (A fix in cffi was + attempted---see the ``ffi_closure_alloc`` branch---but was not + merged because it creates potential memory corruption with + ``fork()``. For more information, `see here.`__) + +.. __: https://bugzilla.redhat.com/show_bug.cgi?id=1249685 + Warning: like ffi.new(), ffi.callback() returns a cdata that has ownership of its C data. (In this case, the necessary C data contains the libffi data structures to do a callback.) This means that the @@ -494,62 +695,17 @@ return 0 lib.python_callback = python_callback -Be careful when writing the Python callback function: if it returns an -object of the wrong type, or more generally raises an exception, then -the exception cannot be propagated. Instead, it is printed to stderr -and the C-level callback is made to return a default value. - -The returned value in case of errors is 0 or null by default, but can be -specified with the ``error`` keyword argument to ``ffi.callback()``: - -.. code-block:: python - - @ffi.callback("int(int, int)", error=-1) - -The exception is still printed to stderr, so this should be -used only as a last-resort solution. - Deprecated: you can also use ``ffi.callback()`` not as a decorator but directly as ``ffi.callback("int(int, int)", myfunc)``. This is discouraged: using this a style, we are more likely to forget the callback object too early, when it is still in use. -.. warning:: - - **SELinux** requires that the setting ``deny_execmem`` is left to - its default setting of ``off`` to use callbacks. A fix in cffi was - attempted (see the ``ffi_closure_alloc`` branch), but this branch is - not merged because it creates potential memory corruption with - ``fork()``. For more information, `see here.`__ +The ``ffi.callback()`` decorator also accepts the optional argument +``error``, and from CFFI version 1.2 the optional argument ``onerror``. +These two work in the same way as `described above for call_python.`__ -.. __: https://bugzilla.redhat.com/show_bug.cgi?id=1249685 +.. __: error_onerror_ -*New in version 1.2:* If you want to be sure to catch all exceptions, use -``ffi.callback(..., onerror=func)``. If an exception occurs and -``onerror`` is specified, then ``onerror(exception, exc_value, -traceback)`` is called. This is useful in some situations where -you cannot simply write ``try: except:`` in the main callback -function, because it might not catch exceptions raised by signal -handlers: if a signal occurs while in C, it will be called after -entering the main callback function but before executing the -``try:``. - -If ``onerror`` returns normally, then it is assumed that it handled -the exception on its own and nothing is printed to stderr. If -``onerror`` raises, then both tracebacks are printed. Finally, -``onerror`` can itself provide the result value of the callback in -C, but doesn't have to: if it simply returns None---or if -``onerror`` itself fails---then the value of ``error`` will be -used, if any. - -Note the following hack: in ``onerror``, you can access the original -callback arguments as follows. First check if ``traceback`` is not -None (it is None e.g. if the whole function ran successfully but -there was an error converting the value returned: this occurs after -the call). If ``traceback`` is not None, then ``traceback.tb_frame`` -is the frame of the outermost function, i.e. directly the one invoked -by the callback handler. So you can get the value of ``argname`` in -that frame by reading ``traceback.tb_frame.f_locals['argname']``. Windows: calling conventions @@ -583,7 +739,9 @@ out. In the ``cdef()``, you can also use ``WINAPI`` as equivalent to ``__stdcall``. As mentioned above, it is not needed (but doesn't hurt) to say ``WINAPI`` or ``__stdcall`` when declaring a plain -function in the ``cdef()``. +function in the ``cdef()``. (The difference can still be seen if you +take explicitly a pointer to this function with ``ffi.addressof()``, +or if the function is ``CFFI_CALL_PYTHON``.) These calling convention specifiers are accepted but ignored on any platform other than 32-bit Windows. From noreply at buildbot.pypy.org Sun Nov 15 05:16:18 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 11:16:18 +0100 (CET) Subject: [pypy-commit] cffi default: Document ffi.new_allocator() Message-ID: <20151115101618.CE3E21C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2402:edfaf9c56322 Date: 2015-11-15 11:10 +0100 http://bitbucket.org/cffi/cffi/changeset/edfaf9c56322/ Log: Document ffi.new_allocator() diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -361,7 +361,19 @@ &PyTuple_GET_ITEM(allocator, 1)); } -PyDoc_STRVAR(ffi_new_allocator_doc, "XXX"); +PyDoc_STRVAR(ffi_new_allocator_doc, +"Return a new allocator, i.e. a function that behaves like ffi.new()\n" +"but uses the provided low-level 'alloc' and 'free' functions.\n" +"\n" +"'alloc' is called with the size as argument. If it returns NULL, a\n" +"MemoryError is raised. 'free' is called with the result of 'alloc'\n" +"as argument. Both can be either Python functions or directly C\n" +"functions. If 'free' is None, then no free function is called.\n" +"If both 'alloc' and 'free' are None, the default is used.\n" +"\n" +"If 'should_clear_after_alloc' is set to False, then the memory\n" +"returned by 'alloc' is assumed to be already cleared (or you are\n" +"fine with garbage); otherwise CFFI will clear it."); static PyObject *ffi_new_allocator(FFIObject *self, PyObject *args, PyObject *kwds) From noreply at buildbot.pypy.org Sun Nov 15 05:16:20 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 11:16:20 +0100 (CET) Subject: [pypy-commit] cffi static-callback: merge default Message-ID: <20151115101620.D0E2B1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2403:1b32f226fb09 Date: 2015-11-15 11:10 +0100 http://bitbucket.org/cffi/cffi/changeset/1b32f226fb09/ Log: merge default diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -361,7 +361,19 @@ &PyTuple_GET_ITEM(allocator, 1)); } -PyDoc_STRVAR(ffi_new_allocator_doc, "XXX"); +PyDoc_STRVAR(ffi_new_allocator_doc, +"Return a new allocator, i.e. a function that behaves like ffi.new()\n" +"but uses the provided low-level 'alloc' and 'free' functions.\n" +"\n" +"'alloc' is called with the size as argument. If it returns NULL, a\n" +"MemoryError is raised. 'free' is called with the result of 'alloc'\n" +"as argument. Both can be either Python functions or directly C\n" +"functions. If 'free' is None, then no free function is called.\n" +"If both 'alloc' and 'free' are None, the default is used.\n" +"\n" +"If 'should_clear_after_alloc' is set to False, then the memory\n" +"returned by 'alloc' is assumed to be already cleared (or you are\n" +"fine with garbage); otherwise CFFI will clear it."); static PyObject *ffi_new_allocator(FFIObject *self, PyObject *args, PyObject *kwds) From noreply at buildbot.pypy.org Sun Nov 15 05:16:22 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 11:16:22 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Inline documentation Message-ID: <20151115101622.B8ABF1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2404:3ce8b03837e9 Date: 2015-11-15 11:17 +0100 http://bitbucket.org/cffi/cffi/changeset/3ce8b03837e9/ Log: Inline documentation diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -745,7 +745,14 @@ from _cffi_backend.c */ PyDoc_STRVAR(ffi_call_python_doc, -"XXX document me"); +"A decorator. Attaches the decorated Python function to the C code\n" +"generated for the CFFI_CALL_PYTHON function of the same name. Calling\n" +"the C function will then invoke the Python function.\n" +"\n" +"Optional arguments: 'name' is the name of the C function, if\n" +"different from the Python function; and 'error' and 'onerror'\n" +"handle what occurs if the Python function raises an exception\n" +"(see the docs for details)."); /* forward; see call_python.c */ static PyObject *_ffi_call_python_decorator(PyObject *, PyObject *); From noreply at buildbot.pypy.org Sun Nov 15 06:26:59 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 12:26:59 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Must setup the threads also when using ffi.call_python(), not just Message-ID: <20151115112659.B89361C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2405:18f25e188dd4 Date: 2015-11-15 12:28 +0100 http://bitbucket.org/cffi/cffi/changeset/18f25e188dd4/ Log: Must setup the threads also when using ffi.call_python(), not just ffi.callback(). diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -5155,6 +5155,13 @@ } infotuple = Py_BuildValue("OOOO", ct, ob, py_rawerr, onerror_ob); Py_DECREF(py_rawerr); + +#ifdef WITH_THREAD + /* We must setup the GIL here, in case the callback is invoked in + some other non-Pythonic thread. This is the same as ctypes. */ + PyEval_InitThreads(); +#endif + return infotuple; } @@ -5200,9 +5207,6 @@ goto error; } assert(closure->user_data == infotuple); -#ifdef WITH_THREAD - PyEval_InitThreads(); -#endif return (PyObject *)cd; error: From noreply at buildbot.pypy.org Sun Nov 15 07:17:37 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 13:17:37 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: in-progress Message-ID: <20151115121737.CBEAE1C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80680:b2f90804d8eb Date: 2015-11-15 13:17 +0100 http://bitbucket.org/pypy/pypy/changeset/b2f90804d8eb/ Log: in-progress diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py new file mode 100644 --- /dev/null +++ b/pypy/module/_cffi_backend/call_python.py @@ -0,0 +1,155 @@ +import os +from rpython.rlib.objectmodel import specialize, instantiate +from rpython.rlib.rarithmetic import intmask +from rpython.rlib import jit +from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rtyper.annlowlevel import llhelper + +from pypy.interpreter.error import oefmt +from pypy.interpreter.gateway import interp2app +from pypy.module._cffi_backend import parse_c_type +from pypy.module._cffi_backend import cerrno +from pypy.module._cffi_backend import cffi_opcode +from pypy.module._cffi_backend import realize_c_type +from pypy.module._cffi_backend.realize_c_type import getop, getarg + + +STDERR = 2 +CALLPY_FN = lltype.FuncType([parse_c_type.PCALLPY, rffi.CCHARP], + lltype.Void) + + +def get_printable_location(callpython): + with callpython as ptr: + callpy = rffi.cast(parse_c_type.PCALLPY, ptr) + return 'cffi_call_python ' + rffi.charp2str(callpy.g_name) + +jitdriver = jit.JitDriver(name='cffi_call_python', + greens=['callpython'], + reds=['ll_args'], + get_printable_location=get_printable_location) + +def py_invoke_callpython(callpython, ll_args): + jitdriver.jit_merge_point(callpython=callpython, ll_args=ll_args) + # the same buffer is used both for passing arguments and the result value + callpython.do_invoke(ll_args, ll_args) + + +def _cffi_call_python(ll_callpy, ll_args): + """Invoked by the helpers generated from CFFI_CALL_PYTHON in the cdef. + + 'callpy' is a static structure that describes which of the + CFFI_CALL_PYTHON is called. It has got fields 'name' and + 'type_index' describing the function, and more reserved fields + that are initially zero. These reserved fields are set up by + ffi.call_python(), which invokes init_call_python() below. + + 'args' is a pointer to an array of 8-byte entries. Each entry + contains an argument. If an argument is less than 8 bytes, only + the part at the beginning of the entry is initialized. If an + argument is 'long double' or a struct/union, then it is passed + by reference. + + 'args' is also used as the place to write the result to. In all + cases, 'args' is at least 8 bytes in size. + """ + from pypy.module._cffi_backend.ccallback import reveal_callback + + cerrno._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) + + if not ll_callpy.c_reserved1: + # Not initialized! We don't have a space at all, so just + # write the error to the file descriptor stderr. (xxx cpython's + # cffi writes it to sys.stderr) + try: + funcname = rffi.charp2str(ll_callpy.c_name) + msg = ("CFFI_CALL_PYTHON: function %s() called, but no code was " + "attached to it yet with ffi.call_python('%s'). " + "Returning 0.\n" % (funcname, funcname)) + os.write(STDERR, msg) + except: + pass + for i in range(intmask(ll_callpy.c_size_of_result)): + ll_args[i] = '\x00' + else: + callpython = reveal_callback(ll_callpy.c_reserved1) + space = callpython.space + must_leave = False + try: + must_leave = space.threadlocals.try_enter_thread(space) + py_invoke_callpython(callpython, ll_args) + # + except Exception, e: + # oups! last-level attempt to recover. + try: + os.write(STDERR, "SystemError: call_python function raised ") + os.write(STDERR, str(e)) + os.write(STDERR, "\n") + except: + pass + callpython.write_error_return_value(ll_res) + if must_leave: + space.threadlocals.leave_thread(space) + + cerrno._errno_before(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) + + +def get_ll_cffi_call_python(): + return llhelper(lltype.Ptr(CALLPY_FN), _cffi_call_python) + + +class Cache: + def __init__(self, space): + self.cache_dict = {} + + +def callpy_deco(space, w_ffi, w_python_callable, w_name, w_error, w_onerror): + from pypy.module._cffi_backend.ffi_obj import W_FFIObject + from pypy.module._cffi_backend.ccallback import W_CallPython + + ffi = space.interp_w(W_FFIObject, w_ffi) + + if space.is_w(w_name, space.w_None): + XXX + else: + name = space.str_w(w_name) + + ctx = ffi.ctxobj.ctx + index = parse_c_type.search_in_globals(ctx, name) + if index < 0: + raise callpy_not_found(ffi, name) + + g = ctx.c_globals[index] + if getop(g.c_type_op) != cffi_opcode.OP_CALL_PYTHON: + raise callpy_not_found(ffi, name) + + w_ct = realize_c_type.realize_c_type(ffi, ctx.c_types, getarg(g.c_type_op)) + + # make a W_CallPython instance, which is nonmovable; then cast it + # to a raw pointer and assign it to the field 'reserved1' of the + # callpy object from C. We must make sure to keep it alive forever, + # or at least until ffi.call_python() is used again to change the + # binding. Note that the W_CallPython is never exposed to the user. + callpy = rffi.cast(parse_c_type.PCALLPY, g.c_address) + callpython = instantiate(W_CallPython, nonmovable=True) + callpython.__init__(space, rffi.cast(rffi.CCHARP, callpy), w_ct, + w_python_callable, w_error, w_onerror) + + key = rffi.cast(lltype.Signed, callpy) + space.fromcache(Cache).cache_dict[key] = callpython + callpy.c_reserved1 = rffi.cast(rffi.CCHARP, callpython.hide_object()) + + # return a cdata of type function-pointer, equal to the one + # obtained by reading 'lib.bar' (see lib_obj.py) + ptr = lltype.direct_fieldptr(g, 'c_size_or_direct_fn') + return w_ct.convert_to_object(rffi.cast(rffi.CCHARP, ptr)) + + +def callpy_not_found(ffi, name): + raise oefmt(ffi.w_FFIError, + "ffi.call_python('%s'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef", name) + + at specialize.memo() +def get_generic_decorator(space): + return space.wrap(interp2app(callpy_deco)) diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py --- a/pypy/module/_cffi_backend/ccallback.py +++ b/pypy/module/_cffi_backend/ccallback.py @@ -3,7 +3,7 @@ """ import sys, os, py -from rpython.rlib import clibffi, jit, jit_libffi, rgc, objectmodel +from rpython.rlib import clibffi, jit, rgc, objectmodel from rpython.rlib.objectmodel import keepalive_until_here from rpython.rtyper.lltypesystem import lltype, llmemory, rffi @@ -25,46 +25,38 @@ # we can cast to a plain VOIDP. As long as the object is not freed, # we can cast the VOIDP back to a W_CDataCallback in reveal_callback(). cdata = objectmodel.instantiate(W_CDataCallback, nonmovable=True) - gcref = rgc.cast_instance_to_gcref(cdata) - raw_cdata = rgc.hide_nonmovable_gcref(gcref) - cdata.__init__(space, ctype, w_callable, w_error, w_onerror, raw_cdata) + cdata.__init__(space, ctype, w_callable, w_error, w_onerror) return cdata def reveal_callback(raw_ptr): addr = rffi.cast(llmemory.Address, raw_ptr) gcref = rgc.reveal_gcref(addr) - return rgc.try_cast_gcref_to_instance(W_CDataCallback, gcref) + return rgc.try_cast_gcref_to_instance(W_CallPython, gcref) class Closure(object): """This small class is here to have a __del__ outside any cycle.""" - ll_error = lltype.nullptr(rffi.CCHARP.TO) # set manually - def __init__(self, ptr): self.ptr = ptr def __del__(self): clibffi.closureHeap.free(rffi.cast(clibffi.FFI_CLOSUREP, self.ptr)) - if self.ll_error: - lltype.free(self.ll_error, flavor='raw') -class W_CDataCallback(W_CData): - _immutable_fields_ = ['key_pycode'] +class W_CallPython(W_CData): + """Base class for W_CDataCallback, also used from call_python.py. + """ w_onerror = None + decode_args_from_libffi = False - def __init__(self, space, ctype, w_callable, w_error, w_onerror, - raw_cdata): - raw_closure = rffi.cast(rffi.CCHARP, clibffi.closureHeap.alloc()) - self._closure = Closure(raw_closure) - W_CData.__init__(self, space, raw_closure, ctype) + def __init__(self, space, cdata, ctype, w_callable, w_error, w_onerror): + W_CData.__init__(self, space, cdata, ctype) # if not space.is_true(space.callable(w_callable)): raise oefmt(space.w_TypeError, "expected a callable object, not %T", w_callable) self.w_callable = w_callable - self.key_pycode = space._try_fetch_pycode(w_callable) if not space.is_none(w_onerror): if not space.is_true(space.callable(w_onerror)): raise oefmt(space.w_TypeError, @@ -74,40 +66,20 @@ # fresult = self.getfunctype().ctitem size = fresult.size - if size > 0: - if fresult.is_primitive_integer and size < SIZE_OF_FFI_ARG: - size = SIZE_OF_FFI_ARG - self._closure.ll_error = lltype.malloc(rffi.CCHARP.TO, size, - flavor='raw', zero=True) - if not space.is_none(w_error): - convert_from_object_fficallback(fresult, self._closure.ll_error, - w_error) + if fresult.is_primitive_integer and size < SIZE_OF_FFI_ARG: + size = SIZE_OF_FFI_ARG + with lltype.scoped_alloc(rffi.CCHARP.TO, size, zero=True) as ll_error: + if not space.is_none(w_error): + convert_from_object_fficallback(fresult, ll_error, w_error, + self.decode_args_from_libffi) + self.error_string = rffi.charpsize2str(ll_error, size) # # We must setup the GIL here, in case the callback is invoked in # some other non-Pythonic thread. This is the same as cffi on - # CPython. + # CPython, or ctypes. if space.config.translation.thread: from pypy.module.thread.os_thread import setup_threads setup_threads(space) - # - cif_descr = self.getfunctype().cif_descr - if not cif_descr: - raise oefmt(space.w_NotImplementedError, - "%s: callback with unsupported argument or " - "return type or with '...'", self.getfunctype().name) - with self as ptr: - closure_ptr = rffi.cast(clibffi.FFI_CLOSUREP, ptr) - unique_id = rffi.cast(rffi.VOIDP, raw_cdata) - res = clibffi.c_ffi_prep_closure(closure_ptr, cif_descr.cif, - invoke_callback, - unique_id) - if rffi.cast(lltype.Signed, res) != clibffi.FFI_OK: - raise OperationError(space.w_SystemError, - space.wrap("libffi failed to build this callback")) - - def _repr_extra(self): - space = self.space - return 'calling ' + space.str_w(space.repr(self.w_callable)) def getfunctype(self): ctype = self.ctype @@ -117,43 +89,118 @@ space.wrap("expected a function ctype")) return ctype + def hide_object(self): + gcref = rgc.cast_instance_to_gcref(self) + return rgc.hide_nonmovable_gcref(gcref) + + def _repr_extra(self): + space = self.space + return 'calling ' + space.str_w(space.repr(self.w_callable)) + + def write_error_return_value(self, ll_res): + error_string = self.error_string + for i in range(len(error_string)): + ll_res[i] = error_string[i] + + def do_invoke(self, ll_res, ll_args): + space = self.space + extra_line = '' + try: + w_args = self.prepare_args_tuple(ll_args) + w_res = space.call(self.w_callable, w_args) + extra_line = "Trying to convert the result back to C:\n" + self.convert_result(ll_res, w_res) + except OperationError, e: + self.handle_applevel_exception(e, ll_res, extra_line) + @jit.unroll_safe - def invoke(self, ll_args): + def prepare_args_tuple(self, ll_args): space = self.space ctype = self.getfunctype() ctype = jit.promote(ctype) args_w = [] + decode_args_from_libffi = self.decode_args_from_libffi for i, farg in enumerate(ctype.fargs): - ll_arg = rffi.cast(rffi.CCHARP, ll_args[i]) + if decode_args_from_libffi: + ll_arg = rffi.cast(rffi.CCHARP, ll_args[i]) + else: + ll_arg = rffi.ptradd(rffi.cast(rffi.CCHARP, ll_args), 8 * i) + if farg.is_indirect_arg_for_call_python: + ll_arg = rffi.cast(rffi.CCHARPP, ll_arg)[0] args_w.append(farg.convert_to_object(ll_arg)) - return space.call(self.w_callable, space.newtuple(args_w)) + return space.newtuple(args_w) def convert_result(self, ll_res, w_res): fresult = self.getfunctype().ctitem - convert_from_object_fficallback(fresult, ll_res, w_res) + convert_from_object_fficallback(fresult, ll_res, w_res, + self.decode_args_from_libffi) def print_error(self, operr, extra_line): space = self.space operr.write_unraisable(space, "cffi callback ", self.w_callable, with_traceback=True, extra_line=extra_line) - def write_error_return_value(self, ll_res): - fresult = self.getfunctype().ctitem - if fresult.size > 0: - misc._raw_memcopy(self._closure.ll_error, ll_res, fresult.size) - keepalive_until_here(self) # to keep self._closure.ll_error alive + @jit.dont_look_inside + def handle_applevel_exception(self, e, ll_res, extra_line): + space = self.space + self.write_error_return_value(ll_res) + if self.w_onerror is None: + self.print_error(e, extra_line) + else: + try: + e.normalize_exception(space) + w_t = e.w_type + w_v = e.get_w_value(space) + w_tb = space.wrap(e.get_traceback()) + w_res = space.call_function(self.w_onerror, w_t, w_v, w_tb) + if not space.is_none(w_res): + self.convert_result(ll_res, w_res) + except OperationError, e2: + # double exception! print a double-traceback... + self.print_error(e, extra_line) # original traceback + e2.write_unraisable(space, '', with_traceback=True, + extra_line="\nDuring the call to 'onerror', " + "another exception occurred:\n\n") -def convert_from_object_fficallback(fresult, ll_res, w_res): +class W_CDataCallback(W_CallPython): + _immutable_fields_ = ['key_pycode'] + decode_args_from_libffi = True + + def __init__(self, space, ctype, w_callable, w_error, w_onerror): + raw_closure = rffi.cast(rffi.CCHARP, clibffi.closureHeap.alloc()) + self._closure = Closure(raw_closure) + W_CallPython.__init__(self, space, raw_closure, ctype, + w_callable, w_error, w_onerror) + self.key_pycode = space._try_fetch_pycode(w_callable) + # + cif_descr = self.getfunctype().cif_descr + if not cif_descr: + raise oefmt(space.w_NotImplementedError, + "%s: callback with unsupported argument or " + "return type or with '...'", self.getfunctype().name) + with self as ptr: + closure_ptr = rffi.cast(clibffi.FFI_CLOSUREP, ptr) + unique_id = rffi.cast(rffi.VOIDP, self.hide_object()) + res = clibffi.c_ffi_prep_closure(closure_ptr, cif_descr.cif, + invoke_callback, + unique_id) + if rffi.cast(lltype.Signed, res) != clibffi.FFI_OK: + raise OperationError(space.w_SystemError, + space.wrap("libffi failed to build this callback")) + + +def convert_from_object_fficallback(fresult, ll_res, w_res, + encode_result_for_libffi): space = fresult.space - small_result = fresult.size < SIZE_OF_FFI_ARG - if small_result and isinstance(fresult, W_CTypeVoid): + if isinstance(fresult, W_CTypeVoid): if not space.is_w(w_res, space.w_None): raise OperationError(space.w_TypeError, space.wrap("callback with the return type 'void'" " must return None")) return # + small_result = encode_result_for_libffi and fresult.size < SIZE_OF_FFI_ARG if small_result and fresult.is_primitive_integer: # work work work around a libffi irregularity: for integer return # types we have to fill at least a complete 'ffi_arg'-sized result @@ -191,29 +238,6 @@ STDERR = 2 - at jit.dont_look_inside -def _handle_applevel_exception(callback, e, ll_res, extra_line): - space = callback.space - callback.write_error_return_value(ll_res) - if callback.w_onerror is None: - callback.print_error(e, extra_line) - else: - try: - e.normalize_exception(space) - w_t = e.w_type - w_v = e.get_w_value(space) - w_tb = space.wrap(e.get_traceback()) - w_res = space.call_function(callback.w_onerror, - w_t, w_v, w_tb) - if not space.is_none(w_res): - callback.convert_result(ll_res, w_res) - except OperationError, e2: - # double exception! print a double-traceback... - callback.print_error(e, extra_line) # original traceback - e2.write_unraisable(space, '', with_traceback=True, - extra_line="\nDuring the call to 'onerror', " - "another exception occurred:\n\n") - def get_printable_location(key_pycode): if key_pycode is None: return 'cffi_callback ' @@ -226,13 +250,7 @@ def py_invoke_callback(callback, ll_res, ll_args): jitdriver.jit_merge_point(callback=callback, ll_res=ll_res, ll_args=ll_args) - extra_line = '' - try: - w_res = callback.invoke(ll_args) - extra_line = "Trying to convert the result back to C:\n" - callback.convert_result(ll_res, w_res) - except OperationError, e: - _handle_applevel_exception(callback, e, ll_res, extra_line) + callback.do_invoke(ll_res, ll_args) def _invoke_callback(ffi_cif, ll_res, ll_args, ll_userdata): """ Callback specification. diff --git a/pypy/module/_cffi_backend/cffi1_module.py b/pypy/module/_cffi_backend/cffi1_module.py --- a/pypy/module/_cffi_backend/cffi1_module.py +++ b/pypy/module/_cffi_backend/cffi1_module.py @@ -17,12 +17,12 @@ def load_cffi1_module(space, name, path, initptr): # This is called from pypy.module.cpyext.api.load_extension_module() - from pypy.module._cffi_backend.call_python import get_cffi_call_python + from pypy.module._cffi_backend.call_python import get_ll_cffi_call_python initfunc = rffi.cast(initfunctype, initptr) with lltype.scoped_alloc(rffi.VOIDPP.TO, 16, zero=True) as p: p[0] = rffi.cast(rffi.VOIDP, VERSION_EXPORT) - p[1] = rffi.cast(rffi.VOIDP, get_cffi_call_python()) + p[1] = rffi.cast(rffi.VOIDP, get_ll_cffi_call_python()) initfunc(p) version = rffi.cast(lltype.Signed, p[0]) if not (VERSION_MIN <= version <= VERSION_MAX): diff --git a/pypy/module/_cffi_backend/ctypeobj.py b/pypy/module/_cffi_backend/ctypeobj.py --- a/pypy/module/_cffi_backend/ctypeobj.py +++ b/pypy/module/_cffi_backend/ctypeobj.py @@ -22,6 +22,7 @@ cast_anything = False is_primitive_integer = False is_nonfunc_pointer_or_array = False + is_indirect_arg_for_call_python = False kind = "?" def __init__(self, space, size, name, name_position): diff --git a/pypy/module/_cffi_backend/ctypeprim.py b/pypy/module/_cffi_backend/ctypeprim.py --- a/pypy/module/_cffi_backend/ctypeprim.py +++ b/pypy/module/_cffi_backend/ctypeprim.py @@ -424,6 +424,7 @@ class W_CTypePrimitiveLongDouble(W_CTypePrimitiveFloat): _attrs_ = [] + is_indirect_arg_for_call_python = True @jit.dont_look_inside def extra_repr(self, cdata): diff --git a/pypy/module/_cffi_backend/ctypestruct.py b/pypy/module/_cffi_backend/ctypestruct.py --- a/pypy/module/_cffi_backend/ctypestruct.py +++ b/pypy/module/_cffi_backend/ctypestruct.py @@ -18,6 +18,7 @@ class W_CTypeStructOrUnion(W_CType): _immutable_fields_ = ['alignment?', '_fields_list?[*]', '_fields_dict?', '_custom_field_pos?', '_with_var_array?'] + is_indirect_arg_for_call_python = True # three possible states: # - "opaque": for opaque C structs; self.size < 0. diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -279,6 +279,30 @@ return cbuffer.buffer(self.space, w_cdata, size) + @unwrap_spec(w_name=WrappedDefault(None), + w_error=WrappedDefault(None), + w_onerror=WrappedDefault(None)) + def descr_call_python(self, w_name, w_error, w_onerror): + """\ +A decorator. Attaches the decorated Python function to the C code +generated for the CFFI_CALL_PYTHON function of the same name. Calling +the C function will then invoke the Python function. + +Optional arguments: 'name' is the name of the C function, if +different from the Python function; and 'error' and 'onerror' +handle what occurs if the Python function raises an exception +(see the docs for details).""" + # + # returns a single-argument function + space = self.space + w_ffi = space.wrap(self) + w_decorator = call_python.get_generic_decorator(space) + return space.appexec([w_decorator, w_ffi, w_name, w_error, w_onerror], + """(decorator, ffi, name, error, onerror): + return lambda python_callable: decorator(ffi, python_callable, + name, error, onerror)""") + + @unwrap_spec(w_python_callable=WrappedDefault(None), w_error=WrappedDefault(None), w_onerror=WrappedDefault(None)) @@ -633,7 +657,7 @@ addressof = interp2app(W_FFIObject.descr_addressof), alignof = interp2app(W_FFIObject.descr_alignof), buffer = interp2app(W_FFIObject.descr_buffer), - #call_python = interp2app(W_FFIObject.descr_call_python), + call_python = interp2app(W_FFIObject.descr_call_python), callback = interp2app(W_FFIObject.descr_callback), cast = interp2app(W_FFIObject.descr_cast), dlclose = interp2app(W_FFIObject.descr_dlclose), diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -71,11 +71,11 @@ ('error_location', rffi.SIZE_T), ('error_message', rffi.CCHARP)) -CALLPY_S = rffi.CStruct('_cffi_callpy_s', - ('name', rffi.CCHARP), - ('size_of_result', rffi.SIZE_T), - ('reserved1', rffi.VOIDP), - ('reserved2', rffi.VOIDP)) +PCALLPY = rffi.CStructPtr('_cffi_callpy_s', + ('name', rffi.CCHARP), + ('size_of_result', rffi.SIZE_T), + ('reserved1', rffi.CCHARP), + ('reserved2', rffi.CCHARP)) GETCONST_S = rffi.CStruct('_cffi_getconst_s', ('value', rffi.ULONGLONG), From noreply at buildbot.pypy.org Sun Nov 15 07:30:06 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 13:30:06 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: fixes Message-ID: <20151115123006.DDAFB1C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80681:5a15e8752bc4 Date: 2015-11-15 13:30 +0100 http://bitbucket.org/pypy/pypy/changeset/5a15e8752bc4/ Log: fixes diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py --- a/pypy/module/_cffi_backend/call_python.py +++ b/pypy/module/_cffi_backend/call_python.py @@ -98,7 +98,7 @@ return llhelper(lltype.Ptr(CALLPY_FN), _cffi_call_python) -class Cache: +class KeepaliveCache: def __init__(self, space): self.cache_dict = {} @@ -110,9 +110,8 @@ ffi = space.interp_w(W_FFIObject, w_ffi) if space.is_w(w_name, space.w_None): - XXX - else: - name = space.str_w(w_name) + w_name = space.getattr(w_python_callable, space.wrap('__name__')) + name = space.str_w(w_name) ctx = ffi.ctxobj.ctx index = parse_c_type.search_in_globals(ctx, name) @@ -136,7 +135,7 @@ w_python_callable, w_error, w_onerror) key = rffi.cast(lltype.Signed, callpy) - space.fromcache(Cache).cache_dict[key] = callpython + space.fromcache(KeepaliveCache).cache_dict[key] = callpython callpy.c_reserved1 = rffi.cast(rffi.CCHARP, callpython.hide_object()) # return a cdata of type function-pointer, equal to the one diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py --- a/pypy/module/_cffi_backend/ccallback.py +++ b/pypy/module/_cffi_backend/ccallback.py @@ -47,8 +47,9 @@ class W_CallPython(W_CData): """Base class for W_CDataCallback, also used from call_python.py. """ + decode_args_from_libffi = False + error_string = '' w_onerror = None - decode_args_from_libffi = False def __init__(self, space, cdata, ctype, w_callable, w_error, w_onerror): W_CData.__init__(self, space, cdata, ctype) @@ -66,13 +67,14 @@ # fresult = self.getfunctype().ctitem size = fresult.size - if fresult.is_primitive_integer and size < SIZE_OF_FFI_ARG: - size = SIZE_OF_FFI_ARG - with lltype.scoped_alloc(rffi.CCHARP.TO, size, zero=True) as ll_error: - if not space.is_none(w_error): - convert_from_object_fficallback(fresult, ll_error, w_error, - self.decode_args_from_libffi) - self.error_string = rffi.charpsize2str(ll_error, size) + if size > 0: + if fresult.is_primitive_integer and size < SIZE_OF_FFI_ARG: + size = SIZE_OF_FFI_ARG + with lltype.scoped_alloc(rffi.CCHARP.TO, size, zero=True) as ll_err: + if not space.is_none(w_error): + convert_from_object_fficallback(fresult, ll_err, w_error, + self.decode_args_from_libffi) + self.error_string = rffi.charpsize2str(ll_err, size) # # We must setup the GIL here, in case the callback is invoked in # some other non-Pythonic thread. This is the same as cffi on diff --git a/pypy/module/_cffi_backend/newtype.py b/pypy/module/_cffi_backend/newtype.py --- a/pypy/module/_cffi_backend/newtype.py +++ b/pypy/module/_cffi_backend/newtype.py @@ -34,9 +34,11 @@ def _clean_cache(space): "NOT_RPYTHON" from pypy.module._cffi_backend.realize_c_type import RealizeCache + from pypy.module._cffi_backend.call_python import KeepaliveCache if hasattr(space, 'fromcache'): # not with the TinyObjSpace space.fromcache(UniqueCache).__init__(space) space.fromcache(RealizeCache).__init__(space) + space.fromcache(KeepaliveCache).__init__(space) # ____________________________________________________________ diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -1473,51 +1473,50 @@ assert lib.boz() is boz() is None assert seen == ["Boz", "Boz"] - def test_call_python_bogus_name(): - ffi = FFI() - ffi.cdef("int abc;") - lib = verify(ffi, 'test_call_python_bogus_name', "int abc;") + def test_call_python_bogus_name(self): + ffi, lib = self.prepare("int abc;", + 'test_call_python_bogus_name', + "int abc;") def fn(): pass - py.test.raises(ffi.error, ffi.call_python("unknown_name"), fn) - py.test.raises(ffi.error, ffi.call_python("abc"), fn) + raises(ffi.error, ffi.call_python("unknown_name"), fn) + raises(ffi.error, ffi.call_python("abc"), fn) assert lib.abc == 0 - e = py.test.raises(ffi.error, ffi.call_python("abc"), fn) + e = raises(ffi.error, ffi.call_python("abc"), fn) assert str(e.value) == ("ffi.call_python('abc'): name not found as a " "CFFI_CALL_PYTHON line from the cdef") - e = py.test.raises(ffi.error, ffi.call_python(), fn) + e = raises(ffi.error, ffi.call_python(), fn) assert str(e.value) == ("ffi.call_python('fn'): name not found as a " "CFFI_CALL_PYTHON line from the cdef") # - py.test.raises(TypeError, ffi.call_python(42), fn) - py.test.raises((TypeError, AttributeError), ffi.call_python(), "foo") + raises(TypeError, ffi.call_python(42), fn) + raises((TypeError, AttributeError), ffi.call_python(), "foo") class X: pass x = X() x.__name__ = x - py.test.raises(TypeError, ffi.call_python(), x) + raises(TypeError, ffi.call_python(), x) - def test_call_python_bogus_result_type(): - ffi = FFI() - ffi.cdef("CFFI_CALL_PYTHON void bar(int);") - lib = verify(ffi, 'test_call_python_bogus_result_type', "") - # + def test_call_python_bogus_result_type(self): + ffi, lib = self.prepare("CFFI_CALL_PYTHON void bar(int);", + 'test_call_python_bogus_result_type', + "") def bar(n): return n * 10 bar1 = ffi.call_python()(bar) - with StdErrCapture() as f: + with self.StdErrCapture() as f: res = bar1(321) assert res is None assert f.getvalue() == ( "From cffi callback %r:\n" % (bar,) + "Trying to convert the result back to C:\n" - "TypeError: callback with the return type 'void' must return None\n") + "TypeError: callback with the return type 'void' must return None\n" + ) - def test_call_python_redefine(): - ffi = FFI() - ffi.cdef("CFFI_CALL_PYTHON int bar(int);") - lib = verify(ffi, 'test_call_python_redefine', "") - # + def test_call_python_redefine(self): + ffi, lib = self.prepare("CFFI_CALL_PYTHON int bar(int);", + 'test_call_python_redefine', + "") @ffi.call_python() def bar(n): return n * 10 @@ -1528,16 +1527,14 @@ return -n assert lib.bar(42) == -42 - def test_call_python_struct(): - ffi = FFI() - ffi.cdef(""" + def test_call_python_struct(self): + ffi, lib = self.prepare(""" struct foo_s { int a, b, c; }; CFFI_CALL_PYTHON int bar(int, struct foo_s, int); CFFI_CALL_PYTHON struct foo_s baz(int, int); CFFI_CALL_PYTHON struct foo_s bok(void); - """) - lib = verify(ffi, 'test_call_python_struct', - "struct foo_s { int a, b, c; };") + """, 'test_call_python_struct', + "struct foo_s { int a, b, c; };") # @ffi.call_python() def bar(x, s, z): @@ -1559,14 +1556,12 @@ res = lib.bok() assert [res.a, res.b, res.c] == [10, 20, 30] - def test_call_python_long_double(): - ffi = FFI() - ffi.cdef(""" + def test_call_python_long_double(self): + ffi, lib = self.prepare(""" CFFI_CALL_PYTHON int bar(int, long double, int); CFFI_CALL_PYTHON long double baz(int, int); CFFI_CALL_PYTHON long double bok(void); - """) - lib = verify(ffi, 'test_call_python_long_double', "") + """, 'test_call_python_long_double', "") # @ffi.call_python() def bar(x, l, z): From noreply at buildbot.pypy.org Sun Nov 15 08:23:10 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 14:23:10 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: fix Message-ID: <20151115132310.DA08D1C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80682:9094ff805996 Date: 2015-11-15 13:35 +0100 http://bitbucket.org/pypy/pypy/changeset/9094ff805996/ Log: fix diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py --- a/pypy/module/_cffi_backend/ccallback.py +++ b/pypy/module/_cffi_backend/ccallback.py @@ -48,7 +48,6 @@ """Base class for W_CDataCallback, also used from call_python.py. """ decode_args_from_libffi = False - error_string = '' w_onerror = None def __init__(self, space, cdata, ctype, w_callable, w_error, w_onerror): @@ -67,14 +66,15 @@ # fresult = self.getfunctype().ctitem size = fresult.size - if size > 0: - if fresult.is_primitive_integer and size < SIZE_OF_FFI_ARG: - size = SIZE_OF_FFI_ARG - with lltype.scoped_alloc(rffi.CCHARP.TO, size, zero=True) as ll_err: - if not space.is_none(w_error): - convert_from_object_fficallback(fresult, ll_err, w_error, - self.decode_args_from_libffi) - self.error_string = rffi.charpsize2str(ll_err, size) + if size < 0: + size = 0 + elif fresult.is_primitive_integer and size < SIZE_OF_FFI_ARG: + size = SIZE_OF_FFI_ARG + with lltype.scoped_alloc(rffi.CCHARP.TO, size, zero=True) as ll_error: + if not space.is_none(w_error): + convert_from_object_fficallback(fresult, ll_error, w_error, + self.decode_args_from_libffi) + self.error_string = rffi.charpsize2str(ll_error, size) # # We must setup the GIL here, in case the callback is invoked in # some other non-Pythonic thread. This is the same as cffi on From noreply at buildbot.pypy.org Sun Nov 15 08:23:13 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 14:23:13 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: hg merge default Message-ID: <20151115132313.0598A1C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80683:e632713d7182 Date: 2015-11-15 13:35 +0100 http://bitbucket.org/pypy/pypy/changeset/e632713d7182/ Log: hg merge default diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.3.0 +Version: 1.3.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -2,7 +2,7 @@ from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib import rdynload, clibffi -VERSION = "1.3.0" +VERSION = "1.3.1" FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI try: diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -1,7 +1,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): From noreply at buildbot.pypy.org Sun Nov 15 08:23:15 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 14:23:15 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: Translation fixes and sharing more logic Message-ID: <20151115132315.1FA2D1C0F93@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80684:08efac09ddaa Date: 2015-11-15 14:23 +0100 http://bitbucket.org/pypy/pypy/changeset/08efac09ddaa/ Log: Translation fixes and sharing more logic diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py --- a/pypy/module/_cffi_backend/call_python.py +++ b/pypy/module/_cffi_backend/call_python.py @@ -19,22 +19,6 @@ lltype.Void) -def get_printable_location(callpython): - with callpython as ptr: - callpy = rffi.cast(parse_c_type.PCALLPY, ptr) - return 'cffi_call_python ' + rffi.charp2str(callpy.g_name) - -jitdriver = jit.JitDriver(name='cffi_call_python', - greens=['callpython'], - reds=['ll_args'], - get_printable_location=get_printable_location) - -def py_invoke_callpython(callpython, ll_args): - jitdriver.jit_merge_point(callpython=callpython, ll_args=ll_args) - # the same buffer is used both for passing arguments and the result value - callpython.do_invoke(ll_args, ll_args) - - def _cffi_call_python(ll_callpy, ll_args): """Invoked by the helpers generated from CFFI_CALL_PYTHON in the cdef. @@ -73,23 +57,9 @@ ll_args[i] = '\x00' else: callpython = reveal_callback(ll_callpy.c_reserved1) - space = callpython.space - must_leave = False - try: - must_leave = space.threadlocals.try_enter_thread(space) - py_invoke_callpython(callpython, ll_args) - # - except Exception, e: - # oups! last-level attempt to recover. - try: - os.write(STDERR, "SystemError: call_python function raised ") - os.write(STDERR, str(e)) - os.write(STDERR, "\n") - except: - pass - callpython.write_error_return_value(ll_res) - if must_leave: - space.threadlocals.leave_thread(space) + # the same buffer is used both for passing arguments and + # the result value + callpython.invoke(ll_args, ll_args) cerrno._errno_before(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) @@ -131,12 +101,12 @@ # binding. Note that the W_CallPython is never exposed to the user. callpy = rffi.cast(parse_c_type.PCALLPY, g.c_address) callpython = instantiate(W_CallPython, nonmovable=True) - callpython.__init__(space, rffi.cast(rffi.CCHARP, callpy), w_ct, - w_python_callable, w_error, w_onerror) + W_CallPython.__init__(callpython, space, rffi.cast(rffi.CCHARP, callpy), + w_ct, w_python_callable, w_error, w_onerror) key = rffi.cast(lltype.Signed, callpy) space.fromcache(KeepaliveCache).cache_dict[key] = callpython - callpy.c_reserved1 = rffi.cast(rffi.CCHARP, callpython.hide_object()) + callpy.c_reserved1 = callpython.hide_object() # return a cdata of type function-pointer, equal to the one # obtained by reading 'lib.bar' (see lib_obj.py) diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py --- a/pypy/module/_cffi_backend/ccallback.py +++ b/pypy/module/_cffi_backend/ccallback.py @@ -8,7 +8,7 @@ from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from pypy.interpreter.error import OperationError, oefmt -from pypy.module._cffi_backend import cerrno, misc +from pypy.module._cffi_backend import cerrno, misc, parse_c_type from pypy.module._cffi_backend.cdataobj import W_CData from pypy.module._cffi_backend.ctypefunc import SIZE_OF_FFI_ARG, W_CTypeFunc from pypy.module._cffi_backend.ctypeprim import W_CTypePrimitiveSigned @@ -25,7 +25,8 @@ # we can cast to a plain VOIDP. As long as the object is not freed, # we can cast the VOIDP back to a W_CDataCallback in reveal_callback(). cdata = objectmodel.instantiate(W_CDataCallback, nonmovable=True) - cdata.__init__(space, ctype, w_callable, w_error, w_onerror) + W_CDataCallback.__init__(cdata, space, ctype, + w_callable, w_error, w_onerror) return cdata def reveal_callback(raw_ptr): @@ -93,7 +94,8 @@ def hide_object(self): gcref = rgc.cast_instance_to_gcref(self) - return rgc.hide_nonmovable_gcref(gcref) + raw = rgc.hide_nonmovable_gcref(gcref) + return rffi.cast(rffi.VOIDP, raw) def _repr_extra(self): space = self.space @@ -104,6 +106,35 @@ for i in range(len(error_string)): ll_res[i] = error_string[i] + def invoke(self, ll_res, ll_args): + space = self.space + must_leave = False + try: + must_leave = space.threadlocals.try_enter_thread(space) + self.py_invoke(ll_res, ll_args) + # + except Exception, e: + # oups! last-level attempt to recover. + try: + os.write(STDERR, "SystemError: callback raised ") + os.write(STDERR, str(e)) + os.write(STDERR, "\n") + except: + pass + self.write_error_return_value(ll_res) + if must_leave: + space.threadlocals.leave_thread(space) + + def py_invoke(self, ll_res, ll_args): + # For W_CallPython only; overridden in W_CDataCallback. Note + # that the details of the two jitdrivers differ. For + # W_CallPython, it depends on the identity of 'self', which + # means every @ffi.call_python() gets its own machine code, + # which sounds reasonable here. Moreover, 'll_res' is ignored + # as it is always equal to 'll_args'. + jitdriver2.jit_merge_point(callpython=self, ll_args=ll_args) + self.do_invoke(ll_args, ll_args) + def do_invoke(self, ll_res, ll_args): space = self.space extra_line = '' @@ -124,9 +155,9 @@ decode_args_from_libffi = self.decode_args_from_libffi for i, farg in enumerate(ctype.fargs): if decode_args_from_libffi: - ll_arg = rffi.cast(rffi.CCHARP, ll_args[i]) + ll_arg = rffi.cast(rffi.CCHARPP, ll_args)[i] else: - ll_arg = rffi.ptradd(rffi.cast(rffi.CCHARP, ll_args), 8 * i) + ll_arg = rffi.ptradd(ll_args, 8 * i) if farg.is_indirect_arg_for_call_python: ll_arg = rffi.cast(rffi.CCHARPP, ll_arg)[0] args_w.append(farg.convert_to_object(ll_arg)) @@ -183,7 +214,7 @@ "return type or with '...'", self.getfunctype().name) with self as ptr: closure_ptr = rffi.cast(clibffi.FFI_CLOSUREP, ptr) - unique_id = rffi.cast(rffi.VOIDP, self.hide_object()) + unique_id = self.hide_object() res = clibffi.c_ffi_prep_closure(closure_ptr, cif_descr.cif, invoke_callback, unique_id) @@ -191,6 +222,12 @@ raise OperationError(space.w_SystemError, space.wrap("libffi failed to build this callback")) + def py_invoke(self, ll_res, ll_args): + jitdriver1.jit_merge_point(callback=self, + ll_res=ll_res, + ll_args=ll_args) + self.do_invoke(ll_res, ll_args) + def convert_from_object_fficallback(fresult, ll_res, w_res, encode_result_for_libffi): @@ -240,21 +277,30 @@ STDERR = 2 -def get_printable_location(key_pycode): +# jitdrivers, for both W_CDataCallback and W_CallPython + +def get_printable_location1(key_pycode): if key_pycode is None: return 'cffi_callback ' return 'cffi_callback ' + key_pycode.get_repr() -jitdriver = jit.JitDriver(name='cffi_callback', - greens=['callback.key_pycode'], - reds=['ll_res', 'll_args', 'callback'], - get_printable_location=get_printable_location) +jitdriver1 = jit.JitDriver(name='cffi_callback', + greens=['callback.key_pycode'], + reds=['ll_res', 'll_args', 'callback'], + get_printable_location=get_printable_location1) -def py_invoke_callback(callback, ll_res, ll_args): - jitdriver.jit_merge_point(callback=callback, ll_res=ll_res, ll_args=ll_args) - callback.do_invoke(ll_res, ll_args) +def get_printable_location2(callpython): + with callpython as ptr: + callpy = rffi.cast(parse_c_type.PCALLPY, ptr) + return 'cffi_call_python ' + rffi.charp2str(callpy.c_name) -def _invoke_callback(ffi_cif, ll_res, ll_args, ll_userdata): +jitdriver2 = jit.JitDriver(name='cffi_call_python', + greens=['callpython'], + reds=['ll_args'], + get_printable_location=get_printable_location2) + + +def invoke_callback(ffi_cif, ll_res, ll_args, ll_userdata): """ Callback specification. ffi_cif - something ffi specific, don't care ll_args - rffi.VOIDPP - pointer to array of pointers to args @@ -262,6 +308,7 @@ ll_userdata - a special structure which holds necessary information (what the real callback is for example), casted to VOIDP """ + cerrno._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) ll_res = rffi.cast(rffi.CCHARP, ll_res) callback = reveal_callback(ll_userdata) if callback is None: @@ -274,27 +321,6 @@ # In this case, we don't even know how big ll_res is. Let's assume # it is just a 'ffi_arg', and store 0 there. misc._raw_memclear(ll_res, SIZE_OF_FFI_ARG) - return - # - space = callback.space - must_leave = False - try: - must_leave = space.threadlocals.try_enter_thread(space) - py_invoke_callback(callback, ll_res, ll_args) - # - except Exception, e: - # oups! last-level attempt to recover. - try: - os.write(STDERR, "SystemError: callback raised ") - os.write(STDERR, str(e)) - os.write(STDERR, "\n") - except: - pass - callback.write_error_return_value(ll_res) - if must_leave: - space.threadlocals.leave_thread(space) - -def invoke_callback(ffi_cif, ll_res, ll_args, ll_userdata): - cerrno._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) - _invoke_callback(ffi_cif, ll_res, ll_args, ll_userdata) + else: + callback.invoke(ll_res, rffi.cast(rffi.CCHARP, ll_args)) cerrno._errno_before(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -74,8 +74,8 @@ PCALLPY = rffi.CStructPtr('_cffi_callpy_s', ('name', rffi.CCHARP), ('size_of_result', rffi.SIZE_T), - ('reserved1', rffi.CCHARP), - ('reserved2', rffi.CCHARP)) + ('reserved1', rffi.VOIDP), + ('reserved2', rffi.VOIDP)) GETCONST_S = rffi.CStruct('_cffi_getconst_s', ('value', rffi.ULONGLONG), From noreply at buildbot.pypy.org Sun Nov 15 11:12:48 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 17:12:48 +0100 (CET) Subject: [pypy-commit] pypy default: test, fix deprecated use of arr([True]) Message-ID: <20151115161248.683A21C11B3@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80685:4b5c840d0da2 Date: 2015-11-15 18:06 +0200 http://bitbucket.org/pypy/pypy/changeset/4b5c840d0da2/ Log: test, fix deprecated use of arr([True]) diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -684,8 +684,9 @@ arr_iter, arr_state = arr.create_iter() arr_dtype = arr.get_dtype() index_dtype = index.get_dtype() - # XXX length of shape of index as well? - while not index_iter.done(index_state): + # support the deprecated form where arr([True]) will return arr[0, ...] + # by iterating over res_iter, not index_iter + while not res_iter.done(res_state): getitem_filter_driver.jit_merge_point(shapelen=shapelen, index_dtype=index_dtype, arr_dtype=arr_dtype, diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -2238,6 +2238,9 @@ c = array([True,False,True],bool) b = a[c] assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all() + c = array([True]) + b = a[c] + assert b.shape == (1, 3) def test_bool_array_index_setitem(self): from numpy import arange, array From noreply at buildbot.pypy.org Sun Nov 15 11:12:52 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 17:12:52 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: merge default into branch Message-ID: <20151115161252.DFDD01C11B3@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80686:9286403425c3 Date: 2015-11-15 18:07 +0200 http://bitbucket.org/pypy/pypy/changeset/9286403425c3/ Log: merge default into branch diff too long, truncating to 2000 out of 4464 lines diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.3.0 +Version: 1.3.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -514,12 +514,17 @@ if self.baseinttype is not None: return self.baseinttype.get_cached_btype(ffi, finishlist) # + from . import api if self.enumvalues: smallest_value = min(self.enumvalues) largest_value = max(self.enumvalues) else: - smallest_value = 0 - largest_value = 0 + import warnings + warnings.warn("%r has no values explicitly defined; next version " + "will refuse to guess which integer type it is " + "meant to be (unsigned/signed, int/long)" + % self._get_c_name()) + smallest_value = largest_value = 0 if smallest_value < 0: # needs a signed type sign = 1 candidate1 = PrimitiveType("int") diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -29,3 +29,7 @@ Support common use-cases for __array_interface__, passes upstream tests +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -28,7 +28,6 @@ """This is the abstract root class of all wrapped objects that live in a 'normal' object space like StdObjSpace.""" __slots__ = () - _settled_ = True user_overridden_class = False def getdict(self, space): diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -2,7 +2,7 @@ from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib import rdynload, clibffi -VERSION = "1.3.0" +VERSION = "1.3.1" FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI try: diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -1,7 +1,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): diff --git a/pypy/module/_minimal_curses/interp_curses.py b/pypy/module/_minimal_curses/interp_curses.py --- a/pypy/module/_minimal_curses/interp_curses.py +++ b/pypy/module/_minimal_curses/interp_curses.py @@ -13,7 +13,7 @@ def __init__(self, msg): self.msg = msg -from rpython.annotator.description import FORCE_ATTRIBUTES_INTO_CLASSES +from rpython.annotator.classdesc import FORCE_ATTRIBUTES_INTO_CLASSES from rpython.annotator.model import SomeString # this is necessary due to annmixlevel diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py --- a/pypy/module/_multiprocessing/interp_win32.py +++ b/pypy/module/_multiprocessing/interp_win32.py @@ -17,7 +17,7 @@ NMPWAIT_WAIT_FOREVER ERROR_PIPE_CONNECTED ERROR_SEM_TIMEOUT ERROR_PIPE_BUSY ERROR_NO_SYSTEM_RESOURCES ERROR_BROKEN_PIPE ERROR_MORE_DATA - ERROR_ALREADY_EXISTS + ERROR_ALREADY_EXISTS ERROR_NO_DATA """.split() class CConfig: diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -5,10 +5,23 @@ from rpython.rlib import rdtoa from rpython.rlib import rfloat from rpython.rlib import rposix, jit +from rpython.rlib.rarithmetic import intmask from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem import rffi +# PyOS_double_to_string's "type", if non-NULL, will be set to one of: +Py_DTST_FINITE = 0 +Py_DTST_INFINITE = 1 +Py_DTST_NAN = 2 + +# Match the "type" back to values in CPython +DOUBLE_TO_STRING_TYPES_MAP = { + rfloat.DIST_FINITE: Py_DTST_FINITE, + rfloat.DIST_INFINITY: Py_DTST_INFINITE, + rfloat.DIST_NAN: Py_DTST_NAN +} + @cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0) @jit.dont_look_inside # direct use of _get_errno() def PyOS_string_to_double(space, s, endptr, w_overflow_exception): @@ -68,3 +81,42 @@ finally: if not user_endptr: lltype.free(endptr, flavor='raw') + + at cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP) +def PyOS_double_to_string(space, val, format_code, precision, flags, ptype): + """Convert a double val to a string using supplied + format_code, precision, and flags. + + format_code must be one of 'e', 'E', 'f', 'F', + 'g', 'G' or 'r'. For 'r', the supplied precision + must be 0 and is ignored. The 'r' format code specifies the + standard repr() format. + + flags can be zero or more of the values Py_DTSF_SIGN, + Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together: + + Py_DTSF_SIGN means to always precede the returned string with a sign + character, even if val is non-negative. + + Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look + like an integer. + + Py_DTSF_ALT means to apply "alternate" formatting rules. See the + documentation for the PyOS_snprintf() '#' specifier for + details. + + If ptype is non-NULL, then the value it points to will be set to one of + Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that + val is a finite number, an infinite number, or not a number, respectively. + + The return value is a pointer to buffer with the converted string or + NULL if the conversion failed. The caller is responsible for freeing the + returned string by calling PyMem_Free(). + """ + buffer, rtype = rfloat.double_to_string(val, format_code, + intmask(precision), + intmask(flags)) + if ptype != lltype.nullptr(rffi.INTP.TO): + ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) + bufp = rffi.str2charp(buffer) + return bufp diff --git a/pypy/module/cpyext/test/test_pystrtod.py b/pypy/module/cpyext/test/test_pystrtod.py --- a/pypy/module/cpyext/test/test_pystrtod.py +++ b/pypy/module/cpyext/test/test_pystrtod.py @@ -1,5 +1,6 @@ import math +from pypy.module.cpyext import pystrtod from pypy.module.cpyext.test.test_api import BaseApiTest from rpython.rtyper.lltypesystem import rffi from rpython.rtyper.lltypesystem import lltype @@ -91,3 +92,76 @@ api.PyErr_Clear() rffi.free_charp(s) lltype.free(endp, flavor='raw') + + +class TestPyOS_double_to_string(BaseApiTest): + + def test_format_code(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(150.0, 'e', 1, 0, ptype) + assert '1.5e+02' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_precision(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3.14159269397, 'g', 5, 0, ptype) + assert '3.1416' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_sign(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(-3.14, 'g', 3, 1, ptype) + assert '-3.14' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_add_dot_0(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3, 'g', 5, 2, ptype) + assert '3.0' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_alt(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(314., 'g', 3, 4, ptype) + assert '314.' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_nan(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(float('nan'), 'g', 3, 4, ptype) + assert 'nan' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_NAN == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_infinity(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(1e200 * 1e200, 'g', 0, 0, ptype) + assert 'inf' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_INFINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_null(self, api): + ptype = lltype.nullptr(rffi.INTP.TO) + r = api.PyOS_double_to_string(3.14, 'g', 3, 0, ptype) + assert '3.14' == rffi.charp2str(r) + assert ptype == lltype.nullptr(rffi.INTP.TO) + rffi.free_charp(r) \ No newline at end of file diff --git a/pypy/module/marshal/interp_marshal.py b/pypy/module/marshal/interp_marshal.py --- a/pypy/module/marshal/interp_marshal.py +++ b/pypy/module/marshal/interp_marshal.py @@ -156,9 +156,6 @@ put_tuple_w(TYPE, tuple_w) puts tuple_w, an unwrapped list of wrapped objects """ - # _annspecialcase_ = "specialize:ctr_location" # polymorphic - # does not work with subclassing - def __init__(self, space, writer, version): self.space = space ## self.put = putfunc diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -684,8 +684,9 @@ arr_iter, arr_state = arr.create_iter() arr_dtype = arr.get_dtype() index_dtype = index.get_dtype() - # XXX length of shape of index as well? - while not index_iter.done(index_state): + # support the deprecated form where arr([True]) will return arr[0, ...] + # by iterating over res_iter, not index_iter + while not res_iter.done(res_state): getitem_filter_driver.jit_merge_point(shapelen=shapelen, index_dtype=index_dtype, arr_dtype=arr_dtype, diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -2235,6 +2235,9 @@ c = array([True,False,True],bool) b = a[c] assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all() + c = array([True]) + b = a[c] + assert b.shape == (1, 3) def test_bool_array_index_setitem(self): from numpy import arange, array diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1336,7 +1336,8 @@ # these depend on user-defined data, so should not be shared assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo") assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*") - assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") + # the following test is an opaque enum, which we no longer support + #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") # sanity check: twice 'ffi1' assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *") @@ -1348,6 +1349,17 @@ assert ffi.getctype("pe") == 'e *' assert ffi.getctype("e1*") == 'e1 *' + def test_opaque_enum(self): + ffi = FFI(backend=self.Backend()) + ffi.cdef("enum foo;") + from cffi import __version_info__ + if __version_info__ < (1, 4): + py.test.skip("re-enable me in version 1.4") + e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) + assert str(e.value) == ( + "'enum foo' has no values explicitly defined: refusing to guess " + "which integer type it is meant to be (unsigned/signed, int/long)") + def test_new_ctype(self): ffi = FFI(backend=self.Backend()) p = ffi.new("int *") diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -1231,6 +1231,21 @@ def setitem(self, index, char): self.data[index] = char + def getslice(self, start, stop, step, size): + if size == 0: + return "" + if step == 1: + assert 0 <= start <= stop + if start == 0 and stop == len(self.data): + return "".join(self.data) + return "".join(self.data[start:stop]) + return Buffer.getslice(self, start, stop, step, size) + + def setslice(self, start, string): + # No bounds checks. + for i in range(len(string)): + self.data[start + i] = string[i] + @specialize.argtype(1) def _memcmp(selfvalue, buffer, length): diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py --- a/pypy/objspace/std/test/test_tupleobject.py +++ b/pypy/objspace/std/test/test_tupleobject.py @@ -413,8 +413,9 @@ from __pypy__ import specialized_zip_2_lists except ImportError: specialized_zip_2_lists = zip - raises(TypeError, specialized_zip_2_lists, [], ()) - raises(TypeError, specialized_zip_2_lists, (), []) + else: + raises(TypeError, specialized_zip_2_lists, [], ()) + raises(TypeError, specialized_zip_2_lists, (), []) assert specialized_zip_2_lists([], []) == [ ] assert specialized_zip_2_lists([2, 3], []) == [ diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -2,6 +2,7 @@ from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant from rpython.annotator import specialize +from rpython.annotator.classdesc import InstanceSource, ClassDef @@ -20,7 +21,6 @@ def specialize__wrap(self, funcdesc, args_s): from pypy.interpreter.baseobjspace import W_Root - from rpython.annotator.classdef import ClassDef W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root) typ = args_s[1].knowntype if isinstance(typ, ClassDef): @@ -50,54 +50,34 @@ typ = (None, str) return funcdesc.cachedgraph(typ) - def _remember_immutable(self, t, cached): - # for jit benefit - if cached not in t._immutable_fields_: # accessed this way just - # for convenience - t._immutable_fields_.append(cached) - - def attach_lookup(self, t, attr): - cached = "cached_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup(attr)) - return True - return False - - def attach_lookup_in_type_where(self, t, attr): - cached = "cached_where_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup_where(attr)) - return True - return False - def consider_lookup(self, bookkeeper, attr): - from rpython.annotator.classdef import InstanceSource assert attr not in self.lookups from pypy.objspace.std import typeobject cached = "cached_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant(None) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups[attr] = True def consider_lookup_in_type_where(self, bookkeeper, attr): - from rpython.annotator.classdef import InstanceSource assert attr not in self.lookups_where from pypy.objspace.std import typeobject cached = "cached_where_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant((None, None)) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup_in_type_where(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup_where(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups_where[attr] = True @@ -135,18 +115,19 @@ def event(self, bookkeeper, what, x): from pypy.objspace.std import typeobject if isinstance(x, typeobject.W_TypeObject): - from rpython.annotator.classdef import InstanceSource clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) self.pypytypes[x] = True #print "TYPE", x for attr in self.lookups: - if attr and self.attach_lookup(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_%s" % attr + setattr(x, cached, x._lookup(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) for attr in self.lookups_where: - if attr and self.attach_lookup_in_type_where(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_where_%s" % attr + setattr(x, cached, x._lookup_where(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) return diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -14,8 +14,8 @@ SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint, s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked, - SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty, AnnotatorError) -from rpython.annotator.classdef import InstanceSource, ClassDef + SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty) +from rpython.annotator.classdesc import ClassDef, ClassDesc from rpython.annotator.listdef import ListDef, ListItem from rpython.annotator.dictdef import DictDef from rpython.annotator import description @@ -23,7 +23,6 @@ from rpython.annotator.argument import simple_args from rpython.rlib.objectmodel import r_dict, r_ordereddict, Symbolic from rpython.tool.algo.unionfind import UnionFind -from rpython.tool.flattenrec import FlattenRecursion from rpython.rtyper import extregistry @@ -163,9 +162,7 @@ s_callable.consider_call_site(args, s_result, call_op) def getuniqueclassdef(self, cls): - """Get the ClassDef associated with the given user cls. - Avoid using this! It breaks for classes that must be specialized. - """ + """Get the ClassDef associated with the given user cls.""" assert cls is not object desc = self.getdesc(cls) return desc.getuniqueclassdef() @@ -334,8 +331,9 @@ and x.__class__.__module__ != '__builtin__': if hasattr(x, '_cleanup_'): x._cleanup_() - self.see_mutable(x) - result = SomeInstance(self.getuniqueclassdef(x.__class__)) + classdef = self.getuniqueclassdef(x.__class__) + classdef.see_instance(x) + result = SomeInstance(classdef) elif x is None: return s_None else: @@ -362,7 +360,7 @@ if pyobj.__module__ == '__builtin__': # avoid making classdefs for builtin types result = self.getfrozen(pyobj) else: - result = description.ClassDesc(self, pyobj) + result = ClassDesc(self, pyobj) elif isinstance(pyobj, types.MethodType): if pyobj.im_self is None: # unbound return self.getdesc(pyobj.im_func) @@ -375,11 +373,11 @@ self.getdesc(pyobj.im_self)) # frozendesc else: # regular method origincls, name = origin_of_meth(pyobj) - self.see_mutable(pyobj.im_self) + classdef = self.getuniqueclassdef(pyobj.im_class) + classdef.see_instance(pyobj.im_self) assert pyobj == getattr(pyobj.im_self, name), ( "%r is not %s.%s ??" % (pyobj, pyobj.im_self, name)) # emulate a getattr to make sure it's on the classdef - classdef = self.getuniqueclassdef(pyobj.im_class) classdef.find_attribute(name) result = self.getmethoddesc( self.getdesc(pyobj.im_func), # funcdesc @@ -400,15 +398,6 @@ self.descs[pyobj] = result return result - def have_seen(self, x): - # this might need to expand some more. - if x in self.descs: - return True - elif (x.__class__, x) in self.seen_mutable: - return True - else: - return False - def getfrozen(self, pyobj): return description.FrozenDesc(self, pyobj) @@ -425,22 +414,6 @@ self.methoddescs[key] = result return result - _see_mutable_flattenrec = FlattenRecursion() - - def see_mutable(self, x): - key = (x.__class__, x) - if key in self.seen_mutable: - return - clsdef = self.getuniqueclassdef(x.__class__) - self.seen_mutable[key] = True - self.event('mutable', x) - source = InstanceSource(self, x) - def delayed(): - for attr in source.all_instance_attributes(): - clsdef.add_source_for_attribute(attr, source) - # ^^^ can trigger reflowing - self._see_mutable_flattenrec(delayed) - def valueoftype(self, t): return annotationoftype(t, self) @@ -495,6 +468,20 @@ return s_result + def getattr_locations(self, clsdesc, attrname): + attrdef = clsdesc.classdef.find_attribute(attrname) + return attrdef.read_locations + + def record_getattr(self, clsdesc, attrname): + locations = self.getattr_locations(clsdesc, attrname) + locations.add(self.position_key) + + def update_attr(self, clsdef, attrdef): + locations = self.getattr_locations(clsdef.classdesc, attrdef.name) + for position in locations: + self.annotator.reflowfromposition(position) + attrdef.validate(homedef=clsdef) + def pbc_call(self, pbc, args, emulated=None): """Analyse a call to a SomePBC() with the given args (list of annotations). diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -5,13 +5,14 @@ from collections import OrderedDict from rpython.annotator.model import ( - SomeInteger, SomeObject, SomeChar, SomeBool, SomeString, SomeTuple, + SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple, SomeUnicodeCodePoint, SomeFloat, unionof, SomeUnicodeString, SomePBC, SomeInstance, SomeDict, SomeList, SomeWeakRef, SomeIterator, SomeOrderedDict, SomeByteArray, add_knowntypedata, s_ImpossibleValue,) from rpython.annotator.bookkeeper import ( getbookkeeper, immutablevalue, BUILTIN_ANALYZERS, analyzer_for) from rpython.annotator import description +from rpython.annotator.classdesc import ClassDef from rpython.flowspace.model import Constant import rpython.rlib.rarithmetic import rpython.rlib.objectmodel @@ -124,7 +125,6 @@ def our_issubclass(cls1, cls2): """ we're going to try to be less silly in the face of old-style classes""" - from rpython.annotator.classdef import ClassDef if cls2 is object: return True def classify(cls): diff --git a/rpython/annotator/classdef.py b/rpython/annotator/classdef.py deleted file mode 100644 --- a/rpython/annotator/classdef.py +++ /dev/null @@ -1,434 +0,0 @@ -""" -Type inference for user-defined classes. -""" -from rpython.annotator.model import ( - SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError) -from rpython.annotator import description - - -# The main purpose of a ClassDef is to collect information about class/instance -# attributes as they are really used. An Attribute object is stored in the -# most general ClassDef where an attribute of that name is read/written: -# classdef.attrs = {'attrname': Attribute()} -# -# The following invariants hold: -# -# (A) if an attribute is read/written on an instance of class A, then the -# classdef of A or a parent class of A has an Attribute object corresponding -# to that name. -# -# (I) if B is a subclass of A, then they don't both have an Attribute for the -# same name. (All information from B's Attribute must be merged into A's.) -# -# Additionally, each ClassDef records an 'attr_sources': it maps attribute names -# to a list of 'source' objects that want to provide a constant value for this -# attribute at the level of this class. The attr_sources provide information -# higher in the class hierarchy than concrete Attribute()s. It is for the case -# where (so far or definitely) the user program only reads/writes the attribute -# at the level of a subclass, but a value for this attribute could possibly -# exist in the parent class or in an instance of a parent class. -# -# The point of not automatically forcing the Attribute instance up to the -# parent class which has a class attribute of the same name is apparent with -# multiple subclasses: -# -# A -# attr=s1 -# / \ -# / \ -# B C -# attr=s2 attr=s3 -# -# XXX this does not seem to be correct, but I don't know how to phrase -# it correctly. See test_specific_attributes in test_annrpython -# -# In this case, as long as 'attr' is only read/written from B or C, the -# Attribute on B says that it can be 's1 or s2', and the Attribute on C says -# it can be 's1 or s3'. Merging them into a single Attribute on A would give -# the more imprecise 's1 or s2 or s3'. -# -# The following invariant holds: -# -# (II) if a class A has an Attribute, the 'attr_sources' for the same name is -# empty. It is also empty on all subclasses of A. (The information goes -# into the Attribute directly in this case.) -# -# The following invariant holds: -# -# (III) for a class A, each attrsource that comes from the class (as opposed to -# from a prebuilt instance) must be merged into all Attributes of the -# same name in all subclasses of A, if any. (Parent class attributes can -# be visible in reads from instances of subclasses.) - -class Attribute(object): - # readonly-ness - # SomeThing-ness - # NB. an attribute is readonly if it is a constant class attribute. - # Both writing to the instance attribute and discovering prebuilt - # instances that have the attribute set will turn off readonly-ness. - - def __init__(self, name, bookkeeper): - assert name != '__class__' - self.name = name - self.bookkeeper = bookkeeper - self.s_value = s_ImpossibleValue - self.readonly = True - self.attr_allowed = True - self.read_locations = {} - - def add_constant_source(self, classdef, source): - s_value = source.s_get_value(classdef, self.name) - if source.instance_level: - # a prebuilt instance source forces readonly=False, see above - self.modified(classdef) - s_new_value = unionof(self.s_value, s_value) # XXX "source %r attr %s" % (source, self.name), - self.s_value = s_new_value - - def getvalue(self): - # Same as 'self.s_value' for historical reasons. - return self.s_value - - def merge(self, other, classdef='?'): - assert self.name == other.name - s_new_value = unionof(self.s_value, other.s_value) # XXX "%s attr %s" % (classdef, self.name) - self.s_value = s_new_value - if not other.readonly: - self.modified(classdef) - self.read_locations.update(other.read_locations) - - def mutated(self, homedef): # reflow from attr read positions - s_newvalue = self.getvalue() - - for position in self.read_locations: - self.bookkeeper.annotator.reflowfromposition(position) - - # check for method demotion and after-the-fact method additions - if isinstance(s_newvalue, SomePBC): - attr = self.name - if s_newvalue.getKind() == description.MethodDesc: - # is method - if homedef.classdesc.read_attribute(attr, None) is None: - if not homedef.check_missing_attribute_update(attr): - for desc in s_newvalue.descriptions: - if desc.selfclassdef is None: - if homedef.classdesc.settled: - raise AnnotatorError( - "demoting method %s to settled class " - "%s not allowed" % (self.name, homedef) - ) - break - - # check for attributes forbidden by slots or _attrs_ - if homedef.classdesc.all_enforced_attrs is not None: - if self.name not in homedef.classdesc.all_enforced_attrs: - self.attr_allowed = False - if not self.readonly: - raise NoSuchAttrError( - "the attribute %r goes here to %r, " - "but it is forbidden here" % ( - self.name, homedef)) - - def modified(self, classdef='?'): - self.readonly = False - if not self.attr_allowed: - raise NoSuchAttrError( - "Attribute %r on %r should be read-only.\n" % (self.name, - classdef) + - "This error can be caused by another 'getattr' that promoted\n" - "the attribute here; the list of read locations is:\n" + - '\n'.join([str(loc[0]) for loc in self.read_locations])) - -class ClassDef(object): - "Wraps a user class." - - def __init__(self, bookkeeper, classdesc): - self.bookkeeper = bookkeeper - self.attrs = {} # {name: Attribute} - self.classdesc = classdesc - self.name = self.classdesc.name - self.shortname = self.name.split('.')[-1] - self.subdefs = [] - self.attr_sources = {} # {name: list-of-sources} - self.read_locations_of__class__ = {} - self.repr = None - self.extra_access_sets = {} - - if classdesc.basedesc: - self.basedef = classdesc.basedesc.getuniqueclassdef() - self.basedef.subdefs.append(self) - self.basedef.see_new_subclass(self) - else: - self.basedef = None - - self.parentdefs = dict.fromkeys(self.getmro()) - - def setup(self, sources): - # collect the (supposed constant) class attributes - for name, source in sources.items(): - self.add_source_for_attribute(name, source) - if self.bookkeeper: - self.bookkeeper.event('classdef_setup', self) - - def add_source_for_attribute(self, attr, source): - """Adds information about a constant source for an attribute. - """ - for cdef in self.getmro(): - if attr in cdef.attrs: - # the Attribute() exists already for this class (or a parent) - attrdef = cdef.attrs[attr] - s_prev_value = attrdef.s_value - attrdef.add_constant_source(self, source) - # we should reflow from all the reader's position, - # but as an optimization we try to see if the attribute - # has really been generalized - if attrdef.s_value != s_prev_value: - attrdef.mutated(cdef) # reflow from all read positions - return - else: - # remember the source in self.attr_sources - sources = self.attr_sources.setdefault(attr, []) - sources.append(source) - # register the source in any Attribute found in subclasses, - # to restore invariant (III) - # NB. add_constant_source() may discover new subdefs but the - # right thing will happen to them because self.attr_sources - # was already updated - if not source.instance_level: - for subdef in self.getallsubdefs(): - if attr in subdef.attrs: - attrdef = subdef.attrs[attr] - s_prev_value = attrdef.s_value - attrdef.add_constant_source(self, source) - if attrdef.s_value != s_prev_value: - attrdef.mutated(subdef) # reflow from all read positions - - def locate_attribute(self, attr): - while True: - for cdef in self.getmro(): - if attr in cdef.attrs: - return cdef - self.generalize_attr(attr) - # the return value will likely be 'self' now, but not always -- see - # test_annrpython.test_attr_moving_from_subclass_to_class_to_parent - - def find_attribute(self, attr): - return self.locate_attribute(attr).attrs[attr] - - def __repr__(self): - return "" % (self.name,) - - def has_no_attrs(self): - for clsdef in self.getmro(): - if clsdef.attrs: - return False - return True - - def commonbase(self, other): - while other is not None and not self.issubclass(other): - other = other.basedef - return other - - def getmro(self): - while self is not None: - yield self - self = self.basedef - - def issubclass(self, otherclsdef): - return otherclsdef in self.parentdefs - - def getallsubdefs(self): - pending = [self] - seen = {} - for clsdef in pending: - yield clsdef - for sub in clsdef.subdefs: - if sub not in seen: - pending.append(sub) - seen[sub] = True - - def _generalize_attr(self, attr, s_value): - # first remove the attribute from subclasses -- including us! - # invariant (I) - subclass_attrs = [] - constant_sources = [] # [(classdef-of-origin, source)] - for subdef in self.getallsubdefs(): - if attr in subdef.attrs: - subclass_attrs.append(subdef.attrs[attr]) - del subdef.attrs[attr] - if attr in subdef.attr_sources: - # accumulate attr_sources for this attribute from all subclasses - lst = subdef.attr_sources[attr] - for source in lst: - constant_sources.append((subdef, source)) - del lst[:] # invariant (II) - - # accumulate attr_sources for this attribute from all parents, too - # invariant (III) - for superdef in self.getmro(): - if attr in superdef.attr_sources: - for source in superdef.attr_sources[attr]: - if not source.instance_level: - constant_sources.append((superdef, source)) - - # create the Attribute and do the generalization asked for - newattr = Attribute(attr, self.bookkeeper) - if s_value: - #if newattr.name == 'intval' and getattr(s_value, 'unsigned', False): - # import pdb; pdb.set_trace() - newattr.s_value = s_value - - # keep all subattributes' values - for subattr in subclass_attrs: - newattr.merge(subattr, classdef=self) - - # store this new Attribute, generalizing the previous ones from - # subclasses -- invariant (A) - self.attrs[attr] = newattr - - # add the values of the pending constant attributes - # completes invariants (II) and (III) - for origin_classdef, source in constant_sources: - newattr.add_constant_source(origin_classdef, source) - - # reflow from all read positions - newattr.mutated(self) - - def generalize_attr(self, attr, s_value=None): - # if the attribute exists in a superclass, generalize there, - # as imposed by invariant (I) - for clsdef in self.getmro(): - if attr in clsdef.attrs: - clsdef._generalize_attr(attr, s_value) - break - else: - self._generalize_attr(attr, s_value) - - def about_attribute(self, name): - """This is the interface for the code generators to ask about - the annotation given to a attribute.""" - for cdef in self.getmro(): - if name in cdef.attrs: - s_result = cdef.attrs[name].s_value - if s_result != s_ImpossibleValue: - return s_result - else: - return None - return None - - def lookup_filter(self, pbc, name=None, flags={}): - """Selects the methods in the pbc that could possibly be seen by - a lookup performed on an instance of 'self', removing the ones - that cannot appear. - """ - d = [] - uplookup = None - updesc = None - for desc in pbc.descriptions: - # pick methods but ignore already-bound methods, which can come - # from an instance attribute - if (isinstance(desc, description.MethodDesc) - and desc.selfclassdef is None): - methclassdef = desc.originclassdef - if methclassdef is not self and methclassdef.issubclass(self): - pass # subclasses methods are always candidates - elif self.issubclass(methclassdef): - # upward consider only the best match - if uplookup is None or methclassdef.issubclass(uplookup): - uplookup = methclassdef - updesc = desc - continue - # for clsdef1 >= clsdef2, we guarantee that - # clsdef1.lookup_filter(pbc) includes - # clsdef2.lookup_filter(pbc) (see formal proof...) - else: - continue # not matching - # bind the method by giving it a selfclassdef. Use the - # more precise subclass that it's coming from. - desc = desc.bind_self(methclassdef, flags) - d.append(desc) - if uplookup is not None: - d.append(updesc.bind_self(self, flags)) - - if d: - return SomePBC(d, can_be_None=pbc.can_be_None) - elif pbc.can_be_None: - return s_None - else: - return s_ImpossibleValue - - def check_missing_attribute_update(self, name): - # haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaack - # sometimes, new methods can show up on classes, added - # e.g. by W_TypeObject._freeze_() -- the multimethod - # implementations. Check that here... - found = False - parents = list(self.getmro()) - parents.reverse() - for base in parents: - if base.check_attr_here(name): - found = True - return found - - def check_attr_here(self, name): - source = self.classdesc.find_source_for(name) - if source is not None: - # oups! new attribute showed up - self.add_source_for_attribute(name, source) - # maybe it also showed up in some subclass? - for subdef in self.getallsubdefs(): - if subdef is not self: - subdef.check_attr_here(name) - return True - else: - return False - - def see_new_subclass(self, classdef): - for position in self.read_locations_of__class__: - self.bookkeeper.annotator.reflowfromposition(position) - if self.basedef is not None: - self.basedef.see_new_subclass(classdef) - - def read_attr__class__(self): - position = self.bookkeeper.position_key - self.read_locations_of__class__[position] = True - return SomePBC([subdef.classdesc for subdef in self.getallsubdefs()]) - - def _freeze_(self): - raise Exception("ClassDefs are used as knowntype for instances but cannot be used as immutablevalue arguments directly") - -# ____________________________________________________________ - -class InstanceSource(object): - instance_level = True - - def __init__(self, bookkeeper, obj): - self.bookkeeper = bookkeeper - self.obj = obj - - def s_get_value(self, classdef, name): - try: - v = getattr(self.obj, name) - except AttributeError: - all_enforced_attrs = classdef.classdesc.all_enforced_attrs - if all_enforced_attrs and name in all_enforced_attrs: - return s_ImpossibleValue - raise - s_value = self.bookkeeper.immutablevalue(v) - return s_value - - def all_instance_attributes(self): - result = getattr(self.obj, '__dict__', {}).keys() - tp = self.obj.__class__ - if isinstance(tp, type): - for basetype in tp.__mro__: - slots = basetype.__dict__.get('__slots__') - if slots: - if isinstance(slots, str): - result.append(slots) - else: - result.extend(slots) - return result - -class NoSuchAttrError(AnnotatorError): - """Raised when an attribute is found on a class where __slots__ - or _attrs_ forbits it.""" diff --git a/rpython/annotator/classdesc.py b/rpython/annotator/classdesc.py new file mode 100644 --- /dev/null +++ b/rpython/annotator/classdesc.py @@ -0,0 +1,944 @@ +""" +Type inference for user-defined classes. +""" +from __future__ import absolute_import +import types + +from rpython.flowspace.model import Constant +from rpython.tool.flattenrec import FlattenRecursion +from rpython.tool.sourcetools import func_with_new_name +from rpython.tool.uid import Hashable +from rpython.annotator.model import ( + SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError, SomeInteger, + SomeString, SomeImpossibleValue, SomeList, HarmlesslyBlocked) +from rpython.annotator.description import ( + Desc, FunctionDesc, MethodDesc, NODEFAULT) + + +# The main purpose of a ClassDef is to collect information about class/instance +# attributes as they are really used. An Attribute object is stored in the +# most general ClassDef where an attribute of that name is read/written: +# classdef.attrs = {'attrname': Attribute()} +# +# The following invariants hold: +# +# (A) if an attribute is read/written on an instance of class A, then the +# classdef of A or a parent class of A has an Attribute object corresponding +# to that name. +# +# (I) if B is a subclass of A, then they don't both have an Attribute for the +# same name. (All information from B's Attribute must be merged into A's.) +# +# Additionally, each ClassDef records an 'attr_sources': it maps attribute names +# to a list of 'source' objects that want to provide a constant value for this +# attribute at the level of this class. The attr_sources provide information +# higher in the class hierarchy than concrete Attribute()s. It is for the case +# where (so far or definitely) the user program only reads/writes the attribute +# at the level of a subclass, but a value for this attribute could possibly +# exist in the parent class or in an instance of a parent class. +# +# The point of not automatically forcing the Attribute instance up to the +# parent class which has a class attribute of the same name is apparent with +# multiple subclasses: +# +# A +# attr=s1 +# / \ +# / \ +# B C +# attr=s2 attr=s3 +# +# XXX this does not seem to be correct, but I don't know how to phrase +# it correctly. See test_specific_attributes in test_annrpython +# +# In this case, as long as 'attr' is only read/written from B or C, the +# Attribute on B says that it can be 's1 or s2', and the Attribute on C says +# it can be 's1 or s3'. Merging them into a single Attribute on A would give +# the more imprecise 's1 or s2 or s3'. +# +# The following invariant holds: +# +# (II) if a class A has an Attribute, the 'attr_sources' for the same name is +# empty. It is also empty on all subclasses of A. (The information goes +# into the Attribute directly in this case.) +# +# The following invariant holds: +# +# (III) for a class A, each attrsource that comes from the class (as opposed to +# from a prebuilt instance) must be merged into all Attributes of the +# same name in all subclasses of A, if any. (Parent class attributes can +# be visible in reads from instances of subclasses.) + +class Attribute(object): + # readonly-ness + # SomeThing-ness + # NB. an attribute is readonly if it is a constant class attribute. + # Both writing to the instance attribute and discovering prebuilt + # instances that have the attribute set will turn off readonly-ness. + + def __init__(self, name): + assert name != '__class__' + self.name = name + self.s_value = s_ImpossibleValue + self.readonly = True + self.attr_allowed = True + self.read_locations = set() + + def add_constant_source(self, classdef, source): + s_value = source.s_get_value(classdef, self.name) + if source.instance_level: + # a prebuilt instance source forces readonly=False, see above + self.modified(classdef) + s_new_value = unionof(self.s_value, s_value) + self.s_value = s_new_value + + def merge(self, other, classdef): + assert self.name == other.name + s_new_value = unionof(self.s_value, other.s_value) + self.s_value = s_new_value + if not other.readonly: + self.modified(classdef) + self.read_locations.update(other.read_locations) + + def validate(self, homedef): + s_newvalue = self.s_value + # check for after-the-fact method additions + if isinstance(s_newvalue, SomePBC): + attr = self.name + if s_newvalue.getKind() == MethodDesc: + # is method + if homedef.classdesc.read_attribute(attr, None) is None: + homedef.check_missing_attribute_update(attr) + + # check for attributes forbidden by slots or _attrs_ + if homedef.classdesc.all_enforced_attrs is not None: + if self.name not in homedef.classdesc.all_enforced_attrs: + self.attr_allowed = False + if not self.readonly: + raise NoSuchAttrError( + "the attribute %r goes here to %r, but it is " + "forbidden here" % (self.name, homedef)) + + def modified(self, classdef='?'): + self.readonly = False + if not self.attr_allowed: + from rpython.annotator.bookkeeper import getbookkeeper + bk = getbookkeeper() + classdesc = classdef.classdesc + locations = bk.getattr_locations(classdesc, self.name) + raise NoSuchAttrError( + "Attribute %r on %r should be read-only.\n" % (self.name, + classdef) + + "This error can be caused by another 'getattr' that promoted\n" + "the attribute here; the list of read locations is:\n" + + '\n'.join([str(loc[0]) for loc in locations])) + +class ClassDef(object): + "Wraps a user class." + + def __init__(self, bookkeeper, classdesc): + self.bookkeeper = bookkeeper + self.attrs = {} # {name: Attribute} + self.classdesc = classdesc + self.name = self.classdesc.name + self.shortname = self.name.split('.')[-1] + self.subdefs = [] + self.attr_sources = {} # {name: list-of-sources} + self.read_locations_of__class__ = {} + self.repr = None + self.extra_access_sets = {} + self.instances_seen = set() + + if classdesc.basedesc: + self.basedef = classdesc.basedesc.getuniqueclassdef() + self.basedef.subdefs.append(self) + self.basedef.see_new_subclass(self) + else: + self.basedef = None + + self.parentdefs = dict.fromkeys(self.getmro()) + + def setup(self, sources): + # collect the (supposed constant) class attributes + for name, source in sources.items(): + self.add_source_for_attribute(name, source) + if self.bookkeeper: + self.bookkeeper.event('classdef_setup', self) + + def s_getattr(self, attrname, flags): + attrdef = self.find_attribute(attrname) + s_result = attrdef.s_value + # hack: if s_result is a set of methods, discard the ones + # that can't possibly apply to an instance of self. + # XXX do it more nicely + if isinstance(s_result, SomePBC): + s_result = self.lookup_filter(s_result, attrname, flags) + elif isinstance(s_result, SomeImpossibleValue): + self.check_missing_attribute_update(attrname) + # blocking is harmless if the attribute is explicitly listed + # in the class or a parent class. + for basedef in self.getmro(): + if basedef.classdesc.all_enforced_attrs is not None: + if attrname in basedef.classdesc.all_enforced_attrs: + raise HarmlesslyBlocked("get enforced attr") + elif isinstance(s_result, SomeList): + s_result = self.classdesc.maybe_return_immutable_list( + attrname, s_result) + return s_result + + def add_source_for_attribute(self, attr, source): + """Adds information about a constant source for an attribute. + """ + for cdef in self.getmro(): + if attr in cdef.attrs: + # the Attribute() exists already for this class (or a parent) + attrdef = cdef.attrs[attr] + s_prev_value = attrdef.s_value + attrdef.add_constant_source(self, source) + # we should reflow from all the reader's position, + # but as an optimization we try to see if the attribute + # has really been generalized + if attrdef.s_value != s_prev_value: + self.bookkeeper.update_attr(cdef, attrdef) + return + else: + # remember the source in self.attr_sources + sources = self.attr_sources.setdefault(attr, []) + sources.append(source) + # register the source in any Attribute found in subclasses, + # to restore invariant (III) + # NB. add_constant_source() may discover new subdefs but the + # right thing will happen to them because self.attr_sources + # was already updated + if not source.instance_level: + for subdef in self.getallsubdefs(): + if attr in subdef.attrs: + attrdef = subdef.attrs[attr] + s_prev_value = attrdef.s_value + attrdef.add_constant_source(self, source) + if attrdef.s_value != s_prev_value: + self.bookkeeper.update_attr(subdef, attrdef) + + def get_owner(self, attrname): + """Return the classdef owning the attribute `attrname`.""" + for cdef in self.getmro(): + if attrname in cdef.attrs: + return cdef + else: + return None + + + def locate_attribute(self, attr): + cdef = self.get_owner(attr) + if cdef: + return cdef + else: + self._generalize_attr(attr, s_value=None) + return self + + def find_attribute(self, attr): + return self.locate_attribute(attr).attrs[attr] + + def __repr__(self): + return "" % (self.name,) + + def has_no_attrs(self): + for clsdef in self.getmro(): + if clsdef.attrs: + return False + return True + + def commonbase(self, other): + while other is not None and not self.issubclass(other): + other = other.basedef + return other + + def getmro(self): + while self is not None: + yield self + self = self.basedef + + def issubclass(self, otherclsdef): + return otherclsdef in self.parentdefs + + def getallsubdefs(self): + pending = [self] + seen = {} + for clsdef in pending: + yield clsdef + for sub in clsdef.subdefs: + if sub not in seen: + pending.append(sub) + seen[sub] = True + + def _generalize_attr(self, attr, s_value): + # create the Attribute and do the generalization asked for + newattr = Attribute(attr) + if s_value: + newattr.s_value = s_value + + # remove the attribute from subclasses -- including us! + # invariant (I) + constant_sources = [] # [(classdef-of-origin, source)] + for subdef in self.getallsubdefs(): + if attr in subdef.attrs: + subattr = subdef.attrs[attr] + newattr.merge(subattr, classdef=self) + del subdef.attrs[attr] + if attr in subdef.attr_sources: + # accumulate attr_sources for this attribute from all subclasses + lst = subdef.attr_sources[attr] + for source in lst: + constant_sources.append((subdef, source)) + del lst[:] # invariant (II) + + # accumulate attr_sources for this attribute from all parents, too + # invariant (III) + for superdef in self.getmro(): + if attr in superdef.attr_sources: + for source in superdef.attr_sources[attr]: + if not source.instance_level: + constant_sources.append((superdef, source)) + + # store this new Attribute, generalizing the previous ones from + # subclasses -- invariant (A) + self.attrs[attr] = newattr + + # add the values of the pending constant attributes + # completes invariants (II) and (III) + for origin_classdef, source in constant_sources: + newattr.add_constant_source(origin_classdef, source) + + # reflow from all read positions + self.bookkeeper.update_attr(self, newattr) + + def generalize_attr(self, attr, s_value=None): + # if the attribute exists in a superclass, generalize there, + # as imposed by invariant (I) + clsdef = self.get_owner(attr) + if clsdef: + clsdef._generalize_attr(attr, s_value) + else: + self._generalize_attr(attr, s_value) + + def about_attribute(self, name): + """This is the interface for the code generators to ask about + the annotation given to a attribute.""" + for cdef in self.getmro(): + if name in cdef.attrs: + s_result = cdef.attrs[name].s_value + if s_result != s_ImpossibleValue: + return s_result + else: + return None + return None + + def lookup_filter(self, pbc, name=None, flags={}): + """Selects the methods in the pbc that could possibly be seen by + a lookup performed on an instance of 'self', removing the ones + that cannot appear. + """ + d = [] + uplookup = None + updesc = None + for desc in pbc.descriptions: + # pick methods but ignore already-bound methods, which can come + # from an instance attribute + if (isinstance(desc, MethodDesc) and desc.selfclassdef is None): + methclassdef = desc.originclassdef + if methclassdef is not self and methclassdef.issubclass(self): + pass # subclasses methods are always candidates + elif self.issubclass(methclassdef): + # upward consider only the best match + if uplookup is None or methclassdef.issubclass(uplookup): + uplookup = methclassdef + updesc = desc + continue + # for clsdef1 >= clsdef2, we guarantee that + # clsdef1.lookup_filter(pbc) includes + # clsdef2.lookup_filter(pbc) (see formal proof...) + else: + continue # not matching + # bind the method by giving it a selfclassdef. Use the + # more precise subclass that it's coming from. + desc = desc.bind_self(methclassdef, flags) + d.append(desc) + if uplookup is not None: + d.append(updesc.bind_self(self, flags)) + + if d: + return SomePBC(d, can_be_None=pbc.can_be_None) + elif pbc.can_be_None: + return s_None + else: + return s_ImpossibleValue + + def check_missing_attribute_update(self, name): + # haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaack + # sometimes, new methods can show up on classes, added + # e.g. by W_TypeObject._freeze_() -- the multimethod + # implementations. Check that here... + found = False + parents = list(self.getmro()) + parents.reverse() + for base in parents: + if base.check_attr_here(name): + found = True + return found + + def check_attr_here(self, name): + source = self.classdesc.find_source_for(name) + if source is not None: + # oups! new attribute showed up + self.add_source_for_attribute(name, source) + # maybe it also showed up in some subclass? + for subdef in self.getallsubdefs(): + if subdef is not self: + subdef.check_attr_here(name) + return True + else: + return False + + _see_instance_flattenrec = FlattenRecursion() + + def see_instance(self, x): + assert isinstance(x, self.classdesc.pyobj) + key = Hashable(x) + if key in self.instances_seen: + return + self.instances_seen.add(key) + self.bookkeeper.event('mutable', x) + source = InstanceSource(self.bookkeeper, x) + def delayed(): + for attr in source.all_instance_attributes(): + self.add_source_for_attribute(attr, source) + # ^^^ can trigger reflowing + self._see_instance_flattenrec(delayed) + + def see_new_subclass(self, classdef): + for position in self.read_locations_of__class__: + self.bookkeeper.annotator.reflowfromposition(position) + if self.basedef is not None: + self.basedef.see_new_subclass(classdef) + + def read_attr__class__(self): + position = self.bookkeeper.position_key + self.read_locations_of__class__[position] = True + return SomePBC([subdef.classdesc for subdef in self.getallsubdefs()]) + + def _freeze_(self): + raise Exception("ClassDefs are used as knowntype for instances but " + "cannot be used as immutablevalue arguments directly") + +# ____________________________________________________________ + +class InstanceSource(object): + instance_level = True + + def __init__(self, bookkeeper, obj): + self.bookkeeper = bookkeeper + self.obj = obj + + def s_get_value(self, classdef, name): + try: + v = getattr(self.obj, name) + except AttributeError: + all_enforced_attrs = classdef.classdesc.all_enforced_attrs + if all_enforced_attrs and name in all_enforced_attrs: + return s_ImpossibleValue + raise + s_value = self.bookkeeper.immutablevalue(v) + return s_value + + def all_instance_attributes(self): + result = getattr(self.obj, '__dict__', {}).keys() + tp = self.obj.__class__ + if isinstance(tp, type): + for basetype in tp.__mro__: + slots = basetype.__dict__.get('__slots__') + if slots: + if isinstance(slots, str): + result.append(slots) + else: + result.extend(slots) + return result + +class NoSuchAttrError(AnnotatorError): + """Raised when an attribute is found on a class where __slots__ + or _attrs_ forbits it.""" + + +def is_mixin(cls): + return cls.__dict__.get('_mixin_', False) + + +class ClassDesc(Desc): + knowntype = type + instance_level = False + all_enforced_attrs = None # or a set + _detect_invalid_attrs = None + + def __init__(self, bookkeeper, cls, + name=None, basedesc=None, classdict=None): + super(ClassDesc, self).__init__(bookkeeper, cls) + if '__NOT_RPYTHON__' in cls.__dict__: + raise AnnotatorError('Bad class') + + if name is None: + name = cls.__module__ + '.' + cls.__name__ + self.name = name + self.basedesc = basedesc + if classdict is None: + classdict = {} # populated below + self.classdict = classdict # {attr: Constant-or-Desc} + if cls.__dict__.get('_annspecialcase_', ''): + raise AnnotatorError( + "Class specialization has been removed. The " + "'_annspecialcase_' class tag is now unsupported.") + self.classdef = None + + if is_mixin(cls): + raise AnnotatorError("cannot use directly the class %r because " + "it is a _mixin_" % (cls,)) + + assert cls.__module__ != '__builtin__' + baselist = list(cls.__bases__) + + # special case: skip BaseException, and pretend + # that all exceptions ultimately inherit from Exception instead + # of BaseException (XXX hack) + if cls is Exception: + baselist = [] + elif baselist == [BaseException]: + baselist = [Exception] + + immutable_fields = cls.__dict__.get('_immutable_fields_', []) + # To prevent confusion, we forbid strings. Any other bona fide sequence + # of strings is OK. + if isinstance(immutable_fields, basestring): + raise AnnotatorError( + "In class %s, '_immutable_fields_' must be a sequence of " + "attribute names, not a string." % cls) + self.immutable_fields = set(immutable_fields) + + mixins_before = [] + mixins_after = [] + base = object + for b1 in baselist: + if b1 is object: + continue + if is_mixin(b1): + if base is object: + mixins_before.append(b1) + else: + mixins_after.append(b1) + else: + assert base is object, ("multiple inheritance only supported " + "with _mixin_: %r" % (cls,)) + base = b1 + if mixins_before and mixins_after: + raise Exception("unsupported: class %r has mixin bases both" + " before and after the regular base" % (self,)) + self.add_mixins(mixins_after, check_not_in=base) + self.add_mixins(mixins_before) + self.add_sources_for_class(cls) + + if base is not object: + self.basedesc = bookkeeper.getdesc(base) + + if '__slots__' in cls.__dict__ or '_attrs_' in cls.__dict__: + attrs = {} + for decl in ('__slots__', '_attrs_'): + decl = cls.__dict__.get(decl, []) + if isinstance(decl, str): + decl = (decl,) + decl = dict.fromkeys(decl) + attrs.update(decl) + if self.basedesc is not None: + if self.basedesc.all_enforced_attrs is None: + raise Exception("%r has slots or _attrs_, " + "but not its base class" % (cls,)) + attrs.update(self.basedesc.all_enforced_attrs) + self.all_enforced_attrs = attrs + + if (self.is_builtin_exception_class() and + self.all_enforced_attrs is None): + if cls not in FORCE_ATTRIBUTES_INTO_CLASSES: + self.all_enforced_attrs = [] # no attribute allowed + + def add_source_attribute(self, name, value, mixin=False): + if isinstance(value, property): + # special case for property object + if value.fget is not None: + newname = name + '__getter__' + func = func_with_new_name(value.fget, newname) + self.add_source_attribute(newname, func, mixin) + if value.fset is not None: + newname = name + '__setter__' + func = func_with_new_name(value.fset, newname) + self.add_source_attribute(newname, func, mixin) + self.classdict[name] = Constant(value) + return + + if isinstance(value, types.FunctionType): + # for debugging + if not hasattr(value, 'class_'): + value.class_ = self.pyobj + if mixin: + # make a new copy of the FunctionDesc for this class, + # but don't specialize further for all subclasses + funcdesc = FunctionDesc(self.bookkeeper, value) + self.classdict[name] = funcdesc + return + # NB. if value is, say, AssertionError.__init__, then we + # should not use getdesc() on it. Never. The problem is + # that the py lib has its own AssertionError.__init__ which + # is of type FunctionType. But bookkeeper.immutablevalue() + # will do the right thing in s_get_value(). + if isinstance(value, staticmethod) and mixin: + # make a new copy of staticmethod + func = value.__get__(42) + value = staticmethod(func_with_new_name(func, func.__name__)) + + if type(value) in MemberDescriptorTypes: + # skip __slots__, showing up in the class as 'member' objects + return + if name == '__init__' and self.is_builtin_exception_class(): + # pretend that built-in exceptions have no __init__, + # unless explicitly specified in builtin.py + from rpython.annotator.builtin import BUILTIN_ANALYZERS + value = getattr(value, 'im_func', value) + if value not in BUILTIN_ANALYZERS: + return + self.classdict[name] = Constant(value) + + def add_mixins(self, mixins, check_not_in=object): + if not mixins: + return + A = type('tmp', tuple(mixins) + (object,), {}) + mro = A.__mro__ + assert mro[0] is A and mro[-1] is object + mro = mro[1:-1] + # + skip = set() + def add(cls): + if cls is not object: + for base in cls.__bases__: + add(base) + for name in cls.__dict__: + skip.add(name) + add(check_not_in) + # + for base in reversed(mro): + assert is_mixin(base), ( + "Mixin class %r has non mixin base class %r" % (mixins, base)) + for name, value in base.__dict__.items(): + if name in skip: + continue + self.add_source_attribute(name, value, mixin=True) + if '_immutable_fields_' in base.__dict__: + self.immutable_fields.update( + set(base.__dict__['_immutable_fields_'])) + + + def add_sources_for_class(self, cls): + for name, value in cls.__dict__.items(): + self.add_source_attribute(name, value) + + def getclassdef(self, key): + return self.getuniqueclassdef() + + def _init_classdef(self): + classdef = ClassDef(self.bookkeeper, self) + self.bookkeeper.classdefs.append(classdef) + self.classdef = classdef + + # forced attributes + cls = self.pyobj + if cls in FORCE_ATTRIBUTES_INTO_CLASSES: + for name, s_value in FORCE_ATTRIBUTES_INTO_CLASSES[cls].items(): + classdef.generalize_attr(name, s_value) + classdef.find_attribute(name).modified(classdef) + + # register all class attributes as coming from this ClassDesc + # (as opposed to prebuilt instances) + classsources = {} + for attr in self.classdict: + classsources[attr] = self # comes from this ClassDesc + classdef.setup(classsources) + # look for a __del__ method and annotate it if it's there + if '__del__' in self.classdict: + from rpython.annotator.model import s_None, SomeInstance + s_func = self.s_read_attribute('__del__') + args_s = [SomeInstance(classdef)] + s = self.bookkeeper.emulate_pbc_call(classdef, s_func, args_s) + assert s_None.contains(s) + return classdef + + def getuniqueclassdef(self): + if self.classdef is None: + self._init_classdef() + return self.classdef + + def pycall(self, whence, args, s_previous_result, op=None): + from rpython.annotator.model import SomeInstance, SomeImpossibleValue + classdef = self.getuniqueclassdef() + s_instance = SomeInstance(classdef) + # look up __init__ directly on the class, bypassing the normal + # lookup mechanisms ClassDef (to avoid influencing Attribute placement) + s_init = self.s_read_attribute('__init__') + if isinstance(s_init, SomeImpossibleValue): + # no __init__: check that there are no constructor args + if not self.is_exception_class(): + try: + args.fixedunpack(0) + except ValueError: + raise Exception("default __init__ takes no argument" + " (class %s)" % (self.name,)) + elif self.pyobj is Exception: + # check explicitly against "raise Exception, x" where x + # is a low-level exception pointer + try: + [s_arg] = args.fixedunpack(1) + except ValueError: + pass + else: + from rpython.rtyper.llannotation import SomePtr + assert not isinstance(s_arg, SomePtr) + else: + # call the constructor + args = args.prepend(s_instance) + s_init.call(args) + return s_instance + + def is_exception_class(self): + return issubclass(self.pyobj, BaseException) + + def is_builtin_exception_class(self): + if self.is_exception_class(): + if self.pyobj.__module__ == 'exceptions': + return True + if issubclass(self.pyobj, AssertionError): + return True + return False + + def lookup(self, name): + cdesc = self + while name not in cdesc.classdict: + cdesc = cdesc.basedesc + if cdesc is None: + return None + else: + return cdesc + + def get_param(self, name, default=None, inherit=True): + cls = self.pyobj + if inherit: + return getattr(cls, name, default) + else: + return cls.__dict__.get(name, default) + + def read_attribute(self, name, default=NODEFAULT): + cdesc = self.lookup(name) + if cdesc is None: + if default is NODEFAULT: + raise AttributeError + else: + return default + else: + return cdesc.classdict[name] + + def s_read_attribute(self, name): + # look up an attribute in the class + cdesc = self.lookup(name) + if cdesc is None: + return s_ImpossibleValue + else: + # delegate to s_get_value to turn it into an annotation + return cdesc.s_get_value(None, name) + + def s_get_value(self, classdef, name): + obj = self.classdict[name] + if isinstance(obj, Constant): + value = obj.value + if isinstance(value, staticmethod): # special case + value = value.__get__(42) + classdef = None # don't bind + elif isinstance(value, classmethod): + raise AnnotatorError("classmethods are not supported") + s_value = self.bookkeeper.immutablevalue(value) + if classdef is not None: + s_value = s_value.bind_callables_under(classdef, name) + elif isinstance(obj, Desc): + if classdef is not None: + obj = obj.bind_under(classdef, name) + s_value = SomePBC([obj]) + else: + raise TypeError("classdict should not contain %r" % (obj,)) + return s_value + + def create_new_attribute(self, name, value): + assert name not in self.classdict, "name clash: %r" % (name,) + self.classdict[name] = Constant(value) + + def find_source_for(self, name): + if name in self.classdict: + return self + # check whether there is a new attribute + cls = self.pyobj + if name in cls.__dict__: + self.add_source_attribute(name, cls.__dict__[name]) + if name in self.classdict: + return self + return None + + def maybe_return_immutable_list(self, attr, s_result): + # hack: 'x.lst' where lst is listed in _immutable_fields_ as + # either 'lst[*]' or 'lst?[*]' + # should really return an immutable list as a result. Implemented + # by changing the result's annotation (but not, of course, doing an + # actual copy in the rtyper). Tested in rpython.rtyper.test.test_rlist, + # test_immutable_list_out_of_instance. + if self._detect_invalid_attrs and attr in self._detect_invalid_attrs: + raise Exception("field %r was migrated to %r from a subclass in " + "which it was declared as _immutable_fields_" % + (attr, self.pyobj)) + search1 = '%s[*]' % (attr,) + search2 = '%s?[*]' % (attr,) + cdesc = self + while cdesc is not None: + immutable_fields = cdesc.immutable_fields + if immutable_fields: + if (search1 in immutable_fields or search2 in immutable_fields): + s_result.listdef.never_resize() + s_copy = s_result.listdef.offspring() + s_copy.listdef.mark_as_immutable() + # + cdesc = cdesc.basedesc + while cdesc is not None: + if cdesc._detect_invalid_attrs is None: + cdesc._detect_invalid_attrs = set() + cdesc._detect_invalid_attrs.add(attr) + cdesc = cdesc.basedesc + # + return s_copy + cdesc = cdesc.basedesc + return s_result # common case + + @staticmethod + def consider_call_site(descs, args, s_result, op): + descs[0].getcallfamily() + descs[0].mergecallfamilies(*descs[1:]) + from rpython.annotator.model import SomeInstance, SomePBC, s_None + if len(descs) == 1: + # call to a single class, look at the result annotation + # in case it was specialized + if not isinstance(s_result, SomeInstance): + raise Exception("calling a class didn't return an instance??") + classdefs = [s_result.classdef] + else: + # call to multiple classes: specialization not supported + classdefs = [desc.getuniqueclassdef() for desc in descs] + # If some of the classes have an __init__ and others not, then + # we complain, even though in theory it could work if all the + # __init__s take no argument. But it's messy to implement, so + # let's just say it is not RPython and you have to add an empty + # __init__ to your base class. + has_init = False + for desc in descs: + s_init = desc.s_read_attribute('__init__') + has_init |= isinstance(s_init, SomePBC) + basedesc = ClassDesc.getcommonbase(descs) + s_init = basedesc.s_read_attribute('__init__') + parent_has_init = isinstance(s_init, SomePBC) + if has_init and not parent_has_init: + raise AnnotatorError( + "some subclasses among %r declare __init__()," + " but not the common parent class" % (descs,)) + # make a PBC of MethodDescs, one for the __init__ of each class + initdescs = [] + for desc, classdef in zip(descs, classdefs): + s_init = desc.s_read_attribute('__init__') + if isinstance(s_init, SomePBC): + assert len(s_init.descriptions) == 1, ( + "unexpected dynamic __init__?") + initfuncdesc, = s_init.descriptions + if isinstance(initfuncdesc, FunctionDesc): + from rpython.annotator.bookkeeper import getbookkeeper + initmethdesc = getbookkeeper().getmethoddesc( + initfuncdesc, classdef, classdef, '__init__') + initdescs.append(initmethdesc) + # register a call to exactly these __init__ methods + if initdescs: + initdescs[0].mergecallfamilies(*initdescs[1:]) + MethodDesc.consider_call_site(initdescs, args, s_None, op) + + def getallbases(self): + desc = self + while desc is not None: + yield desc + desc = desc.basedesc + + @staticmethod + def getcommonbase(descs): + commondesc = descs[0] + for desc in descs[1:]: + allbases = set(commondesc.getallbases()) + while desc not in allbases: + assert desc is not None, "no common base for %r" % (descs,) + desc = desc.basedesc + commondesc = desc + return commondesc + + def rowkey(self): + return self + + def getattrfamily(self, attrname): + "Get the ClassAttrFamily object for attrname. Possibly creates one." + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + _, _, attrfamily = access_sets.find(self) + return attrfamily + + def queryattrfamily(self, attrname): + """Retrieve the ClassAttrFamily object for attrname if there is one, + otherwise return None.""" + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + try: + return access_sets[self] + except KeyError: + return None + From noreply at buildbot.pypy.org Sun Nov 15 11:12:55 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 17:12:55 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: start to add numpy-specific warnings Message-ID: <20151115161255.0BB731C11B3@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80687:37a1526c81b5 Date: 2015-11-15 17:16 +0200 http://bitbucket.org/pypy/pypy/changeset/37a1526c81b5/ Log: start to add numpy-specific warnings diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py --- a/pypy/module/micronumpy/__init__.py +++ b/pypy/module/micronumpy/__init__.py @@ -34,6 +34,7 @@ 'nditer': 'nditer.W_NDIter', 'set_docstring': 'support.descr_set_docstring', + 'VisibleDeprecationWarning': 'support.W_VisibleDeprecationWarning', } for c in ['MAXDIMS', 'CLIP', 'WRAP', 'RAISE']: interpleveldefs[c] = 'space.wrap(constants.%s)' % c diff --git a/pypy/module/micronumpy/support.py b/pypy/module/micronumpy/support.py --- a/pypy/module/micronumpy/support.py +++ b/pypy/module/micronumpy/support.py @@ -8,6 +8,17 @@ from pypy.objspace.std.typeobject import W_TypeObject from pypy.objspace.std.objspace import StdObjSpace from pypy.module.micronumpy import constants as NPY +from pypy.module.exceptions.interp_exceptions import _new_exception, W_UserWarning + +W_VisibleDeprecationWarning = _new_exception('VisibleDeprecationWarning', W_UserWarning, + """Visible deprecation warning. + + By default, python will not show deprecation warnings, so this class + can be used when a very visible warning is helpful, for example because + the usage is most likely a user bug. + + """) + def issequence_w(space, w_obj): from pypy.module.micronumpy.base import W_NDimArray diff --git a/pypy/module/micronumpy/test/test_deprecations.py b/pypy/module/micronumpy/test/test_deprecations.py new file mode 100644 --- /dev/null +++ b/pypy/module/micronumpy/test/test_deprecations.py @@ -0,0 +1,31 @@ +import py +import sys + +from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest + + +class AppTestDeprecations(BaseNumpyAppTest): + spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"]) + + def test_getitem(self): + import numpy as np + import warnings + warnings.simplefilter('error', np.VisibleDeprecationWarning) + try: + arr = np.ones((5, 4, 3)) + index = np.array([True]) + #self.assert_deprecated(arr.__getitem__, args=(index,)) + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + + index = np.array([False] * 6) + #self.assert_deprecated(arr.__getitem__, args=(index,)) + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + + index = np.zeros((4, 4), dtype=bool) + #self.assert_deprecated(arr.__getitem__, args=(index,)) + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + #self.assert_deprecated(arr.__getitem__, args=((slice(None), index),)) + raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index)) + finally: + warnings.simplefilter('default', np.VisibleDeprecationWarning) + From noreply at buildbot.pypy.org Sun Nov 15 11:41:56 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 17:41:56 +0100 (CET) Subject: [pypy-commit] pypy default: typo Message-ID: <20151115164156.4AAD71C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80688:65f9f2765e42 Date: 2015-11-15 16:40 +0100 http://bitbucket.org/pypy/pypy/changeset/65f9f2765e42/ Log: typo diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -448,7 +448,7 @@ 'alloc' is called with the size as argument. If it returns NULL, a MemoryError is raised. 'free' is called with the result of 'alloc' -as argument. Both can be either Python function or directly C +as argument. Both can be either Python functions or directly C functions. If 'free' is None, then no free function is called. If both 'alloc' and 'free' are None, the default is used. From noreply at buildbot.pypy.org Sun Nov 15 11:41:58 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 17:41:58 +0100 (CET) Subject: [pypy-commit] pypy default: "PYPYLOG=...:filename": add support for "$$" in the filename. If found, Message-ID: <20151115164158.73A3C1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80689:7cee4e7b7efd Date: 2015-11-15 17:42 +0100 http://bitbucket.org/pypy/pypy/changeset/7cee4e7b7efd/ Log: "PYPYLOG=...:filename": add support for "$$" in the filename. If found, it is replaced with the current pid. See docs in debug_print.h. diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -23,13 +23,14 @@ static char *debug_start_colors_2 = ""; static char *debug_stop_colors = ""; static char *debug_prefix = NULL; -static char *debug_filename = NULL; -static char *debug_filename_with_fork = NULL; -static void _pypy_debug_open(char *filename) +static void pypy_debug_open(void) { + char *filename = getenv("PYPYLOG"); + if (filename && filename[0]) { + char *newfilename = NULL, *doubledollar; char *colon = strchr(filename, ':'); if (filename[0] == '+') { @@ -51,11 +52,38 @@ debug_prefix[n] = '\0'; filename = colon + 1; } + doubledollar = strstr(filename, "$$"); + if (doubledollar) /* a "$$" in the filename is replaced with the pid */ + { + newfilename = malloc(strlen(filename) + 32); + if (newfilename != NULL) + { + char *p = newfilename; + memcpy(p, filename, doubledollar - filename); + p += doubledollar - filename; + sprintf(p, "%ld", (long)getpid()); + strcat(p, doubledollar + 2); + filename = newfilename; + } + } if (strcmp(filename, "-") != 0) { - debug_filename = strdup(filename); pypy_debug_file = fopen(filename, "w"); } + + if (doubledollar) + { + free(newfilename); /* if not null */ + /* the env var is kept and passed to subprocesses */ + } + else + { +#ifndef _WIN32 + unsetenv("PYPYLOG"); +#else + putenv("PYPYLOG="); +#endif + } } if (!pypy_debug_file) { @@ -67,20 +95,9 @@ debug_stop_colors = "\033[0m"; } } - if (filename) -#ifndef _WIN32 - unsetenv("PYPYLOG"); /* don't pass it to subprocesses */ -#else - putenv("PYPYLOG="); /* don't pass it to subprocesses */ -#endif debug_ready = 1; } -static void pypy_debug_open(void) -{ - _pypy_debug_open(getenv("PYPYLOG")); -} - long pypy_debug_offset(void) { if (!debug_ready) @@ -99,21 +116,19 @@ void pypy_debug_forked(long original_offset) { - if (debug_filename != NULL) + /* 'original_offset' ignored. It used to be that the forked log + files started with this offset printed out, so that we can + rebuild the tree structure. That's overkill... */ + (void)original_offset; + + if (pypy_debug_file) { - char *filename = malloc(strlen(debug_filename) + 32); fclose(pypy_debug_file); pypy_debug_file = NULL; - if (filename == NULL) - return; /* bah */ - sprintf(filename, "%s.fork%ld", debug_filename, (long)getpid()); - pypy_debug_file = fopen(filename, "w"); - if (pypy_debug_file) - fprintf(pypy_debug_file, "FORKED: %ld %s\n", original_offset, - debug_filename_with_fork ? debug_filename_with_fork - : debug_filename); - free(debug_filename_with_fork); - debug_filename_with_fork = filename; + /* if PYPYLOG was set to a name with "$$" in it, it is still + alive, and will be reopened with the new subprocess' pid as + soon as it logs anything */ + debug_ready = 0; } } diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h --- a/rpython/translator/c/src/debug_print.h +++ b/rpython/translator/c/src/debug_print.h @@ -21,6 +21,10 @@ subsections. Note that 'fname' can be '-' to send the logging data to stderr. + If 'fname' includes the substring '$$', it is replaced with the + current process id and you get the log for all subprocesses (and + forks) in different files. If 'fname' does not include '$$', it is + removed from the environment and not passed to subprocesses. */ /* macros used by the generated code */ diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -531,6 +531,7 @@ py.test.skip("requires fork()") def entry_point(argv): + print "parentpid =", os.getpid() debug_start("foo") debug_print("test line") childpid = os.fork() @@ -543,40 +544,46 @@ t, cbuilder = self.compile(entry_point) path = udir.join('test_debug_print_fork.log') out, err = cbuilder.cmdexec("", err=True, - env={'PYPYLOG': ':%s' % path}) + env={'PYPYLOG': ':%s.$$' % path}) assert not err + import time + time.sleep(0.5) # time for the forked children to finish # - f = open(str(path), 'r') + lines = out.splitlines() + assert lines[-1].startswith('parentpid = ') + parentpid = int(lines[-1][12:]) + # + f = open('%s.%d' % (path, parentpid), 'r') lines = f.readlines() f.close() assert '{foo' in lines[0] assert lines[1] == "test line\n" - offset1 = len(lines[0]) + len(lines[1]) + #offset1 = len(lines[0]) + len(lines[1]) assert lines[2].startswith('childpid = ') childpid = int(lines[2][11:]) assert childpid != 0 assert 'foo}' in lines[3] assert len(lines) == 4 # - f = open('%s.fork%d' % (path, childpid), 'r') + f = open('%s.%d' % (path, childpid), 'r') lines = f.readlines() f.close() - assert lines[0] == 'FORKED: %d %s\n' % (offset1, path) - assert lines[1] == 'childpid = 0\n' - offset2 = len(lines[0]) + len(lines[1]) - assert lines[2].startswith('childpid2 = ') - childpid2 = int(lines[2][11:]) + #assert lines[0] == 'FORKED: %d %s\n' % (offset1, path) + assert lines[0] == 'childpid = 0\n' + #offset2 = len(lines[0]) + len(lines[1]) + assert lines[1].startswith('childpid2 = ') + childpid2 = int(lines[1][11:]) assert childpid2 != 0 - assert 'foo}' in lines[3] - assert len(lines) == 4 + assert 'foo}' in lines[2] + assert len(lines) == 3 # - f = open('%s.fork%d' % (path, childpid2), 'r') + f = open('%s.%d' % (path, childpid2), 'r') lines = f.readlines() f.close() - assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid) - assert lines[1] == 'childpid2 = 0\n' - assert 'foo}' in lines[2] - assert len(lines) == 3 + #assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid) + assert lines[0] == 'childpid2 = 0\n' + assert 'foo}' in lines[1] + assert len(lines) == 2 def test_debug_flush_at_exit(self): def entry_point(argv): From noreply at buildbot.pypy.org Sun Nov 15 11:42:00 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 17:42:00 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151115164200.903171C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80690:34811652db74 Date: 2015-11-15 17:42 +0100 http://bitbucket.org/pypy/pypy/changeset/34811652db74/ Log: merge heads diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -684,8 +684,9 @@ arr_iter, arr_state = arr.create_iter() arr_dtype = arr.get_dtype() index_dtype = index.get_dtype() - # XXX length of shape of index as well? - while not index_iter.done(index_state): + # support the deprecated form where arr([True]) will return arr[0, ...] + # by iterating over res_iter, not index_iter + while not res_iter.done(res_state): getitem_filter_driver.jit_merge_point(shapelen=shapelen, index_dtype=index_dtype, arr_dtype=arr_dtype, diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -2238,6 +2238,9 @@ c = array([True,False,True],bool) b = a[c] assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all() + c = array([True]) + b = a[c] + assert b.shape == (1, 3) def test_bool_array_index_setitem(self): from numpy import arange, array From noreply at buildbot.pypy.org Sun Nov 15 12:52:21 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 18:52:21 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: prototype raising a warning, there must be a better way to subclass UserWarning Message-ID: <20151115175221.4FCD11C0ECB@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80691:65856c15caca Date: 2015-11-15 19:44 +0200 http://bitbucket.org/pypy/pypy/changeset/65856c15caca/ Log: prototype raising a warning, there must be a better way to subclass UserWarning diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -116,6 +116,13 @@ "index out of range for array")) size = loop.count_all_true(arr) if arr.ndims() == 1: + if self.ndims() > 1 and arr.get_shape()[0] != self.get_shape()[0]: + msg = ("boolean index did not match indexed array along" + " dimension 0; dimension is %d but corresponding" + " boolean dimension is %d" % (self.get_shape()[0], + arr.get_shape()[0])) + warning = space.gettypefor(support.W_VisibleDeprecationWarning) + space.warn(space.wrap(msg), warning) res_shape = [size] + self.get_shape()[1:] else: res_shape = [size] From noreply at buildbot.pypy.org Sun Nov 15 12:52:25 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 18:52:25 +0100 (CET) Subject: [pypy-commit] pypy release-4.0.x: merge default into release, update to 4.0.1 Message-ID: <20151115175225.E653A1C0ECB@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: release-4.0.x Changeset: r80692:4d03e28118eb Date: 2015-11-15 19:52 +0200 http://bitbucket.org/pypy/pypy/changeset/4d03e28118eb/ Log: merge default into release, update to 4.0.1 diff too long, truncating to 2000 out of 11235 lines diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.3.0 +Version: 1.3.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} -_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'} _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py --- a/lib_pypy/cffi/_pycparser/plyparser.py +++ b/lib_pypy/cffi/_pycparser/plyparser.py @@ -4,7 +4,7 @@ # PLYParser class and other utilites for simplifying programming # parsers with PLY # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -15,6 +15,7 @@ - Line number - (optional) column number, for the Lexer """ + __slots__ = ('file', 'line', 'column', '__weakref__') def __init__(self, file, line, column=None): self.file = file self.line = line @@ -52,4 +53,3 @@ def _parse_error(self, msg, coord): raise ParseError("%s: %s" % (coord, msg)) - diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py --- a/lib_pypy/cffi/_pycparser/yacctab.py +++ b/lib_pypy/cffi/_pycparser/yacctab.py @@ -5,9 +5,9 @@ _lr_method = 'LALR' -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87' +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b' -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),} +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): @@ -16,7 +16,7 @@ _lr_action[_x][_k] = _y del _lr_action_items -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),} +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): @@ -26,261 +26,267 @@ del _lr_goto_items _lr_productions = [ ("S' -> translation_unit_or_empty","S'",1,None,None,None), - ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41), - ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42), - ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41), - ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42), - ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41), - ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42), - ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41), - ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42), - ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41), - ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42), - ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41), - ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42), - ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41), - ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42), - ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41), - ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42), - ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41), - ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42), - ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41), - ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42), - ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41), - ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42), - ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41), - ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42), - ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41), - ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42), - ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496), - ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497), - ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505), - ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512), - ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524), - ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529), - ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','../pycparser/c_parser.py',534), - ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','../pycparser/c_parser.py',539), - ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','../pycparser/c_parser.py',544), - ('function_definition -> declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','../pycparser/c_parser.py',553), - ('function_definition -> declaration_specifiers declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','../pycparser/c_parser.py',570), - ('statement -> labeled_statement','statement',1,'p_statement','../pycparser/c_parser.py',581), - ('statement -> expression_statement','statement',1,'p_statement','../pycparser/c_parser.py',582), - ('statement -> compound_statement','statement',1,'p_statement','../pycparser/c_parser.py',583), - ('statement -> selection_statement','statement',1,'p_statement','../pycparser/c_parser.py',584), - ('statement -> iteration_statement','statement',1,'p_statement','../pycparser/c_parser.py',585), - ('statement -> jump_statement','statement',1,'p_statement','../pycparser/c_parser.py',586), - ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','../pycparser/c_parser.py',600), - ('declaration -> decl_body SEMI','declaration',2,'p_declaration','../pycparser/c_parser.py',659), - ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','../pycparser/c_parser.py',668), - ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','../pycparser/c_parser.py',669), - ('declaration_specifiers -> type_qualifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_1','../pycparser/c_parser.py',674), - ('declaration_specifiers -> type_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_2','../pycparser/c_parser.py',679), - ('declaration_specifiers -> storage_class_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_3','../pycparser/c_parser.py',684), - ('declaration_specifiers -> function_specifier declaration_specifiers_opt','declaration_specifiers',2,'p_declaration_specifiers_4','../pycparser/c_parser.py',689), - ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',694), - ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',695), - ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',696), - ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',697), - ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','../pycparser/c_parser.py',698), - ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','../pycparser/c_parser.py',703), - ('type_specifier -> VOID','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',708), - ('type_specifier -> _BOOL','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',709), - ('type_specifier -> CHAR','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',710), - ('type_specifier -> SHORT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',711), - ('type_specifier -> INT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',712), - ('type_specifier -> LONG','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',713), - ('type_specifier -> FLOAT','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',714), - ('type_specifier -> DOUBLE','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',715), - ('type_specifier -> _COMPLEX','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',716), - ('type_specifier -> SIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',717), - ('type_specifier -> UNSIGNED','type_specifier',1,'p_type_specifier_1','../pycparser/c_parser.py',718), - ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',723), - ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',724), - ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier_2','../pycparser/c_parser.py',725), - ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',730), - ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',731), - ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','../pycparser/c_parser.py',732), - ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list_1','../pycparser/c_parser.py',737), - ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list_1','../pycparser/c_parser.py',738), - ('init_declarator_list -> EQUALS initializer','init_declarator_list',2,'p_init_declarator_list_2','../pycparser/c_parser.py',748), - ('init_declarator_list -> abstract_declarator','init_declarator_list',1,'p_init_declarator_list_3','../pycparser/c_parser.py',756), - ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','../pycparser/c_parser.py',764), - ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','../pycparser/c_parser.py',765), - ('specifier_qualifier_list -> type_qualifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','../pycparser/c_parser.py',770), - ('specifier_qualifier_list -> type_specifier specifier_qualifier_list_opt','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','../pycparser/c_parser.py',775), - ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',783), - ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','../pycparser/c_parser.py',784), - ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','../pycparser/c_parser.py',793), - ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',802), - ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','../pycparser/c_parser.py',803), - ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',812), - ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','../pycparser/c_parser.py',813), - ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','../pycparser/c_parser.py',820), - ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','../pycparser/c_parser.py',821), - ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','../pycparser/c_parser.py',826), - ('struct_declaration -> specifier_qualifier_list abstract_declarator SEMI','struct_declaration',3,'p_struct_declaration_2','../pycparser/c_parser.py',864), - ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','../pycparser/c_parser.py',878), - ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','../pycparser/c_parser.py',879), - ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','../pycparser/c_parser.py',887), - ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','../pycparser/c_parser.py',892), - ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','../pycparser/c_parser.py',893), - ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',901), - ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','../pycparser/c_parser.py',902), - ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','../pycparser/c_parser.py',907), - ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',912), - ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','../pycparser/c_parser.py',913), - ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','../pycparser/c_parser.py',918), - ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','../pycparser/c_parser.py',919), - ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','../pycparser/c_parser.py',920), - ('enumerator -> ID','enumerator',1,'p_enumerator','../pycparser/c_parser.py',931), - ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','../pycparser/c_parser.py',932), - ('declarator -> direct_declarator','declarator',1,'p_declarator_1','../pycparser/c_parser.py',947), - ('declarator -> pointer direct_declarator','declarator',2,'p_declarator_2','../pycparser/c_parser.py',952), - ('declarator -> pointer TYPEID','declarator',2,'p_declarator_3','../pycparser/c_parser.py',961), - ('direct_declarator -> ID','direct_declarator',1,'p_direct_declarator_1','../pycparser/c_parser.py',972), - ('direct_declarator -> LPAREN declarator RPAREN','direct_declarator',3,'p_direct_declarator_2','../pycparser/c_parser.py',981), - ('direct_declarator -> direct_declarator LBRACKET assignment_expression_opt RBRACKET','direct_declarator',4,'p_direct_declarator_3','../pycparser/c_parser.py',986), - ('direct_declarator -> direct_declarator LBRACKET TIMES RBRACKET','direct_declarator',4,'p_direct_declarator_4','../pycparser/c_parser.py',998), - ('direct_declarator -> direct_declarator LPAREN parameter_type_list RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1008), - ('direct_declarator -> direct_declarator LPAREN identifier_list_opt RPAREN','direct_declarator',4,'p_direct_declarator_5','../pycparser/c_parser.py',1009), - ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','../pycparser/c_parser.py',1036), - ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','../pycparser/c_parser.py',1037), - ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','../pycparser/c_parser.py',1047), - ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','../pycparser/c_parser.py',1048), - ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','../pycparser/c_parser.py',1053), - ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','../pycparser/c_parser.py',1054), - ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','../pycparser/c_parser.py',1062), - ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','../pycparser/c_parser.py',1063), - ('parameter_declaration -> declaration_specifiers declarator','parameter_declaration',2,'p_parameter_declaration_1','../pycparser/c_parser.py',1072), - ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','../pycparser/c_parser.py',1083), - ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','../pycparser/c_parser.py',1113), - ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','../pycparser/c_parser.py',1114), - ('initializer -> assignment_expression','initializer',1,'p_initializer_1','../pycparser/c_parser.py',1123), - ('initializer -> brace_open initializer_list brace_close','initializer',3,'p_initializer_2','../pycparser/c_parser.py',1128), - ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','../pycparser/c_parser.py',1129), - ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','../pycparser/c_parser.py',1134), - ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','../pycparser/c_parser.py',1135), - ('designation -> designator_list EQUALS','designation',2,'p_designation','../pycparser/c_parser.py',1146), - ('designator_list -> designator','designator_list',1,'p_designator_list','../pycparser/c_parser.py',1154), - ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','../pycparser/c_parser.py',1155), - ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','../pycparser/c_parser.py',1160), - ('designator -> PERIOD identifier','designator',2,'p_designator','../pycparser/c_parser.py',1161), - ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','../pycparser/c_parser.py',1166), - ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','../pycparser/c_parser.py',1182), - ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','../pycparser/c_parser.py',1190), - ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','../pycparser/c_parser.py',1195), - ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','../pycparser/c_parser.py',1205), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','../pycparser/c_parser.py',1209), - ('direct_abstract_declarator -> LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_3','../pycparser/c_parser.py',1219), - ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','../pycparser/c_parser.py',1227), - ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','../pycparser/c_parser.py',1237), - ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','../pycparser/c_parser.py',1245), From noreply at buildbot.pypy.org Sun Nov 15 15:38:59 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 21:38:59 +0100 (CET) Subject: [pypy-commit] pypy default: document 4.0.1 release (edits welcome) Message-ID: <20151115203859.161E21C11B3@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80693:e43074b43722 Date: 2015-11-15 22:02 +0200 http://bitbucket.org/pypy/pypy/changeset/e43074b43722/ Log: document 4.0.1 release (edits welcome) diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst --- a/pypy/doc/index-of-release-notes.rst +++ b/pypy/doc/index-of-release-notes.rst @@ -6,6 +6,7 @@ .. toctree:: + release-4.0.1.rst release-4.0.0.rst release-2.6.1.rst release-2.6.0.rst diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst --- a/pypy/doc/index-of-whatsnew.rst +++ b/pypy/doc/index-of-whatsnew.rst @@ -7,6 +7,7 @@ .. toctree:: whatsnew-head.rst + whatsnew-4.0.1.rst whatsnew-4.0.0.rst whatsnew-2.6.1.rst whatsnew-2.6.0.rst diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-4.0.1.rst @@ -0,0 +1,110 @@ +========== +PyPy 4.0.1 +========== + +We have released PyPy 4.0.1, a bux-fix release after PyPy 4.0.1. We have fixed +a few critical bugs in the JIT compiled code, reported by users. We encourage +all users of PyPy to update to this version. + + +You can download the PyPy 4.0.1 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project. + +We would also like to thank our contributors and +encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ +with making RPython's JIT even better. + +CFFI +==== + +While not applicable only to PyPy, `cffi`_ is arguably our most significant +contribution to the python ecosystem. PyPy 4.0.1 ships with +`cffi-1.3.1`_ with the improvements it brings. + +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`cffi`: https://cffi.readthedocs.org +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1 +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html +.. _`numpy`: https://bitbucket.org/pypy/numpy + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), +as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. + +We also introduce `support for the 64 bit PowerPC`_ hardware, specifically +Linux running the big- and little-endian variants of ppc64. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy +.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ +.. _`dynamic languages`: http://pypyjs.org +.. _`support for the 64 bit PowerPC`: http://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html +.. _`here`: http://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html + +Other Highlights (since 4.0.0 released three weeks ago) +======================================================= + +* Bug Fixes + + * Fix a bug when unrolling double loops in JITted code + + * Fix multiple memory leaks in the ssl module, one of which affected + `cpython` as well (thanks to Alex Gaynor for pointing those out) + + * Use pkg-config to find ssl headers on OS-X + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy + +* New features: + + * Internal cleanup of RPython class handling + + * Support stackless and greenlets on PPC machines + + * Improve debug logging in subprocesses when using PYPYLOG=..:log.$$ + + * Support PyOS_double_to_string in our cpyext capi compatibility layer + +* Numpy: + + * Improve support for __array_interface__ + + * Propogate NAN mantissas through float16-float32-float64 conversions + + +* Performance improvements and refactorings: + + * Improvements in slicing byte arrays + + * Improvements in enumerate() + + * Silence some warnings while translating + +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html + +Please update, and continue to help us make PyPy better. + +Cheers + +The PyPy Team + diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-4.0.1.rst @@ -0,0 +1,35 @@ +========================= +What's new in PyPy 4.0.1 +========================= + +.. this is a revision shortly after release-4.0.0 +.. startrev: 57c9a47c70f6 + +.. branch: 2174-fix-osx-10-11-translation + +Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -2,34 +2,6 @@ What's new in PyPy 4.0.+ ========================= -.. this is a revision shortly after release-4.0.0 -.. startrev: 57c9a47c70f6 +.. this is a revision shortly after release-4.0.1 +.. startrev: 4b5c840d0da2 -.. branch: 2174-fix-osx-10-11-translation - -Use pkg-config to find ssl headers on OS-X - -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 - -.. branch: ppc-stacklet - -The PPC machines now support the _continuation module (stackless, greenlets) - -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 - -Document that libgdbm-dev is required for translation/packaging - -.. branch: propogate-nans - -Ensure that ndarray conversion from int16->float16->float32->float16->int16 -preserves all int16 values, even across nan conversions. Also fix argmax, argmin -for nan comparisons - -.. branch: array_interface - -Support common use-cases for __array_interface__, passes upstream tests - -.. branch: no-class-specialize - -Some refactoring of class handling in the annotator. -Remove class specialisation and _settled_ flag. From noreply at buildbot.pypy.org Sun Nov 15 15:39:01 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 21:39:01 +0100 (CET) Subject: [pypy-commit] pypy default: update contributors, LICENSE w/11 !!! new names Message-ID: <20151115203901.3795C1C11B3@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80694:aa81f16267c5 Date: 2015-11-15 22:32 +0200 http://bitbucket.org/pypy/pypy/changeset/aa81f16267c5/ Log: update contributors, LICENSE w/11 !!! new names diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -56,14 +56,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -87,7 +88,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -200,9 +200,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -234,6 +237,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -244,6 +248,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -253,6 +258,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -283,6 +289,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey @@ -309,13 +316,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -327,6 +337,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -26,15 +26,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann - Richard Plangger + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -170,9 +170,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -204,6 +207,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -214,6 +218,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -223,6 +228,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -280,13 +286,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -298,6 +307,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py --- a/pypy/doc/tool/makecontributor.py +++ b/pypy/doc/tool/makecontributor.py @@ -69,7 +69,9 @@ 'Rami Chowdhury': ['necaris'], 'Stanislaw Halik':['w31rd0'], 'Wenzhu Man':['wenzhu man', 'wenzhuman'], - 'Anton Gulenko':['anton gulenko'], + 'Anton Gulenko':['anton gulenko', 'anton_gulenko'], + 'Richard Lancaster':['richardlancaster'], + 'William Leslie':['William ML Leslie'], } alias_map = {} From noreply at buildbot.pypy.org Sun Nov 15 15:39:03 2015 From: noreply at buildbot.pypy.org (mattip) Date: Sun, 15 Nov 2015 21:39:03 +0100 (CET) Subject: [pypy-commit] pypy release-4.0.x: merge default into release Message-ID: <20151115203903.944301C0ECB@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: release-4.0.x Changeset: r80695:33f81c22c957 Date: 2015-11-15 22:39 +0200 http://bitbucket.org/pypy/pypy/changeset/33f81c22c957/ Log: merge default into release diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -56,14 +56,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -87,7 +88,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -200,9 +200,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -234,6 +237,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -244,6 +248,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -253,6 +258,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -283,6 +289,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey @@ -309,13 +316,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -327,6 +337,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -26,15 +26,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann - Richard Plangger + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -170,9 +170,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -204,6 +207,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -214,6 +218,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -223,6 +228,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -280,13 +286,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -298,6 +307,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst --- a/pypy/doc/index-of-release-notes.rst +++ b/pypy/doc/index-of-release-notes.rst @@ -6,6 +6,7 @@ .. toctree:: + release-4.0.1.rst release-4.0.0.rst release-2.6.1.rst release-2.6.0.rst diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst --- a/pypy/doc/index-of-whatsnew.rst +++ b/pypy/doc/index-of-whatsnew.rst @@ -7,6 +7,7 @@ .. toctree:: whatsnew-head.rst + whatsnew-4.0.1.rst whatsnew-4.0.0.rst whatsnew-2.6.1.rst whatsnew-2.6.0.rst diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-4.0.1.rst @@ -0,0 +1,110 @@ +========== +PyPy 4.0.1 +========== + +We have released PyPy 4.0.1, a bux-fix release after PyPy 4.0.1. We have fixed +a few critical bugs in the JIT compiled code, reported by users. We encourage +all users of PyPy to update to this version. + + +You can download the PyPy 4.0.1 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project. + +We would also like to thank our contributors and +encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ +with making RPython's JIT even better. + +CFFI +==== + +While not applicable only to PyPy, `cffi`_ is arguably our most significant +contribution to the python ecosystem. PyPy 4.0.1 ships with +`cffi-1.3.1`_ with the improvements it brings. + +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`cffi`: https://cffi.readthedocs.org +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1 +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html +.. _`numpy`: https://bitbucket.org/pypy/numpy + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), +as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. + +We also introduce `support for the 64 bit PowerPC`_ hardware, specifically +Linux running the big- and little-endian variants of ppc64. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy +.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ +.. _`dynamic languages`: http://pypyjs.org +.. _`support for the 64 bit PowerPC`: http://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html +.. _`here`: http://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html + +Other Highlights (since 4.0.0 released three weeks ago) +======================================================= + +* Bug Fixes + + * Fix a bug when unrolling double loops in JITted code + + * Fix multiple memory leaks in the ssl module, one of which affected + `cpython` as well (thanks to Alex Gaynor for pointing those out) + + * Use pkg-config to find ssl headers on OS-X + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy + +* New features: + + * Internal cleanup of RPython class handling + + * Support stackless and greenlets on PPC machines + + * Improve debug logging in subprocesses when using PYPYLOG=..:log.$$ + + * Support PyOS_double_to_string in our cpyext capi compatibility layer + +* Numpy: + + * Improve support for __array_interface__ + + * Propogate NAN mantissas through float16-float32-float64 conversions + + +* Performance improvements and refactorings: + + * Improvements in slicing byte arrays + + * Improvements in enumerate() + + * Silence some warnings while translating + +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html + +Please update, and continue to help us make PyPy better. + +Cheers + +The PyPy Team + diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py --- a/pypy/doc/tool/makecontributor.py +++ b/pypy/doc/tool/makecontributor.py @@ -69,7 +69,9 @@ 'Rami Chowdhury': ['necaris'], 'Stanislaw Halik':['w31rd0'], 'Wenzhu Man':['wenzhu man', 'wenzhuman'], - 'Anton Gulenko':['anton gulenko'], + 'Anton Gulenko':['anton gulenko', 'anton_gulenko'], + 'Richard Lancaster':['richardlancaster'], + 'William Leslie':['William ML Leslie'], } alias_map = {} diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-4.0.1.rst @@ -0,0 +1,35 @@ +========================= +What's new in PyPy 4.0.1 +========================= + +.. this is a revision shortly after release-4.0.0 +.. startrev: 57c9a47c70f6 + +.. branch: 2174-fix-osx-10-11-translation + +Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -2,34 +2,6 @@ What's new in PyPy 4.0.+ ========================= -.. this is a revision shortly after release-4.0.0 -.. startrev: 57c9a47c70f6 +.. this is a revision shortly after release-4.0.1 +.. startrev: 4b5c840d0da2 -.. branch: 2174-fix-osx-10-11-translation - -Use pkg-config to find ssl headers on OS-X - -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 - -.. branch: ppc-stacklet - -The PPC machines now support the _continuation module (stackless, greenlets) - -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 - -Document that libgdbm-dev is required for translation/packaging - -.. branch: propogate-nans - -Ensure that ndarray conversion from int16->float16->float32->float16->int16 -preserves all int16 values, even across nan conversions. Also fix argmax, argmin -for nan comparisons - -.. branch: array_interface - -Support common use-cases for __array_interface__, passes upstream tests - -.. branch: no-class-specialize - -Some refactoring of class handling in the annotator. -Remove class specialisation and _settled_ flag. diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -448,7 +448,7 @@ 'alloc' is called with the size as argument. If it returns NULL, a MemoryError is raised. 'free' is called with the result of 'alloc' -as argument. Both can be either Python function or directly C +as argument. Both can be either Python functions or directly C functions. If 'free' is None, then no free function is called. If both 'alloc' and 'free' are None, the default is used. diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -23,13 +23,14 @@ static char *debug_start_colors_2 = ""; static char *debug_stop_colors = ""; static char *debug_prefix = NULL; -static char *debug_filename = NULL; -static char *debug_filename_with_fork = NULL; -static void _pypy_debug_open(char *filename) +static void pypy_debug_open(void) { + char *filename = getenv("PYPYLOG"); + if (filename && filename[0]) { + char *newfilename = NULL, *doubledollar; char *colon = strchr(filename, ':'); if (filename[0] == '+') { @@ -51,11 +52,38 @@ debug_prefix[n] = '\0'; filename = colon + 1; } + doubledollar = strstr(filename, "$$"); + if (doubledollar) /* a "$$" in the filename is replaced with the pid */ + { + newfilename = malloc(strlen(filename) + 32); + if (newfilename != NULL) + { + char *p = newfilename; + memcpy(p, filename, doubledollar - filename); + p += doubledollar - filename; + sprintf(p, "%ld", (long)getpid()); + strcat(p, doubledollar + 2); + filename = newfilename; + } + } if (strcmp(filename, "-") != 0) { - debug_filename = strdup(filename); pypy_debug_file = fopen(filename, "w"); } + + if (doubledollar) + { + free(newfilename); /* if not null */ + /* the env var is kept and passed to subprocesses */ + } + else + { +#ifndef _WIN32 + unsetenv("PYPYLOG"); +#else + putenv("PYPYLOG="); +#endif + } } if (!pypy_debug_file) { @@ -67,20 +95,9 @@ debug_stop_colors = "\033[0m"; } } - if (filename) -#ifndef _WIN32 - unsetenv("PYPYLOG"); /* don't pass it to subprocesses */ -#else - putenv("PYPYLOG="); /* don't pass it to subprocesses */ -#endif debug_ready = 1; } -static void pypy_debug_open(void) -{ - _pypy_debug_open(getenv("PYPYLOG")); -} - long pypy_debug_offset(void) { if (!debug_ready) @@ -99,21 +116,19 @@ void pypy_debug_forked(long original_offset) { - if (debug_filename != NULL) + /* 'original_offset' ignored. It used to be that the forked log + files started with this offset printed out, so that we can + rebuild the tree structure. That's overkill... */ + (void)original_offset; + + if (pypy_debug_file) { - char *filename = malloc(strlen(debug_filename) + 32); fclose(pypy_debug_file); pypy_debug_file = NULL; - if (filename == NULL) - return; /* bah */ - sprintf(filename, "%s.fork%ld", debug_filename, (long)getpid()); - pypy_debug_file = fopen(filename, "w"); - if (pypy_debug_file) - fprintf(pypy_debug_file, "FORKED: %ld %s\n", original_offset, - debug_filename_with_fork ? debug_filename_with_fork - : debug_filename); - free(debug_filename_with_fork); - debug_filename_with_fork = filename; + /* if PYPYLOG was set to a name with "$$" in it, it is still + alive, and will be reopened with the new subprocess' pid as + soon as it logs anything */ + debug_ready = 0; } } diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h --- a/rpython/translator/c/src/debug_print.h +++ b/rpython/translator/c/src/debug_print.h @@ -21,6 +21,10 @@ subsections. Note that 'fname' can be '-' to send the logging data to stderr. + If 'fname' includes the substring '$$', it is replaced with the + current process id and you get the log for all subprocesses (and + forks) in different files. If 'fname' does not include '$$', it is + removed from the environment and not passed to subprocesses. */ /* macros used by the generated code */ diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -531,6 +531,7 @@ py.test.skip("requires fork()") def entry_point(argv): + print "parentpid =", os.getpid() debug_start("foo") debug_print("test line") childpid = os.fork() @@ -543,40 +544,46 @@ t, cbuilder = self.compile(entry_point) path = udir.join('test_debug_print_fork.log') out, err = cbuilder.cmdexec("", err=True, - env={'PYPYLOG': ':%s' % path}) + env={'PYPYLOG': ':%s.$$' % path}) assert not err + import time + time.sleep(0.5) # time for the forked children to finish # - f = open(str(path), 'r') + lines = out.splitlines() + assert lines[-1].startswith('parentpid = ') + parentpid = int(lines[-1][12:]) + # + f = open('%s.%d' % (path, parentpid), 'r') lines = f.readlines() f.close() assert '{foo' in lines[0] assert lines[1] == "test line\n" - offset1 = len(lines[0]) + len(lines[1]) + #offset1 = len(lines[0]) + len(lines[1]) assert lines[2].startswith('childpid = ') childpid = int(lines[2][11:]) assert childpid != 0 assert 'foo}' in lines[3] assert len(lines) == 4 # - f = open('%s.fork%d' % (path, childpid), 'r') + f = open('%s.%d' % (path, childpid), 'r') lines = f.readlines() f.close() - assert lines[0] == 'FORKED: %d %s\n' % (offset1, path) - assert lines[1] == 'childpid = 0\n' - offset2 = len(lines[0]) + len(lines[1]) - assert lines[2].startswith('childpid2 = ') - childpid2 = int(lines[2][11:]) + #assert lines[0] == 'FORKED: %d %s\n' % (offset1, path) + assert lines[0] == 'childpid = 0\n' + #offset2 = len(lines[0]) + len(lines[1]) + assert lines[1].startswith('childpid2 = ') + childpid2 = int(lines[1][11:]) assert childpid2 != 0 - assert 'foo}' in lines[3] - assert len(lines) == 4 + assert 'foo}' in lines[2] + assert len(lines) == 3 # - f = open('%s.fork%d' % (path, childpid2), 'r') + f = open('%s.%d' % (path, childpid2), 'r') lines = f.readlines() f.close() - assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid) - assert lines[1] == 'childpid2 = 0\n' - assert 'foo}' in lines[2] - assert len(lines) == 3 + #assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid) + assert lines[0] == 'childpid2 = 0\n' + assert 'foo}' in lines[1] + assert len(lines) == 2 def test_debug_flush_at_exit(self): def entry_point(argv): From noreply at buildbot.pypy.org Sun Nov 15 17:52:34 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 23:52:34 +0100 (CET) Subject: [pypy-commit] pypy default: Replace '$$' with '%d'. It is very confusing to use Message-ID: <20151115225234.418381C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80696:76f932bfa900 Date: 2015-11-15 22:56 +0000 http://bitbucket.org/pypy/pypy/changeset/76f932bfa900/ Log: Replace '$$' with '%d'. It is very confusing to use 'PYPYLOG=jit:log.$$' in bash, because bash itself replaces the $$ with the pid of the bash process. diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -30,7 +30,7 @@ if (filename && filename[0]) { - char *newfilename = NULL, *doubledollar; + char *newfilename = NULL, *escape; char *colon = strchr(filename, ':'); if (filename[0] == '+') { @@ -52,17 +52,17 @@ debug_prefix[n] = '\0'; filename = colon + 1; } - doubledollar = strstr(filename, "$$"); - if (doubledollar) /* a "$$" in the filename is replaced with the pid */ + escape = strstr(filename, "%d"); + if (escape) /* a "%d" in the filename is replaced with the pid */ { newfilename = malloc(strlen(filename) + 32); if (newfilename != NULL) { char *p = newfilename; - memcpy(p, filename, doubledollar - filename); - p += doubledollar - filename; + memcpy(p, filename, escape - filename); + p += escape - filename; sprintf(p, "%ld", (long)getpid()); - strcat(p, doubledollar + 2); + strcat(p, escape + 2); filename = newfilename; } } @@ -71,7 +71,7 @@ pypy_debug_file = fopen(filename, "w"); } - if (doubledollar) + if (escape) { free(newfilename); /* if not null */ /* the env var is kept and passed to subprocesses */ @@ -125,7 +125,7 @@ { fclose(pypy_debug_file); pypy_debug_file = NULL; - /* if PYPYLOG was set to a name with "$$" in it, it is still + /* if PYPYLOG was set to a name with "%d" in it, it is still alive, and will be reopened with the new subprocess' pid as soon as it logs anything */ debug_ready = 0; diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h --- a/rpython/translator/c/src/debug_print.h +++ b/rpython/translator/c/src/debug_print.h @@ -21,9 +21,9 @@ subsections. Note that 'fname' can be '-' to send the logging data to stderr. - If 'fname' includes the substring '$$', it is replaced with the + If 'fname' includes the substring '%d' it is replaced with the current process id and you get the log for all subprocesses (and - forks) in different files. If 'fname' does not include '$$', it is + forks) in different files. If 'fname' does not include '%d', it is removed from the environment and not passed to subprocesses. */ diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -544,7 +544,7 @@ t, cbuilder = self.compile(entry_point) path = udir.join('test_debug_print_fork.log') out, err = cbuilder.cmdexec("", err=True, - env={'PYPYLOG': ':%s.$$' % path}) + env={'PYPYLOG': ':%s.%%d' % path}) assert not err import time time.sleep(0.5) # time for the forked children to finish From noreply at buildbot.pypy.org Sun Nov 15 17:52:36 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 23:52:36 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151115225236.8EF171C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80697:9d2ba9e211f9 Date: 2015-11-15 22:57 +0000 http://bitbucket.org/pypy/pypy/changeset/9d2ba9e211f9/ Log: merge heads diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -56,14 +56,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -87,7 +88,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -200,9 +200,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -234,6 +237,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -244,6 +248,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -253,6 +258,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -283,6 +289,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey @@ -309,13 +316,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -327,6 +337,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -26,15 +26,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann - Richard Plangger + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -170,9 +170,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -204,6 +207,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -214,6 +218,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -223,6 +228,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -280,13 +286,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -298,6 +307,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst --- a/pypy/doc/index-of-release-notes.rst +++ b/pypy/doc/index-of-release-notes.rst @@ -6,6 +6,7 @@ .. toctree:: + release-4.0.1.rst release-4.0.0.rst release-2.6.1.rst release-2.6.0.rst diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst --- a/pypy/doc/index-of-whatsnew.rst +++ b/pypy/doc/index-of-whatsnew.rst @@ -7,6 +7,7 @@ .. toctree:: whatsnew-head.rst + whatsnew-4.0.1.rst whatsnew-4.0.0.rst whatsnew-2.6.1.rst whatsnew-2.6.0.rst diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-4.0.1.rst @@ -0,0 +1,110 @@ +========== +PyPy 4.0.1 +========== + +We have released PyPy 4.0.1, a bux-fix release after PyPy 4.0.1. We have fixed +a few critical bugs in the JIT compiled code, reported by users. We encourage +all users of PyPy to update to this version. + + +You can download the PyPy 4.0.1 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project. + +We would also like to thank our contributors and +encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ +with making RPython's JIT even better. + +CFFI +==== + +While not applicable only to PyPy, `cffi`_ is arguably our most significant +contribution to the python ecosystem. PyPy 4.0.1 ships with +`cffi-1.3.1`_ with the improvements it brings. + +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`cffi`: https://cffi.readthedocs.org +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1 +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html +.. _`numpy`: https://bitbucket.org/pypy/numpy + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), +as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. + +We also introduce `support for the 64 bit PowerPC`_ hardware, specifically +Linux running the big- and little-endian variants of ppc64. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy +.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ +.. _`dynamic languages`: http://pypyjs.org +.. _`support for the 64 bit PowerPC`: http://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html +.. _`here`: http://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html + +Other Highlights (since 4.0.0 released three weeks ago) +======================================================= + +* Bug Fixes + + * Fix a bug when unrolling double loops in JITted code + + * Fix multiple memory leaks in the ssl module, one of which affected + `cpython` as well (thanks to Alex Gaynor for pointing those out) + + * Use pkg-config to find ssl headers on OS-X + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy + +* New features: + + * Internal cleanup of RPython class handling + + * Support stackless and greenlets on PPC machines + + * Improve debug logging in subprocesses when using PYPYLOG=..:log.$$ + + * Support PyOS_double_to_string in our cpyext capi compatibility layer + +* Numpy: + + * Improve support for __array_interface__ + + * Propogate NAN mantissas through float16-float32-float64 conversions + + +* Performance improvements and refactorings: + + * Improvements in slicing byte arrays + + * Improvements in enumerate() + + * Silence some warnings while translating + +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html + +Please update, and continue to help us make PyPy better. + +Cheers + +The PyPy Team + diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py --- a/pypy/doc/tool/makecontributor.py +++ b/pypy/doc/tool/makecontributor.py @@ -69,7 +69,9 @@ 'Rami Chowdhury': ['necaris'], 'Stanislaw Halik':['w31rd0'], 'Wenzhu Man':['wenzhu man', 'wenzhuman'], - 'Anton Gulenko':['anton gulenko'], + 'Anton Gulenko':['anton gulenko', 'anton_gulenko'], + 'Richard Lancaster':['richardlancaster'], + 'William Leslie':['William ML Leslie'], } alias_map = {} diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-4.0.1.rst @@ -0,0 +1,35 @@ +========================= +What's new in PyPy 4.0.1 +========================= + +.. this is a revision shortly after release-4.0.0 +.. startrev: 57c9a47c70f6 + +.. branch: 2174-fix-osx-10-11-translation + +Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -2,34 +2,6 @@ What's new in PyPy 4.0.+ ========================= -.. this is a revision shortly after release-4.0.0 -.. startrev: 57c9a47c70f6 +.. this is a revision shortly after release-4.0.1 +.. startrev: 4b5c840d0da2 -.. branch: 2174-fix-osx-10-11-translation - -Use pkg-config to find ssl headers on OS-X - -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 - -.. branch: ppc-stacklet - -The PPC machines now support the _continuation module (stackless, greenlets) - -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 - -Document that libgdbm-dev is required for translation/packaging - -.. branch: propogate-nans - -Ensure that ndarray conversion from int16->float16->float32->float16->int16 -preserves all int16 values, even across nan conversions. Also fix argmax, argmin -for nan comparisons - -.. branch: array_interface - -Support common use-cases for __array_interface__, passes upstream tests - -.. branch: no-class-specialize - -Some refactoring of class handling in the annotator. -Remove class specialisation and _settled_ flag. From noreply at buildbot.pypy.org Sun Nov 15 17:55:57 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 23:55:57 +0100 (CET) Subject: [pypy-commit] pypy default: Update this release doc Message-ID: <20151115225557.1FD7A1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80698:5c05d44fcd84 Date: 2015-11-15 23:56 +0100 http://bitbucket.org/pypy/pypy/changeset/5c05d44fcd84/ Log: Update this release doc diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst --- a/pypy/doc/release-4.0.1.rst +++ b/pypy/doc/release-4.0.1.rst @@ -81,7 +81,9 @@ * Support stackless and greenlets on PPC machines - * Improve debug logging in subprocesses when using PYPYLOG=..:log.$$ + * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d + for example to have all subprocesses write the JIT log to a file + called 'log.%d', with '%d' replaced with the subprocess' PID. * Support PyOS_double_to_string in our cpyext capi compatibility layer From noreply at buildbot.pypy.org Sun Nov 15 17:56:48 2015 From: noreply at buildbot.pypy.org (arigo) Date: Sun, 15 Nov 2015 23:56:48 +0100 (CET) Subject: [pypy-commit] pypy release-4.0.x: merge default into release again Message-ID: <20151115225648.420F41C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: release-4.0.x Changeset: r80699:694f248e5522 Date: 2015-11-15 23:57 +0100 http://bitbucket.org/pypy/pypy/changeset/694f248e5522/ Log: merge default into release again diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst --- a/pypy/doc/release-4.0.1.rst +++ b/pypy/doc/release-4.0.1.rst @@ -81,7 +81,9 @@ * Support stackless and greenlets on PPC machines - * Improve debug logging in subprocesses when using PYPYLOG=..:log.$$ + * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d + for example to have all subprocesses write the JIT log to a file + called 'log.%d', with '%d' replaced with the subprocess' PID. * Support PyOS_double_to_string in our cpyext capi compatibility layer diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -30,7 +30,7 @@ if (filename && filename[0]) { - char *newfilename = NULL, *doubledollar; + char *newfilename = NULL, *escape; char *colon = strchr(filename, ':'); if (filename[0] == '+') { @@ -52,17 +52,17 @@ debug_prefix[n] = '\0'; filename = colon + 1; } - doubledollar = strstr(filename, "$$"); - if (doubledollar) /* a "$$" in the filename is replaced with the pid */ + escape = strstr(filename, "%d"); + if (escape) /* a "%d" in the filename is replaced with the pid */ { newfilename = malloc(strlen(filename) + 32); if (newfilename != NULL) { char *p = newfilename; - memcpy(p, filename, doubledollar - filename); - p += doubledollar - filename; + memcpy(p, filename, escape - filename); + p += escape - filename; sprintf(p, "%ld", (long)getpid()); - strcat(p, doubledollar + 2); + strcat(p, escape + 2); filename = newfilename; } } @@ -71,7 +71,7 @@ pypy_debug_file = fopen(filename, "w"); } - if (doubledollar) + if (escape) { free(newfilename); /* if not null */ /* the env var is kept and passed to subprocesses */ @@ -125,7 +125,7 @@ { fclose(pypy_debug_file); pypy_debug_file = NULL; - /* if PYPYLOG was set to a name with "$$" in it, it is still + /* if PYPYLOG was set to a name with "%d" in it, it is still alive, and will be reopened with the new subprocess' pid as soon as it logs anything */ debug_ready = 0; diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h --- a/rpython/translator/c/src/debug_print.h +++ b/rpython/translator/c/src/debug_print.h @@ -21,9 +21,9 @@ subsections. Note that 'fname' can be '-' to send the logging data to stderr. - If 'fname' includes the substring '$$', it is replaced with the + If 'fname' includes the substring '%d' it is replaced with the current process id and you get the log for all subprocesses (and - forks) in different files. If 'fname' does not include '$$', it is + forks) in different files. If 'fname' does not include '%d', it is removed from the environment and not passed to subprocesses. */ diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -544,7 +544,7 @@ t, cbuilder = self.compile(entry_point) path = udir.join('test_debug_print_fork.log') out, err = cbuilder.cmdexec("", err=True, - env={'PYPYLOG': ':%s.$$' % path}) + env={'PYPYLOG': ':%s.%%d' % path}) assert not err import time time.sleep(0.5) # time for the forked children to finish From noreply at buildbot.pypy.org Sun Nov 15 18:08:45 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 00:08:45 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: update this file Message-ID: <20151115230845.430151C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80700:3b2e3b091734 Date: 2015-11-16 00:07 +0100 http://bitbucket.org/pypy/pypy/changeset/3b2e3b091734/ Log: update this file diff --git a/pypy/module/_cffi_backend/src/parse_c_type.h b/pypy/module/_cffi_backend/src/parse_c_type.h --- a/pypy/module/_cffi_backend/src/parse_c_type.h +++ b/pypy/module/_cffi_backend/src/parse_c_type.h @@ -27,6 +27,7 @@ #define _CFFI_OP_DLOPEN_FUNC 35 #define _CFFI_OP_DLOPEN_CONST 37 #define _CFFI_OP_GLOBAL_VAR_F 39 +#define _CFFI_OP_CALL_PYTHON 41 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -160,6 +161,12 @@ const char *error_message; }; +struct _cffi_callpy_s { + const char *name; + size_t size_of_result; + void *reserved1, *reserved2; +}; + #ifdef _CFFI_INTERNAL RPY_EXTERN int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input); From noreply at buildbot.pypy.org Mon Nov 16 02:55:57 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Mon, 16 Nov 2015 08:55:57 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: guard overflow is behaving properly for int_add_ovf/int_sub_ovf Message-ID: <20151116075557.059B21C12D2@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80701:f2281bea8745 Date: 2015-11-16 08:56 +0100 http://bitbucket.org/pypy/pypy/changeset/f2281bea8745/ Log: guard overflow is behaving properly for int_add_ovf/int_sub_ovf diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -16,9 +16,11 @@ @specialize.arg(1) def negate(cond, inv_overflow=False): + if cond is OF: + return NO + if cond is NO: + return OF overflow = cond.value & 0x1 - if inv_overflow: - assert False value = (~cond.value) & 0xe return loc.imm(value | overflow) @@ -28,3 +30,5 @@ assert negate(LE).value == GT.value assert negate(GT).value == LE.value assert negate(GE).value == LT.value +assert negate(OF).value == NO.value +assert negate(NO).value == OF.value diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py --- a/rpython/jit/backend/zarch/helper/assembler.py +++ b/rpython/jit/backend/zarch/helper/assembler.py @@ -72,27 +72,25 @@ def f(self, op, arglocs, regalloc): l0, l1 = arglocs if not l1.is_imm() or l1.is_in_pool(): - assert "shift imm must NOT reside in pool!" + assert 0, "shift imm must NOT reside in pool!" getattr(self.mc, func)(l0, l0, l1) return f -def gen_emit_rr_or_rpool(rr_func, rp_func, overflow=False): +def gen_emit_rr_or_rpool(rr_func, rp_func): """ the parameters can either be both in registers or the first is in the register, second in literal pool. """ def f(self, op, arglocs, regalloc): l0, l1 = arglocs - if l1.is_imm(): - assert "logical imm must reside in pool!" + if l1.is_imm() and not l1.is_in_pool(): + assert 0, "logical imm must reside in pool!" elif l1.is_in_pool(): getattr(self.mc, rp_func)(l0, l1) else: getattr(self.mc, rr_func)(l0, l1) - if overflow: - self.guard_success_cc = c.OF return f -def gen_emit_imm_pool_rr(imm_func, pool_func, rr_func, overflow=False): +def gen_emit_imm_pool_rr(imm_func, pool_func, rr_func): def emit(self, op, arglocs, regalloc): l0, l1 = arglocs if l1.is_in_pool(): @@ -101,8 +99,6 @@ getattr(self.mc, imm_func)(l0, l1) else: getattr(self.mc, rr_func)(l0, l1) - if overflow: - self.guard_success_cc = c.OF return emit def gen_emit_pool_or_rr_evenodd(pool_func, rr_func): diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -11,9 +11,9 @@ _mixin_ = True emit_int_add = gen_emit_imm_pool_rr('AGFI','AG','AGR') - emit_int_add_ovf = gen_emit_imm_pool_rr('AGFI','AG','AGR', overflow=True) + emit_int_add_ovf = emit_int_add emit_int_sub = gen_emit_rr_or_rpool('SGR', 'SG') - emit_int_sub_ovf = gen_emit_rr_or_rpool('SGR', 'SG', overflow=True) + emit_int_sub_ovf = emit_int_sub emit_int_mul = gen_emit_imm_pool_rr('MSGFI', 'MSG', 'MSGR') emit_int_floordiv = gen_emit_pool_or_rr_evenodd('DSG','DSGR') @@ -121,11 +121,11 @@ self._emit_guard(op, arglocs) def emit_guard_overflow(self, op, arglocs, regalloc): - self.guard_success_cc = c.NO + self.guard_success_cc = c.OF self._emit_guard(op, arglocs) def emit_guard_no_overflow(self, op, arglocs, regalloc): - self.guard_success_cc = c.OF + self.guard_success_cc = c.NO self._emit_guard(op, arglocs) def emit_guard_value(self, op, arglocs, regalloc): diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -68,16 +68,23 @@ assert fail.identifier == 1 @py.test.mark.parametrize('value,opcode,result,guard', - [ (-2**63, 'i1 = int_add_ovf(i0, 1)', -2**63, 'guard_no_overflow'), - (-2**63+1,'i1 = int_add_ovf(i0, 1)', -2**63, 'guard_no_overflow'), - (-2**63+1,'i1 = int_add_ovf(i0, 1)', -2**63+1, 'guard_overflow'), + [ (2**63-1,'i1 = int_add_ovf(i0, 1)',1,'guard_no_overflow'), + (2**63-2,'i1 = int_add_ovf(i0, 1)',0,'guard_no_overflow'), + (2**63-2,'i1 = int_add_ovf(i0, 1)',1,'guard_overflow'), + (2**63-1,'i1 = int_add_ovf(i0, 1)',0,'guard_overflow'), + (-2**63, 'i1 = int_sub_ovf(i0, 1)',1,'guard_no_overflow'), + (-2**63+1,'i1 = int_sub_ovf(i0, 1)',0,'guard_no_overflow'), + (-2**63+1,'i1 = int_sub_ovf(i0, 1)',1,'guard_overflow'), + (-2**63, 'i1 = int_sub_ovf(i0, 1)',0,'guard_overflow'), ]) def test_int_arithmetic_overflow(self, value, opcode, result, guard): + # result == 1 means branch has been taken of the guard code = """ [i0] {opcode} {guard}() [i0] - finish(i1, descr=faildescr) + i2 = int_xor(i1,i1) + finish(i2, descr=faildescr) """.format(opcode=opcode,guard=guard) loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) looptoken = JitCellToken() @@ -85,8 +92,10 @@ deadframe = self.cpu.execute_token(looptoken, value) fail = self.cpu.get_latest_descr(deadframe) res = self.cpu.get_int_value(deadframe, 0) - assert res == result - #assert fail.identifier == 1 + if result == 1: + assert res == value + else: + assert res == 0 def test_double_evenodd_pair(self): # TODO From noreply at buildbot.pypy.org Mon Nov 16 03:43:37 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 09:43:37 +0100 (CET) Subject: [pypy-commit] pypy default: Don't close stderr!!! Message-ID: <20151116084337.1ED291C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80702:f321ba3efa8f Date: 2015-11-16 09:43 +0100 http://bitbucket.org/pypy/pypy/changeset/f321ba3efa8f/ Log: Don't close stderr!!! diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -102,9 +102,14 @@ { if (!debug_ready) return -1; + /* The following fflush() makes sure everything is written now, which + is just before a fork(). So we can fork() and close the file in + the subprocess without ending up with the content of the buffer + written twice. */ + fflush(pypy_debug_file); + // note that we deliberately ignore errno, since -1 is fine // in case this is not a real file - fflush(pypy_debug_file); return ftell(pypy_debug_file); } @@ -123,7 +128,8 @@ if (pypy_debug_file) { - fclose(pypy_debug_file); + if (pypy_debug_file != stderr) + fclose(pypy_debug_file); pypy_debug_file = NULL; /* if PYPYLOG was set to a name with "%d" in it, it is still alive, and will be reopened with the new subprocess' pid as From noreply at buildbot.pypy.org Mon Nov 16 05:01:28 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 11:01:28 +0100 (CET) Subject: [pypy-commit] pypy release-4.0.x: merge default into release again Message-ID: <20151116100128.4484B1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: release-4.0.x Changeset: r80703:aa291d1575e0 Date: 2015-11-16 11:01 +0100 http://bitbucket.org/pypy/pypy/changeset/aa291d1575e0/ Log: merge default into release again diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -102,9 +102,14 @@ { if (!debug_ready) return -1; + /* The following fflush() makes sure everything is written now, which + is just before a fork(). So we can fork() and close the file in + the subprocess without ending up with the content of the buffer + written twice. */ + fflush(pypy_debug_file); + // note that we deliberately ignore errno, since -1 is fine // in case this is not a real file - fflush(pypy_debug_file); return ftell(pypy_debug_file); } @@ -123,7 +128,8 @@ if (pypy_debug_file) { - fclose(pypy_debug_file); + if (pypy_debug_file != stderr) + fclose(pypy_debug_file); pypy_debug_file = NULL; /* if PYPYLOG was set to a name with "%d" in it, it is still alive, and will be reopened with the new subprocess' pid as From noreply at buildbot.pypy.org Mon Nov 16 05:09:01 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 11:09:01 +0100 (CET) Subject: [pypy-commit] pypy default: Needs at least cffi 1.3.0 to successfully run some of the tests Message-ID: <20151116100901.828871C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80704:d5f71dcd6acb Date: 2015-11-16 11:09 +0100 http://bitbucket.org/pypy/pypy/changeset/d5f71dcd6acb/ Log: Needs at least cffi 1.3.0 to successfully run some of the tests diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -16,8 +16,8 @@ from cffi import ffiplatform except ImportError: py.test.skip("system cffi module not found or older than 1.0.0") - if cffi.__version_info__ < (1, 2, 0): - py.test.skip("system cffi module needs to be at least 1.2.0") + if cffi.__version_info__ < (1, 3, 0): + py.test.skip("system cffi module needs to be at least 1.3.0") space.appexec([], """(): import _cffi_backend # force it to be initialized """) From noreply at buildbot.pypy.org Mon Nov 16 05:48:58 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 11:48:58 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: translation progress Message-ID: <20151116104858.0D6341C129F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80705:a11de4ac3077 Date: 2015-11-16 08:12 +0000 http://bitbucket.org/pypy/pypy/changeset/a11de4ac3077/ Log: translation progress diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py --- a/pypy/module/_cffi_backend/call_python.py +++ b/pypy/module/_cffi_backend/call_python.py @@ -73,6 +73,7 @@ self.cache_dict = {} + at jit.dont_look_inside def callpy_deco(space, w_ffi, w_python_callable, w_name, w_error, w_onerror): from pypy.module._cffi_backend.ffi_obj import W_FFIObject from pypy.module._cffi_backend.ccallback import W_CallPython From noreply at buildbot.pypy.org Mon Nov 16 05:51:52 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 11:51:52 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Add a minimal demo of CFFI_CALL_PYTHON Message-ID: <20151116105152.6118C1C129F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2406:919e3cdd4fb6 Date: 2015-11-16 11:52 +0100 http://bitbucket.org/cffi/cffi/changeset/919e3cdd4fb6/ Log: Add a minimal demo of CFFI_CALL_PYTHON diff --git a/demo/cdef_call_python.py b/demo/cdef_call_python.py new file mode 100644 --- /dev/null +++ b/demo/cdef_call_python.py @@ -0,0 +1,29 @@ +import cffi + +ffi = cffi.FFI() + +ffi.cdef(""" + int add(int x, int y); + CFFI_CALL_PYTHON long mangle(int); +""") + +ffi.set_source("_cdef_call_python_cffi", """ + + static long mangle(int); + + static int add(int x, int y) + { + return mangle(x) + mangle(y); + } +""") + +ffi.compile() + + +from _cdef_call_python_cffi import ffi, lib + + at ffi.call_python("mangle") # optional argument, default to func.__name__ +def mangle(x): + return x * x + +assert lib.add(40, 2) == 1604 From noreply at buildbot.pypy.org Mon Nov 16 05:55:49 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 11:55:49 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: import cffi/919e3cdd4fb6 (branch static-callback) Message-ID: <20151116105549.1C8DD1C129F@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80706:50da830ec2ce Date: 2015-11-16 11:00 +0000 http://bitbucket.org/pypy/pypy/changeset/50da830ec2ce/ Log: import cffi/919e3cdd4fb6 (branch static-callback) diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h --- a/lib_pypy/cffi/_cffi_include.h +++ b/lib_pypy/cffi/_cffi_include.h @@ -146,7 +146,9 @@ ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23]) #define _cffi_convert_array_from_object \ ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) -#define _CFFI_NUM_EXPORTS 25 +#define _cffi_call_python \ + ((void(*)(struct _cffi_callpy_s *, char *))_cffi_exports[25]) +#define _CFFI_NUM_EXPORTS 26 typedef struct _ctypedescr CTypeDescrObject; @@ -201,8 +203,11 @@ the others follow */ } +/********** end CPython-specific section **********/ +#else +_CFFI_UNUSED_FN +static void (*_cffi_call_python)(struct _cffi_callpy_s *, char *); #endif -/********** end CPython-specific section **********/ #define _cffi_array_len(array) (sizeof(array) / sizeof((array)[0])) diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py --- a/lib_pypy/cffi/cffi_opcode.py +++ b/lib_pypy/cffi/cffi_opcode.py @@ -54,6 +54,7 @@ OP_DLOPEN_FUNC = 35 OP_DLOPEN_CONST = 37 OP_GLOBAL_VAR_F = 39 +OP_CALL_PYTHON = 41 PRIM_VOID = 0 PRIM_BOOL = 1 diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -29,6 +29,7 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_cffi_call_python = re.compile(r"\bCFFI_CALL_PYTHON\b") _r_star_const_space = re.compile( # matches "* const " r"[*]\s*((const|volatile|restrict)\b\s*)+") @@ -62,7 +63,8 @@ if csource.startswith('*', endpos): parts.append('('); closing += ')' level = 0 - for i in xrange(endpos, len(csource)): + i = endpos + while i < len(csource): c = csource[i] if c == '(': level += 1 @@ -73,6 +75,7 @@ elif c in ',;=': if level == 0: break + i += 1 csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) @@ -101,8 +104,13 @@ csource = _r_stdcall2.sub(' volatile volatile const(', csource) csource = _r_stdcall1.sub(' volatile volatile const ', csource) csource = _r_cdecl.sub(' ', csource) + # + # Replace "CFFI_CALL_PYTHON" with "void CFFI_CALL_PYTHON;" + csource = _r_cffi_call_python.sub('void CFFI_CALL_PYTHON;', csource) + # # Replace "[...]" with "[__dotdotdotarray__]" csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) + # # Replace "...}" with "__dotdotdotNUM__}". This construction should # occur only at the end of enums; at the end of structs we have "...;}" # and at the end of vararg functions "...);". Also replace "=...[,}]" @@ -255,7 +263,9 @@ break # try: + self._found_cffi_call_python = False for decl in iterator: + old_cffi_call_python = self._found_cffi_call_python if isinstance(decl, pycparser.c_ast.Decl): self._parse_decl(decl) elif isinstance(decl, pycparser.c_ast.Typedef): @@ -278,6 +288,8 @@ self._declare('typedef ' + decl.name, realtype, quals=quals) else: raise api.CDefError("unrecognized construct", decl) + if old_cffi_call_python and self._found_cffi_call_python: + raise api.CDefError("CFFI_CALL_PYTHON misplaced") except api.FFIError as e: msg = self._convert_pycparser_error(e, csource) if msg: @@ -324,13 +336,20 @@ ' #define %s %s' % (key, key, key, value)) + def _declare_function(self, tp, quals, decl): + tp = self._get_type_pointer(tp, quals) + if self._found_cffi_call_python: + self._declare('call_python ' + decl.name, tp) + self._found_cffi_call_python = False + else: + self._declare('function ' + decl.name, tp) + def _parse_decl(self, decl): node = decl.type if isinstance(node, pycparser.c_ast.FuncDecl): tp, quals = self._get_type_and_quals(node, name=decl.name) assert isinstance(tp, model.RawFunctionType) - tp = self._get_type_pointer(tp, quals) - self._declare('function ' + decl.name, tp) + self._declare_function(tp, quals, decl) else: if isinstance(node, pycparser.c_ast.Struct): self._get_struct_union_enum_type('struct', node) @@ -346,8 +365,7 @@ tp, quals = self._get_type_and_quals(node, partial_length_ok=True) if tp.is_raw_function: - tp = self._get_type_pointer(tp, quals) - self._declare('function ' + decl.name, tp) + self._declare_function(tp, quals, decl) elif (tp.is_integer_type() and hasattr(decl, 'init') and hasattr(decl.init, 'value') and @@ -360,6 +378,11 @@ _r_int_literal.match(decl.init.expr.value)): self._add_integer_constant(decl.name, '-' + decl.init.expr.value) + elif tp is model.void_type and decl.name == 'CFFI_CALL_PYTHON': + # hack: "CFFI_CALL_PYTHON" in the C source is replaced + # with "void CFFI_CALL_PYTHON;", which when parsed arrives + # at this point and sets this flag: + self._found_cffi_call_python = True elif (quals & model.Q_CONST) and not tp.is_array_type: self._declare('constant ' + decl.name, tp, quals=quals) else: diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -27,6 +27,7 @@ #define _CFFI_OP_DLOPEN_FUNC 35 #define _CFFI_OP_DLOPEN_CONST 37 #define _CFFI_OP_GLOBAL_VAR_F 39 +#define _CFFI_OP_CALL_PYTHON 41 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -160,6 +161,12 @@ const char *error_message; }; +struct _cffi_callpy_s { + const char *name; + size_t size_of_result; + void *reserved1, *reserved2; +}; + #ifdef _CFFI_INTERNAL static int parse_c_type(struct _cffi_parse_info_s *info, const char *input); static int search_in_globals(const struct _cffi_type_context_s *ctx, diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py --- a/lib_pypy/cffi/recompiler.py +++ b/lib_pypy/cffi/recompiler.py @@ -118,6 +118,7 @@ class Recompiler: + _num_callpy = 0 def __init__(self, ffi, module_name, target_is_python=False): self.ffi = ffi @@ -356,7 +357,10 @@ else: prnt(' NULL, /* no includes */') prnt(' %d, /* num_types */' % (len(self.cffi_types),)) - prnt(' 0, /* flags */') + flags = 0 + if self._num_callpy: + flags |= 1 # set to mean "uses _cffi_call_python" + prnt(' %d, /* flags */' % flags) prnt('};') prnt() # @@ -366,6 +370,9 @@ prnt('PyMODINIT_FUNC') prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) prnt('{') + prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') + prnt(' _cffi_call_python = p[1];') + prnt(' }') prnt(' p[0] = (const void *)%s;' % VERSION) prnt(' p[1] = &_cffi_type_context;') prnt('}') @@ -1108,6 +1115,75 @@ GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index))) # ---------- + # CFFI_CALL_PYTHON + + def _generate_cpy_call_python_collecttype(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + self._do_collect_type(tp) + + def _generate_cpy_call_python_decl(self, tp, name): + prnt = self._prnt + if isinstance(tp.result, model.VoidType): + size_of_result = '0' + else: + context = 'result of %s' % name + size_of_result = '(int)sizeof(%s)' % ( + tp.result.get_c_name('', context),) + prnt('static struct _cffi_callpy_s _cffi_callpy__%s =' % name) + prnt(' { "%s", %s };' % (name, size_of_result)) + prnt() + # + arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' a%d' % i, context) + arguments.append(arg) + # + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s(%s)' % (name, repr_arguments) + # + def may_need_128_bits(tp): + return (isinstance(tp, model.PrimitiveType) and + tp.name == 'long double') + # + size_of_a = max(len(tp.args)*8, 8) + if may_need_128_bits(tp.result): + size_of_a = max(size_of_a, 16) + if isinstance(tp.result, model.StructOrUnion): + size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( + tp.result.get_c_name(''), size_of_a, + tp.result.get_c_name(''), size_of_a) + prnt('static %s' % tp.result.get_c_name(name_and_arguments)) + prnt('{') + prnt(' char a[%s];' % size_of_a) + prnt(' char *p = a;') + for i, type in enumerate(tp.args): + arg = 'a%d' % i + if (isinstance(type, model.StructOrUnion) or + may_need_128_bits(type)): + arg = '&' + arg + type = model.PointerType(type) + prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) + prnt(' _cffi_call_python(&_cffi_callpy__%s, p);' % name) + if not isinstance(tp.result, model.VoidType): + prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) + prnt('}') + prnt() + self._num_callpy += 1 + + def _generate_cpy_call_python_ctx(self, tp, name): + if self.target_is_python: + raise ffiplatform.VerificationError( + "cannot use CFFI_CALL_PYTHON in the ABI mode") + if tp.ellipsis: + raise NotImplementedError("CFFI_CALL_PYTHON with a vararg function") + type_index = self._typesdict[tp] + type_op = CffiOp(OP_CALL_PYTHON, type_index) + self._lsts["global"].append( + GlobalExpr(name, '&_cffi_callpy__%s' % name, type_op, name)) + + # ---------- # emitting the opcodes for individual types def _emit_bytecode_VoidType(self, tp, index): diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py @@ -406,3 +406,17 @@ "" % (stdcall, stdcall)) + +def test_CFFI_CALL_PYTHON(): + ffi = FFI() + ffi.cdef(""" + int baz(int, int); + CFFI_CALL_PYTHON int foobar(int, int); + """) + assert 'variable CFFI_CALL_PYTHON' not in ffi._parser._declarations + assert 'function baz' in ffi._parser._declarations + assert 'call_python baz' not in ffi._parser._declarations + assert 'function foobar' not in ffi._parser._declarations + assert 'call_python foobar' in ffi._parser._declarations + assert (ffi._parser._declarations['function baz'] == + ffi._parser._declarations['call_python foobar']) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py @@ -5,6 +5,7 @@ from cffi import recompiler from pypy.module.test_lib_pypy.cffi_tests.udir import udir from pypy.module.test_lib_pypy.cffi_tests.support import u +from StringIO import StringIO def check_type_table(input, expected_output, included=None): @@ -1485,3 +1486,221 @@ assert (pt.x, pt.y) == (99*500*999, -99*500*999) pt = ptr_call2(ffi.addressof(lib, 'cb2')) assert (pt.x, pt.y) == (99*500*999, -99*500*999) + +class StdErrCapture(object): + def __enter__(self): + self.old_stderr = sys.stderr + sys.stderr = f = StringIO() + return f + def __exit__(self, *args): + sys.stderr = self.old_stderr + +def test_call_python_1(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int, int); + CFFI_CALL_PYTHON void baz(int, int); + CFFI_CALL_PYTHON int bok(void); + CFFI_CALL_PYTHON void boz(void); + """) + lib = verify(ffi, 'test_call_python_1', "") + assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") + with StdErrCapture() as f: + res = lib.bar(4, 5) + assert res == 0 + assert f.getvalue() == ( + "CFFI_CALL_PYTHON: function bar() called, but no code was attached " + "to it yet with ffi.call_python('bar'). Returning 0.\n") + + @ffi.call_python("bar") + def my_bar(x, y): + seen.append(("Bar", x, y)) + return x * y + assert my_bar == lib.bar + seen = [] + res = lib.bar(6, 7) + assert seen == [("Bar", 6, 7)] + assert res == 42 + + @ffi.call_python() + def baz(x, y): + seen.append(("Baz", x, y)) + seen = [] + res = baz(50L, 8L) + assert res is None + assert seen == [("Baz", 50, 8)] + assert type(seen[0][1]) is type(seen[0][2]) is int + assert baz == lib.baz + + @ffi.call_python(name="bok") + def bok(): + seen.append("Bok") + return 42 + seen = [] + assert lib.bok() == bok() == 42 + assert seen == ["Bok", "Bok"] + + @ffi.call_python() + def boz(): + seen.append("Boz") + seen = [] + assert lib.boz() is boz() is None + assert seen == ["Boz", "Boz"] + +def test_call_python_bogus_name(): + ffi = FFI() + ffi.cdef("int abc;") + lib = verify(ffi, 'test_call_python_bogus_name', "int abc;") + def fn(): + pass + py.test.raises(ffi.error, ffi.call_python("unknown_name"), fn) + py.test.raises(ffi.error, ffi.call_python("abc"), fn) + assert lib.abc == 0 + e = py.test.raises(ffi.error, ffi.call_python("abc"), fn) + assert str(e.value) == ("ffi.call_python('abc'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef") + e = py.test.raises(ffi.error, ffi.call_python(), fn) + assert str(e.value) == ("ffi.call_python('fn'): name not found as a " + "CFFI_CALL_PYTHON line from the cdef") + # + py.test.raises(TypeError, ffi.call_python(42), fn) + py.test.raises((TypeError, AttributeError), ffi.call_python(), "foo") + class X: + pass + x = X() + x.__name__ = x + py.test.raises(TypeError, ffi.call_python(), x) + +def test_call_python_bogus_result_type(): + ffi = FFI() + ffi.cdef("CFFI_CALL_PYTHON void bar(int);") + lib = verify(ffi, 'test_call_python_bogus_result_type', "") + # + def bar(n): + return n * 10 + bar1 = ffi.call_python()(bar) + with StdErrCapture() as f: + res = bar1(321) + assert res is None + assert f.getvalue() == ( + "From cffi callback %r:\n" % (bar,) + + "Trying to convert the result back to C:\n" + "TypeError: callback with the return type 'void' must return None\n") + +def test_call_python_redefine(): + ffi = FFI() + ffi.cdef("CFFI_CALL_PYTHON int bar(int);") + lib = verify(ffi, 'test_call_python_redefine', "") + # + @ffi.call_python() + def bar(n): + return n * 10 + assert lib.bar(42) == 420 + # + @ffi.call_python() + def bar(n): + return -n + assert lib.bar(42) == -42 + +def test_call_python_struct(): + ffi = FFI() + ffi.cdef(""" + struct foo_s { int a, b, c; }; + CFFI_CALL_PYTHON int bar(int, struct foo_s, int); + CFFI_CALL_PYTHON struct foo_s baz(int, int); + CFFI_CALL_PYTHON struct foo_s bok(void); + """) + lib = verify(ffi, 'test_call_python_struct', + "struct foo_s { int a, b, c; };") + # + @ffi.call_python() + def bar(x, s, z): + return x + s.a + s.b + s.c + z + res = lib.bar(1000, [1001, 1002, 1004], 1008) + assert res == 5015 + # + @ffi.call_python() + def baz(x, y): + return [x + y, x - y, x * y] + res = lib.baz(1000, 42) + assert res.a == 1042 + assert res.b == 958 + assert res.c == 42000 + # + @ffi.call_python() + def bok(): + return [10, 20, 30] + res = lib.bok() + assert [res.a, res.b, res.c] == [10, 20, 30] + +def test_call_python_long_double(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int, long double, int); + CFFI_CALL_PYTHON long double baz(int, int); + CFFI_CALL_PYTHON long double bok(void); + """) + lib = verify(ffi, 'test_call_python_long_double', "") + # + @ffi.call_python() + def bar(x, l, z): + seen.append((x, l, z)) + return 6 + seen = [] + lib.bar(10, 3.5, 20) + expected = ffi.cast("long double", 3.5) + assert repr(seen) == repr([(10, expected, 20)]) + # + @ffi.call_python() + def baz(x, z): + assert x == 10 and z == 20 + return expected + res = lib.baz(10, 20) + assert repr(res) == repr(expected) + # + @ffi.call_python() + def bok(): + return expected + res = lib.bok() + assert repr(res) == repr(expected) + +def test_call_python_signature(): + ffi = FFI() + lib = verify(ffi, 'test_call_python_signature', "") + py.test.raises(TypeError, ffi.call_python(425), None) + py.test.raises(TypeError, ffi.call_python, 'a', 'b', 'c', 'd') + +def test_call_python_errors(): + ffi = FFI() + ffi.cdef(""" + CFFI_CALL_PYTHON int bar(int); + """) + lib = verify(ffi, 'test_call_python_errors', "") + + seen = [] + def oops(*args): + seen.append(args) + + @ffi.call_python(onerror=oops) + def bar(x): + return x + "" + assert bar(10) == 0 + + @ffi.call_python(name="bar", onerror=oops, error=-66) + def bar2(x): + return x + "" + assert bar(10) == -66 + + assert len(seen) == 2 + exc, val, tb = seen[0] + assert exc is TypeError + assert isinstance(val, TypeError) + assert tb.tb_frame.f_code.co_name == "bar" + exc, val, tb = seen[1] + assert exc is TypeError + assert isinstance(val, TypeError) + assert tb.tb_frame.f_code.co_name == "bar2" + # + # a case where 'onerror' is not callable + py.test.raises(TypeError, ffi.call_python(name='bar', onerror=42), + lambda x: x) From noreply at buildbot.pypy.org Mon Nov 16 06:14:33 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:14:33 +0100 (CET) Subject: [pypy-commit] pypy default: Forgot an added file Message-ID: <20151116111433.71E2A1C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80707:eed1d339f370 Date: 2015-11-16 12:07 +0100 http://bitbucket.org/pypy/pypy/changeset/eed1d339f370/ Log: Forgot an added file diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py new file mode 100644 --- /dev/null +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py @@ -0,0 +1,35 @@ +# Generated by pypy/tool/import_cffi.py +import py, os, cffi, re +import _cffi_backend + + +def getlines(): + try: + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + except IOError: + py.test.skip("cannot find ../c/commontypes.c") + lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] + f.close() + return lines + +def test_alphabetical_order(): + lines = getlines() + assert lines == sorted(lines) + +def test_dependencies(): + r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?') + lines = getlines() + d = {} + for line in lines: + match = r.search(line) + if match is not None: + d[match.group(1)] = match.group(2) + for value in d.values(): + if value: + assert value in d + +def test_get_common_types(): + d = {} + _cffi_backend._get_common_types(d) + assert d["bool"] == "_Bool" From noreply at buildbot.pypy.org Mon Nov 16 06:14:35 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:14:35 +0100 (CET) Subject: [pypy-commit] pypy default: Use $RPYDIR in more places in the Makefile Message-ID: <20151116111435.976B61C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80708:d07751828864 Date: 2015-11-16 12:11 +0100 http://bitbucket.org/pypy/pypy/changeset/d07751828864/ Log: Use $RPYDIR in more places in the Makefile diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py --- a/rpython/translator/platform/posix.py +++ b/rpython/translator/platform/posix.py @@ -138,6 +138,13 @@ rel = lpath.relto(rpypath) if rel: return os.path.join('$(RPYDIR)', rel) + # Hack: also relativize from the path '$RPYDIR/..'. + # Otherwise, when translating pypy, we get the paths in + # pypy/module/* that are kept as absolute, which makes the + # whole purpose of $RPYDIR rather pointless. + rel = lpath.relto(rpypath.join('..')) + if rel: + return os.path.join('$(RPYDIR)', '..', rel) m_dir = m.makefile_dir if m_dir == lpath: return '.' From noreply at buildbot.pypy.org Mon Nov 16 06:14:38 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:14:38 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: hg merge default Message-ID: <20151116111438.4A0E11C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80709:fe63dabf7c80 Date: 2015-11-16 11:12 +0000 http://bitbucket.org/pypy/pypy/changeset/fe63dabf7c80/ Log: hg merge default diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -56,14 +56,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -87,7 +88,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -200,9 +200,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -234,6 +237,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -244,6 +248,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -253,6 +258,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -283,6 +289,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey @@ -309,13 +316,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -327,6 +337,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -26,15 +26,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann - Richard Plangger + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -170,9 +170,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -204,6 +207,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -214,6 +218,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -223,6 +228,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -280,13 +286,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -298,6 +307,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst --- a/pypy/doc/index-of-release-notes.rst +++ b/pypy/doc/index-of-release-notes.rst @@ -6,6 +6,7 @@ .. toctree:: + release-4.0.1.rst release-4.0.0.rst release-2.6.1.rst release-2.6.0.rst diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst --- a/pypy/doc/index-of-whatsnew.rst +++ b/pypy/doc/index-of-whatsnew.rst @@ -7,6 +7,7 @@ .. toctree:: whatsnew-head.rst + whatsnew-4.0.1.rst whatsnew-4.0.0.rst whatsnew-2.6.1.rst whatsnew-2.6.0.rst diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-4.0.1.rst @@ -0,0 +1,112 @@ +========== +PyPy 4.0.1 +========== + +We have released PyPy 4.0.1, a bux-fix release after PyPy 4.0.1. We have fixed +a few critical bugs in the JIT compiled code, reported by users. We encourage +all users of PyPy to update to this version. + + +You can download the PyPy 4.0.1 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project. + +We would also like to thank our contributors and +encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ +with making RPython's JIT even better. + +CFFI +==== + +While not applicable only to PyPy, `cffi`_ is arguably our most significant +contribution to the python ecosystem. PyPy 4.0.1 ships with +`cffi-1.3.1`_ with the improvements it brings. + +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`cffi`: https://cffi.readthedocs.org +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1 +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html +.. _`numpy`: https://bitbucket.org/pypy/numpy + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), +as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. + +We also introduce `support for the 64 bit PowerPC`_ hardware, specifically +Linux running the big- and little-endian variants of ppc64. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy +.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ +.. _`dynamic languages`: http://pypyjs.org +.. _`support for the 64 bit PowerPC`: http://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html +.. _`here`: http://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html + +Other Highlights (since 4.0.0 released three weeks ago) +======================================================= + +* Bug Fixes + + * Fix a bug when unrolling double loops in JITted code + + * Fix multiple memory leaks in the ssl module, one of which affected + `cpython` as well (thanks to Alex Gaynor for pointing those out) + + * Use pkg-config to find ssl headers on OS-X + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy + +* New features: + + * Internal cleanup of RPython class handling + + * Support stackless and greenlets on PPC machines + + * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d + for example to have all subprocesses write the JIT log to a file + called 'log.%d', with '%d' replaced with the subprocess' PID. + + * Support PyOS_double_to_string in our cpyext capi compatibility layer + +* Numpy: + + * Improve support for __array_interface__ + + * Propogate NAN mantissas through float16-float32-float64 conversions + + +* Performance improvements and refactorings: + + * Improvements in slicing byte arrays + + * Improvements in enumerate() + + * Silence some warnings while translating + +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html + +Please update, and continue to help us make PyPy better. + +Cheers + +The PyPy Team + diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py --- a/pypy/doc/tool/makecontributor.py +++ b/pypy/doc/tool/makecontributor.py @@ -69,7 +69,9 @@ 'Rami Chowdhury': ['necaris'], 'Stanislaw Halik':['w31rd0'], 'Wenzhu Man':['wenzhu man', 'wenzhuman'], - 'Anton Gulenko':['anton gulenko'], + 'Anton Gulenko':['anton gulenko', 'anton_gulenko'], + 'Richard Lancaster':['richardlancaster'], + 'William Leslie':['William ML Leslie'], } alias_map = {} diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-4.0.1.rst @@ -0,0 +1,35 @@ +========================= +What's new in PyPy 4.0.1 +========================= + +.. this is a revision shortly after release-4.0.0 +.. startrev: 57c9a47c70f6 + +.. branch: 2174-fix-osx-10-11-translation + +Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -2,34 +2,6 @@ What's new in PyPy 4.0.+ ========================= -.. this is a revision shortly after release-4.0.0 -.. startrev: 57c9a47c70f6 +.. this is a revision shortly after release-4.0.1 +.. startrev: 4b5c840d0da2 -.. branch: 2174-fix-osx-10-11-translation - -Use pkg-config to find ssl headers on OS-X - -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 - -.. branch: ppc-stacklet - -The PPC machines now support the _continuation module (stackless, greenlets) - -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 - -Document that libgdbm-dev is required for translation/packaging - -.. branch: propogate-nans - -Ensure that ndarray conversion from int16->float16->float32->float16->int16 -preserves all int16 values, even across nan conversions. Also fix argmax, argmin -for nan comparisons - -.. branch: array_interface - -Support common use-cases for __array_interface__, passes upstream tests - -.. branch: no-class-specialize - -Some refactoring of class handling in the annotator. -Remove class specialisation and _settled_ flag. diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -472,7 +472,7 @@ 'alloc' is called with the size as argument. If it returns NULL, a MemoryError is raised. 'free' is called with the result of 'alloc' -as argument. Both can be either Python function or directly C +as argument. Both can be either Python functions or directly C functions. If 'free' is None, then no free function is called. If both 'alloc' and 'free' are None, the default is used. diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -16,8 +16,8 @@ from cffi import ffiplatform except ImportError: py.test.skip("system cffi module not found or older than 1.0.0") - if cffi.__version_info__ < (1, 2, 0): - py.test.skip("system cffi module needs to be at least 1.2.0") + if cffi.__version_info__ < (1, 3, 0): + py.test.skip("system cffi module needs to be at least 1.3.0") space.appexec([], """(): import _cffi_backend # force it to be initialized """) diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -684,8 +684,9 @@ arr_iter, arr_state = arr.create_iter() arr_dtype = arr.get_dtype() index_dtype = index.get_dtype() - # XXX length of shape of index as well? - while not index_iter.done(index_state): + # support the deprecated form where arr([True]) will return arr[0, ...] + # by iterating over res_iter, not index_iter + while not res_iter.done(res_state): getitem_filter_driver.jit_merge_point(shapelen=shapelen, index_dtype=index_dtype, arr_dtype=arr_dtype, diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -2238,6 +2238,9 @@ c = array([True,False,True],bool) b = a[c] assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all() + c = array([True]) + b = a[c] + assert b.shape == (1, 3) def test_bool_array_index_setitem(self): from numpy import arange, array diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py new file mode 100644 --- /dev/null +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py @@ -0,0 +1,35 @@ +# Generated by pypy/tool/import_cffi.py +import py, os, cffi, re +import _cffi_backend + + +def getlines(): + try: + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + except IOError: + py.test.skip("cannot find ../c/commontypes.c") + lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] + f.close() + return lines + +def test_alphabetical_order(): + lines = getlines() + assert lines == sorted(lines) + +def test_dependencies(): + r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?') + lines = getlines() + d = {} + for line in lines: + match = r.search(line) + if match is not None: + d[match.group(1)] = match.group(2) + for value in d.values(): + if value: + assert value in d + +def test_get_common_types(): + d = {} + _cffi_backend._get_common_types(d) + assert d["bool"] == "_Bool" diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c --- a/rpython/translator/c/src/debug_print.c +++ b/rpython/translator/c/src/debug_print.c @@ -23,13 +23,14 @@ static char *debug_start_colors_2 = ""; static char *debug_stop_colors = ""; static char *debug_prefix = NULL; -static char *debug_filename = NULL; -static char *debug_filename_with_fork = NULL; -static void _pypy_debug_open(char *filename) +static void pypy_debug_open(void) { + char *filename = getenv("PYPYLOG"); + if (filename && filename[0]) { + char *newfilename = NULL, *escape; char *colon = strchr(filename, ':'); if (filename[0] == '+') { @@ -51,11 +52,38 @@ debug_prefix[n] = '\0'; filename = colon + 1; } + escape = strstr(filename, "%d"); + if (escape) /* a "%d" in the filename is replaced with the pid */ + { + newfilename = malloc(strlen(filename) + 32); + if (newfilename != NULL) + { + char *p = newfilename; + memcpy(p, filename, escape - filename); + p += escape - filename; + sprintf(p, "%ld", (long)getpid()); + strcat(p, escape + 2); + filename = newfilename; + } + } if (strcmp(filename, "-") != 0) { - debug_filename = strdup(filename); pypy_debug_file = fopen(filename, "w"); } + + if (escape) + { + free(newfilename); /* if not null */ + /* the env var is kept and passed to subprocesses */ + } + else + { +#ifndef _WIN32 + unsetenv("PYPYLOG"); +#else + putenv("PYPYLOG="); +#endif + } } if (!pypy_debug_file) { @@ -67,27 +95,21 @@ debug_stop_colors = "\033[0m"; } } - if (filename) -#ifndef _WIN32 - unsetenv("PYPYLOG"); /* don't pass it to subprocesses */ -#else - putenv("PYPYLOG="); /* don't pass it to subprocesses */ -#endif debug_ready = 1; } -static void pypy_debug_open(void) -{ - _pypy_debug_open(getenv("PYPYLOG")); -} - long pypy_debug_offset(void) { if (!debug_ready) return -1; + /* The following fflush() makes sure everything is written now, which + is just before a fork(). So we can fork() and close the file in + the subprocess without ending up with the content of the buffer + written twice. */ + fflush(pypy_debug_file); + // note that we deliberately ignore errno, since -1 is fine // in case this is not a real file - fflush(pypy_debug_file); return ftell(pypy_debug_file); } @@ -99,21 +121,20 @@ void pypy_debug_forked(long original_offset) { - if (debug_filename != NULL) + /* 'original_offset' ignored. It used to be that the forked log + files started with this offset printed out, so that we can + rebuild the tree structure. That's overkill... */ + (void)original_offset; + + if (pypy_debug_file) { - char *filename = malloc(strlen(debug_filename) + 32); - fclose(pypy_debug_file); + if (pypy_debug_file != stderr) + fclose(pypy_debug_file); pypy_debug_file = NULL; - if (filename == NULL) - return; /* bah */ - sprintf(filename, "%s.fork%ld", debug_filename, (long)getpid()); - pypy_debug_file = fopen(filename, "w"); - if (pypy_debug_file) - fprintf(pypy_debug_file, "FORKED: %ld %s\n", original_offset, - debug_filename_with_fork ? debug_filename_with_fork - : debug_filename); - free(debug_filename_with_fork); - debug_filename_with_fork = filename; + /* if PYPYLOG was set to a name with "%d" in it, it is still + alive, and will be reopened with the new subprocess' pid as + soon as it logs anything */ + debug_ready = 0; } } diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h --- a/rpython/translator/c/src/debug_print.h +++ b/rpython/translator/c/src/debug_print.h @@ -21,6 +21,10 @@ subsections. Note that 'fname' can be '-' to send the logging data to stderr. + If 'fname' includes the substring '%d' it is replaced with the + current process id and you get the log for all subprocesses (and + forks) in different files. If 'fname' does not include '%d', it is + removed from the environment and not passed to subprocesses. */ /* macros used by the generated code */ diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -531,6 +531,7 @@ py.test.skip("requires fork()") def entry_point(argv): + print "parentpid =", os.getpid() debug_start("foo") debug_print("test line") childpid = os.fork() @@ -543,40 +544,46 @@ t, cbuilder = self.compile(entry_point) path = udir.join('test_debug_print_fork.log') out, err = cbuilder.cmdexec("", err=True, - env={'PYPYLOG': ':%s' % path}) + env={'PYPYLOG': ':%s.%%d' % path}) assert not err + import time + time.sleep(0.5) # time for the forked children to finish # - f = open(str(path), 'r') + lines = out.splitlines() + assert lines[-1].startswith('parentpid = ') + parentpid = int(lines[-1][12:]) + # + f = open('%s.%d' % (path, parentpid), 'r') lines = f.readlines() f.close() assert '{foo' in lines[0] assert lines[1] == "test line\n" - offset1 = len(lines[0]) + len(lines[1]) + #offset1 = len(lines[0]) + len(lines[1]) assert lines[2].startswith('childpid = ') childpid = int(lines[2][11:]) assert childpid != 0 assert 'foo}' in lines[3] assert len(lines) == 4 # - f = open('%s.fork%d' % (path, childpid), 'r') + f = open('%s.%d' % (path, childpid), 'r') lines = f.readlines() f.close() - assert lines[0] == 'FORKED: %d %s\n' % (offset1, path) - assert lines[1] == 'childpid = 0\n' - offset2 = len(lines[0]) + len(lines[1]) - assert lines[2].startswith('childpid2 = ') - childpid2 = int(lines[2][11:]) + #assert lines[0] == 'FORKED: %d %s\n' % (offset1, path) + assert lines[0] == 'childpid = 0\n' + #offset2 = len(lines[0]) + len(lines[1]) + assert lines[1].startswith('childpid2 = ') + childpid2 = int(lines[1][11:]) assert childpid2 != 0 - assert 'foo}' in lines[3] - assert len(lines) == 4 + assert 'foo}' in lines[2] + assert len(lines) == 3 # - f = open('%s.fork%d' % (path, childpid2), 'r') + f = open('%s.%d' % (path, childpid2), 'r') lines = f.readlines() f.close() - assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid) - assert lines[1] == 'childpid2 = 0\n' - assert 'foo}' in lines[2] - assert len(lines) == 3 + #assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid) + assert lines[0] == 'childpid2 = 0\n' + assert 'foo}' in lines[1] + assert len(lines) == 2 def test_debug_flush_at_exit(self): def entry_point(argv): From noreply at buildbot.pypy.org Mon Nov 16 06:14:40 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:14:40 +0100 (CET) Subject: [pypy-commit] pypy default: import cffi/60e372e91498 (Python3 fix only) Message-ID: <20151116111440.5C3C61C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80710:5a1d4f35f484 Date: 2015-11-16 12:14 +0100 http://bitbucket.org/pypy/pypy/changeset/5a1d4f35f484/ Log: import cffi/60e372e91498 (Python3 fix only) diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -62,7 +62,8 @@ if csource.startswith('*', endpos): parts.append('('); closing += ')' level = 0 - for i in xrange(endpos, len(csource)): + i = endpos + while i < len(csource): c = csource[i] if c == '(': level += 1 @@ -73,6 +74,7 @@ elif c in ',;=': if level == 0: break + i += 1 csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) From noreply at buildbot.pypy.org Mon Nov 16 06:16:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:16:11 +0100 (CET) Subject: [pypy-commit] pypy release-4.0.x: import cffi/60e372e91498 (Python3 fix only) Message-ID: <20151116111611.066421C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: release-4.0.x Changeset: r80711:22e46a230fef Date: 2015-11-16 12:14 +0100 http://bitbucket.org/pypy/pypy/changeset/22e46a230fef/ Log: import cffi/60e372e91498 (Python3 fix only) diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -62,7 +62,8 @@ if csource.startswith('*', endpos): parts.append('('); closing += ')' level = 0 - for i in xrange(endpos, len(csource)): + i = endpos + while i < len(csource): c = csource[i] if c == '(': level += 1 @@ -73,6 +74,7 @@ elif c in ',;=': if level == 0: break + i += 1 csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) From noreply at buildbot.pypy.org Mon Nov 16 06:25:42 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:25:42 +0100 (CET) Subject: [pypy-commit] cffi default: Skip this test when run inside pypy, where there is no ../c/commontypes.c Message-ID: <20151116112542.E95A11C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2407:60e372e91498 Date: 2015-11-16 12:04 +0100 http://bitbucket.org/cffi/cffi/changeset/60e372e91498/ Log: Skip this test when run inside pypy, where there is no ../c/commontypes.c diff --git a/testing/cffi1/test_commontypes.py b/testing/cffi1/test_commontypes.py --- a/testing/cffi1/test_commontypes.py +++ b/testing/cffi1/test_commontypes.py @@ -3,8 +3,11 @@ def getlines(): - f = open(os.path.join(os.path.dirname(cffi.__file__), - '..', 'c', 'commontypes.c')) + try: + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + except IOError: + py.test.skip("cannot find ../c/commontypes.c") lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] f.close() return lines From noreply at buildbot.pypy.org Mon Nov 16 06:25:45 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:25:45 +0100 (CET) Subject: [pypy-commit] cffi static-callback: hg merge default Message-ID: <20151116112545.1636F1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2408:bbc42a0625ee Date: 2015-11-16 12:26 +0100 http://bitbucket.org/cffi/cffi/changeset/bbc42a0625ee/ Log: hg merge default diff --git a/testing/cffi1/test_commontypes.py b/testing/cffi1/test_commontypes.py --- a/testing/cffi1/test_commontypes.py +++ b/testing/cffi1/test_commontypes.py @@ -3,8 +3,11 @@ def getlines(): - f = open(os.path.join(os.path.dirname(cffi.__file__), - '..', 'c', 'commontypes.c')) + try: + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + except IOError: + py.test.skip("cannot find ../c/commontypes.c") lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] f.close() return lines From noreply at buildbot.pypy.org Mon Nov 16 06:26:36 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 12:26:36 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Need an explicit cast here Message-ID: <20151116112636.D11951C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2409:2f83b7a79e6c Date: 2015-11-16 11:31 +0000 http://bitbucket.org/cffi/cffi/changeset/2f83b7a79e6c/ Log: Need an explicit cast here diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -371,7 +371,8 @@ prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) prnt('{') prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') - prnt(' _cffi_call_python = p[1];') + prnt(' _cffi_call_python = (void(*)(struct _cffi_callpy_s *, ' + 'char *))p[1];') prnt(' }') prnt(' p[0] = (const void *)%s;' % VERSION) prnt(' p[1] = &_cffi_type_context;') From noreply at buildbot.pypy.org Mon Nov 16 08:23:31 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 14:23:31 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: Need to acquire/release the GIL here Message-ID: <20151116132331.DE5E51C11C2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80712:2a6bc8abcb84 Date: 2015-11-16 14:23 +0100 http://bitbucket.org/pypy/pypy/changeset/2a6bc8abcb84/ Log: Need to acquire/release the GIL here diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py --- a/pypy/module/_cffi_backend/call_python.py +++ b/pypy/module/_cffi_backend/call_python.py @@ -3,6 +3,7 @@ from rpython.rlib.rarithmetic import intmask from rpython.rlib import jit from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.annlowlevel import llhelper from pypy.interpreter.error import oefmt @@ -39,6 +40,12 @@ """ from pypy.module._cffi_backend.ccallback import reveal_callback + after = rffi.aroundstate.after + if after: + after() + rffi.stackcounter.stacks_counter += 1 + llop.gc_stack_bottom(lltype.Void) # marker for trackgcroot.py + cerrno._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) if not ll_callpy.c_reserved1: @@ -63,6 +70,11 @@ cerrno._errno_before(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) + rffi.stackcounter.stacks_counter -= 1 + before = rffi.aroundstate.before + if before: + before() + def get_ll_cffi_call_python(): return llhelper(lltype.Ptr(CALLPY_FN), _cffi_call_python) From noreply at buildbot.pypy.org Mon Nov 16 10:02:51 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 16:02:51 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: import cffi/2f83b7a79e6c Message-ID: <20151116150251.9FFBC1C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80713:844df784ea7b Date: 2015-11-16 11:31 +0000 http://bitbucket.org/pypy/pypy/changeset/844df784ea7b/ Log: import cffi/2f83b7a79e6c diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py --- a/lib_pypy/cffi/recompiler.py +++ b/lib_pypy/cffi/recompiler.py @@ -371,7 +371,8 @@ prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) prnt('{') prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') - prnt(' _cffi_call_python = p[1];') + prnt(' _cffi_call_python = (void(*)(struct _cffi_callpy_s *, ' + 'char *))p[1];') prnt(' }') prnt(' p[0] = (const void *)%s;' % VERSION) prnt(' p[1] = &_cffi_type_context;') From noreply at buildbot.pypy.org Mon Nov 16 10:02:53 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 16:02:53 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: merge heads Message-ID: <20151116150253.DD7491C0334@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80714:f501098f4870 Date: 2015-11-16 14:23 +0000 http://bitbucket.org/pypy/pypy/changeset/f501098f4870/ Log: merge heads diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py --- a/pypy/module/_cffi_backend/call_python.py +++ b/pypy/module/_cffi_backend/call_python.py @@ -3,6 +3,7 @@ from rpython.rlib.rarithmetic import intmask from rpython.rlib import jit from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.annlowlevel import llhelper from pypy.interpreter.error import oefmt @@ -39,6 +40,12 @@ """ from pypy.module._cffi_backend.ccallback import reveal_callback + after = rffi.aroundstate.after + if after: + after() + rffi.stackcounter.stacks_counter += 1 + llop.gc_stack_bottom(lltype.Void) # marker for trackgcroot.py + cerrno._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) if not ll_callpy.c_reserved1: @@ -63,6 +70,11 @@ cerrno._errno_before(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) + rffi.stackcounter.stacks_counter -= 1 + before = rffi.aroundstate.before + if before: + before() + def get_ll_cffi_call_python(): return llhelper(lltype.Ptr(CALLPY_FN), _cffi_call_python) From noreply at buildbot.pypy.org Mon Nov 16 10:04:33 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Mon, 16 Nov 2015 16:04:33 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: add legend to plot_stm_log.py Message-ID: <20151116150433.9D6381C0334@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80715:57ece712776f Date: 2015-11-16 16:06 +0100 http://bitbucket.org/pypy/pypy/changeset/57ece712776f/ Log: add legend to plot_stm_log.py diff --git a/pypy/stm/plot_stm_log.py b/pypy/stm/plot_stm_log.py --- a/pypy/stm/plot_stm_log.py +++ b/pypy/stm/plot_stm_log.py @@ -18,12 +18,16 @@ def plot_boxes(boxes, y, ax): - coords = [(x, w) for x, w, c, i in boxes] - colors = [c for x, w, c, i in boxes] + coords, colors = [], [] + for x, w, style, i in boxes: + coords.append((x, w)) + c = STYLES[0][style] + colors.append(c) + # bars = ax.broken_barh(coords, (y + PADDING, BOX_HEIGHT), facecolors=colors, lw=1, edgecolor=(0, 0, 0), picker=True, antialiased=False, rasterized=True) - + # bars.boxes = boxes @@ -31,14 +35,31 @@ def plot_hlines(hlines, y, ax): global __offset args = [] - for x1, x2, color in hlines: + for x1, x2, style in hlines: arg = [[x1, x2], 2*[y + 2*PADDING + __offset * QUARTER_HEIGHT], - color] + STYLES[1][style]] args.extend(arg) __offset = (__offset + 1) % 4 - ax.plot(*args, linewidth=10, antialiased=False, rasterized=True) + ax.plot(*args, linewidth=10, antialiased=False, rasterized=True, + solid_capstyle='butt') + +def make_legend(ax): + import matplotlib.patches as mpatch + import matplotlib.lines as mlines + boxes, hlines = STYLES + items, labels = [], [] + for label, color in boxes.items(): + items.append(mpatch.Rectangle((0, 0), 1, 1, fc=color)) + labels.append(label) + for label, color in hlines.items(): + # items.append(mpatch.Rectangle((0, 0), 1, 1, fc=color)) + if len(color) < 4: + color = color[0] # e.g. "m-" + items.append(mlines.Line2D((0, 1), (0, 0), linewidth=10, color=color)) + labels.append(label) + ax.legend(items, labels) #################################### @@ -52,6 +73,12 @@ hlines.append((x1, x2, color)) +STYLES = [{'becoming inevitable':'b', + 'inevitable':'orange', + 'normal tx':'g', + 'aborted tx':'r'}, + {'paused/waiting':'darkred', + 'major gc':'m-'}] def add_transaction(boxes, hlines, tr): # get the values: inited, inevitabled, ended, aborted, pauses, gcs, info = ( @@ -62,22 +89,28 @@ assert inited is not None if inevitabled is not None: - add_box(boxes, inited, inevitabled, 'b', info) - add_box(boxes, inevitabled, ended, 'orange', info) + add_box(boxes, inited, inevitabled, + 'becoming inevitable', info) + add_box(boxes, inevitabled, ended, + 'inevitable', info) elif not aborted: - add_box(boxes, inited, ended, 'g', info) + add_box(boxes, inited, ended, + 'normal tx', info) else: - add_box(boxes, inited, ended, 'r', info) + add_box(boxes, inited, ended, + 'aborted tx', info) for start, end in pauses: if start == end: print "Warning, start and end of pause match" - add_hline(hlines, start, end, 'darkred') + add_hline(hlines, start, end, + 'paused/waiting') for start, end in gcs: if start == end: print "Warning, start and end of GC match" - add_hline(hlines, start, end, 'b-.') + add_hline(hlines, start, end, + 'major gc') class Transaction(object): @@ -190,6 +223,7 @@ plot_boxes(boxes, th_num, ax) plot_hlines(hlines, th_num, ax) + make_legend(ax) print "> Pauses:", len(hlines) # plt.ioff() From noreply at buildbot.pypy.org Mon Nov 16 12:48:44 2015 From: noreply at buildbot.pypy.org (arigo) Date: Mon, 16 Nov 2015 18:48:44 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: Add the HTML file we use to redirect from bugs.pypy.org Message-ID: <20151116174844.51DC71C14D6@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r655:8819072a1c08 Date: 2015-11-16 18:49 +0100 http://bitbucket.org/pypy/pypy.org/changeset/8819072a1c08/ Log: Add the HTML file we use to redirect from bugs.pypy.org diff --git a/redirect_bugs_pypy_org.html b/redirect_bugs_pypy_org.html new file mode 100644 --- /dev/null +++ b/redirect_bugs_pypy_org.html @@ -0,0 +1,20 @@ + + +

    PyPy Issue tracker

    +

    The issue tracker for PyPy moved here: +https://bitbucket.org/pypy/pypy/issues

    +

    You should be redirected automatically.

    + + + + From noreply at buildbot.pypy.org Mon Nov 16 13:12:21 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 16 Nov 2015 19:12:21 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: add numpy-specific warning to space Message-ID: <20151116181221.9BA3E1C0334@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80716:79c16090f3f8 Date: 2015-11-16 20:09 +0200 http://bitbucket.org/pypy/pypy/changeset/79c16090f3f8/ Log: add numpy-specific warning to space diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py --- a/pypy/module/micronumpy/__init__.py +++ b/pypy/module/micronumpy/__init__.py @@ -43,6 +43,11 @@ from pypy.module.micronumpy.concrete import _setup _setup() + def setup_after_space_initialization(self): + from pypy.module.micronumpy.support import W_VisibleDeprecationWarning + for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items(): + setattr(self.space, 'w_' + name, self.space.gettypefor(w_type)) + class UMathModule(MixedModule): appleveldefs = {} interpleveldefs = { diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -121,8 +121,8 @@ " dimension 0; dimension is %d but corresponding" " boolean dimension is %d" % (self.get_shape()[0], arr.get_shape()[0])) - warning = space.gettypefor(support.W_VisibleDeprecationWarning) - space.warn(space.wrap(msg), warning) + #warning = space.gettypefor(support.W_VisibleDeprecationWarning) + space.warn(space.wrap(msg), space.w_VisibleDeprecationWarning) res_shape = [size] + self.get_shape()[1:] else: res_shape = [size] From noreply at buildbot.pypy.org Mon Nov 16 13:12:23 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 16 Nov 2015 19:12:23 +0100 (CET) Subject: [pypy-commit] pypy default: fix, cleanup release notice Message-ID: <20151116181223.CBEAF1C0334@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80717:5777f54ccc00 Date: 2015-11-16 20:12 +0200 http://bitbucket.org/pypy/pypy/changeset/5777f54ccc00/ Log: fix, cleanup release notice diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst --- a/pypy/doc/release-4.0.1.rst +++ b/pypy/doc/release-4.0.1.rst @@ -2,7 +2,7 @@ PyPy 4.0.1 ========== -We have released PyPy 4.0.1, a bux-fix release after PyPy 4.0.1. We have fixed +We have released PyPy 4.0.1, a bux-fix release for PyPy 4.0.0. We have fixed a few critical bugs in the JIT compiled code, reported by users. We encourage all users of PyPy to update to this version. @@ -46,18 +46,12 @@ `dynamic languages`_ to see what RPython can do for them. This release supports **x86** machines on most common operating systems -(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), -as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. - -We also introduce `support for the 64 bit PowerPC`_ hardware, specifically -Linux running the big- and little-endian variants of ppc64. +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd), +newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the +big- and little-endian variants of **ppc64** running Linux. .. _`pypy and cpython 2.7.x`: http://speed.pypy.org -.. _OpenBSD: http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy -.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ .. _`dynamic languages`: http://pypyjs.org -.. _`support for the 64 bit PowerPC`: http://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html -.. _`here`: http://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html Other Highlights (since 4.0.0 released three weeks ago) ======================================================= From noreply at buildbot.pypy.org Mon Nov 16 14:19:20 2015 From: noreply at buildbot.pypy.org (mattip) Date: Mon, 16 Nov 2015 20:19:20 +0100 (CET) Subject: [pypy-commit] pypy default: not really a bug-fix, too many enhancements Message-ID: <20151116191920.4015B1C11C2@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80718:1754f866d9cb Date: 2015-11-16 21:19 +0200 http://bitbucket.org/pypy/pypy/changeset/1754f866d9cb/ Log: not really a bug-fix, too many enhancements diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst --- a/pypy/doc/release-4.0.1.rst +++ b/pypy/doc/release-4.0.1.rst @@ -2,10 +2,10 @@ PyPy 4.0.1 ========== -We have released PyPy 4.0.1, a bux-fix release for PyPy 4.0.0. We have fixed -a few critical bugs in the JIT compiled code, reported by users. We encourage -all users of PyPy to update to this version. - +We have released PyPy 4.0.1, three weeks after PyPy 4.0.0. We have fixed +a few critical bugs in the JIT compiled code, reported by users. We therefore +encourage all users of PyPy to update to this version. There are a few minor +enhancements in this version as well. You can download the PyPy 4.0.1 release here: @@ -85,7 +85,7 @@ * Improve support for __array_interface__ - * Propogate NAN mantissas through float16-float32-float64 conversions + * Propagate NAN mantissas through float16-float32-float64 conversions * Performance improvements and refactorings: From noreply at buildbot.pypy.org Mon Nov 16 19:12:07 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 17 Nov 2015 01:12:07 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Make it possible to tell the annotator what exceptions builtins raise Message-ID: <20151117001207.5DA061C13B6@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80719:1a9060a49acb Date: 2015-11-17 00:13 +0000 http://bitbucket.org/pypy/pypy/changeset/1a9060a49acb/ Log: Make it possible to tell the annotator what exceptions builtins raise diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -106,18 +106,23 @@ args_s = [s_obj] nonneg = isinstance(s_obj, SomeInteger) and s_obj.nonneg return constpropagate(int, args_s, SomeInteger(nonneg=nonneg)) +builtin_int.can_only_throw = [ValueError] def builtin_float(s_obj): return constpropagate(float, [s_obj], SomeFloat()) +builtin_float.can_only_throw = [ValueError] def builtin_chr(s_int): return constpropagate(chr, [s_int], SomeChar()) +builtin_chr.can_only_throw = [ValueError] def builtin_unichr(s_int): return constpropagate(unichr, [s_int], SomeUnicodeCodePoint()) +builtin_unichr.can_only_throw = [ValueError] def builtin_unicode(s_unicode): return constpropagate(unicode, [s_unicode], SomeUnicodeString()) +builtin_unicode.can_only_throw = [UnicodeDecodeError] def builtin_bytearray(s_str): return SomeByteArray() diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -563,6 +563,11 @@ def can_be_none(self): return False + @property + def can_only_throw(self): + # Unless otherwise specified, builtins don't raise exceptions + return getattr(self.analyser, 'can_only_throw', []) + class SomeBuiltinMethod(SomeBuiltin): """ Stands for a built-in method which has got special meaning diff --git a/rpython/annotator/test/test_annsimplifyrpython.py b/rpython/annotator/test/test_annsimplifyrpython.py --- a/rpython/annotator/test/test_annsimplifyrpython.py +++ b/rpython/annotator/test/test_annsimplifyrpython.py @@ -135,3 +135,16 @@ a = self.RPythonAnnotator() with py.test.raises(AnnotatorError): a.build_types(f, [int]) + + def test_irrelevant_except(self): + def f(name): + try: + number = int(name) + except IndexError: + return 0 + return number + a = self.RPythonAnnotator() + s = a.build_types(f, [str]) + graph = graphof(a, f) + return_links = [l for l in graph.iterlinks() if l.target is graph.returnblock] + assert len(return_links) == 1 diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -863,6 +863,19 @@ kwds_s['s_'+key] = s_value return self.analyser(*args_s, **kwds_s) +def read_builtins_exc(s_builtin): + return getattr(s_builtin, 'can_only_throw', []) + + at op.simple_call.register(SomeBuiltin) +def simple_call_SomeBuiltin(annotator, v_func, *args_v): + return simple_call_SomeObject(annotator, v_func, *args_v) +simple_call_SomeBuiltin.can_only_throw = read_builtins_exc + + at op.call_args.register(SomeBuiltin) +def call_args_SomeBuiltin(annotator, v_func, *args_v): + return call_args(annotator, v_func, *args_v) +call_args_SomeBuiltin.can_only_throw = read_builtins_exc + class __extend__(SomeBuiltinMethod): def _can_only_throw(self, *args): From noreply at buildbot.pypy.org Tue Nov 17 02:55:49 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 17 Nov 2015 08:55:49 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: basic int_mul_ovf implemented, there is a quirx in the logic that does not allow correct execution yet Message-ID: <20151117075549.552991C1211@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80720:ad3440cae96e Date: 2015-11-16 18:39 +0100 http://bitbucket.org/pypy/pypy/changeset/ad3440cae96e/ Log: basic int_mul_ovf implemented, there is a quirx in the logic that does not allow correct execution yet diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -1,7 +1,14 @@ from rpython.jit.backend.zarch import locations as loc from rpython.rlib.objectmodel import specialize +# CGIJ for instance has another mask encoding prefixed with J +J_EQ = loc.imm(0x1) +J_LT = loc.imm(0x2) +J_LE = loc.imm(0x2 | 0x1) +J_GT = loc.imm(0x4) +J_GE = loc.imm(0x4 | 0x1) +# normal branch instructions EQ = loc.imm(0x8) LT = loc.imm(0x4) GT = loc.imm(0x2) diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -41,6 +41,20 @@ self.free_op_vars() return [l0, l1] +def prepare_int_mul_ovf(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + if check_imm32(a0): + a0, a1 = a1, a0 + lr,lq = self.rm.ensure_even_odd_pair(a0, bind_first=False) + if check_imm32(a1): + l1 = imm(a1.getint()) + else: + l1 = self.ensure_reg(a1) + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [lr, lq, l1] + def prepare_int_div(self, op): a0 = op.getarg(0) a1 = op.getarg(1) diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -123,8 +123,8 @@ self.writechar(chr(imm)) return encode_i -def build_rr(mnemonic, (opcode,)): - @builder.arguments('r,r') +def build_rr(mnemonic, (opcode,), argtypes='r,r'): + @builder.arguments(argtypes) def encode_rr(self, reg1, reg2): self.writechar(opcode) operands = ((reg1 & 0x0f) << 4) | (reg2 & 0xf) @@ -338,6 +338,20 @@ build_rie_g = build_rie_a +def build_rie_c(mnemonic, (opcode1,opcode2)): + br = is_branch_relative(mnemonic) + @builder.arguments('r,i8,r/m,i16') + def encode_rie_c(self, reg1, imm8, mask, imm16): + self.writechar(opcode1) + byte = (reg1 & BIT_MASK_4) << 4 | (mask & BIT_MASK_4) + self.writechar(chr(byte)) + if br: + imm16 = imm16 >> 1 + self.write_i16(imm16 & BIT_MASK_16) + self.writechar(chr(imm8 & 0xff)) + self.writechar(opcode2) + return encode_rie_c + @always_inline def _encode_rrf(self, opcode1, opcode2, r1, r2, rm3, rm4): self.writechar(opcode1) @@ -398,7 +412,7 @@ return function def is_branch_relative(name): - return name.startswith('BR') + return name.startswith('BR') or name.endswith('J') def build_instr_codes(clazz): for mnemonic, params in all_mnemonic_codes.items(): diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -24,6 +24,7 @@ 'MSGR': ('rre', ['\xB9','\x0C']), 'MSG': ('rxy', ['\xE3','\x0C']), 'MSGFI': ('ril', ['\xC2','\x00']), + 'MLGR': ('rre', ['\xB9','\x86']), # div/mod 'DSGR': ('rre', ['\xB9','\x0D'], 'eo,r'), 'DSG': ('rxy', ['\xE3','\x0D'], 'eo,bidl'), @@ -60,6 +61,7 @@ 'CLG': ('rxy', ['\xE3','\x21']), 'CGHI': ('ri', ['\xA7','\x0F']), 'CGFI': ('ril', ['\xC2','\x0C']), + 'CGIJ': ('rie_c', ['\xEC','\x7E']), } logic_mnemonic_codes = { @@ -111,9 +113,10 @@ # load memory 'LMD': ('sse', ['\xEF']), - 'LMG': ('rsy_a', ['\xEB','\x04']), + 'LMG': ('rsy_a', ['\xEB','\x04']), 'LHI': ('ri', ['\xA7','\x08']), 'LGHI': ('ri', ['\xA7','\x09']), + 'LGFI': ('ril', ['\xC0','\x01']), 'LR': ('rr', ['\x18']), 'LGR': ('rre', ['\xB9','\x04']), 'LG': ('rxy', ['\xE3','\x04']), @@ -133,6 +136,9 @@ 'STE': ('rx', ['\x70']), 'STD': ('rx', ['\x60']), + 'SPM': ('rr', ['\x04'], 'r,-'), + 'IPM': ('rre', ['\xB2','\x22'], 'r,-'), + # load binary float # E -> short (32bit), diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -15,6 +15,52 @@ emit_int_sub = gen_emit_rr_or_rpool('SGR', 'SG') emit_int_sub_ovf = emit_int_sub emit_int_mul = gen_emit_imm_pool_rr('MSGFI', 'MSG', 'MSGR') + def emit_int_mul_ovf(self, op, arglocs, regalloc): + lr, lq, l1 = arglocs + if l1.is_in_pool(): + self.mc.LTGR(r.SCRATCH, l1) + l1 = r.SCRATCH + elif l1.is_imm(): + self.mc.LGFI(r.SCRATCH, l1) + l1 = r.SCRATCH + + mc = self.mc + bc_one_signed = mc.CGIJ_byte_count + \ + mc.LPGR_byte_count * 2 + \ + mc.MLGR_byte_count + \ + mc.XG_byte_count + \ + mc.CGIJ_byte_count * 2 + \ + mc.BRC_byte_count + bc_none_signed = mc.MLGR_byte_count + mc.CGIJ_byte_count * 2 + mc.BRC_byte_count + bc_set_overflow = mc.IPM_byte_count + mc.OIHL_byte_count + mc.SPM_byte_count + + # check left neg + mc.CGIJ(lq, l.imm(0), c.J_LT, l.imm(mc.CGIJ_byte_count*2)) + mc.CGIJ(l1, l.imm(0), c.J_GE, l.imm(bc_one_signed)) + # left or right is negative + mc.LPGR(lq, lq) + mc.LPGR(l1, l1) + mc.MLGR(lr, l1) + off = mc.CGIJ_byte_count * 2 + mc.XG_byte_count + mc.BRC_byte_count + bc_none_signed + mc.CGIJ(lr, l.imm(0), c.J_LT, l.imm(off)) # jump to overflow + mc.CGIJ(lq, l.imm(0), c.J_LT, l.imm(off - mc.CGIJ_byte_count)) # jump to over overflow + mc.XG(lq, l.pool(self.pool.constant_64_sign_bit)) + mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow + bc_none_signed)) # no overflow happened + + # both are positive + mc.MLGR(lr, l1) + mc.CGIJ(lq, l.imm(0), c.LT, l.imm(mc.CGIJ_byte_count * 2 + mc.BRC_byte_count)) # jump to over overflow + mc.CGIJ(lr, l.imm(0), c.GT, l.imm(mc.CGIJ_byte_count + mc.BRC_byte_count)) # jump to overflow + mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow)) # no overflow happened + + # set overflow! + mc.IPM(r.SCRATCH) + mc.XGR(r.SCRATCH, r.SCRATCH) + mc.OILH(r.SCRATCH, l.imm(0xf000)) # sets OF + mc.SPM(r.SCRATCH) + + # no overflow happended + # import pdb; pdb.set_trace() emit_int_floordiv = gen_emit_pool_or_rr_evenodd('DSG','DSGR') emit_uint_floordiv = gen_emit_pool_or_rr_evenodd('DLG','DLGR') diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -17,6 +17,7 @@ self.offset_map = {} self.constant_64_zeros = -1 self.constant_64_ones = -1 + self.constant_64_sign_bit = -1 def ensure_can_hold_constants(self, asm, op): if op.is_guard(): @@ -38,6 +39,8 @@ self.offset_map[descr] = self.size elif op.getopnum() == rop.INT_INVERT: self.constant_64_ones = 1 # we need constant ones!!! + elif op.getopnum() == rop.INT_MUL_OVF: + self.constant_64_sign_bit = 1 for arg in op.getarglist(): if arg.is_constant(): self.offset_map[arg] = self.size @@ -91,6 +94,10 @@ asm.mc.write('\x00' * 8) self.constant_64_zeros = self.size written += 8 + if self.constant_64_sign_bit: + asm.mc.write('\x80' + '\x00' * 7) + self.constant_64_sign_bit = self.size + written += 8 self.size += written print "pool with %d quad words" % (self.size // 8) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -185,7 +185,7 @@ i = self.free_regs.index(odd) del self.free_regs[i] return even, odd - i += 1 + i -= 1 import pdb; pdb.set_trace() xxx @@ -538,6 +538,7 @@ prepare_int_sub = helper.prepare_int_sub prepare_int_sub_ovf = helper.prepare_int_sub prepare_int_mul = helper.prepare_int_mul + prepare_int_mul_ovf = helper.prepare_int_mul_ovf prepare_int_floordiv = helper.prepare_int_div prepare_uint_floordiv = helper.prepare_int_div prepare_int_mod = helper.prepare_int_mod diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -72,10 +72,18 @@ (2**63-2,'i1 = int_add_ovf(i0, 1)',0,'guard_no_overflow'), (2**63-2,'i1 = int_add_ovf(i0, 1)',1,'guard_overflow'), (2**63-1,'i1 = int_add_ovf(i0, 1)',0,'guard_overflow'), + (-2**63, 'i1 = int_sub_ovf(i0, 1)',1,'guard_no_overflow'), (-2**63+1,'i1 = int_sub_ovf(i0, 1)',0,'guard_no_overflow'), (-2**63+1,'i1 = int_sub_ovf(i0, 1)',1,'guard_overflow'), (-2**63, 'i1 = int_sub_ovf(i0, 1)',0,'guard_overflow'), + + (-2**63, 'i1 = int_mul_ovf(i0, 2)',1,'guard_no_overflow'), + #(-2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), + #(-2**63, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), + #(-2**15, 'i1 = int_mul_ovf(i0, 2)',1,'guard_overflow'), + #(-2**63, 'i1 = int_mul_ovf(i0, 2)',0,'guard_overflow'), + #(-2**63, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), ]) def test_int_arithmetic_overflow(self, value, opcode, result, guard): # result == 1 means branch has been taken of the guard From noreply at buildbot.pypy.org Tue Nov 17 02:55:51 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 17 Nov 2015 08:55:51 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: mul overflow implemented (thx arigato), added test cases stressing the border of overflow 64 bit overflow Message-ID: <20151117075551.7B0171C1211@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80721:889bc2492655 Date: 2015-11-17 08:56 +0100 http://bitbucket.org/pypy/pypy/changeset/889bc2492655/ Log: mul overflow implemented (thx arigato), added test cases stressing the border of overflow 64 bit overflow diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -1,13 +1,6 @@ from rpython.jit.backend.zarch import locations as loc from rpython.rlib.objectmodel import specialize -# CGIJ for instance has another mask encoding prefixed with J -J_EQ = loc.imm(0x1) -J_LT = loc.imm(0x2) -J_LE = loc.imm(0x2 | 0x1) -J_GT = loc.imm(0x4) -J_GE = loc.imm(0x4 | 0x1) - # normal branch instructions EQ = loc.imm(0x8) LT = loc.imm(0x4) diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -338,9 +338,9 @@ build_rie_g = build_rie_a -def build_rie_c(mnemonic, (opcode1,opcode2)): +def build_rie_c(mnemonic, (opcode1,opcode2), argtypes='r,i8,r/m,i16'): br = is_branch_relative(mnemonic) - @builder.arguments('r,i8,r/m,i16') + @builder.arguments(argtypes) def encode_rie_c(self, reg1, imm8, mask, imm16): self.writechar(opcode1) byte = (reg1 & BIT_MASK_4) << 4 | (mask & BIT_MASK_4) diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -61,7 +61,8 @@ 'CLG': ('rxy', ['\xE3','\x21']), 'CGHI': ('ri', ['\xA7','\x0F']), 'CGFI': ('ril', ['\xC2','\x0C']), - 'CGIJ': ('rie_c', ['\xEC','\x7E']), + 'CGIJ': ('rie_c', ['\xEC','\x7C']), + 'CLGIJ': ('rie_c', ['\xEC','\x7D'], 'r,u8,r/m,i16'), } logic_mnemonic_codes = { diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -18,45 +18,47 @@ def emit_int_mul_ovf(self, op, arglocs, regalloc): lr, lq, l1 = arglocs if l1.is_in_pool(): - self.mc.LTGR(r.SCRATCH, l1) + self.mc.LG(r.SCRATCH, l1) l1 = r.SCRATCH elif l1.is_imm(): self.mc.LGFI(r.SCRATCH, l1) l1 = r.SCRATCH mc = self.mc - bc_one_signed = mc.CGIJ_byte_count + \ - mc.LPGR_byte_count * 2 + \ - mc.MLGR_byte_count + \ - mc.XG_byte_count + \ - mc.CGIJ_byte_count * 2 + \ - mc.BRC_byte_count - bc_none_signed = mc.MLGR_byte_count + mc.CGIJ_byte_count * 2 + mc.BRC_byte_count + bc_one_signed = mc.LPGR_byte_count * 2 + \ + mc.MLGR_byte_count + \ + mc.XG_byte_count + \ + mc.CLGIJ_byte_count * 2 + \ + mc.BRC_byte_count + bc_none_signed = mc.MLGR_byte_count + mc.CGIJ_byte_count * 2 + mc.BRC_byte_count + mc.LPGR_byte_count * 2 bc_set_overflow = mc.IPM_byte_count + mc.OIHL_byte_count + mc.SPM_byte_count # check left neg - mc.CGIJ(lq, l.imm(0), c.J_LT, l.imm(mc.CGIJ_byte_count*2)) - mc.CGIJ(l1, l.imm(0), c.J_GE, l.imm(bc_one_signed)) + mc.CGIJ(lq, l.imm(0), c.LT, l.imm(mc.CGIJ_byte_count*2)) + mc.CGIJ(l1, l.imm(0), c.GE, l.imm(mc.CGIJ_byte_count*2 + bc_one_signed)) + mc.CGIJ(l1, l.imm(0), c.LT, l.imm(mc.CGIJ_byte_count + bc_one_signed)) # jump if both are negative # left or right is negative mc.LPGR(lq, lq) mc.LPGR(l1, l1) mc.MLGR(lr, l1) - off = mc.CGIJ_byte_count * 2 + mc.XG_byte_count + mc.BRC_byte_count + bc_none_signed - mc.CGIJ(lr, l.imm(0), c.J_LT, l.imm(off)) # jump to overflow - mc.CGIJ(lq, l.imm(0), c.J_LT, l.imm(off - mc.CGIJ_byte_count)) # jump to over overflow - mc.XG(lq, l.pool(self.pool.constant_64_sign_bit)) + off = mc.CLGIJ_byte_count * 2 + mc.XG_byte_count + mc.BRC_byte_count + bc_none_signed + mc.CLGIJ(lr, l.imm(0), c.GT, l.imm(off)) # jump to overflow + mc.CGIJ(lq, l.imm(0), c.LT, l.imm(off - mc.CGIJ_byte_count)) # jump to over overflow + mc.XG(lq, l.pool(self.pool.constant_64_sign_bit)) # only one is negative, set the sign bit! mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow + bc_none_signed)) # no overflow happened # both are positive + mc.LPGR(lq, lq) + mc.LPGR(l1, l1) mc.MLGR(lr, l1) mc.CGIJ(lq, l.imm(0), c.LT, l.imm(mc.CGIJ_byte_count * 2 + mc.BRC_byte_count)) # jump to over overflow - mc.CGIJ(lr, l.imm(0), c.GT, l.imm(mc.CGIJ_byte_count + mc.BRC_byte_count)) # jump to overflow + mc.CLGIJ(lr, l.imm(0), c.GT, l.imm(mc.CGIJ_byte_count + mc.BRC_byte_count)) # jump to overflow mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow)) # no overflow happened # set overflow! + mc.XGR(r.SCRATCH, r.SCRATCH) mc.IPM(r.SCRATCH) - mc.XGR(r.SCRATCH, r.SCRATCH) - mc.OILH(r.SCRATCH, l.imm(0xf000)) # sets OF + mc.OILH(r.SCRATCH, l.imm(0x3000)) # sets OF mc.SPM(r.SCRATCH) # no overflow happended diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -79,11 +79,20 @@ (-2**63, 'i1 = int_sub_ovf(i0, 1)',0,'guard_overflow'), (-2**63, 'i1 = int_mul_ovf(i0, 2)',1,'guard_no_overflow'), - #(-2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), - #(-2**63, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), - #(-2**15, 'i1 = int_mul_ovf(i0, 2)',1,'guard_overflow'), - #(-2**63, 'i1 = int_mul_ovf(i0, 2)',0,'guard_overflow'), - #(-2**63, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), + (-2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, 2)',0,'guard_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, -2)',0,'guard_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), + # positive! + (2**63-1, 'i1 = int_mul_ovf(i0, 33)',1,'guard_no_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), + (2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 99)',0,'guard_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 3323881828381)',0,'guard_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), ]) def test_int_arithmetic_overflow(self, value, opcode, result, guard): # result == 1 means branch has been taken of the guard @@ -97,6 +106,7 @@ loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) looptoken = JitCellToken() self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + #import pdb; pdb.set_trace() deadframe = self.cpu.execute_token(looptoken, value) fail = self.cpu.get_latest_descr(deadframe) res = self.cpu.get_int_value(deadframe, 0) From noreply at buildbot.pypy.org Tue Nov 17 03:23:29 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 09:23:29 +0100 (CET) Subject: [pypy-commit] pypy default: Skip a pointless failure showing up on Windows because some functions Message-ID: <20151117082329.D0B881C0526@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80722:a32752f2c531 Date: 2015-11-17 09:23 +0100 http://bitbucket.org/pypy/pypy/changeset/a32752f2c531/ Log: Skip a pointless failure showing up on Windows because some functions are not aligned to 16 bytes diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py --- a/rpython/rtyper/lltypesystem/lltype.py +++ b/rpython/rtyper/lltypesystem/lltype.py @@ -1469,7 +1469,10 @@ result = intmask(obj._getid()) # assume that id() returns an addressish value which is # not zero and aligned to at least a multiple of 4 - assert result != 0 and (result & 3) == 0 + # (at least for GC pointers; we can't really assume anything + # for raw addresses) + if self._T._gckind == 'gc': + assert result != 0 and (result & 3) == 0 return result def _cast_to_adr(self): From noreply at buildbot.pypy.org Tue Nov 17 03:38:10 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 09:38:10 +0100 (CET) Subject: [pypy-commit] pypy default: maybe a fix: this is needed for MS_WIN32 to be defined Message-ID: <20151117083810.85C711C0FE0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80723:c8be68c20100 Date: 2015-11-17 09:38 +0100 http://bitbucket.org/pypy/pypy/changeset/c8be68c20100/ Log: maybe a fix: this is needed for MS_WIN32 to be defined diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -4,6 +4,7 @@ #include #if defined(_MSC_VER) +# include typedef size_t uintptr_t; #else # include From noreply at buildbot.pypy.org Tue Nov 17 03:40:40 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 09:40:40 +0100 (CET) Subject: [pypy-commit] pypy default: comment Message-ID: <20151117084040.A8A2F1C0FE0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80724:e83475f80fac Date: 2015-11-17 09:40 +0100 http://bitbucket.org/pypy/pypy/changeset/e83475f80fac/ Log: comment diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -4,7 +4,7 @@ #include #if defined(_MSC_VER) -# include +# include /* needed at least to define MS_WIN32 */ typedef size_t uintptr_t; #else # include From noreply at buildbot.pypy.org Tue Nov 17 04:35:46 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 10:35:46 +0100 (CET) Subject: [pypy-commit] cffi default: fix Message-ID: <20151117093546.EF4FE1C0526@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2410:0c0093754b62 Date: 2015-11-17 10:36 +0100 http://bitbucket.org/cffi/cffi/changeset/0c0093754b62/ Log: fix diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py --- a/testing/cffi0/test_function.py +++ b/testing/cffi0/test_function.py @@ -486,7 +486,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: From noreply at buildbot.pypy.org Tue Nov 17 04:53:55 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 17 Nov 2015 10:53:55 +0100 (CET) Subject: [pypy-commit] benchmarks default: fix Java compatibility Message-ID: <20151117095355.AB5011C11C2@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r340:843b75028091 Date: 2015-11-17 10:56 +0100 http://bitbucket.org/pypy/benchmarks/changeset/843b75028091/ Log: fix Java compatibility diff --git a/multithread/lee_routing/lee_router.py b/multithread/lee_routing/lee_router.py --- a/multithread/lee_routing/lee_router.py +++ b/multithread/lee_routing/lee_router.py @@ -62,7 +62,7 @@ MAX_WEIGHT = 1 # used as loop indices to look at neighbouring cells -NEIGHBOUR_OFFS = ((1,0), (-1,0), (0,1), (0,-1)) +NEIGHBOUR_OFFS = ((0,1), (1,0), (0,-1), (-1,0)) class Grid(object): @@ -320,7 +320,7 @@ @staticmethod def _tlength(x1, y1, x2, y2): sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) - return math.sqrt(sq); + return int(math.sqrt(float(sq))) def _backtrack_from(self, x_goal, y_goal, x_start, y_start, track_no, tempgrid, grid): diff --git a/multithread/lee_routing/lee_router_tm.py b/multithread/lee_routing/lee_router_tm.py --- a/multithread/lee_routing/lee_router_tm.py +++ b/multithread/lee_routing/lee_router_tm.py @@ -39,10 +39,23 @@ # Translated from Java to Python by Remi Meier -import time, Tkinter +import time import sys, math import threading +try: + from pypystm import atomic, hint_commit_soon +except ImportError: + print "NOT RUNNING STM" + atomic = threading.RLock() + hint_commit_soon = lambda : 0 + +try: + from pypystm import STMQueue, STMEmpty +except ImportError: + from Queue import Queue as STMQueue, Empty as STMEmpty + + DEBUG = True CYAN = "#00FFFF" @@ -62,7 +75,7 @@ MAX_WEIGHT = 1 # used as loop indices to look at neighbouring cells -NEIGHBOUR_OFFS = ((1,0), (-1,0), (0,1), (0,-1)) +NEIGHBOUR_OFFS = ((0,1), (1,0), (0,-1), (-1,0)) class Grid(object): @@ -98,7 +111,7 @@ def occupy(self, lo_x, lo_y, up_x, up_y): for x in range(lo_x, up_x + 1): for y in range(lo_y, up_y + 1): - for c in range(len(self.depth)): + for c in range(self.depth): self[x, y, c] = OCC # depth = self._data[x][y] # for c in range(len(depth)): @@ -129,59 +142,28 @@ -class WorkQueue(object): - def __init__(self, xx1=0, yy1=0, xx2=0, yy2=0, n=0): - self.next = None - self.x1 = xx1 - self.y1 = yy1 - self.x2 = xx2 - self.y2 = yy2 - self.nn = n - def enqueue(self, x1, y1, x2, y2, n): - q = WorkQueue(x1, y1, x2, y2, n) - q.next = self.next - return q +class WorkItem: + def __init__(self, x1=0, y1=0, x2=0, y2=0, n=0): + self.x1, self.y1, self.x2, self.y2, self.n = ( + x1, y1, x2, y2, n) + + def __cmp__(self, o): + selfLen = ((self.x2 - self.x1) * (self.x2 - self.x1) + + (self.y2 - self.y1) * (self.y2 - self.y1)) + otherLen = ((o.x2 - o.x1) * (o.x2 - o.x1) + + (o.y2 - o.y1) * (o.y2 - o.y1)) + return cmp(selfLen, otherLen) + + +class WorkQueue: + def __init__(self, items): + self._stmQ = STMQueue() + for i in (items): + self._stmQ.put(i) def dequeue(self): - q = self.next - self.next = self.next.next - return q - - # def length(self): - # curr = self.next - # retval = 0 - # while curr is not None: - # retval += 1 - # curr = curr.next - # return retval - - def _less(self, other): - return (((self.x2 - self.x1) * (self.x2 - self.x1) - + (self.y2 - self.y1) * (self.y2 - self.y1)) - > ((other.x2 - other.x1) * (other.x2 - other.x1) - + (other.y2 - other.y1) * (other.y2 - other.y1))) - - def _pass(self): - done = True - ent = self - a = ent.next - while a.next is not None: - b = a.next - if a._less(b): - ent.next = b - a.next = b.next - b.next = a - done = False - ent = a - a = b - b = b.next - return done - - def sort(self): - while not self._pass(): - pass - + return self._stmQ.get(0) @@ -195,30 +177,27 @@ def run(self): while True: - with atomic: - self.wq = self.lr.get_next_track() - # - if self.wq is None: - print "finished" - return - # - #self.tempgrid = Grid(GRID_SIZE, GRID_SIZE, 2) - self.lr.lay_next_track(self.wq, self.tempgrid) + self.wq = self.lr.get_next_track() + if self.wq is None: + print "finished" + return + # + #self.tempgrid = Grid(GRID_SIZE, GRID_SIZE, 2) + self.lr.lay_next_track(self.wq, self.tempgrid) -from pypystm import atomic, hint_commit_soon - class LeeRouter(object): def __init__(self, file): self.grid = Grid(GRID_SIZE, GRID_SIZE, 2) - self.work = WorkQueue() + self._work = [] self.net_no = 0 self._parse_data_file(file) self.grid.add_weights() - self.work.sort() - self.queue_lock = threading.Lock() + self._compatibility_sort(self._work) + self.workQ = WorkQueue(self._work) + # self.grid_lock = atomic#threading.Lock() self.view = Viewer() @@ -242,19 +221,53 @@ # join connection pts x0, y0, x1, y1 = params self.net_no += 1 - self.work.next = self.work.enqueue(x0, y0, x1, y1, self.net_no) + # do what happens in Java (insert instead of append): + self._work.insert(0,WorkItem(x0, y0, x1, y1, self.net_no)) + + @staticmethod + def _compatibility_sort(work): + def _pass(): + done = True + ent = -1 + a = ent + 1 + while a + 1 < len(work): + b = a + 1 + if work[a] > work[b]: + # swap a, b + work[a], work[b] = work[b], work[a] + a, b = b, a + assert ent == b - 1 + + done = False + ent = a + a = b + b = b + 1 + return done + # + while not _pass(): + pass + #print "|".join(map(lambda x:str((x.x1 - x.x2)**2+(x.y1-x.y2)**2), work[:20])) + + # @staticmethod + # def _compatibility_sort(work): + # # just here for result-compatibility with Java code + # for passnum in range(len(work) - 1, 0, -1): + # for i in range(passnum): + # if work[i] > work[i+1]: + # work[i], work[i+1] = work[i+1], work[i] + # #print "|".join(map(lambda x:str((x.x1 - x.x2)**2+(x.y1-x.y2)**2), work)) def get_next_track(self): - with self.queue_lock: - if self.work.next is not None: - return self.work.dequeue() - return None + try: + return self.workQ.dequeue() + except STMEmpty: + return None def lay_next_track(self, wq, tempgrid): # start transaction with self.grid_lock: done = self._connect(wq.x1, wq.y1, wq.x2, wq.y2, - wq.nn, tempgrid, self.grid) + wq.n, tempgrid, self.grid) return done # end transaction def create_thread(self): @@ -330,7 +343,7 @@ @staticmethod def _tlength(x1, y1, x2, y2): sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) - return math.sqrt(sq); + return int(math.sqrt(float(sq))) def _backtrack_from(self, x_goal, y_goal, x_start, y_start, track_no, tempgrid, grid): @@ -494,6 +507,7 @@ self.points.append((x, y, col)) def show(self, width=GRID_SIZE, height=GRID_SIZE): + import Tkinter master = Tkinter.Tk() c = Tkinter.Canvas(master, width=width, height=height, background="black") From noreply at buildbot.pypy.org Tue Nov 17 05:24:31 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 17 Nov 2015 11:24:31 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: IN-PROGRESS: we would like this test to pass, failing so far Message-ID: <20151117102431.5CA701C0FE0@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80725:6fbe291f9f9b Date: 2015-11-17 11:24 +0100 http://bitbucket.org/pypy/pypy/changeset/6fbe291f9f9b/ Log: IN-PROGRESS: we would like this test to pass, failing so far diff --git a/rpython/jit/metainterp/test/test_rawmem.py b/rpython/jit/metainterp/test/test_rawmem.py --- a/rpython/jit/metainterp/test/test_rawmem.py +++ b/rpython/jit/metainterp/test/test_rawmem.py @@ -1,7 +1,8 @@ from rpython.jit.metainterp.test.support import LLJitMixin from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.rawstorage import (alloc_raw_storage, raw_storage_setitem, - free_raw_storage, raw_storage_getitem) + free_raw_storage, raw_storage_getitem, + str_storage_getitem) class RawMemTests(object): @@ -105,6 +106,21 @@ res = self.interp_operations(f, []) assert res == ord('X') + def test_str_storage_int(self): + import struct + data = struct.pack('q', 42) + def f(): + res = str_storage_getitem(lltype.Signed, data, 0) + return res + res = self.interp_operations(f, []) + assert res == 42 + import pdb;pdb.set_trace() + self.check_operations_history({'call_i': 1, 'guard_no_exception': 1, + 'call_n': 1, + 'raw_store': 1, 'raw_load_i': 1, + 'finish': 1}) + self.metainterp.staticdata.stats.check_resops({'finish': 1}, omit_finish=False) + class TestRawMem(RawMemTests, LLJitMixin): From noreply at buildbot.pypy.org Tue Nov 17 06:48:16 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 12:48:16 +0100 (CET) Subject: [pypy-commit] pypy default: aaargh, MS_WIN32 is defined in cpython's own include files, not as I Message-ID: <20151117114816.88DC31C0FE0@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80726:fe575252cf40 Date: 2015-11-17 12:48 +0100 http://bitbucket.org/pypy/pypy/changeset/fe575252cf40/ Log: aaargh, MS_WIN32 is defined in cpython's own include files, not as I thought by including windows.h! diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -4,7 +4,7 @@ #include #if defined(_MSC_VER) -# include /* needed at least to define MS_WIN32 */ +# define MS_WIN32 typedef size_t uintptr_t; #else # include From noreply at buildbot.pypy.org Tue Nov 17 07:10:07 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 13:10:07 +0100 (CET) Subject: [pypy-commit] pypy release-4.0.x: win32: manually port fe575252cf40 from default Message-ID: <20151117121007.785E01C0526@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: release-4.0.x Changeset: r80727:5f8302b8bf9f Date: 2015-11-17 13:10 +0100 http://bitbucket.org/pypy/pypy/changeset/5f8302b8bf9f/ Log: win32: manually port fe575252cf40 from default diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -4,6 +4,7 @@ #include #if defined(_MSC_VER) +# define MS_WIN32 typedef size_t uintptr_t; #else # include From noreply at buildbot.pypy.org Tue Nov 17 07:23:41 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 17 Nov 2015 13:23:41 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: workaround for the JIT not emitting DETACH/REATTACH Message-ID: <20151117122341.1FBEF1C12D2@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80728:baa17f78bbb4 Date: 2015-11-17 13:25 +0100 http://bitbucket.org/pypy/pypy/changeset/baa17f78bbb4/ Log: workaround for the JIT not emitting DETACH/REATTACH _build_stm_enter_leave_transactional_zone_helpers does not emit DETACH/REATTACH events to the log in all cases. This patch tries to detect such a situation and approximates the REATTACH event when it finds a minor gc going on. The reverse situation (no DETACH, but REATTACH) is probably possible too, but not handled here. A real solution is still needed. diff --git a/pypy/stm/plot_stm_log.py b/pypy/stm/plot_stm_log.py --- a/pypy/stm/plot_stm_log.py +++ b/pypy/stm/plot_stm_log.py @@ -88,7 +88,9 @@ "\n".join(tr.info)) assert inited is not None - if inevitabled is not None: + if inevitabled is not None and not aborted: + # we may still be "aborted" if we aborted when + # we tried to become inevitable (XXX) add_box(boxes, inited, inevitabled, 'becoming inevitable', info) add_box(boxes, inevitabled, ended, @@ -125,6 +127,7 @@ self.inevitabled = None + def transaction_start(curr_trs, entry): if entry.threadnum in curr_trs: print "WARNING: Start of transaction while there is one already running" @@ -153,11 +156,15 @@ if entry.event == psl.STM_TRANSACTION_START: transaction_start(curr_trs, entry) - elif entry.event == psl.STM_TRANSACTION_REATTACH: - transaction_start(curr_trs, entry) # for now + elif entry.event == psl.STM_TRANSACTION_DETACH: + transaction_commit(curr_trs, finished_trs, entry) + elif (entry.event == psl.STM_TRANSACTION_REATTACH + or (entry.event == psl.STM_GC_MINOR_START + and curr_trs.get(th_num) is None)): + # minor GC is approximate fix for JIT not emitting REATTACH + # in certain situations: + transaction_start(curr_trs, entry) transaction_become_inevitable(curr_trs, entry) - elif entry.event == psl.STM_TRANSACTION_DETACH: - transaction_commit(curr_trs, finished_trs, entry) # for now elif entry.event == psl.STM_TRANSACTION_COMMIT: transaction_commit(curr_trs, finished_trs, entry) elif entry.event == psl.STM_BECOME_INEVITABLE: diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py --- a/pypy/stm/print_stm_log.py +++ b/pypy/stm/print_stm_log.py @@ -8,6 +8,9 @@ STM_TRANSACTION_COMMIT = 1 STM_TRANSACTION_ABORT = 2 +# sometimes there is a DETACH w/o REATTACH and the other way around. +# This happens because the JIT does not emit DETACH/REATTACH events +# to the log (XXX). STM_TRANSACTION_DETACH = 3 STM_TRANSACTION_REATTACH = 4 @@ -114,7 +117,9 @@ self._transaction_pause_time = 0.0 self._transaction_aborting = False self._transaction_inev = None + self._transaction_detached_time = 0.0 self._in_minor_coll = None + assert self._prev[1] == "stop" def transaction_start(self, entry): self.reset_counters() @@ -128,8 +133,24 @@ self._transaction_cpu_time += add_time elif prev_state == "pause": self._transaction_pause_time += add_time + elif prev_state == "detached": + self._transaction_detached_time += add_time self._prev = now, new_state + def make_sure_not_detached(self, entry): + # since some DETACH events are not followed by a REATTACH + # (because the JIT does not emit them), approximate by + # calling this method where we are sure that we shouldn't + # be detached. + if self._prev[1] == "detached": + self.progress(entry.timestamp, "run") + + def transaction_detach(self, entry): + self.progress(entry.timestamp, "detached") + + def transaction_reattach(self, entry): + self.progress(entry.timestamp, "run") + def transaction_commit(self, entry): assert not self._transaction_aborting self.progress(entry.timestamp, "stop") @@ -189,6 +210,7 @@ c.paused_time += wait_time def gc_minor_start(self, event): + self.make_sure_not_detached(event) self._in_minor_coll = event.timestamp def gc_minor_done(self, event): @@ -276,9 +298,9 @@ if entry.event == STM_TRANSACTION_START: t.transaction_start(entry) elif entry.event == STM_TRANSACTION_DETACH: - t.transaction_commit(entry) # for now + t.transaction_detach(entry) elif entry.event == STM_TRANSACTION_REATTACH: - t.transaction_start(entry) # for now + t.transaction_reattach(entry) t.become_inevitable(entry) elif entry.event == STM_TRANSACTION_COMMIT: t.transaction_commit(entry) From noreply at buildbot.pypy.org Tue Nov 17 08:37:07 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 17 Nov 2015 14:37:07 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added test to stress register pair allocation (even odd) as it is needed for division, some invariant is failing still Message-ID: <20151117133707.AD9FF1C1328@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80729:5df254e363c4 Date: 2015-11-17 11:41 +0100 http://bitbucket.org/pypy/pypy/changeset/5df254e363c4/ Log: added test to stress register pair allocation (even odd) as it is needed for division, some invariant is failing still diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -62,6 +62,7 @@ l1 = self.ensure_reg(a1) self.rm.force_result_in_reg(op, a0) self.free_op_vars() + self.rm._check_invariants() return [lr, lq, l1] def prepare_int_mod(self, op): diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -56,13 +56,12 @@ mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow)) # no overflow happened # set overflow! - mc.XGR(r.SCRATCH, r.SCRATCH) mc.IPM(r.SCRATCH) + # set bit 34 & 35 -> indicates overflow mc.OILH(r.SCRATCH, l.imm(0x3000)) # sets OF mc.SPM(r.SCRATCH) # no overflow happended - # import pdb; pdb.set_trace() emit_int_floordiv = gen_emit_pool_or_rr_evenodd('DSG','DSGR') emit_uint_floordiv = gen_emit_pool_or_rr_evenodd('DLG','DLGR') diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -1,6 +1,6 @@ from rpython.jit.backend.llsupport.regalloc import (RegisterManager, FrameManager, TempVar, compute_vars_longevity, - BaseRegalloc) + BaseRegalloc, NoVariableToSpill) from rpython.jit.backend.llsupport.jump import remap_frame_layout_mixed from rpython.jit.backend.zarch.arch import WORD from rpython.jit.codewriter import longlong @@ -170,32 +170,88 @@ even, odd = None, None REGS = r.registers i = len(self.free_regs)-1 + candidates = [] while i >= 0: even = self.free_regs[i] if even.is_even(): + # found an even registers that is actually free odd = REGS[even.value+1] - print even, "is even", odd if odd not in self.free_regs: - print odd, "is NOT free" + # sadly odd is not free, but for spilling + # we found a candidate + candidates.append(odd) + i -= 1 continue - print odd, "is free" self.reg_bindings[var] = even self.reg_bindings[var2] = odd del self.free_regs[i] i = self.free_regs.index(odd) del self.free_regs[i] return even, odd + else: + # an odd free register, maybe the even one is + # a candidate? + odd = even + even = REGS[even.value-1] + if even in r.MANAGED_REGS: + # yes even might be a candidate + candidates.append(even) i -= 1 - import pdb; pdb.set_trace() - xxx - loc = self._spill_var(v, forbidden_vars, selected_reg, - need_lower_byte=need_lower_byte) - prev_loc = self.reg_bindings.get(v, None) - if prev_loc is not None: - self.free_regs.append(prev_loc) - self.reg_bindings[v] = loc - return loc + if len(candidates) != 0: + cur_max_age = -1 + candidate = None + # pseudo step to find best spilling candidate + # similar to _pick_variable_to_spill, but tailored + # to take the even/odd register allocation in consideration + for next in self.reg_bindings: + if next in forbidden_vars: + continue + reg = self.reg_bindings[next] + if reg in candidates: + pass + max_age = self.longevity[next][1] + if cur_max_age < max_age: + cur_max_age = max_age + candidate = next + if candidate is not None: + # well, we got away with a single spill :) + reg = self.reg_bindings[candidate] + self.force_spill_var(candidate) + if reg.is_even(): + self.reg_bindings[var] = reg + rmfree = REGS[reg.value+1] + self.reg_bindings[var2] = rmfree + rmidx = self.free_regs.index(rmfree) + del self.free_regs[rmidx] + return reg, rmfree + else: + self.reg_bindings[var2] = reg + rmfree = REGS[reg.value-1] + self.reg_bindings[var] = rmfree + rmidx = self.free_regs.index(rmfree) + del self.free_regs[rmidx] + return rmfree, reg + + # there is no candidate pair that only would + # require one spill, thus we need to spill two! + # always take the first + for i, reg in enumerate(r.MANAGED_REGS): + if i+1 < len(r.MANAGED_REGS): + reg2 = r.MANAGED_REGS[i+1] + try: + even = self._spill_var(var, forbidden_vars, reg) + odd = self._spill_var(var2, forbidden_vars, reg2) + except NoVariableToSpill: + # woops, this is in efficient + continue + self.reg_bindings[var] = even + self.reg_bindings[var2] = odd + break + else: + # no break! this is bad. really bad + raise NoVariableToSpill() + return even, odd def force_result_in_even_reg(self, result_v, loc, forbidden_vars=[]): diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -106,7 +106,6 @@ loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) looptoken = JitCellToken() self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - #import pdb; pdb.set_trace() deadframe = self.cpu.execute_token(looptoken, value) fail = self.cpu.get_latest_descr(deadframe) res = self.cpu.get_int_value(deadframe, 0) @@ -116,8 +115,28 @@ assert res == 0 def test_double_evenodd_pair(self): - # TODO - pass + code = """ + [i0] + i1 = int_floordiv(i0, 2) + i2 = int_floordiv(i0, 3) + i3 = int_floordiv(i0, 4) + i4 = int_floordiv(i0, 5) + i5 = int_floordiv(i0, 6) + i6 = int_floordiv(i0, 7) + i7 = int_floordiv(i0, 8) + i8 = int_le(i1, 0) + guard_true(i8) [i1,i2,i3,i4,i5,i6,i7] + finish(i0, descr=faildescr) + """ + # the guard forces 3 spills because after 4 divisions + # all even slots of the managed registers are full + loop = parse(code, namespace={'faildescr': BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, 100) + fail = self.cpu.get_latest_descr(deadframe) + for i in range(2,9): + assert self.cpu.get_int_value(deadframe, i-2) == 100//i def test_double_evenodd_pair_spill(self): # TODO From noreply at buildbot.pypy.org Tue Nov 17 08:37:09 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 17 Nov 2015 14:37:09 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: finished implementation to allocate a register pair (even/odd), added test case to ensure the spilling is done correctly Message-ID: <20151117133709.DF53B1C1328@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80730:0b2023218277 Date: 2015-11-17 14:37 +0100 http://bitbucket.org/pypy/pypy/changeset/0b2023218277/ Log: finished implementation to allocate a register pair (even/odd), added test case to ensure the spilling is done correctly diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -193,7 +193,7 @@ # a candidate? odd = even even = REGS[even.value-1] - if even in r.MANAGED_REGS: + if even in r.MANAGED_REGS and even not in self.free_regs: # yes even might be a candidate candidates.append(even) i -= 1 @@ -209,11 +209,17 @@ continue reg = self.reg_bindings[next] if reg in candidates: - pass - max_age = self.longevity[next][1] - if cur_max_age < max_age: - cur_max_age = max_age - candidate = next + reg2 = None + if reg.is_even(): + reg2 = REGS[reg.value+1] + else: + reg2 = REGS[reg.value-1] + if reg2 not in r.MANAGED_REGS: + continue + max_age = self.longevity[next][1] + if cur_max_age < max_age: + cur_max_age = max_age + candidate = next if candidate is not None: # well, we got away with a single spill :) reg = self.reg_bindings[candidate] @@ -221,12 +227,16 @@ if reg.is_even(): self.reg_bindings[var] = reg rmfree = REGS[reg.value+1] + rmidx = self.free_regs.index(reg) + del self.free_regs[rmidx] self.reg_bindings[var2] = rmfree rmidx = self.free_regs.index(rmfree) del self.free_regs[rmidx] return reg, rmfree else: self.reg_bindings[var2] = reg + rmidx = self.free_regs.index(reg) + del self.free_regs[rmidx] rmfree = REGS[reg.value-1] self.reg_bindings[var] = rmfree rmidx = self.free_regs.index(rmfree) diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -138,6 +138,61 @@ for i in range(2,9): assert self.cpu.get_int_value(deadframe, i-2) == 100//i - def test_double_evenodd_pair_spill(self): - # TODO - pass + + + @py.test.mark.parametrize('value', [2,3,15,2**16,-2**5]) + def test_double_evenodd_pair_extensive(self, value): + instrs = [] + failargs = [] + values = [] + j = 0 + mapping = (('int_floordiv',lambda x,y: x // y), + ('int_mod', lambda x,y: x % y), + ('int_mul_ovf', lambda x,y: x * y)) + for i in range(20): + name, func = mapping[j] + instrs.append("i{d} = {i}(i0, {d})".format(d=i+1, i=name)) + values.append((name, func(value, i+1))) + failargs.append("i" + str(i+1)) + j += 1 + if j >= len(mapping): + j = 0 + code = """ + [i0] + {instrs} + i99 = int_add(i0, 1) + i100 = int_eq(i0,i99) + guard_true(i100) [{failargs}] # will always fail!! + finish(i0, descr=faildescr) + """.format(instrs=('\n' +' '*8).join(instrs), failargs=','.join(failargs)) + # the guard forces 3 spills because after 4 divisions + # all even slots of the managed registers are full + loop = parse(code, namespace={'faildescr': BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, value) + fail = self.cpu.get_latest_descr(deadframe) + for i,(name, v) in enumerate(values): + assert self.cpu.get_int_value(deadframe, i) == v + + @py.test.mark.parametrize('v1,v2', [ + (-32,3), + ]) + def test_int_mul_no_overflow(self, v1, v2): + try: + result = v1*v2 + except OverflowError: + py.test.skip("this test is not made to check the overflow!") + code = """ + [i0] + i1 = int_mul_ovf(i0,{v}) + finish(i1, descr=faildescr) + """.format(v=v2) + loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + import pdb; pdb.set_trace() + deadframe = self.cpu.execute_token(looptoken, v1) + fail = self.cpu.get_latest_descr(deadframe) + assert self.cpu.get_int_value(deadframe, 0) == result + From noreply at buildbot.pypy.org Tue Nov 17 12:03:10 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 17 Nov 2015 18:03:10 +0100 (CET) Subject: [pypy-commit] cffi static-callback: link to the reason for the callback new-style Message-ID: <20151117170310.A0F251C11C2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2411:cb74a1bcbad5 Date: 2015-11-17 18:03 +0100 http://bitbucket.org/cffi/cffi/changeset/cb74a1bcbad5/ Log: link to the reason for the callback new-style diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -433,7 +433,10 @@ ABI-mode solution. This is *new in version 1.4.* Use Callbacks_ if backward compatibility -is an issue. +is an issue. (The original callbacks have more overhead and potential +issues with libffi; see the warning__.) + +.. __: Callbacks_ In the builder script, declare in the cdef a function prefixed with ``CFFI_CALL_PYTHON``:: From noreply at buildbot.pypy.org Tue Nov 17 12:09:21 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 17 Nov 2015 18:09:21 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Change default SomeBuiltin behaviour to raising anything Message-ID: <20151117170921.91D551C1211@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80731:e143cbe401d1 Date: 2015-11-17 17:09 +0000 http://bitbucket.org/pypy/pypy/changeset/e143cbe401d1/ Log: Change default SomeBuiltin behaviour to raising anything diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -565,8 +565,8 @@ @property def can_only_throw(self): - # Unless otherwise specified, builtins don't raise exceptions - return getattr(self.analyser, 'can_only_throw', []) + # Unless otherwise specified, builtins can raise any exception + return getattr(self.analyser, 'can_only_throw', None) class SomeBuiltinMethod(SomeBuiltin): diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py --- a/rpython/rtyper/lltypesystem/lltype.py +++ b/rpython/rtyper/lltypesystem/lltype.py @@ -2192,6 +2192,7 @@ # presence of s_extraargs r = SomePtr(Ptr(s_T.const)) return r +ann_malloc.can_only_throw = [MemoryError] def free(p, flavor, track_allocation=True): From noreply at buildbot.pypy.org Tue Nov 17 14:00:16 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 17 Nov 2015 20:00:16 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: ironed out the bug in mul overflow, test runner is now passing two ovf tests! Message-ID: <20151117190016.CC7921C0FE0@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80732:173b585af649 Date: 2015-11-17 20:00 +0100 http://bitbucket.org/pypy/pypy/changeset/173b585af649/ Log: ironed out the bug in mul overflow, test runner is now passing two ovf tests! diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -643,17 +643,21 @@ gcmap = self._finish_gcmap else: gcmap = lltype.nullptr(jitframe.GCMAP) - #self.pool.load_gcmap(self.mc, r.r2, gcmap) + self.load_gcmap(self.mc, r.r2, gcmap) - assert fail_descr_loc.getint() <= 2**12-1 - self.mc.LGHI(r.r5, fail_descr_loc) - self.mc.STG(r.r5, l.addr(ofs, r.SPP)) - self.mc.XGR(r.r2, r.r2) # TODO + assert fail_descr_loc.getint() <= 2**32-1 + self.mc.LGFI(r.r3, fail_descr_loc) + self.mc.STG(r.r3, l.addr(ofs, r.SPP)) self.mc.STG(r.r2, l.addr(ofs2, r.SPP)) # exit function self._call_footer() + def load_gcmap(self, mc, reg, gcmap): + # load the current gcmap into register 'reg' + ptr = rffi.cast(lltype.Signed, gcmap) + mc.load_imm(reg, ptr) + def notimplemented_op(asm, op, arglocs, regalloc): print "[ZARCH/asm] %s not implemented" % op.getopname() raise NotImplementedError(op) diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -146,6 +146,14 @@ self.CGR(a, b) + def load_imm(self, dest_reg, word): + if word <= 32767 and word >= -32768: + self.LGHI(dest_reg, l.imm(word)) + elif word <= 2**31-1 and word >= -2**31: + self.LGFI(dest_reg, l.imm(word)) + else: + xxx + _classes = (AbstractZARCHBuilder,) # Used to build the MachineCodeBlockWrapper diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py --- a/rpython/jit/backend/zarch/helper/assembler.py +++ b/rpython/jit/backend/zarch/helper/assembler.py @@ -71,8 +71,6 @@ def gen_emit_shift(func): def f(self, op, arglocs, regalloc): l0, l1 = arglocs - if not l1.is_imm() or l1.is_in_pool(): - assert 0, "shift imm must NOT reside in pool!" getattr(self.mc, func)(l0, l0, l1) return f @@ -111,7 +109,7 @@ assert lr.is_even() assert lq.is_odd() if l1.is_in_pool(): - self.mc.DSG(lr, l1) + getattr(self.mc,pool_func)(lr, l1) else: - self.mc.DSGR(lr, l1) + getattr(self.mc,rr_func)(lr, l1) return emit diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -100,7 +100,6 @@ a0 = op.getarg(0) a1 = op.getarg(1) assert isinstance(a1, ConstInt) - l1 = self.ensure_reg(a1) assert check_imm20(a1) l0 = self.ensure_reg(a0) # note that the shift value is stored diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py --- a/rpython/jit/backend/zarch/instruction_builder.py +++ b/rpython/jit/backend/zarch/instruction_builder.py @@ -338,6 +338,21 @@ build_rie_g = build_rie_a +def build_rie_b(mnemonic, (opcode1,opcode2)): + br = is_branch_relative(mnemonic) + @builder.arguments('r,r,r/m,i16') + def encode_rie_b(self, reg1, reg2, mask, imm16): + self.writechar(opcode1) + byte = (reg1 & BIT_MASK_4) << 4 | (reg2 & BIT_MASK_4) + self.writechar(chr(byte)) + if br: + imm16 = imm16 >> 1 + self.write_i16(imm16 & BIT_MASK_16) + byte = (mask & BIT_MASK_4) << 4 + self.writechar(chr(byte)) + self.writechar(opcode2) + return encode_rie_b + def build_rie_c(mnemonic, (opcode1,opcode2), argtypes='r,i8,r/m,i16'): br = is_branch_relative(mnemonic) @builder.arguments(argtypes) @@ -395,6 +410,19 @@ self.writechar(opcode2) return encode_rxe +def build_ris(mnemonic, (opcode1,opcode2), argtypes='r,i8,r/m,bd'): + br = is_branch_relative(mnemonic) + @builder.arguments(argtypes) + def encode_rie_c(self, reg1, imm8, mask, basedisp): + self.writechar(opcode1) + byte = (reg1 & BIT_MASK_4) << 4 | (mask & BIT_MASK_4) + self.writechar(chr(byte)) + # + encode_base_displace(self, basedisp) + self.writechar(chr(imm8 & 0xff)) + self.writechar(opcode2) + return encode_rie_c + def build_unpack_func(mnemonic, func): def function(self, *args): newargs = [None] * len(func._arguments_) diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -43,8 +43,6 @@ 'LNGR': ('rre', ['\xB9','\x01']), 'LCGR': ('rre', ['\xB9','\x03']), - - # div 'AY': ('rxy', ['\xE3','\x5A']), @@ -63,6 +61,9 @@ 'CGFI': ('ril', ['\xC2','\x0C']), 'CGIJ': ('rie_c', ['\xEC','\x7C']), 'CLGIJ': ('rie_c', ['\xEC','\x7D'], 'r,u8,r/m,i16'), + 'CGIB': ('ris', ['\xEC','\xFC']), + 'CGRJ': ('rie_b', ['\xEC','\x64']), + 'CLGRJ': ('rie_b', ['\xEC','\x65']), } logic_mnemonic_codes = { diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py --- a/rpython/jit/backend/zarch/locations.py +++ b/rpython/jit/backend/zarch/locations.py @@ -204,10 +204,10 @@ return True def is_imm(self): - return True + return False def is_imm_float(self): - return self.isfloat + return False def is_float(self): return self.isfloat diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -25,13 +25,22 @@ l1 = r.SCRATCH mc = self.mc + bc_one_decision = mc.CLGRJ_byte_count +\ + mc.CLGIJ_byte_count + \ + mc.LCGR_byte_count + \ + mc.BRC_byte_count + \ + mc.SPM_byte_count bc_one_signed = mc.LPGR_byte_count * 2 + \ mc.MLGR_byte_count + \ - mc.XG_byte_count + \ - mc.CLGIJ_byte_count * 2 + \ - mc.BRC_byte_count - bc_none_signed = mc.MLGR_byte_count + mc.CGIJ_byte_count * 2 + mc.BRC_byte_count + mc.LPGR_byte_count * 2 - bc_set_overflow = mc.IPM_byte_count + mc.OIHL_byte_count + mc.SPM_byte_count + mc.LG_byte_count + \ + bc_one_decision + bc_none_signed = mc.LPGR_byte_count * 2 + \ + mc.MLGR_byte_count + \ + mc.LG_byte_count + \ + mc.CLGRJ_byte_count + \ + mc.CLGIJ_byte_count + \ + mc.BRC_byte_count + bc_set_overflow = mc.OIHL_byte_count + mc.SPM_byte_count # check left neg mc.CGIJ(lq, l.imm(0), c.LT, l.imm(mc.CGIJ_byte_count*2)) @@ -41,22 +50,27 @@ mc.LPGR(lq, lq) mc.LPGR(l1, l1) mc.MLGR(lr, l1) - off = mc.CLGIJ_byte_count * 2 + mc.XG_byte_count + mc.BRC_byte_count + bc_none_signed - mc.CLGIJ(lr, l.imm(0), c.GT, l.imm(off)) # jump to overflow - mc.CGIJ(lq, l.imm(0), c.LT, l.imm(off - mc.CGIJ_byte_count)) # jump to over overflow - mc.XG(lq, l.pool(self.pool.constant_64_sign_bit)) # only one is negative, set the sign bit! + mc.LG(r.SCRATCH, l.pool(self.pool.constant_max_64_positive)) + # is the value greater than 2**63 ? then an overflow occured + mc.CLGRJ(lq, r.SCRATCH, c.GT, l.imm(bc_one_decision + bc_none_signed)) # jump to over overflow + mc.CLGIJ(lr, l.imm(0), c.GT, l.imm(bc_one_decision - mc.CLGRJ_byte_count + bc_none_signed)) # jump to overflow + mc.LCGR(lq, lq) + mc.SPM(r.SCRATCH) # 0x80 ... 00 clears the condition code and program mask mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow + bc_none_signed)) # no overflow happened # both are positive mc.LPGR(lq, lq) mc.LPGR(l1, l1) mc.MLGR(lr, l1) - mc.CGIJ(lq, l.imm(0), c.LT, l.imm(mc.CGIJ_byte_count * 2 + mc.BRC_byte_count)) # jump to over overflow - mc.CLGIJ(lr, l.imm(0), c.GT, l.imm(mc.CGIJ_byte_count + mc.BRC_byte_count)) # jump to overflow + off = mc.CLGRJ_byte_count + mc.CLGIJ_byte_count + \ + mc.BRC_byte_count + mc.LG(r.SCRATCH, l.pool(self.pool.constant_64_ones)) + mc.CLGRJ(lq, r.SCRATCH, c.GT, l.imm(off)) # jump to over overflow + mc.CLGIJ(lr, l.imm(0), c.GT, l.imm(off - mc.CLGRJ_byte_count)) # jump to overflow mc.BRC(c.ANY, l.imm(mc.BRC_byte_count + bc_set_overflow)) # no overflow happened # set overflow! - mc.IPM(r.SCRATCH) + #mc.IPM(r.SCRATCH) # set bit 34 & 35 -> indicates overflow mc.OILH(r.SCRATCH, l.imm(0x3000)) # sets OF mc.SPM(r.SCRATCH) @@ -67,7 +81,27 @@ emit_uint_floordiv = gen_emit_pool_or_rr_evenodd('DLG','DLGR') # NOTE division sets one register with the modulo value, thus # the regalloc ensures the right register survives. - emit_int_mod = gen_emit_pool_or_rr_evenodd('DSG','DSGR') + #emit_int_mod = gen_emit_pool_or_rr_evenodd('DSG','DSGR') + def emit_int_mod(self, op, arglocs, regalloc): + lr, lq, l1 = arglocs # lr == remainer, lq == quotient + # when entering the function lr contains the dividend + # after this operation either lr or lq is used further + assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" + # remainer is always a even register r0, r2, ... , r14 + assert lr.is_even() + assert lq.is_odd() + if l1.is_in_pool(): + self.mc.DSG(lr, l1) + # python behavior? + #off = self.mc.CGIJ_byte_count+self.mc.AG_byte_count + #self.mc.CGIJ(lr, l.imm(0), c.GE, l.imm(off)) + #self.mc.AG(lr, l1) + else: + self.mc.DSGR(lr, l1) + # python behavior? + #off = self.mc.CGIJ_byte_count+self.mc.AGR_byte_count + #self.mc.CGIJ(lr, l.imm(0), c.GE, l.imm(off)) + #self.mc.AGR(lr, l1) def emit_int_invert(self, op, arglocs, regalloc): l0 = arglocs[0] diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -18,8 +18,10 @@ self.constant_64_zeros = -1 self.constant_64_ones = -1 self.constant_64_sign_bit = -1 + self.constant_max_64_positive = -1 def ensure_can_hold_constants(self, asm, op): + opnum = op.getopnum() if op.is_guard(): # 1x gcmap pointer # 1x target address @@ -41,6 +43,10 @@ self.constant_64_ones = 1 # we need constant ones!!! elif op.getopnum() == rop.INT_MUL_OVF: self.constant_64_sign_bit = 1 + self.constant_max_64_positive = 1 + elif opnum == rop.INT_RSHIFT or opnum == rop.INT_LSHIFT or \ + opnum == rop.UINT_RSHIFT: + return for arg in op.getarglist(): if arg.is_constant(): self.offset_map[arg] = self.size @@ -58,6 +64,10 @@ self.label_offset = 0 self.size = 0 self.offset_map.clear() + self.constant_64_zeros = -1 + self.constant_64_ones = -1 + self.constant_64_sign_bit = -1 + self.constant_max_64_positive -1 def pre_assemble(self, asm, operations, bridge=False): self.reset() @@ -84,20 +94,24 @@ assert self.size % 2 == 0 #if self.size % 2 == 1: # self.size += 1 - asm.mc.write('\xFF' * self.size) + asm.mc.write('\x00' * self.size) written = 0 - if self.constant_64_ones: + if self.constant_64_ones != -1: asm.mc.write('\xFF' * 8) self.constant_64_ones = self.size written += 8 - if self.constant_64_zeros: + if self.constant_64_zeros != -1: asm.mc.write('\x00' * 8) self.constant_64_zeros = self.size written += 8 - if self.constant_64_sign_bit: - asm.mc.write('\x80' + '\x00' * 7) + if self.constant_64_sign_bit != -1: + asm.mc.write('\x80' + ('\x00' * 7)) self.constant_64_sign_bit = self.size written += 8 + if self.constant_max_64_positive != -1: + asm.mc.write('\x7F' + ('\xFF' * 7)) + self.constant_max_64_positive = self.size + written += 8 self.size += written print "pool with %d quad words" % (self.size // 8) diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -7,7 +7,7 @@ [r0,r1,r2,r3,r4,r5,r6,r7,r8, r9,r10,r11,r12,r13,r14,r15] = registers -MANAGED_REGS = [r0,r1,r4,r5,r6,r7,r8,r9,r10,r12] +MANAGED_REGS = [r0,r1,r4,r5,r6,r7,r8,r9,r10,r12] # keep this list sorted (asc)! VOLATILES = [r6,r7,r8,r9,r10,r12] SP = r15 RETURN = r14 diff --git a/rpython/jit/backend/zarch/test/test_int.py b/rpython/jit/backend/zarch/test/test_int.py new file mode 100644 --- /dev/null +++ b/rpython/jit/backend/zarch/test/test_int.py @@ -0,0 +1,192 @@ +from rpython.jit.backend.test.runner_test import LLtypeBackendTest +from rpython.jit.backend.zarch.runner import CPU_S390_64 +from rpython.jit.tool.oparser import parse +from rpython.jit.metainterp.history import (AbstractFailDescr, + AbstractDescr, + BasicFailDescr, BasicFinalDescr, + JitCellToken, TargetToken, + ConstInt, ConstPtr, + Const, ConstFloat) +from rpython.jit.metainterp.resoperation import InputArgInt, InputArgFloat +from rpython.rtyper.lltypesystem import lltype +from rpython.jit.metainterp.resoperation import ResOperation, rop +import py + +class FakeStats(object): + pass + +class TestIntResOpZARCH(object): + cpu = CPU_S390_64(rtyper=None, stats=FakeStats()) + cpu.setup_once() + + @py.test.mark.parametrize('value,opcode,result', + [ (30,'i1 = int_mul(i0, 2)',60), + (30,'i1 = int_floordiv(i0, 2)',15), + (2**31,'i1 = int_floordiv(i0, 15)',2**31//15), + (0,'i1 = int_floordiv(i0, 1)', 0), + (1,'i1 = int_floordiv(i0, 1)', 1), + (0,'i1 = uint_floordiv(i0, 1)', 0), + (1,'i1 = uint_floordiv(i0, 1)', 1), + (30,'i1 = int_mod(i0, 2)', 0), + (1,'i1 = int_mod(i0, 2)', 1), + (1,'i1 = int_lshift(i0, 4)', 16), + (1,'i1 = int_lshift(i0, 0)', 1), + (4,'i1 = int_rshift(i0, 0)', 4), + (4,'i1 = int_rshift(i0, 1)', 2), + (-1,'i1 = int_rshift(i0, 0)', -1), + (-1,'i1 = int_lshift(i0, 1)', -2), + (-2**35,'i1 = int_lshift(i0, 1)', (-2**35)*2), + (2**64-1,'i1 = uint_rshift(i0, 2)', (2**64-1)//4), + (-1,'i1 = int_neg(i0)', -1), + (1,'i1 = int_neg(i0)', -1), + (2**63-1,'i1 = int_neg(i0)', -(2**63-1)), + (1,'i1 = int_invert(i0)', ~1), + (15,'i1 = int_invert(i0)', ~15), + (-1,'i1 = int_invert(i0)', ~(-1)), + (0,'i1 = int_is_zero(i0)', 1), + (50,'i1 = int_is_zero(i0)', 0), + (-1,'i1 = int_is_true(i0)', 1), + (0,'i1 = int_is_true(i0)', 0), + ]) + def test_int_arithmetic_and_logic(self, value, opcode, result): + loop = parse(""" + [i0] + {opcode} + finish(i1, descr=faildescr) + """.format(opcode=opcode),namespace={"faildescr": BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, value) + fail = self.cpu.get_latest_descr(deadframe) + res = self.cpu.get_int_value(deadframe, 0) + assert res == result + assert fail.identifier == 1 + + @py.test.mark.parametrize('value,opcode,result,guard', + [ (2**63-1,'i1 = int_add_ovf(i0, 1)',1,'guard_no_overflow'), + (2**63-2,'i1 = int_add_ovf(i0, 1)',0,'guard_no_overflow'), + (2**63-2,'i1 = int_add_ovf(i0, 1)',1,'guard_overflow'), + (2**63-1,'i1 = int_add_ovf(i0, 1)',0,'guard_overflow'), + + (-2**63, 'i1 = int_sub_ovf(i0, 1)',1,'guard_no_overflow'), + (-2**63+1,'i1 = int_sub_ovf(i0, 1)',0,'guard_no_overflow'), + (-2**63+1,'i1 = int_sub_ovf(i0, 1)',1,'guard_overflow'), + (-2**63, 'i1 = int_sub_ovf(i0, 1)',0,'guard_overflow'), + + (-2**63, 'i1 = int_mul_ovf(i0, 2)',1,'guard_no_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), + (-2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, 2)',0,'guard_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, -2)',0,'guard_overflow'), + (-2**63, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), + # positive! + (2**63-1, 'i1 = int_mul_ovf(i0, 33)',1,'guard_no_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), + (2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 99)',0,'guard_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 3323881828381)',0,'guard_overflow'), + (2**63-1, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), + ]) + def test_int_arithmetic_overflow(self, value, opcode, result, guard): + # result == 1 means branch has been taken of the guard + code = """ + [i0] + {opcode} + {guard}() [i0] + i2 = int_xor(i1,i1) + finish(i2, descr=faildescr) + """.format(opcode=opcode,guard=guard) + loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, value) + fail = self.cpu.get_latest_descr(deadframe) + res = self.cpu.get_int_value(deadframe, 0) + if result == 1: + assert res == value + else: + assert res == 0 + + def test_double_evenodd_pair(self): + code = """ + [i0] + i1 = int_floordiv(i0, 2) + i2 = int_floordiv(i0, 3) + i3 = int_floordiv(i0, 4) + i4 = int_floordiv(i0, 5) + i5 = int_floordiv(i0, 6) + i6 = int_floordiv(i0, 7) + i7 = int_floordiv(i0, 8) + i8 = int_le(i1, 0) + guard_true(i8) [i1,i2,i3,i4,i5,i6,i7] + finish(i0, descr=faildescr) + """ + # the guard forces 3 spills because after 4 divisions + # all even slots of the managed registers are full + loop = parse(code, namespace={'faildescr': BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, 100) + fail = self.cpu.get_latest_descr(deadframe) + for i in range(2,9): + assert self.cpu.get_int_value(deadframe, i-2) == 100//i + + + + @py.test.mark.parametrize('value', [2,3,15,2**16]) + def test_evenodd_pair_extensive(self, value): + instrs = [] + failargs = [] + values = [] + j = 0 + mapping = (('int_floordiv',lambda x,y: x // y), + ('int_mod', lambda x,y: x % y), + ('int_mul_ovf', lambda x,y: x * y)) + for i in range(20): + name, func = mapping[j] + instrs.append("i{d} = {i}(i0, {d})".format(d=i+1, i=name)) + values.append((name, func(value, i+1))) + failargs.append("i" + str(i+1)) + j += 1 + if j >= len(mapping): + j = 0 + code = """ + [i0] + {instrs} + i99 = int_add(i0, 1) + i100 = int_eq(i0,i99) + guard_true(i100) [{failargs}] # will always fail!! + finish(i0, descr=faildescr) + """.format(instrs=('\n' +' '*8).join(instrs), failargs=','.join(failargs)) + # the guard forces 3 spills because after 4 divisions + # all even slots of the managed registers are full + loop = parse(code, namespace={'faildescr': BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, value) + fail = self.cpu.get_latest_descr(deadframe) + for i,(name, v) in enumerate(values): + assert self.cpu.get_int_value(deadframe, i) == v + + @py.test.mark.parametrize('v1,v2', [ + (-32,3), (-32,4), (-32,1), (-32,199), + (16236612,3), (-1201203,4), (-123101010023,1231), (-0,199), + ]) + def test_int_mul_no_overflow(self, v1, v2): + try: + result = v1*v2 + except OverflowError: + py.test.skip("this test is not made to check the overflow!") + code = """ + [i0] + i1 = int_mul_ovf(i0,{v}) + finish(i1, descr=faildescr) + """.format(v=v2) + loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) + looptoken = JitCellToken() + self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + deadframe = self.cpu.execute_token(looptoken, v1) + fail = self.cpu.get_latest_descr(deadframe) + assert self.cpu.get_int_value(deadframe, 0) == result diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -23,176 +23,3 @@ cpu = CPU_S390_64(rtyper=None, stats=FakeStats()) cpu.setup_once() return cpu - - @py.test.mark.parametrize('value,opcode,result', - [ (30,'i1 = int_mul(i0, 2)',60), - (30,'i1 = int_floordiv(i0, 2)',15), - (2**31,'i1 = int_floordiv(i0, 15)',2**31//15), - (0,'i1 = int_floordiv(i0, 1)', 0), - (1,'i1 = int_floordiv(i0, 1)', 1), - (0,'i1 = uint_floordiv(i0, 1)', 0), - (1,'i1 = uint_floordiv(i0, 1)', 1), - (30,'i1 = int_mod(i0, 2)', 0), - (1,'i1 = int_mod(i0, 2)', 1), - (1,'i1 = int_lshift(i0, 4)', 16), - (1,'i1 = int_lshift(i0, 0)', 1), - (4,'i1 = int_rshift(i0, 0)', 4), - (4,'i1 = int_rshift(i0, 1)', 2), - (-1,'i1 = int_rshift(i0, 0)', -1), - (-1,'i1 = int_lshift(i0, 1)', -2), - (-2**35,'i1 = int_lshift(i0, 1)', (-2**35)*2), - (2**64-1,'i1 = uint_rshift(i0, 2)', (2**64-1)//4), - (-1,'i1 = int_neg(i0)', -1), - (1,'i1 = int_neg(i0)', -1), - (2**63-1,'i1 = int_neg(i0)', -(2**63-1)), - (1,'i1 = int_invert(i0)', ~1), - (15,'i1 = int_invert(i0)', ~15), - (-1,'i1 = int_invert(i0)', ~(-1)), - (0,'i1 = int_is_zero(i0)', 1), - (50,'i1 = int_is_zero(i0)', 0), - (-1,'i1 = int_is_true(i0)', 1), - (0,'i1 = int_is_true(i0)', 0), - ]) - def test_int_arithmetic_and_logic(self, value, opcode, result): - loop = parse(""" - [i0] - {opcode} - finish(i1, descr=faildescr) - """.format(opcode=opcode),namespace={"faildescr": BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, value) - fail = self.cpu.get_latest_descr(deadframe) - res = self.cpu.get_int_value(deadframe, 0) - assert res == result - assert fail.identifier == 1 - - @py.test.mark.parametrize('value,opcode,result,guard', - [ (2**63-1,'i1 = int_add_ovf(i0, 1)',1,'guard_no_overflow'), - (2**63-2,'i1 = int_add_ovf(i0, 1)',0,'guard_no_overflow'), - (2**63-2,'i1 = int_add_ovf(i0, 1)',1,'guard_overflow'), - (2**63-1,'i1 = int_add_ovf(i0, 1)',0,'guard_overflow'), - - (-2**63, 'i1 = int_sub_ovf(i0, 1)',1,'guard_no_overflow'), - (-2**63+1,'i1 = int_sub_ovf(i0, 1)',0,'guard_no_overflow'), - (-2**63+1,'i1 = int_sub_ovf(i0, 1)',1,'guard_overflow'), - (-2**63, 'i1 = int_sub_ovf(i0, 1)',0,'guard_overflow'), - - (-2**63, 'i1 = int_mul_ovf(i0, 2)',1,'guard_no_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), - (-2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, 2)',0,'guard_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, -2)',0,'guard_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), - # positive! - (2**63-1, 'i1 = int_mul_ovf(i0, 33)',1,'guard_no_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), - (2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 99)',0,'guard_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 3323881828381)',0,'guard_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), - ]) - def test_int_arithmetic_overflow(self, value, opcode, result, guard): - # result == 1 means branch has been taken of the guard - code = """ - [i0] - {opcode} - {guard}() [i0] - i2 = int_xor(i1,i1) - finish(i2, descr=faildescr) - """.format(opcode=opcode,guard=guard) - loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, value) - fail = self.cpu.get_latest_descr(deadframe) - res = self.cpu.get_int_value(deadframe, 0) - if result == 1: - assert res == value - else: - assert res == 0 - - def test_double_evenodd_pair(self): - code = """ - [i0] - i1 = int_floordiv(i0, 2) - i2 = int_floordiv(i0, 3) - i3 = int_floordiv(i0, 4) - i4 = int_floordiv(i0, 5) - i5 = int_floordiv(i0, 6) - i6 = int_floordiv(i0, 7) - i7 = int_floordiv(i0, 8) - i8 = int_le(i1, 0) - guard_true(i8) [i1,i2,i3,i4,i5,i6,i7] - finish(i0, descr=faildescr) - """ - # the guard forces 3 spills because after 4 divisions - # all even slots of the managed registers are full - loop = parse(code, namespace={'faildescr': BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, 100) - fail = self.cpu.get_latest_descr(deadframe) - for i in range(2,9): - assert self.cpu.get_int_value(deadframe, i-2) == 100//i - - - - @py.test.mark.parametrize('value', [2,3,15,2**16,-2**5]) - def test_double_evenodd_pair_extensive(self, value): - instrs = [] - failargs = [] - values = [] - j = 0 - mapping = (('int_floordiv',lambda x,y: x // y), - ('int_mod', lambda x,y: x % y), - ('int_mul_ovf', lambda x,y: x * y)) - for i in range(20): - name, func = mapping[j] - instrs.append("i{d} = {i}(i0, {d})".format(d=i+1, i=name)) - values.append((name, func(value, i+1))) - failargs.append("i" + str(i+1)) - j += 1 - if j >= len(mapping): - j = 0 - code = """ - [i0] - {instrs} - i99 = int_add(i0, 1) - i100 = int_eq(i0,i99) - guard_true(i100) [{failargs}] # will always fail!! - finish(i0, descr=faildescr) - """.format(instrs=('\n' +' '*8).join(instrs), failargs=','.join(failargs)) - # the guard forces 3 spills because after 4 divisions - # all even slots of the managed registers are full - loop = parse(code, namespace={'faildescr': BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, value) - fail = self.cpu.get_latest_descr(deadframe) - for i,(name, v) in enumerate(values): - assert self.cpu.get_int_value(deadframe, i) == v - - @py.test.mark.parametrize('v1,v2', [ - (-32,3), - ]) - def test_int_mul_no_overflow(self, v1, v2): - try: - result = v1*v2 - except OverflowError: - py.test.skip("this test is not made to check the overflow!") - code = """ - [i0] - i1 = int_mul_ovf(i0,{v}) - finish(i1, descr=faildescr) - """.format(v=v2) - loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - import pdb; pdb.set_trace() - deadframe = self.cpu.execute_token(looptoken, v1) - fail = self.cpu.get_latest_descr(deadframe) - assert self.cpu.get_int_value(deadframe, 0) == result - From noreply at buildbot.pypy.org Tue Nov 17 14:06:15 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 17 Nov 2015 20:06:15 +0100 (CET) Subject: [pypy-commit] pypy exc-later: Fix rpython/jit/codewriter/test/test_flatten.py::TestFlatten::()::test_int_floordiv_ovf_zer Message-ID: <20151117190616.021711C11C2@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: exc-later Changeset: r80733:a1880cbfdd83 Date: 2015-11-17 19:07 +0000 http://bitbucket.org/pypy/pypy/changeset/a1880cbfdd83/ Log: Fix rpython/jit/codewriter/test/test_flatten.py::TestFlatten::()::te st_int_floordiv_ovf_zer diff --git a/rpython/jit/codewriter/test/test_flatten.py b/rpython/jit/codewriter/test/test_flatten.py --- a/rpython/jit/codewriter/test/test_flatten.py +++ b/rpython/jit/codewriter/test/test_flatten.py @@ -140,7 +140,7 @@ def encoding_test(self, func, args, expected, transform=False, liveness=False, cc=None, jd=None): - + graphs = self.make_graphs(func, args) #graphs[0].show() if transform: @@ -485,11 +485,11 @@ --- L1: goto_if_exception_mismatch $<* struct object_vtable>, L2 - int_return $-42 + int_return $42 --- L2: goto_if_exception_mismatch $<* struct object_vtable>, L3 - int_return $42 + int_return $-42 --- L3: reraise From noreply at buildbot.pypy.org Tue Nov 17 14:10:06 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 17 Nov 2015 20:10:06 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: passing one more test after fixing the flush_cc call in int_is_true, int_is_zero Message-ID: <20151117191006.BF26D1C12D2@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80734:74ffc8d6b4fd Date: 2015-11-17 20:10 +0100 http://bitbucket.org/pypy/pypy/changeset/74ffc8d6b4fd/ Log: passing one more test after fixing the flush_cc call in int_is_true, int_is_zero diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -115,12 +115,12 @@ def emit_int_is_zero(self, op, arglocs, regalloc): l0 = arglocs[0] self.mc.CGHI(l0, l.imm(0)) - self.flush_cc(c.EQ, l0) + self.flush_cc(c.EQ, r.SPP) def emit_int_is_true(self, op, arglocs, regalloc): l0 = arglocs[0] self.mc.CGHI(l0, l.imm(0)) - self.flush_cc(c.NE, l0) + self.flush_cc(c.NE, r.SPP) emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") emit_int_or = gen_emit_rr_or_rpool("OGR", "OG") @@ -137,6 +137,11 @@ emit_int_eq = gen_emit_cmp_op(c.EQ) emit_int_ne = gen_emit_cmp_op(c.NE) + emit_uint_le = gen_emit_cmp_op(c.LE, signed=False) + emit_uint_lt = gen_emit_cmp_op(c.LT, signed=False) + emit_uint_gt = gen_emit_cmp_op(c.GT, signed=False) + emit_uint_ge = gen_emit_cmp_op(c.GE, signed=False) + class FloatOpAssembler(object): _mixin_ = True diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -624,6 +624,11 @@ prepare_int_eq = helper.prepare_cmp_op prepare_int_ne = helper.prepare_cmp_op + prepare_uint_le = helper.prepare_cmp_op + prepare_uint_lt = helper.prepare_cmp_op + prepare_uint_ge = helper.prepare_cmp_op + prepare_uint_gt = helper.prepare_cmp_op + prepare_int_is_zero = helper.prepare_unary_op prepare_int_is_true = helper.prepare_unary_op prepare_int_neg = helper.prepare_unary_op From noreply at buildbot.pypy.org Wed Nov 18 02:06:27 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 08:06:27 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Change the docs to use extern "Python" as discussed yesterday on irc Message-ID: <20151118070627.BD9861C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2412:c4190e6384da Date: 2015-11-18 08:07 +0100 http://bitbucket.org/cffi/cffi/changeset/c4190e6384da/ Log: Change the docs to use extern "Python" as discussed yesterday on irc (thanks antocuni) diff --git a/demo/cdef_call_python.py b/demo/cdef_call_python.py deleted file mode 100644 --- a/demo/cdef_call_python.py +++ /dev/null @@ -1,29 +0,0 @@ -import cffi - -ffi = cffi.FFI() - -ffi.cdef(""" - int add(int x, int y); - CFFI_CALL_PYTHON long mangle(int); -""") - -ffi.set_source("_cdef_call_python_cffi", """ - - static long mangle(int); - - static int add(int x, int y) - { - return mangle(x) + mangle(y); - } -""") - -ffi.compile() - - -from _cdef_call_python_cffi import ffi, lib - - at ffi.call_python("mangle") # optional argument, default to func.__name__ -def mangle(x): - return x * x - -assert lib.add(40, 2) == 1604 diff --git a/demo/extern_python.py b/demo/extern_python.py new file mode 100644 --- /dev/null +++ b/demo/extern_python.py @@ -0,0 +1,26 @@ +import cffi + +ffi = cffi.FFI() + +ffi.cdef("""int my_algo(int); extern "Python" int f(int);""") + +ffi.set_source("_extern_python_cffi", """ + static int f(int); + static int my_algo(int n) { + int i, sum = 0; + for (i = 0; i < n; i++) + sum += f(n); + return sum; + } +""") + +ffi.compile() + + +from _extern_python_cffi import ffi, lib + + at ffi.def_extern() +def f(n): + return n * n + +assert lib.my_algo(10) == 0+1+4+9+16+25+36+49+64+81 diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -422,10 +422,10 @@ with ``int foo();`` really means ``int foo(void);``.) -.. _`call_python`: +.. _`extern "Python"`: -Calling Python from C (new style) ---------------------------------- +Extern "Python" (new-style callbacks) +------------------------------------- When the C code needs a pointer to a function which invokes back a Python function of your choice, here is how you do it in the @@ -433,53 +433,64 @@ ABI-mode solution. This is *new in version 1.4.* Use Callbacks_ if backward compatibility -is an issue. (The original callbacks have more overhead and potential -issues with libffi; see the warning__.) +is an issue. (The original callbacks are slower to invoke and have +the same issue as libffi's callbacks; notably, see the warning__. +The new style described in the present section does not use libffi's +callbacks at all.) .. __: Callbacks_ In the builder script, declare in the cdef a function prefixed with -``CFFI_CALL_PYTHON``:: +``extern "Python"``:: ffi.cdef(""" - typedef ... footype_t; - CFFI_CALL_PYTHON int my_callback(footype_t *, int); + extern "Python" int my_callback(int, int); - void library_function(int(*callback)(footype_t *, int)); + void library_function(int(*callback)(int, int)); """) ffi.set_source("_my_example", """ #include """) -The function ``my_callback()`` is not expected to be found in the C -code you pass with ``set_source()``. Instead, it is defined by CFFI -to call back some Python code. The Python code that is called is -attached at run-time, i.e. in the application's code:: +The function ``my_callback()`` is then implemented in Python inside +your application's code:: from _my_example import ffi, lib - @ffi.call_python() + @ffi.def_extern() def my_callback(fooptr, value): return 42 -Then any call to the C function ``my_callback`` will invoke the -corresponding Python function. From Python you can get a ```` -pointer-to-function object from either ``lib.my_callback`` or directly -from the decorated ``my_callback`` above. +You can get a ```` pointer-to-function object from either +reading ``lib.my_callback``, or directly from the decorated +``my_callback`` above. This ```` can be passed to C code and +then works like a callback: when the C code calls this function +pointer, the Python function ``my_callback`` is called. -Note that there is only one C function per ``CFFI_CALL_PYTHON`` line -in the cdef. You can redefine the attached Python function by calling -``@ffi.call_python()`` again, but it changes the C logic to call the -new Python function; the C function pointer is always the same. This -is not suitable if you need a variable number of C function pointers. +CFFI implements this by defining ``my_callback`` as a static C +function, written after the ``set_source()`` code. The ```` +then points to this function. What this function does is invoke the +Python function object that was dynamically attached by +``@ffi.def_extern()``. -However, this result is not possible either in pure C code. For this -reason, it is usual for C to define callbacks with a ``void *data`` -argument. You can use ``ffi.new_handle()`` and ``ffi.from_handle()`` -to pass a Python object through this ``void *`` argument. For -example, if the C type of the callbacks is:: +Each function from the cdef with ``extern "Python"`` turns into only +one C function. You can redefine the attached Python function by +calling ``@ffi.def_extern()`` again, but it changes the C logic to +call the new Python function; the old Python function is not callable +any more and the C function pointer itself is always the same. - typedef void (*event_cb_t)(struct event *evt, void *userdata); +Extern "Python" and "void *" arguments +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As described just before, you cannot use ``extern "Python"`` to make a +variable number of C function pointers. However, achieving that +result is not possible in pure C code either. For this reason, it is +usual for C to define callbacks with a ``void *data`` argument. You +can use ``ffi.new_handle()`` and ``ffi.from_handle()`` to pass a +Python object through this ``void *`` argument. For example, if the C +type of the callbacks is:: + + typedef void (*event_cb_t)(event_t *evt, void *userdata); and you register events by calling this function:: @@ -488,10 +499,11 @@ Then you would write this in the build script:: ffi.cdef(""" - typedef void (*event_cb_t)(struct event *evt, void *userdata); + typedef ... event_t; + typedef void (*event_cb_t)(event_t *evt, void *userdata); void event_cb_register(event_cb_t cb, void *userdata); - CFFI_CALL_PYTHON void my_event_callback(struct event *, void *); + extern "Python" void my_event_callback(event_t *, void *); """) ffi.set_source("_demo_cffi", """ #include @@ -510,7 +522,7 @@ def process_event(self, evt): ... - @ffi.call_python() + @ffi.def_extern() def my_event_callback(evt, userdata): widget = ffi.from_handle(userdata) widget.process_event(evt) @@ -520,10 +532,10 @@ the library might say that ``widget->userdata`` is a generic field reserved for the application. If the event's signature is now this:: - typedef void (*event_cb_t)(struct widget *w, struct event *evt); + typedef void (*event_cb_t)(widget_t *w, event_t *evt); Then you can use the ``void *`` field in the low-level -``struct widget *`` like this:: +``widget_t *`` like this:: from _demo_cffi import ffi, lib @@ -532,46 +544,82 @@ ll_widget = lib.new_widget(500, 500) self.ll_widget = ll_widget # userdata = ffi.new_handle(self) + self._userdata = userdata # must still keep this alive! ll_widget.userdata = userdata # this makes a copy of the "void *" - self._userdata = userdata # must *still* keep this alive! lib.event_cb_register(ll_widget, my_event_callback) def process_event(self, evt): ... - @ffi.call_python() + @ffi.def_extern() def my_event_callback(ll_widget, evt): widget = ffi.from_handle(ll_widget.userdata) widget.process_event(evt) -In case you want to access ``my_event_callback`` directly from the C -code written in ``set_source()``, you need to write a forward static -declaration (the real implementation of this function is added by CFFI -after this C code):: +Extern "Python" accessed from C directly +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In case you want to access some ``extern "Python"`` function directly +from the C code written in ``set_source()``, you need to write a +forward static declaration. The real implementation of this function +is added by CFFI *after* the C code---this is needed because even the +declaration might use types defined by ``set_source()`` +(e.g. ``event_t`` above, from the ``#include``), so it cannot be +generated before. ffi.set_source("_demo_cffi", """ #include - static void my_event_callback(struct widget *, struct evt *); + static void my_event_callback(widget_t *, event_t *); - /* more C code which uses '&my_event_callback' or even - directly calls my_event_callback() */ + /* here you can write C code which uses '&my_event_callback' */ """) -Note that ``CFFI_CALL_PYTHON`` cannot be a variadic function type -for now (this may be implemented in the future). +This can also be used to write custom C code which calls Python +directly. Here is an example (inefficient in this case, but might be +useful if the logic in ``my_algo()`` is much more complex):: -Be careful when writing the Python callback function: if it returns an -object of the wrong type, or more generally raises an exception, then -the exception cannot be propagated. Instead, it is printed to stderr -and the C-level callback is made to return a default value. This can -be controlled with ``error`` and ``onerror``, described next. + ffi.cdef(""" + extern "Python" int f(int); + int my_algo(int); + """) + ffi.set_source("_example_cffi", """ + static int f(int); + static int my_algo(int n) { + int i, sum = 0; + for (i = 0; i < n; i++) + sum += f(n); + return sum; + } + """) -The ``@ffi.call_python()`` decorator takes these optional arguments: +EXtern "Python": reference +~~~~~~~~~~~~~~~~~~~~~~~~~~ -* ``name``: the name of the ``CFFI_CALL_PYTHON`` function declaration - from the cdef. Defaults to the name of the Python function you - decorate. +``extern "Python"`` must appear in the cdef(). Like the C++ ``extern +"C"`` syntax, it can also be used with braces around a group of +functions:: + + extern "Python" { + int foo(int); + int bar(int); + } + +The ``extern "Python"`` functions cannot be variadic for now. This +may be implemented in the future. + +The corresponding Python callback function is defined with the +``@ffi.def_extern()`` decorator. Be careful when writing this +function: if it raises an exception, or tries to return an object of +the wrong type, then the exception cannot be propagated. Instead, the +exception is printed to stderr and the C-level callback is made to +return a default value. This can be controlled with ``error`` and +``onerror``, described below. + +The ``@ffi.def_extern()`` decorator takes these optional arguments: + +* ``name``: the name of the function as written in the cdef. By default + it is taken from the name of the Python function you decorate. .. _error_onerror: @@ -581,15 +629,15 @@ solution. * ``onerror``: if you want to be sure to catch all exceptions, use - ``@ffi.call_python(onerror=func)``. If an exception occurs and + ``@ffi.def_extern(onerror=my_handler)``. If an exception occurs and ``onerror`` is specified, then ``onerror(exception, exc_value, traceback)`` is called. This is useful in some situations where you cannot simply write ``try: except:`` in the main callback function, because it might not catch exceptions raised by signal handlers: if - a signal occurs while in C, the signal handler is called as soon as - possible, i.e. after entering the callback function but *before* - even executing the ``try:``. If the signal handler raises, we are - not in the ``try: except:`` yet. + a signal occurs while in C, the Python signal handler is called as + soon as possible, which is after entering the callback function but + *before* executing even the ``try:``. If the signal handler raises, + we are not in the ``try: except:`` yet. If ``onerror`` is called and returns normally, then it is assumed that it handled the exception on its own and nothing is printed to @@ -605,8 +653,8 @@ there was an error converting the value returned: this occurs after the call). If ``traceback`` is not None, then ``traceback.tb_frame`` is the frame of the outermost function, - i.e. directly the one of the function decorated with - ``@ffi.call_python()``. So you can get the value of ``argname`` in + i.e. directly the frame of the function decorated with + ``@ffi.def_extern()``. So you can get the value of ``argname`` in that frame by reading ``traceback.tb_frame.f_locals['argname']``. @@ -634,7 +682,7 @@ Callbacks are provided for the ABI mode or for backward compatibility. If you are using the out-of-line API mode, it is - recommended to use the `call_python`_ mechanism instead of + recommended to use the `extern "Python"`_ mechanism instead of callbacks: it gives faster and cleaner code. It also avoids a SELinux issue whereby the setting of ``deny_execmem`` must be left to ``off`` in order to use callbacks. (A fix in cffi was @@ -705,7 +753,7 @@ The ``ffi.callback()`` decorator also accepts the optional argument ``error``, and from CFFI version 1.2 the optional argument ``onerror``. -These two work in the same way as `described above for call_python.`__ +These two work in the same way as `described above for extern "Python".`__ .. __: error_onerror_ From noreply at buildbot.pypy.org Wed Nov 18 02:07:43 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 08:07:43 +0100 (CET) Subject: [pypy-commit] cffi static-callback: flow Message-ID: <20151118070743.4C9E81C0ECB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2413:8aa61a86ab44 Date: 2015-11-18 08:08 +0100 http://bitbucket.org/cffi/cffi/changeset/8aa61a86ab44/ Log: flow diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -608,7 +608,7 @@ The ``extern "Python"`` functions cannot be variadic for now. This may be implemented in the future. -The corresponding Python callback function is defined with the +Each corresponding Python callback function is defined with the ``@ffi.def_extern()`` decorator. Be careful when writing this function: if it raises an exception, or tries to return an object of the wrong type, then the exception cannot be propagated. Instead, the From noreply at buildbot.pypy.org Wed Nov 18 02:11:16 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 08:11:16 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: fixed test that called renamed method on the pool object, guard now compare to zero if condition code is not set Message-ID: <20151118071116.8B2721C0ECB@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80735:a26c3ac249bd Date: 2015-11-18 08:11 +0100 http://bitbucket.org/pypy/pypy/changeset/a26c3ac249bd/ Log: fixed test that called renamed method on the pool object, guard now compare to zero if condition code is not set diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -211,7 +211,7 @@ if hasattr(looptoken, '_ppc_ops_offset'): del looptoken._ppc_ops_offset # else it's kept alive if hasattr(looptoken, '_zarch_ops_offset'): - del looptoken._ppc_ops_offset # else it's kept alive + del looptoken._zarch_ops_offset # else it's kept alive del loop gc.collect() assert not wr_i1() and not wr_guard() diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -6,6 +6,7 @@ from rpython.rtyper.lltypesystem import lltype, rffi, llmemory from rpython.jit.backend.zarch.arch import (WORD, RECOVERY_GCMAP_POOL_OFFSET, RECOVERY_TARGET_POOL_OFFSET) +from rpython.rlib.longlong2float import float2longlong class LiteralPool(object): def __init__(self): @@ -55,22 +56,23 @@ def get_descr_offset(self, descr): return self.offset_map[descr] + def get_offset(self, box): + return self.offset_map[box] + def reserve_literal(self, size): self.size += size - print "resized to", self.size, "(+",size,")" def reset(self): self.pool_start = 0 self.label_offset = 0 self.size = 0 - self.offset_map.clear() + self.offset_map = {} self.constant_64_zeros = -1 self.constant_64_ones = -1 self.constant_64_sign_bit = -1 self.constant_max_64_positive -1 def pre_assemble(self, asm, operations, bridge=False): - self.reset() # O(len(operations)). I do not think there is a way # around this. # @@ -117,7 +119,6 @@ def overwrite_64(self, mc, index, value): index += self.pool_start - print("value", hex(value), "at", index - self.pool_start) mc.overwrite(index, chr(value >> 56 & 0xff)) mc.overwrite(index+1, chr(value >> 48 & 0xff)) mc.overwrite(index+2, chr(value >> 40 & 0xff)) @@ -151,3 +152,4 @@ ptr = rffi.cast(lltype.Signed, guard_token.gcmap) self.overwrite_64(mc, offset + RECOVERY_GCMAP_POOL_OFFSET, ptr) + self.reset() diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -74,12 +74,11 @@ return r.f1 def place_in_pool(self, var): - offset = self.assembler.pool.place(var) + offset = self.assembler.pool.get_offset(var) return l.pool(offset, r.POOL) def ensure_reg(self, box): if isinstance(box, Const): - # TODO, allocate in a register or just load it straight from pool? return self.place_in_pool(box) else: assert box in self.temp_boxes @@ -659,7 +658,6 @@ def load_condition_into_cc(self, box): if self.assembler.guard_success_cc == c.cond_none: - xxx loc = self.ensure_reg(box) mc = self.assembler.mc mc.cmp_op(loc, l.imm(0), imm=True) From noreply at buildbot.pypy.org Wed Nov 18 02:17:24 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 08:17:24 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: move str_storage_getitem into its own module, as it's no longer based on rawstorage. Refactor, and re-implement based on casting. Add JIT support for force_cast between GC objects and the specific case of getinteriorfield we need. Add enough support to the llgraph backend to run the tests Message-ID: <20151118071724.5FE8C1C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80736:2294ad1228f5 Date: 2015-11-18 07:21 +0100 http://bitbucket.org/pypy/pypy/changeset/2294ad1228f5/ Log: move str_storage_getitem into its own module, as it's no longer based on rawstorage. Refactor, and re-implement based on casting. Add JIT support for force_cast between GC objects and the specific case of getinteriorfield we need. Add enough support to the llgraph backend to run the tests diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -638,9 +638,18 @@ return array.getlength() def bh_getarrayitem_gc(self, a, index, descr): - a = support.cast_arg(lltype.Ptr(descr.A), a) + assert index >= 0 + if descr.A is descr.OUTERA: + a = support.cast_arg(lltype.Ptr(descr.A), a) + else: + # we use rffi.cast instead of support.cast_arg because the types + # might not be "compatible" enough from the lltype point of + # view. In particular, this happens when we use + # str_storage_getitem, in which an rpy_string is casted to + # rpy_string_as_Signed (or similar) + a = rffi.cast(lltype.Ptr(descr.OUTERA), a) + a = getattr(a, descr.OUTERA._arrayfld) array = a._obj - assert index >= 0 return support.cast_result(descr.A.OF, array.getitem(index)) bh_getarrayitem_gc_pure_i = bh_getarrayitem_gc diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -1008,12 +1008,11 @@ return SpaceOperation('getarrayitem_gc_i', [op.args[0], v_index, bytearraydescr], op.result) - else: + elif op.result.concretetype is lltype.Void: + return + elif isinstance(op.args[0].concretetype.TO, lltype.GcArray): + # special-case 1: GcArray of Struct v_inst, v_index, c_field = op.args - if op.result.concretetype is lltype.Void: - return - # only GcArray of Struct supported - assert isinstance(v_inst.concretetype.TO, lltype.GcArray) STRUCT = v_inst.concretetype.TO.OF assert isinstance(STRUCT, lltype.Struct) descr = self.cpu.interiorfielddescrof(v_inst.concretetype.TO, @@ -1022,6 +1021,16 @@ kind = getkind(op.result.concretetype)[0] return SpaceOperation('getinteriorfield_gc_%s' % kind, args, op.result) + elif isinstance(op.args[0].concretetype.TO, lltype.GcStruct): + # special-case 2: GcStruct with Array field + v_inst, c_field, v_index = op.args + STRUCT = v_inst.concretetype.TO + ARRAY = getattr(STRUCT, c_field.value) + assert isinstance(ARRAY, lltype.Array) + arraydescr = self.cpu.arraydescrof(STRUCT) + return SpaceOperation('getarrayitem_gc_i', + [op.args[0], v_index, arraydescr], + op.result) def rewrite_op_setinteriorfield(self, op): assert len(op.args) == 4 @@ -1130,10 +1139,13 @@ def rewrite_op_force_cast(self, op): v_arg = op.args[0] v_result = op.result - assert not self._is_gc(v_arg) - if v_arg.concretetype == v_result.concretetype: return + elif self._is_gc(v_arg) and self._is_gc(v_result): + # cast from GC to GC is always fine + return + else: + assert not self._is_gc(v_arg) float_arg = v_arg.concretetype in [lltype.Float, lltype.SingleFloat] float_res = v_result.concretetype in [lltype.Float, lltype.SingleFloat] diff --git a/rpython/jit/metainterp/test/test_rawmem.py b/rpython/jit/metainterp/test/test_rawmem.py --- a/rpython/jit/metainterp/test/test_rawmem.py +++ b/rpython/jit/metainterp/test/test_rawmem.py @@ -108,18 +108,17 @@ def test_str_storage_int(self): import struct - data = struct.pack('q', 42) + data = struct.pack('qq', 42, 100) def f(): - res = str_storage_getitem(lltype.Signed, data, 0) - return res + a = str_storage_getitem(lltype.Signed, data, 0) + b = str_storage_getitem(lltype.Signed, data, 8) + return a+b res = self.interp_operations(f, []) - assert res == 42 - import pdb;pdb.set_trace() - self.check_operations_history({'call_i': 1, 'guard_no_exception': 1, - 'call_n': 1, - 'raw_store': 1, 'raw_load_i': 1, + assert res == 142 + self.check_operations_history({'getarrayitem_gc_i': 2, + 'int_add': 1, 'finish': 1}) - self.metainterp.staticdata.stats.check_resops({'finish': 1}, omit_finish=False) + class TestRawMem(RawMemTests, LLJitMixin): diff --git a/rpython/rlib/rawstorage.py b/rpython/rlib/rawstorage.py --- a/rpython/rlib/rawstorage.py +++ b/rpython/rlib/rawstorage.py @@ -6,8 +6,7 @@ from rpython.rlib import rgc from rpython.rlib.rgc import lltype_is_gc from rpython.rlib.objectmodel import specialize -from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf -from rpython.rtyper.annlowlevel import llstr +from rpython.rlib.strstorage import str_storage_getitem RAW_STORAGE = rffi.CCHARP.TO RAW_STORAGE_PTR = rffi.CCHARP @@ -44,30 +43,6 @@ lltype.free(storage, flavor='raw', track_allocation=track_allocation) - at rgc.no_collect - at specialize.ll() -def str_storage_getitem(TP, s, index): - lls = llstr(s) - # from here, no GC operations can happen - buf = _get_raw_str_buf(STR, lls, 0) - storage = rffi.cast(RAW_STORAGE_PTR, buf) - res = raw_storage_getitem(TP, storage, index) - # end of "no GC" section - keepalive_until_here(lls) - return res - - at rgc.no_collect - at specialize.ll() -def str_storage_getitem_unaligned(TP, s, index): - lls = llstr(s) - # from here, no GC operations can happen - buf = _get_raw_str_buf(STR, lls, 0) - storage = rffi.cast(RAW_STORAGE_PTR, buf) - res = raw_storage_getitem_unaligned(TP, storage, index) - # end of "no GC" section - keepalive_until_here(lls) - return res - # ____________________________________________________________ # # Support for possibly-unaligned accesses diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/rlib/strstorage.py @@ -0,0 +1,55 @@ +# Support for str_storage: i.e., reading primitive types out of RPython string +# +# There are various possible ways to implement it, however not all of them are +# easily supported by the JIT: +# +# 1. use _get_raw_str_buf and cast the chars buffer to RAW_STORAGE_PTR: this +# works well without the JIT, but the cast to RAW_STORAGE_PTR needs to +# happen inside a short "no GC" section (like the one in +# rstr.py:copy_string_contents), which has no chance to work during +# tracing +# +# 2. use llop.raw_load: despite the name, llop.raw_load DOES support reading +# from GC pointers. However: +# +# a. we would like to use a CompositeOffset as the offset (using the +# same logic as in rstr.py:_get_raw_str_buf), but this is not (yet) +# supported before translation: it works only if you pass an actual +# integer +# +# b. raw_load from a GC pointer is not (yet) supported by the +# JIT. There are plans to introduce a gc_load operation: when it +# will be there, we could fix the issue above and actually use it to +# implement str_storage_getitem +# +# 3. the actual solution: cast rpy_string to a GcStruct which has the very +# same layout, with the only difference that its 'chars' field is no +# longer an Array(Char) but e.e. an Array(Signed). Then, we just need to +# read the appropriate index into the array + +from rpython.rtyper.lltypesystem import lltype, rffi, llmemory +from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf +from rpython.rtyper.annlowlevel import llstr +from rpython.rlib.objectmodel import specialize +from rpython.rlib import rgc + + at specialize.memo() +def rpy_string_as_type(TP): + # sanity check that STR is actually what we think it is + assert STR._flds == { + 'hash': lltype.Signed, + 'chars': lltype.Array(lltype.Char, hints={'immutable': True}) + } + STR_AS_TP = lltype.GcStruct('rpy_string_as_%s' % TP, + ('hash', lltype.Signed), + ('chars', lltype.Array(TP, hints={'immutable': True}))) + return STR_AS_TP + + at rgc.no_collect + at specialize.ll() +def str_storage_getitem(TP, s, index): + STR_AS_TP = rpy_string_as_type(TP) + lls = llstr(s) + str_as_tp = rffi.cast(lltype.Ptr(STR_AS_TP), lls) + index = index / rffi.sizeof(TP) + return str_as_tp.chars[index] diff --git a/rpython/rlib/test/test_rawstorage.py b/rpython/rlib/test/test_rawstorage.py --- a/rpython/rlib/test/test_rawstorage.py +++ b/rpython/rlib/test/test_rawstorage.py @@ -5,7 +5,7 @@ from rpython.rlib.rawstorage import alloc_raw_storage, free_raw_storage,\ raw_storage_setitem, raw_storage_getitem, AlignmentError,\ raw_storage_setitem_unaligned, raw_storage_getitem_unaligned,\ - str_storage_getitem, str_storage_getitem_unaligned + str_storage_getitem from rpython.rtyper.test.tool import BaseRtypingTest from rpython.translator.c.test.test_genc import compile @@ -44,16 +44,6 @@ res = str_storage_getitem(lltype.Float, buf, size*2) assert res == 123.0 -def test_untranslated_str_storage_unaligned(monkeypatch): - import struct - monkeypatch.setattr(rawstorage, 'misaligned_is_fine', False) - buf = 'foo' + struct.pack('@ll', 42, 43) - size = struct.calcsize('@l') - res = str_storage_getitem_unaligned(lltype.Signed, buf, 3) - assert res == 42 - res = str_storage_getitem_unaligned(lltype.Signed, buf, size+3) - assert res == 43 - class TestRawStorage(BaseRtypingTest): def test_storage_int(self): From noreply at buildbot.pypy.org Wed Nov 18 02:17:26 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 08:17:26 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: move strstorage tests into their own file, and refactor to avoid duplication Message-ID: <20151118071726.7AD0D1C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80737:f92d64d0ed7e Date: 2015-11-18 07:54 +0100 http://bitbucket.org/pypy/pypy/changeset/f92d64d0ed7e/ Log: move strstorage tests into their own file, and refactor to avoid duplication diff --git a/rpython/rlib/rawstorage.py b/rpython/rlib/rawstorage.py --- a/rpython/rlib/rawstorage.py +++ b/rpython/rlib/rawstorage.py @@ -6,7 +6,6 @@ from rpython.rlib import rgc from rpython.rlib.rgc import lltype_is_gc from rpython.rlib.objectmodel import specialize -from rpython.rlib.strstorage import str_storage_getitem RAW_STORAGE = rffi.CCHARP.TO RAW_STORAGE_PTR = rffi.CCHARP diff --git a/rpython/rlib/test/test_rawstorage.py b/rpython/rlib/test/test_rawstorage.py --- a/rpython/rlib/test/test_rawstorage.py +++ b/rpython/rlib/test/test_rawstorage.py @@ -4,8 +4,7 @@ from rpython.rlib import rawstorage from rpython.rlib.rawstorage import alloc_raw_storage, free_raw_storage,\ raw_storage_setitem, raw_storage_getitem, AlignmentError,\ - raw_storage_setitem_unaligned, raw_storage_getitem_unaligned,\ - str_storage_getitem + raw_storage_setitem_unaligned, raw_storage_getitem_unaligned from rpython.rtyper.test.tool import BaseRtypingTest from rpython.translator.c.test.test_genc import compile @@ -33,17 +32,6 @@ assert res == 3.14 free_raw_storage(r) -def test_untranslated_str_storage(): - import struct - buf = struct.pack('@lld', 42, 43, 123.0) - size = struct.calcsize('@l') - res = str_storage_getitem(lltype.Signed, buf, 0) - assert res == 42 - res = str_storage_getitem(lltype.Signed, buf, size) - assert res == 43 - res = str_storage_getitem(lltype.Float, buf, size*2) - assert res == 123.0 - class TestRawStorage(BaseRtypingTest): def test_storage_int(self): @@ -57,21 +45,6 @@ x = self.interpret(f, [1<<30]) assert x == 1 << 30 - def test_str_storage_int(self): - import struct - buf = struct.pack('@ll', 42, 43) - size = struct.calcsize('@l') - - def f(i): - res = str_storage_getitem(lltype.Signed, buf, i) - return res - - x = self.interpret(f, [0]) - assert x == 42 - x = self.interpret(f, [8]) - assert x == 43 - - def test_storage_float_unaligned(self, monkeypatch): def f(v): r = alloc_raw_storage(24) diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/rlib/test/test_strstorage.py @@ -0,0 +1,33 @@ +import py +import struct +from rpython.rtyper.lltypesystem import lltype +from rpython.rlib.strstorage import str_storage_getitem +from rpython.rtyper.test.tool import BaseRtypingTest + +class BaseStrStorageTest: + + def test_signed(self): + buf = struct.pack('@ll', 42, 43) + size = struct.calcsize('@l') + assert self.str_storage_getitem(lltype.Signed, buf, 0) == 42 + assert self.str_storage_getitem(lltype.Signed, buf, size) == 43 + + def test_float(self): + buf = struct.pack('@dd', 12.3, 45.6) + size = struct.calcsize('@d') + assert self.str_storage_getitem(lltype.Float, buf, 0) == 12.3 + assert self.str_storage_getitem(lltype.Float, buf, size) == 45.6 + + +class TestDirect(BaseStrStorageTest): + + def str_storage_getitem(self, TYPE, buf, offset): + return str_storage_getitem(TYPE, buf, offset) + + +class TestRTyping(BaseStrStorageTest, BaseRtypingTest): + + def str_storage_getitem(self, TYPE, buf, offset): + def fn(offset): + return str_storage_getitem(TYPE, buf, offset) + return self.interpret(fn, [offset]) From noreply at buildbot.pypy.org Wed Nov 18 02:17:28 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 08:17:28 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: re-use BaseStrStorage to implement JIT tests; test_float is failing, as expected Message-ID: <20151118071728.7DB421C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80738:35a943788bea Date: 2015-11-18 08:16 +0100 http://bitbucket.org/pypy/pypy/changeset/35a943788bea/ Log: re-use BaseStrStorage to implement JIT tests; test_float is failing, as expected diff --git a/rpython/jit/metainterp/test/test_rawmem.py b/rpython/jit/metainterp/test/test_rawmem.py --- a/rpython/jit/metainterp/test/test_rawmem.py +++ b/rpython/jit/metainterp/test/test_rawmem.py @@ -1,8 +1,7 @@ from rpython.jit.metainterp.test.support import LLJitMixin from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.rawstorage import (alloc_raw_storage, raw_storage_setitem, - free_raw_storage, raw_storage_getitem, - str_storage_getitem) + free_raw_storage, raw_storage_getitem) class RawMemTests(object): @@ -106,20 +105,6 @@ res = self.interp_operations(f, []) assert res == ord('X') - def test_str_storage_int(self): - import struct - data = struct.pack('qq', 42, 100) - def f(): - a = str_storage_getitem(lltype.Signed, data, 0) - b = str_storage_getitem(lltype.Signed, data, 8) - return a+b - res = self.interp_operations(f, []) - assert res == 142 - self.check_operations_history({'getarrayitem_gc_i': 2, - 'int_add': 1, - 'finish': 1}) - - class TestRawMem(RawMemTests, LLJitMixin): diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -0,0 +1,17 @@ +import py +from rpython.rlib.strstorage import str_storage_getitem +from rpython.rlib.test.test_strstorage import BaseStrStorageTest +from rpython.jit.metainterp.test.support import LLJitMixin + +class TestStrStorage(BaseStrStorageTest, LLJitMixin): + + # for the individual tests see + # ====> ../../../rlib/test/test_strstorage.py + + def str_storage_getitem(self, TYPE, buf, offset): + def f(): + return str_storage_getitem(TYPE, buf, offset) + res = self.interp_operations(f, []) + self.check_operations_history({'getarrayitem_gc_i': 1, + 'finish': 1}) + return res From noreply at buildbot.pypy.org Wed Nov 18 02:19:27 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 08:19:27 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: emit_finish now handles the case if a parameter is in the constant pool. it crashed before Message-ID: <20151118071927.DB19B1C120B@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80739:4ccf3025389e Date: 2015-11-18 08:19 +0100 http://bitbucket.org/pypy/pypy/changeset/4ccf3025389e/ Log: emit_finish now handles the case if a parameter is in the constant pool. it crashed before diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -618,8 +618,14 @@ if len(arglocs) > 1: [return_val, fail_descr_loc] = arglocs if op.getarg(0).type == FLOAT: + if return_val.is_in_pool(): + self.mc.LDY(r.FSCRATCH, return_val) + return_val = r.FSCRATCH self.mc.STD(return_val, l.addr(base_ofs, r.SPP)) else: + if return_val.is_in_pool(): + self.mc.LG(r.SCRATCH, return_val) + return_val = r.SCRATCH self.mc.STG(return_val, l.addr(base_ofs, r.SPP)) else: [fail_descr_loc] = arglocs diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py --- a/rpython/jit/backend/zarch/registers.py +++ b/rpython/jit/backend/zarch/registers.py @@ -19,7 +19,9 @@ [f0,f1,f2,f3,f4,f5,f6,f7,f8, f9,f10,f11,f12,f13,f14,f15] = fpregisters -MANAGED_FP_REGS = fpregisters +FSCRATCH = f0 + +MANAGED_FP_REGS = fpregisters[1:] VOLATILES_FLOAT = [] # The JITFRAME_FIXED_SIZE is measured in words, and should be the From noreply at buildbot.pypy.org Wed Nov 18 02:27:03 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 08:27:03 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: support str_storage_getitem(lltype.Float, ...) Message-ID: <20151118072703.11F4B1C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80740:b5ebdf19edb4 Date: 2015-11-18 08:27 +0100 http://bitbucket.org/pypy/pypy/changeset/b5ebdf19edb4/ Log: support str_storage_getitem(lltype.Float, ...) diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -1028,7 +1028,9 @@ ARRAY = getattr(STRUCT, c_field.value) assert isinstance(ARRAY, lltype.Array) arraydescr = self.cpu.arraydescrof(STRUCT) - return SpaceOperation('getarrayitem_gc_i', + kind = getkind(op.result.concretetype)[0] + assert kind in ('i', 'f') + return SpaceOperation('getarrayitem_gc_%s' % kind, [op.args[0], v_index, arraydescr], op.result) diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py --- a/rpython/jit/metainterp/test/test_strstorage.py +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -1,6 +1,7 @@ import py from rpython.rlib.strstorage import str_storage_getitem from rpython.rlib.test.test_strstorage import BaseStrStorageTest +from rpython.jit.metainterp.history import getkind from rpython.jit.metainterp.test.support import LLJitMixin class TestStrStorage(BaseStrStorageTest, LLJitMixin): @@ -12,6 +13,8 @@ def f(): return str_storage_getitem(TYPE, buf, offset) res = self.interp_operations(f, []) - self.check_operations_history({'getarrayitem_gc_i': 1, + # + kind = getkind(TYPE)[0] # 'i' or 'f' + self.check_operations_history({'getarrayitem_gc_%s' % kind: 1, 'finish': 1}) return res From noreply at buildbot.pypy.org Wed Nov 18 02:27:05 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 08:27:05 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: aargh, forgot to add the default case. Thanks arigato Message-ID: <20151118072705.2B1CD1C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80741:86622dc58965 Date: 2015-11-18 08:27 +0100 http://bitbucket.org/pypy/pypy/changeset/86622dc58965/ Log: aargh, forgot to add the default case. Thanks arigato diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -1033,6 +1033,8 @@ return SpaceOperation('getarrayitem_gc_%s' % kind, [op.args[0], v_index, arraydescr], op.result) + else: + assert False, 'not supported' def rewrite_op_setinteriorfield(self, op): assert len(op.args) == 4 From noreply at buildbot.pypy.org Wed Nov 18 03:29:55 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 09:29:55 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: restore rawstorage.py as it is on default Message-ID: <20151118082955.815691C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80742:2b3a2c2f3640 Date: 2015-11-18 08:32 +0100 http://bitbucket.org/pypy/pypy/changeset/2b3a2c2f3640/ Log: restore rawstorage.py as it is on default diff --git a/rpython/rlib/rawstorage.py b/rpython/rlib/rawstorage.py --- a/rpython/rlib/rawstorage.py +++ b/rpython/rlib/rawstorage.py @@ -1,9 +1,8 @@ -from rpython.rlib.objectmodel import we_are_translated, keepalive_until_here +from rpython.rlib.objectmodel import we_are_translated from rpython.rtyper.extregistry import ExtRegistryEntry from rpython.rtyper.lltypesystem import lltype, rffi, llmemory from rpython.annotator import model as annmodel from rpython.rtyper.llannotation import lltype_to_annotation -from rpython.rlib import rgc from rpython.rlib.rgc import lltype_is_gc from rpython.rlib.objectmodel import specialize @@ -41,7 +40,6 @@ def free_raw_storage(storage, track_allocation=True): lltype.free(storage, flavor='raw', track_allocation=track_allocation) - # ____________________________________________________________ # # Support for possibly-unaligned accesses From noreply at buildbot.pypy.org Wed Nov 18 03:30:01 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 09:30:01 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: add a passing test for singlefloats Message-ID: <20151118083001.B04071C1DBB@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80745:85c3b26dea8a Date: 2015-11-18 09:29 +0100 http://bitbucket.org/pypy/pypy/changeset/85c3b26dea8a/ Log: add a passing test for singlefloats diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py --- a/rpython/jit/metainterp/test/test_strstorage.py +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -1,6 +1,8 @@ import py +from rpython.rtyper.lltypesystem import lltype from rpython.rlib.strstorage import str_storage_getitem from rpython.rlib.test.test_strstorage import BaseStrStorageTest +from rpython.jit.codewriter import longlong from rpython.jit.metainterp.history import getkind from rpython.jit.metainterp.test.support import LLJitMixin @@ -12,9 +14,15 @@ def str_storage_getitem(self, TYPE, buf, offset): def f(): return str_storage_getitem(TYPE, buf, offset) - res = self.interp_operations(f, []) + res = self.interp_operations(f, [], supports_singlefloats=True) # kind = getkind(TYPE)[0] # 'i' or 'f' self.check_operations_history({'getarrayitem_gc_%s' % kind: 1, 'finish': 1}) + # + if TYPE == lltype.SingleFloat: + # interp_operations returns the int version of r_singlefloat, but + # our tests expects to receive an r_singlefloat: let's convert it + # back! + return longlong.int2singlefloat(res) return res diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py --- a/rpython/rlib/test/test_strstorage.py +++ b/rpython/rlib/test/test_strstorage.py @@ -2,6 +2,7 @@ import struct from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.strstorage import str_storage_getitem +from rpython.rlib.rarithmetic import r_singlefloat from rpython.rtyper.test.tool import BaseRtypingTest class BaseStrStorageTest: @@ -26,6 +27,15 @@ assert self.str_storage_getitem(lltype.Float, buf, 0) == 12.3 assert self.str_storage_getitem(lltype.Float, buf, size) == 45.6 + def test_singlefloat(self): + buf = struct.pack('@ff', 12.3, 45.6) + size = struct.calcsize('@f') + x = self.str_storage_getitem(lltype.SingleFloat, buf, 0) + assert x == r_singlefloat(12.3) + x = self.str_storage_getitem(lltype.SingleFloat, buf, size) + assert x == r_singlefloat(45.6) + + class TestDirect(BaseStrStorageTest): def str_storage_getitem(self, TYPE, buf, offset): From noreply at buildbot.pypy.org Wed Nov 18 03:29:57 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 09:29:57 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: we no longer need @rgc.nocollect Message-ID: <20151118082957.87E1E1C1C61@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80743:5f6a7b8eaf84 Date: 2015-11-18 08:59 +0100 http://bitbucket.org/pypy/pypy/changeset/5f6a7b8eaf84/ Log: we no longer need @rgc.nocollect diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py --- a/rpython/rlib/strstorage.py +++ b/rpython/rlib/strstorage.py @@ -31,7 +31,6 @@ from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf from rpython.rtyper.annlowlevel import llstr from rpython.rlib.objectmodel import specialize -from rpython.rlib import rgc @specialize.memo() def rpy_string_as_type(TP): @@ -45,7 +44,6 @@ ('chars', lltype.Array(TP, hints={'immutable': True}))) return STR_AS_TP - at rgc.no_collect @specialize.ll() def str_storage_getitem(TP, s, index): STR_AS_TP = rpy_string_as_type(TP) From noreply at buildbot.pypy.org Wed Nov 18 03:30:03 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 09:30:03 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: run the strstorage tests also on top of the x86 backed Message-ID: <20151118083003.D79661C120B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80746:d528df864b73 Date: 2015-11-18 09:30 +0100 http://bitbucket.org/pypy/pypy/changeset/d528df864b73/ Log: run the strstorage tests also on top of the x86 backed diff --git a/rpython/jit/backend/x86/test/test_strstorage.py b/rpython/jit/backend/x86/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/backend/x86/test/test_strstorage.py @@ -0,0 +1,8 @@ +from rpython.jit.backend.x86.test.test_basic import Jit386Mixin +from rpython.jit.metainterp.test.test_strstorage import TestStrStorage as _TestStrStorage + + +class TestStrStorage(Jit386Mixin, _TestStrStorage): + # for the individual tests see + # ====> ../../../metainterp/test/test_strstorage.py + pass From noreply at buildbot.pypy.org Wed Nov 18 03:29:59 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 09:29:59 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: add a passing test for shorts Message-ID: <20151118082959.9484E1C1D36@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80744:7f76146cee2a Date: 2015-11-18 09:00 +0100 http://bitbucket.org/pypy/pypy/changeset/7f76146cee2a/ Log: add a passing test for shorts diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py --- a/rpython/rlib/test/test_strstorage.py +++ b/rpython/rlib/test/test_strstorage.py @@ -1,6 +1,6 @@ import py import struct -from rpython.rtyper.lltypesystem import lltype +from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.strstorage import str_storage_getitem from rpython.rtyper.test.tool import BaseRtypingTest @@ -12,13 +12,20 @@ assert self.str_storage_getitem(lltype.Signed, buf, 0) == 42 assert self.str_storage_getitem(lltype.Signed, buf, size) == 43 + def test_short(self): + buf = struct.pack('@hh', 42, 43) + size = struct.calcsize('@h') + x = self.str_storage_getitem(rffi.SHORT, buf, 0) + assert int(x) == 42 + x = self.str_storage_getitem(rffi.SHORT, buf, size) + assert int(x) == 43 + def test_float(self): buf = struct.pack('@dd', 12.3, 45.6) size = struct.calcsize('@d') assert self.str_storage_getitem(lltype.Float, buf, 0) == 12.3 assert self.str_storage_getitem(lltype.Float, buf, size) == 45.6 - class TestDirect(BaseStrStorageTest): def str_storage_getitem(self, TYPE, buf, offset): From noreply at buildbot.pypy.org Wed Nov 18 03:34:06 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 18 Nov 2015 09:34:06 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: Merge with default Message-ID: <20151118083406.13C4E1C120B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80747:6971eb50f3ff Date: 2015-11-18 09:23 +0100 http://bitbucket.org/pypy/pypy/changeset/6971eb50f3ff/ Log: Merge with default diff too long, truncating to 2000 out of 3927 lines diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -56,14 +56,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -87,7 +88,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -200,9 +200,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -234,6 +237,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -244,6 +248,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -253,6 +258,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -283,6 +289,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey @@ -309,13 +316,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -327,6 +337,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.3.0 +Version: 1.3.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -62,7 +62,8 @@ if csource.startswith('*', endpos): parts.append('('); closing += ')' level = 0 - for i in xrange(endpos, len(csource)): + i = endpos + while i < len(csource): c = csource[i] if c == '(': level += 1 @@ -73,6 +74,7 @@ elif c in ',;=': if level == 0: break + i += 1 csource = csource[endpos:i] + closing + csource[i:] #print repr(''.join(parts)+csource) parts.append(csource) diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py --- a/lib_pypy/cffi/model.py +++ b/lib_pypy/cffi/model.py @@ -514,12 +514,17 @@ if self.baseinttype is not None: return self.baseinttype.get_cached_btype(ffi, finishlist) # + from . import api if self.enumvalues: smallest_value = min(self.enumvalues) largest_value = max(self.enumvalues) else: - smallest_value = 0 - largest_value = 0 + import warnings + warnings.warn("%r has no values explicitly defined; next version " + "will refuse to guess which integer type it is " + "meant to be (unsigned/signed, int/long)" + % self._get_c_name()) + smallest_value = largest_value = 0 if smallest_value < 0: # needs a signed type sign = 1 candidate1 = PrimitiveType("int") diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -26,15 +26,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann - Richard Plangger + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -170,9 +170,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -204,6 +207,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -214,6 +218,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -223,6 +228,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -280,13 +286,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -298,6 +307,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst --- a/pypy/doc/index-of-release-notes.rst +++ b/pypy/doc/index-of-release-notes.rst @@ -6,6 +6,7 @@ .. toctree:: + release-4.0.1.rst release-4.0.0.rst release-2.6.1.rst release-2.6.0.rst diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst --- a/pypy/doc/index-of-whatsnew.rst +++ b/pypy/doc/index-of-whatsnew.rst @@ -7,6 +7,7 @@ .. toctree:: whatsnew-head.rst + whatsnew-4.0.1.rst whatsnew-4.0.0.rst whatsnew-2.6.1.rst whatsnew-2.6.0.rst diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-4.0.1.rst @@ -0,0 +1,106 @@ +========== +PyPy 4.0.1 +========== + +We have released PyPy 4.0.1, three weeks after PyPy 4.0.0. We have fixed +a few critical bugs in the JIT compiled code, reported by users. We therefore +encourage all users of PyPy to update to this version. There are a few minor +enhancements in this version as well. + +You can download the PyPy 4.0.1 release here: + + http://pypy.org/download.html + +We would like to thank our donors for the continued support of the PyPy +project. + +We would also like to thank our contributors and +encourage new people to join the project. PyPy has many +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ +with making RPython's JIT even better. + +CFFI +==== + +While not applicable only to PyPy, `cffi`_ is arguably our most significant +contribution to the python ecosystem. PyPy 4.0.1 ships with +`cffi-1.3.1`_ with the improvements it brings. + +.. _`PyPy`: http://doc.pypy.org +.. _`RPython`: https://rpython.readthedocs.org +.. _`cffi`: https://cffi.readthedocs.org +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1 +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html +.. _`numpy`: https://bitbucket.org/pypy/numpy + +What is PyPy? +============= + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) +due to its integrated tracing JIT compiler. + +We also welcome developers of other +`dynamic languages`_ to see what RPython can do for them. + +This release supports **x86** machines on most common operating systems +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd), +newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the +big- and little-endian variants of **ppc64** running Linux. + +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org +.. _`dynamic languages`: http://pypyjs.org + +Other Highlights (since 4.0.0 released three weeks ago) +======================================================= + +* Bug Fixes + + * Fix a bug when unrolling double loops in JITted code + + * Fix multiple memory leaks in the ssl module, one of which affected + `cpython` as well (thanks to Alex Gaynor for pointing those out) + + * Use pkg-config to find ssl headers on OS-X + + * Issues reported with our previous release were resolved_ after reports from users on + our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at + #pypy + +* New features: + + * Internal cleanup of RPython class handling + + * Support stackless and greenlets on PPC machines + + * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d + for example to have all subprocesses write the JIT log to a file + called 'log.%d', with '%d' replaced with the subprocess' PID. + + * Support PyOS_double_to_string in our cpyext capi compatibility layer + +* Numpy: + + * Improve support for __array_interface__ + + * Propagate NAN mantissas through float16-float32-float64 conversions + + +* Performance improvements and refactorings: + + * Improvements in slicing byte arrays + + * Improvements in enumerate() + + * Silence some warnings while translating + +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html + +Please update, and continue to help us make PyPy better. + +Cheers + +The PyPy Team + diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py --- a/pypy/doc/tool/makecontributor.py +++ b/pypy/doc/tool/makecontributor.py @@ -69,7 +69,9 @@ 'Rami Chowdhury': ['necaris'], 'Stanislaw Halik':['w31rd0'], 'Wenzhu Man':['wenzhu man', 'wenzhuman'], - 'Anton Gulenko':['anton gulenko'], + 'Anton Gulenko':['anton gulenko', 'anton_gulenko'], + 'Richard Lancaster':['richardlancaster'], + 'William Leslie':['William ML Leslie'], } alias_map = {} diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-4.0.1.rst @@ -0,0 +1,35 @@ +========================= +What's new in PyPy 4.0.1 +========================= + +.. this is a revision shortly after release-4.0.0 +.. startrev: 57c9a47c70f6 + +.. branch: 2174-fix-osx-10-11-translation + +Use pkg-config to find ssl headers on OS-X + +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 + +.. branch: ppc-stacklet + +The PPC machines now support the _continuation module (stackless, greenlets) + +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 + +Document that libgdbm-dev is required for translation/packaging + +.. branch: propogate-nans + +Ensure that ndarray conversion from int16->float16->float32->float16->int16 +preserves all int16 values, even across nan conversions. Also fix argmax, argmin +for nan comparisons + +.. branch: array_interface + +Support common use-cases for __array_interface__, passes upstream tests + +.. branch: no-class-specialize + +Some refactoring of class handling in the annotator. +Remove class specialisation and _settled_ flag. diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -2,30 +2,6 @@ What's new in PyPy 4.0.+ ========================= -.. this is a revision shortly after release-4.0.0 -.. startrev: 57c9a47c70f6 +.. this is a revision shortly after release-4.0.1 +.. startrev: 4b5c840d0da2 -.. branch: 2174-fix-osx-10-11-translation - -Use pkg-config to find ssl headers on OS-X - -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092 - -.. branch: ppc-stacklet - -The PPC machines now support the _continuation module (stackless, greenlets) - -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227 - -Document that libgdbm-dev is required for translation/packaging - -.. branch: propogate-nans - -Ensure that ndarray conversion from int16->float16->float32->float16->int16 -preserves all int16 values, even across nan conversions. Also fix argmax, argmin -for nan comparisons - -.. branch: array_interface - -Support common use-cases for __array_interface__, passes upstream tests - diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -28,7 +28,6 @@ """This is the abstract root class of all wrapped objects that live in a 'normal' object space like StdObjSpace.""" __slots__ = () - _settled_ = True user_overridden_class = False def getdict(self, space): diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -2,7 +2,7 @@ from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib import rdynload, clibffi -VERSION = "1.3.0" +VERSION = "1.3.1" FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI try: diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -448,7 +448,7 @@ 'alloc' is called with the size as argument. If it returns NULL, a MemoryError is raised. 'free' is called with the result of 'alloc' -as argument. Both can be either Python function or directly C +as argument. Both can be either Python functions or directly C functions. If 'free' is None, then no free function is called. If both 'alloc' and 'free' are None, the default is used. diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c --- a/pypy/module/_cffi_backend/src/parse_c_type.c +++ b/pypy/module/_cffi_backend/src/parse_c_type.c @@ -4,6 +4,7 @@ #include #if defined(_MSC_VER) +# define MS_WIN32 typedef size_t uintptr_t; #else # include diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py --- a/pypy/module/_cffi_backend/test/_backend_test_c.py +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py @@ -1,7 +1,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -16,8 +16,8 @@ from cffi import ffiplatform except ImportError: py.test.skip("system cffi module not found or older than 1.0.0") - if cffi.__version_info__ < (1, 2, 0): - py.test.skip("system cffi module needs to be at least 1.2.0") + if cffi.__version_info__ < (1, 3, 0): + py.test.skip("system cffi module needs to be at least 1.3.0") space.appexec([], """(): import _cffi_backend # force it to be initialized """) diff --git a/pypy/module/_minimal_curses/interp_curses.py b/pypy/module/_minimal_curses/interp_curses.py --- a/pypy/module/_minimal_curses/interp_curses.py +++ b/pypy/module/_minimal_curses/interp_curses.py @@ -13,7 +13,7 @@ def __init__(self, msg): self.msg = msg -from rpython.annotator.description import FORCE_ATTRIBUTES_INTO_CLASSES +from rpython.annotator.classdesc import FORCE_ATTRIBUTES_INTO_CLASSES from rpython.annotator.model import SomeString # this is necessary due to annmixlevel diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py --- a/pypy/module/_multiprocessing/interp_win32.py +++ b/pypy/module/_multiprocessing/interp_win32.py @@ -17,7 +17,7 @@ NMPWAIT_WAIT_FOREVER ERROR_PIPE_CONNECTED ERROR_SEM_TIMEOUT ERROR_PIPE_BUSY ERROR_NO_SYSTEM_RESOURCES ERROR_BROKEN_PIPE ERROR_MORE_DATA - ERROR_ALREADY_EXISTS + ERROR_ALREADY_EXISTS ERROR_NO_DATA """.split() class CConfig: diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py --- a/pypy/module/cpyext/pystrtod.py +++ b/pypy/module/cpyext/pystrtod.py @@ -5,10 +5,23 @@ from rpython.rlib import rdtoa from rpython.rlib import rfloat from rpython.rlib import rposix, jit +from rpython.rlib.rarithmetic import intmask from rpython.rtyper.lltypesystem import lltype from rpython.rtyper.lltypesystem import rffi +# PyOS_double_to_string's "type", if non-NULL, will be set to one of: +Py_DTST_FINITE = 0 +Py_DTST_INFINITE = 1 +Py_DTST_NAN = 2 + +# Match the "type" back to values in CPython +DOUBLE_TO_STRING_TYPES_MAP = { + rfloat.DIST_FINITE: Py_DTST_FINITE, + rfloat.DIST_INFINITY: Py_DTST_INFINITE, + rfloat.DIST_NAN: Py_DTST_NAN +} + @cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0) @jit.dont_look_inside # direct use of _get_errno() def PyOS_string_to_double(space, s, endptr, w_overflow_exception): @@ -68,3 +81,42 @@ finally: if not user_endptr: lltype.free(endptr, flavor='raw') + + at cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP) +def PyOS_double_to_string(space, val, format_code, precision, flags, ptype): + """Convert a double val to a string using supplied + format_code, precision, and flags. + + format_code must be one of 'e', 'E', 'f', 'F', + 'g', 'G' or 'r'. For 'r', the supplied precision + must be 0 and is ignored. The 'r' format code specifies the + standard repr() format. + + flags can be zero or more of the values Py_DTSF_SIGN, + Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together: + + Py_DTSF_SIGN means to always precede the returned string with a sign + character, even if val is non-negative. + + Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look + like an integer. + + Py_DTSF_ALT means to apply "alternate" formatting rules. See the + documentation for the PyOS_snprintf() '#' specifier for + details. + + If ptype is non-NULL, then the value it points to will be set to one of + Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that + val is a finite number, an infinite number, or not a number, respectively. + + The return value is a pointer to buffer with the converted string or + NULL if the conversion failed. The caller is responsible for freeing the + returned string by calling PyMem_Free(). + """ + buffer, rtype = rfloat.double_to_string(val, format_code, + intmask(precision), + intmask(flags)) + if ptype != lltype.nullptr(rffi.INTP.TO): + ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype]) + bufp = rffi.str2charp(buffer) + return bufp diff --git a/pypy/module/cpyext/test/test_pystrtod.py b/pypy/module/cpyext/test/test_pystrtod.py --- a/pypy/module/cpyext/test/test_pystrtod.py +++ b/pypy/module/cpyext/test/test_pystrtod.py @@ -1,5 +1,6 @@ import math +from pypy.module.cpyext import pystrtod from pypy.module.cpyext.test.test_api import BaseApiTest from rpython.rtyper.lltypesystem import rffi from rpython.rtyper.lltypesystem import lltype @@ -91,3 +92,76 @@ api.PyErr_Clear() rffi.free_charp(s) lltype.free(endp, flavor='raw') + + +class TestPyOS_double_to_string(BaseApiTest): + + def test_format_code(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(150.0, 'e', 1, 0, ptype) + assert '1.5e+02' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_precision(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3.14159269397, 'g', 5, 0, ptype) + assert '3.1416' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_sign(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(-3.14, 'g', 3, 1, ptype) + assert '-3.14' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_add_dot_0(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(3, 'g', 5, 2, ptype) + assert '3.0' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_flags_alt(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(314., 'g', 3, 4, ptype) + assert '314.' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_FINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_nan(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(float('nan'), 'g', 3, 4, ptype) + assert 'nan' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_NAN == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_infinity(self, api): + ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') + r = api.PyOS_double_to_string(1e200 * 1e200, 'g', 0, 0, ptype) + assert 'inf' == rffi.charp2str(r) + type_value = rffi.cast(lltype.Signed, ptype[0]) + assert pystrtod.Py_DTST_INFINITE == type_value + rffi.free_charp(r) + lltype.free(ptype, flavor='raw') + + def test_ptype_null(self, api): + ptype = lltype.nullptr(rffi.INTP.TO) + r = api.PyOS_double_to_string(3.14, 'g', 3, 0, ptype) + assert '3.14' == rffi.charp2str(r) + assert ptype == lltype.nullptr(rffi.INTP.TO) + rffi.free_charp(r) \ No newline at end of file diff --git a/pypy/module/marshal/interp_marshal.py b/pypy/module/marshal/interp_marshal.py --- a/pypy/module/marshal/interp_marshal.py +++ b/pypy/module/marshal/interp_marshal.py @@ -156,9 +156,6 @@ put_tuple_w(TYPE, tuple_w) puts tuple_w, an unwrapped list of wrapped objects """ - # _annspecialcase_ = "specialize:ctr_location" # polymorphic - # does not work with subclassing - def __init__(self, space, writer, version): self.space = space ## self.put = putfunc diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -684,8 +684,9 @@ arr_iter, arr_state = arr.create_iter() arr_dtype = arr.get_dtype() index_dtype = index.get_dtype() - # XXX length of shape of index as well? - while not index_iter.done(index_state): + # support the deprecated form where arr([True]) will return arr[0, ...] + # by iterating over res_iter, not index_iter + while not res_iter.done(res_state): getitem_filter_driver.jit_merge_point(shapelen=shapelen, index_dtype=index_dtype, arr_dtype=arr_dtype, diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -2238,6 +2238,9 @@ c = array([True,False,True],bool) b = a[c] assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all() + c = array([True]) + b = a[c] + assert b.shape == (1, 3) def test_bool_array_index_setitem(self): from numpy import arange, array diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1336,7 +1336,8 @@ # these depend on user-defined data, so should not be shared assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo") assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*") - assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") + # the following test is an opaque enum, which we no longer support + #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") # sanity check: twice 'ffi1' assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *") @@ -1348,6 +1349,17 @@ assert ffi.getctype("pe") == 'e *' assert ffi.getctype("e1*") == 'e1 *' + def test_opaque_enum(self): + ffi = FFI(backend=self.Backend()) + ffi.cdef("enum foo;") + from cffi import __version_info__ + if __version_info__ < (1, 4): + py.test.skip("re-enable me in version 1.4") + e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) + assert str(e.value) == ( + "'enum foo' has no values explicitly defined: refusing to guess " + "which integer type it is meant to be (unsigned/signed, int/long)") + def test_new_ctype(self): ffi = FFI(backend=self.Backend()) p = ffi.new("int *") diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py new file mode 100644 --- /dev/null +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py @@ -0,0 +1,35 @@ +# Generated by pypy/tool/import_cffi.py +import py, os, cffi, re +import _cffi_backend + + +def getlines(): + try: + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + except IOError: + py.test.skip("cannot find ../c/commontypes.c") + lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] + f.close() + return lines + +def test_alphabetical_order(): + lines = getlines() + assert lines == sorted(lines) + +def test_dependencies(): + r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?') + lines = getlines() + d = {} + for line in lines: + match = r.search(line) + if match is not None: + d[match.group(1)] = match.group(2) + for value in d.values(): + if value: + assert value in d + +def test_get_common_types(): + d = {} + _cffi_backend._get_common_types(d) + assert d["bool"] == "_Bool" diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -1231,6 +1231,21 @@ def setitem(self, index, char): self.data[index] = char + def getslice(self, start, stop, step, size): + if size == 0: + return "" + if step == 1: + assert 0 <= start <= stop + if start == 0 and stop == len(self.data): + return "".join(self.data) + return "".join(self.data[start:stop]) + return Buffer.getslice(self, start, stop, step, size) + + def setslice(self, start, string): + # No bounds checks. + for i in range(len(string)): + self.data[start + i] = string[i] + @specialize.argtype(1) def _memcmp(selfvalue, buffer, length): diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py --- a/pypy/objspace/std/test/test_tupleobject.py +++ b/pypy/objspace/std/test/test_tupleobject.py @@ -413,8 +413,9 @@ from __pypy__ import specialized_zip_2_lists except ImportError: specialized_zip_2_lists = zip - raises(TypeError, specialized_zip_2_lists, [], ()) - raises(TypeError, specialized_zip_2_lists, (), []) + else: + raises(TypeError, specialized_zip_2_lists, [], ()) + raises(TypeError, specialized_zip_2_lists, (), []) assert specialized_zip_2_lists([], []) == [ ] assert specialized_zip_2_lists([2, 3], []) == [ diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -2,6 +2,7 @@ from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant from rpython.annotator import specialize +from rpython.annotator.classdesc import InstanceSource, ClassDef @@ -20,7 +21,6 @@ def specialize__wrap(self, funcdesc, args_s): from pypy.interpreter.baseobjspace import W_Root - from rpython.annotator.classdef import ClassDef W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root) typ = args_s[1].knowntype if isinstance(typ, ClassDef): @@ -50,54 +50,34 @@ typ = (None, str) return funcdesc.cachedgraph(typ) - def _remember_immutable(self, t, cached): - # for jit benefit - if cached not in t._immutable_fields_: # accessed this way just - # for convenience - t._immutable_fields_.append(cached) - - def attach_lookup(self, t, attr): - cached = "cached_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup(attr)) - return True - return False - - def attach_lookup_in_type_where(self, t, attr): - cached = "cached_where_%s" % attr - if not t.is_heaptype() and not t.is_cpytype(): - self._remember_immutable(t, cached) - setattr(t, cached, t._lookup_where(attr)) - return True - return False - def consider_lookup(self, bookkeeper, attr): - from rpython.annotator.classdef import InstanceSource assert attr not in self.lookups from pypy.objspace.std import typeobject cached = "cached_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant(None) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups[attr] = True def consider_lookup_in_type_where(self, bookkeeper, attr): - from rpython.annotator.classdef import InstanceSource assert attr not in self.lookups_where from pypy.objspace.std import typeobject cached = "cached_where_%s" % attr clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) classdesc = clsdef.classdesc + classdesc.immutable_fields.add(cached) classdesc.classdict[cached] = Constant((None, None)) clsdef.add_source_for_attribute(cached, classdesc) for t in self.pypytypes: - if self.attach_lookup_in_type_where(t, attr): + if not (t.is_heaptype() or t.is_cpytype()): + setattr(t, cached, t._lookup_where(attr)) source = InstanceSource(bookkeeper, t) clsdef.add_source_for_attribute(cached, source) self.lookups_where[attr] = True @@ -135,18 +115,19 @@ def event(self, bookkeeper, what, x): from pypy.objspace.std import typeobject if isinstance(x, typeobject.W_TypeObject): - from rpython.annotator.classdef import InstanceSource clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject) self.pypytypes[x] = True #print "TYPE", x for attr in self.lookups: - if attr and self.attach_lookup(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_%s" % attr + setattr(x, cached, x._lookup(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) for attr in self.lookups_where: - if attr and self.attach_lookup_in_type_where(x, attr): + if attr and not (x.is_heaptype() or x.is_cpytype()): cached = "cached_where_%s" % attr + setattr(x, cached, x._lookup_where(attr)) source = InstanceSource(bookkeeper, x) clsdef.add_source_for_attribute(cached, source) return diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -14,8 +14,8 @@ SomeBuiltin, SomePBC, SomeInteger, TLS, TlsClass, SomeUnicodeCodePoint, s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked, - SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty, AnnotatorError) -from rpython.annotator.classdef import InstanceSource, ClassDef + SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty) +from rpython.annotator.classdesc import ClassDef, ClassDesc from rpython.annotator.listdef import ListDef, ListItem from rpython.annotator.dictdef import DictDef from rpython.annotator import description @@ -23,7 +23,6 @@ from rpython.annotator.argument import simple_args from rpython.rlib.objectmodel import r_dict, r_ordereddict, Symbolic from rpython.tool.algo.unionfind import UnionFind -from rpython.tool.flattenrec import FlattenRecursion from rpython.rtyper import extregistry try: @@ -215,9 +214,7 @@ s_callable.consider_call_site(args, s_result, call_op) def getuniqueclassdef(self, cls): - """Get the ClassDef associated with the given user cls. - Avoid using this! It breaks for classes that must be specialized. - """ + """Get the ClassDef associated with the given user cls.""" assert cls is not object desc = self.getdesc(cls) return desc.getuniqueclassdef() @@ -386,8 +383,9 @@ and x.__class__.__module__ != '__builtin__': if hasattr(x, '_cleanup_'): x._cleanup_() - self.see_mutable(x) - result = SomeInstance(self.getuniqueclassdef(x.__class__)) + classdef = self.getuniqueclassdef(x.__class__) + classdef.see_instance(x) + result = SomeInstance(classdef) elif x is None: return s_None else: @@ -414,7 +412,7 @@ if pyobj.__module__ == '__builtin__': # avoid making classdefs for builtin types result = self.getfrozen(pyobj) else: - result = description.ClassDesc(self, pyobj) + result = ClassDesc(self, pyobj) elif isinstance(pyobj, types.MethodType): if pyobj.im_self is None: # unbound return self.getdesc(pyobj.im_func) @@ -427,11 +425,11 @@ self.getdesc(pyobj.im_self)) # frozendesc else: # regular method origincls, name = origin_of_meth(pyobj) - self.see_mutable(pyobj.im_self) + classdef = self.getuniqueclassdef(pyobj.im_class) + classdef.see_instance(pyobj.im_self) assert pyobj == getattr(pyobj.im_self, name), ( "%r is not %s.%s ??" % (pyobj, pyobj.im_self, name)) # emulate a getattr to make sure it's on the classdef - classdef = self.getuniqueclassdef(pyobj.im_class) classdef.find_attribute(name) result = self.getmethoddesc( self.getdesc(pyobj.im_func), # funcdesc @@ -452,15 +450,6 @@ self.descs[pyobj] = result return result - def have_seen(self, x): - # this might need to expand some more. - if x in self.descs: - return True - elif (x.__class__, x) in self.seen_mutable: - return True - else: - return False - def getfrozen(self, pyobj): return description.FrozenDesc(self, pyobj) @@ -477,22 +466,6 @@ self.methoddescs[key] = result return result - _see_mutable_flattenrec = FlattenRecursion() - - def see_mutable(self, x): - key = (x.__class__, x) - if key in self.seen_mutable: - return - clsdef = self.getuniqueclassdef(x.__class__) - self.seen_mutable[key] = True - self.event('mutable', x) - source = InstanceSource(self, x) - def delayed(): - for attr in source.all_instance_attributes(): - clsdef.add_source_for_attribute(attr, source) - # ^^^ can trigger reflowing - self._see_mutable_flattenrec(delayed) - def valueoftype(self, t): return annotationoftype(t, self) @@ -547,6 +520,20 @@ return s_result + def getattr_locations(self, clsdesc, attrname): + attrdef = clsdesc.classdef.find_attribute(attrname) + return attrdef.read_locations + + def record_getattr(self, clsdesc, attrname): + locations = self.getattr_locations(clsdesc, attrname) + locations.add(self.position_key) + + def update_attr(self, clsdef, attrdef): + locations = self.getattr_locations(clsdef.classdesc, attrdef.name) + for position in locations: + self.annotator.reflowfromposition(position) + attrdef.validate(homedef=clsdef) + def pbc_call(self, pbc, args, emulated=None): """Analyse a call to a SomePBC() with the given args (list of annotations). diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -5,13 +5,14 @@ from collections import OrderedDict from rpython.annotator.model import ( - SomeInteger, SomeObject, SomeChar, SomeBool, SomeString, SomeTuple, + SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple, SomeUnicodeCodePoint, SomeFloat, unionof, SomeUnicodeString, SomePBC, SomeInstance, SomeDict, SomeList, SomeWeakRef, SomeIterator, SomeOrderedDict, SomeByteArray, add_knowntypedata, s_ImpossibleValue,) from rpython.annotator.bookkeeper import ( getbookkeeper, immutablevalue, BUILTIN_ANALYZERS, analyzer_for) from rpython.annotator import description +from rpython.annotator.classdesc import ClassDef from rpython.flowspace.model import Constant import rpython.rlib.rarithmetic import rpython.rlib.objectmodel @@ -124,7 +125,6 @@ def our_issubclass(cls1, cls2): """ we're going to try to be less silly in the face of old-style classes""" - from rpython.annotator.classdef import ClassDef if cls2 is object: return True def classify(cls): diff --git a/rpython/annotator/classdef.py b/rpython/annotator/classdesc.py rename from rpython/annotator/classdef.py rename to rpython/annotator/classdesc.py --- a/rpython/annotator/classdef.py +++ b/rpython/annotator/classdesc.py @@ -1,9 +1,18 @@ """ Type inference for user-defined classes. """ +from __future__ import absolute_import +import types + +from rpython.flowspace.model import Constant +from rpython.tool.flattenrec import FlattenRecursion +from rpython.tool.sourcetools import func_with_new_name +from rpython.tool.uid import Hashable from rpython.annotator.model import ( - SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError) -from rpython.annotator import description + SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError, SomeInteger, + SomeString, SomeImpossibleValue, SomeList, HarmlesslyBlocked) +from rpython.annotator.description import ( + Desc, FunctionDesc, MethodDesc, NODEFAULT) # The main purpose of a ClassDef is to collect information about class/instance @@ -67,56 +76,39 @@ # Both writing to the instance attribute and discovering prebuilt # instances that have the attribute set will turn off readonly-ness. - def __init__(self, name, bookkeeper): + def __init__(self, name): assert name != '__class__' self.name = name - self.bookkeeper = bookkeeper self.s_value = s_ImpossibleValue self.readonly = True self.attr_allowed = True - self.read_locations = {} + self.read_locations = set() def add_constant_source(self, classdef, source): s_value = source.s_get_value(classdef, self.name) if source.instance_level: # a prebuilt instance source forces readonly=False, see above self.modified(classdef) - s_new_value = unionof(self.s_value, s_value) # XXX "source %r attr %s" % (source, self.name), + s_new_value = unionof(self.s_value, s_value) self.s_value = s_new_value - def getvalue(self): - # Same as 'self.s_value' for historical reasons. - return self.s_value - - def merge(self, other, classdef='?'): + def merge(self, other, classdef): assert self.name == other.name - s_new_value = unionof(self.s_value, other.s_value) # XXX "%s attr %s" % (classdef, self.name) + s_new_value = unionof(self.s_value, other.s_value) self.s_value = s_new_value if not other.readonly: self.modified(classdef) self.read_locations.update(other.read_locations) - def mutated(self, homedef): # reflow from attr read positions - s_newvalue = self.getvalue() - - for position in self.read_locations: - self.bookkeeper.annotator.reflowfromposition(position) - - # check for method demotion and after-the-fact method additions + def validate(self, homedef): + s_newvalue = self.s_value + # check for after-the-fact method additions if isinstance(s_newvalue, SomePBC): attr = self.name - if s_newvalue.getKind() == description.MethodDesc: + if s_newvalue.getKind() == MethodDesc: # is method if homedef.classdesc.read_attribute(attr, None) is None: - if not homedef.check_missing_attribute_update(attr): - for desc in s_newvalue.descriptions: - if desc.selfclassdef is None: - if homedef.classdesc.settled: - raise AnnotatorError( - "demoting method %s to settled class " - "%s not allowed" % (self.name, homedef) - ) - break + homedef.check_missing_attribute_update(attr) # check for attributes forbidden by slots or _attrs_ if homedef.classdesc.all_enforced_attrs is not None: @@ -124,19 +116,22 @@ self.attr_allowed = False if not self.readonly: raise NoSuchAttrError( - "the attribute %r goes here to %r, " - "but it is forbidden here" % ( - self.name, homedef)) + "the attribute %r goes here to %r, but it is " + "forbidden here" % (self.name, homedef)) def modified(self, classdef='?'): self.readonly = False if not self.attr_allowed: + from rpython.annotator.bookkeeper import getbookkeeper + bk = getbookkeeper() + classdesc = classdef.classdesc + locations = bk.getattr_locations(classdesc, self.name) raise NoSuchAttrError( "Attribute %r on %r should be read-only.\n" % (self.name, classdef) + "This error can be caused by another 'getattr' that promoted\n" "the attribute here; the list of read locations is:\n" + - '\n'.join([str(loc[0]) for loc in self.read_locations])) + '\n'.join([str(loc[0]) for loc in locations])) class ClassDef(object): "Wraps a user class." @@ -152,6 +147,7 @@ self.read_locations_of__class__ = {} self.repr = None self.extra_access_sets = {} + self.instances_seen = set() if classdesc.basedesc: self.basedef = classdesc.basedesc.getuniqueclassdef() @@ -169,6 +165,27 @@ if self.bookkeeper: self.bookkeeper.event('classdef_setup', self) + def s_getattr(self, attrname, flags): + attrdef = self.find_attribute(attrname) + s_result = attrdef.s_value + # hack: if s_result is a set of methods, discard the ones + # that can't possibly apply to an instance of self. + # XXX do it more nicely + if isinstance(s_result, SomePBC): + s_result = self.lookup_filter(s_result, attrname, flags) + elif isinstance(s_result, SomeImpossibleValue): + self.check_missing_attribute_update(attrname) + # blocking is harmless if the attribute is explicitly listed + # in the class or a parent class. + for basedef in self.getmro(): + if basedef.classdesc.all_enforced_attrs is not None: + if attrname in basedef.classdesc.all_enforced_attrs: + raise HarmlesslyBlocked("get enforced attr") + elif isinstance(s_result, SomeList): + s_result = self.classdesc.maybe_return_immutable_list( + attrname, s_result) + return s_result + def add_source_for_attribute(self, attr, source): """Adds information about a constant source for an attribute. """ @@ -182,7 +199,7 @@ # but as an optimization we try to see if the attribute # has really been generalized if attrdef.s_value != s_prev_value: - attrdef.mutated(cdef) # reflow from all read positions + self.bookkeeper.update_attr(cdef, attrdef) return else: # remember the source in self.attr_sources @@ -200,16 +217,24 @@ s_prev_value = attrdef.s_value attrdef.add_constant_source(self, source) if attrdef.s_value != s_prev_value: - attrdef.mutated(subdef) # reflow from all read positions + self.bookkeeper.update_attr(subdef, attrdef) + + def get_owner(self, attrname): + """Return the classdef owning the attribute `attrname`.""" + for cdef in self.getmro(): + if attrname in cdef.attrs: + return cdef + else: + return None + def locate_attribute(self, attr): - while True: - for cdef in self.getmro(): - if attr in cdef.attrs: - return cdef - self.generalize_attr(attr) - # the return value will likely be 'self' now, but not always -- see - # test_annrpython.test_attr_moving_from_subclass_to_class_to_parent + cdef = self.get_owner(attr) + if cdef: + return cdef + else: + self._generalize_attr(attr, s_value=None) + return self def find_attribute(self, attr): return self.locate_attribute(attr).attrs[attr] @@ -247,13 +272,18 @@ seen[sub] = True def _generalize_attr(self, attr, s_value): - # first remove the attribute from subclasses -- including us! + # create the Attribute and do the generalization asked for + newattr = Attribute(attr) + if s_value: + newattr.s_value = s_value + + # remove the attribute from subclasses -- including us! # invariant (I) - subclass_attrs = [] constant_sources = [] # [(classdef-of-origin, source)] for subdef in self.getallsubdefs(): if attr in subdef.attrs: - subclass_attrs.append(subdef.attrs[attr]) + subattr = subdef.attrs[attr] + newattr.merge(subattr, classdef=self) del subdef.attrs[attr] if attr in subdef.attr_sources: # accumulate attr_sources for this attribute from all subclasses @@ -270,17 +300,6 @@ if not source.instance_level: constant_sources.append((superdef, source)) - # create the Attribute and do the generalization asked for - newattr = Attribute(attr, self.bookkeeper) - if s_value: - #if newattr.name == 'intval' and getattr(s_value, 'unsigned', False): - # import pdb; pdb.set_trace() - newattr.s_value = s_value - - # keep all subattributes' values - for subattr in subclass_attrs: - newattr.merge(subattr, classdef=self) - # store this new Attribute, generalizing the previous ones from # subclasses -- invariant (A) self.attrs[attr] = newattr @@ -291,15 +310,14 @@ newattr.add_constant_source(origin_classdef, source) # reflow from all read positions - newattr.mutated(self) + self.bookkeeper.update_attr(self, newattr) def generalize_attr(self, attr, s_value=None): # if the attribute exists in a superclass, generalize there, # as imposed by invariant (I) - for clsdef in self.getmro(): - if attr in clsdef.attrs: - clsdef._generalize_attr(attr, s_value) - break + clsdef = self.get_owner(attr) + if clsdef: + clsdef._generalize_attr(attr, s_value) else: self._generalize_attr(attr, s_value) @@ -326,11 +344,10 @@ for desc in pbc.descriptions: # pick methods but ignore already-bound methods, which can come # from an instance attribute - if (isinstance(desc, description.MethodDesc) - and desc.selfclassdef is None): + if (isinstance(desc, MethodDesc) and desc.selfclassdef is None): methclassdef = desc.originclassdef if methclassdef is not self and methclassdef.issubclass(self): - pass # subclasses methods are always candidates + pass # subclasses methods are always candidates elif self.issubclass(methclassdef): # upward consider only the best match if uplookup is None or methclassdef.issubclass(uplookup): @@ -341,7 +358,7 @@ # clsdef1.lookup_filter(pbc) includes # clsdef2.lookup_filter(pbc) (see formal proof...) else: - continue # not matching + continue # not matching # bind the method by giving it a selfclassdef. Use the # more precise subclass that it's coming from. desc = desc.bind_self(methclassdef, flags) @@ -382,6 +399,22 @@ else: return False + _see_instance_flattenrec = FlattenRecursion() + + def see_instance(self, x): + assert isinstance(x, self.classdesc.pyobj) + key = Hashable(x) + if key in self.instances_seen: + return + self.instances_seen.add(key) + self.bookkeeper.event('mutable', x) + source = InstanceSource(self.bookkeeper, x) + def delayed(): + for attr in source.all_instance_attributes(): + self.add_source_for_attribute(attr, source) + # ^^^ can trigger reflowing + self._see_instance_flattenrec(delayed) + def see_new_subclass(self, classdef): for position in self.read_locations_of__class__: self.bookkeeper.annotator.reflowfromposition(position) @@ -394,7 +427,8 @@ return SomePBC([subdef.classdesc for subdef in self.getallsubdefs()]) def _freeze_(self): - raise Exception("ClassDefs are used as knowntype for instances but cannot be used as immutablevalue arguments directly") + raise Exception("ClassDefs are used as knowntype for instances but " + "cannot be used as immutablevalue arguments directly") # ____________________________________________________________ @@ -432,3 +466,479 @@ class NoSuchAttrError(AnnotatorError): """Raised when an attribute is found on a class where __slots__ or _attrs_ forbits it.""" + + +def is_mixin(cls): + return cls.__dict__.get('_mixin_', False) + + +class ClassDesc(Desc): + knowntype = type + instance_level = False + all_enforced_attrs = None # or a set + _detect_invalid_attrs = None + + def __init__(self, bookkeeper, cls, + name=None, basedesc=None, classdict=None): + super(ClassDesc, self).__init__(bookkeeper, cls) + if '__NOT_RPYTHON__' in cls.__dict__: + raise AnnotatorError('Bad class') + + if name is None: + name = cls.__module__ + '.' + cls.__name__ + self.name = name + self.basedesc = basedesc + if classdict is None: + classdict = {} # populated below + self.classdict = classdict # {attr: Constant-or-Desc} + if cls.__dict__.get('_annspecialcase_', ''): + raise AnnotatorError( + "Class specialization has been removed. The " + "'_annspecialcase_' class tag is now unsupported.") + self.classdef = None + + if is_mixin(cls): + raise AnnotatorError("cannot use directly the class %r because " + "it is a _mixin_" % (cls,)) + + assert cls.__module__ != '__builtin__' + baselist = list(cls.__bases__) + + # special case: skip BaseException, and pretend + # that all exceptions ultimately inherit from Exception instead + # of BaseException (XXX hack) + if cls is Exception: + baselist = [] + elif baselist == [BaseException]: + baselist = [Exception] + + immutable_fields = cls.__dict__.get('_immutable_fields_', []) + # To prevent confusion, we forbid strings. Any other bona fide sequence + # of strings is OK. + if isinstance(immutable_fields, basestring): + raise AnnotatorError( + "In class %s, '_immutable_fields_' must be a sequence of " + "attribute names, not a string." % cls) + self.immutable_fields = set(immutable_fields) + + mixins_before = [] + mixins_after = [] + base = object + for b1 in baselist: + if b1 is object: + continue + if is_mixin(b1): + if base is object: + mixins_before.append(b1) + else: + mixins_after.append(b1) + else: + assert base is object, ("multiple inheritance only supported " + "with _mixin_: %r" % (cls,)) + base = b1 + if mixins_before and mixins_after: + raise Exception("unsupported: class %r has mixin bases both" + " before and after the regular base" % (self,)) + self.add_mixins(mixins_after, check_not_in=base) + self.add_mixins(mixins_before) + self.add_sources_for_class(cls) + + if base is not object: + self.basedesc = bookkeeper.getdesc(base) + + if '__slots__' in cls.__dict__ or '_attrs_' in cls.__dict__: + attrs = {} + for decl in ('__slots__', '_attrs_'): + decl = cls.__dict__.get(decl, []) + if isinstance(decl, str): + decl = (decl,) + decl = dict.fromkeys(decl) + attrs.update(decl) + if self.basedesc is not None: + if self.basedesc.all_enforced_attrs is None: + raise Exception("%r has slots or _attrs_, " + "but not its base class" % (cls,)) + attrs.update(self.basedesc.all_enforced_attrs) + self.all_enforced_attrs = attrs + + if (self.is_builtin_exception_class() and + self.all_enforced_attrs is None): + if cls not in FORCE_ATTRIBUTES_INTO_CLASSES: + self.all_enforced_attrs = [] # no attribute allowed + + def add_source_attribute(self, name, value, mixin=False): + if isinstance(value, property): + # special case for property object + if value.fget is not None: + newname = name + '__getter__' + func = func_with_new_name(value.fget, newname) + self.add_source_attribute(newname, func, mixin) + if value.fset is not None: + newname = name + '__setter__' + func = func_with_new_name(value.fset, newname) + self.add_source_attribute(newname, func, mixin) + self.classdict[name] = Constant(value) + return + + if isinstance(value, types.FunctionType): + # for debugging + if not hasattr(value, 'class_'): + value.class_ = self.pyobj + if mixin: + # make a new copy of the FunctionDesc for this class, + # but don't specialize further for all subclasses + funcdesc = FunctionDesc(self.bookkeeper, value) + self.classdict[name] = funcdesc + return + # NB. if value is, say, AssertionError.__init__, then we + # should not use getdesc() on it. Never. The problem is + # that the py lib has its own AssertionError.__init__ which + # is of type FunctionType. But bookkeeper.immutablevalue() + # will do the right thing in s_get_value(). + if isinstance(value, staticmethod) and mixin: + # make a new copy of staticmethod + func = value.__get__(42) + value = staticmethod(func_with_new_name(func, func.__name__)) + + if type(value) in MemberDescriptorTypes: + # skip __slots__, showing up in the class as 'member' objects + return + if name == '__init__' and self.is_builtin_exception_class(): + # pretend that built-in exceptions have no __init__, + # unless explicitly specified in builtin.py + from rpython.annotator.builtin import BUILTIN_ANALYZERS + value = getattr(value, 'im_func', value) + if value not in BUILTIN_ANALYZERS: + return + self.classdict[name] = Constant(value) + + def add_mixins(self, mixins, check_not_in=object): + if not mixins: + return + A = type('tmp', tuple(mixins) + (object,), {}) + mro = A.__mro__ + assert mro[0] is A and mro[-1] is object + mro = mro[1:-1] + # + skip = set() + def add(cls): + if cls is not object: + for base in cls.__bases__: + add(base) + for name in cls.__dict__: + skip.add(name) + add(check_not_in) + # + for base in reversed(mro): + assert is_mixin(base), ( + "Mixin class %r has non mixin base class %r" % (mixins, base)) + for name, value in base.__dict__.items(): + if name in skip: + continue + self.add_source_attribute(name, value, mixin=True) + if '_immutable_fields_' in base.__dict__: + self.immutable_fields.update( + set(base.__dict__['_immutable_fields_'])) + + + def add_sources_for_class(self, cls): + for name, value in cls.__dict__.items(): + self.add_source_attribute(name, value) + + def getclassdef(self, key): + return self.getuniqueclassdef() + + def _init_classdef(self): + classdef = ClassDef(self.bookkeeper, self) + self.bookkeeper.classdefs.append(classdef) + self.classdef = classdef + + # forced attributes + cls = self.pyobj + if cls in FORCE_ATTRIBUTES_INTO_CLASSES: + for name, s_value in FORCE_ATTRIBUTES_INTO_CLASSES[cls].items(): + classdef.generalize_attr(name, s_value) + classdef.find_attribute(name).modified(classdef) + + # register all class attributes as coming from this ClassDesc + # (as opposed to prebuilt instances) + classsources = {} + for attr in self.classdict: + classsources[attr] = self # comes from this ClassDesc + classdef.setup(classsources) + # look for a __del__ method and annotate it if it's there + if '__del__' in self.classdict: + from rpython.annotator.model import s_None, SomeInstance + s_func = self.s_read_attribute('__del__') + args_s = [SomeInstance(classdef)] + s = self.bookkeeper.emulate_pbc_call(classdef, s_func, args_s) + assert s_None.contains(s) + return classdef + + def getuniqueclassdef(self): + if self.classdef is None: + self._init_classdef() + return self.classdef + + def pycall(self, whence, args, s_previous_result, op=None): + from rpython.annotator.model import SomeInstance, SomeImpossibleValue + classdef = self.getuniqueclassdef() + s_instance = SomeInstance(classdef) + # look up __init__ directly on the class, bypassing the normal + # lookup mechanisms ClassDef (to avoid influencing Attribute placement) + s_init = self.s_read_attribute('__init__') + if isinstance(s_init, SomeImpossibleValue): + # no __init__: check that there are no constructor args + if not self.is_exception_class(): + try: + args.fixedunpack(0) + except ValueError: + raise Exception("default __init__ takes no argument" + " (class %s)" % (self.name,)) + elif self.pyobj is Exception: + # check explicitly against "raise Exception, x" where x + # is a low-level exception pointer + try: + [s_arg] = args.fixedunpack(1) + except ValueError: + pass + else: + from rpython.rtyper.llannotation import SomePtr + assert not isinstance(s_arg, SomePtr) + else: + # call the constructor + args = args.prepend(s_instance) + s_init.call(args) + return s_instance + + def is_exception_class(self): + return issubclass(self.pyobj, BaseException) + + def is_builtin_exception_class(self): + if self.is_exception_class(): + if self.pyobj.__module__ == 'exceptions': + return True + if issubclass(self.pyobj, AssertionError): + return True + return False + + def lookup(self, name): + cdesc = self + while name not in cdesc.classdict: + cdesc = cdesc.basedesc + if cdesc is None: + return None + else: + return cdesc + + def get_param(self, name, default=None, inherit=True): + cls = self.pyobj + if inherit: + return getattr(cls, name, default) + else: + return cls.__dict__.get(name, default) + + def read_attribute(self, name, default=NODEFAULT): + cdesc = self.lookup(name) + if cdesc is None: + if default is NODEFAULT: + raise AttributeError + else: + return default + else: + return cdesc.classdict[name] + + def s_read_attribute(self, name): + # look up an attribute in the class + cdesc = self.lookup(name) + if cdesc is None: + return s_ImpossibleValue + else: + # delegate to s_get_value to turn it into an annotation + return cdesc.s_get_value(None, name) + + def s_get_value(self, classdef, name): + obj = self.classdict[name] + if isinstance(obj, Constant): + value = obj.value + if isinstance(value, staticmethod): # special case + value = value.__get__(42) + classdef = None # don't bind + elif isinstance(value, classmethod): + raise AnnotatorError("classmethods are not supported") + s_value = self.bookkeeper.immutablevalue(value) + if classdef is not None: + s_value = s_value.bind_callables_under(classdef, name) + elif isinstance(obj, Desc): + if classdef is not None: + obj = obj.bind_under(classdef, name) + s_value = SomePBC([obj]) + else: + raise TypeError("classdict should not contain %r" % (obj,)) + return s_value + + def create_new_attribute(self, name, value): + assert name not in self.classdict, "name clash: %r" % (name,) + self.classdict[name] = Constant(value) + + def find_source_for(self, name): + if name in self.classdict: + return self + # check whether there is a new attribute + cls = self.pyobj + if name in cls.__dict__: + self.add_source_attribute(name, cls.__dict__[name]) + if name in self.classdict: + return self + return None + + def maybe_return_immutable_list(self, attr, s_result): + # hack: 'x.lst' where lst is listed in _immutable_fields_ as + # either 'lst[*]' or 'lst?[*]' + # should really return an immutable list as a result. Implemented + # by changing the result's annotation (but not, of course, doing an + # actual copy in the rtyper). Tested in rpython.rtyper.test.test_rlist, + # test_immutable_list_out_of_instance. + if self._detect_invalid_attrs and attr in self._detect_invalid_attrs: + raise Exception("field %r was migrated to %r from a subclass in " + "which it was declared as _immutable_fields_" % + (attr, self.pyobj)) + search1 = '%s[*]' % (attr,) + search2 = '%s?[*]' % (attr,) + cdesc = self + while cdesc is not None: + immutable_fields = cdesc.immutable_fields + if immutable_fields: + if (search1 in immutable_fields or search2 in immutable_fields): + s_result.listdef.never_resize() + s_copy = s_result.listdef.offspring() + s_copy.listdef.mark_as_immutable() + # + cdesc = cdesc.basedesc + while cdesc is not None: + if cdesc._detect_invalid_attrs is None: + cdesc._detect_invalid_attrs = set() + cdesc._detect_invalid_attrs.add(attr) + cdesc = cdesc.basedesc + # + return s_copy + cdesc = cdesc.basedesc + return s_result # common case + + @staticmethod + def consider_call_site(descs, args, s_result, op): + descs[0].getcallfamily() + descs[0].mergecallfamilies(*descs[1:]) + from rpython.annotator.model import SomeInstance, SomePBC, s_None + if len(descs) == 1: + # call to a single class, look at the result annotation + # in case it was specialized + if not isinstance(s_result, SomeInstance): + raise Exception("calling a class didn't return an instance??") + classdefs = [s_result.classdef] + else: + # call to multiple classes: specialization not supported + classdefs = [desc.getuniqueclassdef() for desc in descs] + # If some of the classes have an __init__ and others not, then + # we complain, even though in theory it could work if all the + # __init__s take no argument. But it's messy to implement, so + # let's just say it is not RPython and you have to add an empty + # __init__ to your base class. + has_init = False + for desc in descs: + s_init = desc.s_read_attribute('__init__') + has_init |= isinstance(s_init, SomePBC) + basedesc = ClassDesc.getcommonbase(descs) + s_init = basedesc.s_read_attribute('__init__') + parent_has_init = isinstance(s_init, SomePBC) + if has_init and not parent_has_init: + raise AnnotatorError( + "some subclasses among %r declare __init__()," + " but not the common parent class" % (descs,)) + # make a PBC of MethodDescs, one for the __init__ of each class + initdescs = [] + for desc, classdef in zip(descs, classdefs): + s_init = desc.s_read_attribute('__init__') + if isinstance(s_init, SomePBC): + assert len(s_init.descriptions) == 1, ( + "unexpected dynamic __init__?") + initfuncdesc, = s_init.descriptions + if isinstance(initfuncdesc, FunctionDesc): + from rpython.annotator.bookkeeper import getbookkeeper + initmethdesc = getbookkeeper().getmethoddesc( + initfuncdesc, classdef, classdef, '__init__') + initdescs.append(initmethdesc) + # register a call to exactly these __init__ methods + if initdescs: + initdescs[0].mergecallfamilies(*initdescs[1:]) + MethodDesc.consider_call_site(initdescs, args, s_None, op) + + def getallbases(self): + desc = self + while desc is not None: + yield desc + desc = desc.basedesc + + @staticmethod + def getcommonbase(descs): + commondesc = descs[0] + for desc in descs[1:]: + allbases = set(commondesc.getallbases()) + while desc not in allbases: + assert desc is not None, "no common base for %r" % (descs,) + desc = desc.basedesc + commondesc = desc + return commondesc + + def rowkey(self): + return self + + def getattrfamily(self, attrname): + "Get the ClassAttrFamily object for attrname. Possibly creates one." + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + _, _, attrfamily = access_sets.find(self) + return attrfamily + + def queryattrfamily(self, attrname): + """Retrieve the ClassAttrFamily object for attrname if there is one, + otherwise return None.""" + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + try: + return access_sets[self] + except KeyError: + return None + + def mergeattrfamilies(self, others, attrname): + """Merge the attr families of the given Descs into one.""" + access_sets = self.bookkeeper.get_classpbc_attr_families(attrname) + changed, rep, attrfamily = access_sets.find(self) + for desc in others: + changed1, rep, attrfamily = access_sets.union(rep, desc) + changed = changed or changed1 + return changed + +# ____________________________________________________________ + +class Sample(object): + __slots__ = 'x' +MemberDescriptorTypes = [type(Sample.x)] +del Sample +try: + MemberDescriptorTypes.append(type(OSError.errno)) +except AttributeError: # on CPython <= 2.4 + pass + +# ____________________________________________________________ + +FORCE_ATTRIBUTES_INTO_CLASSES = { + EnvironmentError: {'errno': SomeInteger(), + 'strerror': SomeString(can_be_None=True), + 'filename': SomeString(can_be_None=True)}, +} + +try: + WindowsError +except NameError: + pass +else: + FORCE_ATTRIBUTES_INTO_CLASSES[WindowsError] = {'winerror': SomeInteger()} diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py --- a/rpython/annotator/description.py +++ b/rpython/annotator/description.py @@ -2,13 +2,12 @@ import types from rpython.annotator.signature import ( enforce_signature_args, enforce_signature_return, finish_type) -from rpython.flowspace.model import Constant, FunctionGraph +from rpython.flowspace.model import FunctionGraph from rpython.flowspace.bytecode import cpython_code_signature from rpython.annotator.argument import rawshape, ArgErr, simple_args -from rpython.tool.sourcetools import valid_identifier, func_with_new_name +from rpython.tool.sourcetools import valid_identifier from rpython.tool.pairtype import extendabletype -from rpython.annotator.model import ( - AnnotatorError, SomeInteger, SomeString, s_ImpossibleValue) +from rpython.annotator.model import AnnotatorError, s_ImpossibleValue class CallFamily(object): """A family of Desc objects that could be called from common call sites. @@ -188,6 +187,8 @@ class NoStandardGraph(Exception): """The function doesn't have a single standard non-specialized graph.""" +NODEFAULT = object() + class FunctionDesc(Desc): knowntype = types.FunctionType @@ -404,469 +405,6 @@ return s_sigs -def is_mixin(cls): - return cls.__dict__.get('_mixin_', False) - -NODEFAULT = object() - -class ClassDesc(Desc): - knowntype = type - instance_level = False - all_enforced_attrs = None # or a set - settled = False - _detect_invalid_attrs = None - - def __init__(self, bookkeeper, cls, - name=None, basedesc=None, classdict=None, - specialize=None): - super(ClassDesc, self).__init__(bookkeeper, cls) - if '__NOT_RPYTHON__' in cls.__dict__: - raise AnnotatorError('Bad class') - - if name is None: - name = cls.__module__ + '.' + cls.__name__ - self.name = name - self.basedesc = basedesc - if classdict is None: - classdict = {} # populated below - self.classdict = classdict # {attr: Constant-or-Desc} - if specialize is None: - specialize = cls.__dict__.get('_annspecialcase_', '') - self.specialize = specialize - self._classdefs = {} - - if is_mixin(cls): - raise AnnotatorError("cannot use directly the class %r because " - "it is a _mixin_" % (cls,)) - - assert cls.__module__ != '__builtin__' From noreply at buildbot.pypy.org Wed Nov 18 03:34:08 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 18 Nov 2015 09:34:08 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: fix merge Message-ID: <20151118083408.51E021C120B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80748:c8079c4b84d1 Date: 2015-11-18 09:35 +0100 http://bitbucket.org/pypy/pypy/changeset/c8079c4b84d1/ Log: fix merge diff --git a/rpython/jit/backend/llsupport/stmrewrite.py b/rpython/jit/backend/llsupport/stmrewrite.py --- a/rpython/jit/backend/llsupport/stmrewrite.py +++ b/rpython/jit/backend/llsupport/stmrewrite.py @@ -50,7 +50,7 @@ if op.is_call(): self.next_op_may_be_in_new_transaction() # - if opnum in (rop.CALL_RELEASE_GIL_I, rop.CALL_RELEASE_GIL_R, + if opnum in (rop.CALL_RELEASE_GIL_I, rop.CALL_RELEASE_GIL_F, rop.CALL_RELEASE_GIL_N): # self.fallback_inevitable(op) # is done by assembler._release_gil_shadowstack() From noreply at buildbot.pypy.org Wed Nov 18 03:59:50 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 09:59:50 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Fix cparser Message-ID: <20151118085950.A3F081C1279@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2414:40fdfeb33597 Date: 2015-11-18 09:28 +0100 http://bitbucket.org/cffi/cffi/changeset/40fdfeb33597/ Log: Fix cparser diff --git a/cffi/cffi_opcode.py b/cffi/cffi_opcode.py --- a/cffi/cffi_opcode.py +++ b/cffi/cffi_opcode.py @@ -54,7 +54,7 @@ OP_DLOPEN_FUNC = 35 OP_DLOPEN_CONST = 37 OP_GLOBAL_VAR_F = 39 -OP_CALL_PYTHON = 41 +OP_EXTERN_PYTHON = 41 PRIM_VOID = 0 PRIM_BOOL = 1 diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -29,7 +29,7 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") -_r_cffi_call_python = re.compile(r"\bCFFI_CALL_PYTHON\b") +_r_extern_python = re.compile(r'\bextern\s*"Python"\s*.') _r_star_const_space = re.compile( # matches "* const " r"[*]\s*((const|volatile|restrict)\b\s*)+") @@ -81,6 +81,47 @@ parts.append(csource) return ''.join(parts) +def _preprocess_extern_python(csource): + # input: `extern "Python" int foo(int);` or + # `extern "Python" { int foo(int); }` + # output: + # void __cffi_extern_python_start; + # int foo(int); + # void __cffi_extern_python_stop; + parts = [] + while True: + match = _r_extern_python.search(csource) + if not match: + break + endpos = match.end() - 1 + #print + #print ''.join(parts)+csource + #print '=>' + parts.append(csource[:match.start()]) + parts.append('void __cffi_extern_python_start; ') + if csource[endpos] == '{': + # grouping variant + closing = csource.find('}', endpos) + if closing < 0: + raise api.CDefError("'extern \"Python\" {': no '}' found") + if csource.find('{', endpos + 1, closing) >= 0: + raise NotImplementedError("cannot use { } inside a block " + "'extern \"Python\" { ... }'") + parts.append(csource[endpos+1:closing]) + csource = csource[closing+1:] + else: + # non-grouping variant + semicolon = csource.find(';', endpos) + if semicolon < 0: + raise api.CDefError("'extern \"Python\": no ';' found") + parts.append(csource[endpos:semicolon+1]) + csource = csource[semicolon+1:] + parts.append(' void __cffi_extern_python_stop;') + #print ''.join(parts)+csource + #print + parts.append(csource) + return ''.join(parts) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -105,8 +146,8 @@ csource = _r_stdcall1.sub(' volatile volatile const ', csource) csource = _r_cdecl.sub(' ', csource) # - # Replace "CFFI_CALL_PYTHON" with "void CFFI_CALL_PYTHON;" - csource = _r_cffi_call_python.sub('void CFFI_CALL_PYTHON;', csource) + # Replace `extern "Python"` with start/end markers + csource = _preprocess_extern_python(csource) # # Replace "[...]" with "[__dotdotdotarray__]" csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) @@ -263,9 +304,8 @@ break # try: - self._found_cffi_call_python = False + self._inside_extern_python = False for decl in iterator: - old_cffi_call_python = self._found_cffi_call_python if isinstance(decl, pycparser.c_ast.Decl): self._parse_decl(decl) elif isinstance(decl, pycparser.c_ast.Typedef): @@ -288,8 +328,6 @@ self._declare('typedef ' + decl.name, realtype, quals=quals) else: raise api.CDefError("unrecognized construct", decl) - if old_cffi_call_python and self._found_cffi_call_python: - raise api.CDefError("CFFI_CALL_PYTHON misplaced") except api.FFIError as e: msg = self._convert_pycparser_error(e, csource) if msg: @@ -338,9 +376,8 @@ def _declare_function(self, tp, quals, decl): tp = self._get_type_pointer(tp, quals) - if self._found_cffi_call_python: - self._declare('call_python ' + decl.name, tp) - self._found_cffi_call_python = False + if self._inside_extern_python: + self._declare('extern_python ' + decl.name, tp) else: self._declare('function ' + decl.name, tp) @@ -378,15 +415,23 @@ _r_int_literal.match(decl.init.expr.value)): self._add_integer_constant(decl.name, '-' + decl.init.expr.value) - elif tp is model.void_type and decl.name == 'CFFI_CALL_PYTHON': - # hack: "CFFI_CALL_PYTHON" in the C source is replaced - # with "void CFFI_CALL_PYTHON;", which when parsed arrives - # at this point and sets this flag: - self._found_cffi_call_python = True - elif (quals & model.Q_CONST) and not tp.is_array_type: - self._declare('constant ' + decl.name, tp, quals=quals) + elif (tp is model.void_type and + decl.name.startswith('__cffi_extern_python_')): + # hack: `extern "Python"` in the C source is replaced + # with "void __cffi_extern_python_start;" and + # "void __cffi_extern_python_stop;" + self._inside_extern_python = not self._inside_extern_python + assert self._inside_extern_python == ( + decl.name == '__cffi_extern_python_start') else: - self._declare('variable ' + decl.name, tp, quals=quals) + if self._inside_extern_python: + raise api.CDefError( + "cannot declare constants or " + "variables with 'extern \"Python\"'") + if (quals & model.Q_CONST) and not tp.is_array_type: + self._declare('constant ' + decl.name, tp, quals=quals) + else: + self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): return self.parse_type_and_quals(cdecl)[0] diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -406,16 +406,30 @@ "long(*)(), " "short(%s*)(short))'>" % (stdcall, stdcall)) -def test_CFFI_CALL_PYTHON(): +def test_extern_python(): ffi = FFI() ffi.cdef(""" + int bok(int, int); + extern "Python" int foobar(int, int); int baz(int, int); - CFFI_CALL_PYTHON int foobar(int, int); """) - assert 'variable CFFI_CALL_PYTHON' not in ffi._parser._declarations - assert 'function baz' in ffi._parser._declarations - assert 'call_python baz' not in ffi._parser._declarations - assert 'function foobar' not in ffi._parser._declarations - assert 'call_python foobar' in ffi._parser._declarations + assert sorted(ffi._parser._declarations) == [ + 'extern_python foobar', 'function baz', 'function bok'] + assert (ffi._parser._declarations['function bok'] == + ffi._parser._declarations['extern_python foobar'] == + ffi._parser._declarations['function baz']) + +def test_extern_python_group(): + ffi = FFI() + ffi.cdef(""" + int bok(int); + extern "Python" {int foobar(int, int);int bzrrr(int);} + int baz(int, int); + """) + assert sorted(ffi._parser._declarations) == [ + 'extern_python bzrrr', 'extern_python foobar', + 'function baz', 'function bok'] assert (ffi._parser._declarations['function baz'] == - ffi._parser._declarations['call_python foobar']) + ffi._parser._declarations['extern_python foobar'] != + ffi._parser._declarations['function bok'] == + ffi._parser._declarations['extern_python bzrrr']) From noreply at buildbot.pypy.org Wed Nov 18 03:59:52 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 09:59:52 +0100 (CET) Subject: [pypy-commit] cffi static-callback: update the code to use 'extern "Python"' Message-ID: <20151118085952.D38A31C1279@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2415:4a750b4d4bfa Date: 2015-11-18 10:00 +0100 http://bitbucket.org/cffi/cffi/changeset/4a750b4d4bfa/ Log: update the code to use 'extern "Python"' diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -6350,8 +6350,8 @@ } #endif -struct _cffi_callpy_s; /* forward declaration */ -static void _cffi_call_python(struct _cffi_callpy_s *callpy, char *args); +struct _cffi_externpy_s; /* forward declaration */ +static void _cffi_call_python(struct _cffi_externpy_s *, char *args); static void *cffi_exports[] = { NULL, diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -1,5 +1,5 @@ -static PyObject *_ffi_call_python_decorator(PyObject *outer_args, PyObject *fn) +static PyObject *_ffi_def_extern_decorator(PyObject *outer_args, PyObject *fn) { #if PY_MAJOR_VERSION >= 3 # error review! @@ -8,7 +8,7 @@ PyObject *error, *onerror, *infotuple, *x; int index; const struct _cffi_global_s *g; - struct _cffi_callpy_s *callpy; + struct _cffi_externpy_s *externpy; CTypeDescrObject *ct; FFIObject *ffi; builder_c_t *types_builder; @@ -33,7 +33,7 @@ if (index < 0) goto not_found; g = &types_builder->ctx.globals[index]; - if (_CFFI_GETOP(g->type_op) != _CFFI_OP_CALL_PYTHON) + if (_CFFI_GETOP(g->type_op) != _CFFI_OP_EXTERN_PYTHON) goto not_found; Py_XDECREF(name); @@ -50,9 +50,9 @@ /* attach infotuple to reserved1, where it will stay forever unless a new version is attached later */ - callpy = (struct _cffi_callpy_s *)g->address; - x = (PyObject *)callpy->reserved1; - callpy->reserved1 = (void *)infotuple; + externpy = (struct _cffi_externpy_s *)g->address; + x = (PyObject *)externpy->reserved1; + externpy->reserved1 = (void *)infotuple; Py_XDECREF(x); /* return a cdata of type function-pointer, equal to the one @@ -62,22 +62,22 @@ return x; not_found: - PyErr_Format(FFIError, "ffi.call_python('%s'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef", s); + PyErr_Format(FFIError, "ffi.def_extern('%s'): no 'extern \"Python\"' " + "function with this name", s); Py_XDECREF(name); return NULL; } -static void _cffi_call_python(struct _cffi_callpy_s *callpy, char *args) +static void _cffi_call_python(struct _cffi_externpy_s *externpy, char *args) { - /* Invoked by the helpers generated from CFFI_CALL_PYTHON in the cdef. + /* Invoked by the helpers generated from extern "Python" in the cdef. - 'callpy' is a static structure that describes which of the - CFFI_CALL_PYTHON is called. It has got fields 'name' and + 'externpy' is a static structure that describes which of the + extern "Python" functions is called. It has got fields 'name' and 'type_index' describing the function, and more reserved fields that are initially zero. These reserved fields are set up by - ffi.call_python(), which invokes init_call_python() below. + ffi.def_extern(), which invokes _ffi_def_extern_decorator() above. 'args' is a pointer to an array of 8-byte entries. Each entry contains an argument. If an argument is less than 8 bytes, only @@ -85,8 +85,9 @@ argument is 'long double' or a struct/union, then it is passed by reference. - 'args' is also used as the place to write the result to. In all - cases, 'args' is at least 8 bytes in size. + 'args' is also used as the place to write the result to + (directly, even if more than 8 bytes). In all cases, 'args' is + at least 8 bytes in size. */ save_errno(); { @@ -94,21 +95,20 @@ PyGILState_STATE state = PyGILState_Ensure(); #endif - if (callpy->reserved1 == NULL) { + if (externpy->reserved1 == NULL) { /* not initialized! */ PyObject *f = PySys_GetObject("stderr"); if (f != NULL) { - PyFile_WriteString("CFFI_CALL_PYTHON: function ", f); - PyFile_WriteString(callpy->name, f); + PyFile_WriteString("extern \"Python\": function ", f); + PyFile_WriteString(externpy->name, f); PyFile_WriteString("() called, but no code was attached " - "to it yet with ffi.call_python('", f); - PyFile_WriteString(callpy->name, f); - PyFile_WriteString("'). Returning 0.\n", f); + "to it yet with @ffi.def_extern(). " + "Returning 0.\n", f); } - memset(args, 0, callpy->size_of_result); + memset(args, 0, externpy->size_of_result); } else { - general_invoke_callback(0, args, args, callpy->reserved1); + general_invoke_callback(0, args, args, externpy->reserved1); } #ifdef WITH_THREAD diff --git a/c/cffi1_module.c b/c/cffi1_module.c --- a/c/cffi1_module.c +++ b/c/cffi1_module.c @@ -174,7 +174,7 @@ /* initialize the exports array */ num_exports = 25; - if (ctx->flags & 1) /* set to mean "uses _cffi_call_python" */ + if (ctx->flags & 1) /* set to mean that 'extern "Python"' is used */ num_exports = 26; memcpy(exports, (char *)cffi_exports, num_exports * sizeof(void *)); diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -744,10 +744,10 @@ #define ffi_gc b_gcp /* ffi_gc() => b_gcp() from _cffi_backend.c */ -PyDoc_STRVAR(ffi_call_python_doc, +PyDoc_STRVAR(ffi_def_extern_doc, "A decorator. Attaches the decorated Python function to the C code\n" -"generated for the CFFI_CALL_PYTHON function of the same name. Calling\n" -"the C function will then invoke the Python function.\n" +"generated for the 'extern \"Python\"' function of the same name.\n" +"Calling the C function will then invoke the Python function.\n" "\n" "Optional arguments: 'name' is the name of the C function, if\n" "different from the Python function; and 'error' and 'onerror'\n" @@ -755,13 +755,13 @@ "(see the docs for details)."); /* forward; see call_python.c */ -static PyObject *_ffi_call_python_decorator(PyObject *, PyObject *); +static PyObject *_ffi_def_extern_decorator(PyObject *, PyObject *); -static PyObject *ffi_call_python(FFIObject *self, PyObject *args, - PyObject *kwds) +static PyObject *ffi_def_extern(FFIObject *self, PyObject *args, + PyObject *kwds) { - static PyMethodDef md = {"call_python_decorator", - (PyCFunction)_ffi_call_python_decorator, METH_O}; + static PyMethodDef md = {"def_extern_decorator", + (PyCFunction)_ffi_def_extern_decorator, METH_O}; PyObject *name = Py_None, *error = Py_None; PyObject *res, *onerror = Py_None; static char *keywords[] = {"name", "error", "onerror", NULL}; @@ -922,7 +922,7 @@ {"addressof", (PyCFunction)ffi_addressof, METH_VARARGS, ffi_addressof_doc}, {"alignof", (PyCFunction)ffi_alignof, METH_O, ffi_alignof_doc}, {"buffer", (PyCFunction)ffi_buffer, METH_VKW, ffi_buffer_doc}, - {"call_python",(PyCFunction)ffi_call_python,METH_VKW, ffi_call_python_doc}, + {"def_extern", (PyCFunction)ffi_def_extern, METH_VKW, ffi_def_extern_doc}, {"callback", (PyCFunction)ffi_callback, METH_VKW, ffi_callback_doc}, {"cast", (PyCFunction)ffi_cast, METH_VARARGS, ffi_cast_doc}, {"dlclose", (PyCFunction)ffi_dlclose, METH_VARARGS, ffi_dlclose_doc}, diff --git a/c/lib_obj.c b/c/lib_obj.c --- a/c/lib_obj.c +++ b/c/lib_obj.c @@ -364,8 +364,8 @@ break; } - case _CFFI_OP_CALL_PYTHON: - /* for reading 'lib.bar' where bar is declared with CFFI_CALL_PYTHON */ + case _CFFI_OP_EXTERN_PYTHON: + /* for reading 'lib.bar' where bar is declared with extern "Python" */ ct = realize_c_type(types_builder, types_builder->ctx.types, _CFFI_GETARG(g->type_op)); if (ct == NULL) diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h --- a/cffi/_cffi_include.h +++ b/cffi/_cffi_include.h @@ -147,7 +147,7 @@ #define _cffi_convert_array_from_object \ ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) #define _cffi_call_python \ - ((void(*)(struct _cffi_callpy_s *, char *))_cffi_exports[25]) + ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[25]) #define _CFFI_NUM_EXPORTS 26 typedef struct _ctypedescr CTypeDescrObject; @@ -206,7 +206,7 @@ /********** end CPython-specific section **********/ #else _CFFI_UNUSED_FN -static void (*_cffi_call_python)(struct _cffi_callpy_s *, char *); +static void (*_cffi_call_python)(struct _cffi_externpy_s *, char *); #endif diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -27,7 +27,7 @@ #define _CFFI_OP_DLOPEN_FUNC 35 #define _CFFI_OP_DLOPEN_CONST 37 #define _CFFI_OP_GLOBAL_VAR_F 39 -#define _CFFI_OP_CALL_PYTHON 41 +#define _CFFI_OP_EXTERN_PYTHON 41 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -161,7 +161,7 @@ const char *error_message; }; -struct _cffi_callpy_s { +struct _cffi_externpy_s { const char *name; size_t size_of_result; void *reserved1, *reserved2; diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -118,7 +118,7 @@ class Recompiler: - _num_callpy = 0 + _num_externpy = 0 def __init__(self, ffi, module_name, target_is_python=False): self.ffi = ffi @@ -358,8 +358,8 @@ prnt(' NULL, /* no includes */') prnt(' %d, /* num_types */' % (len(self.cffi_types),)) flags = 0 - if self._num_callpy: - flags |= 1 # set to mean "uses _cffi_call_python" + if self._num_externpy: + flags |= 1 # set to mean that we use extern "Python" prnt(' %d, /* flags */' % flags) prnt('};') prnt() @@ -370,10 +370,11 @@ prnt('PyMODINIT_FUNC') prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) prnt('{') - prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') - prnt(' _cffi_call_python = (void(*)(struct _cffi_callpy_s *, ' - 'char *))p[1];') - prnt(' }') + if self._num_externpy: + prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') + prnt(' _cffi_call_python = ' + '(void(*)(struct _cffi_externpy_s *, char *))p[1];') + prnt(' }') prnt(' p[0] = (const void *)%s;' % VERSION) prnt(' p[1] = &_cffi_type_context;') prnt('}') @@ -1116,13 +1117,13 @@ GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index))) # ---------- - # CFFI_CALL_PYTHON + # extern "Python" - def _generate_cpy_call_python_collecttype(self, tp, name): + def _generate_cpy_extern_python_collecttype(self, tp, name): assert isinstance(tp, model.FunctionPtrType) self._do_collect_type(tp) - def _generate_cpy_call_python_decl(self, tp, name): + def _generate_cpy_extern_python_decl(self, tp, name): prnt = self._prnt if isinstance(tp.result, model.VoidType): size_of_result = '0' @@ -1130,7 +1131,7 @@ context = 'result of %s' % name size_of_result = '(int)sizeof(%s)' % ( tp.result.get_c_name('', context),) - prnt('static struct _cffi_callpy_s _cffi_callpy__%s =' % name) + prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name) prnt(' { "%s", %s };' % (name, size_of_result)) prnt() # @@ -1166,23 +1167,23 @@ arg = '&' + arg type = model.PointerType(type) prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) - prnt(' _cffi_call_python(&_cffi_callpy__%s, p);' % name) + prnt(' _cffi_call_python(&_cffi_externpy__%s, p);' % name) if not isinstance(tp.result, model.VoidType): prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) prnt('}') prnt() - self._num_callpy += 1 + self._num_externpy += 1 - def _generate_cpy_call_python_ctx(self, tp, name): + def _generate_cpy_extern_python_ctx(self, tp, name): if self.target_is_python: raise ffiplatform.VerificationError( - "cannot use CFFI_CALL_PYTHON in the ABI mode") + "cannot use 'extern \"Python\"' in the ABI mode") if tp.ellipsis: - raise NotImplementedError("CFFI_CALL_PYTHON with a vararg function") + raise NotImplementedError("a vararg function is extern \"Python\"") type_index = self._typesdict[tp] - type_op = CffiOp(OP_CALL_PYTHON, type_index) + type_op = CffiOp(OP_EXTERN_PYTHON, type_index) self._lsts["global"].append( - GlobalExpr(name, '&_cffi_callpy__%s' % name, type_op, name)) + GlobalExpr(name, '&_cffi_externpy__%s' % name, type_op, name)) # ---------- # emitting the opcodes for individual types diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1494,24 +1494,26 @@ def __exit__(self, *args): sys.stderr = self.old_stderr -def test_call_python_1(): +def test_extern_python_1(): ffi = FFI() ffi.cdef(""" - CFFI_CALL_PYTHON int bar(int, int); - CFFI_CALL_PYTHON void baz(int, int); - CFFI_CALL_PYTHON int bok(void); - CFFI_CALL_PYTHON void boz(void); + extern "Python" { + int bar(int, int); + void baz(int, int); + int bok(void); + void boz(void); + } """) - lib = verify(ffi, 'test_call_python_1', "") + lib = verify(ffi, 'test_extern_python_1', "") assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") with StdErrCapture() as f: res = lib.bar(4, 5) assert res == 0 assert f.getvalue() == ( - "CFFI_CALL_PYTHON: function bar() called, but no code was attached " - "to it yet with ffi.call_python('bar'). Returning 0.\n") + "extern \"Python\": function bar() called, but no code was attached " + "to it yet with @ffi.def_extern(). Returning 0.\n") - @ffi.call_python("bar") + @ffi.def_extern("bar") def my_bar(x, y): seen.append(("Bar", x, y)) return x * y @@ -1521,7 +1523,7 @@ assert seen == [("Bar", 6, 7)] assert res == 42 - @ffi.call_python() + @ffi.def_extern() def baz(x, y): seen.append(("Baz", x, y)) seen = [] @@ -1531,53 +1533,53 @@ assert type(seen[0][1]) is type(seen[0][2]) is int assert baz == lib.baz - @ffi.call_python(name="bok") - def bok(): + @ffi.def_extern(name="bok") + def bokk(): seen.append("Bok") return 42 seen = [] - assert lib.bok() == bok() == 42 + assert lib.bok() == bokk() == 42 assert seen == ["Bok", "Bok"] - @ffi.call_python() + @ffi.def_extern() def boz(): seen.append("Boz") seen = [] assert lib.boz() is boz() is None assert seen == ["Boz", "Boz"] -def test_call_python_bogus_name(): +def test_extern_python_bogus_name(): ffi = FFI() ffi.cdef("int abc;") - lib = verify(ffi, 'test_call_python_bogus_name', "int abc;") + lib = verify(ffi, 'test_extern_python_bogus_name', "int abc;") def fn(): pass - py.test.raises(ffi.error, ffi.call_python("unknown_name"), fn) - py.test.raises(ffi.error, ffi.call_python("abc"), fn) + py.test.raises(ffi.error, ffi.def_extern("unknown_name"), fn) + py.test.raises(ffi.error, ffi.def_extern("abc"), fn) assert lib.abc == 0 - e = py.test.raises(ffi.error, ffi.call_python("abc"), fn) - assert str(e.value) == ("ffi.call_python('abc'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef") - e = py.test.raises(ffi.error, ffi.call_python(), fn) - assert str(e.value) == ("ffi.call_python('fn'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef") + e = py.test.raises(ffi.error, ffi.def_extern("abc"), fn) + assert str(e.value) == ("ffi.def_extern('abc'): no 'extern \"Python\"' " + "function with this name") + e = py.test.raises(ffi.error, ffi.def_extern(), fn) + assert str(e.value) == ("ffi.def_extern('fn'): no 'extern \"Python\"' " + "function with this name") # - py.test.raises(TypeError, ffi.call_python(42), fn) - py.test.raises((TypeError, AttributeError), ffi.call_python(), "foo") + py.test.raises(TypeError, ffi.def_extern(42), fn) + py.test.raises((TypeError, AttributeError), ffi.def_extern(), "foo") class X: pass x = X() x.__name__ = x - py.test.raises(TypeError, ffi.call_python(), x) + py.test.raises(TypeError, ffi.def_extern(), x) -def test_call_python_bogus_result_type(): +def test_extern_python_bogus_result_type(): ffi = FFI() - ffi.cdef("CFFI_CALL_PYTHON void bar(int);") - lib = verify(ffi, 'test_call_python_bogus_result_type', "") + ffi.cdef("""extern "Python" void bar(int);""") + lib = verify(ffi, 'test_extern_python_bogus_result_type', "") # def bar(n): return n * 10 - bar1 = ffi.call_python()(bar) + bar1 = ffi.def_extern()(bar) with StdErrCapture() as f: res = bar1(321) assert res is None @@ -1586,39 +1588,39 @@ "Trying to convert the result back to C:\n" "TypeError: callback with the return type 'void' must return None\n") -def test_call_python_redefine(): +def test_extern_python_redefine(): ffi = FFI() - ffi.cdef("CFFI_CALL_PYTHON int bar(int);") - lib = verify(ffi, 'test_call_python_redefine', "") + ffi.cdef("""extern "Python" int bar(int);""") + lib = verify(ffi, 'test_extern_python_redefine', "") # - @ffi.call_python() + @ffi.def_extern() def bar(n): return n * 10 assert lib.bar(42) == 420 # - @ffi.call_python() + @ffi.def_extern() def bar(n): return -n assert lib.bar(42) == -42 -def test_call_python_struct(): +def test_extern_python_struct(): ffi = FFI() ffi.cdef(""" struct foo_s { int a, b, c; }; - CFFI_CALL_PYTHON int bar(int, struct foo_s, int); - CFFI_CALL_PYTHON struct foo_s baz(int, int); - CFFI_CALL_PYTHON struct foo_s bok(void); + extern "Python" int bar(int, struct foo_s, int); + extern "Python" { struct foo_s baz(int, int); + struct foo_s bok(void); } """) - lib = verify(ffi, 'test_call_python_struct', + lib = verify(ffi, 'test_extern_python_struct', "struct foo_s { int a, b, c; };") # - @ffi.call_python() + @ffi.def_extern() def bar(x, s, z): return x + s.a + s.b + s.c + z res = lib.bar(1000, [1001, 1002, 1004], 1008) assert res == 5015 # - @ffi.call_python() + @ffi.def_extern() def baz(x, y): return [x + y, x - y, x * y] res = lib.baz(1000, 42) @@ -1626,22 +1628,22 @@ assert res.b == 958 assert res.c == 42000 # - @ffi.call_python() + @ffi.def_extern() def bok(): return [10, 20, 30] res = lib.bok() assert [res.a, res.b, res.c] == [10, 20, 30] -def test_call_python_long_double(): +def test_extern_python_long_double(): ffi = FFI() ffi.cdef(""" - CFFI_CALL_PYTHON int bar(int, long double, int); - CFFI_CALL_PYTHON long double baz(int, int); - CFFI_CALL_PYTHON long double bok(void); + extern "Python" int bar(int, long double, int); + extern "Python" long double baz(int, int); + extern "Python" long double bok(void); """) - lib = verify(ffi, 'test_call_python_long_double', "") + lib = verify(ffi, 'test_extern_python_long_double', "") # - @ffi.call_python() + @ffi.def_extern() def bar(x, l, z): seen.append((x, l, z)) return 6 @@ -1650,42 +1652,42 @@ expected = ffi.cast("long double", 3.5) assert repr(seen) == repr([(10, expected, 20)]) # - @ffi.call_python() + @ffi.def_extern() def baz(x, z): assert x == 10 and z == 20 return expected res = lib.baz(10, 20) assert repr(res) == repr(expected) # - @ffi.call_python() + @ffi.def_extern() def bok(): return expected res = lib.bok() assert repr(res) == repr(expected) -def test_call_python_signature(): +def test_extern_python_signature(): ffi = FFI() - lib = verify(ffi, 'test_call_python_signature', "") - py.test.raises(TypeError, ffi.call_python(425), None) - py.test.raises(TypeError, ffi.call_python, 'a', 'b', 'c', 'd') + lib = verify(ffi, 'test_extern_python_signature', "") + py.test.raises(TypeError, ffi.def_extern(425), None) + py.test.raises(TypeError, ffi.def_extern, 'a', 'b', 'c', 'd') -def test_call_python_errors(): +def test_extern_python_errors(): ffi = FFI() ffi.cdef(""" - CFFI_CALL_PYTHON int bar(int); + extern "Python" int bar(int); """) - lib = verify(ffi, 'test_call_python_errors', "") + lib = verify(ffi, 'test_extern_python_errors', "") seen = [] def oops(*args): seen.append(args) - @ffi.call_python(onerror=oops) + @ffi.def_extern(onerror=oops) def bar(x): return x + "" assert bar(10) == 0 - @ffi.call_python(name="bar", onerror=oops, error=-66) + @ffi.def_extern(name="bar", onerror=oops, error=-66) def bar2(x): return x + "" assert bar(10) == -66 @@ -1701,5 +1703,5 @@ assert tb.tb_frame.f_code.co_name == "bar2" # # a case where 'onerror' is not callable - py.test.raises(TypeError, ffi.call_python(name='bar', onerror=42), + py.test.raises(TypeError, ffi.def_extern(name='bar', onerror=42), lambda x: x) From noreply at buildbot.pypy.org Wed Nov 18 04:10:23 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 10:10:23 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: fix imports Message-ID: <20151118091023.6D73D1C0ECB@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80749:4c362a658da5 Date: 2015-11-18 10:01 +0100 http://bitbucket.org/pypy/pypy/changeset/4c362a658da5/ Log: fix imports diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py --- a/rpython/rlib/rstruct/nativefmttable.py +++ b/rpython/rlib/rstruct/nativefmttable.py @@ -11,7 +11,7 @@ from rpython.rlib.rstruct.standardfmttable import native_is_bigendian from rpython.rlib.rstruct.error import StructError from rpython.rlib.unroll import unrolling_iterable -from rpython.rlib.rawstorage import str_storage_getitem +from rpython.rlib.strstorage import str_storage_getitem from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.tool import rffi_platform from rpython.translator.tool.cbuild import ExternalCompilationInfo diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py --- a/rpython/rlib/rstruct/standardfmttable.py +++ b/rpython/rlib/rstruct/standardfmttable.py @@ -12,7 +12,7 @@ from rpython.rlib.rstruct import ieee from rpython.rlib.rstruct.error import StructError, StructOverflowError from rpython.rlib.unroll import unrolling_iterable -from rpython.rlib.rawstorage import str_storage_getitem +from rpython.rlib.strstorage import str_storage_getitem from rpython.rlib import rarithmetic from rpython.rtyper.lltypesystem import rffi From noreply at buildbot.pypy.org Wed Nov 18 05:04:53 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 11:04:53 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: update to cffi/4a750b4d4bfa Message-ID: <20151118100453.9D5F41C0400@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80750:f727b3445c49 Date: 2015-11-18 10:03 +0100 http://bitbucket.org/pypy/pypy/changeset/f727b3445c49/ Log: update to cffi/4a750b4d4bfa diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h --- a/lib_pypy/cffi/_cffi_include.h +++ b/lib_pypy/cffi/_cffi_include.h @@ -147,7 +147,7 @@ #define _cffi_convert_array_from_object \ ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) #define _cffi_call_python \ - ((void(*)(struct _cffi_callpy_s *, char *))_cffi_exports[25]) + ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[25]) #define _CFFI_NUM_EXPORTS 26 typedef struct _ctypedescr CTypeDescrObject; @@ -206,7 +206,7 @@ /********** end CPython-specific section **********/ #else _CFFI_UNUSED_FN -static void (*_cffi_call_python)(struct _cffi_callpy_s *, char *); +static void (*_cffi_call_python)(struct _cffi_externpy_s *, char *); #endif diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py --- a/lib_pypy/cffi/cffi_opcode.py +++ b/lib_pypy/cffi/cffi_opcode.py @@ -54,7 +54,7 @@ OP_DLOPEN_FUNC = 35 OP_DLOPEN_CONST = 37 OP_GLOBAL_VAR_F = 39 -OP_CALL_PYTHON = 41 +OP_EXTERN_PYTHON = 41 PRIM_VOID = 0 PRIM_BOOL = 1 diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -29,7 +29,7 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") -_r_cffi_call_python = re.compile(r"\bCFFI_CALL_PYTHON\b") +_r_extern_python = re.compile(r'\bextern\s*"Python"\s*.') _r_star_const_space = re.compile( # matches "* const " r"[*]\s*((const|volatile|restrict)\b\s*)+") @@ -81,6 +81,47 @@ parts.append(csource) return ''.join(parts) +def _preprocess_extern_python(csource): + # input: `extern "Python" int foo(int);` or + # `extern "Python" { int foo(int); }` + # output: + # void __cffi_extern_python_start; + # int foo(int); + # void __cffi_extern_python_stop; + parts = [] + while True: + match = _r_extern_python.search(csource) + if not match: + break + endpos = match.end() - 1 + #print + #print ''.join(parts)+csource + #print '=>' + parts.append(csource[:match.start()]) + parts.append('void __cffi_extern_python_start; ') + if csource[endpos] == '{': + # grouping variant + closing = csource.find('}', endpos) + if closing < 0: + raise api.CDefError("'extern \"Python\" {': no '}' found") + if csource.find('{', endpos + 1, closing) >= 0: + raise NotImplementedError("cannot use { } inside a block " + "'extern \"Python\" { ... }'") + parts.append(csource[endpos+1:closing]) + csource = csource[closing+1:] + else: + # non-grouping variant + semicolon = csource.find(';', endpos) + if semicolon < 0: + raise api.CDefError("'extern \"Python\": no ';' found") + parts.append(csource[endpos:semicolon+1]) + csource = csource[semicolon+1:] + parts.append(' void __cffi_extern_python_stop;') + #print ''.join(parts)+csource + #print + parts.append(csource) + return ''.join(parts) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -105,8 +146,8 @@ csource = _r_stdcall1.sub(' volatile volatile const ', csource) csource = _r_cdecl.sub(' ', csource) # - # Replace "CFFI_CALL_PYTHON" with "void CFFI_CALL_PYTHON;" - csource = _r_cffi_call_python.sub('void CFFI_CALL_PYTHON;', csource) + # Replace `extern "Python"` with start/end markers + csource = _preprocess_extern_python(csource) # # Replace "[...]" with "[__dotdotdotarray__]" csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) @@ -263,9 +304,8 @@ break # try: - self._found_cffi_call_python = False + self._inside_extern_python = False for decl in iterator: - old_cffi_call_python = self._found_cffi_call_python if isinstance(decl, pycparser.c_ast.Decl): self._parse_decl(decl) elif isinstance(decl, pycparser.c_ast.Typedef): @@ -288,8 +328,6 @@ self._declare('typedef ' + decl.name, realtype, quals=quals) else: raise api.CDefError("unrecognized construct", decl) - if old_cffi_call_python and self._found_cffi_call_python: - raise api.CDefError("CFFI_CALL_PYTHON misplaced") except api.FFIError as e: msg = self._convert_pycparser_error(e, csource) if msg: @@ -338,9 +376,8 @@ def _declare_function(self, tp, quals, decl): tp = self._get_type_pointer(tp, quals) - if self._found_cffi_call_python: - self._declare('call_python ' + decl.name, tp) - self._found_cffi_call_python = False + if self._inside_extern_python: + self._declare('extern_python ' + decl.name, tp) else: self._declare('function ' + decl.name, tp) @@ -378,15 +415,23 @@ _r_int_literal.match(decl.init.expr.value)): self._add_integer_constant(decl.name, '-' + decl.init.expr.value) - elif tp is model.void_type and decl.name == 'CFFI_CALL_PYTHON': - # hack: "CFFI_CALL_PYTHON" in the C source is replaced - # with "void CFFI_CALL_PYTHON;", which when parsed arrives - # at this point and sets this flag: - self._found_cffi_call_python = True - elif (quals & model.Q_CONST) and not tp.is_array_type: - self._declare('constant ' + decl.name, tp, quals=quals) + elif (tp is model.void_type and + decl.name.startswith('__cffi_extern_python_')): + # hack: `extern "Python"` in the C source is replaced + # with "void __cffi_extern_python_start;" and + # "void __cffi_extern_python_stop;" + self._inside_extern_python = not self._inside_extern_python + assert self._inside_extern_python == ( + decl.name == '__cffi_extern_python_start') else: - self._declare('variable ' + decl.name, tp, quals=quals) + if self._inside_extern_python: + raise api.CDefError( + "cannot declare constants or " + "variables with 'extern \"Python\"'") + if (quals & model.Q_CONST) and not tp.is_array_type: + self._declare('constant ' + decl.name, tp, quals=quals) + else: + self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): return self.parse_type_and_quals(cdecl)[0] diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -27,7 +27,7 @@ #define _CFFI_OP_DLOPEN_FUNC 35 #define _CFFI_OP_DLOPEN_CONST 37 #define _CFFI_OP_GLOBAL_VAR_F 39 -#define _CFFI_OP_CALL_PYTHON 41 +#define _CFFI_OP_EXTERN_PYTHON 41 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -161,7 +161,7 @@ const char *error_message; }; -struct _cffi_callpy_s { +struct _cffi_externpy_s { const char *name; size_t size_of_result; void *reserved1, *reserved2; diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py --- a/lib_pypy/cffi/recompiler.py +++ b/lib_pypy/cffi/recompiler.py @@ -118,7 +118,7 @@ class Recompiler: - _num_callpy = 0 + _num_externpy = 0 def __init__(self, ffi, module_name, target_is_python=False): self.ffi = ffi @@ -358,8 +358,8 @@ prnt(' NULL, /* no includes */') prnt(' %d, /* num_types */' % (len(self.cffi_types),)) flags = 0 - if self._num_callpy: - flags |= 1 # set to mean "uses _cffi_call_python" + if self._num_externpy: + flags |= 1 # set to mean that we use extern "Python" prnt(' %d, /* flags */' % flags) prnt('};') prnt() @@ -370,10 +370,11 @@ prnt('PyMODINIT_FUNC') prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) prnt('{') - prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') - prnt(' _cffi_call_python = (void(*)(struct _cffi_callpy_s *, ' - 'char *))p[1];') - prnt(' }') + if self._num_externpy: + prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') + prnt(' _cffi_call_python = ' + '(void(*)(struct _cffi_externpy_s *, char *))p[1];') + prnt(' }') prnt(' p[0] = (const void *)%s;' % VERSION) prnt(' p[1] = &_cffi_type_context;') prnt('}') @@ -1116,13 +1117,13 @@ GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index))) # ---------- - # CFFI_CALL_PYTHON + # extern "Python" - def _generate_cpy_call_python_collecttype(self, tp, name): + def _generate_cpy_extern_python_collecttype(self, tp, name): assert isinstance(tp, model.FunctionPtrType) self._do_collect_type(tp) - def _generate_cpy_call_python_decl(self, tp, name): + def _generate_cpy_extern_python_decl(self, tp, name): prnt = self._prnt if isinstance(tp.result, model.VoidType): size_of_result = '0' @@ -1130,7 +1131,7 @@ context = 'result of %s' % name size_of_result = '(int)sizeof(%s)' % ( tp.result.get_c_name('', context),) - prnt('static struct _cffi_callpy_s _cffi_callpy__%s =' % name) + prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name) prnt(' { "%s", %s };' % (name, size_of_result)) prnt() # @@ -1166,23 +1167,23 @@ arg = '&' + arg type = model.PointerType(type) prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) - prnt(' _cffi_call_python(&_cffi_callpy__%s, p);' % name) + prnt(' _cffi_call_python(&_cffi_externpy__%s, p);' % name) if not isinstance(tp.result, model.VoidType): prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) prnt('}') prnt() - self._num_callpy += 1 + self._num_externpy += 1 - def _generate_cpy_call_python_ctx(self, tp, name): + def _generate_cpy_extern_python_ctx(self, tp, name): if self.target_is_python: raise ffiplatform.VerificationError( - "cannot use CFFI_CALL_PYTHON in the ABI mode") + "cannot use 'extern \"Python\"' in the ABI mode") if tp.ellipsis: - raise NotImplementedError("CFFI_CALL_PYTHON with a vararg function") + raise NotImplementedError("a vararg function is extern \"Python\"") type_index = self._typesdict[tp] - type_op = CffiOp(OP_CALL_PYTHON, type_index) + type_op = CffiOp(OP_EXTERN_PYTHON, type_index) self._lsts["global"].append( - GlobalExpr(name, '&_cffi_callpy__%s' % name, type_op, name)) + GlobalExpr(name, '&_cffi_externpy__%s' % name, type_op, name)) # ---------- # emitting the opcodes for individual types diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py @@ -407,16 +407,30 @@ "long(*)(), " "short(%s*)(short))'>" % (stdcall, stdcall)) -def test_CFFI_CALL_PYTHON(): +def test_extern_python(): ffi = FFI() ffi.cdef(""" + int bok(int, int); + extern "Python" int foobar(int, int); int baz(int, int); - CFFI_CALL_PYTHON int foobar(int, int); """) - assert 'variable CFFI_CALL_PYTHON' not in ffi._parser._declarations - assert 'function baz' in ffi._parser._declarations - assert 'call_python baz' not in ffi._parser._declarations - assert 'function foobar' not in ffi._parser._declarations - assert 'call_python foobar' in ffi._parser._declarations + assert sorted(ffi._parser._declarations) == [ + 'extern_python foobar', 'function baz', 'function bok'] + assert (ffi._parser._declarations['function bok'] == + ffi._parser._declarations['extern_python foobar'] == + ffi._parser._declarations['function baz']) + +def test_extern_python_group(): + ffi = FFI() + ffi.cdef(""" + int bok(int); + extern "Python" {int foobar(int, int);int bzrrr(int);} + int baz(int, int); + """) + assert sorted(ffi._parser._declarations) == [ + 'extern_python bzrrr', 'extern_python foobar', + 'function baz', 'function bok'] assert (ffi._parser._declarations['function baz'] == - ffi._parser._declarations['call_python foobar']) + ffi._parser._declarations['extern_python foobar'] != + ffi._parser._declarations['function bok'] == + ffi._parser._declarations['extern_python bzrrr']) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py @@ -1495,24 +1495,26 @@ def __exit__(self, *args): sys.stderr = self.old_stderr -def test_call_python_1(): +def test_extern_python_1(): ffi = FFI() ffi.cdef(""" - CFFI_CALL_PYTHON int bar(int, int); - CFFI_CALL_PYTHON void baz(int, int); - CFFI_CALL_PYTHON int bok(void); - CFFI_CALL_PYTHON void boz(void); + extern "Python" { + int bar(int, int); + void baz(int, int); + int bok(void); + void boz(void); + } """) - lib = verify(ffi, 'test_call_python_1', "") + lib = verify(ffi, 'test_extern_python_1', "") assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") with StdErrCapture() as f: res = lib.bar(4, 5) assert res == 0 assert f.getvalue() == ( - "CFFI_CALL_PYTHON: function bar() called, but no code was attached " - "to it yet with ffi.call_python('bar'). Returning 0.\n") + "extern \"Python\": function bar() called, but no code was attached " + "to it yet with @ffi.def_extern(). Returning 0.\n") - @ffi.call_python("bar") + @ffi.def_extern("bar") def my_bar(x, y): seen.append(("Bar", x, y)) return x * y @@ -1522,7 +1524,7 @@ assert seen == [("Bar", 6, 7)] assert res == 42 - @ffi.call_python() + @ffi.def_extern() def baz(x, y): seen.append(("Baz", x, y)) seen = [] @@ -1532,53 +1534,53 @@ assert type(seen[0][1]) is type(seen[0][2]) is int assert baz == lib.baz - @ffi.call_python(name="bok") - def bok(): + @ffi.def_extern(name="bok") + def bokk(): seen.append("Bok") return 42 seen = [] - assert lib.bok() == bok() == 42 + assert lib.bok() == bokk() == 42 assert seen == ["Bok", "Bok"] - @ffi.call_python() + @ffi.def_extern() def boz(): seen.append("Boz") seen = [] assert lib.boz() is boz() is None assert seen == ["Boz", "Boz"] -def test_call_python_bogus_name(): +def test_extern_python_bogus_name(): ffi = FFI() ffi.cdef("int abc;") - lib = verify(ffi, 'test_call_python_bogus_name', "int abc;") + lib = verify(ffi, 'test_extern_python_bogus_name', "int abc;") def fn(): pass - py.test.raises(ffi.error, ffi.call_python("unknown_name"), fn) - py.test.raises(ffi.error, ffi.call_python("abc"), fn) + py.test.raises(ffi.error, ffi.def_extern("unknown_name"), fn) + py.test.raises(ffi.error, ffi.def_extern("abc"), fn) assert lib.abc == 0 - e = py.test.raises(ffi.error, ffi.call_python("abc"), fn) - assert str(e.value) == ("ffi.call_python('abc'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef") - e = py.test.raises(ffi.error, ffi.call_python(), fn) - assert str(e.value) == ("ffi.call_python('fn'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef") + e = py.test.raises(ffi.error, ffi.def_extern("abc"), fn) + assert str(e.value) == ("ffi.def_extern('abc'): no 'extern \"Python\"' " + "function with this name") + e = py.test.raises(ffi.error, ffi.def_extern(), fn) + assert str(e.value) == ("ffi.def_extern('fn'): no 'extern \"Python\"' " + "function with this name") # - py.test.raises(TypeError, ffi.call_python(42), fn) - py.test.raises((TypeError, AttributeError), ffi.call_python(), "foo") + py.test.raises(TypeError, ffi.def_extern(42), fn) + py.test.raises((TypeError, AttributeError), ffi.def_extern(), "foo") class X: pass x = X() x.__name__ = x - py.test.raises(TypeError, ffi.call_python(), x) + py.test.raises(TypeError, ffi.def_extern(), x) -def test_call_python_bogus_result_type(): +def test_extern_python_bogus_result_type(): ffi = FFI() - ffi.cdef("CFFI_CALL_PYTHON void bar(int);") - lib = verify(ffi, 'test_call_python_bogus_result_type', "") + ffi.cdef("""extern "Python" void bar(int);""") + lib = verify(ffi, 'test_extern_python_bogus_result_type', "") # def bar(n): return n * 10 - bar1 = ffi.call_python()(bar) + bar1 = ffi.def_extern()(bar) with StdErrCapture() as f: res = bar1(321) assert res is None @@ -1587,39 +1589,39 @@ "Trying to convert the result back to C:\n" "TypeError: callback with the return type 'void' must return None\n") -def test_call_python_redefine(): +def test_extern_python_redefine(): ffi = FFI() - ffi.cdef("CFFI_CALL_PYTHON int bar(int);") - lib = verify(ffi, 'test_call_python_redefine', "") + ffi.cdef("""extern "Python" int bar(int);""") + lib = verify(ffi, 'test_extern_python_redefine', "") # - @ffi.call_python() + @ffi.def_extern() def bar(n): return n * 10 assert lib.bar(42) == 420 # - @ffi.call_python() + @ffi.def_extern() def bar(n): return -n assert lib.bar(42) == -42 -def test_call_python_struct(): +def test_extern_python_struct(): ffi = FFI() ffi.cdef(""" struct foo_s { int a, b, c; }; - CFFI_CALL_PYTHON int bar(int, struct foo_s, int); - CFFI_CALL_PYTHON struct foo_s baz(int, int); - CFFI_CALL_PYTHON struct foo_s bok(void); + extern "Python" int bar(int, struct foo_s, int); + extern "Python" { struct foo_s baz(int, int); + struct foo_s bok(void); } """) - lib = verify(ffi, 'test_call_python_struct', + lib = verify(ffi, 'test_extern_python_struct', "struct foo_s { int a, b, c; };") # - @ffi.call_python() + @ffi.def_extern() def bar(x, s, z): return x + s.a + s.b + s.c + z res = lib.bar(1000, [1001, 1002, 1004], 1008) assert res == 5015 # - @ffi.call_python() + @ffi.def_extern() def baz(x, y): return [x + y, x - y, x * y] res = lib.baz(1000, 42) @@ -1627,22 +1629,22 @@ assert res.b == 958 assert res.c == 42000 # - @ffi.call_python() + @ffi.def_extern() def bok(): return [10, 20, 30] res = lib.bok() assert [res.a, res.b, res.c] == [10, 20, 30] -def test_call_python_long_double(): +def test_extern_python_long_double(): ffi = FFI() ffi.cdef(""" - CFFI_CALL_PYTHON int bar(int, long double, int); - CFFI_CALL_PYTHON long double baz(int, int); - CFFI_CALL_PYTHON long double bok(void); + extern "Python" int bar(int, long double, int); + extern "Python" long double baz(int, int); + extern "Python" long double bok(void); """) - lib = verify(ffi, 'test_call_python_long_double', "") + lib = verify(ffi, 'test_extern_python_long_double', "") # - @ffi.call_python() + @ffi.def_extern() def bar(x, l, z): seen.append((x, l, z)) return 6 @@ -1651,42 +1653,42 @@ expected = ffi.cast("long double", 3.5) assert repr(seen) == repr([(10, expected, 20)]) # - @ffi.call_python() + @ffi.def_extern() def baz(x, z): assert x == 10 and z == 20 return expected res = lib.baz(10, 20) assert repr(res) == repr(expected) # - @ffi.call_python() + @ffi.def_extern() def bok(): return expected res = lib.bok() assert repr(res) == repr(expected) -def test_call_python_signature(): +def test_extern_python_signature(): ffi = FFI() - lib = verify(ffi, 'test_call_python_signature', "") - py.test.raises(TypeError, ffi.call_python(425), None) - py.test.raises(TypeError, ffi.call_python, 'a', 'b', 'c', 'd') + lib = verify(ffi, 'test_extern_python_signature', "") + py.test.raises(TypeError, ffi.def_extern(425), None) + py.test.raises(TypeError, ffi.def_extern, 'a', 'b', 'c', 'd') -def test_call_python_errors(): +def test_extern_python_errors(): ffi = FFI() ffi.cdef(""" - CFFI_CALL_PYTHON int bar(int); + extern "Python" int bar(int); """) - lib = verify(ffi, 'test_call_python_errors', "") + lib = verify(ffi, 'test_extern_python_errors', "") seen = [] def oops(*args): seen.append(args) - @ffi.call_python(onerror=oops) + @ffi.def_extern(onerror=oops) def bar(x): return x + "" assert bar(10) == 0 - @ffi.call_python(name="bar", onerror=oops, error=-66) + @ffi.def_extern(name="bar", onerror=oops, error=-66) def bar2(x): return x + "" assert bar(10) == -66 @@ -1702,5 +1704,5 @@ assert tb.tb_frame.f_code.co_name == "bar2" # # a case where 'onerror' is not callable - py.test.raises(TypeError, ffi.call_python(name='bar', onerror=42), + py.test.raises(TypeError, ffi.def_extern(name='bar', onerror=42), lambda x: x) From noreply at buildbot.pypy.org Wed Nov 18 05:04:55 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 11:04:55 +0100 (CET) Subject: [pypy-commit] pypy cffi-static-callback: update to the 'extern "Python"' style Message-ID: <20151118100455.A6CD11C0400@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: cffi-static-callback Changeset: r80751:c9f979361cde Date: 2015-11-18 11:05 +0100 http://bitbucket.org/pypy/pypy/changeset/c9f979361cde/ Log: update to the 'extern "Python"' style diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py --- a/pypy/module/_cffi_backend/call_python.py +++ b/pypy/module/_cffi_backend/call_python.py @@ -16,18 +16,18 @@ STDERR = 2 -CALLPY_FN = lltype.FuncType([parse_c_type.PCALLPY, rffi.CCHARP], - lltype.Void) +EXTERNPY_FN = lltype.FuncType([parse_c_type.PEXTERNPY, rffi.CCHARP], + lltype.Void) -def _cffi_call_python(ll_callpy, ll_args): - """Invoked by the helpers generated from CFFI_CALL_PYTHON in the cdef. +def _cffi_call_python(ll_externpy, ll_args): + """Invoked by the helpers generated from extern "Python" in the cdef. - 'callpy' is a static structure that describes which of the - CFFI_CALL_PYTHON is called. It has got fields 'name' and + 'externpy' is a static structure that describes which of the + extern "Python" functions is called. It has got fields 'name' and 'type_index' describing the function, and more reserved fields that are initially zero. These reserved fields are set up by - ffi.call_python(), which invokes init_call_python() below. + ffi.def_extern(), which invokes externpy_deco() below. 'args' is a pointer to an array of 8-byte entries. Each entry contains an argument. If an argument is less than 8 bytes, only @@ -35,8 +35,9 @@ argument is 'long double' or a struct/union, then it is passed by reference. - 'args' is also used as the place to write the result to. In all - cases, 'args' is at least 8 bytes in size. + 'args' is also used as the place to write the result to + (directly, even if more than 8 bytes). In all cases, 'args' is + at least 8 bytes in size. """ from pypy.module._cffi_backend.ccallback import reveal_callback @@ -48,25 +49,25 @@ cerrno._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) - if not ll_callpy.c_reserved1: + if not ll_externpy.c_reserved1: # Not initialized! We don't have a space at all, so just # write the error to the file descriptor stderr. (xxx cpython's # cffi writes it to sys.stderr) try: - funcname = rffi.charp2str(ll_callpy.c_name) - msg = ("CFFI_CALL_PYTHON: function %s() called, but no code was " - "attached to it yet with ffi.call_python('%s'). " - "Returning 0.\n" % (funcname, funcname)) + funcname = rffi.charp2str(ll_externpy.c_name) + msg = ("extern \"Python\": function %s() called, but no code was " + "attached to it yet with @ffi.def_extern(). " + "Returning 0.\n" % (funcname,)) os.write(STDERR, msg) except: pass - for i in range(intmask(ll_callpy.c_size_of_result)): + for i in range(intmask(ll_externpy.c_size_of_result)): ll_args[i] = '\x00' else: - callpython = reveal_callback(ll_callpy.c_reserved1) + externpython = reveal_callback(ll_externpy.c_reserved1) # the same buffer is used both for passing arguments and # the result value - callpython.invoke(ll_args, ll_args) + externpython.invoke(ll_args, ll_args) cerrno._errno_before(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) @@ -77,7 +78,7 @@ def get_ll_cffi_call_python(): - return llhelper(lltype.Ptr(CALLPY_FN), _cffi_call_python) + return llhelper(lltype.Ptr(EXTERNPY_FN), _cffi_call_python) class KeepaliveCache: @@ -86,9 +87,9 @@ @jit.dont_look_inside -def callpy_deco(space, w_ffi, w_python_callable, w_name, w_error, w_onerror): +def externpy_deco(space, w_ffi, w_python_callable, w_name, w_error, w_onerror): from pypy.module._cffi_backend.ffi_obj import W_FFIObject - from pypy.module._cffi_backend.ccallback import W_CallPython + from pypy.module._cffi_backend.ccallback import W_ExternPython ffi = space.interp_w(W_FFIObject, w_ffi) @@ -99,27 +100,28 @@ ctx = ffi.ctxobj.ctx index = parse_c_type.search_in_globals(ctx, name) if index < 0: - raise callpy_not_found(ffi, name) + raise externpy_not_found(ffi, name) g = ctx.c_globals[index] - if getop(g.c_type_op) != cffi_opcode.OP_CALL_PYTHON: - raise callpy_not_found(ffi, name) + if getop(g.c_type_op) != cffi_opcode.OP_EXTERN_PYTHON: + raise externpy_not_found(ffi, name) w_ct = realize_c_type.realize_c_type(ffi, ctx.c_types, getarg(g.c_type_op)) - # make a W_CallPython instance, which is nonmovable; then cast it + # make a W_ExternPython instance, which is nonmovable; then cast it # to a raw pointer and assign it to the field 'reserved1' of the - # callpy object from C. We must make sure to keep it alive forever, - # or at least until ffi.call_python() is used again to change the - # binding. Note that the W_CallPython is never exposed to the user. - callpy = rffi.cast(parse_c_type.PCALLPY, g.c_address) - callpython = instantiate(W_CallPython, nonmovable=True) - W_CallPython.__init__(callpython, space, rffi.cast(rffi.CCHARP, callpy), + # externpy object from C. We must make sure to keep it alive forever, + # or at least until ffi.def_extern() is used again to change the + # binding. Note that the W_ExternPython is never exposed to the user. + externpy = rffi.cast(parse_c_type.PEXTERNPY, g.c_address) + externpython = instantiate(W_ExternPython, nonmovable=True) + cdata = rffi.cast(rffi.CCHARP, externpy) + W_ExternPython.__init__(externpython, space, cdata, w_ct, w_python_callable, w_error, w_onerror) - key = rffi.cast(lltype.Signed, callpy) - space.fromcache(KeepaliveCache).cache_dict[key] = callpython - callpy.c_reserved1 = callpython.hide_object() + key = rffi.cast(lltype.Signed, externpy) + space.fromcache(KeepaliveCache).cache_dict[key] = externpython + externpy.c_reserved1 = externpython.hide_object() # return a cdata of type function-pointer, equal to the one # obtained by reading 'lib.bar' (see lib_obj.py) @@ -127,11 +129,11 @@ return w_ct.convert_to_object(rffi.cast(rffi.CCHARP, ptr)) -def callpy_not_found(ffi, name): +def externpy_not_found(ffi, name): raise oefmt(ffi.w_FFIError, - "ffi.call_python('%s'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef", name) + "ffi.def_extern('%s'): no 'extern \"Python\"' " + "function with this name", name) @specialize.memo() def get_generic_decorator(space): - return space.wrap(interp2app(callpy_deco)) + return space.wrap(interp2app(externpy_deco)) diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py --- a/pypy/module/_cffi_backend/ccallback.py +++ b/pypy/module/_cffi_backend/ccallback.py @@ -32,7 +32,7 @@ def reveal_callback(raw_ptr): addr = rffi.cast(llmemory.Address, raw_ptr) gcref = rgc.reveal_gcref(addr) - return rgc.try_cast_gcref_to_instance(W_CallPython, gcref) + return rgc.try_cast_gcref_to_instance(W_ExternPython, gcref) class Closure(object): @@ -45,7 +45,7 @@ clibffi.closureHeap.free(rffi.cast(clibffi.FFI_CLOSUREP, self.ptr)) -class W_CallPython(W_CData): +class W_ExternPython(W_CData): """Base class for W_CDataCallback, also used from call_python.py. """ decode_args_from_libffi = False @@ -126,13 +126,13 @@ space.threadlocals.leave_thread(space) def py_invoke(self, ll_res, ll_args): - # For W_CallPython only; overridden in W_CDataCallback. Note + # For W_ExternPython only; overridden in W_CDataCallback. Note # that the details of the two jitdrivers differ. For - # W_CallPython, it depends on the identity of 'self', which - # means every @ffi.call_python() gets its own machine code, + # W_ExternPython, it depends on the identity of 'self', which + # means every @ffi.def_extern() gets its own machine code, # which sounds reasonable here. Moreover, 'll_res' is ignored # as it is always equal to 'll_args'. - jitdriver2.jit_merge_point(callpython=self, ll_args=ll_args) + jitdriver2.jit_merge_point(externpython=self, ll_args=ll_args) self.do_invoke(ll_args, ll_args) def do_invoke(self, ll_res, ll_args): @@ -196,15 +196,15 @@ "another exception occurred:\n\n") -class W_CDataCallback(W_CallPython): +class W_CDataCallback(W_ExternPython): _immutable_fields_ = ['key_pycode'] decode_args_from_libffi = True def __init__(self, space, ctype, w_callable, w_error, w_onerror): raw_closure = rffi.cast(rffi.CCHARP, clibffi.closureHeap.alloc()) self._closure = Closure(raw_closure) - W_CallPython.__init__(self, space, raw_closure, ctype, - w_callable, w_error, w_onerror) + W_ExternPython.__init__(self, space, raw_closure, ctype, + w_callable, w_error, w_onerror) self.key_pycode = space._try_fetch_pycode(w_callable) # cif_descr = self.getfunctype().cif_descr @@ -277,7 +277,7 @@ STDERR = 2 -# jitdrivers, for both W_CDataCallback and W_CallPython +# jitdrivers, for both W_CDataCallback and W_ExternPython def get_printable_location1(key_pycode): if key_pycode is None: @@ -289,13 +289,13 @@ reds=['ll_res', 'll_args', 'callback'], get_printable_location=get_printable_location1) -def get_printable_location2(callpython): - with callpython as ptr: - callpy = rffi.cast(parse_c_type.PCALLPY, ptr) - return 'cffi_call_python ' + rffi.charp2str(callpy.c_name) +def get_printable_location2(externpython): + with externpython as ptr: + externpy = rffi.cast(parse_c_type.PEXTERNPY, ptr) + return 'cffi_call_python ' + rffi.charp2str(externpy.c_name) jitdriver2 = jit.JitDriver(name='cffi_call_python', - greens=['callpython'], + greens=['externpython'], reds=['ll_args'], get_printable_location=get_printable_location2) diff --git a/pypy/module/_cffi_backend/cffi_opcode.py b/pypy/module/_cffi_backend/cffi_opcode.py --- a/pypy/module/_cffi_backend/cffi_opcode.py +++ b/pypy/module/_cffi_backend/cffi_opcode.py @@ -54,7 +54,7 @@ OP_DLOPEN_FUNC = 35 OP_DLOPEN_CONST = 37 OP_GLOBAL_VAR_F = 39 -OP_CALL_PYTHON = 41 +OP_EXTERN_PYTHON = 41 PRIM_VOID = 0 PRIM_BOOL = 1 diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -282,11 +282,11 @@ @unwrap_spec(w_name=WrappedDefault(None), w_error=WrappedDefault(None), w_onerror=WrappedDefault(None)) - def descr_call_python(self, w_name, w_error, w_onerror): + def descr_def_extern(self, w_name, w_error, w_onerror): """\ A decorator. Attaches the decorated Python function to the C code -generated for the CFFI_CALL_PYTHON function of the same name. Calling -the C function will then invoke the Python function. +generated for the 'extern "Python" function of the same name. +Calling the C function will then invoke the Python function. Optional arguments: 'name' is the name of the C function, if different from the Python function; and 'error' and 'onerror' @@ -657,9 +657,9 @@ addressof = interp2app(W_FFIObject.descr_addressof), alignof = interp2app(W_FFIObject.descr_alignof), buffer = interp2app(W_FFIObject.descr_buffer), - call_python = interp2app(W_FFIObject.descr_call_python), callback = interp2app(W_FFIObject.descr_callback), cast = interp2app(W_FFIObject.descr_cast), + def_extern = interp2app(W_FFIObject.descr_def_extern), dlclose = interp2app(W_FFIObject.descr_dlclose), dlopen = interp2app(W_FFIObject.descr_dlopen), from_buffer = interp2app(W_FFIObject.descr_from_buffer), diff --git a/pypy/module/_cffi_backend/lib_obj.py b/pypy/module/_cffi_backend/lib_obj.py --- a/pypy/module/_cffi_backend/lib_obj.py +++ b/pypy/module/_cffi_backend/lib_obj.py @@ -168,9 +168,9 @@ w_result = W_CData(self.space, ptr, w_ctfnptr) # # - elif op == cffi_opcode.OP_CALL_PYTHON: + elif op == cffi_opcode.OP_EXTERN_PYTHON: # for reading 'lib.bar' where bar is declared - # with CFFI_CALL_PYTHON + # as an extern "Python" w_ct = realize_c_type.realize_c_type( self.ffi, self.ctx.c_types, getarg(g.c_type_op)) ptr = lltype.direct_fieldptr(g, 'c_size_or_direct_fn') diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py --- a/pypy/module/_cffi_backend/parse_c_type.py +++ b/pypy/module/_cffi_backend/parse_c_type.py @@ -71,11 +71,11 @@ ('error_location', rffi.SIZE_T), ('error_message', rffi.CCHARP)) -PCALLPY = rffi.CStructPtr('_cffi_callpy_s', - ('name', rffi.CCHARP), - ('size_of_result', rffi.SIZE_T), - ('reserved1', rffi.VOIDP), - ('reserved2', rffi.VOIDP)) +PEXTERNPY = rffi.CStructPtr('_cffi_externpy_s', + ('name', rffi.CCHARP), + ('size_of_result', rffi.SIZE_T), + ('reserved1', rffi.VOIDP), + ('reserved2', rffi.VOIDP)) GETCONST_S = rffi.CStruct('_cffi_getconst_s', ('value', rffi.ULONGLONG), diff --git a/pypy/module/_cffi_backend/src/parse_c_type.h b/pypy/module/_cffi_backend/src/parse_c_type.h --- a/pypy/module/_cffi_backend/src/parse_c_type.h +++ b/pypy/module/_cffi_backend/src/parse_c_type.h @@ -27,7 +27,7 @@ #define _CFFI_OP_DLOPEN_FUNC 35 #define _CFFI_OP_DLOPEN_CONST 37 #define _CFFI_OP_GLOBAL_VAR_F 39 -#define _CFFI_OP_CALL_PYTHON 41 +#define _CFFI_OP_EXTERN_PYTHON 41 #define _CFFI_PRIM_VOID 0 #define _CFFI_PRIM_BOOL 1 @@ -161,7 +161,7 @@ const char *error_message; }; -struct _cffi_callpy_s { +struct _cffi_externpy_s { const char *name; size_t size_of_result; void *reserved1, *reserved2; diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py --- a/pypy/module/_cffi_backend/test/test_recompiler.py +++ b/pypy/module/_cffi_backend/test/test_recompiler.py @@ -1423,22 +1423,24 @@ sys.stderr = self.old_stderr return StdErrCapture() - def test_call_python_1(self): + def test_extern_python_1(self): ffi, lib = self.prepare(""" - CFFI_CALL_PYTHON int bar(int, int); - CFFI_CALL_PYTHON void baz(int, int); - CFFI_CALL_PYTHON int bok(void); - CFFI_CALL_PYTHON void boz(void); - """, 'test_call_python_1', "") + extern "Python" { + int bar(int, int); + void baz(int, int); + int bok(void); + void boz(void); + } + """, 'test_extern_python_1', "") assert ffi.typeof(lib.bar) == ffi.typeof("int(*)(int, int)") with self.StdErrCapture(fd=True) as f: res = lib.bar(4, 5) assert res == 0 assert f.getvalue() == ( - "CFFI_CALL_PYTHON: function bar() called, but no code was attached " - "to it yet with ffi.call_python('bar'). Returning 0.\n") + "extern \"Python\": function bar() called, but no code was attached " + "to it yet with @ffi.def_extern(). Returning 0.\n") - @ffi.call_python("bar") + @ffi.def_extern("bar") def my_bar(x, y): seen.append(("Bar", x, y)) return x * y @@ -1448,7 +1450,7 @@ assert seen == [("Bar", 6, 7)] assert res == 42 - @ffi.call_python() + @ffi.def_extern() def baz(x, y): seen.append(("Baz", x, y)) seen = [] @@ -1458,91 +1460,90 @@ assert type(seen[0][1]) is type(seen[0][2]) is int assert baz == lib.baz - @ffi.call_python() - def bok(): + @ffi.def_extern(name="bok") + def bokk(): seen.append("Bok") return 42 seen = [] - assert lib.bok() == bok() == 42 + assert lib.bok() == bokk() == 42 assert seen == ["Bok", "Bok"] - @ffi.call_python() + @ffi.def_extern() def boz(): seen.append("Boz") seen = [] assert lib.boz() is boz() is None assert seen == ["Boz", "Boz"] - def test_call_python_bogus_name(self): + def test_extern_python_bogus_name(self): ffi, lib = self.prepare("int abc;", - 'test_call_python_bogus_name', + 'test_extern_python_bogus_name', "int abc;") def fn(): pass - raises(ffi.error, ffi.call_python("unknown_name"), fn) - raises(ffi.error, ffi.call_python("abc"), fn) + raises(ffi.error, ffi.def_extern("unknown_name"), fn) + raises(ffi.error, ffi.def_extern("abc"), fn) assert lib.abc == 0 - e = raises(ffi.error, ffi.call_python("abc"), fn) - assert str(e.value) == ("ffi.call_python('abc'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef") - e = raises(ffi.error, ffi.call_python(), fn) - assert str(e.value) == ("ffi.call_python('fn'): name not found as a " - "CFFI_CALL_PYTHON line from the cdef") + e = raises(ffi.error, ffi.def_extern("abc"), fn) + assert str(e.value) == ("ffi.def_extern('abc'): no 'extern \"Python\"' " + "function with this name") + e = raises(ffi.error, ffi.def_extern(), fn) + assert str(e.value) == ("ffi.def_extern('fn'): no 'extern \"Python\"' " + "function with this name") # - raises(TypeError, ffi.call_python(42), fn) - raises((TypeError, AttributeError), ffi.call_python(), "foo") + raises(TypeError, ffi.def_extern(42), fn) + raises((TypeError, AttributeError), ffi.def_extern(), "foo") class X: pass x = X() x.__name__ = x - raises(TypeError, ffi.call_python(), x) + raises(TypeError, ffi.def_extern(), x) - def test_call_python_bogus_result_type(self): - ffi, lib = self.prepare("CFFI_CALL_PYTHON void bar(int);", - 'test_call_python_bogus_result_type', + def test_extern_python_bogus_result_type(self): + ffi, lib = self.prepare("""extern "Python" void bar(int);""", + 'test_extern_python_bogus_result_type', "") def bar(n): return n * 10 - bar1 = ffi.call_python()(bar) + bar1 = ffi.def_extern()(bar) with self.StdErrCapture() as f: res = bar1(321) assert res is None assert f.getvalue() == ( "From cffi callback %r:\n" % (bar,) + "Trying to convert the result back to C:\n" - "TypeError: callback with the return type 'void' must return None\n" - ) + "TypeError: callback with the return type 'void' must return None\n") - def test_call_python_redefine(self): - ffi, lib = self.prepare("CFFI_CALL_PYTHON int bar(int);", - 'test_call_python_redefine', + def test_extern_python_redefine(self): + ffi, lib = self.prepare("""extern "Python" int bar(int);""", + 'test_extern_python_redefine', "") - @ffi.call_python() + @ffi.def_extern() def bar(n): return n * 10 assert lib.bar(42) == 420 # - @ffi.call_python() + @ffi.def_extern() def bar(n): return -n assert lib.bar(42) == -42 - def test_call_python_struct(self): + def test_extern_python_struct(self): ffi, lib = self.prepare(""" struct foo_s { int a, b, c; }; - CFFI_CALL_PYTHON int bar(int, struct foo_s, int); - CFFI_CALL_PYTHON struct foo_s baz(int, int); - CFFI_CALL_PYTHON struct foo_s bok(void); - """, 'test_call_python_struct', - "struct foo_s { int a, b, c; };") + extern "Python" int bar(int, struct foo_s, int); + extern "Python" { struct foo_s baz(int, int); + struct foo_s bok(void); } + """, 'test_extern_python_struct', + "struct foo_s { int a, b, c; };") # - @ffi.call_python() + @ffi.def_extern() def bar(x, s, z): return x + s.a + s.b + s.c + z res = lib.bar(1000, [1001, 1002, 1004], 1008) assert res == 5015 # - @ffi.call_python() + @ffi.def_extern() def baz(x, y): return [x + y, x - y, x * y] res = lib.baz(1000, 42) @@ -1550,20 +1551,20 @@ assert res.b == 958 assert res.c == 42000 # - @ffi.call_python() + @ffi.def_extern() def bok(): return [10, 20, 30] res = lib.bok() assert [res.a, res.b, res.c] == [10, 20, 30] - def test_call_python_long_double(self): + def test_extern_python_long_double(self): ffi, lib = self.prepare(""" - CFFI_CALL_PYTHON int bar(int, long double, int); - CFFI_CALL_PYTHON long double baz(int, int); - CFFI_CALL_PYTHON long double bok(void); - """, 'test_call_python_long_double', "") + extern "Python" int bar(int, long double, int); + extern "Python" long double baz(int, int); + extern "Python" long double bok(void); + """, 'test_extern_python_long_double', "") # - @ffi.call_python() + @ffi.def_extern() def bar(x, l, z): seen.append((x, l, z)) return 6 @@ -1572,15 +1573,53 @@ expected = ffi.cast("long double", 3.5) assert repr(seen) == repr([(10, expected, 20)]) # - @ffi.call_python() + @ffi.def_extern() def baz(x, z): assert x == 10 and z == 20 return expected res = lib.baz(10, 20) assert repr(res) == repr(expected) # - @ffi.call_python() + @ffi.def_extern() def bok(): return expected res = lib.bok() assert repr(res) == repr(expected) + + def test_extern_python_signature(self): + ffi, lib = self.prepare("", 'test_extern_python_signature', "") + raises(TypeError, ffi.def_extern(425), None) + raises(TypeError, ffi.def_extern, 'a', 'b', 'c', 'd') + + def test_extern_python_errors(self): + ffi, lib = self.prepare(""" + extern "Python" int bar(int); + """, 'test_extern_python_errors', "") + + seen = [] + def oops(*args): + seen.append(args) + + @ffi.def_extern(onerror=oops) + def bar(x): + return x + "" + assert bar(10) == 0 + + @ffi.def_extern(name="bar", onerror=oops, error=-66) + def bar2(x): + return x + "" + assert bar(10) == -66 + + assert len(seen) == 2 + exc, val, tb = seen[0] + assert exc is TypeError + assert isinstance(val, TypeError) + assert tb.tb_frame.f_code.co_name == "bar" + exc, val, tb = seen[1] + assert exc is TypeError + assert isinstance(val, TypeError) + assert tb.tb_frame.f_code.co_name == "bar2" + # + # a case where 'onerror' is not callable + raises(TypeError, ffi.def_extern(name='bar', onerror=42), + lambda x: x) From noreply at buildbot.pypy.org Wed Nov 18 06:07:06 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 12:07:06 +0100 (CET) Subject: [pypy-commit] pypy default: Print the usession directory at the very end, not at the end of Message-ID: <20151118110706.5E49B1C1D36@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80752:10e1674318ad Date: 2015-11-18 12:07 +0100 http://bitbucket.org/pypy/pypy/changeset/10e1674318ad/ Log: Print the usession directory at the very end, not at the end of create_exe(), now that there is an extra step afterwards for pypy diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py --- a/rpython/translator/driver.py +++ b/rpython/translator/driver.py @@ -502,7 +502,6 @@ shutil.copyfile(str(name), str(newname.new(ext=ext))) self.log.info("copied: %s" % (newname,)) self.c_entryp = newexename - self.log.info('usession directory: %s' % (udir,)) self.log.info("created: %s" % (self.c_entryp,)) @taskdef(['source_c'], "Compiling c source") @@ -548,7 +547,9 @@ goals = [goals] goals.extend(self.extra_goals) goals = self.backend_select_goals(goals) - return self._execute(goals, task_skip = self._maybe_skip()) + result = self._execute(goals, task_skip = self._maybe_skip()) + self.log.info('usession directory: %s' % (udir,)) + return result @staticmethod def from_targetspec(targetspec_dic, config=None, args=None, From noreply at buildbot.pypy.org Wed Nov 18 06:27:42 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 12:27:42 +0100 (CET) Subject: [pypy-commit] cffi static-callback: Write one error message directly to stderr instead of sys.stderr. This Message-ID: <20151118112742.B549D1C0400@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2416:1e8f6c41d71a Date: 2015-11-18 12:28 +0100 http://bitbucket.org/cffi/cffi/changeset/1e8f6c41d71a/ Log: Write one error message directly to stderr instead of sys.stderr. This lets us avoid taking the GIL, which might crash in case the Python interpreter is not initialized at all. diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -90,29 +90,21 @@ at least 8 bytes in size. */ save_errno(); - { -#ifdef WITH_THREAD - PyGILState_STATE state = PyGILState_Ensure(); -#endif if (externpy->reserved1 == NULL) { /* not initialized! */ - PyObject *f = PySys_GetObject("stderr"); - if (f != NULL) { - PyFile_WriteString("extern \"Python\": function ", f); - PyFile_WriteString(externpy->name, f); - PyFile_WriteString("() called, but no code was attached " - "to it yet with @ffi.def_extern(). " - "Returning 0.\n", f); - } + fprintf(stderr, "extern \"Python\": function %s() called, " + "but no code was attached to it yet with " + "@ffi.def_extern(). Returning 0.\n", externpy->name); memset(args, 0, externpy->size_of_result); } else { +#ifdef WITH_THREAD + PyGILState_STATE state = PyGILState_Ensure(); +#endif general_invoke_callback(0, args, args, externpy->reserved1); - } - #ifdef WITH_THREAD - PyGILState_Release(state); + PyGILState_Release(state); #endif } restore_errno(); diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py --- a/testing/cffi0/test_function.py +++ b/testing/cffi0/test_function.py @@ -4,6 +4,7 @@ import ctypes.util from cffi.backend_ctypes import CTypesBackend from testing.udir import udir +from testing.support import FdWriteCapture try: from StringIO import StringIO @@ -11,29 +12,6 @@ from io import StringIO -class FdWriteCapture(object): - """xxx limited to capture at most 512 bytes of output, according - to the Posix manual.""" - - def __init__(self, capture_fd): - self.capture_fd = capture_fd - - def __enter__(self): - self.read_fd, self.write_fd = os.pipe() - self.copy_fd = os.dup(self.capture_fd) - os.dup2(self.write_fd, self.capture_fd) - return self - - def __exit__(self, *args): - os.dup2(self.copy_fd, self.capture_fd) - os.close(self.copy_fd) - os.close(self.write_fd) - self._value = os.read(self.read_fd, 512) - os.close(self.read_fd) - - def getvalue(self): - return self._value - lib_m = 'm' if sys.platform == 'win32': #there is a small chance this fails on Mingw via environ $CC @@ -135,7 +113,7 @@ """) ffi.C = ffi.dlopen(None) ffi.C.fputs # fetch before capturing, for easier debugging - with FdWriteCapture(2) as fd: + with FdWriteCapture() as fd: ffi.C.fputs(b"hello\n", ffi.C.stderr) ffi.C.fputs(b" world\n", ffi.C.stderr) res = fd.getvalue() @@ -151,7 +129,7 @@ """) ffi.C = ffi.dlopen(None) ffi.C.fputs # fetch before capturing, for easier debugging - with FdWriteCapture(2) as fd: + with FdWriteCapture() as fd: ffi.C.fputs(b"hello\n", ffi.C.stderr) ffi.C.fputs(b" world\n", ffi.C.stderr) res = fd.getvalue() @@ -166,7 +144,7 @@ void *stderr; """) ffi.C = ffi.dlopen(None) - with FdWriteCapture(2) as fd: + with FdWriteCapture() as fd: ffi.C.fprintf(ffi.C.stderr, b"hello with no arguments\n") ffi.C.fprintf(ffi.C.stderr, b"hello, %s!\n", ffi.new("char[]", b"world")) @@ -228,7 +206,7 @@ fptr = ffi.cast("int(*)(const char *txt, void *)", ffi.C.fputs) assert fptr == ffi.C.fputs assert repr(fptr).startswith(" Author: Armin Rigo Branch: cffi-static-callback Changeset: r80753:0b45b61fea59 Date: 2015-11-18 12:29 +0100 http://bitbucket.org/pypy/pypy/changeset/0b45b61fea59/ Log: import cffi/1e8f6c41d71a diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py @@ -5,6 +5,7 @@ import ctypes.util from cffi.backend_ctypes import CTypesBackend from pypy.module.test_lib_pypy.cffi_tests.udir import udir +from pypy.module.test_lib_pypy.cffi_tests.support import FdWriteCapture try: from StringIO import StringIO @@ -12,29 +13,6 @@ from io import StringIO -class FdWriteCapture(object): - """xxx limited to capture at most 512 bytes of output, according - to the Posix manual.""" - - def __init__(self, capture_fd): - self.capture_fd = capture_fd - - def __enter__(self): - self.read_fd, self.write_fd = os.pipe() - self.copy_fd = os.dup(self.capture_fd) - os.dup2(self.write_fd, self.capture_fd) - return self - - def __exit__(self, *args): - os.dup2(self.copy_fd, self.capture_fd) - os.close(self.copy_fd) - os.close(self.write_fd) - self._value = os.read(self.read_fd, 512) - os.close(self.read_fd) - - def getvalue(self): - return self._value - lib_m = 'm' if sys.platform == 'win32': #there is a small chance this fails on Mingw via environ $CC @@ -136,7 +114,7 @@ """) ffi.C = ffi.dlopen(None) ffi.C.fputs # fetch before capturing, for easier debugging - with FdWriteCapture(2) as fd: + with FdWriteCapture() as fd: ffi.C.fputs(b"hello\n", ffi.C.stderr) ffi.C.fputs(b" world\n", ffi.C.stderr) res = fd.getvalue() @@ -152,7 +130,7 @@ """) ffi.C = ffi.dlopen(None) ffi.C.fputs # fetch before capturing, for easier debugging - with FdWriteCapture(2) as fd: + with FdWriteCapture() as fd: ffi.C.fputs(b"hello\n", ffi.C.stderr) ffi.C.fputs(b" world\n", ffi.C.stderr) res = fd.getvalue() @@ -167,7 +145,7 @@ void *stderr; """) ffi.C = ffi.dlopen(None) - with FdWriteCapture(2) as fd: + with FdWriteCapture() as fd: ffi.C.fprintf(ffi.C.stderr, b"hello with no arguments\n") ffi.C.fprintf(ffi.C.stderr, b"hello, %s!\n", ffi.new("char[]", b"world")) @@ -229,7 +207,7 @@ fptr = ffi.cast("int(*)(const char *txt, void *)", ffi.C.fputs) assert fptr == ffi.C.fputs assert repr(fptr).startswith(" Author: Manuel Jacob Branch: py3k Changeset: r80754:27eb9104567c Date: 2015-11-15 10:44 +0100 http://bitbucket.org/pypy/pypy/changeset/27eb9104567c/ Log: 2to3 diff --git a/pypy/module/thread/test/test_lock.py b/pypy/module/thread/test/test_lock.py --- a/pypy/module/thread/test/test_lock.py +++ b/pypy/module/thread/test/test_lock.py @@ -182,7 +182,7 @@ self.sig_recvd = True old_handler = signal.signal(signal.SIGUSR1, my_handler) try: - ready = thread.allocate_lock() + ready = _thread.allocate_lock() ready.acquire() def other_thread(): # Acquire the lock in a non-main thread, so this test works for From noreply at buildbot.pypy.org Wed Nov 18 07:00:39 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 13:00:39 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151118120039.9579C1C1279@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r656:4fb669dfb539 Date: 2015-11-18 13:01 +0100 http://bitbucket.org/pypy/pypy.org/changeset/4fb669dfb539/ Log: update the values diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -17,7 +17,7 @@ 2nd call: - $29688 of $80000 (37.1%) + $29698 of $80000 (37.1%)
    @@ -25,7 +25,7 @@
  • From noreply at buildbot.pypy.org Wed Nov 18 08:08:45 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 18 Nov 2015 14:08:45 +0100 (CET) Subject: [pypy-commit] benchmarks default: TM benchmark tuning Message-ID: <20151118130845.D7AD21C1EB0@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r341:2c38edec82f1 Date: 2015-11-18 13:40 +0100 http://bitbucket.org/pypy/benchmarks/changeset/2c38edec82f1/ Log: TM benchmark tuning diff --git a/multithread/lee_routing/lee_router_tm.py b/multithread/lee_routing/lee_router_tm.py --- a/multithread/lee_routing/lee_router_tm.py +++ b/multithread/lee_routing/lee_router_tm.py @@ -38,6 +38,27 @@ # Author: IW # Translated from Java to Python by Remi Meier +# +# Changes done to improve TM performance: +# * The tempgrid was created once, then used repeatedly. For STM, +# this is bad because when we modify the tempgrid, we write to +# tons of *old* objects that have to be recorded in the write-set. +# Also, the write-set goes to the commit log and increases its +# size tremendously. +# +# * The Java version used a list of lists of lists for the grid. +# To use memory more efficiently, we use one list/array that +# is indexed linearly with index calculation. +# +# * The change above (one big list) means that conflict detection +# on the shared grid detects conflicts all the time. So we box +# each value in a STMValue() object. (-> overhead for single- +# threaded version) +# +# * Use optimized STMQueue from pypystm module instead of +# hand-written WorkQueue. +# + import time import sys, math @@ -45,14 +66,12 @@ try: from pypystm import atomic, hint_commit_soon + from pypystm import queue as STMQueue, Empty as STMEmpty + print "RUNNING STM" except ImportError: print "NOT RUNNING STM" atomic = threading.RLock() hint_commit_soon = lambda : 0 - -try: - from pypystm import STMQueue, STMEmpty -except ImportError: from Queue import Queue as STMQueue, Empty as STMEmpty @@ -83,9 +102,6 @@ self.width = width self.height = height self.depth = depth - # self._data = [[[0 for _ in range(depth)] - # for _ in range(height)] - # for _ in range(width)] self._data = None self.reset(EMPTY) @@ -93,29 +109,19 @@ return (x * self.height + y) * self.depth + z def __getitem__(self, args): - #x, y, z = args - #return self._data[x][y][z] return self._data[self._idx(*args)] def __setitem__(self, args, value): self._data[self._idx(*args)] = value - # x, y, z = args - # self._data[x][y][z] = value def reset(self, val): self._data = [val] * (self.width * self.height * self.depth) - # for col in self._data: - # for r in range(len(col)): - # col[r] = [val] * self.depth def occupy(self, lo_x, lo_y, up_x, up_y): for x in range(lo_x, up_x + 1): for y in range(lo_y, up_y + 1): for c in range(self.depth): self[x, y, c] = OCC - # depth = self._data[x][y] - # for c in range(len(depth)): - # depth[c] = OCC def add_weights(self): @@ -139,8 +145,29 @@ if self[x + dx, y + dy, z] == EMPTY: self[x + dx, y + dy, z] = val - 1 +class STMValue(object): + def __init__(self, v): + self.v = v +class STMGrid(Grid): + """Grid that boxes each value to avoid conflicts and that + keeps around the grid on reset""" + def __init__(self, *args): + super(STMGrid, self).__init__(*args) + + def reset(self, val): + if self._data is None: + self._data = [STMValue(val) for _ in range(self.width * self.height * self.depth)] + else: + for i in range(len(self._data)): + self._data[i].v = val + + def __getitem__(self, args): + return super(STMGrid, self).__getitem__(args).v + + def __setitem__(self, args, value): + super(STMGrid, self).__getitem__(args).v = value class WorkItem: @@ -159,7 +186,7 @@ class WorkQueue: def __init__(self, items): self._stmQ = STMQueue() - for i in (items): + for i in items: self._stmQ.put(i) def dequeue(self): @@ -190,7 +217,7 @@ class LeeRouter(object): def __init__(self, file): - self.grid = Grid(GRID_SIZE, GRID_SIZE, 2) + self.grid = STMGrid(GRID_SIZE, GRID_SIZE, 2) self._work = [] self.net_no = 0 self._parse_data_file(file) @@ -248,14 +275,6 @@ pass #print "|".join(map(lambda x:str((x.x1 - x.x2)**2+(x.y1-x.y2)**2), work[:20])) - # @staticmethod - # def _compatibility_sort(work): - # # just here for result-compatibility with Java code - # for passnum in range(len(work) - 1, 0, -1): - # for i in range(passnum): - # if work[i] > work[i+1]: - # work[i], work[i+1] = work[i+1], work[i] - # #print "|".join(map(lambda x:str((x.x1 - x.x2)**2+(x.y1-x.y2)**2), work)) def get_next_track(self): try: From noreply at buildbot.pypy.org Wed Nov 18 08:43:52 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 18 Nov 2015 14:43:52 +0100 (CET) Subject: [pypy-commit] benchmarks default: fix use of wrong data structure Message-ID: <20151118134352.622AA1C1279@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r342:1b2b48c6a787 Date: 2015-11-18 14:46 +0100 http://bitbucket.org/pypy/benchmarks/changeset/1b2b48c6a787/ Log: fix use of wrong data structure diff --git a/multithread/lee_routing/lee_router_tm.py b/multithread/lee_routing/lee_router_tm.py --- a/multithread/lee_routing/lee_router_tm.py +++ b/multithread/lee_routing/lee_router_tm.py @@ -58,11 +58,14 @@ # * Use optimized STMQueue from pypystm module instead of # hand-written WorkQueue. # - +# * Use a deque() where Java used a Vector. deque is much better +# to pop an element from the front and append at the end. +# import time import sys, math import threading +import collections try: from pypystm import atomic, hint_commit_soon @@ -302,8 +305,8 @@ # # g[x_goal][y_goal][0] = EMPTY; // set goal as empty # g[x_goal][y_goal][1] = EMPTY; // set goal as empty - front = [] - tmp_front = [] + front = collections.deque()#[] + tmp_front = collections.deque()#[] tempgrid[x, y, 0] = 1 tempgrid[x, y, 1] = 1 # @@ -313,7 +316,7 @@ reached0, reached1 = False, False while front: while front: - fx, fy, fz, fdw = front.pop(0) + fx, fy, fz, fdw = front.popleft() # if fdw > 0: tmp_front.append((fx, fy, fz, fdw - 1)) From noreply at buildbot.pypy.org Wed Nov 18 08:58:48 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 14:58:48 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: test_int_operations is now passing Message-ID: <20151118135848.AFC731C1279@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80755:86247434b6b3 Date: 2015-11-18 14:59 +0100 http://bitbucket.org/pypy/pypy/changeset/86247434b6b3/ Log: test_int_operations is now passing diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -371,10 +371,10 @@ # sadly we cannot use LOCGHI # it is included in some extension that seem to be NOT installed # by default. - self.mc.LGHI(r.SCRATCH, l.imm(1)) - self.mc.LOCGR(result_loc, r.SCRATCH, condition) - self.mc.LGHI(r.SCRATCH, l.imm(0)) - self.mc.LOCGR(result_loc, r.SCRATCH, c.negate(condition)) + self.mc.LGHI(result_loc, l.imm(1)) + off = self.mc.XGR_byte_count + self.mc.BRC_byte_count + self.mc.BRC(condition, l.imm(off)) # branch over LGHI + self.mc.XGR(result_loc, result_loc) def _assemble(self, regalloc, inputargs, operations): @@ -408,6 +408,11 @@ self.mc.store(r.SCRATCH.value, r.SPP, offset) return assert 0, "not supported location" + elif prev_loc.is_in_pool(): + if loc.is_reg(): + self.mc.LG(loc, prev_loc) + else: + xxx elif prev_loc.is_stack(): offset = prev_loc.value # move from memory to register diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -129,21 +129,21 @@ if signed: if pool: # 64 bit immediate signed - self.CLG(a, b) + self.CG(a, b) elif imm: - self.CGHI(a, b) + self.CGFI(a, b) else: # 64 bit signed - self.CLGR(a, b) + self.CGR(a, b) else: if pool: # 64 bit immediate unsigned - self.CG(a, b) + self.CLG(a, b) elif imm: - raise NotImplementedError + self.CLGFI(a, b) else: # 64 bit unsigned - self.CGR(a, b) + self.CLGR(a, b) def load_imm(self, dest_reg, word): diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py --- a/rpython/jit/backend/zarch/helper/assembler.py +++ b/rpython/jit/backend/zarch/helper/assembler.py @@ -6,34 +6,6 @@ from rpython.jit.metainterp.resoperation import rop from rpython.rtyper.lltypesystem import rffi, lltype -def flush_cc(asm, condition, result_loc): - # After emitting an instruction that leaves a boolean result in - # a condition code (cc), call this. In the common case, result_loc - # will be set to SPP by the regalloc, which in this case means - # "propagate it between this operation and the next guard by keeping - # it in the cc". In the uncommon case, result_loc is another - # register, and we emit a load from the cc into this register. - assert asm.guard_success_cc == c.cond_none - if result_loc is r.SPP: - asm.guard_success_cc = condition - else: - # Possibly invert the bit in the CR - bit, invert = c.encoding[condition] - assert 0 <= bit <= 3 - if invert == 12: - pass - elif invert == 4: - asm.mc.crnor(bit, bit, bit) - else: - assert 0 - - resval = result_loc.value - # move the content of the CR to resval - asm.mc.mfcr(resval) - # zero out everything except of the result - asm.mc.rlwinm(resval, resval, 1 + bit, 31, 31) - - def do_emit_cmp_op(self, arglocs, condition, signed, fp): l0 = arglocs[0] l1 = arglocs[1] @@ -41,13 +13,8 @@ # do the comparison self.mc.cmp_op(l0, l1, pool=l1.is_in_pool(), imm=l1.is_imm(), signed=signed, fp=fp) - # CR bits: - # 0: LT - # 1: GT - # 2: EQ - # 3: UNordered - if fp: + xxx # Support for NaNs: with LE or GE, if one of the operands is a # NaN, we get CR=1,0,0,0 (unordered bit only). We're about to # check "not GT" or "not LT", but in case of NaN we want to @@ -59,8 +26,7 @@ # self.mc.crnor(0, 0, 3) # condition = c.LT pass - - flush_cc(self, condition, r.SPP) + self.flush_cc(condition, arglocs[2]) def gen_emit_cmp_op(condition, signed=True, fp=False): @@ -82,7 +48,7 @@ l0, l1 = arglocs if l1.is_imm() and not l1.is_in_pool(): assert 0, "logical imm must reside in pool!" - elif l1.is_in_pool(): + if l1.is_in_pool(): getattr(self.mc, rp_func)(l0, l1) else: getattr(self.mc, rr_func)(l0, l1) @@ -108,6 +74,7 @@ # remainer is always a even register r0, r2, ... , r14 assert lr.is_even() assert lq.is_odd() + self.mc.XGR(lr, lr) if l1.is_in_pool(): getattr(self.mc,pool_func)(lr, l1) else: diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -1,5 +1,7 @@ -from rpython.jit.metainterp.history import ConstInt, FLOAT +from rpython.jit.metainterp.history import ConstInt, FLOAT, Const from rpython.jit.backend.zarch.locations import imm, addr +from rpython.jit.backend.llsupport.regalloc import TempVar +import rpython.jit.backend.zarch.registers as r def check_imm(arg, lower_bound=-2**15, upper_bound=2**15-1): if isinstance(arg, ConstInt): @@ -55,33 +57,38 @@ self.free_op_vars() return [lr, lq, l1] -def prepare_int_div(self, op): - a0 = op.getarg(0) - a1 = op.getarg(1) - lr,lq = self.rm.ensure_even_odd_pair(a0, bind_first=False) - l1 = self.ensure_reg(a1) - self.rm.force_result_in_reg(op, a0) - self.free_op_vars() - self.rm._check_invariants() - return [lr, lq, l1] +def generate_div_mod(modulus): + def f(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + if isinstance(a0, Const): + poolloc = self.ensure_reg(a0) + lr,lq = self.rm.ensure_even_odd_pair(op, bind_first=modulus, must_exist=False) + self.assembler.mc.LG(lq, poolloc) + else: + lr,lq = self.rm.ensure_even_odd_pair(a0, bind_first=modulus) + self.rm.force_result_in_reg(op, a0) + l1 = self.ensure_reg(a1) + self.free_op_vars() + self.rm._check_invariants() + return [lr, lq, l1] + return f -def prepare_int_mod(self, op): - a0 = op.getarg(0) - a1 = op.getarg(1) - lr,lq = self.rm.ensure_even_odd_pair(a0, bind_first=True) - l1 = self.ensure_reg(a1) - self.rm.force_result_in_reg(op, a0) - self.free_op_vars() - return [lr, lq, l1] +prepare_int_div= generate_div_mod(False) +prepare_int_mod = generate_div_mod(True) def prepare_int_sub(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - if isinstance(a0, ConstInt): - a0, a1 = a1, a0 + # sub is not commotative, thus cannot swap operands + l1 = self.ensure_reg(a1) l0 = self.ensure_reg(a0) - l1 = self.ensure_reg(a1) - self.force_result_in_reg(op, a0) + if isinstance(a0, Const): + loc = self.force_allocate_reg(op) + self.assembler.mc.LG(loc, l0) + l0 = loc + else: + self.rm.force_result_in_reg(op, a0) self.free_op_vars() return [l0, l1] @@ -99,29 +106,42 @@ def prepare_int_shift(self, op): a0 = op.getarg(0) a1 = op.getarg(1) - assert isinstance(a1, ConstInt) - assert check_imm20(a1) + if isinstance(a1, ConstInt): + # note that the shift value is stored + # in the addr part of the instruction + l1 = addr(a1.getint()) + else: + self.rm.ensure_in_reg(a1, r.SCRATCH) + l1 = addr(0, r.SCRATCH) l0 = self.ensure_reg(a0) - # note that the shift value is stored - # in the addr part of the instruction - l1 = addr(a1.getint()) - self.force_result_in_reg(op, a0) + if l0.is_in_pool(): + loc = self.force_allocate_reg(op) + self.assembler.mc.LG(loc, l0) + l0 = loc + else: + self.force_result_in_reg(op, a0) self.free_op_vars() return [l0, l1] -def prepare_cmp_op(self, op): - a0 = op.getarg(0) - a1 = op.getarg(1) - if check_imm(a0): - a0, a1 = a1, a0 - l0 = self.ensure_reg(a0) - if check_imm(a1): - l1 = imm(a1.getint()) - else: - l1 = self.ensure_reg(a1) - self.force_result_in_reg(op, a0) - self.free_op_vars() - return [l0, l1] +def generate_cmp_op(signed=True): + def prepare_cmp_op(self, op): + a0 = op.getarg(0) + a1 = op.getarg(1) + invert = imm(0) + l0 = self.ensure_reg(a0) + if signed and check_imm32(a1): + l1 = imm(a1.getint()) + else: + l1 = self.ensure_reg(a1) + if l0.is_in_pool(): + poolloc = l0 + l0 = self.force_allocate_reg(op) + self.assembler.mc.LG(l0, poolloc) + res = self.force_allocate_reg_or_cc(op) + #self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0, l1, res, invert] + return prepare_cmp_op def prepare_binary_op(self, op): a0 = op.getarg(0) @@ -137,5 +157,6 @@ assert not isinstance(a0, ConstInt) l0 = self.ensure_reg(a0) self.force_result_in_reg(op, a0) + res = self.force_allocate_reg_or_cc(op) self.free_op_vars() - return [l0] + return [l0, res] diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -59,6 +59,7 @@ 'CLG': ('rxy', ['\xE3','\x21']), 'CGHI': ('ri', ['\xA7','\x0F']), 'CGFI': ('ril', ['\xC2','\x0C']), + 'CLGFI': ('ril', ['\xC2','\x0E']), 'CGIJ': ('rie_c', ['\xEC','\x7C']), 'CLGIJ': ('rie_c', ['\xEC','\x7D'], 'r,u8,r/m,i16'), 'CGIB': ('ris', ['\xEC','\xFC']), diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py --- a/rpython/jit/backend/zarch/locations.py +++ b/rpython/jit/backend/zarch/locations.py @@ -213,7 +213,7 @@ return self.isfloat def __repr__(self): - return "pool(i,%d)" % self.value + return "pool(i,%d)" % self.displace def addr(displace, basereg=None, indexreg=None, length=None): diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -12,8 +12,18 @@ emit_int_add = gen_emit_imm_pool_rr('AGFI','AG','AGR') emit_int_add_ovf = emit_int_add - emit_int_sub = gen_emit_rr_or_rpool('SGR', 'SG') + + def emit_int_sub(self, op, arglocs, regalloc): + l0, l1 = arglocs + if l1.is_imm() and not l1.is_in_pool(): + assert 0, "logical imm must reside in pool!" + if l1.is_in_pool(): + self.mc.SG(l0, l1) + else: + self.mc.SGR(l0, l1) + emit_int_sub_ovf = emit_int_sub + emit_int_mul = gen_emit_imm_pool_rr('MSGFI', 'MSG', 'MSGR') def emit_int_mul_ovf(self, op, arglocs, regalloc): lr, lq, l1 = arglocs @@ -104,23 +114,25 @@ #self.mc.AGR(lr, l1) def emit_int_invert(self, op, arglocs, regalloc): - l0 = arglocs[0] + l0, l1 = arglocs assert not l0.is_imm() - self.mc.XG(l0, l.pool(self.pool.constant_64_ones)) + self.mc.XG(l1, l.pool(self.pool.constant_64_ones)) + if l0 != l1: + self.mc.LGR(l0, l1) def emit_int_neg(self, op, arglocs, regalloc): - l0 = arglocs[0] - self.mc.LNGR(l0, l0) + l0, l1 = arglocs + self.mc.LCGR(l0, l1) def emit_int_is_zero(self, op, arglocs, regalloc): - l0 = arglocs[0] - self.mc.CGHI(l0, l.imm(0)) - self.flush_cc(c.EQ, r.SPP) + l0, l1 = arglocs + self.mc.CGHI(l1, l.imm(0)) + self.flush_cc(c.EQ, l0) def emit_int_is_true(self, op, arglocs, regalloc): - l0 = arglocs[0] + l0, l1 = arglocs self.mc.CGHI(l0, l.imm(0)) - self.flush_cc(c.NE, r.SPP) + self.flush_cc(c.NE, l0) emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") emit_int_or = gen_emit_rr_or_rpool("OGR", "OG") diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -47,6 +47,10 @@ self.constant_max_64_positive = 1 elif opnum == rop.INT_RSHIFT or opnum == rop.INT_LSHIFT or \ opnum == rop.UINT_RSHIFT: + a0 = op.getarg(0) + if a0.is_constant(): + self.offset_map[a0] = self.size + self.reserve_literal(8) return for arg in op.getarglist(): if arg.is_constant(): diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -115,7 +115,7 @@ return rffi.cast(lltype.Signed, c.value) def convert_to_imm(self, c): - val = self.convert_to_int(c) + #val = self.convert_to_int(c) return l.ImmLocation(val) def ensure_reg(self, box): @@ -134,9 +134,9 @@ self.temp_boxes.append(box) return reg - def ensure_even_odd_pair(self, var, bind_first=True): + def ensure_even_odd_pair(self, var, bind_first=True, must_exist=True): self._check_type(var) - prev_loc = self.loc(var, must_exist=True) + prev_loc = self.loc(var, must_exist=must_exist) var2 = TempVar() self.temp_boxes.append(var2) if prev_loc is self.frame_reg: @@ -262,6 +262,22 @@ raise NoVariableToSpill() return even, odd + def ensure_in_reg(self, var, reg): + """ opposed to ensure_reg, this loads the contents of the variable + directly into reg """ + if isinstance(var, ConstInt): + if -2**15 <= var.value and var.value <= 2*15-1: + self.assembler.mc.LGHI(reg, l.imm(var.value)) + elif -2**31 <= var.value and var.value <= 2*31-1: + self.assembler.mc.LGFI(reg, l.imm(var.value)) + else: + poolloc = self.ensure_reg(a1) + self.assembler.mc.LG(reg, poolloc) + else: + loc = self.loc(var, must_exist=True) + if loc is not reg: + self.assembler.regalloc_mov(loc, reg) + return reg def force_result_in_even_reg(self, result_v, loc, forbidden_vars=[]): pass @@ -415,7 +431,7 @@ return r.SPP else: # else, return a regular register (not SPP). - return self.force_allocate_reg(var) + return self.rm.force_allocate_reg(var) def walk_operations(self, inputargs, operations): from rpython.jit.backend.zarch.assembler import ( @@ -616,17 +632,17 @@ prepare_int_lshift = helper.prepare_int_shift prepare_uint_rshift = helper.prepare_int_shift - prepare_int_le = helper.prepare_cmp_op - prepare_int_lt = helper.prepare_cmp_op - prepare_int_ge = helper.prepare_cmp_op - prepare_int_gt = helper.prepare_cmp_op - prepare_int_eq = helper.prepare_cmp_op - prepare_int_ne = helper.prepare_cmp_op + prepare_int_le = helper.generate_cmp_op() + prepare_int_lt = helper.generate_cmp_op() + prepare_int_ge = helper.generate_cmp_op() + prepare_int_gt = helper.generate_cmp_op() + prepare_int_eq = helper.generate_cmp_op() + prepare_int_ne = helper.generate_cmp_op() - prepare_uint_le = helper.prepare_cmp_op - prepare_uint_lt = helper.prepare_cmp_op - prepare_uint_ge = helper.prepare_cmp_op - prepare_uint_gt = helper.prepare_cmp_op + prepare_uint_le = helper.generate_cmp_op(signed=False) + prepare_uint_lt = helper.generate_cmp_op(signed=False) + prepare_uint_ge = helper.generate_cmp_op(signed=False) + prepare_uint_gt = helper.generate_cmp_op(signed=False) prepare_int_is_zero = helper.prepare_unary_op prepare_int_is_true = helper.prepare_unary_op diff --git a/rpython/jit/backend/zarch/test/test_int.py b/rpython/jit/backend/zarch/test/test_int.py --- a/rpython/jit/backend/zarch/test/test_int.py +++ b/rpython/jit/backend/zarch/test/test_int.py @@ -19,96 +19,6 @@ cpu = CPU_S390_64(rtyper=None, stats=FakeStats()) cpu.setup_once() - @py.test.mark.parametrize('value,opcode,result', - [ (30,'i1 = int_mul(i0, 2)',60), - (30,'i1 = int_floordiv(i0, 2)',15), - (2**31,'i1 = int_floordiv(i0, 15)',2**31//15), - (0,'i1 = int_floordiv(i0, 1)', 0), - (1,'i1 = int_floordiv(i0, 1)', 1), - (0,'i1 = uint_floordiv(i0, 1)', 0), - (1,'i1 = uint_floordiv(i0, 1)', 1), - (30,'i1 = int_mod(i0, 2)', 0), - (1,'i1 = int_mod(i0, 2)', 1), - (1,'i1 = int_lshift(i0, 4)', 16), - (1,'i1 = int_lshift(i0, 0)', 1), - (4,'i1 = int_rshift(i0, 0)', 4), - (4,'i1 = int_rshift(i0, 1)', 2), - (-1,'i1 = int_rshift(i0, 0)', -1), - (-1,'i1 = int_lshift(i0, 1)', -2), - (-2**35,'i1 = int_lshift(i0, 1)', (-2**35)*2), - (2**64-1,'i1 = uint_rshift(i0, 2)', (2**64-1)//4), - (-1,'i1 = int_neg(i0)', -1), - (1,'i1 = int_neg(i0)', -1), - (2**63-1,'i1 = int_neg(i0)', -(2**63-1)), - (1,'i1 = int_invert(i0)', ~1), - (15,'i1 = int_invert(i0)', ~15), - (-1,'i1 = int_invert(i0)', ~(-1)), - (0,'i1 = int_is_zero(i0)', 1), - (50,'i1 = int_is_zero(i0)', 0), - (-1,'i1 = int_is_true(i0)', 1), - (0,'i1 = int_is_true(i0)', 0), - ]) - def test_int_arithmetic_and_logic(self, value, opcode, result): - loop = parse(""" - [i0] - {opcode} - finish(i1, descr=faildescr) - """.format(opcode=opcode),namespace={"faildescr": BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, value) - fail = self.cpu.get_latest_descr(deadframe) - res = self.cpu.get_int_value(deadframe, 0) - assert res == result - assert fail.identifier == 1 - - @py.test.mark.parametrize('value,opcode,result,guard', - [ (2**63-1,'i1 = int_add_ovf(i0, 1)',1,'guard_no_overflow'), - (2**63-2,'i1 = int_add_ovf(i0, 1)',0,'guard_no_overflow'), - (2**63-2,'i1 = int_add_ovf(i0, 1)',1,'guard_overflow'), - (2**63-1,'i1 = int_add_ovf(i0, 1)',0,'guard_overflow'), - - (-2**63, 'i1 = int_sub_ovf(i0, 1)',1,'guard_no_overflow'), - (-2**63+1,'i1 = int_sub_ovf(i0, 1)',0,'guard_no_overflow'), - (-2**63+1,'i1 = int_sub_ovf(i0, 1)',1,'guard_overflow'), - (-2**63, 'i1 = int_sub_ovf(i0, 1)',0,'guard_overflow'), - - (-2**63, 'i1 = int_mul_ovf(i0, 2)',1,'guard_no_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), - (-2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, 2)',0,'guard_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, -2)',0,'guard_overflow'), - (-2**63, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), - # positive! - (2**63-1, 'i1 = int_mul_ovf(i0, 33)',1,'guard_no_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, -2)',1,'guard_no_overflow'), - (2**15, 'i1 = int_mul_ovf(i0, 2)',0,'guard_no_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 0)',0,'guard_no_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 99)',0,'guard_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 3323881828381)',0,'guard_overflow'), - (2**63-1, 'i1 = int_mul_ovf(i0, 0)',1,'guard_overflow'), - ]) - def test_int_arithmetic_overflow(self, value, opcode, result, guard): - # result == 1 means branch has been taken of the guard - code = """ - [i0] - {opcode} - {guard}() [i0] - i2 = int_xor(i1,i1) - finish(i2, descr=faildescr) - """.format(opcode=opcode,guard=guard) - loop = parse(code, namespace={"faildescr": BasicFinalDescr(1)}) - looptoken = JitCellToken() - self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) - deadframe = self.cpu.execute_token(looptoken, value) - fail = self.cpu.get_latest_descr(deadframe) - res = self.cpu.get_int_value(deadframe, 0) - if result == 1: - assert res == value - else: - assert res == 0 - def test_double_evenodd_pair(self): code = """ [i0] From noreply at buildbot.pypy.org Wed Nov 18 09:26:48 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 15:26:48 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: ironed out a problem in prepare unary op Message-ID: <20151118142648.1A7D71C0ECB@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80756:7f5ca8a6eb21 Date: 2015-11-18 15:27 +0100 http://bitbucket.org/pypy/pypy/changeset/7f5ca8a6eb21/ Log: ironed out a problem in prepare unary op diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -114,25 +114,23 @@ #self.mc.AGR(lr, l1) def emit_int_invert(self, op, arglocs, regalloc): - l0, l1 = arglocs + l0, _ = arglocs assert not l0.is_imm() - self.mc.XG(l1, l.pool(self.pool.constant_64_ones)) - if l0 != l1: - self.mc.LGR(l0, l1) + self.mc.XG(l0, l.pool(self.pool.constant_64_ones)) def emit_int_neg(self, op, arglocs, regalloc): - l0, l1 = arglocs - self.mc.LCGR(l0, l1) + l0, _ = arglocs + self.mc.LCGR(l0, l0) def emit_int_is_zero(self, op, arglocs, regalloc): - l0, l1 = arglocs - self.mc.CGHI(l1, l.imm(0)) - self.flush_cc(c.EQ, l0) + l0, res = arglocs + self.mc.CGHI(l0, l.imm(0)) + self.flush_cc(c.EQ, res) def emit_int_is_true(self, op, arglocs, regalloc): - l0, l1 = arglocs + l0, res = arglocs self.mc.CGHI(l0, l.imm(0)) - self.flush_cc(c.NE, l0) + self.flush_cc(c.NE, res) emit_int_and = gen_emit_rr_or_rpool("NGR", "NG") emit_int_or = gen_emit_rr_or_rpool("OGR", "OG") diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -431,6 +431,8 @@ return r.SPP else: # else, return a regular register (not SPP). + if self.rm.reg_bindings.get(var, None) != None: + return self.rm.loc(var, must_exist=True) return self.rm.force_allocate_reg(var) def walk_operations(self, inputargs, operations): From noreply at buildbot.pypy.org Wed Nov 18 09:58:16 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 15:58:16 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: implemented signext, test_runner checking signext passes Message-ID: <20151118145816.E2DC41C1C61@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80757:d09527f603f6 Date: 2015-11-18 15:58 +0100 http://bitbucket.org/pypy/pypy/changeset/d09527f603f6/ Log: implemented signext, test_runner checking signext passes diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -152,7 +152,7 @@ self.free_op_vars() return [l0, l1] -def prepare_unary_op(self, op): +def prepare_unary_cmp(self, op): a0 = op.getarg(0) assert not isinstance(a0, ConstInt) l0 = self.ensure_reg(a0) @@ -160,3 +160,11 @@ res = self.force_allocate_reg_or_cc(op) self.free_op_vars() return [l0, res] + +def prepare_unary_op(self, op): + a0 = op.getarg(0) + assert not isinstance(a0, ConstInt) + l0 = self.ensure_reg(a0) + self.force_result_in_reg(op, a0) + self.free_op_vars() + return [l0] diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -129,6 +129,11 @@ 'LOCGR': ('rrf_c', ['\xB9','\xE2']), 'LOCG': ('rsy_b', ['\xEB','\xE2']), + # load for sign ext + 'LGBR': ('rre', ['\xB9','\x06']), + 'LGHR': ('rre', ['\xB9','\x07']), + 'LGFR': ('rre', ['\xB9','\x14']), + # store memory 'STMG': ('rsy_a', ['\xEB','\x24']), 'ST': ('rx', ['\x50']), diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -114,14 +114,26 @@ #self.mc.AGR(lr, l1) def emit_int_invert(self, op, arglocs, regalloc): - l0, _ = arglocs + l0 = arglocs assert not l0.is_imm() self.mc.XG(l0, l.pool(self.pool.constant_64_ones)) def emit_int_neg(self, op, arglocs, regalloc): - l0, _ = arglocs + l0 = arglocs self.mc.LCGR(l0, l0) + def emit_int_signext(self, op, arglocs, regalloc): + l0, = arglocs + extend_from = op.getarg(1).getint() + if extend_from == 1: + self.mc.LGBR(l0, l0) + elif extend_from == 2: + self.mc.LGHR(l0, l0) + elif extend_from == 4: + self.mc.LGFR(l0, l0) + else: + raise AssertionError(extend_from) + def emit_int_is_zero(self, op, arglocs, regalloc): l0, res = arglocs self.mc.CGHI(l0, l.imm(0)) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -646,10 +646,13 @@ prepare_uint_ge = helper.generate_cmp_op(signed=False) prepare_uint_gt = helper.generate_cmp_op(signed=False) - prepare_int_is_zero = helper.prepare_unary_op - prepare_int_is_true = helper.prepare_unary_op + prepare_int_is_zero = helper.prepare_unary_cmp + prepare_int_is_true = helper.prepare_unary_cmp + prepare_int_neg = helper.prepare_unary_op prepare_int_invert = helper.prepare_unary_op + prepare_int_signext = helper.prepare_unary_op + prepare_int_force_ge_zero = helper.prepare_unary_op From noreply at buildbot.pypy.org Wed Nov 18 10:22:35 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 16:22:35 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: implemented int_force_ge_zero using a jump over load zero if it is greater equal to zero Message-ID: <20151118152235.4DE801C12B4@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80758:2197df425dc5 Date: 2015-11-18 16:22 +0100 http://bitbucket.org/pypy/pypy/changeset/2197df425dc5/ Log: implemented int_force_ge_zero using a jump over load zero if it is greater equal to zero diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -134,6 +134,12 @@ else: raise AssertionError(extend_from) + def emit_int_force_ge_zero(self, op, arglocs, resloc): + l0, = arglocs + off = self.mc.CGIJ_byte_count + self.mc.LGHI_byte_count + self.mc.CGIJ(l0, l.imm(0), c.GE, l.imm(off)) + self.mc.LGHI(l0, l.imm(0)) + def emit_int_is_zero(self, op, arglocs, regalloc): l0, res = arglocs self.mc.CGHI(l0, l.imm(0)) From noreply at buildbot.pypy.org Wed Nov 18 10:48:40 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 18 Nov 2015 16:48:40 +0100 (CET) Subject: [pypy-commit] pypy default: implement a simple code callback Message-ID: <20151118154840.9DCF41C120B@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: Changeset: r80759:88e614bb406f Date: 2015-11-18 17:48 +0200 http://bitbucket.org/pypy/pypy/changeset/88e614bb406f/ Log: implement a simple code callback diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -391,6 +391,7 @@ self.check_signal_action = None # changed by the signal module self.user_del_action = UserDelAction(self) self._code_of_sys_exc_info = None + self._code_hook = None # can be overridden to a subclass self.initialize() @@ -1241,6 +1242,13 @@ self.setitem(w_globals, w_key, self.wrap(self.builtin)) return statement.exec_code(self, w_globals, w_locals) + def new_code_hook(self, w_code): + if self._code_hook is not None: + try: + self.call_function(self._code_hook, w_code) + except OperationError, e: + e.write_unraisable(self, "new_code_hook()") + def appexec(self, posargs_w, source): """ return value from executing given source at applevel. EXPERIMENTAL. The source must look like diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -86,6 +86,7 @@ self._signature = cpython_code_signature(self) self._initialize() self._init_ready() + self.space.new_code_hook(self) def _initialize(self): if self.co_cellvars: diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py --- a/pypy/module/__pypy__/__init__.py +++ b/pypy/module/__pypy__/__init__.py @@ -86,6 +86,7 @@ 'specialized_zip_2_lists' : 'interp_magic.specialized_zip_2_lists', 'set_debug' : 'interp_magic.set_debug', 'locals_to_fast' : 'interp_magic.locals_to_fast', + 'set_code_callback' : 'interp_magic.set_code_callback', 'save_module_content_for_future_reload': 'interp_magic.save_module_content_for_future_reload', } diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py --- a/pypy/module/__pypy__/interp_magic.py +++ b/pypy/module/__pypy__/interp_magic.py @@ -151,3 +151,9 @@ def specialized_zip_2_lists(space, w_list1, w_list2): from pypy.objspace.std.specialisedtupleobject import specialized_zip_2_lists return specialized_zip_2_lists(space, w_list1, w_list2) + +def set_code_callback(space, w_callable): + if space.is_none(w_callable): + space._code_hook = None + else: + space._code_hook = w_callable \ No newline at end of file diff --git a/pypy/module/__pypy__/test/test_magic.py b/pypy/module/__pypy__/test/test_magic.py --- a/pypy/module/__pypy__/test/test_magic.py +++ b/pypy/module/__pypy__/test/test_magic.py @@ -13,3 +13,21 @@ # sys.dont_write_bytecode = d __pypy__.save_module_content_for_future_reload(sys) + + def test_new_code_hook(self): + l = [] + + def callable(code): + l.append(code) + + import __pypy__ + __pypy__.set_code_callback(callable) + d = {} + try: + exec """ +def f(): + pass +""" in d + finally: + __pypy__.set_code_callback(None) + assert d['f'].__code__ in l \ No newline at end of file From noreply at buildbot.pypy.org Wed Nov 18 10:55:29 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 16:55:29 +0100 (CET) Subject: [pypy-commit] cffi static-callback: an XXX Message-ID: <20151118155529.9F09C1C12B4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: static-callback Changeset: r2417:dce52f75b925 Date: 2015-11-18 15:43 +0100 http://bitbucket.org/cffi/cffi/changeset/dce52f75b925/ Log: an XXX diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -91,6 +91,9 @@ */ save_errno(); +#error XXX subinterpreters! +#error should we make "externpy->reserved1" subinterpreter-local?? + if (externpy->reserved1 == NULL) { /* not initialized! */ fprintf(stderr, "extern \"Python\": function %s() called, " From noreply at buildbot.pypy.org Wed Nov 18 10:55:32 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 16:55:32 +0100 (CET) Subject: [pypy-commit] cffi release-1.3: merge default for release 1.3.1 Message-ID: <20151118155532.2AD1A1C12B4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: release-1.3 Changeset: r2418:9a35705472a8 Date: 2015-11-18 15:46 +0100 http://bitbucket.org/cffi/cffi/changeset/9a35705472a8/ Log: merge default for release 1.3.1 diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -5861,6 +5861,9 @@ (PyObject *)&CTypeDescr_Type); } +/* forward, in commontypes.c */ +static PyObject *b__get_common_types(PyObject *self, PyObject *arg); + static PyObject *b_gcp(PyObject *self, PyObject *args, PyObject *kwds) { CDataObject *cd; @@ -6187,6 +6190,7 @@ {"getwinerror", (PyCFunction)b_getwinerror, METH_VARARGS | METH_KEYWORDS}, #endif {"_get_types", b__get_types, METH_NOARGS}, + {"_get_common_types", b__get_common_types, METH_O}, {"_testfunc", b__testfunc, METH_VARARGS}, {"_testbuff", b__testbuff, METH_VARARGS}, {"_init_cffi_1_0_external_module", b_init_cffi_1_0_external_module, METH_O}, @@ -6447,7 +6451,7 @@ if (v == NULL || PyModule_AddObject(m, "_C_API", v) < 0) INITERROR; - v = PyText_FromString("1.3.0"); + v = PyText_FromString("1.3.1"); if (v == NULL || PyModule_AddObject(m, "__version__", v) < 0) INITERROR; diff --git a/c/cffi1_module.c b/c/cffi1_module.c --- a/c/cffi1_module.c +++ b/c/cffi1_module.c @@ -15,6 +15,7 @@ #include "cglob.c" #include "lib_obj.c" #include "cdlopen.c" +#include "commontypes.c" static int init_ffi_lib(PyObject *m) diff --git a/c/commontypes.c b/c/commontypes.c new file mode 100644 --- /dev/null +++ b/c/commontypes.c @@ -0,0 +1,215 @@ +/* This file must be kept in alphabetical order. See test_commontypes.py */ + +#define EQ(key, value) key "\0" value /* string concatenation */ +#ifdef _WIN64 +# define W32_64(X,Y) Y +# else +# define W32_64(X,Y) X +# endif + + +static const char *common_simple_types[] = { + +#ifdef MS_WIN32 /* Windows types */ + EQ("ATOM", "WORD"), + EQ("BOOL", "int"), + EQ("BOOLEAN", "BYTE"), + EQ("BYTE", "unsigned char"), + EQ("CCHAR", "char"), + EQ("CHAR", "char"), + EQ("COLORREF", "DWORD"), + EQ("DWORD", "unsigned long"), + EQ("DWORD32", "unsigned int"), + EQ("DWORD64", "unsigned long long"), + EQ("DWORDLONG", "ULONGLONG"), + EQ("DWORD_PTR", "ULONG_PTR"), +#endif + + EQ("FILE", "struct _IO_FILE"), + +#ifdef MS_WIN32 /* more Windows types */ + EQ("FLOAT", "float"), + EQ("HACCEL", "HANDLE"), + EQ("HALF_PTR", W32_64("short","int")), + EQ("HANDLE", "PVOID"), + EQ("HBITMAP", "HANDLE"), + EQ("HBRUSH", "HANDLE"), + EQ("HCOLORSPACE", "HANDLE"), + EQ("HCONV", "HANDLE"), + EQ("HCONVLIST", "HANDLE"), + EQ("HCURSOR", "HICON"), + EQ("HDC", "HANDLE"), + EQ("HDDEDATA", "HANDLE"), + EQ("HDESK", "HANDLE"), + EQ("HDROP", "HANDLE"), + EQ("HDWP", "HANDLE"), + EQ("HENHMETAFILE", "HANDLE"), + EQ("HFILE", "int"), + EQ("HFONT", "HANDLE"), + EQ("HGDIOBJ", "HANDLE"), + EQ("HGLOBAL", "HANDLE"), + EQ("HHOOK", "HANDLE"), + EQ("HICON", "HANDLE"), + EQ("HINSTANCE", "HANDLE"), + EQ("HKEY", "HANDLE"), + EQ("HKL", "HANDLE"), + EQ("HLOCAL", "HANDLE"), + EQ("HMENU", "HANDLE"), + EQ("HMETAFILE", "HANDLE"), + EQ("HMODULE", "HINSTANCE"), + EQ("HMONITOR", "HANDLE"), + EQ("HPALETTE", "HANDLE"), + EQ("HPEN", "HANDLE"), + EQ("HRESULT", "LONG"), + EQ("HRGN", "HANDLE"), + EQ("HRSRC", "HANDLE"), + EQ("HSZ", "HANDLE"), + EQ("HWND", "HANDLE"), + EQ("INT", "int"), + EQ("INT16", "short"), + EQ("INT32", "int"), + EQ("INT64", "long long"), + EQ("INT8", "signed char"), + EQ("INT_PTR", W32_64("int","long long")), + EQ("LANGID", "WORD"), + EQ("LCID", "DWORD"), + EQ("LCTYPE", "DWORD"), + EQ("LGRPID", "DWORD"), + EQ("LONG", "long"), + EQ("LONG32", "int"), + EQ("LONG64", "long long"), + EQ("LONGLONG", "long long"), + EQ("LONG_PTR", W32_64("long","long long")), + EQ("LPARAM", "LONG_PTR"), + EQ("LPBOOL", "BOOL *"), + EQ("LPBYTE", "BYTE *"), + EQ("LPCOLORREF", "DWORD *"), + EQ("LPCSTR", "const char *"), + EQ("LPCVOID", "const void *"), + EQ("LPCWSTR", "const WCHAR *"), + EQ("LPDWORD", "DWORD *"), + EQ("LPHANDLE", "HANDLE *"), + EQ("LPINT", "int *"), + EQ("LPLONG", "long *"), + EQ("LPSTR", "CHAR *"), + EQ("LPVOID", "void *"), + EQ("LPWORD", "WORD *"), + EQ("LPWSTR", "WCHAR *"), + EQ("LRESULT", "LONG_PTR"), + EQ("PBOOL", "BOOL *"), + EQ("PBOOLEAN", "BOOLEAN *"), + EQ("PBYTE", "BYTE *"), + EQ("PCHAR", "CHAR *"), + EQ("PCSTR", "const CHAR *"), + EQ("PCWSTR", "const WCHAR *"), + EQ("PDWORD", "DWORD *"), + EQ("PDWORD32", "DWORD32 *"), + EQ("PDWORD64", "DWORD64 *"), + EQ("PDWORDLONG", "DWORDLONG *"), + EQ("PDWORD_PTR", "DWORD_PTR *"), + EQ("PFLOAT", "FLOAT *"), + EQ("PHALF_PTR", "HALF_PTR *"), + EQ("PHANDLE", "HANDLE *"), + EQ("PHKEY", "HKEY *"), + EQ("PINT", "int *"), + EQ("PINT16", "INT16 *"), + EQ("PINT32", "INT32 *"), + EQ("PINT64", "INT64 *"), + EQ("PINT8", "INT8 *"), + EQ("PINT_PTR", "INT_PTR *"), + EQ("PLCID", "PDWORD"), + EQ("PLONG", "LONG *"), + EQ("PLONG32", "LONG32 *"), + EQ("PLONG64", "LONG64 *"), + EQ("PLONGLONG", "LONGLONG *"), + EQ("PLONG_PTR", "LONG_PTR *"), + EQ("PSHORT", "SHORT *"), + EQ("PSIZE_T", "SIZE_T *"), + EQ("PSSIZE_T", "SSIZE_T *"), + EQ("PSTR", "CHAR *"), + EQ("PUCHAR", "UCHAR *"), + EQ("PUHALF_PTR", "UHALF_PTR *"), + EQ("PUINT", "UINT *"), + EQ("PUINT16", "UINT16 *"), + EQ("PUINT32", "UINT32 *"), + EQ("PUINT64", "UINT64 *"), + EQ("PUINT8", "UINT8 *"), + EQ("PUINT_PTR", "UINT_PTR *"), + EQ("PULONG", "ULONG *"), + EQ("PULONG32", "ULONG32 *"), + EQ("PULONG64", "ULONG64 *"), + EQ("PULONGLONG", "ULONGLONG *"), + EQ("PULONG_PTR", "ULONG_PTR *"), + EQ("PUSHORT", "USHORT *"), + EQ("PVOID", "void *"), + EQ("PWCHAR", "WCHAR *"), + EQ("PWORD", "WORD *"), + EQ("PWSTR", "WCHAR *"), + EQ("QWORD", "unsigned long long"), + EQ("SC_HANDLE", "HANDLE"), + EQ("SC_LOCK", "LPVOID"), + EQ("SERVICE_STATUS_HANDLE", "HANDLE"), + EQ("SHORT", "short"), + EQ("SIZE_T", "ULONG_PTR"), + EQ("SSIZE_T", "LONG_PTR"), + EQ("UCHAR", "unsigned char"), + EQ("UHALF_PTR", W32_64("unsigned short","unsigned int")), + EQ("UINT", "unsigned int"), + EQ("UINT16", "unsigned short"), + EQ("UINT32", "unsigned int"), + EQ("UINT64", "unsigned long long"), + EQ("UINT8", "unsigned char"), + EQ("UINT_PTR", W32_64("unsigned int","unsigned long long")), + EQ("ULONG", "unsigned long"), + EQ("ULONG32", "unsigned int"), + EQ("ULONG64", "unsigned long long"), + EQ("ULONGLONG", "unsigned long long"), + EQ("ULONG_PTR", W32_64("unsigned long","unsigned long long")), + EQ("USHORT", "unsigned short"), + EQ("USN", "LONGLONG"), + EQ("VOID", "void"), + EQ("WCHAR", "wchar_t"), + EQ("WINSTA", "HANDLE"), + EQ("WORD", "unsigned short"), + EQ("WPARAM", "UINT_PTR"), +#endif + + EQ("bool", "_Bool"), +}; + + +#undef EQ +#undef W32_64 + +#define num_common_simple_types \ + (sizeof(common_simple_types) / sizeof(common_simple_types[0])) + + +static const char *get_common_type(const char *search, size_t search_len) +{ + const char *entry; + int index = search_sorted(common_simple_types, sizeof(const char *), + num_common_simple_types, search, search_len); + if (index < 0) + return NULL; + + entry = common_simple_types[index]; + return entry + strlen(entry) + 1; +} + +static PyObject *b__get_common_types(PyObject *self, PyObject *arg) +{ + int i, err; + for (i = 0; i < num_common_simple_types; i++) { + const char *s = common_simple_types[i]; + PyObject *o = PyText_FromString(s + strlen(s) + 1); + if (o == NULL) + return NULL; + err = PyDict_SetItemString(arg, s, o); + Py_DECREF(o); + if (err < 0) + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} diff --git a/c/ffi_obj.c b/c/ffi_obj.c --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -361,7 +361,19 @@ &PyTuple_GET_ITEM(allocator, 1)); } -PyDoc_STRVAR(ffi_new_allocator_doc, "XXX"); +PyDoc_STRVAR(ffi_new_allocator_doc, +"Return a new allocator, i.e. a function that behaves like ffi.new()\n" +"but uses the provided low-level 'alloc' and 'free' functions.\n" +"\n" +"'alloc' is called with the size as argument. If it returns NULL, a\n" +"MemoryError is raised. 'free' is called with the result of 'alloc'\n" +"as argument. Both can be either Python functions or directly C\n" +"functions. If 'free' is None, then no free function is called.\n" +"If both 'alloc' and 'free' are None, the default is used.\n" +"\n" +"If 'should_clear_after_alloc' is set to False, then the memory\n" +"returned by 'alloc' is assumed to be already cleared (or you are\n" +"fine with garbage); otherwise CFFI will clear it."); static PyObject *ffi_new_allocator(FFIObject *self, PyObject *args, PyObject *kwds) diff --git a/c/parse_c_type.c b/c/parse_c_type.c --- a/c/parse_c_type.c +++ b/c/parse_c_type.c @@ -220,6 +220,8 @@ #define MAX_SSIZE_T (((size_t)-1) >> 1) static int parse_complete(token_t *tok); +static const char *get_common_type(const char *search, size_t search_len); +static int parse_common_type_replacement(token_t *tok, const char *replacement); static int parse_sequel(token_t *tok, int outer) { @@ -442,26 +444,34 @@ return _CFFI_GETARG(result); } +static int search_sorted(const char *const *base, + size_t item_size, int array_len, + const char *search, size_t search_len) +{ + int left = 0, right = array_len; + const char *baseptr = (const char *)base; -#define MAKE_SEARCH_FUNC(FIELD) \ - static \ - int search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ - const char *search, size_t search_len) \ - { \ - int left = 0, right = ctx->num_##FIELD; \ - \ - while (left < right) { \ - int middle = (left + right) / 2; \ - const char *src = ctx->FIELD[middle].name; \ - int diff = strncmp(src, search, search_len); \ - if (diff == 0 && src[search_len] == '\0') \ - return middle; \ - else if (diff >= 0) \ - right = middle; \ - else \ - left = middle + 1; \ - } \ - return -1; \ + while (left < right) { + int middle = (left + right) / 2; + const char *src = *(const char *const *)(baseptr + middle * item_size); + int diff = strncmp(src, search, search_len); + if (diff == 0 && src[search_len] == '\0') + return middle; + else if (diff >= 0) + right = middle; + else + left = middle + 1; + } + return -1; +} + +#define MAKE_SEARCH_FUNC(FIELD) \ + static \ + int search_in_##FIELD(const struct _cffi_type_context_s *ctx, \ + const char *search, size_t search_len) \ + { \ + return search_sorted(&ctx->FIELD->name, sizeof(*ctx->FIELD), \ + ctx->num_##FIELD, search, search_len); \ } MAKE_SEARCH_FUNC(globals) @@ -715,6 +725,7 @@ break; case TOK_IDENTIFIER: { + const char *replacement; int n = search_in_typenames(tok->info->ctx, tok->p, tok->size); if (n >= 0) { t1 = _CFFI_OP(_CFFI_OP_TYPENAME, n); @@ -725,6 +736,14 @@ t1 = _CFFI_OP(_CFFI_OP_PRIMITIVE, n); break; } + replacement = get_common_type(tok->p, tok->size); + if (replacement != NULL) { + n = parse_common_type_replacement(tok, replacement); + if (n < 0) + return parse_error(tok, "internal error, please report!"); + t1 = _CFFI_OP(_CFFI_OP_NOOP, n); + break; + } return parse_error(tok, "undefined type name"); } case TOK_STRUCT: @@ -736,10 +755,15 @@ return parse_error(tok, "struct or union name expected"); n = search_in_struct_unions(tok->info->ctx, tok->p, tok->size); - if (n < 0) - return parse_error(tok, "undefined struct/union name"); - if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) != 0) - ^ (kind == TOK_UNION)) + if (n < 0) { + if (kind == TOK_STRUCT && tok->size == 8 && + !memcmp(tok->p, "_IO_FILE", 8)) + n = _CFFI__IO_FILE_STRUCT; + else + return parse_error(tok, "undefined struct/union name"); + } + else if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) + != 0) ^ (kind == TOK_UNION)) return parse_error(tok, "wrong kind of tag: struct vs union"); t1 = _CFFI_OP(_CFFI_OP_STRUCT_UNION, n); @@ -770,7 +794,8 @@ static -int parse_c_type(struct _cffi_parse_info_s *info, const char *input) +int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, + const char *input) { int result; token_t token; @@ -781,12 +806,26 @@ token.p = input; token.size = 0; token.output = info->output; - token.output_index = 0; + token.output_index = *output_index; next_token(&token); result = parse_complete(&token); + *output_index = token.output_index; if (token.kind != TOK_END) return parse_error(&token, "unexpected symbol"); return result; } + +static +int parse_c_type(struct _cffi_parse_info_s *info, const char *input) +{ + size_t output_index = 0; + return parse_c_type_from(info, &output_index, input); +} + +static +int parse_common_type_replacement(token_t *tok, const char *replacement) +{ + return parse_c_type_from(tok->info, &tok->output_index, replacement); +} diff --git a/c/realize_c_type.c b/c/realize_c_type.c --- a/c/realize_c_type.c +++ b/c/realize_c_type.c @@ -314,6 +314,16 @@ _cffi_opcode_t op2; const struct _cffi_struct_union_s *s; + if (sindex == _CFFI__IO_FILE_STRUCT) { + /* returns a single global cached opaque type */ + static PyObject *file_struct = NULL; + if (file_struct == NULL) + file_struct = new_struct_or_union_type("FILE", + CT_STRUCT | CT_IS_FILE); + Py_XINCREF(file_struct); + return file_struct; + } + s = &builder->ctx.struct_unions[sindex]; op2 = builder->ctx.types[s->type_index]; if ((((uintptr_t)op2) & 1) == 0) { @@ -330,9 +340,9 @@ (s->flags & _CFFI_F_UNION) ? "union " : "struct ", s->name); if (strcmp(name, "struct _IO_FILE") == 0) - flags |= CT_IS_FILE; - - x = new_struct_or_union_type(name, flags); + x = _realize_c_struct_or_union(builder, _CFFI__IO_FILE_STRUCT); + else + x = new_struct_or_union_type(name, flags); if (x == NULL) return NULL; diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -7,12 +7,12 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) _setup_path() from _cffi_backend import * -from _cffi_backend import _testfunc, _get_types, __version__ +from _cffi_backend import _testfunc, _get_types, _get_common_types, __version__ # ____________________________________________________________ import sys -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): @@ -3520,3 +3520,8 @@ assert repr(BFunc) == "" else: assert repr(BFunc) == "" + +def test_get_common_types(): + d = {} + _get_common_types(d) + assert d['bool'] == '_Bool' diff --git a/cffi/__init__.py b/cffi/__init__.py --- a/cffi/__init__.py +++ b/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/cffi/cffi_opcode.py b/cffi/cffi_opcode.py --- a/cffi/cffi_opcode.py +++ b/cffi/cffi_opcode.py @@ -110,6 +110,8 @@ _UNKNOWN_FLOAT_PRIM = -2 _UNKNOWN_LONG_DOUBLE = -3 +_IO_FILE_STRUCT = -1 + PRIMITIVE_TO_INDEX = { 'char': PRIM_CHAR, 'short': PRIM_SHORT, diff --git a/cffi/commontypes.py b/cffi/commontypes.py --- a/cffi/commontypes.py +++ b/cffi/commontypes.py @@ -2,10 +2,17 @@ from . import api, model -COMMON_TYPES = { - 'FILE': model.unknown_type('FILE', '_IO_FILE'), - 'bool': '_Bool', - } +COMMON_TYPES = {} + +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: if _type.endswith('_t'): @@ -14,212 +21,35 @@ _CACHE = {} -def resolve_common_type(commontype): +def resolve_common_type(parser, commontype): try: return _CACHE[commontype] except KeyError: - result = COMMON_TYPES.get(commontype, commontype) - if not isinstance(result, str): - pass # result is already a BaseType - elif result.endswith(' *'): - if result.startswith('const '): - result = model.ConstPointerType( - resolve_common_type(result[6:-2])) - else: - result = model.PointerType(resolve_common_type(result[:-2])) - elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES: - result = model.PrimitiveType(result) - elif result == 'set-unicode-needed': + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': raise api.FFIError("The Windows type %r is only available after " "you call ffi.set_unicode()" % (commontype,)) else: - if commontype == result: + if commontype == cdecl: raise api.FFIError("Unsupported type: %r. Please file a bug " "if you think it should be." % (commontype,)) - result = resolve_common_type(result) # recursively + result, quals = parser.parse_type_and_quals(cdecl) # recursive + assert isinstance(result, model.BaseTypeByIdentity) - _CACHE[commontype] = result - return result + _CACHE[commontype] = result, quals + return result, quals # ____________________________________________________________ -# Windows common types +# extra types for Windows (most of them are in commontypes.c) -def win_common_types(maxsize): - result = {} - if maxsize < (1<<32): - result.update({ # Windows 32-bits - 'HALF_PTR': 'short', - 'INT_PTR': 'int', - 'LONG_PTR': 'long', - 'UHALF_PTR': 'unsigned short', - 'UINT_PTR': 'unsigned int', - 'ULONG_PTR': 'unsigned long', - }) - else: - result.update({ # Windows 64-bits - 'HALF_PTR': 'int', - 'INT_PTR': 'long long', - 'LONG_PTR': 'long long', - 'UHALF_PTR': 'unsigned int', - 'UINT_PTR': 'unsigned long long', - 'ULONG_PTR': 'unsigned long long', - }) - result.update({ - "BYTE": "unsigned char", - "BOOL": "int", - "CCHAR": "char", - "CHAR": "char", - "DWORD": "unsigned long", - "DWORD32": "unsigned int", - "DWORD64": "unsigned long long", - "FLOAT": "float", - "INT": "int", - "INT8": "signed char", - "INT16": "short", - "INT32": "int", - "INT64": "long long", - "LONG": "long", - "LONGLONG": "long long", - "LONG32": "int", - "LONG64": "long long", - "WORD": "unsigned short", - "PVOID": model.voidp_type, - "ULONGLONG": "unsigned long long", - "WCHAR": "wchar_t", - "SHORT": "short", - "UCHAR": "unsigned char", - "UINT": "unsigned int", - "UINT8": "unsigned char", - "UINT16": "unsigned short", - "UINT32": "unsigned int", - "UINT64": "unsigned long long", - "ULONG": "unsigned long", - "ULONG32": "unsigned int", - "ULONG64": "unsigned long long", - "USHORT": "unsigned short", - - "SIZE_T": "ULONG_PTR", - "SSIZE_T": "LONG_PTR", - "ATOM": "WORD", - "BOOLEAN": "BYTE", - "COLORREF": "DWORD", - - "HANDLE": "PVOID", - "DWORDLONG": "ULONGLONG", - "DWORD_PTR": "ULONG_PTR", - "HACCEL": "HANDLE", - - "HBITMAP": "HANDLE", - "HBRUSH": "HANDLE", - "HCOLORSPACE": "HANDLE", - "HCONV": "HANDLE", - "HCONVLIST": "HANDLE", - "HDC": "HANDLE", - "HDDEDATA": "HANDLE", - "HDESK": "HANDLE", - "HDROP": "HANDLE", - "HDWP": "HANDLE", - "HENHMETAFILE": "HANDLE", - "HFILE": "int", - "HFONT": "HANDLE", - "HGDIOBJ": "HANDLE", - "HGLOBAL": "HANDLE", - "HHOOK": "HANDLE", - "HICON": "HANDLE", - "HCURSOR": "HICON", - "HINSTANCE": "HANDLE", - "HKEY": "HANDLE", - "HKL": "HANDLE", - "HLOCAL": "HANDLE", - "HMENU": "HANDLE", - "HMETAFILE": "HANDLE", - "HMODULE": "HINSTANCE", - "HMONITOR": "HANDLE", - "HPALETTE": "HANDLE", - "HPEN": "HANDLE", - "HRESULT": "LONG", - "HRGN": "HANDLE", - "HRSRC": "HANDLE", - "HSZ": "HANDLE", - "WINSTA": "HANDLE", - "HWND": "HANDLE", - - "LANGID": "WORD", - "LCID": "DWORD", - "LCTYPE": "DWORD", - "LGRPID": "DWORD", - "LPARAM": "LONG_PTR", - "LPBOOL": "BOOL *", - "LPBYTE": "BYTE *", - "LPCOLORREF": "DWORD *", - "LPCSTR": "const char *", - - "LPCVOID": model.const_voidp_type, - "LPCWSTR": "const WCHAR *", - "LPDWORD": "DWORD *", - "LPHANDLE": "HANDLE *", - "LPINT": "int *", - "LPLONG": "long *", - "LPSTR": "CHAR *", - "LPWSTR": "WCHAR *", - "LPVOID": model.voidp_type, - "LPWORD": "WORD *", - "LRESULT": "LONG_PTR", - "PBOOL": "BOOL *", - "PBOOLEAN": "BOOLEAN *", - "PBYTE": "BYTE *", - "PCHAR": "CHAR *", - "PCSTR": "const CHAR *", - "PCWSTR": "const WCHAR *", - "PDWORD": "DWORD *", - "PDWORDLONG": "DWORDLONG *", - "PDWORD_PTR": "DWORD_PTR *", - "PDWORD32": "DWORD32 *", - "PDWORD64": "DWORD64 *", - "PFLOAT": "FLOAT *", - "PHALF_PTR": "HALF_PTR *", - "PHANDLE": "HANDLE *", - "PHKEY": "HKEY *", - "PINT": "int *", - "PINT_PTR": "INT_PTR *", - "PINT8": "INT8 *", - "PINT16": "INT16 *", - "PINT32": "INT32 *", - "PINT64": "INT64 *", - "PLCID": "PDWORD", - "PLONG": "LONG *", - "PLONGLONG": "LONGLONG *", - "PLONG_PTR": "LONG_PTR *", - "PLONG32": "LONG32 *", - "PLONG64": "LONG64 *", - "PSHORT": "SHORT *", - "PSIZE_T": "SIZE_T *", - "PSSIZE_T": "SSIZE_T *", - "PSTR": "CHAR *", - "PUCHAR": "UCHAR *", - "PUHALF_PTR": "UHALF_PTR *", - "PUINT": "UINT *", - "PUINT_PTR": "UINT_PTR *", - "PUINT8": "UINT8 *", - "PUINT16": "UINT16 *", - "PUINT32": "UINT32 *", - "PUINT64": "UINT64 *", - "PULONG": "ULONG *", - "PULONGLONG": "ULONGLONG *", - "PULONG_PTR": "ULONG_PTR *", - "PULONG32": "ULONG32 *", - "PULONG64": "ULONG64 *", - "PUSHORT": "USHORT *", - "PWCHAR": "WCHAR *", - "PWORD": "WORD *", - "PWSTR": "WCHAR *", - "QWORD": "unsigned long long", - "SC_HANDLE": "HANDLE", - "SC_LOCK": "LPVOID", - "SERVICE_STATUS_HANDLE": "HANDLE", - +def win_common_types(): + return { "UNICODE_STRING": model.StructType( "_UNICODE_STRING", ["Length", @@ -232,10 +62,6 @@ "PUNICODE_STRING": "UNICODE_STRING *", "PCUNICODE_STRING": "const UNICODE_STRING *", - "USN": "LONGLONG", - "VOID": model.void_type, - "WPARAM": "UINT_PTR", - "TBYTE": "set-unicode-needed", "TCHAR": "set-unicode-needed", "LPCTSTR": "set-unicode-needed", @@ -244,9 +70,7 @@ "PTSTR": "set-unicode-needed", "PTBYTE": "set-unicode-needed", "PTCHAR": "set-unicode-needed", - }) - return result - + } if sys.platform == 'win32': - COMMON_TYPES.update(win_common_types(sys.maxsize)) + COMMON_TYPES.update(win_common_types()) diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -29,6 +29,8 @@ _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") _r_cdecl = re.compile(r"\b__cdecl\b") +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") def _get_parser(): global _parser_cache @@ -36,6 +38,48 @@ _parser_cache = pycparser.CParser() return _parser_cache +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + i = endpos + while i < len(csource): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + i += 1 + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + return ''.join(parts) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -47,6 +91,10 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) + # # BIG HACK: replace WINAPI or __stdcall with "volatile const". # It doesn't make sense for the return type of a function to be # "volatile volatile const", so we abuse it to detect __stdcall... @@ -320,13 +368,15 @@ self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] assert not macros exprnode = ast.ext[-1].type.args.params[0] if isinstance(exprnode, pycparser.c_ast.ID): raise api.CDefError("unknown identifier '%s'" % (exprnode.name,)) - tp, quals = self._get_type_and_quals(exprnode.type) - return tp + return self._get_type_and_quals(exprnode.type) def _declare(self, name, obj, included=False, quals=0): if name in self._declarations: @@ -348,6 +398,8 @@ pycparser.c_ast.PtrDecl)): if 'const' in type.quals: quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE if 'restrict' in type.quals: quals |= model.Q_RESTRICT return quals @@ -422,7 +474,8 @@ if ident == '__dotdotdot__': raise api.FFIError(':%d: bad usage of "..."' % typenode.coord.line) - return resolve_common_type(ident), quals + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) # if isinstance(type, pycparser.c_ast.Struct): # 'struct foobar' @@ -456,6 +509,13 @@ def _parse_function_type(self, typenode, funcname=None): params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise api.CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) ellipsis = ( len(params) > 0 and isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and diff --git a/cffi/model.py b/cffi/model.py --- a/cffi/model.py +++ b/cffi/model.py @@ -7,10 +7,13 @@ # type qualifiers Q_CONST = 0x01 Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 def qualify(quals, replace_with): if quals & Q_CONST: replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() if quals & Q_RESTRICT: # It seems that __restrict is supported by gcc and msvc. # If you hit some different compiler, add a #define in @@ -511,12 +514,17 @@ if self.baseinttype is not None: return self.baseinttype.get_cached_btype(ffi, finishlist) # + from . import api if self.enumvalues: smallest_value = min(self.enumvalues) largest_value = max(self.enumvalues) else: - smallest_value = 0 - largest_value = 0 + import warnings + warnings.warn("%r has no values explicitly defined; next version " + "will refuse to guess which integer type it is " + "meant to be (unsigned/signed, int/long)" + % self._get_c_name()) + smallest_value = largest_value = 0 if smallest_value < 0: # needs a signed type sign = 1 candidate1 = PrimitiveType("int") diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -83,6 +83,8 @@ #define _CFFI__UNKNOWN_FLOAT_PRIM (-2) #define _CFFI__UNKNOWN_LONG_DOUBLE (-3) +#define _CFFI__IO_FILE_STRUCT (-1) + struct _cffi_global_s { const char *name; diff --git a/doc/source/cdef.rst b/doc/source/cdef.rst --- a/doc/source/cdef.rst +++ b/doc/source/cdef.rst @@ -253,7 +253,7 @@ Usually, the right thing to do is to call this method with True. Be aware (particularly on Python 2) that, afterwards, you need to pass unicode -strings as arguments instead of not byte strings. (Before cffi version 0.9, +strings as arguments instead of byte strings. (Before cffi version 0.9, ``TCHAR`` and friends where hard-coded as unicode, but ``UNICODE`` was, inconsistently, not defined by default.) diff --git a/doc/source/conf.py b/doc/source/conf.py --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -47,7 +47,7 @@ # The short X.Y version. version = '1.3' # The full version, including alpha/beta/rc tags. -release = '1.3.0' +release = '1.3.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/installation.rst b/doc/source/installation.rst --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -51,11 +51,11 @@ Download and Installation: -* http://pypi.python.org/packages/source/c/cffi/cffi-1.3.0.tar.gz +* http://pypi.python.org/packages/source/c/cffi/cffi-1.3.1.tar.gz - - MD5: a40ed8c8ac653c8fc7d5603711b06eaf + - MD5: ... - - SHA: 54a0b2dbbc2f5d99131aa337e217b636652641a9 + - SHA: ... * Or grab the most current version from the `Bitbucket page`_: ``hg clone https://bitbucket.org/cffi/cffi`` diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -514,6 +514,16 @@ discouraged: using this a style, we are more likely to forget the callback object too early, when it is still in use. +.. warning:: + + **SELinux** requires that the setting ``deny_execmem`` is left to + its default setting of ``off`` to use callbacks. A fix in cffi was + attempted (see the ``ffi_closure_alloc`` branch), but this branch is + not merged because it creates potential memory corruption with + ``fork()``. For more information, `see here.`__ + +.. __: https://bugzilla.redhat.com/show_bug.cgi?id=1249685 + *New in version 1.2:* If you want to be sure to catch all exceptions, use ``ffi.callback(..., onerror=func)``. If an exception occurs and ``onerror`` is specified, then ``onerror(exception, exc_value, @@ -692,13 +702,16 @@ **ffi.from_buffer(python_buffer)**: return a ```` that points to the data of the given Python object, which must support the buffer interface. This is the opposite of ``ffi.buffer()``. It gives -a (read-write) reference to the existing data, not a copy; for this +a reference to the existing data, not a copy; for this reason, and for PyPy compatibility, it does not work with the built-in types str or unicode or bytearray (or buffers/memoryviews on them). It is meant to be used on objects containing large quantities of raw data, like ``array.array`` or numpy arrays. It supports both the old buffer API (in Python 2.x) and the -new memoryview API. The original object is kept alive (and, in case +new memoryview API. Note that if you pass a read-only buffer object, +you still get a regular ````; it is your responsibility +not to write there if the original buffer doesn't expect you to. +The original object is kept alive (and, in case of memoryview, locked) as long as the cdata object returned by ``ffi.from_buffer()`` is alive. *New in version 0.9.* diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst --- a/doc/source/whatsnew.rst +++ b/doc/source/whatsnew.rst @@ -3,6 +3,22 @@ ====================== +v1.3.1 +====== + +* The optional typedefs (``bool``, ``FILE`` and all Windows types) were + not always available from out-of-line FFI objects. + +* Opaque enums are phased out from the cdefs: they now give a warning, + instead of (possibly wrongly) being assumed equal to ``unsigned int``. + Please report if you get a reasonable use case for them. + +* Some parsing details, notably ``volatile`` is passed along like + ``const`` and ``restrict``. Also, older versions of pycparser + mis-parse some pointer-to-pointer types like ``char * const *``: the + "const" ends up at the wrong place. Added a workaround. + + v1.3.0 ====== diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -144,7 +144,7 @@ `Mailing list `_ """, - version='1.3.0', + version='1.3.1', packages=['cffi'] if cpython else [], package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h']} if cpython else {}, diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -756,10 +756,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 @@ -1334,7 +1335,8 @@ # these depend on user-defined data, so should not be shared assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo") assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*") - assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") + # the following test is an opaque enum, which we no longer support + #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo") # sanity check: twice 'ffi1' assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *") @@ -1346,6 +1348,17 @@ assert ffi.getctype("pe") == 'e *' assert ffi.getctype("e1*") == 'e1 *' + def test_opaque_enum(self): + ffi = FFI(backend=self.Backend()) + ffi.cdef("enum foo;") + from cffi import __version_info__ + if __version_info__ < (1, 4): + py.test.skip("re-enable me in version 1.4") + e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) + assert str(e.value) == ( + "'enum foo' has no values explicitly defined: refusing to guess " + "which integer type it is meant to be (unsigned/signed, int/long)") + def test_new_ctype(self): ffi = FFI(backend=self.Backend()) p = ffi.new("int *") diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py --- a/testing/cffi0/test_function.py +++ b/testing/cffi0/test_function.py @@ -486,7 +486,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -261,7 +261,8 @@ ffi = FFI() ffi.cdef("typedef int bool, *FILE;") assert repr(ffi.cast("bool", 123)) == "" - assert repr(ffi.cast("FILE", 123)) == "" + assert re.match(r"", + repr(ffi.cast("FILE", 123))) ffi = FFI() ffi.cdef("typedef bool (*fn_t)(bool, bool);") # "bool," but within "( )" @@ -272,6 +273,13 @@ ffi = FFI() ffi.cdef("typedef _Bool bool; void f(bool);") +def test_unknown_argument_type(): + ffi = FFI() + e = py.test.raises(CDefError, ffi.cdef, "void f(foobarbazzz);") + assert str(e.value) == ("f arg 1: unknown type 'foobarbazzz' (if you meant" + " to use the old C syntax of giving untyped" + " arguments, it is not supported)") + def test_void_renamed_as_only_arg(): ffi = FFI() ffi.cdef("typedef void void_t1;" @@ -279,38 +287,16 @@ "typedef int (*func_t)(void_t);") assert ffi.typeof("func_t").args == () -def test_win_common_types(): - from cffi.commontypes import COMMON_TYPES, _CACHE - from cffi.commontypes import win_common_types, resolve_common_type - # - def clear_all(extra={}, old_dict=COMMON_TYPES.copy()): - COMMON_TYPES.clear() - COMMON_TYPES.update(old_dict) - COMMON_TYPES.update(extra) - _CACHE.clear() - # - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - for key in sorted(ct): - if ct[key] != 'set-unicode-needed': - resolve_common_type(key) - # assert did not crash - # now try to use e.g. WPARAM (-> UINT_PTR -> unsigned 32/64-bit) - for maxsize in [2**32-1, 2**64-1]: - ct = win_common_types(maxsize) - clear_all(ct) - ffi = FFI() - value = int(ffi.cast("WPARAM", -1)) - assert value == maxsize - # - clear_all() - def test_WPARAM_on_windows(): if sys.platform != 'win32': py.test.skip("Only for Windows") ffi = FFI() ffi.cdef("void f(WPARAM);") + # + # WPARAM -> UINT_PTR -> unsigned 32/64-bit integer + ffi = FFI() + value = int(ffi.cast("WPARAM", -42)) + assert value == sys.maxsize * 2 - 40 def test__is_constant_globalvar(): for input, expected_output in [ @@ -360,6 +346,41 @@ assert lst[0] == lst[2] assert lst[1] == lst[3] +def test_const_pointer_to_pointer(): + from cffi import model + ffi = FFI(backend=FakeBackend()) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * (* const)") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * (* const (*))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char (* const (* (*)))") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals("char * * * const const") + assert (str(tp), qual) == ("", model.Q_CONST) + tp, qual = ffi._parser.parse_type_and_quals("char * * volatile *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char * volatile restrict * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("char const volatile * * *") + assert (str(tp), qual) == ("", 0) + tp, qual = ffi._parser.parse_type_and_quals("const char * * *") + assert (str(tp), qual) == ("", 0) + # + tp, qual = ffi._parser.parse_type_and_quals( + "int(char*const*, short****const*)") + assert (str(tp), qual) == ( + "", 0) + tp, qual = ffi._parser.parse_type_and_quals( + "char*const*(short*const****)") + assert (str(tp), qual) == ( + "", 0) + def test_enum(): ffi = FFI() ffi.cdef(""" diff --git a/testing/cffi1/test_commontypes.py b/testing/cffi1/test_commontypes.py new file mode 100644 --- /dev/null +++ b/testing/cffi1/test_commontypes.py @@ -0,0 +1,34 @@ +import py, os, cffi, re +import _cffi_backend + + +def getlines(): + try: + f = open(os.path.join(os.path.dirname(cffi.__file__), + '..', 'c', 'commontypes.c')) + except IOError: + py.test.skip("cannot find ../c/commontypes.c") + lines = [line for line in f.readlines() if line.strip().startswith('EQ(')] + f.close() + return lines + +def test_alphabetical_order(): + lines = getlines() + assert lines == sorted(lines) + +def test_dependencies(): + r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?') + lines = getlines() + d = {} + for line in lines: + match = r.search(line) + if match is not None: + d[match.group(1)] = match.group(2) + for value in d.values(): + if value: + assert value in d + +def test_get_common_types(): + d = {} + _cffi_backend._get_common_types(d) + assert d["bool"] == "_Bool" diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py --- a/testing/cffi1/test_ffi_obj.py +++ b/testing/cffi1/test_ffi_obj.py @@ -395,3 +395,23 @@ return ffi.NULL alloc5 = ffi.new_allocator(myalloc5) py.test.raises(MemoryError, alloc5, "int[5]") + +def test_bool_issue228(): + ffi = _cffi1_backend.FFI() + fntype = ffi.typeof("int(*callback)(bool is_valid)") + assert repr(fntype.args[0]) == "" + +def test_FILE_issue228(): + fntype1 = _cffi1_backend.FFI().typeof("FILE *") + fntype2 = _cffi1_backend.FFI().typeof("FILE *") + assert repr(fntype1) == "" + assert fntype1 is fntype2 + +def test_cast_from_int_type_to_bool(): + ffi = _cffi1_backend.FFI() + for basetype in ['char', 'short', 'int', 'long', 'long long']: + for sign in ['signed', 'unsigned']: + type = '%s %s' % (sign, basetype) + assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 + assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 diff --git a/testing/cffi1/test_new_ffi_1.py b/testing/cffi1/test_new_ffi_1.py --- a/testing/cffi1/test_new_ffi_1.py +++ b/testing/cffi1/test_new_ffi_1.py @@ -781,10 +781,11 @@ p = ffi.cast("long long", ffi.cast("wchar_t", -1)) if SIZE_OF_WCHAR == 2: # 2 bytes, unsigned assert int(p) == 0xffff - elif platform.machine().startswith(('arm', 'aarch64')): - assert int(p) == 0xffffffff # 4 bytes, unsigned - else: # 4 bytes, signed + elif (sys.platform.startswith('linux') and + platform.machine().startswith('x86')): # known to be signed assert int(p) == -1 + else: # in general, it can be either signed or not + assert int(p) in [-1, 0xffffffff] # e.g. on arm, both cases occur p = ffi.cast("int", u+'\u1234') assert int(p) == 0x1234 diff --git a/testing/cffi1/test_parse_c_type.py b/testing/cffi1/test_parse_c_type.py --- a/testing/cffi1/test_parse_c_type.py +++ b/testing/cffi1/test_parse_c_type.py @@ -19,8 +19,11 @@ ffi.cdef(header) lib = ffi.verify( - open(os.path.join(cffi_dir, '..', 'c', 'parse_c_type.c')).read(), - include_dirs=[cffi_dir]) + open(os.path.join(cffi_dir, '..', 'c', 'parse_c_type.c')).read() + """ +static const char *get_common_type(const char *search, size_t search_len) { + return NULL; +} +""", include_dirs=[cffi_dir]) class ParseError(Exception): pass diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1204,12 +1204,19 @@ assert foo_s.fields[1][1].type is ffi.typeof("void *") def test_restrict_fields(): - if sys.platform == 'win32': - py.test.skip("'__restrict__' probably not recognized") ffi = FFI() ffi.cdef("""struct foo_s { void * restrict b; };""") lib = verify(ffi, 'test_restrict_fields', """ - struct foo_s { void * __restrict__ b; };""") + struct foo_s { void * __restrict b; };""") + foo_s = ffi.typeof("struct foo_s") + assert foo_s.fields[0][0] == 'b' + assert foo_s.fields[0][1].type is ffi.typeof("void *") + +def test_volatile_fields(): + ffi = FFI() + ffi.cdef("""struct foo_s { void * volatile b; };""") + lib = verify(ffi, 'test_volatile_fields', """ + struct foo_s { void * volatile b; };""") foo_s = ffi.typeof("struct foo_s") assert foo_s.fields[0][0] == 'b' assert foo_s.fields[0][1].type is ffi.typeof("void *") diff --git a/testing/cffi1/test_verify1.py b/testing/cffi1/test_verify1.py --- a/testing/cffi1/test_verify1.py +++ b/testing/cffi1/test_verify1.py @@ -1494,15 +1494,6 @@ assert lib.foo(0) == 1 py.test.raises(TypeError, lib.foo, 0.0) -def test_cast_from_int_type_to_bool(): - ffi = FFI() - for basetype in ['char', 'short', 'int', 'long', 'long long']: - for sign in ['signed', 'unsigned']: - type = '%s %s' % (sign, basetype) - assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 - assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 - assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 - def test_addressof(): ffi = FFI() ffi.cdef(""" @@ -2250,3 +2241,31 @@ assert p == lib.myarray + 4 p[1] = 82 assert lib.my_value == 82 # [5] + +def test_const_pointer_to_pointer(): + ffi = FFI() + ffi.cdef("struct s { char *const *a; };") + ffi.verify("struct s { char *const *a; };") + +def test_share_FILE(): + ffi1 = FFI() + ffi1.cdef("void do_stuff(FILE *);") + lib1 = ffi1.verify("void do_stuff(FILE *f) { (void)f; }") + ffi2 = FFI() + ffi2.cdef("FILE *barize(void);") + lib2 = ffi2.verify("FILE *barize(void) { return NULL; }") + lib1.do_stuff(lib2.barize()) + +def test_win_common_types(): + if sys.platform != 'win32': + py.test.skip("Windows only") + ffi = FFI() + ffi.set_unicode(True) + ffi.verify("") + assert ffi.typeof("PBYTE") is ffi.typeof("unsigned char *") + if sys.maxsize > 2**32: + expected = "unsigned long long" + else: + expected = "unsigned int" + assert ffi.typeof("UINT_PTR") is ffi.typeof(expected) + assert ffi.typeof("PTSTR") is ffi.typeof("wchar_t *") From noreply at buildbot.pypy.org Wed Nov 18 10:55:34 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 18 Nov 2015 16:55:34 +0100 (CET) Subject: [pypy-commit] cffi release-1.3: md5/sha1 Message-ID: <20151118155534.289011C12B4@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: release-1.3 Changeset: r2419:0b4cc8cabeac Date: 2015-11-18 16:56 +0100 http://bitbucket.org/cffi/cffi/changeset/0b4cc8cabeac/ Log: md5/sha1 diff --git a/doc/source/installation.rst b/doc/source/installation.rst --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -53,9 +53,9 @@ * http://pypi.python.org/packages/source/c/cffi/cffi-1.3.1.tar.gz - - MD5: ... + - MD5: deeba7c1fd32a66f1db587988d760c11 - - SHA: ... + - SHA: a9a73358a0a22c18d301728f040cc380eb997dc1 * Or grab the most current version from the `Bitbucket page`_: ``hg clone https://bitbucket.org/cffi/cffi`` From noreply at buildbot.pypy.org Wed Nov 18 11:16:59 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 18 Nov 2015 17:16:59 +0100 (CET) Subject: [pypy-commit] pypy default: fix translation Message-ID: <20151118161659.5F8881C0400@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: Changeset: r80760:1f06b485fd84 Date: 2015-11-18 18:17 +0200 http://bitbucket.org/pypy/pypy/changeset/1f06b485fd84/ Log: fix translation diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -391,8 +391,7 @@ self.check_signal_action = None # changed by the signal module self.user_del_action = UserDelAction(self) self._code_of_sys_exc_info = None - self._code_hook = None - + # can be overridden to a subclass self.initialize() @@ -1242,13 +1241,6 @@ self.setitem(w_globals, w_key, self.wrap(self.builtin)) return statement.exec_code(self, w_globals, w_locals) - def new_code_hook(self, w_code): - if self._code_hook is not None: - try: - self.call_function(self._code_hook, w_code) - except OperationError, e: - e.write_unraisable(self, "new_code_hook()") - def appexec(self, posargs_w, source): """ return value from executing given source at applevel. EXPERIMENTAL. The source must look like diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -50,6 +50,9 @@ kwargname = varnames[argcount] if code.co_flags & CO_VARKEYWORDS else None return Signature(argnames, varargname, kwargname) +class CodeHookCache(object): + def __init__(self, space): + self._code_hook = None class PyCode(eval.Code): "CPython-style code objects." @@ -86,7 +89,15 @@ self._signature = cpython_code_signature(self) self._initialize() self._init_ready() - self.space.new_code_hook(self) + self.new_code_hook() + + def new_code_hook(self): + code_hook = self.space.fromcache(CodeHookCache)._code_hook + if code_hook is not None: + try: + self.space.call_function(code_hook, self) + except OperationError, e: + e.write_unraisable(self.space, "new_code_hook()") def _initialize(self): if self.co_cellvars: diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py --- a/pypy/module/__pypy__/interp_magic.py +++ b/pypy/module/__pypy__/interp_magic.py @@ -1,5 +1,6 @@ from pypy.interpreter.error import OperationError, wrap_oserror from pypy.interpreter.gateway import unwrap_spec +from pypy.interpreter.pycode import CodeHookCache from pypy.interpreter.pyframe import PyFrame from pypy.interpreter.mixedmodule import MixedModule from rpython.rlib.objectmodel import we_are_translated @@ -153,7 +154,8 @@ return specialized_zip_2_lists(space, w_list1, w_list2) def set_code_callback(space, w_callable): + cache = space.fromcache(CodeHookCache) if space.is_none(w_callable): - space._code_hook = None + cache._code_hook = None else: - space._code_hook = w_callable \ No newline at end of file + cache._code_hook = w_callable \ No newline at end of file From noreply at buildbot.pypy.org Wed Nov 18 11:31:28 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 18 Nov 2015 17:31:28 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: forgot to unpack arglocs (missing , ) Message-ID: <20151118163128.7ED6F1C1C61@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80761:f019dc0cb830 Date: 2015-11-18 17:31 +0100 http://bitbucket.org/pypy/pypy/changeset/f019dc0cb830/ Log: forgot to unpack arglocs (missing ,) diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -114,12 +114,12 @@ #self.mc.AGR(lr, l1) def emit_int_invert(self, op, arglocs, regalloc): - l0 = arglocs + l0, = arglocs assert not l0.is_imm() self.mc.XG(l0, l.pool(self.pool.constant_64_ones)) def emit_int_neg(self, op, arglocs, regalloc): - l0 = arglocs + l0, = arglocs self.mc.LCGR(l0, l0) def emit_int_signext(self, op, arglocs, regalloc): diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -825,8 +825,8 @@ for m in missing: print(" " * 4 + m) print - print("regalloc implements %.2f%% of all resops" % \ - (100.0 * implemented_count / total_count)) + print("regalloc implements %d of %d = %.2f%% of all resops" % \ + (implemented_count, total_count, (100.0 * implemented_count / total_count))) del implemented_count del total_count From noreply at buildbot.pypy.org Wed Nov 18 11:33:10 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 18 Nov 2015 17:33:10 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: fix the optimizer, which gets confused when we pass a virtual string to getarrayitem_gc Message-ID: <20151118163310.AA8FB1C1C61@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80762:4fb804c3e5fe Date: 2015-11-18 17:33 +0100 http://bitbucket.org/pypy/pypy/changeset/4fb804c3e5fe/ Log: fix the optimizer, which gets confused when we pass a virtual string to getarrayitem_gc diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -535,10 +535,14 @@ cf.do_setfield(self, op) def optimize_GETARRAYITEM_GC_I(self, op): + # When using str_storage_getitem we op.getarg(0) is a string, NOT an + # array. That's why we need to check for .is_array() before + # remembering the reads. There is no point in remembering it, as the + # box will be forced anyway by the optimizer arrayinfo = self.ensure_ptr_info_arg0(op) indexb = self.getintbound(op.getarg(1)) cf = None - if indexb.is_constant(): + if indexb.is_constant() and arrayinfo.is_array(): index = indexb.getint() arrayinfo.getlenbound(None).make_gt_const(index) # use the cache on (arraydescr, index), which is a constant @@ -555,7 +559,7 @@ self.make_nonnull(op.getarg(0)) self.emit_operation(op) # the remember the result of reading the array item - if cf is not None: + if cf is not None and arrayinfo.is_array(): arrayinfo.setitem(op.getdescr(), indexb.getint(), self.get_box_replacement(op.getarg(0)), self.get_box_replacement(op), cf, diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py --- a/rpython/jit/metainterp/optimizeopt/info.py +++ b/rpython/jit/metainterp/optimizeopt/info.py @@ -49,6 +49,9 @@ def is_null(self): return False + def is_array(self): + return False + def force_at_the_end_of_preamble(self, op, optforce, rec): if not self.is_virtual(): return optforce.get_box_replacement(op) @@ -478,6 +481,9 @@ self.lenbound = intutils.ConstIntBound(size) self._clear = clear + def is_array(self): + return True + def getlenbound(self, mode): from rpython.jit.metainterp.optimizeopt import intutils @@ -716,6 +722,9 @@ def is_virtual(self): return False + def is_array(self): + return True + def get_known_class(self, cpu): if not self._const.nonnull(): return None diff --git a/rpython/jit/metainterp/optimizeopt/virtualize.py b/rpython/jit/metainterp/optimizeopt/virtualize.py --- a/rpython/jit/metainterp/optimizeopt/virtualize.py +++ b/rpython/jit/metainterp/optimizeopt/virtualize.py @@ -271,8 +271,11 @@ self.emit_operation(op) def optimize_GETARRAYITEM_GC_I(self, op): + # When using str_storage_getitem we op.getarg(0) is a string, NOT an + # array, hence the check for is_array(). If it's a virtual but not an + # array (i.e., if it's a string) it will be forced. opinfo = self.getptrinfo(op.getarg(0)) - if opinfo and opinfo.is_virtual(): + if opinfo and opinfo.is_virtual() and opinfo.is_array(): indexbox = self.get_constant_box(op.getarg(1)) if indexbox is not None: item = opinfo.getitem(op.getdescr(), indexbox.getint()) diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py --- a/rpython/jit/metainterp/test/test_strstorage.py +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -1,5 +1,6 @@ import py -from rpython.rtyper.lltypesystem import lltype +import struct +from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.strstorage import str_storage_getitem from rpython.rlib.test.test_strstorage import BaseStrStorageTest from rpython.jit.codewriter import longlong @@ -26,3 +27,20 @@ # back! return longlong.int2singlefloat(res) return res + + + def test_force_virtual_str_storage(self): + size = rffi.sizeof(lltype.Signed) + def f(val): + x = chr(val) + '\x00'*(size-1) + return str_storage_getitem(lltype.Signed, x, 0) + res = self.interp_operations(f, [42], supports_singlefloats=True) + assert res == 42 + self.check_operations_history({ + 'newstr': 1, # str forcing + 'strsetitem': 1, # str forcing + 'call_pure_r': 1, # str forcing (copystrcontent) + 'guard_no_exception': 1, # str forcing + 'getarrayitem_gc_i': 1, # str_storage_getitem + 'finish': 1 + }) From noreply at buildbot.pypy.org Wed Nov 18 11:43:55 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 18 Nov 2015 17:43:55 +0100 (CET) Subject: [pypy-commit] pypy anntype: Improve exception analysis. Message-ID: <20151118164355.B8F701C120B@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80763:da3a7fd425fb Date: 2015-11-18 16:44 +0000 http://bitbucket.org/pypy/pypy/changeset/da3a7fd425fb/ Log: Improve exception analysis. Reframe except clause handling in terms of annotations. diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -10,7 +10,8 @@ from rpython.flowspace.model import Variable, Constant, checkgraph from rpython.translator import simplify, transform from rpython.annotator import model as annmodel, signature -from rpython.annotator.model import SomeTypeOf +from rpython.annotator.model import ( + SomeTypeOf, SomeException, s_ImpossibleValue) from rpython.annotator.bookkeeper import Bookkeeper from rpython.rtyper.normalizecalls import perform_normalizations @@ -210,7 +211,7 @@ for graph in newgraphs: v = graph.getreturnvar() if v.annotation is None: - self.setbinding(v, annmodel.s_ImpossibleValue) + self.setbinding(v, s_ImpossibleValue) def validate(self): """Check that the annotation results are valid""" @@ -282,7 +283,7 @@ except KeyError: # the function didn't reach any return statement so far. # (some functions actually never do, they always raise exceptions) - return annmodel.s_ImpossibleValue + return s_ImpossibleValue def reflowfromposition(self, position_key): graph, block, index = position_key @@ -493,15 +494,21 @@ # filter out those exceptions which cannot # occur for this specific, typed operation. candidates = can_only_throw + s_exception = SomeException(set(can_only_throw)) for link in exits: case = link.exitcase + s_case = SomeException({case}) if case is None: self.follow_link(graph, link, {}) continue - covered = [c for c in candidates if issubclass(c, case)] - if covered: - self.follow_raise_link(graph, link, {}) - candidates = [c for c in candidates if c not in covered] + if s_exception == s_ImpossibleValue: + break + s_matching_exc = s_exception.intersection(s_case) + if s_matching_exc != s_ImpossibleValue: + self.follow_raise_link(graph, link, + constraints={link.last_exc_value: + s_matching_exc.as_SomeInstance(self.bookkeeper)}) + s_exception = s_exception.difference(s_case) else: for link in exits: if link.exitcase is None: @@ -543,7 +550,7 @@ s_constraint = constraints[v_out] s_out = pair(s_out, s_constraint).improve() # ignore links that try to pass impossible values - if s_out == annmodel.s_ImpossibleValue: + if s_out == s_ImpossibleValue: ignore_link = True s_out = self.apply_renaming(s_out, renaming) inputs_s.append(s_out) @@ -588,7 +595,7 @@ s_constraint = constraints[v_out] s_out = pair(s_out, s_constraint).improve() # ignore links that try to pass impossible values - if s_out == annmodel.s_ImpossibleValue: + if s_out == s_ImpossibleValue: ignore_link = True s_out = self.apply_renaming(s_out, renaming) inputs_s.append(s_out) @@ -612,8 +619,8 @@ raise BlockedInference(self, op, -1) resultcell = op.consider(self) if resultcell is None: - resultcell = annmodel.s_ImpossibleValue - elif resultcell == annmodel.s_ImpossibleValue: + resultcell = s_ImpossibleValue + elif resultcell == s_ImpossibleValue: raise BlockedInference(self, op, -1) # the operation cannot succeed assert isinstance(resultcell, annmodel.SomeObject) assert isinstance(op.result, Variable) diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -445,6 +445,29 @@ def noneify(self): return SomeInstance(self.classdef, can_be_None=True) +class SomeException(SomeObject): + def __init__(self, classes): + self.classes = classes + + def intersection(self, other): + classes = {c for c in self.classes + if any(issubclass(c, c2) for c2 in other.classes)} + if classes: + return SomeException(classes) + else: + return s_ImpossibleValue + + def difference(self, other): + classes = {c for c in self.classes + if not any(issubclass(c, c2) for c2 in other.classes)} + if classes: + return SomeException(classes) + else: + return s_ImpossibleValue + + def as_SomeInstance(self, bk): + return unionof(*[bk.valueoftype(cls) for cls in self.classes]) + class SomePBC(SomeObject): """Stands for a global user instance, built prior to the analysis, diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -698,6 +698,19 @@ s = a.build_types(snippet.exc_deduction_our_excs_plus_others, []) assert isinstance(s, annmodel.SomeInteger) + def test_method_exception_specialization(self): + def f(l): + try: + return l.pop() + except Exception: + raise + a = self.RPythonAnnotator() + s = a.build_types(f, [[int]]) + graph = graphof(a, f) + etype, evalue = graph.exceptblock.inputargs + assert evalue.annotation.classdef.shortname == 'IndexError' + #assert etype.const == IndexError + def test_operation_always_raising(self): def operation_always_raising(n): lst = [] From noreply at buildbot.pypy.org Wed Nov 18 13:19:52 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 18 Nov 2015 19:19:52 +0100 (CET) Subject: [pypy-commit] pypy anntype: Add SomeExceptCase and clarify the meaning of SomeException Message-ID: <20151118181952.497721C12B4@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80764:4bf6d2c87b5c Date: 2015-11-18 18:20 +0000 http://bitbucket.org/pypy/pypy/changeset/4bf6d2c87b5c/ Log: Add SomeExceptCase and clarify the meaning of SomeException diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -11,7 +11,7 @@ from rpython.translator import simplify, transform from rpython.annotator import model as annmodel, signature from rpython.annotator.model import ( - SomeTypeOf, SomeException, s_ImpossibleValue) + SomeTypeOf, SomeException, SomeExceptCase, s_ImpossibleValue) from rpython.annotator.bookkeeper import Bookkeeper from rpython.rtyper.normalizecalls import perform_normalizations @@ -497,7 +497,7 @@ s_exception = SomeException(set(can_only_throw)) for link in exits: case = link.exitcase - s_case = SomeException({case}) + s_case = SomeExceptCase(case) if case is None: self.follow_link(graph, link, {}) continue diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -446,20 +446,21 @@ return SomeInstance(self.classdef, can_be_None=True) class SomeException(SomeObject): + """The set of exceptions obeying type(exc) in self.classes""" def __init__(self, classes): self.classes = classes def intersection(self, other): - classes = {c for c in self.classes - if any(issubclass(c, c2) for c2 in other.classes)} + assert isinstance(other, SomeExceptCase) + classes = {c for c in self.classes if issubclass(c, other.case)} if classes: return SomeException(classes) else: return s_ImpossibleValue def difference(self, other): - classes = {c for c in self.classes - if not any(issubclass(c, c2) for c2 in other.classes)} + assert isinstance(other, SomeExceptCase) + classes = {c for c in self.classes if not issubclass(c, other.case)} if classes: return SomeException(classes) else: @@ -469,6 +470,15 @@ return unionof(*[bk.valueoftype(cls) for cls in self.classes]) +class SomeExceptCase(SomeObject): + """The set of exceptions that match a given except clause. + + IOW, the set of exceptions that verify isinstance(exc, self.case). + """ + def __init__(self, case): + self.case = case + + class SomePBC(SomeObject): """Stands for a global user instance, built prior to the analysis, or a set of such instances.""" From noreply at buildbot.pypy.org Wed Nov 18 15:10:40 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 18 Nov 2015 21:10:40 +0100 (CET) Subject: [pypy-commit] pypy anntype: Completely move is_type_of attribute from SomeType to SomeTypeOf Message-ID: <20151118201040.D00AA1C0400@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80765:37f7ff034ec7 Date: 2015-11-18 20:11 +0000 http://bitbucket.org/pypy/pypy/changeset/37f7ff034ec7/ Log: Completely move is_type_of attribute from SomeType to SomeTypeOf diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -11,7 +11,7 @@ from rpython.translator import simplify, transform from rpython.annotator import model as annmodel, signature from rpython.annotator.model import ( - SomeTypeOf, SomeException, SomeExceptCase, s_ImpossibleValue) + typeof, SomeTypeOf, SomeException, SomeExceptCase, s_ImpossibleValue) from rpython.annotator.bookkeeper import Bookkeeper from rpython.rtyper.normalizecalls import perform_normalizations @@ -395,11 +395,10 @@ for v in s_out.is_type_of: renamed_is_type_of += renaming[v] assert s_out.knowntype is type - newcell = annmodel.SomeType() + newcell = typeof(renamed_is_type_of) if s_out.is_constant(): newcell.const = s_out.const s_out = newcell - s_out.is_type_of = renamed_is_type_of if hasattr(s_out, 'knowntypedata'): renamed_knowntypedata = {} @@ -573,7 +572,7 @@ self.setbinding(v_last_exc_value, s_last_exc_value) if isinstance(v_last_exc_type, Variable): - self.setbinding(v_last_exc_type, SomeTypeOf(v_last_exc_value)) + self.setbinding(v_last_exc_type, SomeTypeOf([v_last_exc_value])) ignore_link = False @@ -584,8 +583,7 @@ for v_out, v_input in zip(link.args, link.target.inputargs): if v_out == v_last_exc_type: - s_out = annmodel.SomeType() - s_out.is_type_of = renaming[v_last_exc_value] + s_out = typeof(renaming[v_last_exc_value]) if isinstance(v_last_exc_type, Constant): s_out.const = v_last_exc_type.value inputs_s.append(s_out) diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -146,25 +146,18 @@ def union((obj1, obj2)): result = SomeType() - is_type_of1 = getattr(obj1, 'is_type_of', []) - is_type_of2 = getattr(obj2, 'is_type_of', []) if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const: result.const = obj1.const - if is_type_of1 and is_type_of1 == is_type_of2: - result.is_type_of = is_type_of1 return result class __extend__(pairtype(SomeTypeOf, SomeTypeOf)): def union((s_obj1, s_obj2)): - if s_obj1 == s_obj2: - return s_obj1 - else: - s_1 = SomeType() - s_1.is_type_of = s_obj1.is_type_of - s_2 = SomeType() - s_2.is_type_of = s_obj2.is_type_of - return unionof(s_1, s_2) - + vars = list(set(s_obj1.is_type_of) | set(s_obj2.is_type_of)) + result = SomeTypeOf(vars) + if (s_obj1.is_immutable_constant() and s_obj2.is_immutable_constant() + and s_obj1.const == s_obj2.const): + result.const = obj1.const + return result # cloning a function with identical code, for the can_only_throw attribute def _clone(f, can_only_throw = None): diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -140,12 +140,17 @@ class SomeTypeOf(SomeType): """The type of a variable""" - def __init__(self, v_arg): - self.v_arg = v_arg + def __init__(self, args_v): + assert isinstance(args_v, list) + assert args_v + self.is_type_of = args_v - @property - def is_type_of(self): - return [self.v_arg] +def typeof(args_v): + if args_v: + return SomeTypeOf(args_v) + else: + return SomeType() + class SomeFloat(SomeObject): "Stands for a float or an integer." diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -709,7 +709,7 @@ graph = graphof(a, f) etype, evalue = graph.exceptblock.inputargs assert evalue.annotation.classdef.shortname == 'IndexError' - #assert etype.const == IndexError + #assert etype.annotation.const == IndexError def test_operation_always_raising(self): def operation_always_raising(n): @@ -1389,11 +1389,12 @@ a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)]) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() + t = annmodel.SomeTypeOf([ev]) t.const = KeyError - t.is_type_of = [ev] - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError) + assert et.annotation == t + s_ev = ev.annotation + assert (isinstance(s_ev, annmodel.SomeInstance) and + s_ev.classdef == a.bookkeeper.getuniqueclassdef(KeyError)) def test_reraiseAnything(self): def f(dic): @@ -1405,11 +1406,12 @@ a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)]) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() - t.is_type_of = [ev] - t.const = KeyError # IndexError ignored because 'dic' is a dict - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError) + t = annmodel.SomeTypeOf([ev]) + t.const = KeyError # IndexError ignored because 'dic' is a dict + assert et.annotation == t + s_ev = ev.annotation + assert (isinstance(s_ev, annmodel.SomeInstance) and + s_ev.classdef == a.bookkeeper.getuniqueclassdef(KeyError)) def test_exception_mixing(self): def h(): @@ -1440,10 +1442,11 @@ a.build_types(f, [int, somelist(annmodel.s_Int)]) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() - t.is_type_of = [ev] - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception) + t = annmodel.SomeTypeOf([ev]) + assert et.annotation == t + s_ev = ev.annotation + assert (isinstance(s_ev, annmodel.SomeInstance) and + s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception)) def test_try_except_raise_finally1(self): def h(): pass @@ -1462,10 +1465,11 @@ a.build_types(f, []) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() - t.is_type_of = [ev] - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception) + t = annmodel.SomeTypeOf([ev]) + assert et.annotation == t + s_ev = ev.annotation + assert (isinstance(s_ev, annmodel.SomeInstance) and + s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception)) def test_inplace_div(self): def f(n): diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -30,7 +30,7 @@ @op.type.register(SomeObject) def type_SomeObject(annotator, v_arg): - return SomeTypeOf(v_arg) + return SomeTypeOf([v_arg]) @op.bool.register(SomeObject) diff --git a/rpython/translator/goal/query.py b/rpython/translator/goal/query.py --- a/rpython/translator/goal/query.py +++ b/rpython/translator/goal/query.py @@ -48,7 +48,7 @@ s_ev = annotator.annotation(ev) if s_et: if s_et.knowntype == type: - if s_et.__class__ == annmodel.SomeType: + if s_et.__class__ == annmodel.SomeTypeOf: if hasattr(s_et, 'is_type_of') and s_et.is_type_of == [ev]: continue else: diff --git a/rpython/translator/transform.py b/rpython/translator/transform.py --- a/rpython/translator/transform.py +++ b/rpython/translator/transform.py @@ -189,8 +189,7 @@ self.links_followed[errlink] = True # fix the annotation of the exceptblock.inputargs etype, evalue = graph.exceptblock.inputargs - s_type = annmodel.SomeType() - s_type.is_type_of = [evalue] + s_type = annmodel.SomeTypeOf([evalue]) s_value = annmodel.SomeInstance(self.bookkeeper.getuniqueclassdef(Exception)) self.setbinding(etype, s_type) self.setbinding(evalue, s_value) From noreply at buildbot.pypy.org Wed Nov 18 15:27:34 2015 From: noreply at buildbot.pypy.org (mattip) Date: Wed, 18 Nov 2015 21:27:34 +0100 (CET) Subject: [pypy-commit] pypy numpy-1.10: reflect the current status of boolean indexing in tests Message-ID: <20151118202734.EF8871C0400@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: numpy-1.10 Changeset: r80766:13cd949305f6 Date: 2015-11-16 22:06 +0200 http://bitbucket.org/pypy/pypy/changeset/13cd949305f6/ Log: reflect the current status of boolean indexing in tests diff --git a/pypy/module/micronumpy/test/test_deprecations.py b/pypy/module/micronumpy/test/test_deprecations.py --- a/pypy/module/micronumpy/test/test_deprecations.py +++ b/pypy/module/micronumpy/test/test_deprecations.py @@ -9,23 +9,25 @@ def test_getitem(self): import numpy as np - import warnings + import warnings, sys warnings.simplefilter('error', np.VisibleDeprecationWarning) try: arr = np.ones((5, 4, 3)) index = np.array([True]) - #self.assert_deprecated(arr.__getitem__, args=(index,)) raises(np.VisibleDeprecationWarning, arr.__getitem__, index) index = np.array([False] * 6) - #self.assert_deprecated(arr.__getitem__, args=(index,)) raises(np.VisibleDeprecationWarning, arr.__getitem__, index) index = np.zeros((4, 4), dtype=bool) - #self.assert_deprecated(arr.__getitem__, args=(index,)) - raises(np.VisibleDeprecationWarning, arr.__getitem__, index) - #self.assert_deprecated(arr.__getitem__, args=((slice(None), index),)) - raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index)) + if '__pypy__' in sys.builtin_module_names: + # boolean indexing matches the dims in index + # to the first index.ndims in arr, not implemented in pypy yet + raises(IndexError, arr.__getitem__, index) + raises(TypeError, arr.__getitem__, (slice(None), index)) + else: + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index)) finally: warnings.simplefilter('default', np.VisibleDeprecationWarning) From noreply at buildbot.pypy.org Wed Nov 18 15:27:37 2015 From: noreply at buildbot.pypy.org (mattip) Date: Wed, 18 Nov 2015 21:27:37 +0100 (CET) Subject: [pypy-commit] pypy default: Added tag release-4.0.1 for changeset 5f8302b8bf9f Message-ID: <20151118202737.1B7501C0400@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80767:c684edd31da8 Date: 2015-11-18 22:26 +0200 http://bitbucket.org/pypy/pypy/changeset/c684edd31da8/ Log: Added tag release-4.0.1 for changeset 5f8302b8bf9f diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -17,3 +17,4 @@ 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 +5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1 From noreply at buildbot.pypy.org Wed Nov 18 18:28:54 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 19 Nov 2015 00:28:54 +0100 (CET) Subject: [pypy-commit] pypy anntype: Use an annotator fixture in test_model.py Message-ID: <20151118232854.CD7D31C1279@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80768:a9885feba211 Date: 2015-11-18 23:30 +0000 http://bitbucket.org/pypy/pypy/changeset/a9885feba211/ Log: Use an annotator fixture in test_model.py diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py --- a/rpython/annotator/test/test_model.py +++ b/rpython/annotator/test/test_model.py @@ -1,9 +1,14 @@ -import py +import pytest from rpython.annotator.model import * from rpython.annotator.listdef import ListDef from rpython.translator.translator import TranslationContext + at pytest.fixture() +def annotator(): + t = TranslationContext() + return t.buildannotator() + listdef1 = ListDef(None, SomeTuple([SomeInteger(nonneg=True), SomeString()])) listdef2 = ListDef(None, SomeTuple([SomeInteger(nonneg=False), SomeString()])) @@ -100,19 +105,21 @@ class AAA(object): pass -def test_blocked_inference1(): +def test_blocked_inference1(annotator): def blocked_inference(): return AAA().m() - py.test.raises(AnnotatorError, compile_function, blocked_inference) + with pytest.raises(AnnotatorError): + annotator.build_types(blocked_inference, []) -def test_blocked_inference2(): +def test_blocked_inference2(annotator): def blocked_inference(): a = AAA() b = a.x return b - py.test.raises(AnnotatorError, compile_function, blocked_inference) + with pytest.raises(AnnotatorError): + annotator.build_types(blocked_inference, []) def test_not_const(): From noreply at buildbot.pypy.org Thu Nov 19 04:21:41 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 19 Nov 2015 10:21:41 +0100 (CET) Subject: [pypy-commit] buildbot default: fix link from root page Message-ID: <20151119092141.C83001C0EB1@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r970:9245fb217688 Date: 2015-11-19 10:22 +0100 http://bitbucket.org/pypy/buildbot/changeset/9245fb217688/ Log: fix link from root page diff --git a/master/templates/root.html b/master/templates/root.html --- a/master/templates/root.html +++ b/master/templates/root.html @@ -28,9 +28,9 @@
  • - The Summary Display - <default> will give you a failure-oriented summary for recent - revisions (<default> only). + The Summary Display + <trunk> will give you a failure-oriented summary for recent + revisions (excluding branches).
  • From noreply at buildbot.pypy.org Thu Nov 19 05:28:06 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 19 Nov 2015 11:28:06 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added assembler regalloc/instructions for int_to_float (+ inverse) and int_to_ptr (+ inverse). test_runner.py passing 4 more tests Message-ID: <20151119102806.7DD0F1C0EB1@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80769:fff20ae97c0f Date: 2015-11-19 11:28 +0100 http://bitbucket.org/pypy/pypy/changeset/fff20ae97c0f/ Log: added assembler regalloc/instructions for int_to_float (+ inverse) and int_to_ptr (+ inverse). test_runner.py passing 4 more tests diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -15,7 +15,7 @@ RECOVERY_TARGET_POOL_OFFSET, JUMPABS_TARGET_ADDR__POOL_OFFSET, JUMPABS_POOL_ADDR_POOL_OFFSET) from rpython.jit.backend.zarch.opassembler import (IntOpAssembler, - FloatOpAssembler, GuardOpAssembler) + FloatOpAssembler, GuardOpAssembler, MiscOpAssembler) from rpython.jit.backend.zarch.regalloc import Regalloc from rpython.jit.metainterp.resoperation import rop from rpython.rlib.debug import (debug_print, debug_start, debug_stop, @@ -31,7 +31,7 @@ class AssemblerZARCH(BaseAssembler, IntOpAssembler, FloatOpAssembler, - GuardOpAssembler): + GuardOpAssembler, MiscOpAssembler): def __init__(self, cpu, translate_support_code=False): BaseAssembler.__init__(self, cpu, translate_support_code) diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -147,12 +147,15 @@ def load_imm(self, dest_reg, word): - if word <= 32767 and word >= -32768: + if -32768 <= word <= 32767: self.LGHI(dest_reg, l.imm(word)) - elif word <= 2**31-1 and word >= -2**31: + elif -2**31 <= word <= 2**31-1: self.LGFI(dest_reg, l.imm(word)) else: - xxx + # this is not put into the constant pool, because it + # is an immediate value that cannot easily be estimated + self.LGFI(dest_reg, l.imm(word & 0xFFFFffff)) + self.IIHF(dest_reg, l.imm((word >> 32) & 0xFFFFffff)) _classes = (AbstractZARCHBuilder,) diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py --- a/rpython/jit/backend/zarch/conditions.py +++ b/rpython/jit/backend/zarch/conditions.py @@ -12,6 +12,8 @@ NO = loc.imm(0xe) # NO overflow ANY = loc.imm(0xf) +FP_CUTOFF = loc.imm(0x1) # 4.4 => 4, 4.5 => 4 + cond_none = loc.imm(0x0) @specialize.arg(1) diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -165,6 +165,14 @@ a0 = op.getarg(0) assert not isinstance(a0, ConstInt) l0 = self.ensure_reg(a0) - self.force_result_in_reg(op, a0) + res = self.force_result_in_reg(op, a0) self.free_op_vars() - return [l0] + return [l0,] + +def prepare_same_as(self, op): + a0 = op.getarg(0) + assert not isinstance(a0, ConstInt) + l0 = self.ensure_reg(a0) + res = self.force_allocate_reg(op) + self.free_op_vars() + return [l0, res] diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -124,6 +124,7 @@ 'LGR': ('rre', ['\xB9','\x04']), 'LG': ('rxy', ['\xE3','\x04']), 'LARL': ('ril', ['\xC0','\x00'], 'r/m,h32'), + 'IIHF': ('ril', ['\xC0','\x08']), # load on condition 'LOCGR': ('rrf_c', ['\xB9','\xE2']), diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -201,6 +201,14 @@ else: self.mc.DDBR(l0, l1) + def emit_cast_float_to_int(self, op, arglocs, regalloc): + f0, r0 = arglocs + self.mc.CGDBR(r0, f0, c.FP_CUTOFF) + + def emit_cast_int_to_float(self, op, arglocs, regalloc): + r0, f0 = arglocs + self.mc.CDGBR(f0, r0) + class GuardOpAssembler(object): _mixin_ = True @@ -389,3 +397,16 @@ self._store_force_index(op) self.store_info_on_descr(0, guard_token) +class MiscOpAssembler(object): + _mixin_ = True + + def _genop_same_as(self, op, arglocs, regalloc): + argloc, resloc = arglocs + if argloc is not resloc: + self.regalloc_mov(argloc, resloc) + + emit_same_as_i = _genop_same_as + emit_same_as_r = _genop_same_as + emit_same_as_f = _genop_same_as + emit_cast_ptr_to_int = _genop_same_as + emit_cast_int_to_ptr = _genop_same_as diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -661,6 +661,20 @@ prepare_float_mul = helper.prepare_binary_op prepare_float_truediv = helper.prepare_binary_op + prepare_cast_ptr_to_int = helper.prepare_same_as + prepare_cast_int_to_ptr = helper.prepare_same_as + + def prepare_cast_int_to_float(self, op): + loc1 = self.ensure_reg(op.getarg(0)) + res = self.fprm.force_allocate_reg(op) + return [loc1, res] + + def prepare_cast_float_to_int(self, op): + loc1 = self.ensure_reg(op.getarg(0)) + self.free_op_vars() + res = self.rm.force_allocate_reg(op) + return [loc1, res] + def _prepare_guard(self, op, args=None): if args is None: args = [] From noreply at buildbot.pypy.org Thu Nov 19 06:16:43 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 19 Nov 2015 12:16:43 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: remove some cases where we became inevitable unnecessarily Message-ID: <20151119111644.0080E1C1279@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80770:1fc1326bc941 Date: 2015-11-19 12:18 +0100 http://bitbucket.org/pypy/pypy/changeset/1fc1326bc941/ Log: remove some cases where we became inevitable unnecessarily AFAICS, "pure" in llmodel means "don't become inevitable" and doesn't have any other effect anywhere else. So maybe it should be renamed. diff --git a/rpython/jit/backend/llsupport/gc.py b/rpython/jit/backend/llsupport/gc.py --- a/rpython/jit/backend/llsupport/gc.py +++ b/rpython/jit/backend/llsupport/gc.py @@ -1,6 +1,6 @@ import os from rpython.rlib import rgc -from rpython.rlib.objectmodel import we_are_translated, specialize +from rpython.rlib.objectmodel import we_are_translated, specialize, stm_ignored from rpython.rlib.rarithmetic import ovfcheck from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr from rpython.rtyper import rclass @@ -809,7 +809,12 @@ self.get_translated_info_for_guard_is_object()) p = base_type_info + (typeid << shift_by) + infobits_offset p = rffi.cast(rffi.CCHARP, p) - return (ord(p[0]) & IS_OBJECT_FLAG) != 0 + if self.stm: + with stm_ignored: + c = p[0] + else: + c = p[0] + return (ord(c) & IS_OBJECT_FLAG) != 0 # ____________________________________________________________ diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -690,23 +690,32 @@ @specialize.argtype(1) def bh_getfield_gc_i(self, struct, fielddescr, pure=False): + assert isinstance(fielddescr, FieldDescr) ofs, size, sign = self.unpack_fielddescr_size(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): fielddescr.assert_correct_type(struct) + if not pure: + pure = fielddescr.is_immutable() or not fielddescr.stm_should_track_raw_accesses() return self.read_int_at_mem(struct, ofs, size, sign, pure) @specialize.argtype(1) def bh_getfield_gc_r(self, struct, fielddescr, pure=False): + assert isinstance(fielddescr, FieldDescr) ofs = self.unpack_fielddescr(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): fielddescr.assert_correct_type(struct) + if not pure: + pure = fielddescr.is_immutable() or not fielddescr.stm_should_track_raw_accesses() return self.read_ref_at_mem(struct, ofs, pure) @specialize.argtype(1) def bh_getfield_gc_f(self, struct, fielddescr, pure=False): + assert isinstance(fielddescr, FieldDescr) ofs = self.unpack_fielddescr(fielddescr) if isinstance(lltype.typeOf(struct), lltype.Ptr): fielddescr.assert_correct_type(struct) + if not pure: + pure = fielddescr.is_immutable() or not fielddescr.stm_should_track_raw_accesses() return self.read_float_at_mem(struct, ofs, pure) bh_getfield_raw_i = bh_getfield_gc_i From noreply at buildbot.pypy.org Thu Nov 19 08:11:08 2015 From: noreply at buildbot.pypy.org (mjacob) Date: Thu, 19 Nov 2015 14:11:08 +0100 (CET) Subject: [pypy-commit] pypy py3k: 2to3 Message-ID: <20151119131108.4F1321C0EB1@cobra.cs.uni-duesseldorf.de> Author: Manuel Jacob Branch: py3k Changeset: r80771:2656e0ec2579 Date: 2015-11-19 13:29 +0100 http://bitbucket.org/pypy/pypy/changeset/2656e0ec2579/ Log: 2to3 diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -606,7 +606,7 @@ static PyObject * foo_nb_add_call(PyObject *self, PyObject *other) { - return PyInt_FromLong(42); + return PyLong_FromLong(42); } PyTypeObject Foo_Type = { From noreply at buildbot.pypy.org Thu Nov 19 08:11:10 2015 From: noreply at buildbot.pypy.org (mjacob) Date: Thu, 19 Nov 2015 14:11:10 +0100 (CET) Subject: [pypy-commit] pypy py3k: Skip this numpy cpyext test. Message-ID: <20151119131110.A381F1C0EB1@cobra.cs.uni-duesseldorf.de> Author: Manuel Jacob Branch: py3k Changeset: r80772:ff2836f9a451 Date: 2015-11-19 13:32 +0100 http://bitbucket.org/pypy/pypy/changeset/ff2836f9a451/ Log: Skip this numpy cpyext test. diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -355,6 +355,7 @@ assert api.PyErr_Occurred() is None def test_ndarray_ref(self, space, api): + py.test.py3k_skip('Numpy not yet supported on py3k') w_obj = space.appexec([], """(): import _numpypy return _numpypy.multiarray.dtype('int64').type(2)""") From noreply at buildbot.pypy.org Thu Nov 19 08:11:12 2015 From: noreply at buildbot.pypy.org (mjacob) Date: Thu, 19 Nov 2015 14:11:12 +0100 (CET) Subject: [pypy-commit] pypy py3k: Remove this test because specialized_zip_2_lists() is not implemented on py3k. Message-ID: <20151119131112.CD88A1C0EB1@cobra.cs.uni-duesseldorf.de> Author: Manuel Jacob Branch: py3k Changeset: r80773:db2bd09dae24 Date: 2015-11-19 13:36 +0100 http://bitbucket.org/pypy/pypy/changeset/db2bd09dae24/ Log: Remove this test because specialized_zip_2_lists() is not implemented on py3k. diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py --- a/pypy/objspace/std/test/test_tupleobject.py +++ b/pypy/objspace/std/test/test_tupleobject.py @@ -409,22 +409,3 @@ assert (() != object()) is True assert ((1,) != object()) is True assert ((1, 2) != object()) is True - - def test_zip_two_lists(self): - try: - from __pypy__ import specialized_zip_2_lists - except ImportError: - specialized_zip_2_lists = zip - else: - raises(TypeError, specialized_zip_2_lists, [], ()) - raises(TypeError, specialized_zip_2_lists, (), []) - assert specialized_zip_2_lists([], []) == [ - ] - assert specialized_zip_2_lists([2, 3], []) == [ - ] - assert specialized_zip_2_lists([2, 3], [4, 5, 6]) == [ - (2, 4), (3, 5)] - assert specialized_zip_2_lists([4.1, 3.6, 7.2], [2.3, 4.8]) == [ - (4.1, 2.3), (3.6, 4.8)] - assert specialized_zip_2_lists(["foo", "bar"], [6, 2]) == [ - ("foo", 6), ("bar", 2)] From noreply at buildbot.pypy.org Thu Nov 19 09:05:51 2015 From: noreply at buildbot.pypy.org (fijal) Date: Thu, 19 Nov 2015 15:05:51 +0100 (CET) Subject: [pypy-commit] pypy default: Merged in jamadden/pypy/osx-flat-namespace (pull request #358) Message-ID: <20151119140551.3C3241C134D@cobra.cs.uni-duesseldorf.de> Author: Maciej Fijalkowski Branch: Changeset: r80775:52fb5c4b6cac Date: 2015-11-19 16:06 +0200 http://bitbucket.org/pypy/pypy/changeset/52fb5c4b6cac/ Log: Merged in jamadden/pypy/osx-flat-namespace (pull request #358) Fix the cpyext tests on OS X by linking with -flat_namespace. diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py --- a/rpython/translator/platform/darwin.py +++ b/rpython/translator/platform/darwin.py @@ -28,11 +28,11 @@ # needed for cross compiling on ARM, needs fixing if relevant for darwin if len(rel_libdirs) > 0: print 'in get_rpath_flags, rel_libdirs is not fixed up',rel_libdirs - return self.rpath_flags + return self.rpath_flags def _args_for_shared(self, args): return (list(self.shared_only) - + ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup'] + + ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup', '-flat_namespace'] + args) def _include_dirs_for_libffi(self): From noreply at buildbot.pypy.org Thu Nov 19 09:05:49 2015 From: noreply at buildbot.pypy.org (jamadden) Date: Thu, 19 Nov 2015 15:05:49 +0100 (CET) Subject: [pypy-commit] pypy osx-flat-namespace: Fix the cpyext tests by linking with -flat_namespace. Message-ID: <20151119140549.0BE9E1C12BE@cobra.cs.uni-duesseldorf.de> Author: Jason Madden Branch: osx-flat-namespace Changeset: r80774:db227f4e2909 Date: 2015-11-19 06:11 -0600 http://bitbucket.org/pypy/pypy/changeset/db227f4e2909/ Log: Fix the cpyext tests by linking with -flat_namespace. diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py --- a/rpython/translator/platform/darwin.py +++ b/rpython/translator/platform/darwin.py @@ -26,11 +26,11 @@ # needed for cross compiling on ARM, needs fixing if relevant for darwin if len(rel_libdirs) > 0: print 'in get_rpath_flags, rel_libdirs is not fixed up',rel_libdirs - return self.rpath_flags + return self.rpath_flags def _args_for_shared(self, args): return (list(self.shared_only) - + ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup'] + + ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup', '-flat_namespace'] + args) def _include_dirs_for_libffi(self): From noreply at buildbot.pypy.org Thu Nov 19 10:27:48 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 19 Nov 2015 16:27:48 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added debug increment as operation (regalloc + assembly) Message-ID: <20151119152748.9C2711C1279@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80778:bc577360b3d3 Date: 2015-11-19 16:28 +0100 http://bitbucket.org/pypy/pypy/changeset/bc577360b3d3/ Log: added debug increment as operation (regalloc + assembly) diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -4952,6 +4952,7 @@ def test_increment_debug_counter(self): foo = lltype.malloc(rffi.CArray(lltype.Signed), 1, flavor='raw') foo[0] = 1789200 + print "addr" , hex(rffi.cast(lltype.Signed, foo)) self.execute_operation(rop.INCREMENT_DEBUG_COUNTER, [ConstInt(rffi.cast(lltype.Signed, foo))], 'void') diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -583,9 +583,6 @@ # ________________________________________ # ASSEMBLER EMISSION - def emit_increment_debug_counter(self, op, arglocs, regalloc): - pass # TODO - def emit_label(self, op, arglocs, regalloc): offset = self.pool.pool_start - self.mc.get_relative_pos() # load the pool address at each label diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -153,7 +153,7 @@ self.LGFI(dest_reg, l.imm(word)) else: # this is not put into the constant pool, because it - # is an immediate value that cannot easily be estimated + # is an immediate value that cannot easily be forseen self.LGFI(dest_reg, l.imm(word & 0xFFFFffff)) self.IIHF(dest_reg, l.imm((word >> 32) & 0xFFFFffff)) diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -410,3 +410,10 @@ emit_same_as_f = _genop_same_as emit_cast_ptr_to_int = _genop_same_as emit_cast_int_to_ptr = _genop_same_as + + def emit_increment_debug_counter(self, op, arglocs, regalloc): + addr, scratch = arglocs + self.mc.LG(scratch, l.addr(0,addr)) + self.mc.AGHI(scratch, l.imm(1)) + self.mc.STG(scratch, l.addr(0,addr)) + diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -609,12 +609,24 @@ if loc is not None and loc.is_stack(): self.fm.hint_frame_pos[box] = self.fm.get_loc_index(loc) + def convert_to_int(self, c): + if isinstance(c, ConstInt): + return rffi.cast(lltype.Signed, c.value) + else: + assert isinstance(c, ConstPtr) + return rffi.cast(lltype.Signed, c.value) + # ****************************************************** # * P R E P A R E O P E R A T I O N S * # ****************************************************** def prepare_increment_debug_counter(self, op): - pass # XXX + #poolloc = self.ensure_reg(op.getarg(0)) + immvalue = self.convert_to_int(op.getarg(0)) + base_loc = r.SCRATCH + self.assembler.mc.load_imm(base_loc, immvalue) + scratch = r.SCRATCH2 + return [base_loc, scratch] prepare_int_add = helper.prepare_int_add prepare_int_add_ovf = helper.prepare_int_add From noreply at buildbot.pypy.org Thu Nov 19 10:39:31 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 19 Nov 2015 16:39:31 +0100 (CET) Subject: [pypy-commit] stmgc default: free large overflow objs on abort Message-ID: <20151119153931.44DC11C0EB1@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r1969:e3071642fd5c Date: 2015-11-19 16:42 +0100 http://bitbucket.org/pypy/stmgc/changeset/e3071642fd5c/ Log: free large overflow objs on abort Benchmarks show (e.g. lee routing) that the more threads we run, the longer major GCs take (bc. there is more memory to look at). E.g. Lee on 1 thread spends 12% of its time doing GC; on 4 threads, the ratio goes up to 39%. This patch tries to lower the work to be done during major GCs by freeing overflow objects if the transaction aborted. For now, only large ones bc. we miss a smallmalloc_free() function (and it's also not clear if freeing small overflow objs should be done early). This change improves performance by 5-15% on 4 threads. diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -1561,6 +1561,14 @@ list_clear(pseg->objects_pointing_to_nursery); list_clear(pseg->old_objects_with_cards_set); + LIST_FOREACH_R(pseg->large_overflow_objects, uintptr_t /*item*/, + { + if (is_small_uniform((object_t*)item)) { + //_stm_small_free() + } else { + _stm_large_free(stm_object_pages + item); + } + }); list_clear(pseg->large_overflow_objects); list_clear(pseg->young_weakrefs); #pragma pop_macro("STM_SEGMENT") diff --git a/c8/stm/detach.c b/c8/stm/detach.c --- a/c8/stm/detach.c +++ b/c8/stm/detach.c @@ -127,6 +127,7 @@ // XXX: not sure if the next line is a good idea tl->last_associated_segment_num = remote_seg_num; ensure_gs_register(remote_seg_num); + assert(old_tl == STM_SEGMENT->running_thread); timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); } @@ -186,6 +187,7 @@ assert(segnum > 0); ensure_gs_register(segnum); + assert(((stm_thread_local_t *)old) == STM_SEGMENT->running_thread); timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH); commit_external_inevitable_transaction(); ensure_gs_register(mysegnum); diff --git a/c8/test/test_basic.py b/c8/test/test_basic.py --- a/c8/test/test_basic.py +++ b/c8/test/test_basic.py @@ -638,6 +638,21 @@ self.start_transaction() assert stm_get_char(lp1) == 'a' + def test_overflow_freed_on_abort(self): + self.start_transaction() + big = stm_allocate(GC_LAST_SMALL_SIZE + FAST_ALLOC) # large, outside, young obj + self.push_root(big) + stm_minor_collect() # now 'big' is overflow + big = self.pop_root() + self.abort_transaction() + + self.start_transaction() + big2 = stm_allocate(GC_LAST_SMALL_SIZE + FAST_ALLOC) + assert big == big2 # reused slot + self.abort_transaction() + + + def test_inevitable_transaction_has_priority(self): self.start_transaction() assert self.is_inevitable() == 0 From noreply at buildbot.pypy.org Thu Nov 19 10:52:44 2015 From: noreply at buildbot.pypy.org (fijal) Date: Thu, 19 Nov 2015 16:52:44 +0100 (CET) Subject: [pypy-commit] pypy fix-trace-too-long-heuristic: change the heuristic a bit Message-ID: <20151119155244.653521C0EB1@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: fix-trace-too-long-heuristic Changeset: r80779:543f6b24d1b0 Date: 2015-11-19 17:52 +0200 http://bitbucket.org/pypy/pypy/changeset/543f6b24d1b0/ Log: change the heuristic a bit diff --git a/rpython/jit/codewriter/jitcode.py b/rpython/jit/codewriter/jitcode.py --- a/rpython/jit/codewriter/jitcode.py +++ b/rpython/jit/codewriter/jitcode.py @@ -7,7 +7,7 @@ _empty_i = [] _empty_r = [] _empty_f = [] - + def __init__(self, name, fnaddr=None, calldescr=None, called_from=None): self.name = name self.fnaddr = fnaddr diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -1903,7 +1903,9 @@ raise ChangeFrame def is_main_jitcode(self, jitcode): - return self.jitdriver_sd is not None and jitcode is self.jitdriver_sd.mainjitcode + return (jitcode.jitdriver_sd is not None and + jitcode.jitdriver_sd.jitdriver.is_main_jitdriver) + #return self.jitdriver_sd is not None and jitcode is self.jitdriver_sd.mainjitcode def newframe(self, jitcode, greenkey=None): if jitcode.jitdriver_sd: diff --git a/rpython/jit/metainterp/test/test_recursive.py b/rpython/jit/metainterp/test/test_recursive.py --- a/rpython/jit/metainterp/test/test_recursive.py +++ b/rpython/jit/metainterp/test/test_recursive.py @@ -541,7 +541,8 @@ code = hlstr(code) return "%s %d %s" % (code, pc, code[pc]) myjitdriver = JitDriver(greens=['pc', 'code'], reds=['n'], - get_printable_location=p) + get_printable_location=p, + is_main_jitdriver=True) def f(code, n): pc = 0 diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py --- a/rpython/rlib/jit.py +++ b/rpython/rlib/jit.py @@ -604,7 +604,7 @@ get_printable_location=None, confirm_enter_jit=None, can_never_inline=None, should_unroll_one_iteration=None, name='jitdriver', check_untranslated=True, vectorize=False, - get_unique_id=None): + get_unique_id=None, is_main_jitdriver=False): if greens is not None: self.greens = greens self.name = name @@ -643,6 +643,7 @@ self.can_never_inline = can_never_inline self.should_unroll_one_iteration = should_unroll_one_iteration self.check_untranslated = check_untranslated + self.is_main_jitdriver = is_main_jitdriver self.vec = vectorize def _freeze_(self): From noreply at buildbot.pypy.org Thu Nov 19 10:52:46 2015 From: noreply at buildbot.pypy.org (fijal) Date: Thu, 19 Nov 2015 16:52:46 +0100 (CET) Subject: [pypy-commit] pypy fix-trace-too-long-heuristic: use the new heuristic Message-ID: <20151119155246.BE0791C0EB1@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: fix-trace-too-long-heuristic Changeset: r80780:d1f7d7071a96 Date: 2015-11-19 17:52 +0200 http://bitbucket.org/pypy/pypy/changeset/d1f7d7071a96/ Log: use the new heuristic diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py --- a/pypy/module/pypyjit/interp_jit.py +++ b/pypy/module/pypyjit/interp_jit.py @@ -54,7 +54,8 @@ get_unique_id = get_unique_id, should_unroll_one_iteration = should_unroll_one_iteration, - name='pypyjit') + name='pypyjit', + is_main_jitdriver=True) class __extend__(PyFrame): From noreply at buildbot.pypy.org Thu Nov 19 11:49:15 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 19 Nov 2015 17:49:15 +0100 (CET) Subject: [pypy-commit] pypy anntype: Implement unions of SomeException with SomeInstance Message-ID: <20151119164915.8465A1C0EB1@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype Changeset: r80781:7d8c6879587b Date: 2015-11-19 16:50 +0000 http://bitbucket.org/pypy/pypy/changeset/7d8c6879587b/ Log: Implement unions of SomeException with SomeInstance diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py --- a/rpython/annotator/annrpython.py +++ b/rpython/annotator/annrpython.py @@ -492,21 +492,21 @@ if can_only_throw is not None: # filter out those exceptions which cannot # occur for this specific, typed operation. - candidates = can_only_throw - s_exception = SomeException(set(can_only_throw)) + s_exception = self.bookkeeper.new_exception(can_only_throw) for link in exits: case = link.exitcase - s_case = SomeExceptCase(case) if case is None: self.follow_link(graph, link, {}) continue if s_exception == s_ImpossibleValue: break + s_case = SomeExceptCase( + self.bookkeeper.getuniqueclassdef(case)) s_matching_exc = s_exception.intersection(s_case) if s_matching_exc != s_ImpossibleValue: self.follow_raise_link(graph, link, constraints={link.last_exc_value: - s_matching_exc.as_SomeInstance(self.bookkeeper)}) + s_matching_exc.as_SomeInstance()}) s_exception = s_exception.difference(s_case) else: for link in exits: diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -6,14 +6,14 @@ from rpython.tool.pairtype import pair, pairtype from rpython.annotator.model import ( SomeObject, SomeInteger, SomeBool, s_Bool, SomeString, SomeChar, SomeList, - SomeDict, SomeUnicodeCodePoint, SomeUnicodeString, + SomeDict, SomeUnicodeCodePoint, SomeUnicodeString, SomeException, SomeTuple, SomeImpossibleValue, s_ImpossibleValue, SomeInstance, SomeBuiltinMethod, SomeIterator, SomePBC, SomeNone, SomeFloat, s_None, SomeByteArray, SomeWeakRef, SomeSingleFloat, SomeLongFloat, SomeType, SomeTypeOf, SomeConstantType, unionof, UnionError, read_can_only_throw, add_knowntypedata, merge_knowntypedata,) -from rpython.annotator.bookkeeper import immutablevalue +from rpython.annotator.bookkeeper import immutablevalue, getbookkeeper from rpython.flowspace.model import Variable, Constant, const from rpython.flowspace.operation import op from rpython.rlib import rarithmetic @@ -677,6 +677,14 @@ thistype = pairtype(SomeInstance, SomeInstance) return super(thistype, pair(ins1, ins2)).improve() +class __extend__(pairtype(SomeException, SomeInstance)): + def union((s_exc, s_inst)): + return unionof(s_exc.as_SomeInstance(), s_inst) + +class __extend__(pairtype(SomeInstance, SomeException)): + def union((s_inst, s_exc)): + return unionof(s_exc.as_SomeInstance(), s_inst) + @op.getitem.register_transform(SomeInstance, SomeObject) def getitem_SomeInstance(annotator, v_ins, v_idx): diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -12,7 +12,7 @@ from rpython.annotator.model import ( SomeOrderedDict, SomeString, SomeChar, SomeFloat, unionof, SomeInstance, SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint, - s_None, s_ImpossibleValue, SomeBool, SomeTuple, + s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeException, SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked, SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty) from rpython.annotator.classdesc import ClassDef, ClassDesc @@ -167,6 +167,10 @@ desc = self.getdesc(cls) return desc.getuniqueclassdef() + def new_exception(self, exc_classes): + clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes} + return SomeException(clsdefs) + def getlistdef(self, **flags_if_new): """Get the ListDef associated with the current position.""" try: diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -452,27 +452,27 @@ class SomeException(SomeObject): """The set of exceptions obeying type(exc) in self.classes""" - def __init__(self, classes): - self.classes = classes + def __init__(self, classdefs): + self.classdefs = classdefs def intersection(self, other): assert isinstance(other, SomeExceptCase) - classes = {c for c in self.classes if issubclass(c, other.case)} - if classes: - return SomeException(classes) + classdefs = {c for c in self.classdefs if c.issubclass(other.case)} + if classdefs: + return SomeException(classdefs) else: return s_ImpossibleValue def difference(self, other): assert isinstance(other, SomeExceptCase) - classes = {c for c in self.classes if not issubclass(c, other.case)} - if classes: - return SomeException(classes) + classdefs = {c for c in self.classdefs if not c.issubclass(other.case)} + if classdefs: + return SomeException(classdefs) else: return s_ImpossibleValue - def as_SomeInstance(self, bk): - return unionof(*[bk.valueoftype(cls) for cls in self.classes]) + def as_SomeInstance(self): + return unionof(*[SomeInstance(cdef) for cdef in self.classdefs]) class SomeExceptCase(SomeObject): diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py --- a/rpython/annotator/test/test_model.py +++ b/rpython/annotator/test/test_model.py @@ -3,6 +3,7 @@ from rpython.annotator.model import * from rpython.annotator.listdef import ListDef from rpython.translator.translator import TranslationContext +from rpython.annotator import unaryop, binaryop # for side-effects @pytest.fixture() def annotator(): @@ -136,3 +137,11 @@ assert s.no_nul is True s = SomeChar().nonnulify() assert s.no_nul is True + +def test_SomeException_union(annotator): + bk = annotator.bookkeeper + someinst = lambda cls, **kw: SomeInstance(bk.getuniqueclassdef(cls), **kw) + s_inst = someinst(Exception) + s_exc = bk.new_exception([ValueError, IndexError]) + assert unionof(s_exc, s_inst) == s_inst + assert unionof(s_inst, s_exc) == s_inst From noreply at buildbot.pypy.org Thu Nov 19 12:34:01 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 19 Nov 2015 18:34:01 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: fixed same_as in regalloc and several other places in regalloc_mov Message-ID: <20151119173401.6FCF41C12B2@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80782:206b872ed188 Date: 2015-11-19 18:34 +0100 http://bitbucket.org/pypy/pypy/changeset/206b872ed188/ Log: fixed same_as in regalloc and several other places in regalloc_mov diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -411,8 +411,11 @@ elif prev_loc.is_in_pool(): if loc.is_reg(): self.mc.LG(loc, prev_loc) + elif loc.is_fp_reg(): + self.mc.LD(loc, prev_loc) else: xxx + return elif prev_loc.is_stack(): offset = prev_loc.value # move from memory to register @@ -447,12 +450,14 @@ value = prev_loc.getint() # move immediate value to fp register if loc.is_fp_reg(): + xxx with scratch_reg(self.mc): self.mc.load_imm(r.SCRATCH, value) self.mc.lfdx(loc.value, 0, r.SCRATCH.value) return # move immediate value to memory elif loc.is_stack(): + xxx with scratch_reg(self.mc): offset = loc.value self.mc.load_imm(r.SCRATCH, value) @@ -461,17 +466,15 @@ return assert 0, "not supported location" elif prev_loc.is_fp_reg(): - reg = prev_loc.value # move to another fp register if loc.is_fp_reg(): - other_reg = loc.value - self.mc.fmr(other_reg, reg) + self.mc.LDR(loc, prev_loc) return # move from fp register to memory elif loc.is_stack(): assert loc.type == FLOAT, "target not float location" offset = loc.value - self.mc.stfd(reg, r.SPP.value, offset) + self.mc.STD(prev_loc, l.addr(offset, r.SPP)) return assert 0, "not supported location" assert 0, "not supported location" diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py --- a/rpython/jit/backend/zarch/helper/regalloc.py +++ b/rpython/jit/backend/zarch/helper/regalloc.py @@ -171,7 +171,6 @@ def prepare_same_as(self, op): a0 = op.getarg(0) - assert not isinstance(a0, ConstInt) l0 = self.ensure_reg(a0) res = self.force_allocate_reg(op) self.free_op_vars() diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py --- a/rpython/jit/backend/zarch/pool.py +++ b/rpython/jit/backend/zarch/pool.py @@ -145,7 +145,9 @@ elif val.type == INT: self.overwrite_64(mc, offset, val.value) else: - raise NotImplementedError + assert val.type == REF + i64 = rffi.cast(lltype.Signed, val.value) + self.overwrite_64(mc, offset, i64) else: pass diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -676,6 +676,10 @@ prepare_cast_ptr_to_int = helper.prepare_same_as prepare_cast_int_to_ptr = helper.prepare_same_as + prepare_same_as_i = helper.prepare_same_as + prepare_same_as_r = helper.prepare_same_as + prepare_same_as_f = helper.prepare_same_as + def prepare_cast_int_to_float(self, op): loc1 = self.ensure_reg(op.getarg(0)) res = self.fprm.force_allocate_reg(op) From noreply at buildbot.pypy.org Thu Nov 19 14:00:14 2015 From: noreply at buildbot.pypy.org (mattip) Date: Thu, 19 Nov 2015 20:00:14 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: release 4.0.1 Message-ID: <20151119190014.1FA3D1C12BE@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: extradoc Changeset: r657:6b22be597c12 Date: 2015-11-19 21:01 +0200 http://bitbucket.org/pypy/pypy.org/changeset/6b22be597c12/ Log: release 4.0.1 diff --git a/download.html b/download.html --- a/download.html +++ b/download.html @@ -74,7 +74,7 @@ performance improvements.

    We provide binaries for x86 and ARM Linux, Mac OS/X and Windows for:

    @@ -113,21 +113,21 @@ degrees of being up-to-date.
  • -
    -

    Python2.7 compatible PyPy 4.0.0

    +
    +

    Python2.7 compatible PyPy 4.0.1

    @@ -193,7 +193,7 @@ uncompressed, they run in-place. For now you can uncompress them either somewhere in your home directory or, say, in /opt, and if you want, put a symlink from somewhere like -/usr/local/bin/pypy to /path/to/pypy-4.0.0/bin/pypy. Do +/usr/local/bin/pypy to /path/to/pypy-4.0.1/bin/pypy. Do not move or copy the executable pypy outside the tree – put a symlink to it, otherwise it will not find its libraries.

    @@ -235,7 +235,7 @@
  • Get the source code. The following packages contain the source at the same revision as the above binaries:

    Or you can checkout the current trunk using Mercurial (the trunk usually works and is of course more up-to-date):

    @@ -343,19 +343,19 @@

    Checksums

    Here are the checksums for each of the downloads

    -

    pypy-4.0.0 md5:

    +

    pypy-4.0.1 md5:

    -82b11e63ab81db1604575dadd5cea427  pypy-4.0.0-linux64.tar.bz2
    -f91946d5abd5dff8e05ab0b5acffb432  pypy-4.0.0-linux-armel.tar.bz2
    -1db3ae7237a8a01f61b3b4ade65684ab  pypy-4.0.0-linux-armhf-raring.tar.bz2
    -14ac97384cfe772e4dab1974bb0010b6  pypy-4.0.0-linux-armhf-raspbian.tar.bz2
    -e1050332d8e1e6054906fa0a30cdc282  pypy-4.0.0-linux.tar.bz2
    -fcd8e2dacc2340173be206ab9de1d3fc  pypy-4.0.0-osx64.tar.bz2
    -57722fd5fc01734839ecc523ce965fbb  pypy-4.0.0-src.tar.bz2
    -8e90eed8aea1686d98c2e7dce5bda1e0  pypy-4.0.0-src.zip
    -fb013ec74edbf8dfd4f059e934fd4e5c  pypy-4.0.0-win32.zip
    -911e91b80f18b1bd3ddaf4905d077568  pypy-4.0.0-ppc64.tar.bz2
    -ade07e0fd3eb62155829680898b73c3c  pypy-4.0.0-ppc64le.tar.bz2
    +f6721e62f4ba1cdc4cc5ad719369e359  pypy-4.0.1-linux64.tar.bz2
    +fe8106ac3919c7b4be2766944326a624  pypy-4.0.1-linux-armel.tar.bz2
    +823b8a457f4c48ebdb8e1ee607b0a893  pypy-4.0.1-linux-armhf-raring.tar.bz2
    +e45728d413aa88963d4462ebcfaff6ea  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +d1d03aa44df354a3f589473a51406795  pypy-4.0.1-linux.tar.bz2
    +67ac82d88aaaef8c3074e68d700f3968  pypy-4.0.1-osx64.tar.bz2
    +f5b35ebedee2fa4fdfee82733be59996  pypy-4.0.1-src.tar.bz2
    +6b81d79886b215a877fee7624883ee94  pypy-4.0.1-src.zip
    +dc6573828ee5c82df18f9035f3b19edb  pypy-4.0.1-win32.zip
    +d4492e65201bb09dca5f97601113dc57  pypy-4.0.1-ppc64le.tar.bz2
    +2aadbb7638153b9d7c2a832888ed3c1e  pypy-4.0.1-ppc64.tar.bz2
     

    pypy3-2.4.0 md5:

    @@ -374,19 +374,19 @@
     2c9f0054f3b93a6473f10be35277825a  pypy-1.8-sandbox-linux64.tar.bz2
     009c970b5fa75754ae4c32a5d108a8d4  pypy-1.8-sandbox-linux.tar.bz2
     
    -

    pypy-4.0.0 sha1:

    +

    pypy-4.0.1 sha1:

    -aed958fdc720b77fdd52cb826239ccbd6d01f465  pypy-4.0.0-linux64.tar.bz2
    -65b50e0299dc0695a8460c14b401c783216464b1  pypy-4.0.0-linux-armel.tar.bz2
    -663afb7b0d77ddf53c78d49dbc36c6e8349c7fbb  pypy-4.0.0-linux-armhf-raring.tar.bz2
    -9998bfc5d0691ac23c12b268a7c8937dda0f4ed4  pypy-4.0.0-linux-armhf-raspbian.tar.bz2
    -685fb3b3e345d5c6404b4b143e3bae623fc727d3  pypy-4.0.0-linux.tar.bz2
    -7656c9975b353c801a15b924930ee47f173280b9  pypy-4.0.0-osx64.tar.bz2
    -b66a6a8c3ecdf6f62b13931cd2919dd160e1249b  pypy-4.0.0-src.tar.bz2
    -24550900db0a1a0b1a2554cb1fa480cd0ae2fbfd  pypy-4.0.0-src.zip
    -7369248180bdc9c6055272b1dedb3b3a70181497  pypy-4.0.0-win32.zip
    -b5c930aa70ef602daeacf9cc0cd80c1587158eaa  pypy-4.0.0-ppc64.tar.bz2
    -47c34b8a1ba418bf3e06c4741778ad198e2f3bba  pypy-4.0.0-ppc64le.tar.bz2
    +f723ed8aa51c98dcad703ff87c32ade3a54f0101  pypy-4.0.1-linux64.tar.bz2
    +947a24eff8f50705b403bd67f3357e135f071036  pypy-4.0.1-linux-armel.tar.bz2
    +bbcc04d524a5e7634173a7272b233f675a719bbf  pypy-4.0.1-linux-armhf-raring.tar.bz2
    +adf73fb7bb8001f549472eba5fee970c1800bc56  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +b306273b86a86ef3c624ecea7e48e45f660e1ef5  pypy-4.0.1-linux.tar.bz2
    +75286d96b22040723fe1de061d3df43cea712903  pypy-4.0.1-osx64.tar.bz2
    +805e9a81528a905afa571aa33cc66c650ae4e9f4  pypy-4.0.1-src.tar.bz2
    +5f29a916eba5f2b31affa56753b7ca108718d9be  pypy-4.0.1-src.zip
    +992b110210e556cd6803c2ca3837bec82a09aa15  pypy-4.0.1-win32.zip
    +271ae5d44f2219259340bf596fad22e5024b48a8  pypy-4.0.1-ppc64le.tar.bz2
    +bca102567fac577b7740700588f325c40d25af63  pypy-4.0.1-ppc64.tar.bz2
     

    pypy3-2.4.0 sha1:

    diff --git a/source/download.txt b/source/download.txt
    --- a/source/download.txt
    +++ b/source/download.txt
    @@ -14,12 +14,12 @@
     
     We provide binaries for x86 and ARM Linux, Mac OS/X and Windows for:
     
    -* the Python2.7 compatible release — **PyPy 4.0.0** — (`what's new in PyPy 4.0.0?`_)
    +* the Python2.7 compatible release — **PyPy 4.0.1** — (`what's new in PyPy 4.0.1?`_)
     * the Python3.2.5 compatible release — **PyPy3 2.4.0** — (`what's new in PyPy3 2.4.0?`_).
     
     * the Python2.7 Software Transactional Memory special release — **PyPy-STM 2.5.1** (Linux x86-64 only)
     
    -.. _what's new in PyPy 4.0.0?: http://doc.pypy.org/en/latest/release-4.0.0.html
    +.. _what's new in PyPy 4.0.1?: http://doc.pypy.org/en/latest/release-4.0.1.html
     .. _what's new in PyPy3 2.4.0?: http://doc.pypy.org/en/latest/release-pypy3-2.4.0.html
     
     
    @@ -73,7 +73,7 @@
     .. _`portable Linux binaries`: https://github.com/squeaky-pl/portable-pypy#portable-pypy-distribution-for-linux
     
     
    -Python2.7 compatible PyPy 4.0.0
    +Python2.7 compatible PyPy 4.0.1
     -----------------------------------
     
     * `Linux x86 binary (32bit, tar.bz2 built on Ubuntu 12.04 - 14.04)`__ (see ``[1]`` below)
    @@ -91,17 +91,17 @@
     * `All our downloads,`__ including previous versions.  We also have a
       mirror_, but please use only if you have troubles accessing the links above
     
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-linux.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-linux64.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-linux-armhf-raspbian.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-linux-armhf-raring.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-linux-armel.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-osx64.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-win32.zip
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-ppc64.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-ppc64le.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-src.tar.bz2
    -.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-src.zip
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux64.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux-armhf-raring.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux-armel.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-osx64.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-win32.zip
    +.. __: http://cobra.cs.uni-duesseldorf.de/~buildmaster/mirror/pypy-4.0.1-ppc64.tar.bz2
    +.. __: http://cobra.cs.uni-duesseldorf.de/~buildmaster/mirror/pypy-4.0.1-ppc64le.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-src.tar.bz2
    +.. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-src.zip
     .. _`vcredist_x86.exe`: http://www.microsoft.com/en-us/download/details.aspx?id=5582
     .. __: https://bitbucket.org/pypy/pypy/downloads
     .. _mirror: http://cobra.cs.uni-duesseldorf.de/~buildmaster/mirror/
    @@ -195,7 +195,7 @@
     uncompressed, they run in-place.  For now you can uncompress them
     either somewhere in your home directory or, say, in ``/opt``, and
     if you want, put a symlink from somewhere like
    -``/usr/local/bin/pypy`` to ``/path/to/pypy-4.0.0/bin/pypy``.  Do
    +``/usr/local/bin/pypy`` to ``/path/to/pypy-4.0.1/bin/pypy``.  Do
     not move or copy the executable ``pypy`` outside the tree --- put
     a symlink to it, otherwise it will not find its libraries.
     
    @@ -251,9 +251,9 @@
     1. Get the source code.  The following packages contain the source at
        the same revision as the above binaries:
     
    -   * `pypy-4.0.0-src.tar.bz2`__ (sources)
    +   * `pypy-4.0.1-src.tar.bz2`__ (sources)
     
    -   .. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.0-src.tar.bz2
    +   .. __: https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-src.tar.bz2
     
        Or you can checkout the current trunk using Mercurial_ (the trunk
        usually works and is of course more up-to-date)::
    @@ -372,19 +372,19 @@
     
     Here are the checksums for each of the downloads
     
    -pypy-4.0.0 md5::
    +pypy-4.0.1 md5::
     
    -    82b11e63ab81db1604575dadd5cea427  pypy-4.0.0-linux64.tar.bz2
    -    f91946d5abd5dff8e05ab0b5acffb432  pypy-4.0.0-linux-armel.tar.bz2
    -    1db3ae7237a8a01f61b3b4ade65684ab  pypy-4.0.0-linux-armhf-raring.tar.bz2
    -    14ac97384cfe772e4dab1974bb0010b6  pypy-4.0.0-linux-armhf-raspbian.tar.bz2
    -    e1050332d8e1e6054906fa0a30cdc282  pypy-4.0.0-linux.tar.bz2
    -    fcd8e2dacc2340173be206ab9de1d3fc  pypy-4.0.0-osx64.tar.bz2
    -    57722fd5fc01734839ecc523ce965fbb  pypy-4.0.0-src.tar.bz2
    -    8e90eed8aea1686d98c2e7dce5bda1e0  pypy-4.0.0-src.zip
    -    fb013ec74edbf8dfd4f059e934fd4e5c  pypy-4.0.0-win32.zip
    -    911e91b80f18b1bd3ddaf4905d077568  pypy-4.0.0-ppc64.tar.bz2
    -    ade07e0fd3eb62155829680898b73c3c  pypy-4.0.0-ppc64le.tar.bz2
    +    f6721e62f4ba1cdc4cc5ad719369e359  pypy-4.0.1-linux64.tar.bz2
    +    fe8106ac3919c7b4be2766944326a624  pypy-4.0.1-linux-armel.tar.bz2
    +    823b8a457f4c48ebdb8e1ee607b0a893  pypy-4.0.1-linux-armhf-raring.tar.bz2
    +    e45728d413aa88963d4462ebcfaff6ea  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +    d1d03aa44df354a3f589473a51406795  pypy-4.0.1-linux.tar.bz2
    +    67ac82d88aaaef8c3074e68d700f3968  pypy-4.0.1-osx64.tar.bz2
    +    f5b35ebedee2fa4fdfee82733be59996  pypy-4.0.1-src.tar.bz2
    +    6b81d79886b215a877fee7624883ee94  pypy-4.0.1-src.zip
    +    dc6573828ee5c82df18f9035f3b19edb  pypy-4.0.1-win32.zip
    +    d4492e65201bb09dca5f97601113dc57  pypy-4.0.1-ppc64le.tar.bz2
    +    2aadbb7638153b9d7c2a832888ed3c1e  pypy-4.0.1-ppc64.tar.bz2
     
     pypy3-2.4.0 md5::
     
    @@ -405,19 +405,19 @@
        009c970b5fa75754ae4c32a5d108a8d4  pypy-1.8-sandbox-linux.tar.bz2
     
     
    -pypy-4.0.0 sha1::
    +pypy-4.0.1 sha1::
     
    -    aed958fdc720b77fdd52cb826239ccbd6d01f465  pypy-4.0.0-linux64.tar.bz2
    -    65b50e0299dc0695a8460c14b401c783216464b1  pypy-4.0.0-linux-armel.tar.bz2
    -    663afb7b0d77ddf53c78d49dbc36c6e8349c7fbb  pypy-4.0.0-linux-armhf-raring.tar.bz2
    -    9998bfc5d0691ac23c12b268a7c8937dda0f4ed4  pypy-4.0.0-linux-armhf-raspbian.tar.bz2
    -    685fb3b3e345d5c6404b4b143e3bae623fc727d3  pypy-4.0.0-linux.tar.bz2
    -    7656c9975b353c801a15b924930ee47f173280b9  pypy-4.0.0-osx64.tar.bz2
    -    b66a6a8c3ecdf6f62b13931cd2919dd160e1249b  pypy-4.0.0-src.tar.bz2
    -    24550900db0a1a0b1a2554cb1fa480cd0ae2fbfd  pypy-4.0.0-src.zip
    -    7369248180bdc9c6055272b1dedb3b3a70181497  pypy-4.0.0-win32.zip
    -    b5c930aa70ef602daeacf9cc0cd80c1587158eaa  pypy-4.0.0-ppc64.tar.bz2
    -    47c34b8a1ba418bf3e06c4741778ad198e2f3bba  pypy-4.0.0-ppc64le.tar.bz2
    +    f723ed8aa51c98dcad703ff87c32ade3a54f0101  pypy-4.0.1-linux64.tar.bz2
    +    947a24eff8f50705b403bd67f3357e135f071036  pypy-4.0.1-linux-armel.tar.bz2
    +    bbcc04d524a5e7634173a7272b233f675a719bbf  pypy-4.0.1-linux-armhf-raring.tar.bz2
    +    adf73fb7bb8001f549472eba5fee970c1800bc56  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +    b306273b86a86ef3c624ecea7e48e45f660e1ef5  pypy-4.0.1-linux.tar.bz2
    +    75286d96b22040723fe1de061d3df43cea712903  pypy-4.0.1-osx64.tar.bz2
    +    805e9a81528a905afa571aa33cc66c650ae4e9f4  pypy-4.0.1-src.tar.bz2
    +    5f29a916eba5f2b31affa56753b7ca108718d9be  pypy-4.0.1-src.zip
    +    992b110210e556cd6803c2ca3837bec82a09aa15  pypy-4.0.1-win32.zip
    +    271ae5d44f2219259340bf596fad22e5024b48a8  pypy-4.0.1-ppc64le.tar.bz2
    +    bca102567fac577b7740700588f325c40d25af63  pypy-4.0.1-ppc64.tar.bz2
     
     pypy3-2.4.0 sha1::
     
    
    From noreply at buildbot.pypy.org  Thu Nov 19 15:22:34 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Thu, 19 Nov 2015 21:22:34 +0100 (CET)
    Subject: [pypy-commit] pypy.org extradoc: change sha1->sha256 for 4.0.1
     checksums, widen the page a bit
    Message-ID: <20151119202234.CF3881C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: extradoc
    Changeset: r658:90186d510185
    Date: 2015-11-19 22:23 +0200
    http://bitbucket.org/pypy/pypy.org/changeset/90186d510185/
    
    Log:	change sha1->sha256 for 4.0.1 checksums, widen the page a bit
    
    diff --git a/css/site.css b/css/site.css
    --- a/css/site.css
    +++ b/css/site.css
    @@ -223,7 +223,7 @@
     #main {
     	float: left;
     	padding: 10px 30px 0 10px;
    -	width: 680px;
    +	width: 800px;
     	line-height: 2em;
     	font-size: 0.9em;
     }
    @@ -249,7 +249,7 @@
     }
     
     #main pre {
    -	font-size: 15px;
    +	font-size: 13px;
     	font-family: "inconsolata-2", "inconsolata-1", Monaco, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
     }
     
    diff --git a/download.html b/download.html
    --- a/download.html
    +++ b/download.html
    @@ -374,19 +374,19 @@
     2c9f0054f3b93a6473f10be35277825a  pypy-1.8-sandbox-linux64.tar.bz2
     009c970b5fa75754ae4c32a5d108a8d4  pypy-1.8-sandbox-linux.tar.bz2
     
    -

    pypy-4.0.1 sha1:

    +

    pypy-4.0.1 sha256:

    -f723ed8aa51c98dcad703ff87c32ade3a54f0101  pypy-4.0.1-linux64.tar.bz2
    -947a24eff8f50705b403bd67f3357e135f071036  pypy-4.0.1-linux-armel.tar.bz2
    -bbcc04d524a5e7634173a7272b233f675a719bbf  pypy-4.0.1-linux-armhf-raring.tar.bz2
    -adf73fb7bb8001f549472eba5fee970c1800bc56  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    -b306273b86a86ef3c624ecea7e48e45f660e1ef5  pypy-4.0.1-linux.tar.bz2
    -75286d96b22040723fe1de061d3df43cea712903  pypy-4.0.1-osx64.tar.bz2
    -805e9a81528a905afa571aa33cc66c650ae4e9f4  pypy-4.0.1-src.tar.bz2
    -5f29a916eba5f2b31affa56753b7ca108718d9be  pypy-4.0.1-src.zip
    -992b110210e556cd6803c2ca3837bec82a09aa15  pypy-4.0.1-win32.zip
    -271ae5d44f2219259340bf596fad22e5024b48a8  pypy-4.0.1-ppc64le.tar.bz2
    -bca102567fac577b7740700588f325c40d25af63  pypy-4.0.1-ppc64.tar.bz2
    +0d6090cee59f4b9bab91ddbea76580d0c232b78dae65aaa9e8fa8d4449ba25b4  pypy-4.0.1-linux64.tar.bz2
    +d1acdd45ebd34580dd632c63c95211f6bae5e9a8f7a46ffa6f0443286ff9f61b  pypy-4.0.1-linux-armel.tar.bz2
    +e67278ce7423aa7bf99a95fd271cb76763eae3106930f4b7de1fba6a70a3f383  pypy-4.0.1-linux-armhf-raring.tar.bz2
    +52eef495f560af59a787b9935367cb5f8c83b48e32a80ec3e7060bffac011ecc  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +721920fcbb6aefc9a98e868e32b7f4ea5fd68b7f9305d08d0a2595327c9c0611  pypy-4.0.1-linux.tar.bz2
    +06be1299691f7ea558bf8e3bdf3d20debb8ba03cd7cadf04f2d6cbd5fd084430  pypy-4.0.1-osx64.tar.bz2
    +43be0b04bcbde1e24d5f39875c0471cdc7bdb44549e5618d32e49bccaa778111  pypy-4.0.1-ppc64le.tar.bz2
    +63c0a1614ffc94f94a64790df5ad193193b378f2cf8729213db06fbd64052911  pypy-4.0.1-ppc64.tar.bz2
    +29f5aa6ba17b34fd980e85172dfeb4086fdc373ad392b1feff2677d2d8aea23c  pypy-4.0.1-src.tar.bz2
    +e344b383e8c745cc7c26bbcb0a43958e768fdd1d29dd0799cc148e0518d8d36f  pypy-4.0.1-src.zip
    +9a350a5e6f9b86fb525c6f1300b0c97c021ea8b1e37bfd32a8c4bb7a415d5329  pypy-4.0.1-win32.zip
     

    pypy3-2.4.0 sha1:

    diff --git a/source/download.txt b/source/download.txt
    --- a/source/download.txt
    +++ b/source/download.txt
    @@ -405,19 +405,19 @@
        009c970b5fa75754ae4c32a5d108a8d4  pypy-1.8-sandbox-linux.tar.bz2
     
     
    -pypy-4.0.1 sha1::
    +pypy-4.0.1 sha256::
     
    -    f723ed8aa51c98dcad703ff87c32ade3a54f0101  pypy-4.0.1-linux64.tar.bz2
    -    947a24eff8f50705b403bd67f3357e135f071036  pypy-4.0.1-linux-armel.tar.bz2
    -    bbcc04d524a5e7634173a7272b233f675a719bbf  pypy-4.0.1-linux-armhf-raring.tar.bz2
    -    adf73fb7bb8001f549472eba5fee970c1800bc56  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    -    b306273b86a86ef3c624ecea7e48e45f660e1ef5  pypy-4.0.1-linux.tar.bz2
    -    75286d96b22040723fe1de061d3df43cea712903  pypy-4.0.1-osx64.tar.bz2
    -    805e9a81528a905afa571aa33cc66c650ae4e9f4  pypy-4.0.1-src.tar.bz2
    -    5f29a916eba5f2b31affa56753b7ca108718d9be  pypy-4.0.1-src.zip
    -    992b110210e556cd6803c2ca3837bec82a09aa15  pypy-4.0.1-win32.zip
    -    271ae5d44f2219259340bf596fad22e5024b48a8  pypy-4.0.1-ppc64le.tar.bz2
    -    bca102567fac577b7740700588f325c40d25af63  pypy-4.0.1-ppc64.tar.bz2
    +    0d6090cee59f4b9bab91ddbea76580d0c232b78dae65aaa9e8fa8d4449ba25b4  pypy-4.0.1-linux64.tar.bz2
    +    d1acdd45ebd34580dd632c63c95211f6bae5e9a8f7a46ffa6f0443286ff9f61b  pypy-4.0.1-linux-armel.tar.bz2
    +    e67278ce7423aa7bf99a95fd271cb76763eae3106930f4b7de1fba6a70a3f383  pypy-4.0.1-linux-armhf-raring.tar.bz2
    +    52eef495f560af59a787b9935367cb5f8c83b48e32a80ec3e7060bffac011ecc  pypy-4.0.1-linux-armhf-raspbian.tar.bz2
    +    721920fcbb6aefc9a98e868e32b7f4ea5fd68b7f9305d08d0a2595327c9c0611  pypy-4.0.1-linux.tar.bz2
    +    06be1299691f7ea558bf8e3bdf3d20debb8ba03cd7cadf04f2d6cbd5fd084430  pypy-4.0.1-osx64.tar.bz2
    +    43be0b04bcbde1e24d5f39875c0471cdc7bdb44549e5618d32e49bccaa778111  pypy-4.0.1-ppc64le.tar.bz2
    +    63c0a1614ffc94f94a64790df5ad193193b378f2cf8729213db06fbd64052911  pypy-4.0.1-ppc64.tar.bz2
    +    29f5aa6ba17b34fd980e85172dfeb4086fdc373ad392b1feff2677d2d8aea23c  pypy-4.0.1-src.tar.bz2
    +    e344b383e8c745cc7c26bbcb0a43958e768fdd1d29dd0799cc148e0518d8d36f  pypy-4.0.1-src.zip
    +    9a350a5e6f9b86fb525c6f1300b0c97c021ea8b1e37bfd32a8c4bb7a415d5329  pypy-4.0.1-win32.zip
     
     pypy3-2.4.0 sha1::
     
    
    From noreply at buildbot.pypy.org  Thu Nov 19 15:56:18 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Thu, 19 Nov 2015 21:56:18 +0100 (CET)
    Subject: [pypy-commit] pypy.org extradoc: widen the page to make room for
     the donations div
    Message-ID: <20151119205618.07FA81C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: extradoc
    Changeset: r659:e6e9b4fe04aa
    Date: 2015-11-19 22:57 +0200
    http://bitbucket.org/pypy/pypy.org/changeset/e6e9b4fe04aa/
    
    Log:	widen the page to make room for the donations div
    
    diff --git a/css/site.css b/css/site.css
    --- a/css/site.css
    +++ b/css/site.css
    @@ -167,7 +167,7 @@
     #body-inner {
        	margin: 0 auto;
     	padding: 10px 20px;
    -	width: 1000px;
    +	width: 1150px;
     }
     
     #body-outer {
    
    From noreply at buildbot.pypy.org  Thu Nov 19 16:02:52 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Thu, 19 Nov 2015 22:02:52 +0100 (CET)
    Subject: [pypy-commit] jitviewer default: Added tag pypy-4.0.1 for changeset
     6b1139406283
    Message-ID: <20151119210252.3A2831C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r277:e49b88557c99
    Date: 2015-11-19 23:03 +0200
    http://bitbucket.org/pypy/jitviewer/changeset/e49b88557c99/
    
    Log:	Added tag pypy-4.0.1 for changeset 6b1139406283
    
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -6,3 +6,4 @@
     ec561fb900e02df04e47b11c413f4a8449cbbb3a pypy-2.5
     3a0152b4ac6b8f930c493ef357fc5e9d8f4b91b7 pypy-2.6.0
     01dbb2d473162ccf7f2efe47888e86429c2498ad pypy-4.0.0
    +6b11394062835e86ca53bd7ec34d427a0485acd5 pypy-4.0.1
    
    From noreply at buildbot.pypy.org  Thu Nov 19 19:01:21 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 01:01:21 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: reverse the logic to distinguish
     virtual arrays and strings,
     and most importantly remove the weird ConstPtrInfo.is_array()==True
    Message-ID: <20151120000121.C62BF1C136E@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80784:d8b23469f91f
    Date: 2015-11-20 00:36 +0100
    http://bitbucket.org/pypy/pypy/changeset/d8b23469f91f/
    
    Log:	reverse the logic to distinguish virtual arrays and strings, and
    	most importantly remove the weird ConstPtrInfo.is_array()==True
    
    diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py
    --- a/rpython/jit/metainterp/optimizeopt/heap.py
    +++ b/rpython/jit/metainterp/optimizeopt/heap.py
    @@ -536,13 +536,12 @@
     
         def optimize_GETARRAYITEM_GC_I(self, op):
             # When using str_storage_getitem we op.getarg(0) is a string, NOT an
    -        # array. That's why we need to check for .is_array() before
    -        # remembering the reads. There is no point in remembering it, as the
    -        # box will be forced anyway by the optimizer
    +        # array. In that case, we cannot cache the getarrayitem as if it were
    +        # an array, obviously
             arrayinfo = self.ensure_ptr_info_arg0(op)
             indexb = self.getintbound(op.getarg(1))
             cf = None
    -        if indexb.is_constant() and arrayinfo.is_array():
    +        if indexb.is_constant() and not arrayinfo.is_vstring():
                 index = indexb.getint()
                 arrayinfo.getlenbound(None).make_gt_const(index)
                 # use the cache on (arraydescr, index), which is a constant
    @@ -559,7 +558,7 @@
             self.make_nonnull(op.getarg(0))
             self.emit_operation(op)
             # the remember the result of reading the array item
    -        if cf is not None and arrayinfo.is_array():
    +        if cf is not None and not arrayinfo.is_vstring():
                 arrayinfo.setitem(op.getdescr(), indexb.getint(),
                                   self.get_box_replacement(op.getarg(0)),
                                   self.get_box_replacement(op), cf,
    diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py
    --- a/rpython/jit/metainterp/optimizeopt/info.py
    +++ b/rpython/jit/metainterp/optimizeopt/info.py
    @@ -24,6 +24,9 @@
         def is_virtual(self):
             return False
     
    +    def is_vstring(self):
    +        return False
    +
         def is_precise(self):
             return False
     
    @@ -49,9 +52,6 @@
         def is_null(self):
             return False
     
    -    def is_array(self):
    -        return False
    -
         def force_at_the_end_of_preamble(self, op, optforce, rec):
             if not self.is_virtual():
                 return optforce.get_box_replacement(op)
    @@ -481,9 +481,6 @@
                 self.lenbound = intutils.ConstIntBound(size)
             self._clear = clear
     
    -    def is_array(self):
    -        return True
    -
         def getlenbound(self, mode):
             from rpython.jit.metainterp.optimizeopt import intutils
     
    @@ -722,9 +719,6 @@
         def is_virtual(self):
             return False
     
    -    def is_array(self):
    -        return True
    -
         def get_known_class(self, cpu):
             if not self._const.nonnull():
                 return None
    diff --git a/rpython/jit/metainterp/optimizeopt/virtualize.py b/rpython/jit/metainterp/optimizeopt/virtualize.py
    --- a/rpython/jit/metainterp/optimizeopt/virtualize.py
    +++ b/rpython/jit/metainterp/optimizeopt/virtualize.py
    @@ -272,10 +272,9 @@
     
         def optimize_GETARRAYITEM_GC_I(self, op):
             # When using str_storage_getitem we op.getarg(0) is a string, NOT an
    -        # array, hence the check for is_array(). If it's a virtual but not an
    -        # array (i.e., if it's a string) it will be forced.
    +        # array, hence the check. In that case, it will be forced
             opinfo = self.getptrinfo(op.getarg(0))
    -        if opinfo and opinfo.is_virtual() and opinfo.is_array():
    +        if opinfo and opinfo.is_virtual() and not opinfo.is_vstring():
                 indexbox = self.get_constant_box(op.getarg(1))
                 if indexbox is not None:
                     item = opinfo.getitem(op.getdescr(), indexbox.getint())
    diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py b/rpython/jit/metainterp/optimizeopt/vstring.py
    --- a/rpython/jit/metainterp/optimizeopt/vstring.py
    +++ b/rpython/jit/metainterp/optimizeopt/vstring.py
    @@ -62,6 +62,9 @@
             self.mode = mode
             self.length = length
     
    +    def is_vstring(self):
    +        return True
    +
         def getlenbound(self, mode):
             from rpython.jit.metainterp.optimizeopt import intutils
     
    
    From noreply at buildbot.pypy.org  Thu Nov 19 19:01:23 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 01:01:23 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: add a fast-path to unpack_double,
     which reads directly from the input string instead of taking a slice. There
     are still some rough edges,
     but I commit this anyway so I can translate while I sleep :)
    Message-ID: <20151120000123.F0F7B1C136E@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80785:7cf0a0cef3b5
    Date: 2015-11-20 01:01 +0100
    http://bitbucket.org/pypy/pypy/changeset/7cf0a0cef3b5/
    
    Log:	add a fast-path to unpack_double, which reads directly from the
    	input string instead of taking a slice. There are still some rough
    	edges, but I commit this anyway so I can translate while I sleep :)
    
    diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py
    --- a/pypy/module/struct/formatiterator.py
    +++ b/pypy/module/struct/formatiterator.py
    @@ -149,3 +149,17 @@
         @specialize.argtype(1)
         def appendobj(self, value):
             self.result_w.append(self.space.wrap(value))
    +
    +    def is_aligned(self, size):
    +        return self.pos % size == 0
    +
    +    def get_buffer(self):
    +        # XXX: if self.buf is something different that StringBuffer, this has
    +        # the effect to copy the whole string at each unpack!
    +        return self.buf.as_str()
    +
    +    def get_pos(self):
    +        return self.pos
    +
    +    def advance(self, size):
    +        self.read(size) # XXX, could avoid taking the slice
    diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py
    --- a/rpython/rlib/rstruct/nativefmttable.py
    +++ b/rpython/rlib/rstruct/nativefmttable.py
    @@ -44,8 +44,16 @@
     
     @specialize.argtype(0)
     def unpack_double(fmtiter):
    -    input = fmtiter.read(sizeof_double)
    -    doubleval = str_storage_getitem(rffi.DOUBLE, input, 0)
    +    if fmtiter.is_aligned(sizeof_double):
    +        # fast path
    +        input = fmtiter.get_buffer()
    +        pos = fmtiter.get_pos()
    +        doubleval = str_storage_getitem(rffi.DOUBLE, input, pos)
    +        fmtiter.advance(sizeof_double)
    +    else:
    +        # slow path, take the slice
    +        input = fmtiter.read(sizeof_double)
    +        doubleval = str_storage_getitem(rffi.DOUBLE, input, 0)
         fmtiter.appendobj(doubleval)
     
     def pack_float(fmtiter):
    diff --git a/rpython/rlib/rstruct/runpack.py b/rpython/rlib/rstruct/runpack.py
    --- a/rpython/rlib/rstruct/runpack.py
    +++ b/rpython/rlib/rstruct/runpack.py
    @@ -38,6 +38,18 @@
     
             def appendobj(self, value):
                 self.value = value
    +
    +        def is_aligned(self, size):
    +            return self.mr.inputpos % size == 0
    +
    +        def get_buffer(self):
    +            return self.mr.input
    +
    +        def get_pos(self):
    +            return self.mr.inputpos
    +
    +        def advance(self, size):
    +            self.read(size) # XXX, could avoid taking the slice
         ReaderForPos.__name__ = 'ReaderForPos%d' % pos
         return ReaderForPos
     
    diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py
    --- a/rpython/rlib/rstruct/test/test_runpack.py
    +++ b/rpython/rlib/rstruct/test/test_runpack.py
    @@ -43,11 +43,9 @@
             """
             Check the 'd' and 'f' format characters on native packing.
             """
    -        d_data = struct.pack("d", 12.34)
    -        f_data = struct.pack("f", 12.34)
    +        d_data = struct.pack("df", 12.34, 12.34)
             def fn():
    -            d = runpack("@d", d_data)
    -            f = runpack("@f", f_data)
    +            d, f = runpack("@df", d_data)
                 return d, f
             #
             res = self.interpret(fn, [])
    
    From noreply at buildbot.pypy.org  Thu Nov 19 20:32:17 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Fri, 20 Nov 2015 02:32:17 +0100 (CET)
    Subject: [pypy-commit] pypy anntype: Implement unions of SomeException with
     s_None
    Message-ID: <20151120013217.149CC1C12B4@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype
    Changeset: r80786:b7728cb83be9
    Date: 2015-11-19 17:04 +0000
    http://bitbucket.org/pypy/pypy/changeset/b7728cb83be9/
    
    Log:	Implement unions of SomeException with s_None
    
    diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
    --- a/rpython/annotator/binaryop.py
    +++ b/rpython/annotator/binaryop.py
    @@ -677,11 +677,15 @@
                 thistype = pairtype(SomeInstance, SomeInstance)
                 return super(thistype, pair(ins1, ins2)).improve()
     
    -class __extend__(pairtype(SomeException, SomeInstance)):
    +class __extend__(
    +        pairtype(SomeException, SomeInstance),
    +        pairtype(SomeException, SomeNone)):
         def union((s_exc, s_inst)):
             return unionof(s_exc.as_SomeInstance(), s_inst)
     
    -class __extend__(pairtype(SomeInstance, SomeException)):
    +class __extend__(
    +        pairtype(SomeInstance, SomeException),
    +        pairtype(SomeNone, SomeException)):
         def union((s_inst, s_exc)):
             return unionof(s_exc.as_SomeInstance(), s_inst)
     
    diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py
    --- a/rpython/annotator/test/test_model.py
    +++ b/rpython/annotator/test/test_model.py
    @@ -145,3 +145,6 @@
         s_exc = bk.new_exception([ValueError, IndexError])
         assert unionof(s_exc, s_inst) == s_inst
         assert unionof(s_inst, s_exc) == s_inst
    +    s_nullable = unionof(s_None, bk.new_exception([ValueError]))
    +    assert isinstance(s_nullable, SomeInstance)
    +    assert s_nullable.can_be_None
    
    From noreply at buildbot.pypy.org  Fri Nov 20 04:43:21 2015
    From: noreply at buildbot.pypy.org (fijal)
    Date: Fri, 20 Nov 2015 10:43:21 +0100 (CET)
    Subject: [pypy-commit] pypy fix-trace-too-long-heuristic: a bit undertested
     hooks to get the new abort hook going
    Message-ID: <20151120094321.BBB381C12B3@cobra.cs.uni-duesseldorf.de>
    
    Author: fijal
    Branch: fix-trace-too-long-heuristic
    Changeset: r80787:8b8b9dd15910
    Date: 2015-11-20 11:43 +0200
    http://bitbucket.org/pypy/pypy/changeset/8b8b9dd15910/
    
    Log:	a bit undertested hooks to get the new abort hook going
    
    diff --git a/pypy/module/pypyjit/__init__.py b/pypy/module/pypyjit/__init__.py
    --- a/pypy/module/pypyjit/__init__.py
    +++ b/pypy/module/pypyjit/__init__.py
    @@ -14,6 +14,7 @@
             'trace_next_iteration_hash': 'interp_jit.trace_next_iteration_hash',
             'set_compile_hook': 'interp_resop.set_compile_hook',
             'set_abort_hook': 'interp_resop.set_abort_hook',
    +        'set_trace_too_long_hook': 'interp_resop.set_trace_too_long_hook',
             'get_stats_snapshot': 'interp_resop.get_stats_snapshot',
             'get_stats_asmmemmgr': 'interp_resop.get_stats_asmmemmgr',
             # those things are disabled because they have bugs, but if
    diff --git a/pypy/module/pypyjit/hooks.py b/pypy/module/pypyjit/hooks.py
    --- a/pypy/module/pypyjit/hooks.py
    +++ b/pypy/module/pypyjit/hooks.py
    @@ -28,6 +28,23 @@
                 finally:
                     cache.in_recursion = False
     
    +    def on_trace_too_long(self, jitdriver, greenkey, greenkey_repr):
    +        space = self.space
    +        cache = space.fromcache(Cache)
    +        if cache.in_recursion:
    +            return
    +        if space.is_true(cache.w_trace_too_long_hook):
    +            cache.in_recursion = True
    +            try:
    +                try:
    +                    space.call_function(cache.w_trace_too_long_hook,
    +                        space.wrap(jitdriver.name),
    +                        wrap_greenkey(space, jitdriver, greenkey, greenkey_repr))
    +                except OperationError, e:
    +                    e.write_unraisable(space, "jit hook", cache.w_trace_too_long_hook)
    +            finally:
    +                cache.in_recursion = False
    +
         def after_compile(self, debug_info):
             self._compile_hook(debug_info, is_bridge=False)
     
    diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py
    --- a/pypy/module/pypyjit/interp_resop.py
    +++ b/pypy/module/pypyjit/interp_resop.py
    @@ -22,6 +22,7 @@
         def __init__(self, space):
             self.w_compile_hook = space.w_None
             self.w_abort_hook = space.w_None
    +        self.w_trace_too_long_hook = space.w_None
     
         def getno(self):
             self.no += 1
    @@ -79,6 +80,21 @@
         cache.w_abort_hook = w_hook
         cache.in_recursion = NonConstant(False)
     
    +def set_trace_too_long_hook(space, w_hook):
    +    """ set_trace_too_long_hook(hook)
    +
    +    Set a hook (callable) that will be called each time we abort
    +    tracing because the trace is too long.
    +
    +    The hook will be called with the signature:
    +
    +        hook(jitdriver_name, greenkey)
    +    """
    +    cache = space.fromcache(Cache)
    +    assert w_hook is not None
    +    cache.w_trace_too_long_hook = w_hook
    +    cache.in_recursion = NonConstant(False)
    +
     def wrap_oplist(space, logops, operations, ops_offset=None):
         # this function is called from the JIT
         from rpython.jit.metainterp.resoperation import rop
    diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
    --- a/rpython/jit/metainterp/pyjitpl.py
    +++ b/rpython/jit/metainterp/pyjitpl.py
    @@ -1889,6 +1889,9 @@
     
             self.box_names_memo = {}
     
    +        self.aborted_tracing_jitdriver = None
    +        self.aborted_tracing_greenkey = None
    +
         def retrace_needed(self, trace, exported_state):
             self.partial_trace = trace
             self.retracing_from = len(self.history.operations) - 1
    @@ -2228,6 +2231,15 @@
                         self.staticdata.logger_ops._make_log_operations(
                             self.box_names_memo),
                         self.history.operations)
    +            if self.aborted_tracing_jitdriver is not None:
    +                jd_sd = self.aborted_tracing_jitdriver
    +                greenkey = self.aborted_tracing_greenkey
    +                self.staticdata.warmrunnerdesc.hooks.on_trace_too_long(
    +                    jd_sd.jitdriver, greenkey,
    +                    jd_sd.warmstate.get_location_str(greenkey))
    +                # no ops for now
    +                self.aborted_tracing_jitdriver = None
    +                self.aborted_tracing_greenkey = None
             self.staticdata.stats.aborted()
     
         def blackhole_if_trace_too_long(self):
    @@ -2239,6 +2251,8 @@
                 if greenkey_of_huge_function is not None:
                     jd_sd.warmstate.disable_noninlinable_function(
                         greenkey_of_huge_function)
    +                self.aborted_tracing_jitdriver = jd_sd
    +                self.aborted_tracing_greenkey = greenkey_of_huge_function
                     if self.current_merge_points:
                         jd_sd = self.jitdriver_sd
                         greenkey = self.current_merge_points[0][0][:jd_sd.num_green_args]
    diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
    --- a/rpython/rlib/jit.py
    +++ b/rpython/rlib/jit.py
    @@ -1062,6 +1062,12 @@
             greenkey where it started, reason is a string why it got aborted
             """
     
    +    def on_trace_too_long(self, jitdriver, greenkey, greenkey_repr):
    +        """ A hook called each time we abort the trace because it's too
    +        long with the greenkey being the one responsible for the
    +        disabled function
    +        """
    +
         #def before_optimize(self, debug_info):
         #    """ A hook called before optimizer is run, called with instance of
         #    JitDebugInfo. Overwrite for custom behavior
    
    From noreply at buildbot.pypy.org  Fri Nov 20 05:17:36 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Fri, 20 Nov 2015 11:17:36 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: merged default
    Message-ID: <20151120101736.62A741C023F@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80788:ccd0b940856e
    Date: 2015-11-20 11:01 +0100
    http://bitbucket.org/pypy/pypy/changeset/ccd0b940856e/
    
    Log:	merged default
    
    diff too long, truncating to 2000 out of 6622 lines
    
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -17,3 +17,4 @@
     295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
     f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
     850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
    +5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
    diff --git a/LICENSE b/LICENSE
    --- a/LICENSE
    +++ b/LICENSE
    @@ -56,14 +56,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -87,7 +88,6 @@
       Ludovic Aubry
       Jacob Hallen
       Jason Creighton
    -  Richard Plangger
       Alex Martelli
       Michal Bendowski
       stian
    @@ -200,9 +200,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -234,6 +237,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -244,6 +248,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -253,6 +258,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -283,6 +289,7 @@
       shoma hosaka
       Daniel Neuhäuser
       Ben Mather
    +  Niclas Olofsson
       halgari
       Boglarka Vezer
       Chris Pressey
    @@ -309,13 +316,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -327,6 +337,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
    --- a/lib_pypy/cffi.egg-info/PKG-INFO
    +++ b/lib_pypy/cffi.egg-info/PKG-INFO
    @@ -1,6 +1,6 @@
     Metadata-Version: 1.1
     Name: cffi
    -Version: 1.3.0
    +Version: 1.3.1
     Summary: Foreign Function Interface for Python calling C code.
     Home-page: http://cffi.readthedocs.org
     Author: Armin Rigo, Maciej Fijalkowski
    diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
    --- a/lib_pypy/cffi/__init__.py
    +++ b/lib_pypy/cffi/__init__.py
    @@ -4,8 +4,8 @@
     from .api import FFI, CDefError, FFIError
     from .ffiplatform import VerificationError, VerificationMissing
     
    -__version__ = "1.3.0"
    -__version_info__ = (1, 3, 0)
    +__version__ = "1.3.1"
    +__version_info__ = (1, 3, 1)
     
     # The verifier module file names are based on the CRC32 of a string that
     # contains the following version number.  It may be older than __version__
    diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py
    --- a/lib_pypy/cffi/cparser.py
    +++ b/lib_pypy/cffi/cparser.py
    @@ -62,7 +62,8 @@
             if csource.startswith('*', endpos):
                 parts.append('('); closing += ')'
             level = 0
    -        for i in xrange(endpos, len(csource)):
    +        i = endpos
    +        while i < len(csource):
                 c = csource[i]
                 if c == '(':
                     level += 1
    @@ -73,6 +74,7 @@
                 elif c in ',;=':
                     if level == 0:
                         break
    +            i += 1
             csource = csource[endpos:i] + closing + csource[i:]
             #print repr(''.join(parts)+csource)
         parts.append(csource)
    diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py
    --- a/lib_pypy/cffi/model.py
    +++ b/lib_pypy/cffi/model.py
    @@ -514,12 +514,17 @@
             if self.baseinttype is not None:
                 return self.baseinttype.get_cached_btype(ffi, finishlist)
             #
    +        from . import api
             if self.enumvalues:
                 smallest_value = min(self.enumvalues)
                 largest_value = max(self.enumvalues)
             else:
    -            smallest_value = 0
    -            largest_value = 0
    +            import warnings
    +            warnings.warn("%r has no values explicitly defined; next version "
    +                          "will refuse to guess which integer type it is "
    +                          "meant to be (unsigned/signed, int/long)"
    +                          % self._get_c_name())
    +            smallest_value = largest_value = 0
             if smallest_value < 0:   # needs a signed type
                 sign = 1
                 candidate1 = PrimitiveType("int")
    diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
    --- a/pypy/doc/build.rst
    +++ b/pypy/doc/build.rst
    @@ -85,13 +85,16 @@
     _ssl
         libssl
     
    +gdbm
    +    libgdbm-dev
    +
     Make sure to have these libraries (with development headers) installed before
     building PyPy, otherwise the resulting binary will not contain these modules.
     
     On Debian, this is the command to install all build-time dependencies::
     
         apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \
    -    libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev
    +    libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev
     
     For the optional lzma module on PyPy3 you will also need ``liblzma-dev``.
     
    diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
    --- a/pypy/doc/contributor.rst
    +++ b/pypy/doc/contributor.rst
    @@ -26,15 +26,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    -  Richard Plangger
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -170,9 +170,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -204,6 +207,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -214,6 +218,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -223,6 +228,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -280,13 +286,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -298,6 +307,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst
    --- a/pypy/doc/index-of-release-notes.rst
    +++ b/pypy/doc/index-of-release-notes.rst
    @@ -6,6 +6,7 @@
     
     .. toctree::
     
    +   release-4.0.1.rst
        release-4.0.0.rst
        release-2.6.1.rst
        release-2.6.0.rst
    diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst
    --- a/pypy/doc/index-of-whatsnew.rst
    +++ b/pypy/doc/index-of-whatsnew.rst
    @@ -7,6 +7,7 @@
     .. toctree::
     
        whatsnew-head.rst
    +   whatsnew-4.0.1.rst
        whatsnew-4.0.0.rst
        whatsnew-2.6.1.rst
        whatsnew-2.6.0.rst
    diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/release-4.0.1.rst
    @@ -0,0 +1,106 @@
    +==========
    +PyPy 4.0.1
    +==========
    +
    +We have released PyPy 4.0.1, three weeks after PyPy 4.0.0. We have fixed
    +a few critical bugs in the JIT compiled code, reported by users. We therefore
    +encourage all users of PyPy to update to this version. There are a few minor
    +enhancements in this version as well.
    +
    +You can download the PyPy 4.0.1 release here:
    +
    +    http://pypy.org/download.html
    +
    +We would like to thank our donors for the continued support of the PyPy
    +project.
    +
    +We would also like to thank our contributors and 
    +encourage new people to join the project. PyPy has many
    +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation
    +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ 
    +with making RPython's JIT even better. 
    +
    +CFFI
    +====
    +
    +While not applicable only to PyPy, `cffi`_ is arguably our most significant
    +contribution to the python ecosystem. PyPy 4.0.1 ships with 
    +`cffi-1.3.1`_ with the improvements it brings.
    +
    +.. _`PyPy`: http://doc.pypy.org 
    +.. _`RPython`: https://rpython.readthedocs.org
    +.. _`cffi`: https://cffi.readthedocs.org
    +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1
    +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly
    +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html
    +.. _`numpy`: https://bitbucket.org/pypy/numpy
    +
    +What is PyPy?
    +=============
    +
    +PyPy is a very compliant Python interpreter, almost a drop-in replacement for
    +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison)
    +due to its integrated tracing JIT compiler.
    +
    +We also welcome developers of other
    +`dynamic languages`_ to see what RPython can do for them.
    +
    +This release supports **x86** machines on most common operating systems
    +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd),
    +newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the
    +big- and little-endian variants of **ppc64** running Linux.
    +
    +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org
    +.. _`dynamic languages`: http://pypyjs.org
    +
    +Other Highlights (since 4.0.0 released three weeks ago)
    +=======================================================
    +
    +* Bug Fixes
    +
    +  * Fix a bug when unrolling double loops in JITted code
    +
    +  * Fix multiple memory leaks in the ssl module, one of which affected
    +    `cpython` as well (thanks to Alex Gaynor for pointing those out)
    +
    +  * Use pkg-config to find ssl headers on OS-X
    +
    +  * Issues reported with our previous release were resolved_ after reports from users on
    +    our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
    +    #pypy
    +
    +* New features:
    +
    +  * Internal cleanup of RPython class handling
    +
    +  * Support stackless and greenlets on PPC machines
    +
    +  * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d
    +    for example to have all subprocesses write the JIT log to a file
    +    called 'log.%d', with '%d' replaced with the subprocess' PID.
    +
    +  * Support PyOS_double_to_string in our cpyext capi compatibility layer
    +
    +* Numpy:
    +
    +  * Improve support for __array_interface__
    +
    +  * Propagate NAN mantissas through float16-float32-float64 conversions
    +
    +
    +* Performance improvements and refactorings:
    +
    +  * Improvements in slicing byte arrays
    +
    +  * Improvements in enumerate()
    +
    +  * Silence some warnings while translating
    +
    +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html
    +
    +Please update, and continue to help us make PyPy better.
    +
    +Cheers
    +
    +The PyPy Team
    +
    diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
    --- a/pypy/doc/tool/makecontributor.py
    +++ b/pypy/doc/tool/makecontributor.py
    @@ -69,7 +69,9 @@
         'Rami Chowdhury': ['necaris'],
         'Stanislaw Halik':['w31rd0'],
         'Wenzhu Man':['wenzhu man', 'wenzhuman'],
    -    'Anton Gulenko':['anton gulenko'],
    +    'Anton Gulenko':['anton gulenko', 'anton_gulenko'],
    +    'Richard Lancaster':['richardlancaster'],
    +    'William Leslie':['William ML Leslie'],
         }
     
     alias_map = {}
    diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/whatsnew-4.0.1.rst
    @@ -0,0 +1,35 @@
    +=========================
    +What's new in PyPy 4.0.1
    +=========================
    +
    +.. this is a revision shortly after release-4.0.0
    +.. startrev: 57c9a47c70f6
    +
    +.. branch: 2174-fix-osx-10-11-translation
    +
    +Use pkg-config to find ssl headers on OS-X
    +
    +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    +
    +.. branch: ppc-stacklet
    +
    +The PPC machines now support the _continuation module (stackless, greenlets)
    +
    +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227
    +
    +Document that libgdbm-dev is required for translation/packaging
    +
    +.. branch: propogate-nans
    +
    +Ensure that ndarray conversion from int16->float16->float32->float16->int16
    +preserves all int16 values, even across nan conversions. Also fix argmax, argmin
    +for nan comparisons
    +
    +.. branch: array_interface
    +
    +Support common use-cases for __array_interface__, passes upstream tests
    +
    +.. branch: no-class-specialize
    +
    +Some refactoring of class handling in the annotator. 
    +Remove class specialisation and _settled_ flag.
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -2,15 +2,6 @@
     What's new in PyPy 4.0.+
     =========================
     
    -.. this is a revision shortly after release-4.0.0
    -.. startrev: 57c9a47c70f6
    +.. this is a revision shortly after release-4.0.1
    +.. startrev: 4b5c840d0da2
     
    -.. branch: 2174-fix-osx-10-11-translation
    -
    -Use pkg-config to find ssl headers on OS-X
    -
    -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    -
    -.. branch: ppc-stacklet
    -
    -The PPC machines now support the _continuation module (stackless, greenlets)
    diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
    --- a/pypy/interpreter/baseobjspace.py
    +++ b/pypy/interpreter/baseobjspace.py
    @@ -28,7 +28,6 @@
         """This is the abstract root class of all wrapped objects that live
         in a 'normal' object space like StdObjSpace."""
         __slots__ = ()
    -    _settled_ = True
         user_overridden_class = False
     
         def getdict(self, space):
    @@ -392,7 +391,7 @@
             self.check_signal_action = None   # changed by the signal module
             self.user_del_action = UserDelAction(self)
             self._code_of_sys_exc_info = None
    -
    +        
             # can be overridden to a subclass
             self.initialize()
     
    diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
    --- a/pypy/interpreter/pycode.py
    +++ b/pypy/interpreter/pycode.py
    @@ -50,6 +50,9 @@
         kwargname = varnames[argcount] if code.co_flags & CO_VARKEYWORDS else None
         return Signature(argnames, varargname, kwargname)
     
    +class CodeHookCache(object):
    +    def __init__(self, space):
    +        self._code_hook = None
     
     class PyCode(eval.Code):
         "CPython-style code objects."
    @@ -86,6 +89,15 @@
             self._signature = cpython_code_signature(self)
             self._initialize()
             self._init_ready()
    +        self.new_code_hook()
    +
    +    def new_code_hook(self):
    +        code_hook = self.space.fromcache(CodeHookCache)._code_hook
    +        if code_hook is not None:
    +            try:
    +                self.space.call_function(code_hook, self)
    +            except OperationError, e:
    +                e.write_unraisable(self.space, "new_code_hook()")
     
         def _initialize(self):
             if self.co_cellvars:
    diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py
    --- a/pypy/interpreter/test/test_zzpickle_and_slow.py
    +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
    @@ -390,15 +390,20 @@
     
         def test_pickle_enum(self):
             import pickle
    -        e      = enumerate(range(10))
    +        e = enumerate(range(100, 106))
             e.next()
             e.next()
             pckl   = pickle.dumps(e)
             result = pickle.loads(pckl)
    -        e.next()
    -        result.next()
    +        res = e.next()
    +        assert res == (2, 102)
    +        res = result.next()
    +        assert res == (2, 102)
             assert type(e) is type(result)
    -        assert list(e) == list(result)
    +        res = list(e)
    +        assert res == [(3, 103), (4, 104), (5, 105)]
    +        res = list(result)
    +        assert res == [(3, 103), (4, 104), (5, 105)]
     
         def test_pickle_xrangeiter(self):
             import pickle
    diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py
    --- a/pypy/module/__builtin__/functional.py
    +++ b/pypy/module/__builtin__/functional.py
    @@ -8,7 +8,7 @@
     from pypy.interpreter.error import OperationError
     from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
     from pypy.interpreter.typedef import TypeDef
    -from rpython.rlib import jit
    +from rpython.rlib import jit, rarithmetic
     from rpython.rlib.objectmodel import specialize
     from rpython.rlib.rarithmetic import r_uint, intmask
     from rpython.rlib.rbigint import rbigint
    @@ -229,27 +229,70 @@
         return min_max(space, __args__, "min")
     
     
    +
     class W_Enumerate(W_Root):
    -    def __init__(self, w_iter, w_start):
    -        self.w_iter = w_iter
    +    def __init__(self, w_iter_or_list, start, w_start):
    +        # 'w_index' should never be a wrapped int here; if it would be,
    +        # then it is actually None and the unwrapped int is in 'index'.
    +        self.w_iter_or_list = w_iter_or_list
    +        self.index = start
             self.w_index = w_start
     
         def descr___new__(space, w_subtype, w_iterable, w_start=None):
    -        self = space.allocate_instance(W_Enumerate, w_subtype)
    +        from pypy.objspace.std.listobject import W_ListObject
    +
             if w_start is None:
    -            w_start = space.wrap(0)
    +            start = 0
             else:
                 w_start = space.index(w_start)
    -        self.__init__(space.iter(w_iterable), w_start)
    +            if space.is_w(space.type(w_start), space.w_int):
    +                start = space.int_w(w_start)
    +                w_start = None
    +            else:
    +                start = -1
    +
    +        if start == 0 and type(w_iterable) is W_ListObject:
    +            w_iter = w_iterable
    +        else:
    +            w_iter = space.iter(w_iterable)
    +
    +        self = space.allocate_instance(W_Enumerate, w_subtype)
    +        self.__init__(w_iter, start, w_start)
             return space.wrap(self)
     
         def descr___iter__(self, space):
             return space.wrap(self)
     
         def descr_next(self, space):
    -        w_item = space.next(self.w_iter)
    +        from pypy.objspace.std.listobject import W_ListObject
             w_index = self.w_index
    -        self.w_index = space.add(w_index, space.wrap(1))
    +        w_iter_or_list = self.w_iter_or_list
    +        w_item = None
    +        if w_index is None:
    +            index = self.index
    +            if type(w_iter_or_list) is W_ListObject:
    +                try:
    +                    w_item = w_iter_or_list.getitem(index)
    +                except IndexError:
    +                    self.w_iter_or_list = None
    +                    raise OperationError(space.w_StopIteration, space.w_None)
    +                self.index = index + 1
    +            elif w_iter_or_list is None:
    +                raise OperationError(space.w_StopIteration, space.w_None)
    +            else:
    +                try:
    +                    newval = rarithmetic.ovfcheck(index + 1)
    +                except OverflowError:
    +                    w_index = space.wrap(index)
    +                    self.w_index = space.add(w_index, space.wrap(1))
    +                    self.index = -1
    +                else:
    +                    self.index = newval
    +            w_index = space.wrap(index)
    +        else:
    +            self.w_index = space.add(w_index, space.wrap(1))
    +        if w_item is None:
    +            w_item = space.next(self.w_iter_or_list)
             return space.newtuple([w_index, w_item])
     
         def descr___reduce__(self, space):
    @@ -257,12 +300,20 @@
             w_mod    = space.getbuiltinmodule('_pickle_support')
             mod      = space.interp_w(MixedModule, w_mod)
             w_new_inst = mod.get('enumerate_new')
    -        w_info = space.newtuple([self.w_iter, self.w_index])
    +        w_index = self.w_index
    +        if w_index is None:
    +            w_index = space.wrap(self.index)
    +        w_info = space.newtuple([self.w_iter_or_list, w_index])
             return space.newtuple([w_new_inst, w_info])
     
     # exported through _pickle_support
    -def _make_enumerate(space, w_iter, w_index):
    -    return space.wrap(W_Enumerate(w_iter, w_index))
    +def _make_enumerate(space, w_iter_or_list, w_index):
    +    if space.is_w(space.type(w_index), space.w_int):
    +        index = space.int_w(w_index)
    +        w_index = None
    +    else:
    +        index = -1
    +    return space.wrap(W_Enumerate(w_iter_or_list, index, w_index))
     
     W_Enumerate.typedef = TypeDef("enumerate",
         __new__=interp2app(W_Enumerate.descr___new__.im_func),
    diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py
    --- a/pypy/module/__builtin__/test/test_builtin.py
    +++ b/pypy/module/__builtin__/test/test_builtin.py
    @@ -264,6 +264,7 @@
             raises(StopIteration,x.next)
     
         def test_enumerate(self):
    +        import sys
             seq = range(2,4)
             enum = enumerate(seq)
             assert enum.next() == (0, 2)
    @@ -274,6 +275,15 @@
             enum = enumerate(range(5), 2)
             assert list(enum) == zip(range(2, 7), range(5))
     
    +        enum = enumerate(range(2), 2**100)
    +        assert list(enum) == [(2**100, 0), (2**100+1, 1)]
    +
    +        enum = enumerate(range(2), sys.maxint)
    +        assert list(enum) == [(sys.maxint, 0), (sys.maxint+1, 1)]
    +
    +        raises(TypeError, enumerate, range(2), 5.5)
    +
    +
         def test_next(self):
             x = iter(['a', 'b', 'c'])
             assert next(x) == 'a'
    diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
    --- a/pypy/module/__pypy__/__init__.py
    +++ b/pypy/module/__pypy__/__init__.py
    @@ -86,6 +86,7 @@
             'specialized_zip_2_lists'   : 'interp_magic.specialized_zip_2_lists',
             'set_debug'                 : 'interp_magic.set_debug',
             'locals_to_fast'            : 'interp_magic.locals_to_fast',
    +        'set_code_callback'         : 'interp_magic.set_code_callback',
             'save_module_content_for_future_reload':
                               'interp_magic.save_module_content_for_future_reload',
         }
    diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py
    --- a/pypy/module/__pypy__/interp_magic.py
    +++ b/pypy/module/__pypy__/interp_magic.py
    @@ -1,5 +1,6 @@
     from pypy.interpreter.error import OperationError, wrap_oserror
     from pypy.interpreter.gateway import unwrap_spec
    +from pypy.interpreter.pycode import CodeHookCache
     from pypy.interpreter.pyframe import PyFrame
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib.objectmodel import we_are_translated
    @@ -151,3 +152,10 @@
     def specialized_zip_2_lists(space, w_list1, w_list2):
         from pypy.objspace.std.specialisedtupleobject import specialized_zip_2_lists
         return specialized_zip_2_lists(space, w_list1, w_list2)
    +
    +def set_code_callback(space, w_callable):
    +    cache = space.fromcache(CodeHookCache)
    +    if space.is_none(w_callable):
    +        cache._code_hook = None
    +    else:
    +        cache._code_hook = w_callable
    \ No newline at end of file
    diff --git a/pypy/module/__pypy__/test/test_magic.py b/pypy/module/__pypy__/test/test_magic.py
    --- a/pypy/module/__pypy__/test/test_magic.py
    +++ b/pypy/module/__pypy__/test/test_magic.py
    @@ -13,3 +13,21 @@
             #
             sys.dont_write_bytecode = d
             __pypy__.save_module_content_for_future_reload(sys)
    +
    +    def test_new_code_hook(self):
    +        l = []
    +
    +        def callable(code):
    +            l.append(code)
    +
    +        import __pypy__
    +        __pypy__.set_code_callback(callable)
    +        d = {}
    +        try:
    +            exec """
    +def f():
    +    pass
    +""" in d
    +        finally:
    +            __pypy__.set_code_callback(None)
    +        assert d['f'].__code__ in l
    \ No newline at end of file
    diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
    --- a/pypy/module/_cffi_backend/__init__.py
    +++ b/pypy/module/_cffi_backend/__init__.py
    @@ -2,7 +2,7 @@
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib import rdynload, clibffi
     
    -VERSION = "1.3.0"
    +VERSION = "1.3.1"
     
     FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI
     try:
    diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
    --- a/pypy/module/_cffi_backend/ffi_obj.py
    +++ b/pypy/module/_cffi_backend/ffi_obj.py
    @@ -448,7 +448,7 @@
     
     'alloc' is called with the size as argument.  If it returns NULL, a
     MemoryError is raised.  'free' is called with the result of 'alloc'
    -as argument.  Both can be either Python function or directly C
    +as argument.  Both can be either Python functions or directly C
     functions.  If 'free' is None, then no free function is called.
     If both 'alloc' and 'free' are None, the default is used.
     
    diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c
    --- a/pypy/module/_cffi_backend/src/parse_c_type.c
    +++ b/pypy/module/_cffi_backend/src/parse_c_type.c
    @@ -4,6 +4,7 @@
     #include 
     
     #if defined(_MSC_VER)
    +# define MS_WIN32
     typedef size_t uintptr_t;
     #else
     # include 
    diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
    --- a/pypy/module/_cffi_backend/test/_backend_test_c.py
    +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
    @@ -1,7 +1,7 @@
     # ____________________________________________________________
     
     import sys
    -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version"
    +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version"
                                     " of cffi that differs from the one that we"
                                     " get from 'import _cffi_backend'")
     if sys.version_info < (3,):
    diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py
    --- a/pypy/module/_cffi_backend/test/test_recompiler.py
    +++ b/pypy/module/_cffi_backend/test/test_recompiler.py
    @@ -16,8 +16,8 @@
             from cffi import ffiplatform
         except ImportError:
             py.test.skip("system cffi module not found or older than 1.0.0")
    -    if cffi.__version_info__ < (1, 2, 0):
    -        py.test.skip("system cffi module needs to be at least 1.2.0")
    +    if cffi.__version_info__ < (1, 3, 0):
    +        py.test.skip("system cffi module needs to be at least 1.3.0")
         space.appexec([], """():
             import _cffi_backend     # force it to be initialized
         """)
    diff --git a/pypy/module/_minimal_curses/interp_curses.py b/pypy/module/_minimal_curses/interp_curses.py
    --- a/pypy/module/_minimal_curses/interp_curses.py
    +++ b/pypy/module/_minimal_curses/interp_curses.py
    @@ -13,7 +13,7 @@
         def __init__(self, msg):
             self.msg = msg
     
    -from rpython.annotator.description import FORCE_ATTRIBUTES_INTO_CLASSES
    +from rpython.annotator.classdesc import FORCE_ATTRIBUTES_INTO_CLASSES
     from rpython.annotator.model import SomeString
     
     # this is necessary due to annmixlevel
    diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py
    --- a/pypy/module/_multiprocessing/interp_win32.py
    +++ b/pypy/module/_multiprocessing/interp_win32.py
    @@ -17,7 +17,7 @@
         NMPWAIT_WAIT_FOREVER
         ERROR_PIPE_CONNECTED ERROR_SEM_TIMEOUT ERROR_PIPE_BUSY
         ERROR_NO_SYSTEM_RESOURCES ERROR_BROKEN_PIPE ERROR_MORE_DATA
    -    ERROR_ALREADY_EXISTS
    +    ERROR_ALREADY_EXISTS ERROR_NO_DATA
     """.split()
     
     class CConfig:
    diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
    --- a/pypy/module/_ssl/interp_ssl.py
    +++ b/pypy/module/_ssl/interp_ssl.py
    @@ -1,4 +1,4 @@
    -from rpython.rlib import rpoll, rsocket, rthread, rweakref
    +from rpython.rlib import rpoll, rsocket, rthread, rweakref, rgc
     from rpython.rlib.rarithmetic import intmask, widen, r_uint
     from rpython.rlib.ropenssl import *
     from pypy.module._socket import interp_socket
    @@ -852,55 +852,58 @@
                         names = rffi.cast(GENERAL_NAMES, method[0].c_d2i(
                             null, p_ptr, length))
     
    -            for j in range(libssl_sk_GENERAL_NAME_num(names)):
    -                # Get a rendering of each name in the set of names
    +            try:
    +                for j in range(libssl_sk_GENERAL_NAME_num(names)):
    +                    # Get a rendering of each name in the set of names
     
    -                name = libssl_sk_GENERAL_NAME_value(names, j)
    -                gntype = intmask(name.c_type)
    -                if gntype == GEN_DIRNAME:
    -                    # we special-case DirName as a tuple of tuples of
    -                    # attributes
    -                    dirname = libssl_pypy_GENERAL_NAME_dirn(name)
    -                    w_t = space.newtuple([
    -                        space.wrap("DirName"),
    -                        _create_tuple_for_X509_NAME(space, dirname)
    -                        ])
    -                elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI):
    -                    # GENERAL_NAME_print() doesn't handle NULL bytes in
    -                    # ASN1_string correctly, CVE-2013-4238
    -                    if gntype == GEN_EMAIL:
    -                        v = space.wrap("email")
    -                    elif gntype == GEN_DNS:
    -                        v = space.wrap("DNS")
    -                    elif gntype == GEN_URI:
    -                        v = space.wrap("URI")
    +                    name = libssl_sk_GENERAL_NAME_value(names, j)
    +                    gntype = intmask(name.c_type)
    +                    if gntype == GEN_DIRNAME:
    +                        # we special-case DirName as a tuple of tuples of
    +                        # attributes
    +                        dirname = libssl_pypy_GENERAL_NAME_dirn(name)
    +                        w_t = space.newtuple([
    +                            space.wrap("DirName"),
    +                            _create_tuple_for_X509_NAME(space, dirname)
    +                            ])
    +                    elif gntype in (GEN_EMAIL, GEN_DNS, GEN_URI):
    +                        # GENERAL_NAME_print() doesn't handle NULL bytes in
    +                        # ASN1_string correctly, CVE-2013-4238
    +                        if gntype == GEN_EMAIL:
    +                            v = space.wrap("email")
    +                        elif gntype == GEN_DNS:
    +                            v = space.wrap("DNS")
    +                        elif gntype == GEN_URI:
    +                            v = space.wrap("URI")
    +                        else:
    +                            assert False
    +                        as_ = libssl_pypy_GENERAL_NAME_dirn(name)
    +                        as_ = rffi.cast(ASN1_STRING, as_)
    +                        buf = libssl_ASN1_STRING_data(as_)
    +                        length = libssl_ASN1_STRING_length(as_)
    +                        w_t = space.newtuple([
    +                            v, space.wrap(rffi.charpsize2str(buf, length))])
                         else:
    -                        assert False
    -                    as_ = libssl_pypy_GENERAL_NAME_dirn(name)
    -                    as_ = rffi.cast(ASN1_STRING, as_)
    -                    buf = libssl_ASN1_STRING_data(as_)
    -                    length = libssl_ASN1_STRING_length(as_)
    -                    w_t = space.newtuple([
    -                        v, space.wrap(rffi.charpsize2str(buf, length))])
    -                else:
    -                    # for everything else, we use the OpenSSL print form
    -                    if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY,
    -                                      GEN_IPADD, GEN_RID):
    -                        space.warn(space.wrap("Unknown general name type"),
    -                                   space.w_RuntimeWarning)
    -                    libssl_BIO_reset(biobuf)
    -                    libssl_GENERAL_NAME_print(biobuf, name)
    -                    with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf:
    -                        length = libssl_BIO_gets(biobuf, buf, 2047)
    -                        if length < 0:
    -                            raise _ssl_seterror(space, None, 0)
    +                        # for everything else, we use the OpenSSL print form
    +                        if gntype not in (GEN_OTHERNAME, GEN_X400, GEN_EDIPARTY,
    +                                          GEN_IPADD, GEN_RID):
    +                            space.warn(space.wrap("Unknown general name type"),
    +                                       space.w_RuntimeWarning)
    +                        libssl_BIO_reset(biobuf)
    +                        libssl_GENERAL_NAME_print(biobuf, name)
    +                        with lltype.scoped_alloc(rffi.CCHARP.TO, 2048) as buf:
    +                            length = libssl_BIO_gets(biobuf, buf, 2047)
    +                            if length < 0:
    +                                raise _ssl_seterror(space, None, 0)
     
    -                        v = rffi.charpsize2str(buf, length)
    -                    v1, v2 = v.split(':', 1)
    -                    w_t = space.newtuple([space.wrap(v1),
    -                                          space.wrap(v2)])
    +                            v = rffi.charpsize2str(buf, length)
    +                        v1, v2 = v.split(':', 1)
    +                        w_t = space.newtuple([space.wrap(v1),
    +                                              space.wrap(v2)])
     
    -                alt_names_w.append(w_t)
    +                    alt_names_w.append(w_t)
    +            finally:
    +                libssl_pypy_GENERAL_NAME_pop_free(names)
         finally:
             libssl_BIO_free(biobuf)
     
    @@ -921,8 +924,11 @@
             length = libssl_ASN1_STRING_to_UTF8(buf_ptr, value)
             if length < 0:
                 raise _ssl_seterror(space, None, 0)
    -        w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length))
    -        w_value = space.call_method(w_value, "decode", space.wrap("utf-8"))
    +        try:
    +            w_value = space.wrap(rffi.charpsize2str(buf_ptr[0], length))
    +            w_value = space.call_method(w_value, "decode", space.wrap("utf-8"))
    +        finally:
    +            libssl_OPENSSL_free(buf_ptr[0])
     
         return space.newtuple([w_name, w_value])
     
    @@ -930,9 +936,10 @@
     def _get_aia_uri(space, certificate, nid):
         info = rffi.cast(AUTHORITY_INFO_ACCESS, libssl_X509_get_ext_d2i(
             certificate, NID_info_access, None, None))
    -    if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0:
    -        return
         try:
    +        if not info or libssl_sk_ACCESS_DESCRIPTION_num(info) == 0:
    +            return
    +
             result_w = []
             for i in range(libssl_sk_ACCESS_DESCRIPTION_num(info)):
                 ad = libssl_sk_ACCESS_DESCRIPTION_value(info, i)
    @@ -962,20 +969,24 @@
         if not dps:
             return None
     
    -    cdp_w = []
    -    for i in range(libssl_sk_DIST_POINT_num(dps)):
    -        dp = libssl_sk_DIST_POINT_value(dps, i)
    -        gns = libssl_pypy_DIST_POINT_fullname(dp)
    +    try:
    +        cdp_w = []
    +        for i in range(libssl_sk_DIST_POINT_num(dps)):
    +            dp = libssl_sk_DIST_POINT_value(dps, i)
    +            gns = libssl_pypy_DIST_POINT_fullname(dp)
     
    -        for j in range(libssl_sk_GENERAL_NAME_num(gns)):
    -            name = libssl_sk_GENERAL_NAME_value(gns, j)
    -            gntype = intmask(name.c_type)
    -            if gntype != GEN_URI:
    -                continue
    -            uri = libssl_pypy_GENERAL_NAME_uri(name)
    -            length = intmask(uri.c_length)
    -            s_uri = rffi.charpsize2str(uri.c_data, length)
    -            cdp_w.append(space.wrap(s_uri))
    +            for j in range(libssl_sk_GENERAL_NAME_num(gns)):
    +                name = libssl_sk_GENERAL_NAME_value(gns, j)
    +                gntype = intmask(name.c_type)
    +                if gntype != GEN_URI:
    +                    continue
    +                uri = libssl_pypy_GENERAL_NAME_uri(name)
    +                length = intmask(uri.c_length)
    +                s_uri = rffi.charpsize2str(uri.c_data, length)
    +                cdp_w.append(space.wrap(s_uri))
    +    finally:
    +        if OPENSSL_VERSION_NUMBER < 0x10001000:
    +            libssl_sk_DIST_POINT_free(dps)
         return space.newtuple(cdp_w[:])
     
     def checkwait(space, w_sock, writing):
    @@ -1270,6 +1281,7 @@
             if not ctx:
                 raise ssl_error(space, "failed to allocate SSL context")
     
    +        rgc.add_memory_pressure(10 * 1024 * 1024)
             self = space.allocate_instance(_SSLContext, w_subtype)
             self.ctx = ctx
             self.check_hostname = False
    @@ -1296,6 +1308,9 @@
     
             return self
     
    +    def __del__(self):
    +        libssl_SSL_CTX_free(self.ctx)
    +
         @unwrap_spec(server_side=int)
         def descr_wrap_socket(self, space, w_sock, server_side, w_server_hostname=None, w_ssl_sock=None):
             return _SSLSocket.descr_new(space, self, w_sock, server_side, w_server_hostname, w_ssl_sock)
    diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py
    --- a/pypy/module/cpyext/pystrtod.py
    +++ b/pypy/module/cpyext/pystrtod.py
    @@ -5,10 +5,23 @@
     from rpython.rlib import rdtoa
     from rpython.rlib import rfloat
     from rpython.rlib import rposix, jit
    +from rpython.rlib.rarithmetic import intmask
     from rpython.rtyper.lltypesystem import lltype
     from rpython.rtyper.lltypesystem import rffi
     
     
    +# PyOS_double_to_string's "type", if non-NULL, will be set to one of:
    +Py_DTST_FINITE = 0
    +Py_DTST_INFINITE = 1
    +Py_DTST_NAN = 2
    +
    +# Match the "type" back to values in CPython
    +DOUBLE_TO_STRING_TYPES_MAP = {
    +    rfloat.DIST_FINITE: Py_DTST_FINITE,
    +    rfloat.DIST_INFINITY: Py_DTST_INFINITE,
    +    rfloat.DIST_NAN: Py_DTST_NAN
    +}
    +
     @cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0)
     @jit.dont_look_inside       # direct use of _get_errno()
     def PyOS_string_to_double(space, s, endptr, w_overflow_exception):
    @@ -68,3 +81,42 @@
         finally:
             if not user_endptr:
                 lltype.free(endptr, flavor='raw')
    +
    + at cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP)
    +def PyOS_double_to_string(space, val, format_code, precision, flags, ptype):
    +    """Convert a double val to a string using supplied
    +    format_code, precision, and flags.
    +
    +    format_code must be one of 'e', 'E', 'f', 'F',
    +    'g', 'G' or 'r'.  For 'r', the supplied precision
    +    must be 0 and is ignored.  The 'r' format code specifies the
    +    standard repr() format.
    +
    +    flags can be zero or more of the values Py_DTSF_SIGN,
    +    Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together:
    +
    +    Py_DTSF_SIGN means to always precede the returned string with a sign
    +    character, even if val is non-negative.
    +
    +    Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look
    +    like an integer.
    +
    +    Py_DTSF_ALT means to apply "alternate" formatting rules.  See the
    +    documentation for the PyOS_snprintf() '#' specifier for
    +    details.
    +
    +    If ptype is non-NULL, then the value it points to will be set to one of
    +    Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that
    +    val is a finite number, an infinite number, or not a number, respectively.
    +
    +    The return value is a pointer to buffer with the converted string or
    +    NULL if the conversion failed. The caller is responsible for freeing the
    +    returned string by calling PyMem_Free().
    +    """
    +    buffer, rtype = rfloat.double_to_string(val, format_code,
    +                                            intmask(precision),
    +                                            intmask(flags))
    +    if ptype != lltype.nullptr(rffi.INTP.TO):
    +        ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype])
    +    bufp = rffi.str2charp(buffer)
    +    return bufp
    diff --git a/pypy/module/cpyext/test/test_pystrtod.py b/pypy/module/cpyext/test/test_pystrtod.py
    --- a/pypy/module/cpyext/test/test_pystrtod.py
    +++ b/pypy/module/cpyext/test/test_pystrtod.py
    @@ -1,5 +1,6 @@
     import math
     
    +from pypy.module.cpyext import pystrtod
     from pypy.module.cpyext.test.test_api import BaseApiTest
     from rpython.rtyper.lltypesystem import rffi
     from rpython.rtyper.lltypesystem import lltype
    @@ -91,3 +92,76 @@
             api.PyErr_Clear()
             rffi.free_charp(s)
             lltype.free(endp, flavor='raw')
    +
    +
    +class TestPyOS_double_to_string(BaseApiTest):
    +
    +    def test_format_code(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(150.0, 'e', 1, 0, ptype)
    +        assert '1.5e+02' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_precision(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(3.14159269397, 'g', 5, 0, ptype)
    +        assert '3.1416' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_flags_sign(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(-3.14, 'g', 3, 1, ptype)
    +        assert '-3.14' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_flags_add_dot_0(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(3, 'g', 5, 2, ptype)
    +        assert '3.0' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_flags_alt(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(314., 'g', 3, 4, ptype)
    +        assert '314.' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_ptype_nan(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(float('nan'), 'g', 3, 4, ptype)
    +        assert 'nan' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_NAN == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_ptype_infinity(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(1e200 * 1e200, 'g', 0, 0, ptype)
    +        assert 'inf' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_INFINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_ptype_null(self, api):
    +        ptype = lltype.nullptr(rffi.INTP.TO)
    +        r = api.PyOS_double_to_string(3.14, 'g', 3, 0, ptype)
    +        assert '3.14' == rffi.charp2str(r)
    +        assert ptype == lltype.nullptr(rffi.INTP.TO)
    +        rffi.free_charp(r)
    \ No newline at end of file
    diff --git a/pypy/module/marshal/interp_marshal.py b/pypy/module/marshal/interp_marshal.py
    --- a/pypy/module/marshal/interp_marshal.py
    +++ b/pypy/module/marshal/interp_marshal.py
    @@ -156,9 +156,6 @@
         put_tuple_w(TYPE, tuple_w)  puts tuple_w, an unwrapped list of wrapped objects
         """
     
    -    # _annspecialcase_ = "specialize:ctr_location" # polymorphic
    -    # does not work with subclassing
    -
         def __init__(self, space, writer, version):
             self.space = space
             ## self.put = putfunc
    diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
    --- a/pypy/module/micronumpy/compile.py
    +++ b/pypy/module/micronumpy/compile.py
    @@ -371,6 +371,8 @@
         @specialize.arg(2)
         def call_method(self, w_obj, s, *args):
             # XXX even the hacks have hacks
    +        if s == 'size': # used in _array() but never called by tests
    +            return IntObject(0)
             return getattr(w_obj, 'descr_' + s)(self, *args)
     
         @specialize.arg(1)
    diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
    --- a/pypy/module/micronumpy/ctors.py
    +++ b/pypy/module/micronumpy/ctors.py
    @@ -2,6 +2,7 @@
     from pypy.interpreter.gateway import unwrap_spec, WrappedDefault
     from rpython.rlib.buffer import SubBuffer
     from rpython.rlib.rstring import strip_spaces
    +from rpython.rlib.rawstorage import RAW_STORAGE_PTR
     from rpython.rtyper.lltypesystem import lltype, rffi
     
     from pypy.module.micronumpy import descriptor, loop, support
    @@ -45,7 +46,7 @@
         try:
             w_interface = space.getattr(w_object, space.wrap("__array_interface__"))
             if w_interface is None:
    -            return None
    +            return None, False
             version_w = space.finditem(w_interface, space.wrap("version"))
             if version_w is None:
                 raise oefmt(space.w_ValueError, "__array_interface__ found without"
    @@ -67,19 +68,46 @@
                 raise oefmt(space.w_ValueError,
                         "__array_interface__ missing one or more required keys: shape, typestr"
                         )
    -        raise oefmt(space.w_NotImplementedError,
    -                    "creating array from __array_interface__ not supported yet")
    -        '''
    -        data_w = space.listview()
    +        if w_descr is not None:
    +            raise oefmt(space.w_NotImplementedError,
    +                    "__array_interface__ descr not supported yet")
    +        if w_strides is None or space.is_w(w_strides, space.w_None):
    +            strides = None
    +        else:
    +            strides = [space.int_w(i) for i in space.listview(w_strides)]
             shape = [space.int_w(i) for i in space.listview(w_shape)]
             dtype = descriptor.decode_w_dtype(space, w_dtype)
    -        rw = space.is_true(data_w[1])
    -        '''
    -        #print 'create view from shape',shape,'dtype',dtype,'descr',w_descr,'data',data_w[0],'rw',rw
    -        return None
    +        if dtype is None:
    +            raise oefmt(space.w_ValueError,
    +                    "__array_interface__ could not decode dtype %R", w_dtype
    +                    )
    +        if w_data is not None and (space.isinstance_w(w_data, space.w_tuple) or space.isinstance_w(w_data, space.w_list)):
    +            data_w = space.listview(w_data)
    +            data = rffi.cast(RAW_STORAGE_PTR, space.int_w(data_w[0]))
    +            read_only = True # XXX why not space.is_true(data_w[1])
    +            offset = 0
    +            return W_NDimArray.from_shape_and_storage(space, shape, data, 
    +                                    dtype, strides=strides, start=offset), read_only
    +        if w_data is None:
    +            data = w_object
    +        else:
    +            data = w_data
    +        w_offset = space.finditem(w_interface, space.wrap('offset'))
    +        if w_offset is None:
    +            offset = 0
    +        else:
    +            offset = space.int_w(w_offset)
    +        #print 'create view from shape',shape,'dtype',dtype,'data',data
    +        if strides is not None:
    +            raise oefmt(space.w_NotImplementedError,
    +                   "__array_interface__ strides not fully supported yet") 
    +        arr = frombuffer(space, data, dtype, support.product(shape), offset)
    +        new_impl = arr.implementation.reshape(arr, shape)
    +        return W_NDimArray(new_impl), False
    +        
         except OperationError as e:
             if e.match(space, space.w_AttributeError):
    -            return None
    +            return None, False
             raise
     
     
    @@ -103,19 +131,20 @@
         if space.isinstance_w(w_object, space.w_type):
             raise oefmt(space.w_ValueError, "cannot create ndarray from type instance")
         # for anything that isn't already an array, try __array__ method first
    +    dtype = descriptor.decode_w_dtype(space, w_dtype)
         if not isinstance(w_object, W_NDimArray):
             w_array = try_array_method(space, w_object, w_dtype)
             if w_array is not None:
                 # continue with w_array, but do further operations in place
                 w_object = w_array
                 copy = False
    +            dtype = w_object.get_dtype()
         if not isinstance(w_object, W_NDimArray):
    -        w_array = try_interface_method(space, w_object)
    +        w_array, _copy = try_interface_method(space, w_object)
             if w_array is not None:
                 w_object = w_array
    -            copy = False
    -    dtype = descriptor.decode_w_dtype(space, w_dtype)
    -
    +            copy = _copy
    +            dtype = w_object.get_dtype()
     
         if isinstance(w_object, W_NDimArray):
             npy_order = order_converter(space, w_order, NPY.ANYORDER)
    diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py
    --- a/pypy/module/micronumpy/loop.py
    +++ b/pypy/module/micronumpy/loop.py
    @@ -534,10 +534,10 @@
                 while not inner_iter.done(inner_state):
                     arg_driver.jit_merge_point(shapelen=shapelen, dtype=dtype)
                     w_val = inner_iter.getitem(inner_state)
    -                new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val)
    -                if dtype.itemtype.ne(new_best, cur_best):
    +                old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val)
    +                if not old_best:
                         result = idx
    -                    cur_best = new_best
    +                    cur_best = w_val
                     inner_state = inner_iter.next(inner_state)
                     idx += 1
                 result = get_dtype_cache(space).w_longdtype.box(result)
    @@ -557,17 +557,17 @@
             while not iter.done(state):
                 arg_flat_driver.jit_merge_point(shapelen=shapelen, dtype=dtype)
                 w_val = iter.getitem(state)
    -            new_best = getattr(dtype.itemtype, op_name)(cur_best, w_val)
    -            if dtype.itemtype.ne(new_best, cur_best):
    +            old_best = getattr(dtype.itemtype, op_name)(cur_best, w_val)
    +            if not old_best:
                     result = idx
    -                cur_best = new_best
    +                cur_best = w_val
                 state = iter.next(state)
                 idx += 1
             return result
     
         return argmin_argmax, argmin_argmax_flat
    -argmin, argmin_flat = _new_argmin_argmax('min')
    -argmax, argmax_flat = _new_argmin_argmax('max')
    +argmin, argmin_flat = _new_argmin_argmax('argmin')
    +argmax, argmax_flat = _new_argmin_argmax('argmax')
     
     dot_driver = jit.JitDriver(name = 'numpy_dot',
                                greens = ['dtype'],
    @@ -684,8 +684,9 @@
         arr_iter, arr_state = arr.create_iter()
         arr_dtype = arr.get_dtype()
         index_dtype = index.get_dtype()
    -    # XXX length of shape of index as well?
    -    while not index_iter.done(index_state):
    +    # support the deprecated form where arr([True]) will return arr[0, ...]
    +    # by iterating over res_iter, not index_iter
    +    while not res_iter.done(res_state):
             getitem_filter_driver.jit_merge_point(shapelen=shapelen,
                                                   index_dtype=index_dtype,
                                                   arr_dtype=arr_dtype,
    diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
    --- a/pypy/module/micronumpy/test/test_ndarray.py
    +++ b/pypy/module/micronumpy/test/test_ndarray.py
    @@ -1852,6 +1852,24 @@
             a = array([(1, 2)], dtype=[('a', 'int64'), ('b', 'int64')])
             assert a.view('S16')[0] == '\x01' + '\x00' * 7 + '\x02'
     
    +    def test_half_conversions(self):
    +        from numpy import array, arange
    +        from math import isnan, isinf
    +        e = array([0, -1, -float('inf'), float('nan'), 6], dtype='float16')
    +        assert map(isnan, e) == [False, False, False, True, False]
    +        assert map(isinf, e) == [False, False, True, False, False]
    +        assert e.argmax() == 3
    +        # numpy preserves value for uint16 -> cast_as_float16 -> 
    +        #     convert_to_float64 -> convert_to_float16 -> uint16
    +        #  even for float16 various float16 nans
    +        all_f16 = arange(0xfe00, 0xffff, dtype='uint16')
    +        all_f16.dtype = 'float16'
    +        all_f32 = array(all_f16, dtype='float32')
    +        b = array(all_f32, dtype='float16')
    +        c = b.view(dtype='uint16')
    +        d = all_f16.view(dtype='uint16')
    +        assert (c == d).all()
    +
         def test_ndarray_view_empty(self):
             from numpy import array, dtype
             x = array([], dtype=[('a', 'int8'), ('b', 'int8')])
    @@ -2220,6 +2238,9 @@
             c = array([True,False,True],bool)
             b = a[c]
             assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all()
    +        c = array([True])
    +        b = a[c]
    +        assert b.shape == (1, 3)
     
         def test_bool_array_index_setitem(self):
             from numpy import arange, array
    @@ -3052,7 +3073,7 @@
             assert (b == zeros(10)).all()
     
         def test_array_interface(self):
    -        from numpy import array
    +        from numpy import array, ones
             a = array(2.5)
             i = a.__array_interface__
             assert isinstance(i['data'][0], int)
    @@ -3075,7 +3096,7 @@
     
             class Dummy(object):
                 def __init__(self, aif=None):
    -                if aif:
    +                if aif is not None:
                         self.__array_interface__ = aif
     
             a = array(Dummy())
    @@ -3084,6 +3105,31 @@
             raises(ValueError, array, Dummy({'version': 0}))
             raises(ValueError, array, Dummy({'version': 'abc'}))
             raises(ValueError, array, Dummy({'version': 3}))
    +        raises(TypeError, array, Dummy({'version': 3, 'typestr': 'f8', 'shape': ('a', 3)}))
    +
    +        a = array([1, 2, 3])
    +        b = array(Dummy(a.__array_interface__))
    +        b[1] = 200
    +        assert a[1] == 2 # upstream compatibility, is this a bug?
    +        interface_a = a.__array_interface__
    +        interface_b = b.__array_interface__
    +        # only the data[0] value should differ
    +        assert interface_a['data'][0] != interface_b['data'][0]
    +        assert interface_b['data'][1] == interface_a['data'][1]
    +        interface_b.pop('data')
    +        interface_a.pop('data')
    +        assert interface_a == interface_b
    +
    +        b = array(Dummy({'version':3, 'shape': (50,), 'typestr': 'u1',
    +                         'data': 'a'*100}))
    +        assert b.dtype == 'uint8'
    +        assert b.shape == (50,)
    +
    +        a = ones((1,), dtype='float16')
    +        b = Dummy(a.__array_interface__)
    +        c = array(b)
    +        assert c.dtype == 'float16'
    +        assert (a == c).all()
     
         def test_array_indexing_one_elem(self):
             from numpy import array, arange
    diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
    --- a/pypy/module/micronumpy/types.py
    +++ b/pypy/module/micronumpy/types.py
    @@ -345,6 +345,14 @@
         def min(self, v1, v2):
             return min(v1, v2)
     
    +    @raw_binary_op
    +    def argmax(self, v1, v2):
    +        return v1 >= v2
    +
    +    @raw_binary_op
    +    def argmin(self, v1, v2):
    +        return v1 <= v2
    +
         @raw_unary_op
         def rint(self, v):
             float64 = Float64(self.space)
    @@ -820,6 +828,14 @@
         def min(self, v1, v2):
             return v1 if v1 <= v2 or rfloat.isnan(v1) else v2
     
    +    @raw_binary_op
    +    def argmax(self, v1, v2):
    +        return v1 >= v2 or rfloat.isnan(v1)
    +
    +    @raw_binary_op
    +    def argmin(self, v1, v2):
    +        return v1 <= v2 or rfloat.isnan(v1)
    +
         @simple_binary_op
         def fmax(self, v1, v2):
             return v1 if v1 >= v2 or rfloat.isnan(v2) else v2
    @@ -1407,6 +1423,16 @@
                 return v1
             return v2
     
    +    def argmin(self, v1, v2):
    +        if self.le(v1, v2) or self.isnan(v1):
    +            return True
    +        return False
    +
    +    def argmax(self, v1, v2):
    +        if self.ge(v1, v2) or self.isnan(v1):
    +            return True
    +        return False
    +
         @complex_binary_op
         def floordiv(self, v1, v2):
             (r1, i1), (r2, i2) = v1, v2
    @@ -1927,6 +1953,18 @@
                 return v1
             return v2
     
    +    @raw_binary_op
    +    def argmax(self, v1, v2):
    +        if self.space.is_true(self.space.ge(v1, v2)):
    +            return True
    +        return False
    +
    +    @raw_binary_op
    +    def argmin(self, v1, v2):
    +        if self.space.is_true(self.space.le(v1, v2)):
    +            return True
    +        return False
    +
         @raw_unary_op
         def bool(self,v):
             return self._obool(v)
    diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py
    --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py
    +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py
    @@ -248,3 +248,23 @@
             loop, = log.loops_by_filename(self.filepath)
             ops = loop.ops_by_id('getitem', include_guard_not_invalidated=False)
             assert log.opnames(ops) == []
    +
    +    def test_enumerate_list(self):
    +        def main(n):
    +            for a, b in enumerate([1, 2] * 1000):
    +                a + b
    +
    +        log = self.run(main, [1000])
    +        loop, = log.loops_by_filename(self.filepath)
    +        opnames = log.opnames(loop.allops())
    +        assert opnames.count('new_with_vtable') == 0
    +
    +    def test_enumerate(self):
    +        def main(n):
    +            for a, b in enumerate("abc" * 1000):
    +                a + ord(b)
    +
    +        log = self.run(main, [1000])
    +        loop, = log.loops_by_filename(self.filepath)
    +        opnames = log.opnames(loop.allops())
    +        assert opnames.count('new_with_vtable') == 0
    diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py
    --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py
    +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py
    @@ -1336,7 +1336,8 @@
             # these depend on user-defined data, so should not be shared
             assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo")
             assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*")
    -        assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo")
    +        # the following test is an opaque enum, which we no longer support
    +        #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo")
             # sanity check: twice 'ffi1'
             assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *")
     
    @@ -1348,6 +1349,17 @@
             assert ffi.getctype("pe") == 'e *'
             assert ffi.getctype("e1*") == 'e1 *'
     
    +    def test_opaque_enum(self):
    +        ffi = FFI(backend=self.Backend())
    +        ffi.cdef("enum foo;")
    +        from cffi import __version_info__
    +        if __version_info__ < (1, 4):
    +            py.test.skip("re-enable me in version 1.4")
    +        e = py.test.raises(CDefError, ffi.cast, "enum foo", -1)
    +        assert str(e.value) == (
    +            "'enum foo' has no values explicitly defined: refusing to guess "
    +            "which integer type it is meant to be (unsigned/signed, int/long)")
    +
         def test_new_ctype(self):
             ffi = FFI(backend=self.Backend())
             p = ffi.new("int *")
    diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py
    @@ -0,0 +1,35 @@
    +# Generated by pypy/tool/import_cffi.py
    +import py, os, cffi, re
    +import _cffi_backend
    +
    +
    +def getlines():
    +    try:
    +        f = open(os.path.join(os.path.dirname(cffi.__file__),
    +                              '..', 'c', 'commontypes.c'))
    +    except IOError:
    +        py.test.skip("cannot find ../c/commontypes.c")
    +    lines = [line for line in f.readlines() if line.strip().startswith('EQ(')]
    +    f.close()
    +    return lines
    +
    +def test_alphabetical_order():
    +    lines = getlines()
    +    assert lines == sorted(lines)
    +
    +def test_dependencies():
    +    r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?')
    +    lines = getlines()
    +    d = {}
    +    for line in lines:
    +        match = r.search(line)
    +        if match is not None:
    +            d[match.group(1)] = match.group(2)
    +    for value in d.values():
    +        if value:
    +            assert value in d
    +
    +def test_get_common_types():
    +    d = {}
    +    _cffi_backend._get_common_types(d)
    +    assert d["bool"] == "_Bool"
    diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
    --- a/pypy/objspace/std/bytearrayobject.py
    +++ b/pypy/objspace/std/bytearrayobject.py
    @@ -1231,6 +1231,21 @@
         def setitem(self, index, char):
             self.data[index] = char
     
    +    def getslice(self, start, stop, step, size):
    +        if size == 0:
    +            return ""
    +        if step == 1:
    +            assert 0 <= start <= stop
    +            if start == 0 and stop == len(self.data):
    +                return "".join(self.data)
    +            return "".join(self.data[start:stop])
    +        return Buffer.getslice(self, start, stop, step, size)
    +
    +    def setslice(self, start, string):
    +        # No bounds checks.
    +        for i in range(len(string)):
    +            self.data[start + i] = string[i]
    +
     
     @specialize.argtype(1)
     def _memcmp(selfvalue, buffer, length):
    diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py
    --- a/pypy/objspace/std/test/test_tupleobject.py
    +++ b/pypy/objspace/std/test/test_tupleobject.py
    @@ -413,8 +413,9 @@
                 from __pypy__ import specialized_zip_2_lists
             except ImportError:
                 specialized_zip_2_lists = zip
    -        raises(TypeError, specialized_zip_2_lists, [], ())
    -        raises(TypeError, specialized_zip_2_lists, (), [])
    +        else:
    +            raises(TypeError, specialized_zip_2_lists, [], ())
    +            raises(TypeError, specialized_zip_2_lists, (), [])
             assert specialized_zip_2_lists([], []) == [
                 ]
             assert specialized_zip_2_lists([2, 3], []) == [
    diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py
    --- a/pypy/tool/ann_override.py
    +++ b/pypy/tool/ann_override.py
    @@ -2,6 +2,7 @@
     from rpython.annotator.policy import AnnotatorPolicy
     from rpython.flowspace.model import Constant
     from rpython.annotator import specialize
    +from rpython.annotator.classdesc import InstanceSource, ClassDef
     
     
     
    @@ -20,7 +21,6 @@
     
         def specialize__wrap(self,  funcdesc, args_s):
             from pypy.interpreter.baseobjspace import W_Root
    -        from rpython.annotator.classdef import ClassDef
             W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root)
             typ = args_s[1].knowntype
             if isinstance(typ, ClassDef):
    @@ -50,54 +50,34 @@
                     typ = (None, str)
             return funcdesc.cachedgraph(typ)
     
    -    def _remember_immutable(self, t, cached):
    -        # for jit benefit
    -        if cached not in t._immutable_fields_: # accessed this way just
    -                                               # for convenience
    -            t._immutable_fields_.append(cached)
    -
    -    def attach_lookup(self, t, attr):
    -        cached = "cached_%s" % attr
    -        if not t.is_heaptype() and not t.is_cpytype():
    -            self._remember_immutable(t, cached)
    -            setattr(t, cached, t._lookup(attr))
    -            return True
    -        return False
    -
    -    def attach_lookup_in_type_where(self, t, attr):
    -        cached = "cached_where_%s" % attr
    -        if not t.is_heaptype() and not t.is_cpytype():
    -            self._remember_immutable(t, cached)
    -            setattr(t, cached, t._lookup_where(attr))
    -            return True
    -        return False
    -
         def consider_lookup(self, bookkeeper, attr):
    -        from rpython.annotator.classdef import InstanceSource
             assert attr not in self.lookups
             from pypy.objspace.std import typeobject
             cached = "cached_%s" % attr
             clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
             classdesc = clsdef.classdesc
    +        classdesc.immutable_fields.add(cached)
             classdesc.classdict[cached] = Constant(None)
             clsdef.add_source_for_attribute(cached, classdesc)
             for t in self.pypytypes:
    -            if self.attach_lookup(t, attr):
    +            if not (t.is_heaptype() or t.is_cpytype()):
    +                setattr(t, cached, t._lookup(attr))
                     source = InstanceSource(bookkeeper, t)
                     clsdef.add_source_for_attribute(cached, source)
             self.lookups[attr] = True
     
         def consider_lookup_in_type_where(self, bookkeeper, attr):
    -        from rpython.annotator.classdef import InstanceSource
             assert attr not in self.lookups_where
             from pypy.objspace.std import typeobject
             cached = "cached_where_%s" % attr
             clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
             classdesc = clsdef.classdesc
    +        classdesc.immutable_fields.add(cached)
             classdesc.classdict[cached] = Constant((None, None))
             clsdef.add_source_for_attribute(cached, classdesc)
             for t in self.pypytypes:
    -            if self.attach_lookup_in_type_where(t, attr):
    +            if not (t.is_heaptype() or t.is_cpytype()):
    +                setattr(t, cached, t._lookup_where(attr))
                     source = InstanceSource(bookkeeper, t)
                     clsdef.add_source_for_attribute(cached, source)
             self.lookups_where[attr] = True
    @@ -135,18 +115,19 @@
         def event(self, bookkeeper, what, x):
             from pypy.objspace.std import typeobject
             if isinstance(x, typeobject.W_TypeObject):
    -            from rpython.annotator.classdef import InstanceSource
                 clsdef = bookkeeper.getuniqueclassdef(typeobject.W_TypeObject)
                 self.pypytypes[x] = True
                 #print "TYPE", x
                 for attr in self.lookups:
    -                if attr and self.attach_lookup(x, attr):
    +                if attr and not (x.is_heaptype() or x.is_cpytype()):
                         cached = "cached_%s" % attr
    +                    setattr(x, cached, x._lookup(attr))
                         source = InstanceSource(bookkeeper, x)
                         clsdef.add_source_for_attribute(cached, source)
                 for attr in self.lookups_where:
    -                if attr and self.attach_lookup_in_type_where(x, attr):
    +                if attr and not (x.is_heaptype() or x.is_cpytype()):
                         cached = "cached_where_%s" % attr
    +                    setattr(x, cached, x._lookup_where(attr))
                         source = InstanceSource(bookkeeper, x)
                         clsdef.add_source_for_attribute(cached, source)
             return
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -14,8 +14,8 @@
         SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint,
         s_None, s_ImpossibleValue, SomeBool, SomeTuple,
         SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked,
    -    SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty, AnnotatorError)
    -from rpython.annotator.classdef import InstanceSource, ClassDef
    +    SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty)
    +from rpython.annotator.classdesc import ClassDef, ClassDesc
     from rpython.annotator.listdef import ListDef, ListItem
     from rpython.annotator.dictdef import DictDef
     from rpython.annotator import description
    @@ -23,7 +23,6 @@
     from rpython.annotator.argument import simple_args
     from rpython.rlib.objectmodel import r_dict, r_ordereddict, Symbolic
     from rpython.tool.algo.unionfind import UnionFind
    -from rpython.tool.flattenrec import FlattenRecursion
     from rpython.rtyper import extregistry
     
     
    @@ -163,9 +162,7 @@
                 s_callable.consider_call_site(args, s_result, call_op)
     
         def getuniqueclassdef(self, cls):
    -        """Get the ClassDef associated with the given user cls.
    -        Avoid using this!  It breaks for classes that must be specialized.
    -        """
    +        """Get the ClassDef associated with the given user cls."""
             assert cls is not object
             desc = self.getdesc(cls)
             return desc.getuniqueclassdef()
    @@ -334,8 +331,9 @@
                      and x.__class__.__module__ != '__builtin__':
                 if hasattr(x, '_cleanup_'):
                     x._cleanup_()
    -            self.see_mutable(x)
    -            result = SomeInstance(self.getuniqueclassdef(x.__class__))
    +            classdef = self.getuniqueclassdef(x.__class__)
    +            classdef.see_instance(x)
    +            result = SomeInstance(classdef)
             elif x is None:
                 return s_None
             else:
    @@ -362,7 +360,7 @@
                     if pyobj.__module__ == '__builtin__': # avoid making classdefs for builtin types
                         result = self.getfrozen(pyobj)
                     else:
    -                    result = description.ClassDesc(self, pyobj)
    +                    result = ClassDesc(self, pyobj)
                 elif isinstance(pyobj, types.MethodType):
                     if pyobj.im_self is None:   # unbound
                         return self.getdesc(pyobj.im_func)
    @@ -375,11 +373,11 @@
                             self.getdesc(pyobj.im_self))            # frozendesc
                     else: # regular method
                         origincls, name = origin_of_meth(pyobj)
    -                    self.see_mutable(pyobj.im_self)
    +                    classdef = self.getuniqueclassdef(pyobj.im_class)
    +                    classdef.see_instance(pyobj.im_self)
                         assert pyobj == getattr(pyobj.im_self, name), (
                             "%r is not %s.%s ??" % (pyobj, pyobj.im_self, name))
                         # emulate a getattr to make sure it's on the classdef
    -                    classdef = self.getuniqueclassdef(pyobj.im_class)
                         classdef.find_attribute(name)
                         result = self.getmethoddesc(
                             self.getdesc(pyobj.im_func),            # funcdesc
    @@ -400,15 +398,6 @@
                 self.descs[pyobj] = result
                 return result
     
    -    def have_seen(self, x):
    -        # this might need to expand some more.
    -        if x in self.descs:
    -            return True
    -        elif (x.__class__, x) in self.seen_mutable:
    -            return True
    -        else:
    -            return False
    -
         def getfrozen(self, pyobj):
             return description.FrozenDesc(self, pyobj)
     
    @@ -425,22 +414,6 @@
                 self.methoddescs[key] = result
                 return result
     
    -    _see_mutable_flattenrec = FlattenRecursion()
    -
    -    def see_mutable(self, x):
    -        key = (x.__class__, x)
    -        if key in self.seen_mutable:
    -            return
    -        clsdef = self.getuniqueclassdef(x.__class__)
    -        self.seen_mutable[key] = True
    -        self.event('mutable', x)
    -        source = InstanceSource(self, x)
    -        def delayed():
    -            for attr in source.all_instance_attributes():
    -                clsdef.add_source_for_attribute(attr, source)
    -                # ^^^ can trigger reflowing
    -        self._see_mutable_flattenrec(delayed)
    -
         def valueoftype(self, t):
             return annotationoftype(t, self)
     
    @@ -495,6 +468,20 @@
     
             return s_result
     
    +    def getattr_locations(self, clsdesc, attrname):
    +        attrdef = clsdesc.classdef.find_attribute(attrname)
    +        return attrdef.read_locations
    +
    +    def record_getattr(self, clsdesc, attrname):
    +        locations = self.getattr_locations(clsdesc, attrname)
    +        locations.add(self.position_key)
    +
    +    def update_attr(self, clsdef, attrdef):
    +        locations = self.getattr_locations(clsdef.classdesc, attrdef.name)
    +        for position in locations:
    +            self.annotator.reflowfromposition(position)
    +        attrdef.validate(homedef=clsdef)
    +
         def pbc_call(self, pbc, args, emulated=None):
             """Analyse a call to a SomePBC() with the given args (list of
             annotations).
    diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py
    --- a/rpython/annotator/builtin.py
    +++ b/rpython/annotator/builtin.py
    @@ -5,13 +5,14 @@
     from collections import OrderedDict
     
     from rpython.annotator.model import (
    -    SomeInteger, SomeObject, SomeChar, SomeBool, SomeString, SomeTuple,
    +    SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple,
         SomeUnicodeCodePoint, SomeFloat, unionof, SomeUnicodeString,
         SomePBC, SomeInstance, SomeDict, SomeList, SomeWeakRef, SomeIterator,
         SomeOrderedDict, SomeByteArray, add_knowntypedata, s_ImpossibleValue,)
     from rpython.annotator.bookkeeper import (
         getbookkeeper, immutablevalue, BUILTIN_ANALYZERS, analyzer_for)
     from rpython.annotator import description
    +from rpython.annotator.classdesc import ClassDef
     from rpython.flowspace.model import Constant
     import rpython.rlib.rarithmetic
     import rpython.rlib.objectmodel
    @@ -124,7 +125,6 @@
     
     def our_issubclass(cls1, cls2):
         """ we're going to try to be less silly in the face of old-style classes"""
    -    from rpython.annotator.classdef import ClassDef
         if cls2 is object:
             return True
         def classify(cls):
    diff --git a/rpython/annotator/classdef.py b/rpython/annotator/classdef.py
    deleted file mode 100644
    --- a/rpython/annotator/classdef.py
    +++ /dev/null
    @@ -1,434 +0,0 @@
    -"""
    -Type inference for user-defined classes.
    -"""
    -from rpython.annotator.model import (
    -    SomePBC, s_ImpossibleValue, unionof, s_None, AnnotatorError)
    -from rpython.annotator import description
    -
    -
    -# The main purpose of a ClassDef is to collect information about class/instance
    -# attributes as they are really used.  An Attribute object is stored in the
    -# most general ClassDef where an attribute of that name is read/written:
    -#    classdef.attrs = {'attrname': Attribute()}
    -#
    -# The following invariants hold:
    -#
    -# (A) if an attribute is read/written on an instance of class A, then the
    -#     classdef of A or a parent class of A has an Attribute object corresponding
    -#     to that name.
    -#
    -# (I) if B is a subclass of A, then they don't both have an Attribute for the
    -#     same name.  (All information from B's Attribute must be merged into A's.)
    -#
    -# Additionally, each ClassDef records an 'attr_sources': it maps attribute names
    -# to a list of 'source' objects that want to provide a constant value for this
    -# attribute at the level of this class.  The attr_sources provide information
    -# higher in the class hierarchy than concrete Attribute()s.  It is for the case
    -# where (so far or definitely) the user program only reads/writes the attribute
    -# at the level of a subclass, but a value for this attribute could possibly
    -# exist in the parent class or in an instance of a parent class.
    -#
    -# The point of not automatically forcing the Attribute instance up to the
    -# parent class which has a class attribute of the same name is apparent with
    -# multiple subclasses:
    -#
    -#                                    A
    -#                                 attr=s1
    -#                                  /   \
    -#                                 /     \
    -#                                B       C
    -#                             attr=s2  attr=s3
    -#
    -# XXX this does not seem to be correct, but I don't know how to phrase
    -#     it correctly. See test_specific_attributes in test_annrpython
    -#
    -# In this case, as long as 'attr' is only read/written from B or C, the
    -# Attribute on B says that it can be 's1 or s2', and the Attribute on C says
    -# it can be 's1 or s3'.  Merging them into a single Attribute on A would give
    -# the more imprecise 's1 or s2 or s3'.
    -#
    -# The following invariant holds:
    -#
    -# (II) if a class A has an Attribute, the 'attr_sources' for the same name is
    -#      empty.  It is also empty on all subclasses of A.  (The information goes
    -#      into the Attribute directly in this case.)
    -#
    -# The following invariant holds:
    -#
    -#  (III) for a class A, each attrsource that comes from the class (as opposed to
    -#        from a prebuilt instance) must be merged into all Attributes of the
    -#        same name in all subclasses of A, if any.  (Parent class attributes can
    -#        be visible in reads from instances of subclasses.)
    
    From noreply at buildbot.pypy.org  Fri Nov 20 05:22:39 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Fri, 20 Nov 2015 11:22:39 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: fixed wrong parameter on added
     instruction (provided an i32, needed unsigned i32)
    Message-ID: <20151120102239.AC5FC1C023F@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80789:636198e3c58c
    Date: 2015-11-20 11:23 +0100
    http://bitbucket.org/pypy/pypy/changeset/636198e3c58c/
    
    Log:	fixed wrong parameter on added instruction (provided an i32, needed
    	unsigned i32)
    
    diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py
    --- a/rpython/jit/backend/zarch/instructions.py
    +++ b/rpython/jit/backend/zarch/instructions.py
    @@ -59,7 +59,7 @@
         'CLG':     ('rxy',    ['\xE3','\x21']),
         'CGHI':    ('ri',     ['\xA7','\x0F']),
         'CGFI':    ('ril',    ['\xC2','\x0C']),
    -    'CLGFI':   ('ril',    ['\xC2','\x0E']),
    +    'CLGFI':   ('ril',    ['\xC2','\x0E'], 'r,u32'),
         'CGIJ':    ('rie_c',  ['\xEC','\x7C']),
         'CLGIJ':   ('rie_c',  ['\xEC','\x7D'], 'r,u8,r/m,i16'),
         'CGIB':    ('ris',    ['\xEC','\xFC']),
    @@ -124,7 +124,7 @@
         'LGR':     ('rre',   ['\xB9','\x04']),
         'LG':      ('rxy',   ['\xE3','\x04']),
         'LARL':    ('ril',   ['\xC0','\x00'], 'r/m,h32'),
    -    'IIHF':    ('ril',   ['\xC0','\x08']),
    +    'IIHF':    ('ril',   ['\xC0','\x08'], 'r,u32'),
     
         # load on condition
         'LOCGR':  ('rrf_c',    ['\xB9','\xE2']),
    
    From noreply at buildbot.pypy.org  Fri Nov 20 06:29:11 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Fri, 20 Nov 2015 12:29:11 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: did not free the list of pending
     guard tokens,
     now the backend does not keep pending guard tokens around. (gc.get_referrers
     is quite a handy function)
    Message-ID: <20151120112911.6AF951C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80790:279538e83767
    Date: 2015-11-20 12:29 +0100
    http://bitbucket.org/pypy/pypy/changeset/279538e83767/
    
    Log:	did not free the list of pending guard tokens, now the backend does
    	not keep pending guard tokens around. (gc.get_referrers is quite a
    	handy function)
    
    diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py
    --- a/rpython/jit/backend/zarch/assembler.py
    +++ b/rpython/jit/backend/zarch/assembler.py
    @@ -36,8 +36,6 @@
         def __init__(self, cpu, translate_support_code=False):
             BaseAssembler.__init__(self, cpu, translate_support_code)
             self.mc = None
    -        self.pool = LiteralPool()
    -        self.pending_guards = None
             self.current_clt = None
             self._regalloc = None
             self.datablockwrapper = None
    @@ -64,12 +62,14 @@
             self.mc.datablockwrapper = self.datablockwrapper
             self.target_tokens_currently_compiling = {}
             self.frame_depth_to_patch = []
    +        self.pool = LiteralPool()
     
         def teardown(self):
    +        self.pending_guard_tokens = None
             self.current_clt = None
             self._regalloc = None
             self.mc = None
    -        self.pending_guards = None
    +        self.pool = None
     
         def target_arglocs(self, looptoken):
             return looptoken._zarch_arglocs
    @@ -383,7 +383,7 @@
             regalloc.compute_hint_frame_locations(operations)
             regalloc.walk_operations(inputargs, operations)
             assert self.guard_success_cc == c.cond_none
    -        if 1: # we_are_translated() or self.cpu.dont_keepalive_stuff:
    +        if we_are_translated() or self.cpu.dont_keepalive_stuff:
                 self._regalloc = None   # else keep it around for debugging
             frame_depth = regalloc.get_final_frame_depth()
             jump_target_descr = regalloc.jump_target_descr
    diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py
    --- a/rpython/jit/backend/zarch/codebuilder.py
    +++ b/rpython/jit/backend/zarch/codebuilder.py
    @@ -78,7 +78,6 @@
             pos = self.get_relative_pos()
             self.ops_offset[op] = pos
     
    -
         def _dump_trace(self, addr, name, formatter=-1):
             if not we_are_translated():
                 if formatter != -1:
    @@ -110,7 +109,6 @@
     
         def b_cond_offset(self, offset, condition):
             assert condition != c.cond_none
    -        # TODO ? BI, BO = c.encoding[condition]
             self.BRC(condition, l.imm(offset))
     
         def b_offset(self, reladdr):
    @@ -118,7 +116,6 @@
             self.BRC(c.ANY, l.imm(offset))
     
         def reserve_guard_branch(self):
    -        print "reserve!", self.get_relative_pos()
             self.BRC(l.imm(0x0), l.imm(0))
     
         def cmp_op(self, a, b, pool=False, imm=False, signed=True, fp=False):
    diff --git a/rpython/jit/backend/zarch/pool.py b/rpython/jit/backend/zarch/pool.py
    --- a/rpython/jit/backend/zarch/pool.py
    +++ b/rpython/jit/backend/zarch/pool.py
    @@ -154,8 +154,7 @@
             for guard_token in pending_guard_tokens:
                 descr = guard_token.faildescr
                 offset = self.offset_map[descr]
    +            assert isinstance(offset, int)
                 guard_token._pool_offset = offset
                 ptr = rffi.cast(lltype.Signed, guard_token.gcmap)
                 self.overwrite_64(mc, offset + RECOVERY_GCMAP_POOL_OFFSET, ptr)
    -
    -        self.reset()
    diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py
    --- a/rpython/jit/backend/zarch/runner.py
    +++ b/rpython/jit/backend/zarch/runner.py
    @@ -17,6 +17,7 @@
         cast_ptr_to_int = staticmethod(cast_ptr_to_int)
     
     class CPU_S390_64(AbstractZARCHCPU):
    +    dont_keepalive_stuff = True
         supports_floats = True
     
         IS_64_BIT = True
    
    From noreply at buildbot.pypy.org  Fri Nov 20 06:47:49 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Fri, 20 Nov 2015 12:47:49 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: pushing forward floating point
     arithmetic (work in progress), lunch needed
    Message-ID: <20151120114749.121C11C023F@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80791:e224f731963f
    Date: 2015-11-20 12:48 +0100
    http://bitbucket.org/pypy/pypy/changeset/e224f731963f/
    
    Log:	pushing forward floating point arithmetic (work in progress), lunch
    	needed
    
    diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py
    --- a/rpython/jit/backend/zarch/helper/regalloc.py
    +++ b/rpython/jit/backend/zarch/helper/regalloc.py
    @@ -152,6 +152,25 @@
         self.free_op_vars()
         return [l0, l1]
     
    +def generate_prepare_float_binary_op(allow_swap=False):
    +    def prepare_float_binary_op(self, op):
    +        a0 = op.getarg(0)
    +        a1 = op.getarg(1)
    +        if allow_swap:
    +            if isinstance(a0, Const):
    +                a0,a1 = a1,a0
    +        l0 = self.ensure_reg(a0)
    +        l1 = self.ensure_reg(a1)
    +        if isinstance(a0, Const):
    +            newloc = self.force_allocate_reg(op)
    +            self.assembler.regalloc_mov(l0, newloc)
    +            l0 = newloc
    +        else:
    +            self.force_result_in_reg(op, a0)
    +        self.free_op_vars()
    +        return [l0, l1]
    +    return prepare_float_binary_op
    +
     def prepare_unary_cmp(self, op):
         a0 = op.getarg(0)
         assert not isinstance(a0, ConstInt)
    diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py
    --- a/rpython/jit/backend/zarch/opassembler.py
    +++ b/rpython/jit/backend/zarch/opassembler.py
    @@ -173,33 +173,10 @@
     class FloatOpAssembler(object):
         _mixin_ = True
     
    -    def emit_float_add(self, op, arglocs, regalloc):
    -        l0, l1 = arglocs
    -        if l1.is_in_pool():
    -            self.mc.ADB(l0, l1)
    -        else:
    -            self.mc.ADBR(l0, l1)
    -
    -    def emit_float_sub(self, op, arglocs, regalloc):
    -        l0, l1 = arglocs
    -        if l1.is_in_pool():
    -            self.mc.SDB(l0, l1)
    -        else:
    -            self.mc.SDBR(l0, l1)
    -
    -    def emit_float_mul(self, op, arglocs, regalloc):
    -        l0, l1 = arglocs
    -        if l1.is_in_pool():
    -            self.mc.MDB(l0, l1)
    -        else:
    -            self.mc.MDBR(l0, l1)
    -
    -    def emit_float_div(self, op, arglocs, regalloc):
    -        l0, l1 = arglocs
    -        if l1.is_in_pool():
    -            self.mc.DDB(l0, l1)
    -        else:
    -            self.mc.DDBR(l0, l1)
    +    emit_float_add = gen_emit_rr_or_rpool('ADBR','ADB')
    +    emit_float_sub = gen_emit_rr_or_rpool('SDBR','SDB')
    +    emit_float_mul = gen_emit_rr_or_rpool('MDBR','MDB')
    +    emit_float_truediv = gen_emit_rr_or_rpool('DDBR','DDB')
     
         def emit_cast_float_to_int(self, op, arglocs, regalloc):
             f0, r0 = arglocs
    diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py
    --- a/rpython/jit/backend/zarch/regalloc.py
    +++ b/rpython/jit/backend/zarch/regalloc.py
    @@ -55,6 +55,7 @@
         box_types             = [FLOAT]
         save_around_call_regs = r.VOLATILES_FLOAT
         assert set(save_around_call_regs).issubset(all_regs)
    +    pool = None
     
         def convert_to_adr(self, c):
             assert isinstance(c, ConstFloat)
    @@ -64,8 +65,8 @@
             return adr
     
         def convert_to_imm(self, c):
    -        adr = self.convert_to_adr(c)
    -        return l.ConstFloatLoc(adr)
    +        off = self.pool.get_offset(c)
    +        return l.pool(off)
     
         def __init__(self, longevity, frame_manager=None, assembler=None):
             RegisterManager.__init__(self, longevity, frame_manager, assembler)
    @@ -330,6 +331,7 @@
                                          assembler = self.assembler)
             self.fprm = FPRegisterManager(self.longevity, frame_manager = self.fm,
                                           assembler = self.assembler)
    +        self.fprm.pool = self.assembler.pool
             return operations
     
         def prepare_loop(self, inputargs, operations, looptoken, allgcrefs):
    @@ -668,10 +670,11 @@
         prepare_int_force_ge_zero = helper.prepare_unary_op
     
     
    -    prepare_float_add = helper.prepare_binary_op
    -    prepare_float_sub = helper.prepare_binary_op
    -    prepare_float_mul = helper.prepare_binary_op
    -    prepare_float_truediv = helper.prepare_binary_op
    +    prepare_float_add = helper.generate_prepare_float_binary_op(allow_swap=True)
    +    prepare_float_sub = helper.generate_prepare_float_binary_op()
    +    prepare_float_mul = helper.generate_prepare_float_binary_op(allow_swap=True)
    +    prepare_float_truediv = helper.generate_prepare_float_binary_op()
    +
     
         prepare_cast_ptr_to_int = helper.prepare_same_as
         prepare_cast_int_to_ptr = helper.prepare_same_as
    
    From noreply at buildbot.pypy.org  Fri Nov 20 08:55:46 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Fri, 20 Nov 2015 14:55:46 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: float comparison operations
     passing int_float_operations tests (unary ops missing)
    Message-ID: <20151120135546.A30A31C0352@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80792:0f8f161d153e
    Date: 2015-11-20 14:56 +0100
    http://bitbucket.org/pypy/pypy/changeset/0f8f161d153e/
    
    Log:	float comparison operations passing int_float_operations tests
    	(unary ops missing)
    
    diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py
    --- a/rpython/jit/backend/zarch/codebuilder.py
    +++ b/rpython/jit/backend/zarch/codebuilder.py
    @@ -120,8 +120,10 @@
     
         def cmp_op(self, a, b, pool=False, imm=False, signed=True, fp=False):
             if fp == True:
    -            xxx
    -            self.fcmpu(a, b)
    +            if pool:
    +                self.CDB(a, b)
    +            else:
    +                self.CDBR(a, b)
             else:
                 if signed:
                     if pool:
    diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py
    --- a/rpython/jit/backend/zarch/helper/assembler.py
    +++ b/rpython/jit/backend/zarch/helper/assembler.py
    @@ -14,18 +14,20 @@
         self.mc.cmp_op(l0, l1, pool=l1.is_in_pool(), imm=l1.is_imm(), signed=signed, fp=fp)
     
         if fp:
    -        xxx
             # Support for NaNs: with LE or GE, if one of the operands is a
             # NaN, we get CR=1,0,0,0 (unordered bit only).  We're about to
             # check "not GT" or "not LT", but in case of NaN we want to
             # get the answer False.
    -        #if condition == c.LE:
    -        #    self.mc.crnor(1, 1, 3)
    -        #    condition = c.GT
    -        #elif condition == c.GE:
    -        #    self.mc.crnor(0, 0, 3)
    -        #    condition = c.LT
    -        pass
    +        if condition == c.LE:
    +            pass
    +            # TODO xxx
    +            #self.mc.crnor(1, 1, 3)
    +            #condition = c.GT
    +        elif condition == c.GE:
    +            pass
    +            #xxx
    +            #self.mc.crnor(0, 0, 3)
    +            #condition = c.LT
         self.flush_cc(condition, arglocs[2])
     
     
    diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py
    --- a/rpython/jit/backend/zarch/helper/regalloc.py
    +++ b/rpython/jit/backend/zarch/helper/regalloc.py
    @@ -143,6 +143,13 @@
             return [l0, l1, res, invert]
         return prepare_cmp_op
     
    +def prepare_float_cmp_op(self, op):
    +    l0 = self.ensure_reg(op.getarg(0), force_in_reg=True)
    +    l1 = self.ensure_reg(op.getarg(1))
    +    res = self.force_allocate_reg_or_cc(op)
    +    self.free_op_vars()
    +    return [l0, l1, res]
    +
     def prepare_binary_op(self, op):
         a0 = op.getarg(0)
         a1 = op.getarg(1)
    diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py
    --- a/rpython/jit/backend/zarch/opassembler.py
    +++ b/rpython/jit/backend/zarch/opassembler.py
    @@ -178,6 +178,13 @@
         emit_float_mul = gen_emit_rr_or_rpool('MDBR','MDB')
         emit_float_truediv = gen_emit_rr_or_rpool('DDBR','DDB')
     
    +    emit_float_lt = gen_emit_cmp_op(c.LT, fp=True)
    +    emit_float_le = gen_emit_cmp_op(c.LE, fp=True)
    +    emit_float_eq = gen_emit_cmp_op(c.EQ, fp=True)
    +    emit_float_ne = gen_emit_cmp_op(c.NE, fp=True)
    +    emit_float_gt = gen_emit_cmp_op(c.GT, fp=True)
    +    emit_float_ge = gen_emit_cmp_op(c.GE, fp=True)
    +
         def emit_cast_float_to_int(self, op, arglocs, regalloc):
             f0, r0 = arglocs
             self.mc.CGDBR(r0, f0, c.FP_CUTOFF)
    diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py
    --- a/rpython/jit/backend/zarch/regalloc.py
    +++ b/rpython/jit/backend/zarch/regalloc.py
    @@ -78,9 +78,16 @@
             offset = self.assembler.pool.get_offset(var)
             return l.pool(offset, r.POOL)
     
    -    def ensure_reg(self, box):
    +    def ensure_reg(self, box, force_in_reg):
             if isinstance(box, Const):
    -            return self.place_in_pool(box)
    +            poolloc = self.place_in_pool(box)
    +            if force_in_reg:
    +                tmp = TempVar()
    +                self.temp_boxes.append(tmp)
    +                reg = self.force_allocate_reg(tmp)
    +                self.assembler.mc.LD(reg, poolloc)
    +                return reg
    +            return poolloc
             else:
                 assert box in self.temp_boxes
                 loc = self.make_sure_var_in_reg(box,
    @@ -119,10 +126,17 @@
             #val = self.convert_to_int(c)
             return l.ImmLocation(val)
     
    -    def ensure_reg(self, box):
    +    def ensure_reg(self, box, force_in_reg):
             if isinstance(box, Const):
                 offset = self.assembler.pool.get_descr_offset(box)
    -            return l.pool(offset)
    +            poolloc = l.pool(offset)
    +            if force_in_reg:
    +                tmp = TempVar()
    +                self.temp_boxes.append(tmp)
    +                reg = self.force_allocate_reg(tmp)
    +                self.assembler.mc.LG(reg, poolloc)
    +                return reg
    +            return poolloc
             else:
                 assert box in self.temp_boxes
                 loc = self.make_sure_var_in_reg(box,
    @@ -546,11 +560,11 @@
             else:
                 return self.rm.call_result_location(v)
     
    -    def ensure_reg(self, box):
    +    def ensure_reg(self, box, force_in_reg=False):
             if box.type == FLOAT:
    -            return self.fprm.ensure_reg(box)
    +            return self.fprm.ensure_reg(box, force_in_reg)
             else:
    -            return self.rm.ensure_reg(box)
    +            return self.rm.ensure_reg(box, force_in_reg)
     
         def ensure_reg_or_16bit_imm(self, box):
             if box.type == FLOAT:
    @@ -675,6 +689,13 @@
         prepare_float_mul = helper.generate_prepare_float_binary_op(allow_swap=True)
         prepare_float_truediv = helper.generate_prepare_float_binary_op()
     
    +    prepare_float_lt = helper.prepare_float_cmp_op
    +    prepare_float_le = helper.prepare_float_cmp_op
    +    prepare_float_eq = helper.prepare_float_cmp_op
    +    prepare_float_ne = helper.prepare_float_cmp_op
    +    prepare_float_gt = helper.prepare_float_cmp_op
    +    prepare_float_ge = helper.prepare_float_cmp_op
    +
     
         prepare_cast_ptr_to_int = helper.prepare_same_as
         prepare_cast_int_to_ptr = helper.prepare_same_as
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:08:14 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Fri, 20 Nov 2015 15:08:14 +0100 (CET)
    Subject: [pypy-commit] pypy default: minimal support for greenlet.settrace()
    Message-ID: <20151120140814.51AA51C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r80793:c7b77b0b686c
    Date: 2015-11-20 15:08 +0100
    http://bitbucket.org/pypy/pypy/changeset/c7b77b0b686c/
    
    Log:	minimal support for greenlet.settrace()
    
    diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
    --- a/lib_pypy/greenlet.py
    +++ b/lib_pypy/greenlet.py
    @@ -88,9 +88,19 @@
             #
             try:
                 unbound_method = getattr(_continulet, methodname)
    +            _tls.leaving = current
                 args, kwds = unbound_method(current, *baseargs, to=target)
    -        finally:
                 _tls.current = current
    +        except:
    +            _tls.current = current
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            _tls.leaving = None
    +            raise
    +        else:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            _tls.leaving = None
             #
             if kwds:
                 if args:
    @@ -122,6 +132,34 @@
             return f.f_back.f_back.f_back   # go past start(), __switch(), switch()
     
     # ____________________________________________________________
    +# Recent additions
    +
    +GREENLET_USE_GC = True
    +GREENLET_USE_TRACING = True
    +
    +def gettrace():
    +    return getattr(_tls, 'trace', None)
    +
    +def settrace(callback):
    +    try:
    +        prev = _tls.trace
    +        del _tls.trace
    +    except AttributeError:
    +        prev = None
    +    if callback is not None:
    +        _tls.trace = callback
    +    return prev
    +
    +def _run_trace_callback(event):
    +    try:
    +        _tls.trace(event, (_tls.leaving, _tls.current))
    +    except:
    +        # In case of exceptions trace function is removed
    +        if hasattr(_tls, 'trace'):
    +            del _tls.trace
    +        raise
    +
    +# ____________________________________________________________
     # Internal stuff
     
     try:
    @@ -143,22 +181,32 @@
         _tls.current = gmain
     
     def _greenlet_start(greenlet, args):
    -    args, kwds = args
    -    _tls.current = greenlet
         try:
    -        res = greenlet.run(*args, **kwds)
    -    except GreenletExit, e:
    -        res = e
    +        args, kwds = args
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            res = greenlet.run(*args, **kwds)
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
     
     def _greenlet_throw(greenlet, exc, value, tb):
    -    _tls.current = greenlet
         try:
    -        raise exc, value, tb
    -    except GreenletExit, e:
    -        res = e
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            raise exc, value, tb
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
    diff --git a/pypy/module/test_lib_pypy/test_greenlet_tracing.py b/pypy/module/test_lib_pypy/test_greenlet_tracing.py
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/test_lib_pypy/test_greenlet_tracing.py
    @@ -0,0 +1,53 @@
    +import py
    +try:
    +    from lib_pypy import greenlet
    +except ImportError, e:
    +    py.test.skip(e)
    +
    +class SomeError(Exception):
    +    pass
    +
    +class TestTracing:
    +    def test_greenlet_tracing(self):
    +        main = greenlet.getcurrent()
    +        actions = []
    +        def trace(*args):
    +            actions.append(args)
    +        def dummy():
    +            pass
    +        def dummyexc():
    +            raise SomeError()
    +        oldtrace = greenlet.settrace(trace)
    +        try:
    +            g1 = greenlet.greenlet(dummy)
    +            g1.switch()
    +            g2 = greenlet.greenlet(dummyexc)
    +            py.test.raises(SomeError, g2.switch)
    +        finally:
    +            greenlet.settrace(oldtrace)
    +        assert actions == [
    +            ('switch', (main, g1)),
    +            ('switch', (g1, main)),
    +            ('switch', (main, g2)),
    +            ('throw', (g2, main)),
    +        ]
    +
    +    def test_exception_disables_tracing(self):
    +        main = greenlet.getcurrent()
    +        actions = []
    +        def trace(*args):
    +            actions.append(args)
    +            raise SomeError()
    +        def dummy():
    +            main.switch()
    +        g = greenlet.greenlet(dummy)
    +        g.switch()
    +        oldtrace = greenlet.settrace(trace)
    +        try:
    +            py.test.raises(SomeError, g.switch)
    +            assert greenlet.gettrace() is None
    +        finally:
    +            greenlet.settrace(oldtrace)
    +        assert actions == [
    +            ('switch', (main, g)),
    +        ]
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:21:27 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Fri, 20 Nov 2015 15:21:27 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: passing float_operations
     (includes arith, compare, neg, abs and conversion to integer and back
    Message-ID: <20151120142127.26EC41C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80794:cb6631d78b5c
    Date: 2015-11-20 15:21 +0100
    http://bitbucket.org/pypy/pypy/changeset/cb6631d78b5c/
    
    Log:	passing float_operations (includes arith, compare, neg, abs and
    	conversion to integer and back
    
    diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
    --- a/rpython/jit/backend/test/runner_test.py
    +++ b/rpython/jit/backend/test/runner_test.py
    @@ -419,7 +419,9 @@
     
         def test_float_operations(self):
             from rpython.jit.metainterp.test.test_executor import get_float_tests
    +        from rpython.jit.metainterp.resoperation import opname
             for opnum, boxargs, rettype, retvalue in get_float_tests(self.cpu):
    +            print("testing", opname[opnum])
                 res = self.execute_operation(opnum, boxargs, rettype)
                 if rettype == 'float':
                     res = longlong.getrealfloat(res)
    diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py
    --- a/rpython/jit/backend/zarch/conditions.py
    +++ b/rpython/jit/backend/zarch/conditions.py
    @@ -12,7 +12,8 @@
     NO = loc.imm(0xe) # NO overflow
     ANY = loc.imm(0xf)
     
    -FP_CUTOFF = loc.imm(0x1) # 4.4 => 4, 4.5 => 4
    +FP_ROUND_DEFAULT = loc.imm(0x0)
    +FP_TOWARDS_ZERO = loc.imm(0x5)
     
     cond_none = loc.imm(0x0)
     
    diff --git a/rpython/jit/backend/zarch/helper/regalloc.py b/rpython/jit/backend/zarch/helper/regalloc.py
    --- a/rpython/jit/backend/zarch/helper/regalloc.py
    +++ b/rpython/jit/backend/zarch/helper/regalloc.py
    @@ -190,7 +190,7 @@
     def prepare_unary_op(self, op):
         a0 = op.getarg(0)
         assert not isinstance(a0, ConstInt)
    -    l0 = self.ensure_reg(a0)
    +    l0 = self.ensure_reg(a0, force_in_reg=True)
         res = self.force_result_in_reg(op, a0)
         self.free_op_vars()
         return [l0,]
    diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py
    --- a/rpython/jit/backend/zarch/instructions.py
    +++ b/rpython/jit/backend/zarch/instructions.py
    @@ -217,6 +217,10 @@
         'CDBR':    ('rre',   ['\xB3','\x19']),
         'CEB':     ('rxe',   ['\xED','\x09'], 'r,bidl,-'),
         'CDB':     ('rxe',   ['\xED','\x19'], 'r,bidl,-'),
    +
    +    # complement & positive
    +    'LPDBR':    ('rre',   ['\xB3','\x10']),
    +    'LCDBR':    ('rre',   ['\xB3','\x13']),
     }
     
     # MISC
    diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py
    --- a/rpython/jit/backend/zarch/opassembler.py
    +++ b/rpython/jit/backend/zarch/opassembler.py
    @@ -185,9 +185,17 @@
         emit_float_gt = gen_emit_cmp_op(c.GT, fp=True)
         emit_float_ge = gen_emit_cmp_op(c.GE, fp=True)
     
    +    def emit_float_neg(self, op, arglocs, regalloc):
    +        l0, = arglocs
    +        self.mc.LCDBR(l0, l0)
    +
    +    def emit_float_abs(self, op, arglocs, regalloc):
    +        l0, = arglocs
    +        self.mc.LPDBR(l0, l0)
    +
         def emit_cast_float_to_int(self, op, arglocs, regalloc):
             f0, r0 = arglocs
    -        self.mc.CGDBR(r0, f0, c.FP_CUTOFF)
    +        self.mc.CGDBR(r0, c.FP_TOWARDS_ZERO, f0)
     
         def emit_cast_int_to_float(self, op, arglocs, regalloc):
             r0, f0 = arglocs
    diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py
    --- a/rpython/jit/backend/zarch/regalloc.py
    +++ b/rpython/jit/backend/zarch/regalloc.py
    @@ -696,6 +696,9 @@
         prepare_float_gt = helper.prepare_float_cmp_op
         prepare_float_ge = helper.prepare_float_cmp_op
     
    +    prepare_float_neg = helper.prepare_unary_op
    +    prepare_float_abs = helper.prepare_unary_op
    +
     
         prepare_cast_ptr_to_int = helper.prepare_same_as
         prepare_cast_int_to_ptr = helper.prepare_same_as
    diff --git a/rpython/jit/metainterp/test/test_executor.py b/rpython/jit/metainterp/test/test_executor.py
    --- a/rpython/jit/metainterp/test/test_executor.py
    +++ b/rpython/jit/metainterp/test/test_executor.py
    @@ -281,8 +281,8 @@
         yield (rop.FLOAT_NEG, [15.9], 'float', -15.9)
         yield (rop.FLOAT_ABS, [-5.9], 'float', 5.9)
         yield (rop.FLOAT_ABS, [15.9], 'float', 15.9)
    +    yield (rop.CAST_FLOAT_TO_INT, [5.9], 'int', 5)
         yield (rop.CAST_FLOAT_TO_INT, [-5.9], 'int', -5)
    -    yield (rop.CAST_FLOAT_TO_INT, [5.9], 'int', 5)
         yield (rop.CAST_INT_TO_FLOAT, [123], 'float', 123.0)
         yield (rop.CAST_INT_TO_FLOAT, [-123], 'float', -123.0)
     
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:21:57 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Fri, 20 Nov 2015 15:21:57 +0100 (CET)
    Subject: [pypy-commit] pypy numpy-1.10: consolidate coerce for record and
     void-with-fields dtypes, fix translation
    Message-ID: <20151120142157.EC9341C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: numpy-1.10
    Changeset: r80795:4d46e08b45c3
    Date: 2015-11-19 08:21 +0200
    http://bitbucket.org/pypy/pypy/changeset/4d46e08b45c3/
    
    Log:	consolidate coerce for record and void-with-fields dtypes, fix
    	translation
    
    diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
    --- a/pypy/module/micronumpy/__init__.py
    +++ b/pypy/module/micronumpy/__init__.py
    @@ -43,10 +43,6 @@
             from pypy.module.micronumpy.concrete import _setup
             _setup()
     
    -    def setup_after_space_initialization(self):
    -        from pypy.module.micronumpy.support import W_VisibleDeprecationWarning
    -        for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items():
    -            setattr(self.space, 'w_' + name, self.space.gettypefor(w_type))
     
     class UMathModule(MixedModule):
         appleveldefs = {}
    @@ -144,3 +140,10 @@
             'multiarray': MultiArrayModule,
             'umath': UMathModule,
         }
    +
    +    def setup_after_space_initialization(self):
    +        from pypy.module.micronumpy.support import W_VisibleDeprecationWarning
    +        print 'in setup_after_space_initialization', self.space
    +        for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items():
    +            setattr(self.space, 'w_' + name, self.space.gettypefor(w_type))
    +
    diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
    --- a/pypy/module/micronumpy/compile.py
    +++ b/pypy/module/micronumpy/compile.py
    @@ -65,6 +65,7 @@
         w_KeyError = W_TypeObject("KeyError")
         w_SystemExit = W_TypeObject("SystemExit")
         w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt")
    +    w_VisibleDeprecationWarning = W_TypeObject("VisibleDeprecationWarning")
         w_None = None
     
         w_bool = W_TypeObject("bool")
    @@ -402,6 +403,9 @@
             assert isinstance(w_check_class, W_TypeObject)
             return w_exc_type.name == w_check_class.name
     
    +    def warn(self, w_msg, w_warn_type):
    +        pass
    +
     class FloatObject(W_Root):
         tp = FakeSpace.w_float
         def __init__(self, floatval):
    diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
    --- a/pypy/module/micronumpy/test/test_dtypes.py
    +++ b/pypy/module/micronumpy/test/test_dtypes.py
    @@ -345,12 +345,22 @@
     
         def test_can_subclass(self):
             import numpy as np
    +        import sys
             class xyz(np.void):
                 pass
             assert np.dtype(xyz).name == 'xyz'
             # another obscure API, used in numpy record.py
             a = np.dtype((xyz, [('x', 'int32'), ('y', 'float32')]))
    -        assert repr(a).endswith("xyz, [('x', '
    
    Author: mattip 
    Branch: numpy-1.10
    Changeset: r80796:f13f3012726c
    Date: 2015-11-20 16:15 +0200
    http://bitbucket.org/pypy/pypy/changeset/f13f3012726c/
    
    Log:	allow records in void types, progress in numpy issue #9
    
    diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
    --- a/pypy/module/micronumpy/__init__.py
    +++ b/pypy/module/micronumpy/__init__.py
    @@ -143,7 +143,6 @@
     
         def setup_after_space_initialization(self):
             from pypy.module.micronumpy.support import W_VisibleDeprecationWarning
    -        print 'in setup_after_space_initialization', self.space
             for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items():
                 setattr(self.space, 'w_' + name, self.space.gettypefor(w_type))
     
    diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
    --- a/pypy/module/micronumpy/ndarray.py
    +++ b/pypy/module/micronumpy/ndarray.py
    @@ -75,7 +75,7 @@
             dtype = space.interp_w(descriptor.W_Dtype, space.call_function(
                 space.gettypefor(descriptor.W_Dtype), w_dtype))
             if (dtype.elsize != self.get_dtype().elsize or
    -                dtype.is_flexible() or self.get_dtype().is_flexible()):
    +                (not dtype.is_record() and self.get_dtype().is_flexible())):
                 raise OperationError(space.w_ValueError, space.wrap(
                     "new type not compatible with array."))
             self.implementation.set_dtype(space, dtype)
    diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
    --- a/pypy/module/micronumpy/test/test_ndarray.py
    +++ b/pypy/module/micronumpy/test/test_ndarray.py
    @@ -3072,7 +3072,8 @@
             assert (b == zeros(10)).all()
     
         def test_array_interface(self):
    -        from numpy import array, ones
    +        from numpy import array
    +        import numpy as np
             a = array(2.5)
             i = a.__array_interface__
             assert isinstance(i['data'][0], int)
    @@ -3094,9 +3095,10 @@
             assert b_data + 3 * b.dtype.itemsize == c_data
     
             class Dummy(object):
    -            def __init__(self, aif=None):
    +            def __init__(self, aif=None, base=None):
                     if aif is not None:
                         self.__array_interface__ = aif
    +                self.base = base
     
             a = array(Dummy())
             assert a.dtype == object
    @@ -3124,12 +3126,22 @@
             assert b.dtype == 'uint8'
             assert b.shape == (50,)
     
    -        a = ones((1,), dtype='float16')
    +        a = np.ones((1,), dtype='float16')
             b = Dummy(a.__array_interface__)
             c = array(b)
             assert c.dtype == 'float16'
             assert (a == c).all()
     
    +        t = np.dtype([("a", np.float64), ("b", np.float64)], align=True)
    +        a = np.zeros(10, dtype=t)
    +        a['a'] = range(10, 20)
    +        a['b'] = range(20, 30)
    +        interface = dict(a.__array_interface__)
    +        array = np.array(Dummy(interface))
    +        assert array.dtype.kind == 'V'
    +        array.dtype = a.dtype
    +        assert array[5]['b'] == 25
    +
         def test_array_indexing_one_elem(self):
             from numpy import array, arange
             raises(IndexError, 'arange(3)[array([3.5])]')
    diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
    --- a/pypy/module/micronumpy/types.py
    +++ b/pypy/module/micronumpy/types.py
    @@ -2423,12 +2423,11 @@
     
         @jit.unroll_safe
         def store(self, arr, i, offset, box, native):
    -        assert i == 0
             assert isinstance(box, boxes.W_VoidBox)
             assert box.dtype is box.arr.dtype
             with arr as arr_storage, box.arr as box_storage:
                 for k in range(box.arr.dtype.elsize):
    -                arr_storage[k + offset] = box_storage[k + box.ofs]
    +                arr_storage[i + k + offset] = box_storage[k + box.ofs]
     
         def readarray(self, arr, i, offset, dtype=None):
             from pypy.module.micronumpy.base import W_NDimArray
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:22:02 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Fri, 20 Nov 2015 15:22:02 +0100 (CET)
    Subject: [pypy-commit] pypy numpy-1.10: merge branch
    Message-ID: <20151120142202.1C1991C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: numpy-1.10
    Changeset: r80797:c2d98e748bc7
    Date: 2015-11-20 16:16 +0200
    http://bitbucket.org/pypy/pypy/changeset/c2d98e748bc7/
    
    Log:	merge branch
    
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:22:04 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Fri, 20 Nov 2015 15:22:04 +0100 (CET)
    Subject: [pypy-commit] pypy default: merge adaptations for numpy 1.10 into
     default
    Message-ID: <20151120142204.7D6DB1C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r80798:479c8ee1f395
    Date: 2015-11-20 16:16 +0200
    http://bitbucket.org/pypy/pypy/changeset/479c8ee1f395/
    
    Log:	merge adaptations for numpy 1.10 into default
    
    diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
    --- a/pypy/module/micronumpy/__init__.py
    +++ b/pypy/module/micronumpy/__init__.py
    @@ -34,6 +34,7 @@
             'nditer': 'nditer.W_NDIter',
     
             'set_docstring': 'support.descr_set_docstring',
    +        'VisibleDeprecationWarning': 'support.W_VisibleDeprecationWarning',
         }
         for c in ['MAXDIMS', 'CLIP', 'WRAP', 'RAISE']:
             interpleveldefs[c] = 'space.wrap(constants.%s)' % c
    @@ -42,6 +43,7 @@
             from pypy.module.micronumpy.concrete import _setup
             _setup()
     
    +
     class UMathModule(MixedModule):
         appleveldefs = {}
         interpleveldefs = {
    @@ -138,3 +140,9 @@
             'multiarray': MultiArrayModule,
             'umath': UMathModule,
         }
    +
    +    def setup_after_space_initialization(self):
    +        from pypy.module.micronumpy.support import W_VisibleDeprecationWarning
    +        for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items():
    +            setattr(self.space, 'w_' + name, self.space.gettypefor(w_type))
    +
    diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py
    --- a/pypy/module/micronumpy/base.py
    +++ b/pypy/module/micronumpy/base.py
    @@ -44,7 +44,7 @@
             from pypy.module.micronumpy.strides import calc_strides
             if len(shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(shape) * dtype.elsize)
             except OverflowError as e:
    @@ -69,7 +69,7 @@
             isize = dtype.elsize
             if len(shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 totalsize = ovfcheck(support.product_check(shape) * isize)
             except OverflowError as e:
    diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py
    --- a/pypy/module/micronumpy/boxes.py
    +++ b/pypy/module/micronumpy/boxes.py
    @@ -444,7 +444,7 @@
     
         @unwrap_spec(axis1=int, axis2=int)
         def descr_swapaxes(self, space, axis1, axis2):
    -        return self
    +        raise oefmt(space.w_ValueError, 'bad axis1 argument to swapaxes')
     
         def descr_fill(self, space, w_value):
             self.get_dtype(space).coerce(space, w_value)
    @@ -573,7 +573,7 @@
             try:
                 ofs, dtype = self.dtype.fields[item]
             except KeyError:
    -            raise oefmt(space.w_IndexError, "invalid index")
    +            raise oefmt(space.w_ValueError, "no field of name %s", item)
     
             from pypy.module.micronumpy.types import VoidType
             if isinstance(dtype.itemtype, VoidType):
    diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
    --- a/pypy/module/micronumpy/compile.py
    +++ b/pypy/module/micronumpy/compile.py
    @@ -65,6 +65,7 @@
         w_KeyError = W_TypeObject("KeyError")
         w_SystemExit = W_TypeObject("SystemExit")
         w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt")
    +    w_VisibleDeprecationWarning = W_TypeObject("VisibleDeprecationWarning")
         w_None = None
     
         w_bool = W_TypeObject("bool")
    @@ -402,6 +403,9 @@
             assert isinstance(w_check_class, W_TypeObject)
             return w_exc_type.name == w_check_class.name
     
    +    def warn(self, w_msg, w_warn_type):
    +        pass
    +
     class FloatObject(W_Root):
         tp = FakeSpace.w_float
         def __init__(self, floatval):
    diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
    --- a/pypy/module/micronumpy/concrete.py
    +++ b/pypy/module/micronumpy/concrete.py
    @@ -457,7 +457,7 @@
         def set_shape(self, space, orig_array, new_shape):
             if len(new_shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(new_shape) * self.dtype.elsize)
             except OverflowError as e:
    @@ -601,7 +601,7 @@
         def set_shape(self, space, orig_array, new_shape):
             if len(new_shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(new_shape) * self.dtype.elsize)
             except OverflowError as e:
    diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
    --- a/pypy/module/micronumpy/ctors.py
    +++ b/pypy/module/micronumpy/ctors.py
    @@ -18,7 +18,7 @@
             raise oefmt(space.w_TypeError,
                         "argument 1 must be numpy.dtype, not %T", w_dtype)
         if w_dtype.elsize == 0:
    -        raise oefmt(space.w_ValueError, "itemsize cannot be zero")
    +        raise oefmt(space.w_TypeError, "Empty data-type")
         if not space.isinstance_w(w_state, space.w_str):
             raise oefmt(space.w_TypeError, "initializing object must be a string")
         if space.len_w(w_state) != w_dtype.elsize:
    diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
    --- a/pypy/module/micronumpy/descriptor.py
    +++ b/pypy/module/micronumpy/descriptor.py
    @@ -217,6 +217,8 @@
                 endian = ignore
             if self.num == NPY.UNICODE:
                 size >>= 2
    +        if self.num == NPY.OBJECT:
    +            return "%s%s" %(endian, basic)
             return "%s%s%s" % (endian, basic, size)
     
         def descr_get_descr(self, space, style='descr', force_dict=False):
    @@ -485,7 +487,12 @@
     
         def descr_str(self, space):
             if self.fields:
    -            return space.str(self.descr_get_descr(space, style='str'))
    +            r = self.descr_get_descr(space, style='str')
    +            name = space.str_w(space.str(self.w_box_type))
    +            if name != "":
    +                boxname = space.str(self.w_box_type)
    +                r = space.newtuple([self.w_box_type, r])
    +            return space.str(r)
             elif self.subdtype is not None:
                 return space.str(space.newtuple([
                     self.subdtype.descr_get_str(space),
    @@ -497,8 +504,13 @@
                     return self.descr_get_name(space)
     
         def descr_repr(self, space):
    +        if isinstance(self.itemtype, types.CharType):
    +            return space.wrap("dtype('S1')")
             if self.fields:
                 r = self.descr_get_descr(space, style='repr')
    +            name = space.str_w(space.str(self.w_box_type))
    +            if name != "":
    +                r = space.newtuple([space.wrap(self.w_box_type), r])
             elif self.subdtype is not None:
                 r = space.newtuple([self.subdtype.descr_get_str(space),
                                     self.descr_get_shape(space)])
    @@ -942,7 +954,7 @@
         shape_w = space.fixedview(w_shape)
         if len(shape_w) < 1:
             return None
    -    elif len(shape_w) == 1 and space.isinstance_w(shape_w[0], space.w_tuple):
    +    elif space.isinstance_w(shape_w[0], space.w_tuple):
             # (base_dtype, new_dtype) dtype spectification
             return None
         shape = []
    @@ -997,12 +1009,16 @@
             if len(spec) > 0:
                 # this is (base_dtype, new_dtype) so just make it a union by setting both
                 # parts' offset to 0
    -            try:
    -                dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment)
    -            except:
    -                raise
    -            raise oefmt(space.w_NotImplementedError, 
    -                "(base_dtype, new_dtype) dtype spectification discouraged, not implemented")
    +            w_dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment)
    +            assert isinstance(w_dtype, W_Dtype)
    +            assert isinstance(w_dtype1, W_Dtype)
    +            if (w_dtype.elsize != 0 and w_dtype1.elsize != 0 and 
    +                    w_dtype1.elsize != w_dtype.elsize):
    +                raise oefmt(space.w_ValueError,
    +                    'mismatch in size of old and new data-descriptor')
    +            retval = W_Dtype(w_dtype.itemtype, w_dtype.w_box_type,
    +                    names=w_dtype1.names[:], fields=w_dtype1.fields.copy())
    +            return retval
         if space.is_none(w_dtype):
             return cache.w_float64dtype
         if space.isinstance_w(w_dtype, w_subtype):
    @@ -1032,19 +1048,22 @@
         elif space.isinstance_w(w_dtype, space.w_tuple):
             w_dtype0 = space.getitem(w_dtype, space.wrap(0))
             w_dtype1 = space.getitem(w_dtype, space.wrap(1))
    -        if space.isinstance_w(w_dtype0, space.w_type) and \
    -           space.isinstance_w(w_dtype1, space.w_list):
    -            #obscure api - (subclass, spec). Ignore the subclass
    -            return make_new_dtype(space, w_subtype, w_dtype1, alignment, 
    -                        copy=copy, w_shape=w_shape, w_metadata=w_metadata)
    -        subdtype = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy)
    -        assert isinstance(subdtype, W_Dtype)
    -        if subdtype.elsize == 0:
    -            name = "%s%d" % (subdtype.kind, space.int_w(w_dtype1))
    +        # create a new dtype object
    +        l_side = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy)
    +        assert isinstance(l_side, W_Dtype)
    +        if l_side.elsize == 0 and space.isinstance_w(w_dtype1, space.w_int):
    +            #(flexible_dtype, itemsize)
    +            name = "%s%d" % (l_side.kind, space.int_w(w_dtype1))
                 retval = make_new_dtype(space, w_subtype, space.wrap(name), alignment, copy)
    -        else:
    -            retval = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy, w_shape=w_dtype1)
    -        return _set_metadata_and_copy(space, w_metadata, retval, copy)
    +            return _set_metadata_and_copy(space, w_metadata, retval, copy)
    +        elif (space.isinstance_w(w_dtype1, space.w_int) or
    +                space.isinstance_w(w_dtype1, space.w_tuple) or 
    +                space.isinstance_w(w_dtype1, space.w_list) or 
    +                isinstance(w_dtype1, W_NDimArray)):
    +            #(fixed_dtype, shape) or (base_dtype, new_dtype)
    +            retval = make_new_dtype(space, w_subtype, l_side, alignment,
    +                                    copy, w_shape=w_dtype1)
    +            return _set_metadata_and_copy(space, w_metadata, retval, copy)
         elif space.isinstance_w(w_dtype, space.w_dict):
             return _set_metadata_and_copy(space, w_metadata,
                     dtype_from_dict(space, w_dtype, alignment), copy)
    @@ -1122,7 +1141,7 @@
                 size = int(name[1:])
             except ValueError:
                 raise oefmt(space.w_TypeError, "data type not understood")
    -    if char == NPY.CHARLTR:
    +    if char == NPY.CHARLTR and size == 0:
             return W_Dtype(
                 types.CharType(space),
                 elsize=1,
    @@ -1133,7 +1152,7 @@
             return new_unicode_dtype(space, size)
         elif char == NPY.VOIDLTR:
             return new_void_dtype(space, size)
    -    assert False
    +    raise oefmt(space.w_TypeError, 'data type "%s" not understood', name)
     
     
     def new_string_dtype(space, size):
    diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
    --- a/pypy/module/micronumpy/ndarray.py
    +++ b/pypy/module/micronumpy/ndarray.py
    @@ -75,7 +75,7 @@
             dtype = space.interp_w(descriptor.W_Dtype, space.call_function(
                 space.gettypefor(descriptor.W_Dtype), w_dtype))
             if (dtype.elsize != self.get_dtype().elsize or
    -                dtype.is_flexible() or self.get_dtype().is_flexible()):
    +                (not dtype.is_record() and self.get_dtype().is_flexible())):
                 raise OperationError(space.w_ValueError, space.wrap(
                     "new type not compatible with array."))
             self.implementation.set_dtype(space, dtype)
    @@ -116,6 +116,13 @@
                     "index out of range for array"))
             size = loop.count_all_true(arr)
             if arr.ndims() == 1:
    +            if self.ndims() > 1 and arr.get_shape()[0] != self.get_shape()[0]:
    +                msg = ("boolean index did not match indexed array along"
    +                      " dimension 0; dimension is %d but corresponding"
    +                      " boolean dimension is %d" % (self.get_shape()[0],
    +                      arr.get_shape()[0]))
    +                #warning = space.gettypefor(support.W_VisibleDeprecationWarning)
    +                space.warn(space.wrap(msg), space.w_VisibleDeprecationWarning)
                 res_shape = [size] + self.get_shape()[1:]
             else:
                 res_shape = [size]
    @@ -278,7 +285,7 @@
         def getfield(self, space, field):
             dtype = self.get_dtype()
             if field not in dtype.fields:
    -            raise oefmt(space.w_ValueError, "field named %s not found", field)
    +            raise oefmt(space.w_ValueError, "no field of name %s", field)
             arr = self.implementation
             ofs, subdtype = arr.dtype.fields[field][:2]
             # ofs only changes start
    @@ -489,10 +496,8 @@
             numpy.swapaxes : equivalent function
             """
             if axis1 == axis2:
    -            return self
    +            return self.descr_view(space)
             n = self.ndims()
    -        if n <= 1:
    -            return self
             if axis1 < 0:
                 axis1 += n
             if axis2 < 0:
    @@ -501,6 +506,8 @@
                 raise oefmt(space.w_ValueError, "bad axis1 argument to swapaxes")
             if axis2 < 0 or axis2 >= n:
                 raise oefmt(space.w_ValueError, "bad axis2 argument to swapaxes")
    +        if n <= 1:
    +            return self
             return self.implementation.swapaxes(space, self, axis1, axis2)
     
         def descr_nonzero(self, space):
    @@ -899,7 +906,7 @@
                         if cur_shape[i] != 1:
                             raise OperationError(space.w_ValueError, space.wrap(
                                 "cannot select an axis to squeeze out "
    -                            "which has size greater than one"))
    +                            "which has size not equal to one"))
                     else:
                         new_shape.append(cur_shape[i])
             else:
    @@ -1374,7 +1381,7 @@
         shape = shape_converter(space, w_shape, dtype)
         if len(shape) > NPY.MAXDIMS:
             raise oefmt(space.w_ValueError,
    -            "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +            "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
         if not space.is_none(w_buffer):
             if (not space.is_none(w_strides)):
                 strides = [space.int_w(w_i) for w_i in
    diff --git a/pypy/module/micronumpy/support.py b/pypy/module/micronumpy/support.py
    --- a/pypy/module/micronumpy/support.py
    +++ b/pypy/module/micronumpy/support.py
    @@ -8,6 +8,17 @@
     from pypy.objspace.std.typeobject import W_TypeObject
     from pypy.objspace.std.objspace import StdObjSpace
     from pypy.module.micronumpy import constants as NPY
    +from pypy.module.exceptions.interp_exceptions import _new_exception, W_UserWarning
    +
    +W_VisibleDeprecationWarning = _new_exception('VisibleDeprecationWarning', W_UserWarning,
    +    """Visible deprecation warning.
    +
    +    By default, python will not show deprecation warnings, so this class
    +    can be used when a very visible warning is helpful, for example because
    +    the usage is most likely a user bug.
    +
    +    """)
    +
     
     def issequence_w(space, w_obj):
         from pypy.module.micronumpy.base import W_NDimArray
    diff --git a/pypy/module/micronumpy/test/test_deprecations.py b/pypy/module/micronumpy/test/test_deprecations.py
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/micronumpy/test/test_deprecations.py
    @@ -0,0 +1,33 @@
    +import py
    +import sys
    +
    +from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
    +
    +
    +class AppTestDeprecations(BaseNumpyAppTest):
    +    spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
    +
    +    def test_getitem(self):
    +        import numpy as np
    +        import warnings, sys
    +        warnings.simplefilter('error', np.VisibleDeprecationWarning)
    +        try:
    +            arr = np.ones((5, 4, 3))
    +            index = np.array([True])
    +            raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +
    +            index = np.array([False] * 6)
    +            raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +
    +            index = np.zeros((4, 4), dtype=bool)
    +            if '__pypy__' in sys.builtin_module_names:
    +                # boolean indexing matches the dims in index
    +                # to the first index.ndims in arr, not implemented in pypy yet
    +                raises(IndexError, arr.__getitem__, index)
    +                raises(TypeError, arr.__getitem__, (slice(None), index))
    +            else:
    +                raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +                raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index))
    +        finally:
    +            warnings.simplefilter('default', np.VisibleDeprecationWarning)
    +
    diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
    --- a/pypy/module/micronumpy/test/test_dtypes.py
    +++ b/pypy/module/micronumpy/test/test_dtypes.py
    @@ -345,13 +345,22 @@
     
         def test_can_subclass(self):
             import numpy as np
    +        import sys
             class xyz(np.void):
                 pass
             assert np.dtype(xyz).name == 'xyz'
             # another obscure API, used in numpy record.py
    -        # it seems numpy throws away the subclass type and parses the spec
             a = np.dtype((xyz, [('x', 'int32'), ('y', 'float32')]))
    -        assert repr(a) == "dtype([('x', '
    
    Author: mattip 
    Branch: 
    Changeset: r80799:9360f3b2ba81
    Date: 2015-11-20 16:19 +0200
    http://bitbucket.org/pypy/pypy/changeset/9360f3b2ba81/
    
    Log:	document merged branches
    
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -5,3 +5,11 @@
     .. this is a revision shortly after release-4.0.1
     .. startrev: 4b5c840d0da2
     
    +.. branch: numpy-1.10
    +
    +Fix tests to run cleanly with -A and start to fix micronumpy for upstream numpy
    +which is now 1.10.2
    +
    +.. branch: osx-flat-namespace
    +
    +Fix the cpyext tests on OSX by linking with -flat_namespace
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:22:08 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Fri, 20 Nov 2015 15:22:08 +0100 (CET)
    Subject: [pypy-commit] pypy default: update repackage.sh,
     document the need to run it in a clean directory
    Message-ID: <20151120142208.C7DCE1C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r80800:7b90c3771367
    Date: 2015-11-18 22:38 +0200
    http://bitbucket.org/pypy/pypy/changeset/7b90c3771367/
    
    Log:	update repackage.sh, document the need to run it in a clean
    	directory
    
    diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh
    --- a/pypy/tool/release/repackage.sh
    +++ b/pypy/tool/release/repackage.sh
    @@ -1,10 +1,11 @@
     # Edit these appropriately before running this script
    -maj=2
    -min=6
    +maj=4
    +min=0
     rev=1
     # This script will download latest builds from the buildmaster, rename the top
     # level directory, and repackage ready to be uploaded to bitbucket. It will also
     # download source, assuming a tag for the release already exists, and repackage them.
    +# The script should be run in an empty directory, i.e. /tmp/release_xxx
     
     for plat in linux linux64 linux-armhf-raspbian linux-armhf-raring linux-armel osx64 freebsd64
       do
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:22:10 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Fri, 20 Nov 2015 15:22:10 +0100 (CET)
    Subject: [pypy-commit] pypy default: restart the next version
    Message-ID: <20151120142210.E176B1C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r80801:9273f790a5ed
    Date: 2015-11-19 08:39 +0200
    http://bitbucket.org/pypy/pypy/changeset/9273f790a5ed/
    
    Log:	restart the next version
    
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -1,5 +1,5 @@
     =========================
    -What's new in PyPy 4.0.+
    +What's new in PyPy 4.1.+
     =========================
     
     .. this is a revision shortly after release-4.0.1
    diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
    --- a/pypy/module/cpyext/include/patchlevel.h
    +++ b/pypy/module/cpyext/include/patchlevel.h
    @@ -29,7 +29,7 @@
     #define PY_VERSION		"2.7.10"
     
     /* PyPy version as a string */
    -#define PYPY_VERSION "4.0.1-alpha0"
    +#define PYPY_VERSION "4.1.0-alpha0"
     
     /* Subversion Revision number of this file (not of the repository).
      * Empty since Mercurial migration. */
    diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
    --- a/pypy/module/sys/version.py
    +++ b/pypy/module/sys/version.py
    @@ -10,7 +10,7 @@
     #XXX # sync CPYTHON_VERSION with patchlevel.h, package.py
     CPYTHON_API_VERSION        = 1013   #XXX # sync with include/modsupport.h
     
    -PYPY_VERSION               = (4, 0, 1, "alpha", 0)    #XXX # sync patchlevel.h
    +PYPY_VERSION               = (4, 1, 0, "alpha", 0)    #XXX # sync patchlevel.h
     
     
     import pypy
    
    From noreply at buildbot.pypy.org  Fri Nov 20 09:56:30 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Fri, 20 Nov 2015 15:56:30 +0100 (CET)
    Subject: [pypy-commit] cffi static-callback: Change the @ffi.def_extern()
     decorator to not automatically replace the
    Message-ID: <20151120145630.48E8E1C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: static-callback
    Changeset: r2420:63e802144a16
    Date: 2015-11-20 15:57 +0100
    http://bitbucket.org/cffi/cffi/changeset/63e802144a16/
    
    Log:	Change the @ffi.def_extern() decorator to not automatically replace
    	the function with the cdata. You need to get the cdata from the lib
    	explicitly. This should make it clearer that there is only one
    	cdata, even if you apply the decorator again.
    
    diff --git a/c/call_python.c b/c/call_python.c
    --- a/c/call_python.c
    +++ b/c/call_python.c
    @@ -43,10 +43,9 @@
             return NULL;
     
         infotuple = prepare_callback_info_tuple(ct, fn, error, onerror, 0);
    -    if (infotuple == NULL) {
    -        Py_DECREF(ct);
    +    Py_DECREF(ct);
    +    if (infotuple == NULL)
             return NULL;
    -    }
     
         /* attach infotuple to reserved1, where it will stay forever
            unless a new version is attached later */
    @@ -55,11 +54,9 @@
         externpy->reserved1 = (void *)infotuple;
         Py_XDECREF(x);
     
    -    /* return a cdata of type function-pointer, equal to the one
    -       obtained by reading 'lib.bar' (see lib_obj.c) */
    -    x = convert_to_object((char *)&g->size_or_direct_fn, ct);
    -    Py_DECREF(ct);
    -    return x;
    +    /* return the function object unmodified */
    +    Py_INCREF(fn);
    +    return fn;
     
      not_found:
         PyErr_Format(FFIError, "ffi.def_extern('%s'): no 'extern \"Python\"' "
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -461,11 +461,12 @@
         def my_callback(fooptr, value):
             return 42
     
    -You can get a ```` pointer-to-function object from either
    -reading ``lib.my_callback``, or directly from the decorated
    -``my_callback`` above.  This ```` can be passed to C code and
    +You can get a ```` pointer-to-function object from
    +``lib.my_callback``.  This ```` can be passed to C code and
     then works like a callback: when the C code calls this function
    -pointer, the Python function ``my_callback`` is called.
    +pointer, the Python function ``my_callback`` is called.  (You need
    +to pass ``lib.my_callback`` to C code, and not ``my_callback``: the
    +latter is just a plain Python function that cannot be passed to C.)
     
     CFFI implements this by defining ``my_callback`` as a static C
     function, written after the ``set_source()`` code.  The ````
    @@ -474,10 +475,13 @@
     ``@ffi.def_extern()``.
     
     Each function from the cdef with ``extern "Python"`` turns into only
    -one C function.  You can redefine the attached Python function by
    -calling ``@ffi.def_extern()`` again, but it changes the C logic to
    -call the new Python function; the old Python function is not callable
    -any more and the C function pointer itself is always the same.
    +one C function.  To support some corner cases, it is possible to
    +redefine the attached Python function by calling ``@ffi.def_extern()``
    +again---but this is not recommended!  Better write the Python function
    +more flexibly in the first place.  Calling ``@ffi.def_extern()`` again
    +changes the C logic to call the new Python function; the old Python
    +function is not callable any more and the C function pointer you get
    +from ``lib.my_function`` is always the same.
     
     Extern "Python" and "void *" arguments
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    @@ -517,7 +521,7 @@
             def __init__(self):
                 userdata = ffi.new_handle(self)
                 self._userdata = userdata     # must keep this alive!
    -            lib.event_cb_register(my_event_callback, userdata)
    +            lib.event_cb_register(lib.my_event_callback, userdata)
     
             def process_event(self, evt):
                 ...
    @@ -546,7 +550,7 @@
                 userdata = ffi.new_handle(self)
                 self._userdata = userdata        # must still keep this alive!
                 ll_widget.userdata = userdata    # this makes a copy of the "void *"
    -            lib.event_cb_register(ll_widget, my_event_callback)
    +            lib.event_cb_register(ll_widget, lib.my_event_callback)
     
             def process_event(self, evt):
                 ...
    diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
    --- a/testing/cffi1/test_recompiler.py
    +++ b/testing/cffi1/test_recompiler.py
    @@ -1509,36 +1509,38 @@
         def my_bar(x, y):
             seen.append(("Bar", x, y))
             return x * y
    -    assert my_bar == lib.bar
    +    assert my_bar != lib.bar
         seen = []
         res = lib.bar(6, 7)
         assert seen == [("Bar", 6, 7)]
         assert res == 42
     
    -    @ffi.def_extern()
         def baz(x, y):
             seen.append(("Baz", x, y))
    +    baz1 = ffi.def_extern()(baz)
    +    assert baz1 is baz
         seen = []
    -    res = baz(50L, 8L)
    +    baz(40L, 4L)
    +    res = lib.baz(50L, 8L)
         assert res is None
    -    assert seen == [("Baz", 50, 8)]
    -    assert type(seen[0][1]) is type(seen[0][2]) is int
    -    assert baz == lib.baz
    +    assert seen == [("Baz", 40L, 4L), ("Baz", 50, 8)]
    +    assert type(seen[0][1]) is type(seen[0][2]) is long
    +    assert type(seen[1][1]) is type(seen[1][2]) is int
     
         @ffi.def_extern(name="bok")
         def bokk():
             seen.append("Bok")
             return 42
         seen = []
    -    assert lib.bok() == bokk() == 42
    -    assert seen == ["Bok", "Bok"]
    +    assert lib.bok() == 42
    +    assert seen == ["Bok"]
     
         @ffi.def_extern()
         def boz():
             seen.append("Boz")
         seen = []
    -    assert lib.boz() is boz() is None
    -    assert seen == ["Boz", "Boz"]
    +    assert lib.boz() is None
    +    assert seen == ["Boz"]
     
     def test_extern_python_bogus_name():
         ffi = FFI()
    @@ -1569,11 +1571,11 @@
         ffi.cdef("""extern "Python" void bar(int);""")
         lib = verify(ffi, 'test_extern_python_bogus_result_type', "")
         #
    +    @ffi.def_extern()
         def bar(n):
             return n * 10
    -    bar1 = ffi.def_extern()(bar)
         with StdErrCapture() as f:
    -        res = bar1(321)
    +        res = lib.bar(321)
         assert res is None
         assert f.getvalue() == (
             "From cffi callback %r:\n" % (bar,) +
    @@ -1677,12 +1679,12 @@
         @ffi.def_extern(onerror=oops)
         def bar(x):
             return x + ""
    -    assert bar(10) == 0
    +    assert lib.bar(10) == 0
     
         @ffi.def_extern(name="bar", onerror=oops, error=-66)
         def bar2(x):
             return x + ""
    -    assert bar(10) == -66
    +    assert lib.bar(10) == -66
     
         assert len(seen) == 2
         exc, val, tb = seen[0]
    
    From noreply at buildbot.pypy.org  Fri Nov 20 10:10:12 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Fri, 20 Nov 2015 16:10:12 +0100 (CET)
    Subject: [pypy-commit] pypy anntype: Discover constantness of exception
     types in more cases
    Message-ID: <20151120151012.60F551C023F@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype
    Changeset: r80802:7528a6ef8224
    Date: 2015-11-20 15:11 +0000
    http://bitbucket.org/pypy/pypy/changeset/7528a6ef8224/
    
    Log:	Discover constantness of exception types in more cases
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -504,16 +504,15 @@
                                 self.bookkeeper.getuniqueclassdef(case))
                         s_matching_exc = s_exception.intersection(s_case)
                         if s_matching_exc != s_ImpossibleValue:
    -                        self.follow_raise_link(graph, link,
    -                            constraints={link.last_exc_value:
    -                                s_matching_exc.as_SomeInstance()})
    +                        self.follow_raise_link(graph, link, s_matching_exc)
                         s_exception = s_exception.difference(s_case)
                 else:
                     for link in exits:
                         if link.exitcase is None:
                             self.follow_link(graph, link, {})
                         else:
    -                        self.follow_raise_link(graph, link, {})
    +                        s_exception = self.bookkeeper.valueoftype(link.exitcase)
    +                        self.follow_raise_link(graph, link, s_exception)
             else:
                 if isinstance(block.exitswitch, Variable):
                     knowntypedata = getattr(block.exitswitch.annotation,
    @@ -559,7 +558,7 @@
             self.links_followed[link] = True
             self.addpendingblock(graph, link.target, inputs_s)
     
    -    def follow_raise_link(self, graph, link, constraints):
    +    def follow_raise_link(self, graph, link, s_last_exc_value):
             v_last_exc_type = link.last_exception
             v_last_exc_value = link.last_exc_value
     
    @@ -567,15 +566,13 @@
                     issubclass(link.exitcase, BaseException))
     
             assert v_last_exc_type and v_last_exc_value
    -        s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase)
    +
             if isinstance(v_last_exc_value, Variable):
                 self.setbinding(v_last_exc_value, s_last_exc_value)
     
             if isinstance(v_last_exc_type, Variable):
    -            self.setbinding(v_last_exc_type, SomeTypeOf([v_last_exc_value]))
    +            self.setbinding(v_last_exc_type, typeof([v_last_exc_value]))
     
    -
    -        ignore_link = False
             inputs_s = []
             renaming = defaultdict(list)
             for v_out, v_input in zip(link.args, link.target.inputargs):
    @@ -586,19 +583,13 @@
                     s_out = typeof(renaming[v_last_exc_value])
                     if isinstance(v_last_exc_type, Constant):
                         s_out.const = v_last_exc_type.value
    +                elif v_last_exc_type.annotation.is_constant():
    +                    s_out.const = v_last_exc_type.annotation.const
                     inputs_s.append(s_out)
                 else:
                     s_out = self.annotation(v_out)
    -                if v_out in constraints:
    -                    s_constraint = constraints[v_out]
    -                    s_out = pair(s_out, s_constraint).improve()
    -                    # ignore links that try to pass impossible values
    -                    if s_out == s_ImpossibleValue:
    -                        ignore_link = True
                     s_out = self.apply_renaming(s_out, renaming)
                     inputs_s.append(s_out)
    -        if ignore_link:
    -            return
     
             self.links_followed[link] = True
             self.addpendingblock(graph, link.target, inputs_s)
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -141,13 +141,17 @@
     class SomeTypeOf(SomeType):
         """The type of a variable"""
         def __init__(self, args_v):
    -        assert isinstance(args_v, list)
    -        assert args_v
             self.is_type_of = args_v
     
     def typeof(args_v):
         if args_v:
    -        return SomeTypeOf(args_v)
    +        result = SomeTypeOf(args_v)
    +        if len(args_v) == 1:
    +            s_arg = args_v[0].annotation
    +            if isinstance(s_arg, SomeException) and len(s_arg.classdefs) == 1:
    +                cdef, = s_arg.classdefs
    +                result.const = cdef.classdesc.pyobj
    +        return result
         else:
             return SomeType()
     
    diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py
    --- a/rpython/annotator/test/test_annrpython.py
    +++ b/rpython/annotator/test/test_annrpython.py
    @@ -698,6 +698,42 @@
             s = a.build_types(snippet.exc_deduction_our_excs_plus_others, [])
             assert isinstance(s, annmodel.SomeInteger)
     
    +    def test_complex_exception_deduction(self):
    +        class InternalError(Exception):
    +            def __init__(self, msg):
    +                self.msg = msg
    +
    +        class AppError(Exception):
    +            def __init__(self, msg):
    +                self.msg = msg
    +        def apperror(msg):
    +            return AppError(msg)
    +
    +        def f(string):
    +            if not string:
    +                raise InternalError('Empty string')
    +            return string, None
    +        def cleanup():
    +            pass
    +
    +        def g(string):
    +            try:
    +                try:
    +                    string, _ = f(string)
    +                except ZeroDivisionError:
    +                    raise apperror('ZeroDivisionError')
    +                try:
    +                    result, _ = f(string)
    +                finally:
    +                    cleanup()
    +            except InternalError as e:
    +                raise apperror(e.msg)
    +            return result
    +
    +        a = self.RPythonAnnotator()
    +        s_result = a.build_types(g, [str])
    +        assert isinstance(s_result, annmodel.SomeString)
    +
         def test_method_exception_specialization(self):
             def f(l):
                 try:
    @@ -708,8 +744,9 @@
             s = a.build_types(f, [[int]])
             graph = graphof(a, f)
             etype, evalue = graph.exceptblock.inputargs
    -        assert evalue.annotation.classdef.shortname == 'IndexError'
    -        #assert etype.annotation.const == IndexError
    +        assert evalue.annotation.classdefs == {
    +                a.bookkeeper.getuniqueclassdef(IndexError)}
    +        assert etype.annotation.const == IndexError
     
         def test_operation_always_raising(self):
             def operation_always_raising(n):
    @@ -1393,8 +1430,7 @@
             t.const = KeyError
             assert et.annotation == t
             s_ev = ev.annotation
    -        assert (isinstance(s_ev, annmodel.SomeInstance) and
    -                s_ev.classdef == a.bookkeeper.getuniqueclassdef(KeyError))
    +        assert s_ev == a.bookkeeper.new_exception([KeyError])
     
         def test_reraiseAnything(self):
             def f(dic):
    @@ -1410,8 +1446,7 @@
             t.const = KeyError  # IndexError ignored because 'dic' is a dict
             assert et.annotation == t
             s_ev = ev.annotation
    -        assert (isinstance(s_ev, annmodel.SomeInstance) and
    -                s_ev.classdef == a.bookkeeper.getuniqueclassdef(KeyError))
    +        assert s_ev == a.bookkeeper.new_exception([KeyError])
     
         def test_exception_mixing(self):
             def h():
    diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
    --- a/rpython/rtyper/rclass.py
    +++ b/rpython/rtyper/rclass.py
    @@ -445,6 +445,13 @@
         def rtyper_makekey(self):
             return self.__class__, self.classdef
     
    +class __extend__(annmodel.SomeException):
    +    def rtyper_makerepr(self, rtyper):
    +        return self.as_SomeInstance().rtyper_makerepr(rtyper)
    +
    +    def rtyper_makekey(self):
    +        return self.__class__, frozenset(self.classdefs)
    +
     class __extend__(annmodel.SomeType):
         def rtyper_makerepr(self, rtyper):
             return get_type_repr(rtyper)
    
    From noreply at buildbot.pypy.org  Fri Nov 20 10:59:21 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Fri, 20 Nov 2015 16:59:21 +0100 (CET)
    Subject: [pypy-commit] cffi static-callback: Fix the issue with
     subinterpreters: now each subinterpreter should have
    Message-ID: <20151120155921.BADBE1C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: static-callback
    Changeset: r2421:c5547a6eff56
    Date: 2015-11-20 17:00 +0100
    http://bitbucket.org/cffi/cffi/changeset/c5547a6eff56/
    
    Log:	Fix the issue with subinterpreters: now each subinterpreter should
    	have its own independent copy of each @ffi.def_extern().
    
    diff --git a/c/call_python.c b/c/call_python.c
    --- a/c/call_python.c
    +++ b/c/call_python.c
    @@ -1,3 +1,26 @@
    +
    +static PyObject *_get_interpstate_dict(void)
    +{
    +    /* hack around to return a dict that is subinterpreter-local */
    +    int err;
    +    PyObject *m, *modules = PyThreadState_GET()->interp->modules;
    +
    +    if (modules == NULL) {
    +        PyErr_SetString(FFIError, "subinterpreter already gone?");
    +        return NULL;
    +    }
    +    m = PyDict_GetItemString(modules, "_cffi_backend._extern_py");
    +    if (m == NULL) {
    +        m = PyModule_New("_cffi_backend._extern_py");
    +        if (m == NULL)
    +            return NULL;
    +        err = PyDict_SetItemString(modules, "_cffi_backend._extern_py", m);
    +        Py_DECREF(m);    /* sys.modules keeps one reference to m */
    +        if (err < 0)
    +            return NULL;
    +    }
    +    return PyModule_GetDict(m);
    +}
     
     static PyObject *_ffi_def_extern_decorator(PyObject *outer_args, PyObject *fn)
     {
    @@ -5,14 +28,16 @@
     #  error review!
     #endif
         char *s;
    -    PyObject *error, *onerror, *infotuple, *x;
    -    int index;
    +    PyObject *error, *onerror, *infotuple, *old1;
    +    int index, err;
         const struct _cffi_global_s *g;
         struct _cffi_externpy_s *externpy;
         CTypeDescrObject *ct;
         FFIObject *ffi;
         builder_c_t *types_builder;
         PyObject *name = NULL;
    +    PyObject *interpstate_dict;
    +    PyObject *interpstate_key;
     
         if (!PyArg_ParseTuple(outer_args, "OzOO", &ffi, &s, &error, &onerror))
             return NULL;
    @@ -47,12 +72,36 @@
         if (infotuple == NULL)
             return NULL;
     
    -    /* attach infotuple to reserved1, where it will stay forever
    -       unless a new version is attached later */
    +    /* don't directly attach infotuple to externpy: in the presence of
    +       subinterpreters, each time we switch to a different
    +       subinterpreter and call the C function, it will notice the
    +       change and look up infotuple from the interpstate_dict.
    +    */
    +    interpstate_dict = _get_interpstate_dict();
    +    if (interpstate_dict == NULL) {
    +        Py_DECREF(infotuple);
    +        return NULL;
    +    }
    +
         externpy = (struct _cffi_externpy_s *)g->address;
    -    x = (PyObject *)externpy->reserved1;
    -    externpy->reserved1 = (void *)infotuple;
    -    Py_XDECREF(x);
    +    interpstate_key = PyLong_FromVoidPtr((void *)externpy);
    +    if (interpstate_key == NULL) {
    +        Py_DECREF(infotuple);
    +        return NULL;
    +    }
    +
    +    err = PyDict_SetItem(interpstate_dict, interpstate_key, infotuple);
    +    Py_DECREF(interpstate_key);
    +    Py_DECREF(infotuple);    /* interpstate_dict owns the last ref */
    +    if (err < 0)
    +        return NULL;
    +
    +    /* force _update_cache_to_call_python() to be called the next time
    +       the C function invokes _cffi_call_python, to update the cache */
    +    old1 = externpy->reserved1;
    +    externpy->reserved1 = Py_None;   /* a non-NULL value */
    +    Py_INCREF(Py_None);
    +    Py_XDECREF(old1);
     
         /* return the function object unmodified */
         Py_INCREF(fn);
    @@ -66,6 +115,37 @@
     }
     
     
    +static int _update_cache_to_call_python(struct _cffi_externpy_s *externpy)
    +{
    +    PyObject *interpstate_dict, *interpstate_key, *infotuple, *old1, *new1;
    +
    +    interpstate_dict = _get_interpstate_dict();
    +    if (interpstate_dict == NULL)
    +        goto error;
    +
    +    interpstate_key = PyLong_FromVoidPtr((void *)externpy);
    +    if (interpstate_key == NULL)
    +        goto error;
    +
    +    infotuple = PyDict_GetItem(interpstate_dict, interpstate_key);
    +    Py_DECREF(interpstate_key);
    +    if (infotuple == NULL)
    +        return 1;    /* no ffi.def_extern() from this subinterpreter */
    +
    +    new1 = PyThreadState_GET()->interp->modules;
    +    Py_INCREF(new1);
    +    old1 = (PyObject *)externpy->reserved1;
    +    externpy->reserved1 = new1;         /* holds a reference        */
    +    externpy->reserved2 = infotuple;    /* doesn't hold a reference */
    +    Py_XDECREF(old1);
    +
    +    return 0;   /* no error */
    +
    + error:
    +    PyErr_Clear();
    +    return 2;   /* out of memory? */
    +}
    +
     static void _cffi_call_python(struct _cffi_externpy_s *externpy, char *args)
     {
         /* Invoked by the helpers generated from extern "Python" in the cdef.
    @@ -86,26 +166,43 @@
            (directly, even if more than 8 bytes).  In all cases, 'args' is
            at least 8 bytes in size.
         */
    +    int err = 0;
         save_errno();
     
    -#error XXX subinterpreters!
    -#error should we make "externpy->reserved1" subinterpreter-local??
    -
    +    /* We need the infotuple here.  We could always go through
    +       interp->modules['..'][externpy], but to avoid the extra dict
    +       lookups, we cache in (reserved1, reserved2) the last seen pair
    +       (interp->modules, infotuple).
    +    */
         if (externpy->reserved1 == NULL) {
    -        /* not initialized! */
    -        fprintf(stderr, "extern \"Python\": function %s() called, "
    -                        "but no code was attached to it yet with "
    -                        "@ffi.def_extern().  Returning 0.\n", externpy->name);
    -        memset(args, 0, externpy->size_of_result);
    +        /* Not initialized!  We didn't call @ffi.def_extern() on this
    +           externpy object from any subinterpreter at all. */
    +        err = 1;
         }
         else {
     #ifdef WITH_THREAD
             PyGILState_STATE state = PyGILState_Ensure();
     #endif
    -        general_invoke_callback(0, args, args, externpy->reserved1);
    +        if (externpy->reserved1 != PyThreadState_GET()->interp->modules) {
    +            /* Update the (reserved1, reserved2) cache.  This will fail
    +               if we didn't call @ffi.def_extern() in this particular
    +               subinterpreter. */
    +            err = _update_cache_to_call_python(externpy);
    +        }
    +        if (!err) {
    +            general_invoke_callback(0, args, args, externpy->reserved2);
    +        }
     #ifdef WITH_THREAD
             PyGILState_Release(state);
     #endif
         }
    +    if (err) {
    +        static const char *msg[2] = {
    +            "no code was attached to it yet with @ffi.def_extern()",
    +            "got internal exception (out of memory?)" };
    +        fprintf(stderr, "extern \"Python\": function %s() called, "
    +                        "but %s.  Returning 0.\n", externpy->name, msg[err-1]);
    +        memset(args, 0, externpy->size_of_result);
    +    }
         restore_errno();
     }
    
    From noreply at buildbot.pypy.org  Fri Nov 20 11:17:13 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Fri, 20 Nov 2015 17:17:13 +0100 (CET)
    Subject: [pypy-commit] cffi static-callback: meh, fix demo
    Message-ID: <20151120161713.58E071C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: static-callback
    Changeset: r2422:dd35f43cf387
    Date: 2015-11-20 17:18 +0100
    http://bitbucket.org/cffi/cffi/changeset/dd35f43cf387/
    
    Log:	meh, fix demo
    
    diff --git a/demo/extern_python.py b/demo/extern_python.py
    --- a/demo/extern_python.py
    +++ b/demo/extern_python.py
    @@ -9,7 +9,7 @@
         static int my_algo(int n) {
             int i, sum = 0;
             for (i = 0; i < n; i++)
    -            sum += f(n);
    +            sum += f(i);
             return sum;
         }
     """)
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -592,7 +592,7 @@
             static int my_algo(int n) {
                 int i, sum = 0;
                 for (i = 0; i < n; i++)
    -                sum += f(n);
    +                sum += f(i);
                 return sum;
             }
         """)
    
    From noreply at buildbot.pypy.org  Fri Nov 20 11:18:49 2015
    From: noreply at buildbot.pypy.org (fijal)
    Date: Fri, 20 Nov 2015 17:18:49 +0100 (CET)
    Subject: [pypy-commit] pypy fix-trace-too-long-heuristic: try to wrap guard
     operations so we can get their hash
    Message-ID: <20151120161849.0D9B61C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: fijal
    Branch: fix-trace-too-long-heuristic
    Changeset: r80803:3fe75b266c8c
    Date: 2015-11-20 18:19 +0200
    http://bitbucket.org/pypy/pypy/changeset/3fe75b266c8c/
    
    Log:	try to wrap guard operations so we can get their hash
    
    diff --git a/pypy/module/pypyjit/__init__.py b/pypy/module/pypyjit/__init__.py
    --- a/pypy/module/pypyjit/__init__.py
    +++ b/pypy/module/pypyjit/__init__.py
    @@ -24,6 +24,7 @@
             #'enable_debug': 'interp_resop.enable_debug',
             #'disable_debug': 'interp_resop.disable_debug',
             'ResOperation': 'interp_resop.WrappedOp',
    +        'GuardOp': 'interp_resop.GuardOp',
             'DebugMergePoint': 'interp_resop.DebugMergePoint',
             'JitLoopInfo': 'interp_resop.W_JitLoopInfo',
             'PARAMETER_DOCS': 'space.wrap(rpython.rlib.jit.PARAMETER_DOCS)',
    diff --git a/pypy/module/pypyjit/interp_resop.py b/pypy/module/pypyjit/interp_resop.py
    --- a/pypy/module/pypyjit/interp_resop.py
    +++ b/pypy/module/pypyjit/interp_resop.py
    @@ -10,6 +10,7 @@
     from rpython.rtyper.rclass import OBJECT
     #from rpython.jit.metainterp.resoperation import rop
     from rpython.rlib.nonconst import NonConstant
    +from rpython.rlib.rarithmetic import r_uint
     from rpython.rlib import jit_hooks
     from rpython.rlib.jit import Counters
     from rpython.rlib.objectmodel import compute_unique_id
    @@ -119,6 +120,9 @@
                                            op.getarg(1).getint(),
                                            op.getarg(2).getint(),
                                            w_greenkey))
    +        elif op.is_guard():
    +            l_w.append(GuardOp(name, ofs, logops.repr_of_resop(op),
    +                op.getdescr().get_jitcounter_hash()))
             else:
                 l_w.append(WrappedOp(name, ofs, logops.repr_of_resop(op)))
         return l_w
    @@ -127,6 +131,10 @@
     def descr_new_resop(space, w_tp, name, offset=-1, repr=''):
         return WrappedOp(name, offset, repr)
     
    + at unwrap_spec(offset=int, repr=str, name=str, hash=r_uint)
    +def descr_new_guardop(space, w_tp, name, offset=-1, repr='', hash=r_uint(0)):
    +    return GuardOp(name, offset, repr, hash)
    +
     @unwrap_spec(repr=str, name=str, jd_name=str, call_depth=int, call_id=int)
     def descr_new_dmp(space, w_tp, name, repr, jd_name, call_depth, call_id,
         w_greenkey):
    @@ -149,6 +157,11 @@
         def descr_name(self, space):
             return space.wrap(self.name)
     
    +class GuardOp(WrappedOp):
    +    def __init__(self, name, offset, repr_of_resop, hash):
    +        WrappedOp.__init__(self, name, offset, repr_of_resop)
    +        self.hash = hash
    +
     class DebugMergePoint(WrappedOp):
         """ A class representing Debug Merge Point - the entry point
         to a jitted loop.
    @@ -186,6 +199,17 @@
     )
     WrappedOp.typedef.acceptable_as_base_class = False
     
    +GuardOp.typedef = TypeDef(
    +    'GuardOp',
    +    __doc__ = GuardOp.__doc__,
    +    __new__ = interp2app(descr_new_guardop),
    +    __repr__ = interp2app(GuardOp.descr_repr),
    +    name = GetSetProperty(GuardOp.descr_name),
    +    offset = interp_attrproperty("offset", cls=GuardOp),
    +    hash = interp_attrproperty("hash", cls=GuardOp),
    +    )
    +GuardOp.typedef.acceptable_as_base_class = False
    +
     DebugMergePoint.typedef = TypeDef(
         'DebugMergePoint', WrappedOp.typedef,
         __new__ = interp2app(descr_new_dmp),
    diff --git a/pypy/module/pypyjit/test/test_jit_hook.py b/pypy/module/pypyjit/test/test_jit_hook.py
    --- a/pypy/module/pypyjit/test/test_jit_hook.py
    +++ b/pypy/module/pypyjit/test/test_jit_hook.py
    @@ -65,6 +65,14 @@
                 if i != 1:
                     offset[op] = i
     
    +        class FailDescr(BasicFailDescr):
    +            def get_jitcounter_hash(self):
    +                from rpython.rlib.rarithmetic import r_uint
    +                return r_uint(13)
    +
    +        oplist[-1].setdescr(FailDescr())
    +        oplist[-2].setdescr(FailDescr())
    +
             token = JitCellToken()
             token.number = 0
             di_loop = JitDebugInfo(MockJitDriverSD, logger, token, oplist, 'loop',
    @@ -73,7 +81,7 @@
                                             oplist, 'loop', greenkey)
             di_loop.asminfo = AsmInfo(offset, 0x42, 12)
             di_bridge = JitDebugInfo(MockJitDriverSD, logger, JitCellToken(),
    -                                 oplist, 'bridge', fail_descr=BasicFailDescr())
    +                                 oplist, 'bridge', fail_descr=FailDescr())
             di_bridge.asminfo = AsmInfo(offset, 0, 0)
     
             def interp_on_compile():
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:00:26 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 18:00:26 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: try hard to run the rstruct code
     when calling runpack before the translation
    Message-ID: <20151120170026.ABC581C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80804:5c33c457e1ac
    Date: 2015-11-20 15:41 +0100
    http://bitbucket.org/pypy/pypy/changeset/5c33c457e1ac/
    
    Log:	try hard to run the rstruct code when calling runpack before the
    	translation
    
    diff --git a/rpython/rlib/rstruct/runpack.py b/rpython/rlib/rstruct/runpack.py
    --- a/rpython/rlib/rstruct/runpack.py
    +++ b/rpython/rlib/rstruct/runpack.py
    @@ -100,13 +100,6 @@
             exec source.compile() in miniglobals
             self.unpack = miniglobals['unpack'] # override not-rpython version
     
    -    def unpack(self, s):
    -        # NOT_RPYTHON
    -        res = unpack(self.fmt, s)
    -        if len(res) == 1:
    -            return res[0]
    -        return res
    -
         def _freeze_(self):
             assert self.formats
             self._create_unpacking_func()
    @@ -115,6 +108,7 @@
     def create_unpacker(unpack_str):
         fmtiter = FrozenUnpackIterator(unpack_str)
         fmtiter.interpret(unpack_str)
    +    assert fmtiter._freeze_()
         return fmtiter
     create_unpacker._annspecialcase_ = 'specialize:memo'
     
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:00:28 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 18:00:28 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: use the str_storage_getitem
     fastpath to unpack ints and floats by reading them directly from within the
     buffer,
     is it's properly aligned. Add tests which disallow the fast path so that we
     can easily test also the slow paths
    Message-ID: <20151120170028.B868A1C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80805:7b525c75f558
    Date: 2015-11-20 16:21 +0100
    http://bitbucket.org/pypy/pypy/changeset/7b525c75f558/
    
    Log:	use the str_storage_getitem fastpath to unpack ints and floats by
    	reading them directly from within the buffer, is it's properly
    	aligned. Add tests which disallow the fast path so that we can
    	easily test also the slow paths
    
    diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py
    --- a/rpython/rlib/rstruct/nativefmttable.py
    +++ b/rpython/rlib/rstruct/nativefmttable.py
    @@ -8,7 +8,8 @@
     from rpython.rlib.objectmodel import specialize
     from rpython.rlib.rarithmetic import r_singlefloat, widen
     from rpython.rlib.rstruct import standardfmttable as std
    -from rpython.rlib.rstruct.standardfmttable import native_is_bigendian
    +from rpython.rlib.rstruct.standardfmttable import (native_is_bigendian, unpack_fastpath,
    +                                                   CannotUnpack)
     from rpython.rlib.rstruct.error import StructError
     from rpython.rlib.unroll import unrolling_iterable
     from rpython.rlib.strstorage import str_storage_getitem
    @@ -44,16 +45,13 @@
     
     @specialize.argtype(0)
     def unpack_double(fmtiter):
    -    if fmtiter.is_aligned(sizeof_double):
    -        # fast path
    -        input = fmtiter.get_buffer()
    -        pos = fmtiter.get_pos()
    -        doubleval = str_storage_getitem(rffi.DOUBLE, input, pos)
    -        fmtiter.advance(sizeof_double)
    -    else:
    +    try:
    +        doubleval = unpack_fastpath(rffi.DOUBLE, fmtiter)
    +    except CannotUnpack:
             # slow path, take the slice
             input = fmtiter.read(sizeof_double)
             doubleval = str_storage_getitem(rffi.DOUBLE, input, 0)
    +    #
         fmtiter.appendobj(doubleval)
     
     def pack_float(fmtiter):
    @@ -72,8 +70,11 @@
     
     @specialize.argtype(0)
     def unpack_float(fmtiter):
    -    input = fmtiter.read(sizeof_float)
    -    floatval = str_storage_getitem(rffi.FLOAT, input, 0)
    +    try:
    +        floatval = unpack_fastpath(rffi.FLOAT, fmtiter)
    +    except CannotUnpack:
    +        input = fmtiter.read(sizeof_float)
    +        floatval = str_storage_getitem(rffi.FLOAT, input, 0)
         doubleval = float(floatval) # convert from r_singlefloat to rpython's float
         fmtiter.appendobj(doubleval)
     
    diff --git a/rpython/rlib/rstruct/runpack.py b/rpython/rlib/rstruct/runpack.py
    --- a/rpython/rlib/rstruct/runpack.py
    +++ b/rpython/rlib/rstruct/runpack.py
    @@ -39,16 +39,13 @@
             def appendobj(self, value):
                 self.value = value
     
    -        def is_aligned(self, size):
    -            return self.mr.inputpos % size == 0
    -
    -        def get_buffer(self):
    -            return self.mr.input
    -
             def get_pos(self):
                 return self.mr.inputpos
     
    -        def advance(self, size):
    +        def get_buffer_as_string_maybe(self):
    +            return self.mr.input
    +
    +        def skip(self, size):
                 self.read(size) # XXX, could avoid taking the slice
         ReaderForPos.__name__ = 'ReaderForPos%d' % pos
         return ReaderForPos
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -130,6 +130,21 @@
     
     # ____________________________________________________________
     
    +ALLOW_FASTPATH = True # set to False by TestNoFastPath
    +
    +class CannotUnpack(Exception):
    +    pass
    +
    + at specialize.arg(0)
    +def unpack_fastpath(TYPE, fmtiter):
    +    size = rffi.sizeof(TYPE)
    +    pos = fmtiter.get_pos()
    +    strbuf = fmtiter.get_buffer_as_string_maybe()
    +    if pos % size != 0 or strbuf is None or not ALLOW_FASTPATH:
    +        raise CannotUnpack
    +    fmtiter.skip(size)
    +    return str_storage_getitem(TYPE, strbuf, pos)
    +
     @specialize.argtype(0)
     def unpack_pad(fmtiter, count):
         fmtiter.read(count)
    @@ -173,8 +188,6 @@
                 return TYPE
         raise KeyError("Cannot find an int type size=%d, signed=%d" % (size, signed))
     
    -UNPACK_ALLOW_RAW_STORAGE = True
    -
     def make_int_unpacker(size, signed, _memo={}):
         try:
             return _memo[size, signed]
    @@ -196,17 +209,28 @@
         TYPE = get_rffi_int_type(size, signed)
     
         @specialize.argtype(0)
    +    def unpack_int_fastpath_maybe(fmtiter):
    +        if fmtiter.bigendian != native_is_bigendian:
    +            return False
    +        try:
    +            intvalue = unpack_fastpath(TYPE, fmtiter)
    +        except CannotUnpack:
    +            return False
    +        if not signed and size < native_int_size:
    +            intvalue = rarithmetic.intmask(intvalue)
    +        intvalue = inttype(intvalue)
    +        fmtiter.appendobj(intvalue)
    +        return True
    +
    +    @specialize.argtype(0)
         def unpack_int(fmtiter):
    +        if unpack_int_fastpath_maybe(fmtiter):
    +            return
    +        # slow path
             intvalue = inttype(0)
             s = fmtiter.read(size)
             idx = 0
    -        if UNPACK_ALLOW_RAW_STORAGE and fmtiter.bigendian == native_is_bigendian:
    -            # fast path, using the native raw_storage
    -            intvalue = str_storage_getitem(TYPE, s, 0)
    -            if not signed and size < native_int_size:
    -                intvalue = rarithmetic.intmask(intvalue)
    -            intvalue = inttype(intvalue)
    -        elif fmtiter.bigendian:
    +        if fmtiter.bigendian:
                 for i in unroll_range_size:
                     x = ord(s[idx])
                     if signed and i == 0 and x >= 128:
    diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py
    --- a/rpython/rlib/rstruct/test/test_runpack.py
    +++ b/rpython/rlib/rstruct/test/test_runpack.py
    @@ -48,6 +48,13 @@
                 d, f = runpack("@df", d_data)
                 return d, f
             #
    +        # direct test
    +        d, f = fn()
    +        assert d == 12.34     # no precision lost
    +        assert f != 12.34     # precision lost
    +        assert abs(f - 12.34) < 1E-6
    +        #
    +        # translated test
             res = self.interpret(fn, [])
             d = res.item0
             f = res.item1  # convert from r_singlefloat
    @@ -83,8 +90,11 @@
             assert unpack(">q", '\xbeMLKJIHH') == -0x41B2B3B4B5B6B7B8
             assert unpack(">Q", '\x81BCDEFGH') == 0x8142434445464748
     
    -    def test_unpack_standard_no_raw_storage(self, monkeypatch):
    -        monkeypatch.setattr(standardfmttable, 'UNPACK_ALLOW_RAW_STORAGE', False)
    -        self.test_unpack_standard_little()
    -        self.test_unpack_standard_big()
     
    +class TestNoFastPath(TestRStruct):
    +
    +    def setup_method(self, meth):
    +        standardfmttable.ALLOW_FASTPATH = False
    +
    +    def teardown_method(self, meth):
    +        standardfmttable.ALLOW_FASTPATH = True
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:00:30 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 18:00:30 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: adapt the applevel struct to the
     new interface for the fast path
    Message-ID: <20151120170030.BF2AF1C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80806:913f469cb07b
    Date: 2015-11-20 16:27 +0100
    http://bitbucket.org/pypy/pypy/changeset/913f469cb07b/
    
    Log:	adapt the applevel struct to the new interface for the fast path
    
    diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py
    --- a/pypy/module/struct/formatiterator.py
    +++ b/pypy/module/struct/formatiterator.py
    @@ -150,16 +150,13 @@
         def appendobj(self, value):
             self.result_w.append(self.space.wrap(value))
     
    -    def is_aligned(self, size):
    -        return self.pos % size == 0
    +    def get_pos(self):
    +        return self.pos
     
    -    def get_buffer(self):
    +    def get_buffer_as_string_maybe(self):
             # XXX: if self.buf is something different that StringBuffer, this has
             # the effect to copy the whole string at each unpack!
             return self.buf.as_str()
     
    -    def get_pos(self):
    -        return self.pos
    -
    -    def advance(self, size):
    +    def skip(self, size):
             self.read(size) # XXX, could avoid taking the slice
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:00:32 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 18:00:32 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: change the inteface: now
     get_buffer_as_string_maybe also return the position inside the string: this
     will allow to support sub-buffers
    Message-ID: <20151120170032.C3B621C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80807:c4eb83d8e88f
    Date: 2015-11-20 16:52 +0100
    http://bitbucket.org/pypy/pypy/changeset/c4eb83d8e88f/
    
    Log:	change the inteface: now get_buffer_as_string_maybe also return the
    	position inside the string: this will allow to support sub-buffers
    
    diff --git a/rpython/rlib/rstruct/runpack.py b/rpython/rlib/rstruct/runpack.py
    --- a/rpython/rlib/rstruct/runpack.py
    +++ b/rpython/rlib/rstruct/runpack.py
    @@ -39,11 +39,8 @@
             def appendobj(self, value):
                 self.value = value
     
    -        def get_pos(self):
    -            return self.mr.inputpos
    -
             def get_buffer_as_string_maybe(self):
    -            return self.mr.input
    +            return self.mr.input, self.mr.inputpos
     
             def skip(self, size):
                 self.read(size) # XXX, could avoid taking the slice
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -138,8 +138,7 @@
     @specialize.arg(0)
     def unpack_fastpath(TYPE, fmtiter):
         size = rffi.sizeof(TYPE)
    -    pos = fmtiter.get_pos()
    -    strbuf = fmtiter.get_buffer_as_string_maybe()
    +    strbuf, pos = fmtiter.get_buffer_as_string_maybe()
         if pos % size != 0 or strbuf is None or not ALLOW_FASTPATH:
             raise CannotUnpack
         fmtiter.skip(size)
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:00:34 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 18:00:34 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: make sure that
     struct.unpack_from uses the fast path as well
    Message-ID: <20151120170034.CB1741C1205@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80808:f2275be59406
    Date: 2015-11-20 17:37 +0100
    http://bitbucket.org/pypy/pypy/changeset/f2275be59406/
    
    Log:	make sure that struct.unpack_from uses the fast path as well
    
    diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py
    --- a/pypy/module/struct/formatiterator.py
    +++ b/pypy/module/struct/formatiterator.py
    @@ -154,9 +154,8 @@
             return self.pos
     
         def get_buffer_as_string_maybe(self):
    -        # XXX: if self.buf is something different that StringBuffer, this has
    -        # the effect to copy the whole string at each unpack!
    -        return self.buf.as_str()
    +        string, pos = self.buf.as_str_and_offset_maybe()
    +        return string, pos+self.pos
     
         def skip(self, size):
             self.read(size) # XXX, could avoid taking the slice
    diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py
    --- a/pypy/module/struct/test/test_struct.py
    +++ b/pypy/module/struct/test/test_struct.py
    @@ -462,3 +462,29 @@
             assert self.struct.unpack_from("ii", b, 2) == (17, 42)
             b[:sz] = self.struct.pack("ii", 18, 43)
             assert self.struct.unpack_from("ii", b) == (18, 43)
    +
    +
    +class AppTestFastPath(object):
    +    spaceconfig = dict(usemodules=['struct', '__pypy__'])
    +
    +    def setup_class(cls):
    +        from rpython.rlib.rstruct import standardfmttable
    +        standardfmttable.ALLOW_SLOWPATH = False
    +        #
    +        cls.w_struct = cls.space.appexec([], """():
    +            import struct
    +            return struct
    +        """)
    +        cls.w_bytebuffer = cls.space.appexec([], """():
    +            import __pypy__
    +            return __pypy__.bytebuffer
    +        """)
    +
    +    def teardown_class(cls):
    +        from rpython.rlib.rstruct import standardfmttable
    +        standardfmttable.ALLOW_SLOWPATH = True
    +
    +    def test_unpack_from(self):
    +        buf = self.struct.pack("iii", 0, 42, 43)
    +        offset = self.struct.calcsize("i")
    +        assert self.struct.unpack_from("ii", buf, offset) == (42, 43)
    diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py
    --- a/rpython/rlib/buffer.py
    +++ b/rpython/rlib/buffer.py
    @@ -22,6 +22,14 @@
             # May be overridden.
             return self.getslice(0, self.getlength(), 1, self.getlength())
     
    +    def as_str_and_offset_maybe(self):
    +        """
    +        If the buffer is backed by a string, return a pair (string, offset), where
    +        offset is the offset inside the string where the buffer start.
    +        Else, return (None, 0).
    +        """
    +        return None, 0
    +
         def getitem(self, index):
             "Returns the index'th character in the buffer."
             raise NotImplementedError   # Must be overriden.  No bounds checks.
    @@ -66,6 +74,9 @@
         def as_str(self):
             return self.value
     
    +    def as_str_and_offset_maybe(self):
    +        return self.value, 0
    +
         def getitem(self, index):
             return self.value[index]
     
    @@ -99,6 +110,12 @@
             else:
                 return 0
     
    +    def as_str_and_offset_maybe(self):
    +        string, offset = self.buffer.as_str_and_offset_maybe()
    +        if string is not None:
    +            return string, offset+self.offset
    +        return None, 0
    +
         def getitem(self, index):
             return self.buffer.getitem(self.offset + index)
     
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -130,7 +130,8 @@
     
     # ____________________________________________________________
     
    -ALLOW_FASTPATH = True # set to False by TestNoFastPath
    +USE_FASTPATH = True    # set to False by some tests
    +ALLOW_SLOWPATH = True  # set to False by some tests
     
     class CannotUnpack(Exception):
         pass
    @@ -139,7 +140,7 @@
     def unpack_fastpath(TYPE, fmtiter):
         size = rffi.sizeof(TYPE)
         strbuf, pos = fmtiter.get_buffer_as_string_maybe()
    -    if pos % size != 0 or strbuf is None or not ALLOW_FASTPATH:
    +    if strbuf is None or pos % size != 0 or not USE_FASTPATH:
             raise CannotUnpack
         fmtiter.skip(size)
         return str_storage_getitem(TYPE, strbuf, pos)
    @@ -226,6 +227,9 @@
             if unpack_int_fastpath_maybe(fmtiter):
                 return
             # slow path
    +        if not ALLOW_SLOWPATH:
    +            # we enter here only on some tests
    +            raise ValueError("fastpath not taken :(")
             intvalue = inttype(0)
             s = fmtiter.read(size)
             idx = 0
    diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py
    --- a/rpython/rlib/rstruct/test/test_runpack.py
    +++ b/rpython/rlib/rstruct/test/test_runpack.py
    @@ -94,7 +94,7 @@
     class TestNoFastPath(TestRStruct):
     
         def setup_method(self, meth):
    -        standardfmttable.ALLOW_FASTPATH = False
    +        standardfmttable.USE_FASTPATH = False
     
         def teardown_method(self, meth):
    -        standardfmttable.ALLOW_FASTPATH = True
    +        standardfmttable.USE_FASTPATH = True
    diff --git a/rpython/rlib/test/test_buffer.py b/rpython/rlib/test/test_buffer.py
    --- a/rpython/rlib/test/test_buffer.py
    +++ b/rpython/rlib/test/test_buffer.py
    @@ -32,3 +32,16 @@
         a = RPythonAnnotator()
         s = a.build_types(func, [int])
         assert s == SomeInteger(nonneg=True)
    +
    +
    +def test_as_str_and_offset_maybe():
    +    buf = StringBuffer('hello world')
    +    assert buf.as_str_and_offset_maybe() == ('hello world', 0)
    +    #
    +    sbuf = SubBuffer(buf, 6, 5)
    +    assert sbuf.getslice(0, 5, 1, 5) == 'world'
    +    assert sbuf.as_str_and_offset_maybe() == ('hello world', 6)
    +    #
    +    ssbuf = SubBuffer(sbuf, 3, 2)
    +    assert ssbuf.getslice(0, 2, 1, 2) == 'ld'
    +    assert ssbuf.as_str_and_offset_maybe() == ('hello world', 9)
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:24:59 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Fri, 20 Nov 2015 18:24:59 +0100 (CET)
    Subject: [pypy-commit] pypy anntype: Split off SomeTypeOf-specific path in
     handling of op.issubtype
    Message-ID: <20151120172459.706081C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype
    Changeset: r80809:c17dbcc48d6a
    Date: 2015-11-20 15:59 +0000
    http://bitbucket.org/pypy/pypy/changeset/c17dbcc48d6a/
    
    Log:	Split off SomeTypeOf-specific path in handling of op.issubtype
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -11,7 +11,7 @@
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, SomeTypeOf, SomeException, SomeExceptCase, s_ImpossibleValue)
    +        typeof, SomeExceptCase, s_ImpossibleValue)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
    --- a/rpython/annotator/unaryop.py
    +++ b/rpython/annotator/unaryop.py
    @@ -100,18 +100,17 @@
         callspec = complex_args([annotator.annotation(v_arg) for v_arg in args_v])
         return annotator.annotation(func).call(callspec)
     
    + at op.issubtype.register(SomeObject)
    +def issubtype(annotator, v_type, v_cls):
    +    s_type = v_type.annotation
    +    s_cls = annotator.annotation(v_cls)
    +    if s_type.is_constant() and s_cls.is_constant():
    +        return annotator.bookkeeper.immutablevalue(
    +            issubclass(s_type.const, s_cls.const))
    +    return s_Bool
    +
     class __extend__(SomeObject):
     
    -    def issubtype(self, s_cls):
    -        if hasattr(self, 'is_type_of'):
    -            vars = self.is_type_of
    -            annotator = getbookkeeper().annotator
    -            return builtin.builtin_isinstance(annotator.binding(vars[0]),
    -                                              s_cls, vars)
    -        if self.is_constant() and s_cls.is_constant():
    -            return immutablevalue(issubclass(self.const, s_cls.const))
    -        return s_Bool
    -
         def len(self):
             return SomeInteger(nonneg=True)
     
    @@ -914,6 +913,12 @@
             # really crash translated code).  It can be generalized later.
             return SomeImpossibleValue()
     
    + at op.issubtype.register(SomeTypeOf)
    +def issubtype(annotator, v_type, v_cls):
    +    args_v = v_type.annotation.is_type_of
    +    return builtin.builtin_isinstance(
    +        args_v[0].annotation, annotator.annotation(v_cls), args_v)
    +
     #_________________________________________
     # weakrefs
     
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:25:01 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Fri, 20 Nov 2015 18:25:01 +0100 (CET)
    Subject: [pypy-commit] pypy anntype: Implement unions of SomeExceptions
    Message-ID: <20151120172501.7B9ED1C0EB1@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype
    Changeset: r80810:f0b297934dd7
    Date: 2015-11-20 17:25 +0000
    http://bitbucket.org/pypy/pypy/changeset/f0b297934dd7/
    
    Log:	Implement unions of SomeExceptions
    
    diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
    --- a/rpython/annotator/binaryop.py
    +++ b/rpython/annotator/binaryop.py
    @@ -689,6 +689,10 @@
         def union((s_inst, s_exc)):
             return unionof(s_exc.as_SomeInstance(), s_inst)
     
    +class __extend__(pairtype(SomeException, SomeException)):
    +    def union((s_exc1, s_exc2)):
    +        return SomeException(s_exc1.classdefs | s_exc2.classdefs)
    +
     
     @op.getitem.register_transform(SomeInstance, SomeObject)
     def getitem_SomeInstance(annotator, v_ins, v_idx):
    diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py
    --- a/rpython/annotator/test/test_model.py
    +++ b/rpython/annotator/test/test_model.py
    @@ -148,3 +148,6 @@
         s_nullable = unionof(s_None, bk.new_exception([ValueError]))
         assert isinstance(s_nullable, SomeInstance)
         assert s_nullable.can_be_None
    +    s_exc1 = bk.new_exception([ValueError])
    +    s_exc2 = bk.new_exception([IndexError])
    +    unionof(s_exc1, s_exc2) == unionof(s_exc2, s_exc1)
    
    From noreply at buildbot.pypy.org  Fri Nov 20 12:34:22 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Fri, 20 Nov 2015 18:34:22 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: translation fix;
     I didn't find a better way to express specialize.arg0_and_argtype1
    Message-ID: <20151120173422.9D19F1C12B3@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80811:ec447791f752
    Date: 2015-11-20 18:34 +0100
    http://bitbucket.org/pypy/pypy/changeset/ec447791f752/
    
    Log:	translation fix; I didn't find a better way to express
    	specialize.arg0_and_argtype1
    
    diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py
    --- a/rpython/rlib/rstruct/nativefmttable.py
    +++ b/rpython/rlib/rstruct/nativefmttable.py
    @@ -46,7 +46,7 @@
     @specialize.argtype(0)
     def unpack_double(fmtiter):
         try:
    -        doubleval = unpack_fastpath(rffi.DOUBLE, fmtiter)
    +        doubleval = unpack_fastpath(rffi.DOUBLE)(fmtiter)
         except CannotUnpack:
             # slow path, take the slice
             input = fmtiter.read(sizeof_double)
    @@ -71,7 +71,7 @@
     @specialize.argtype(0)
     def unpack_float(fmtiter):
         try:
    -        floatval = unpack_fastpath(rffi.FLOAT, fmtiter)
    +        floatval = unpack_fastpath(rffi.FLOAT)(fmtiter)
         except CannotUnpack:
             input = fmtiter.read(sizeof_float)
             floatval = str_storage_getitem(rffi.FLOAT, input, 0)
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -136,14 +136,17 @@
     class CannotUnpack(Exception):
         pass
     
    - at specialize.arg(0)
    -def unpack_fastpath(TYPE, fmtiter):
    -    size = rffi.sizeof(TYPE)
    -    strbuf, pos = fmtiter.get_buffer_as_string_maybe()
    -    if strbuf is None or pos % size != 0 or not USE_FASTPATH:
    -        raise CannotUnpack
    -    fmtiter.skip(size)
    -    return str_storage_getitem(TYPE, strbuf, pos)
    + at specialize.memo()
    +def unpack_fastpath(TYPE):
    +    @specialize.argtype(0)
    +    def do_unpack_fastpath(fmtiter):
    +        size = rffi.sizeof(TYPE)
    +        strbuf, pos = fmtiter.get_buffer_as_string_maybe()
    +        if strbuf is None or pos % size != 0 or not USE_FASTPATH:
    +            raise CannotUnpack
    +        fmtiter.skip(size)
    +        return str_storage_getitem(TYPE, strbuf, pos)
    +    return do_unpack_fastpath
     
     @specialize.argtype(0)
     def unpack_pad(fmtiter, count):
    @@ -213,7 +216,7 @@
             if fmtiter.bigendian != native_is_bigendian:
                 return False
             try:
    -            intvalue = unpack_fastpath(TYPE, fmtiter)
    +            intvalue = unpack_fastpath(TYPE)(fmtiter)
             except CannotUnpack:
                 return False
             if not signed and size < native_int_size:
    
    From noreply at buildbot.pypy.org  Fri Nov 20 13:52:07 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Fri, 20 Nov 2015 19:52:07 +0100 (CET)
    Subject: [pypy-commit] pypy anntype: hg merge default
    Message-ID: <20151120185207.725AB1C12B3@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype
    Changeset: r80812:84d086b4b9d8
    Date: 2015-11-20 18:53 +0000
    http://bitbucket.org/pypy/pypy/changeset/84d086b4b9d8/
    
    Log:	hg merge default
    
    diff too long, truncating to 2000 out of 2484 lines
    
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -17,3 +17,4 @@
     295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
     f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
     850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
    +5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
    diff --git a/LICENSE b/LICENSE
    --- a/LICENSE
    +++ b/LICENSE
    @@ -56,14 +56,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -87,7 +88,6 @@
       Ludovic Aubry
       Jacob Hallen
       Jason Creighton
    -  Richard Plangger
       Alex Martelli
       Michal Bendowski
       stian
    @@ -200,9 +200,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -234,6 +237,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -244,6 +248,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -253,6 +258,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -283,6 +289,7 @@
       shoma hosaka
       Daniel Neuhäuser
       Ben Mather
    +  Niclas Olofsson
       halgari
       Boglarka Vezer
       Chris Pressey
    @@ -309,13 +316,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -327,6 +337,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
    --- a/lib_pypy/cffi.egg-info/PKG-INFO
    +++ b/lib_pypy/cffi.egg-info/PKG-INFO
    @@ -1,6 +1,6 @@
     Metadata-Version: 1.1
     Name: cffi
    -Version: 1.3.0
    +Version: 1.3.1
     Summary: Foreign Function Interface for Python calling C code.
     Home-page: http://cffi.readthedocs.org
     Author: Armin Rigo, Maciej Fijalkowski
    diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
    --- a/lib_pypy/cffi/__init__.py
    +++ b/lib_pypy/cffi/__init__.py
    @@ -4,8 +4,8 @@
     from .api import FFI, CDefError, FFIError
     from .ffiplatform import VerificationError, VerificationMissing
     
    -__version__ = "1.3.0"
    -__version_info__ = (1, 3, 0)
    +__version__ = "1.3.1"
    +__version_info__ = (1, 3, 1)
     
     # The verifier module file names are based on the CRC32 of a string that
     # contains the following version number.  It may be older than __version__
    diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py
    --- a/lib_pypy/cffi/cparser.py
    +++ b/lib_pypy/cffi/cparser.py
    @@ -62,7 +62,8 @@
             if csource.startswith('*', endpos):
                 parts.append('('); closing += ')'
             level = 0
    -        for i in xrange(endpos, len(csource)):
    +        i = endpos
    +        while i < len(csource):
                 c = csource[i]
                 if c == '(':
                     level += 1
    @@ -73,6 +74,7 @@
                 elif c in ',;=':
                     if level == 0:
                         break
    +            i += 1
             csource = csource[endpos:i] + closing + csource[i:]
             #print repr(''.join(parts)+csource)
         parts.append(csource)
    diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py
    --- a/lib_pypy/cffi/model.py
    +++ b/lib_pypy/cffi/model.py
    @@ -514,12 +514,17 @@
             if self.baseinttype is not None:
                 return self.baseinttype.get_cached_btype(ffi, finishlist)
             #
    +        from . import api
             if self.enumvalues:
                 smallest_value = min(self.enumvalues)
                 largest_value = max(self.enumvalues)
             else:
    -            smallest_value = 0
    -            largest_value = 0
    +            import warnings
    +            warnings.warn("%r has no values explicitly defined; next version "
    +                          "will refuse to guess which integer type it is "
    +                          "meant to be (unsigned/signed, int/long)"
    +                          % self._get_c_name())
    +            smallest_value = largest_value = 0
             if smallest_value < 0:   # needs a signed type
                 sign = 1
                 candidate1 = PrimitiveType("int")
    diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
    --- a/lib_pypy/greenlet.py
    +++ b/lib_pypy/greenlet.py
    @@ -88,9 +88,19 @@
             #
             try:
                 unbound_method = getattr(_continulet, methodname)
    +            _tls.leaving = current
                 args, kwds = unbound_method(current, *baseargs, to=target)
    -        finally:
                 _tls.current = current
    +        except:
    +            _tls.current = current
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            _tls.leaving = None
    +            raise
    +        else:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            _tls.leaving = None
             #
             if kwds:
                 if args:
    @@ -122,6 +132,34 @@
             return f.f_back.f_back.f_back   # go past start(), __switch(), switch()
     
     # ____________________________________________________________
    +# Recent additions
    +
    +GREENLET_USE_GC = True
    +GREENLET_USE_TRACING = True
    +
    +def gettrace():
    +    return getattr(_tls, 'trace', None)
    +
    +def settrace(callback):
    +    try:
    +        prev = _tls.trace
    +        del _tls.trace
    +    except AttributeError:
    +        prev = None
    +    if callback is not None:
    +        _tls.trace = callback
    +    return prev
    +
    +def _run_trace_callback(event):
    +    try:
    +        _tls.trace(event, (_tls.leaving, _tls.current))
    +    except:
    +        # In case of exceptions trace function is removed
    +        if hasattr(_tls, 'trace'):
    +            del _tls.trace
    +        raise
    +
    +# ____________________________________________________________
     # Internal stuff
     
     try:
    @@ -143,22 +181,32 @@
         _tls.current = gmain
     
     def _greenlet_start(greenlet, args):
    -    args, kwds = args
    -    _tls.current = greenlet
         try:
    -        res = greenlet.run(*args, **kwds)
    -    except GreenletExit, e:
    -        res = e
    +        args, kwds = args
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            res = greenlet.run(*args, **kwds)
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
     
     def _greenlet_throw(greenlet, exc, value, tb):
    -    _tls.current = greenlet
         try:
    -        raise exc, value, tb
    -    except GreenletExit, e:
    -        res = e
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            raise exc, value, tb
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
    diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
    --- a/pypy/doc/contributor.rst
    +++ b/pypy/doc/contributor.rst
    @@ -26,15 +26,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    -  Richard Plangger
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -170,9 +170,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -204,6 +207,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -214,6 +218,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -223,6 +228,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -280,13 +286,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -298,6 +307,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst
    --- a/pypy/doc/index-of-release-notes.rst
    +++ b/pypy/doc/index-of-release-notes.rst
    @@ -6,6 +6,7 @@
     
     .. toctree::
     
    +   release-4.0.1.rst
        release-4.0.0.rst
        release-2.6.1.rst
        release-2.6.0.rst
    diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst
    --- a/pypy/doc/index-of-whatsnew.rst
    +++ b/pypy/doc/index-of-whatsnew.rst
    @@ -7,6 +7,7 @@
     .. toctree::
     
        whatsnew-head.rst
    +   whatsnew-4.0.1.rst
        whatsnew-4.0.0.rst
        whatsnew-2.6.1.rst
        whatsnew-2.6.0.rst
    diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/release-4.0.1.rst
    @@ -0,0 +1,106 @@
    +==========
    +PyPy 4.0.1
    +==========
    +
    +We have released PyPy 4.0.1, three weeks after PyPy 4.0.0. We have fixed
    +a few critical bugs in the JIT compiled code, reported by users. We therefore
    +encourage all users of PyPy to update to this version. There are a few minor
    +enhancements in this version as well.
    +
    +You can download the PyPy 4.0.1 release here:
    +
    +    http://pypy.org/download.html
    +
    +We would like to thank our donors for the continued support of the PyPy
    +project.
    +
    +We would also like to thank our contributors and 
    +encourage new people to join the project. PyPy has many
    +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation
    +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ 
    +with making RPython's JIT even better. 
    +
    +CFFI
    +====
    +
    +While not applicable only to PyPy, `cffi`_ is arguably our most significant
    +contribution to the python ecosystem. PyPy 4.0.1 ships with 
    +`cffi-1.3.1`_ with the improvements it brings.
    +
    +.. _`PyPy`: http://doc.pypy.org 
    +.. _`RPython`: https://rpython.readthedocs.org
    +.. _`cffi`: https://cffi.readthedocs.org
    +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1
    +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly
    +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html
    +.. _`numpy`: https://bitbucket.org/pypy/numpy
    +
    +What is PyPy?
    +=============
    +
    +PyPy is a very compliant Python interpreter, almost a drop-in replacement for
    +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison)
    +due to its integrated tracing JIT compiler.
    +
    +We also welcome developers of other
    +`dynamic languages`_ to see what RPython can do for them.
    +
    +This release supports **x86** machines on most common operating systems
    +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd),
    +newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the
    +big- and little-endian variants of **ppc64** running Linux.
    +
    +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org
    +.. _`dynamic languages`: http://pypyjs.org
    +
    +Other Highlights (since 4.0.0 released three weeks ago)
    +=======================================================
    +
    +* Bug Fixes
    +
    +  * Fix a bug when unrolling double loops in JITted code
    +
    +  * Fix multiple memory leaks in the ssl module, one of which affected
    +    `cpython` as well (thanks to Alex Gaynor for pointing those out)
    +
    +  * Use pkg-config to find ssl headers on OS-X
    +
    +  * Issues reported with our previous release were resolved_ after reports from users on
    +    our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
    +    #pypy
    +
    +* New features:
    +
    +  * Internal cleanup of RPython class handling
    +
    +  * Support stackless and greenlets on PPC machines
    +
    +  * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d
    +    for example to have all subprocesses write the JIT log to a file
    +    called 'log.%d', with '%d' replaced with the subprocess' PID.
    +
    +  * Support PyOS_double_to_string in our cpyext capi compatibility layer
    +
    +* Numpy:
    +
    +  * Improve support for __array_interface__
    +
    +  * Propagate NAN mantissas through float16-float32-float64 conversions
    +
    +
    +* Performance improvements and refactorings:
    +
    +  * Improvements in slicing byte arrays
    +
    +  * Improvements in enumerate()
    +
    +  * Silence some warnings while translating
    +
    +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html
    +
    +Please update, and continue to help us make PyPy better.
    +
    +Cheers
    +
    +The PyPy Team
    +
    diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
    --- a/pypy/doc/tool/makecontributor.py
    +++ b/pypy/doc/tool/makecontributor.py
    @@ -69,7 +69,9 @@
         'Rami Chowdhury': ['necaris'],
         'Stanislaw Halik':['w31rd0'],
         'Wenzhu Man':['wenzhu man', 'wenzhuman'],
    -    'Anton Gulenko':['anton gulenko'],
    +    'Anton Gulenko':['anton gulenko', 'anton_gulenko'],
    +    'Richard Lancaster':['richardlancaster'],
    +    'William Leslie':['William ML Leslie'],
         }
     
     alias_map = {}
    diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/whatsnew-4.0.1.rst
    @@ -0,0 +1,35 @@
    +=========================
    +What's new in PyPy 4.0.1
    +=========================
    +
    +.. this is a revision shortly after release-4.0.0
    +.. startrev: 57c9a47c70f6
    +
    +.. branch: 2174-fix-osx-10-11-translation
    +
    +Use pkg-config to find ssl headers on OS-X
    +
    +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    +
    +.. branch: ppc-stacklet
    +
    +The PPC machines now support the _continuation module (stackless, greenlets)
    +
    +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227
    +
    +Document that libgdbm-dev is required for translation/packaging
    +
    +.. branch: propogate-nans
    +
    +Ensure that ndarray conversion from int16->float16->float32->float16->int16
    +preserves all int16 values, even across nan conversions. Also fix argmax, argmin
    +for nan comparisons
    +
    +.. branch: array_interface
    +
    +Support common use-cases for __array_interface__, passes upstream tests
    +
    +.. branch: no-class-specialize
    +
    +Some refactoring of class handling in the annotator. 
    +Remove class specialisation and _settled_ flag.
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -1,35 +1,15 @@
     =========================
    -What's new in PyPy 4.0.+
    +What's new in PyPy 4.1.+
     =========================
     
    -.. this is a revision shortly after release-4.0.0
    -.. startrev: 57c9a47c70f6
    +.. this is a revision shortly after release-4.0.1
    +.. startrev: 4b5c840d0da2
     
    -.. branch: 2174-fix-osx-10-11-translation
    +.. branch: numpy-1.10
     
    -Use pkg-config to find ssl headers on OS-X
    +Fix tests to run cleanly with -A and start to fix micronumpy for upstream numpy
    +which is now 1.10.2
     
    -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    +.. branch: osx-flat-namespace
     
    -.. branch: ppc-stacklet
    -
    -The PPC machines now support the _continuation module (stackless, greenlets)
    -
    -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227
    -
    -Document that libgdbm-dev is required for translation/packaging
    -
    -.. branch: propogate-nans
    -
    -Ensure that ndarray conversion from int16->float16->float32->float16->int16
    -preserves all int16 values, even across nan conversions. Also fix argmax, argmin
    -for nan comparisons
    -
    -.. branch: array_interface
    -
    -Support common use-cases for __array_interface__, passes upstream tests
    -
    -.. branch: no-class-specialize
    -
    -Some refactoring of class handling in the annotator. 
    -Remove class specialisation and _settled_ flag.
    +Fix the cpyext tests on OSX by linking with -flat_namespace
    diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
    --- a/pypy/interpreter/baseobjspace.py
    +++ b/pypy/interpreter/baseobjspace.py
    @@ -391,7 +391,7 @@
             self.check_signal_action = None   # changed by the signal module
             self.user_del_action = UserDelAction(self)
             self._code_of_sys_exc_info = None
    -
    +        
             # can be overridden to a subclass
             self.initialize()
     
    diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
    --- a/pypy/interpreter/pycode.py
    +++ b/pypy/interpreter/pycode.py
    @@ -50,6 +50,9 @@
         kwargname = varnames[argcount] if code.co_flags & CO_VARKEYWORDS else None
         return Signature(argnames, varargname, kwargname)
     
    +class CodeHookCache(object):
    +    def __init__(self, space):
    +        self._code_hook = None
     
     class PyCode(eval.Code):
         "CPython-style code objects."
    @@ -86,6 +89,15 @@
             self._signature = cpython_code_signature(self)
             self._initialize()
             self._init_ready()
    +        self.new_code_hook()
    +
    +    def new_code_hook(self):
    +        code_hook = self.space.fromcache(CodeHookCache)._code_hook
    +        if code_hook is not None:
    +            try:
    +                self.space.call_function(code_hook, self)
    +            except OperationError, e:
    +                e.write_unraisable(self.space, "new_code_hook()")
     
         def _initialize(self):
             if self.co_cellvars:
    diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
    --- a/pypy/module/__pypy__/__init__.py
    +++ b/pypy/module/__pypy__/__init__.py
    @@ -86,6 +86,7 @@
             'specialized_zip_2_lists'   : 'interp_magic.specialized_zip_2_lists',
             'set_debug'                 : 'interp_magic.set_debug',
             'locals_to_fast'            : 'interp_magic.locals_to_fast',
    +        'set_code_callback'         : 'interp_magic.set_code_callback',
             'save_module_content_for_future_reload':
                               'interp_magic.save_module_content_for_future_reload',
         }
    diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py
    --- a/pypy/module/__pypy__/interp_magic.py
    +++ b/pypy/module/__pypy__/interp_magic.py
    @@ -1,5 +1,6 @@
     from pypy.interpreter.error import OperationError, wrap_oserror
     from pypy.interpreter.gateway import unwrap_spec
    +from pypy.interpreter.pycode import CodeHookCache
     from pypy.interpreter.pyframe import PyFrame
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib.objectmodel import we_are_translated
    @@ -151,3 +152,10 @@
     def specialized_zip_2_lists(space, w_list1, w_list2):
         from pypy.objspace.std.specialisedtupleobject import specialized_zip_2_lists
         return specialized_zip_2_lists(space, w_list1, w_list2)
    +
    +def set_code_callback(space, w_callable):
    +    cache = space.fromcache(CodeHookCache)
    +    if space.is_none(w_callable):
    +        cache._code_hook = None
    +    else:
    +        cache._code_hook = w_callable
    \ No newline at end of file
    diff --git a/pypy/module/__pypy__/test/test_magic.py b/pypy/module/__pypy__/test/test_magic.py
    --- a/pypy/module/__pypy__/test/test_magic.py
    +++ b/pypy/module/__pypy__/test/test_magic.py
    @@ -13,3 +13,21 @@
             #
             sys.dont_write_bytecode = d
             __pypy__.save_module_content_for_future_reload(sys)
    +
    +    def test_new_code_hook(self):
    +        l = []
    +
    +        def callable(code):
    +            l.append(code)
    +
    +        import __pypy__
    +        __pypy__.set_code_callback(callable)
    +        d = {}
    +        try:
    +            exec """
    +def f():
    +    pass
    +""" in d
    +        finally:
    +            __pypy__.set_code_callback(None)
    +        assert d['f'].__code__ in l
    \ No newline at end of file
    diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
    --- a/pypy/module/_cffi_backend/__init__.py
    +++ b/pypy/module/_cffi_backend/__init__.py
    @@ -2,7 +2,7 @@
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib import rdynload, clibffi
     
    -VERSION = "1.3.0"
    +VERSION = "1.3.1"
     
     FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI
     try:
    diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
    --- a/pypy/module/_cffi_backend/ffi_obj.py
    +++ b/pypy/module/_cffi_backend/ffi_obj.py
    @@ -448,7 +448,7 @@
     
     'alloc' is called with the size as argument.  If it returns NULL, a
     MemoryError is raised.  'free' is called with the result of 'alloc'
    -as argument.  Both can be either Python function or directly C
    +as argument.  Both can be either Python functions or directly C
     functions.  If 'free' is None, then no free function is called.
     If both 'alloc' and 'free' are None, the default is used.
     
    diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c
    --- a/pypy/module/_cffi_backend/src/parse_c_type.c
    +++ b/pypy/module/_cffi_backend/src/parse_c_type.c
    @@ -4,6 +4,7 @@
     #include 
     
     #if defined(_MSC_VER)
    +# define MS_WIN32
     typedef size_t uintptr_t;
     #else
     # include 
    diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
    --- a/pypy/module/_cffi_backend/test/_backend_test_c.py
    +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
    @@ -1,7 +1,7 @@
     # ____________________________________________________________
     
     import sys
    -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version"
    +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version"
                                     " of cffi that differs from the one that we"
                                     " get from 'import _cffi_backend'")
     if sys.version_info < (3,):
    diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py
    --- a/pypy/module/_cffi_backend/test/test_recompiler.py
    +++ b/pypy/module/_cffi_backend/test/test_recompiler.py
    @@ -16,8 +16,8 @@
             from cffi import ffiplatform
         except ImportError:
             py.test.skip("system cffi module not found or older than 1.0.0")
    -    if cffi.__version_info__ < (1, 2, 0):
    -        py.test.skip("system cffi module needs to be at least 1.2.0")
    +    if cffi.__version_info__ < (1, 3, 0):
    +        py.test.skip("system cffi module needs to be at least 1.3.0")
         space.appexec([], """():
             import _cffi_backend     # force it to be initialized
         """)
    diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py
    --- a/pypy/module/_multiprocessing/interp_win32.py
    +++ b/pypy/module/_multiprocessing/interp_win32.py
    @@ -17,7 +17,7 @@
         NMPWAIT_WAIT_FOREVER
         ERROR_PIPE_CONNECTED ERROR_SEM_TIMEOUT ERROR_PIPE_BUSY
         ERROR_NO_SYSTEM_RESOURCES ERROR_BROKEN_PIPE ERROR_MORE_DATA
    -    ERROR_ALREADY_EXISTS
    +    ERROR_ALREADY_EXISTS ERROR_NO_DATA
     """.split()
     
     class CConfig:
    diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
    --- a/pypy/module/cpyext/include/patchlevel.h
    +++ b/pypy/module/cpyext/include/patchlevel.h
    @@ -29,7 +29,7 @@
     #define PY_VERSION		"2.7.10"
     
     /* PyPy version as a string */
    -#define PYPY_VERSION "4.0.1-alpha0"
    +#define PYPY_VERSION "4.1.0-alpha0"
     
     /* Subversion Revision number of this file (not of the repository).
      * Empty since Mercurial migration. */
    diff --git a/pypy/module/cpyext/pystrtod.py b/pypy/module/cpyext/pystrtod.py
    --- a/pypy/module/cpyext/pystrtod.py
    +++ b/pypy/module/cpyext/pystrtod.py
    @@ -5,10 +5,23 @@
     from rpython.rlib import rdtoa
     from rpython.rlib import rfloat
     from rpython.rlib import rposix, jit
    +from rpython.rlib.rarithmetic import intmask
     from rpython.rtyper.lltypesystem import lltype
     from rpython.rtyper.lltypesystem import rffi
     
     
    +# PyOS_double_to_string's "type", if non-NULL, will be set to one of:
    +Py_DTST_FINITE = 0
    +Py_DTST_INFINITE = 1
    +Py_DTST_NAN = 2
    +
    +# Match the "type" back to values in CPython
    +DOUBLE_TO_STRING_TYPES_MAP = {
    +    rfloat.DIST_FINITE: Py_DTST_FINITE,
    +    rfloat.DIST_INFINITY: Py_DTST_INFINITE,
    +    rfloat.DIST_NAN: Py_DTST_NAN
    +}
    +
     @cpython_api([rffi.CCHARP, rffi.CCHARPP, PyObject], rffi.DOUBLE, error=-1.0)
     @jit.dont_look_inside       # direct use of _get_errno()
     def PyOS_string_to_double(space, s, endptr, w_overflow_exception):
    @@ -68,3 +81,42 @@
         finally:
             if not user_endptr:
                 lltype.free(endptr, flavor='raw')
    +
    + at cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP)
    +def PyOS_double_to_string(space, val, format_code, precision, flags, ptype):
    +    """Convert a double val to a string using supplied
    +    format_code, precision, and flags.
    +
    +    format_code must be one of 'e', 'E', 'f', 'F',
    +    'g', 'G' or 'r'.  For 'r', the supplied precision
    +    must be 0 and is ignored.  The 'r' format code specifies the
    +    standard repr() format.
    +
    +    flags can be zero or more of the values Py_DTSF_SIGN,
    +    Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together:
    +
    +    Py_DTSF_SIGN means to always precede the returned string with a sign
    +    character, even if val is non-negative.
    +
    +    Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look
    +    like an integer.
    +
    +    Py_DTSF_ALT means to apply "alternate" formatting rules.  See the
    +    documentation for the PyOS_snprintf() '#' specifier for
    +    details.
    +
    +    If ptype is non-NULL, then the value it points to will be set to one of
    +    Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that
    +    val is a finite number, an infinite number, or not a number, respectively.
    +
    +    The return value is a pointer to buffer with the converted string or
    +    NULL if the conversion failed. The caller is responsible for freeing the
    +    returned string by calling PyMem_Free().
    +    """
    +    buffer, rtype = rfloat.double_to_string(val, format_code,
    +                                            intmask(precision),
    +                                            intmask(flags))
    +    if ptype != lltype.nullptr(rffi.INTP.TO):
    +        ptype[0] = rffi.cast(rffi.INT, DOUBLE_TO_STRING_TYPES_MAP[rtype])
    +    bufp = rffi.str2charp(buffer)
    +    return bufp
    diff --git a/pypy/module/cpyext/test/test_pystrtod.py b/pypy/module/cpyext/test/test_pystrtod.py
    --- a/pypy/module/cpyext/test/test_pystrtod.py
    +++ b/pypy/module/cpyext/test/test_pystrtod.py
    @@ -1,5 +1,6 @@
     import math
     
    +from pypy.module.cpyext import pystrtod
     from pypy.module.cpyext.test.test_api import BaseApiTest
     from rpython.rtyper.lltypesystem import rffi
     from rpython.rtyper.lltypesystem import lltype
    @@ -91,3 +92,76 @@
             api.PyErr_Clear()
             rffi.free_charp(s)
             lltype.free(endp, flavor='raw')
    +
    +
    +class TestPyOS_double_to_string(BaseApiTest):
    +
    +    def test_format_code(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(150.0, 'e', 1, 0, ptype)
    +        assert '1.5e+02' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_precision(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(3.14159269397, 'g', 5, 0, ptype)
    +        assert '3.1416' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_flags_sign(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(-3.14, 'g', 3, 1, ptype)
    +        assert '-3.14' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_flags_add_dot_0(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(3, 'g', 5, 2, ptype)
    +        assert '3.0' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_flags_alt(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(314., 'g', 3, 4, ptype)
    +        assert '314.' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_FINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_ptype_nan(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(float('nan'), 'g', 3, 4, ptype)
    +        assert 'nan' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_NAN == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_ptype_infinity(self, api):
    +        ptype = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
    +        r = api.PyOS_double_to_string(1e200 * 1e200, 'g', 0, 0, ptype)
    +        assert 'inf' == rffi.charp2str(r)
    +        type_value = rffi.cast(lltype.Signed, ptype[0])
    +        assert pystrtod.Py_DTST_INFINITE == type_value
    +        rffi.free_charp(r)
    +        lltype.free(ptype, flavor='raw')
    +
    +    def test_ptype_null(self, api):
    +        ptype = lltype.nullptr(rffi.INTP.TO)
    +        r = api.PyOS_double_to_string(3.14, 'g', 3, 0, ptype)
    +        assert '3.14' == rffi.charp2str(r)
    +        assert ptype == lltype.nullptr(rffi.INTP.TO)
    +        rffi.free_charp(r)
    \ No newline at end of file
    diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
    --- a/pypy/module/micronumpy/__init__.py
    +++ b/pypy/module/micronumpy/__init__.py
    @@ -34,6 +34,7 @@
             'nditer': 'nditer.W_NDIter',
     
             'set_docstring': 'support.descr_set_docstring',
    +        'VisibleDeprecationWarning': 'support.W_VisibleDeprecationWarning',
         }
         for c in ['MAXDIMS', 'CLIP', 'WRAP', 'RAISE']:
             interpleveldefs[c] = 'space.wrap(constants.%s)' % c
    @@ -42,6 +43,7 @@
             from pypy.module.micronumpy.concrete import _setup
             _setup()
     
    +
     class UMathModule(MixedModule):
         appleveldefs = {}
         interpleveldefs = {
    @@ -138,3 +140,9 @@
             'multiarray': MultiArrayModule,
             'umath': UMathModule,
         }
    +
    +    def setup_after_space_initialization(self):
    +        from pypy.module.micronumpy.support import W_VisibleDeprecationWarning
    +        for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items():
    +            setattr(self.space, 'w_' + name, self.space.gettypefor(w_type))
    +
    diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py
    --- a/pypy/module/micronumpy/base.py
    +++ b/pypy/module/micronumpy/base.py
    @@ -44,7 +44,7 @@
             from pypy.module.micronumpy.strides import calc_strides
             if len(shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(shape) * dtype.elsize)
             except OverflowError as e:
    @@ -69,7 +69,7 @@
             isize = dtype.elsize
             if len(shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 totalsize = ovfcheck(support.product_check(shape) * isize)
             except OverflowError as e:
    diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py
    --- a/pypy/module/micronumpy/boxes.py
    +++ b/pypy/module/micronumpy/boxes.py
    @@ -444,7 +444,7 @@
     
         @unwrap_spec(axis1=int, axis2=int)
         def descr_swapaxes(self, space, axis1, axis2):
    -        return self
    +        raise oefmt(space.w_ValueError, 'bad axis1 argument to swapaxes')
     
         def descr_fill(self, space, w_value):
             self.get_dtype(space).coerce(space, w_value)
    @@ -573,7 +573,7 @@
             try:
                 ofs, dtype = self.dtype.fields[item]
             except KeyError:
    -            raise oefmt(space.w_IndexError, "invalid index")
    +            raise oefmt(space.w_ValueError, "no field of name %s", item)
     
             from pypy.module.micronumpy.types import VoidType
             if isinstance(dtype.itemtype, VoidType):
    diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
    --- a/pypy/module/micronumpy/compile.py
    +++ b/pypy/module/micronumpy/compile.py
    @@ -65,6 +65,7 @@
         w_KeyError = W_TypeObject("KeyError")
         w_SystemExit = W_TypeObject("SystemExit")
         w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt")
    +    w_VisibleDeprecationWarning = W_TypeObject("VisibleDeprecationWarning")
         w_None = None
     
         w_bool = W_TypeObject("bool")
    @@ -402,6 +403,9 @@
             assert isinstance(w_check_class, W_TypeObject)
             return w_exc_type.name == w_check_class.name
     
    +    def warn(self, w_msg, w_warn_type):
    +        pass
    +
     class FloatObject(W_Root):
         tp = FakeSpace.w_float
         def __init__(self, floatval):
    diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
    --- a/pypy/module/micronumpy/concrete.py
    +++ b/pypy/module/micronumpy/concrete.py
    @@ -457,7 +457,7 @@
         def set_shape(self, space, orig_array, new_shape):
             if len(new_shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(new_shape) * self.dtype.elsize)
             except OverflowError as e:
    @@ -601,7 +601,7 @@
         def set_shape(self, space, orig_array, new_shape):
             if len(new_shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(new_shape) * self.dtype.elsize)
             except OverflowError as e:
    diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
    --- a/pypy/module/micronumpy/ctors.py
    +++ b/pypy/module/micronumpy/ctors.py
    @@ -18,7 +18,7 @@
             raise oefmt(space.w_TypeError,
                         "argument 1 must be numpy.dtype, not %T", w_dtype)
         if w_dtype.elsize == 0:
    -        raise oefmt(space.w_ValueError, "itemsize cannot be zero")
    +        raise oefmt(space.w_TypeError, "Empty data-type")
         if not space.isinstance_w(w_state, space.w_str):
             raise oefmt(space.w_TypeError, "initializing object must be a string")
         if space.len_w(w_state) != w_dtype.elsize:
    diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
    --- a/pypy/module/micronumpy/descriptor.py
    +++ b/pypy/module/micronumpy/descriptor.py
    @@ -217,6 +217,8 @@
                 endian = ignore
             if self.num == NPY.UNICODE:
                 size >>= 2
    +        if self.num == NPY.OBJECT:
    +            return "%s%s" %(endian, basic)
             return "%s%s%s" % (endian, basic, size)
     
         def descr_get_descr(self, space, style='descr', force_dict=False):
    @@ -485,7 +487,12 @@
     
         def descr_str(self, space):
             if self.fields:
    -            return space.str(self.descr_get_descr(space, style='str'))
    +            r = self.descr_get_descr(space, style='str')
    +            name = space.str_w(space.str(self.w_box_type))
    +            if name != "":
    +                boxname = space.str(self.w_box_type)
    +                r = space.newtuple([self.w_box_type, r])
    +            return space.str(r)
             elif self.subdtype is not None:
                 return space.str(space.newtuple([
                     self.subdtype.descr_get_str(space),
    @@ -497,8 +504,13 @@
                     return self.descr_get_name(space)
     
         def descr_repr(self, space):
    +        if isinstance(self.itemtype, types.CharType):
    +            return space.wrap("dtype('S1')")
             if self.fields:
                 r = self.descr_get_descr(space, style='repr')
    +            name = space.str_w(space.str(self.w_box_type))
    +            if name != "":
    +                r = space.newtuple([space.wrap(self.w_box_type), r])
             elif self.subdtype is not None:
                 r = space.newtuple([self.subdtype.descr_get_str(space),
                                     self.descr_get_shape(space)])
    @@ -942,7 +954,7 @@
         shape_w = space.fixedview(w_shape)
         if len(shape_w) < 1:
             return None
    -    elif len(shape_w) == 1 and space.isinstance_w(shape_w[0], space.w_tuple):
    +    elif space.isinstance_w(shape_w[0], space.w_tuple):
             # (base_dtype, new_dtype) dtype spectification
             return None
         shape = []
    @@ -997,12 +1009,16 @@
             if len(spec) > 0:
                 # this is (base_dtype, new_dtype) so just make it a union by setting both
                 # parts' offset to 0
    -            try:
    -                dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment)
    -            except:
    -                raise
    -            raise oefmt(space.w_NotImplementedError, 
    -                "(base_dtype, new_dtype) dtype spectification discouraged, not implemented")
    +            w_dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment)
    +            assert isinstance(w_dtype, W_Dtype)
    +            assert isinstance(w_dtype1, W_Dtype)
    +            if (w_dtype.elsize != 0 and w_dtype1.elsize != 0 and 
    +                    w_dtype1.elsize != w_dtype.elsize):
    +                raise oefmt(space.w_ValueError,
    +                    'mismatch in size of old and new data-descriptor')
    +            retval = W_Dtype(w_dtype.itemtype, w_dtype.w_box_type,
    +                    names=w_dtype1.names[:], fields=w_dtype1.fields.copy())
    +            return retval
         if space.is_none(w_dtype):
             return cache.w_float64dtype
         if space.isinstance_w(w_dtype, w_subtype):
    @@ -1032,19 +1048,22 @@
         elif space.isinstance_w(w_dtype, space.w_tuple):
             w_dtype0 = space.getitem(w_dtype, space.wrap(0))
             w_dtype1 = space.getitem(w_dtype, space.wrap(1))
    -        if space.isinstance_w(w_dtype0, space.w_type) and \
    -           space.isinstance_w(w_dtype1, space.w_list):
    -            #obscure api - (subclass, spec). Ignore the subclass
    -            return make_new_dtype(space, w_subtype, w_dtype1, alignment, 
    -                        copy=copy, w_shape=w_shape, w_metadata=w_metadata)
    -        subdtype = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy)
    -        assert isinstance(subdtype, W_Dtype)
    -        if subdtype.elsize == 0:
    -            name = "%s%d" % (subdtype.kind, space.int_w(w_dtype1))
    +        # create a new dtype object
    +        l_side = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy)
    +        assert isinstance(l_side, W_Dtype)
    +        if l_side.elsize == 0 and space.isinstance_w(w_dtype1, space.w_int):
    +            #(flexible_dtype, itemsize)
    +            name = "%s%d" % (l_side.kind, space.int_w(w_dtype1))
                 retval = make_new_dtype(space, w_subtype, space.wrap(name), alignment, copy)
    -        else:
    -            retval = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy, w_shape=w_dtype1)
    -        return _set_metadata_and_copy(space, w_metadata, retval, copy)
    +            return _set_metadata_and_copy(space, w_metadata, retval, copy)
    +        elif (space.isinstance_w(w_dtype1, space.w_int) or
    +                space.isinstance_w(w_dtype1, space.w_tuple) or 
    +                space.isinstance_w(w_dtype1, space.w_list) or 
    +                isinstance(w_dtype1, W_NDimArray)):
    +            #(fixed_dtype, shape) or (base_dtype, new_dtype)
    +            retval = make_new_dtype(space, w_subtype, l_side, alignment,
    +                                    copy, w_shape=w_dtype1)
    +            return _set_metadata_and_copy(space, w_metadata, retval, copy)
         elif space.isinstance_w(w_dtype, space.w_dict):
             return _set_metadata_and_copy(space, w_metadata,
                     dtype_from_dict(space, w_dtype, alignment), copy)
    @@ -1122,7 +1141,7 @@
                 size = int(name[1:])
             except ValueError:
                 raise oefmt(space.w_TypeError, "data type not understood")
    -    if char == NPY.CHARLTR:
    +    if char == NPY.CHARLTR and size == 0:
             return W_Dtype(
                 types.CharType(space),
                 elsize=1,
    @@ -1133,7 +1152,7 @@
             return new_unicode_dtype(space, size)
         elif char == NPY.VOIDLTR:
             return new_void_dtype(space, size)
    -    assert False
    +    raise oefmt(space.w_TypeError, 'data type "%s" not understood', name)
     
     
     def new_string_dtype(space, size):
    diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py
    --- a/pypy/module/micronumpy/loop.py
    +++ b/pypy/module/micronumpy/loop.py
    @@ -684,8 +684,9 @@
         arr_iter, arr_state = arr.create_iter()
         arr_dtype = arr.get_dtype()
         index_dtype = index.get_dtype()
    -    # XXX length of shape of index as well?
    -    while not index_iter.done(index_state):
    +    # support the deprecated form where arr([True]) will return arr[0, ...]
    +    # by iterating over res_iter, not index_iter
    +    while not res_iter.done(res_state):
             getitem_filter_driver.jit_merge_point(shapelen=shapelen,
                                                   index_dtype=index_dtype,
                                                   arr_dtype=arr_dtype,
    diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
    --- a/pypy/module/micronumpy/ndarray.py
    +++ b/pypy/module/micronumpy/ndarray.py
    @@ -75,7 +75,7 @@
             dtype = space.interp_w(descriptor.W_Dtype, space.call_function(
                 space.gettypefor(descriptor.W_Dtype), w_dtype))
             if (dtype.elsize != self.get_dtype().elsize or
    -                dtype.is_flexible() or self.get_dtype().is_flexible()):
    +                (not dtype.is_record() and self.get_dtype().is_flexible())):
                 raise OperationError(space.w_ValueError, space.wrap(
                     "new type not compatible with array."))
             self.implementation.set_dtype(space, dtype)
    @@ -116,6 +116,13 @@
                     "index out of range for array"))
             size = loop.count_all_true(arr)
             if arr.ndims() == 1:
    +            if self.ndims() > 1 and arr.get_shape()[0] != self.get_shape()[0]:
    +                msg = ("boolean index did not match indexed array along"
    +                      " dimension 0; dimension is %d but corresponding"
    +                      " boolean dimension is %d" % (self.get_shape()[0],
    +                      arr.get_shape()[0]))
    +                #warning = space.gettypefor(support.W_VisibleDeprecationWarning)
    +                space.warn(space.wrap(msg), space.w_VisibleDeprecationWarning)
                 res_shape = [size] + self.get_shape()[1:]
             else:
                 res_shape = [size]
    @@ -278,7 +285,7 @@
         def getfield(self, space, field):
             dtype = self.get_dtype()
             if field not in dtype.fields:
    -            raise oefmt(space.w_ValueError, "field named %s not found", field)
    +            raise oefmt(space.w_ValueError, "no field of name %s", field)
             arr = self.implementation
             ofs, subdtype = arr.dtype.fields[field][:2]
             # ofs only changes start
    @@ -489,10 +496,8 @@
             numpy.swapaxes : equivalent function
             """
             if axis1 == axis2:
    -            return self
    +            return self.descr_view(space)
             n = self.ndims()
    -        if n <= 1:
    -            return self
             if axis1 < 0:
                 axis1 += n
             if axis2 < 0:
    @@ -501,6 +506,8 @@
                 raise oefmt(space.w_ValueError, "bad axis1 argument to swapaxes")
             if axis2 < 0 or axis2 >= n:
                 raise oefmt(space.w_ValueError, "bad axis2 argument to swapaxes")
    +        if n <= 1:
    +            return self
             return self.implementation.swapaxes(space, self, axis1, axis2)
     
         def descr_nonzero(self, space):
    @@ -899,7 +906,7 @@
                         if cur_shape[i] != 1:
                             raise OperationError(space.w_ValueError, space.wrap(
                                 "cannot select an axis to squeeze out "
    -                            "which has size greater than one"))
    +                            "which has size not equal to one"))
                     else:
                         new_shape.append(cur_shape[i])
             else:
    @@ -1374,7 +1381,7 @@
         shape = shape_converter(space, w_shape, dtype)
         if len(shape) > NPY.MAXDIMS:
             raise oefmt(space.w_ValueError,
    -            "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +            "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
         if not space.is_none(w_buffer):
             if (not space.is_none(w_strides)):
                 strides = [space.int_w(w_i) for w_i in
    diff --git a/pypy/module/micronumpy/support.py b/pypy/module/micronumpy/support.py
    --- a/pypy/module/micronumpy/support.py
    +++ b/pypy/module/micronumpy/support.py
    @@ -8,6 +8,17 @@
     from pypy.objspace.std.typeobject import W_TypeObject
     from pypy.objspace.std.objspace import StdObjSpace
     from pypy.module.micronumpy import constants as NPY
    +from pypy.module.exceptions.interp_exceptions import _new_exception, W_UserWarning
    +
    +W_VisibleDeprecationWarning = _new_exception('VisibleDeprecationWarning', W_UserWarning,
    +    """Visible deprecation warning.
    +
    +    By default, python will not show deprecation warnings, so this class
    +    can be used when a very visible warning is helpful, for example because
    +    the usage is most likely a user bug.
    +
    +    """)
    +
     
     def issequence_w(space, w_obj):
         from pypy.module.micronumpy.base import W_NDimArray
    diff --git a/pypy/module/micronumpy/test/test_deprecations.py b/pypy/module/micronumpy/test/test_deprecations.py
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/micronumpy/test/test_deprecations.py
    @@ -0,0 +1,33 @@
    +import py
    +import sys
    +
    +from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
    +
    +
    +class AppTestDeprecations(BaseNumpyAppTest):
    +    spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
    +
    +    def test_getitem(self):
    +        import numpy as np
    +        import warnings, sys
    +        warnings.simplefilter('error', np.VisibleDeprecationWarning)
    +        try:
    +            arr = np.ones((5, 4, 3))
    +            index = np.array([True])
    +            raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +
    +            index = np.array([False] * 6)
    +            raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +
    +            index = np.zeros((4, 4), dtype=bool)
    +            if '__pypy__' in sys.builtin_module_names:
    +                # boolean indexing matches the dims in index
    +                # to the first index.ndims in arr, not implemented in pypy yet
    +                raises(IndexError, arr.__getitem__, index)
    +                raises(TypeError, arr.__getitem__, (slice(None), index))
    +            else:
    +                raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +                raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index))
    +        finally:
    +            warnings.simplefilter('default', np.VisibleDeprecationWarning)
    +
    diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
    --- a/pypy/module/micronumpy/test/test_dtypes.py
    +++ b/pypy/module/micronumpy/test/test_dtypes.py
    @@ -345,13 +345,22 @@
     
         def test_can_subclass(self):
             import numpy as np
    +        import sys
             class xyz(np.void):
                 pass
             assert np.dtype(xyz).name == 'xyz'
             # another obscure API, used in numpy record.py
    -        # it seems numpy throws away the subclass type and parses the spec
             a = np.dtype((xyz, [('x', 'int32'), ('y', 'float32')]))
    -        assert repr(a) == "dtype([('x', '
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r80813:3baa25ce21e8
    Date: 2015-11-21 08:28 +0100
    http://bitbucket.org/pypy/pypy/changeset/3baa25ce21e8/
    
    Log:	Follow-up for dfb609e46b95? I think there are reasons for always
    	returning an UnrolInfo() with extra_same_as instead of inventing an
    	empty list. I missed this 4th place... But this is even worse
    	because I can't design a test *and* I don't have a crash. (Issue
    	#2185 is around there but I think it might not be related.)
    
    diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py
    --- a/rpython/jit/metainterp/optimizeopt/unroll.py
    +++ b/rpython/jit/metainterp/optimizeopt/unroll.py
    @@ -180,7 +180,7 @@
     
             if not inline_short_preamble:
                 self.jump_to_preamble(celltoken, end_jump, info)
    -            return (UnrollInfo(target_token, label_op, [],
    +            return (UnrollInfo(target_token, label_op, extra_same_as,
                                    self.optimizer.quasi_immutable_deps),
                         self.optimizer._newoperations)            
     
    
    From noreply at buildbot.pypy.org  Sat Nov 21 06:08:26 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Sat, 21 Nov 2015 12:08:26 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: there is no distinction between
     native and standard float/double formats: the Python struct module requires
     that the format is ieee754 in both cases. However,
     in case our platform DOES support ieee754,
     we can directly convert the value from the memory. The very slow path
     defined in ieee.py is used only for obscure platforms which do not use
     native ieee754 floats, or in case we require a differend endianess
    Message-ID: <20151121110826.7BA841C12B2@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80814:8f216a415954
    Date: 2015-11-21 11:34 +0100
    http://bitbucket.org/pypy/pypy/changeset/8f216a415954/
    
    Log:	there is no distinction between native and standard float/double
    	formats: the Python struct module requires that the format is
    	ieee754 in both cases. However, in case our platform DOES support
    	ieee754, we can directly convert the value from the memory. The very
    	slow path defined in ieee.py is used only for obscure platforms
    	which do not use native ieee754 floats, or in case we require a
    	differend endianess
    
    diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py
    --- a/rpython/rlib/rstruct/nativefmttable.py
    +++ b/rpython/rlib/rstruct/nativefmttable.py
    @@ -8,8 +8,7 @@
     from rpython.rlib.objectmodel import specialize
     from rpython.rlib.rarithmetic import r_singlefloat, widen
     from rpython.rlib.rstruct import standardfmttable as std
    -from rpython.rlib.rstruct.standardfmttable import (native_is_bigendian, unpack_fastpath,
    -                                                   CannotUnpack)
    +from rpython.rlib.rstruct.standardfmttable import native_is_bigendian
     from rpython.rlib.rstruct.error import StructError
     from rpython.rlib.unroll import unrolling_iterable
     from rpython.rlib.strstorage import str_storage_getitem
    @@ -43,16 +42,6 @@
                 fmtiter.result.append(chr(value & 0xff))
                 value >>= 8
     
    - at specialize.argtype(0)
    -def unpack_double(fmtiter):
    -    try:
    -        doubleval = unpack_fastpath(rffi.DOUBLE)(fmtiter)
    -    except CannotUnpack:
    -        # slow path, take the slice
    -        input = fmtiter.read(sizeof_double)
    -        doubleval = str_storage_getitem(rffi.DOUBLE, input, 0)
    -    #
    -    fmtiter.appendobj(doubleval)
     
     def pack_float(fmtiter):
         doubleval = fmtiter.accept_float_arg()
    @@ -68,16 +57,6 @@
                 fmtiter.result.append(chr(value & 0xff))
                 value >>= 8
     
    - at specialize.argtype(0)
    -def unpack_float(fmtiter):
    -    try:
    -        floatval = unpack_fastpath(rffi.FLOAT)(fmtiter)
    -    except CannotUnpack:
    -        input = fmtiter.read(sizeof_float)
    -        floatval = str_storage_getitem(rffi.FLOAT, input, 0)
    -    doubleval = float(floatval) # convert from r_singlefloat to rpython's float
    -    fmtiter.appendobj(doubleval)
    -
     # ____________________________________________________________
     #
     # Use rffi_platform to get the native sizes and alignments from the C compiler
    @@ -134,10 +113,10 @@
     
             if fmtchar == 'f':
                 pack = pack_float
    -            unpack = unpack_float
    +            unpack = std.unpack_float
             elif fmtchar == 'd':
                 pack = pack_double
    -            unpack = unpack_double
    +            unpack = std.unpack_double
             elif fmtchar == '?':
                 pack = std.pack_bool
                 unpack = std.unpack_bool
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -17,6 +17,7 @@
     from rpython.rtyper.lltypesystem import rffi
     
     native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1)
    +native_is_ieee754 = float.__getformat__('double').startswith('IEEE')
     
     def pack_pad(fmtiter, count):
         fmtiter.result.append_multiple_char('\x00', count)
    @@ -175,12 +176,27 @@
             end = count
         fmtiter.appendobj(data[1:end])
     
    -def make_float_unpacker(size):
    +def make_ieee_unpacker(TYPE):
         @specialize.argtype(0)
    -    def unpacker(fmtiter):
    -        data = fmtiter.read(size)
    -        fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian))
    -    return unpacker
    +    def unpack_ieee(fmtiter):
    +        size = rffi.sizeof(TYPE)
    +        if fmtiter.bigendian != native_is_bigendian or not native_is_ieee754:
    +            # fallback to the very slow unpacking code in ieee.py
    +            data = fmtiter.read(size)
    +            fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian))
    +            return
    +        try:
    +            # fast path
    +            val = unpack_fastpath(TYPE)(fmtiter)
    +        except CannotUnpack:
    +            # slow path, take the slice
    +            input = fmtiter.read(size)
    +            val = str_storage_getitem(TYPE, input, 0)
    +        fmtiter.appendobj(float(val))
    +    return unpack_ieee
    +
    +unpack_double = make_ieee_unpacker(rffi.DOUBLE)
    +unpack_float = make_ieee_unpacker(rffi.FLOAT)
     
     # ____________________________________________________________
     
    @@ -267,9 +283,9 @@
         'p':{ 'size' : 1, 'pack' : pack_pascal, 'unpack' : unpack_pascal,
               'needcount' : True },
         'f':{ 'size' : 4, 'pack' : make_float_packer(4),
    -                    'unpack' : make_float_unpacker(4)},
    +                    'unpack' : unpack_float},
         'd':{ 'size' : 8, 'pack' : make_float_packer(8),
    -                    'unpack' : make_float_unpacker(8)},
    +                    'unpack' : unpack_double},
         '?':{ 'size' : 1, 'pack' : pack_bool, 'unpack' : unpack_bool},
         }
     
    
    From noreply at buildbot.pypy.org  Sat Nov 21 09:51:07 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Sat, 21 Nov 2015 15:51:07 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: hg merge
     default-at-the-latest-green-revision
    Message-ID: <20151121145107.1CF321C1248@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80815:a256226d8bce
    Date: 2015-11-21 15:48 +0100
    http://bitbucket.org/pypy/pypy/changeset/a256226d8bce/
    
    Log:	hg merge default-at-the-latest-green-revision
    
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -17,3 +17,4 @@
     295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
     f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
     850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
    +5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
    diff --git a/LICENSE b/LICENSE
    --- a/LICENSE
    +++ b/LICENSE
    @@ -56,14 +56,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -87,7 +88,6 @@
       Ludovic Aubry
       Jacob Hallen
       Jason Creighton
    -  Richard Plangger
       Alex Martelli
       Michal Bendowski
       stian
    @@ -200,9 +200,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -234,6 +237,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -244,6 +248,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -253,6 +258,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -283,6 +289,7 @@
       shoma hosaka
       Daniel Neuhäuser
       Ben Mather
    +  Niclas Olofsson
       halgari
       Boglarka Vezer
       Chris Pressey
    @@ -309,13 +316,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -327,6 +337,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
    --- a/lib_pypy/cffi.egg-info/PKG-INFO
    +++ b/lib_pypy/cffi.egg-info/PKG-INFO
    @@ -1,6 +1,6 @@
     Metadata-Version: 1.1
     Name: cffi
    -Version: 1.3.0
    +Version: 1.3.1
     Summary: Foreign Function Interface for Python calling C code.
     Home-page: http://cffi.readthedocs.org
     Author: Armin Rigo, Maciej Fijalkowski
    diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
    --- a/lib_pypy/cffi/__init__.py
    +++ b/lib_pypy/cffi/__init__.py
    @@ -4,8 +4,8 @@
     from .api import FFI, CDefError, FFIError
     from .ffiplatform import VerificationError, VerificationMissing
     
    -__version__ = "1.3.0"
    -__version_info__ = (1, 3, 0)
    +__version__ = "1.3.1"
    +__version_info__ = (1, 3, 1)
     
     # The verifier module file names are based on the CRC32 of a string that
     # contains the following version number.  It may be older than __version__
    diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py
    --- a/lib_pypy/cffi/cparser.py
    +++ b/lib_pypy/cffi/cparser.py
    @@ -62,7 +62,8 @@
             if csource.startswith('*', endpos):
                 parts.append('('); closing += ')'
             level = 0
    -        for i in xrange(endpos, len(csource)):
    +        i = endpos
    +        while i < len(csource):
                 c = csource[i]
                 if c == '(':
                     level += 1
    @@ -73,6 +74,7 @@
                 elif c in ',;=':
                     if level == 0:
                         break
    +            i += 1
             csource = csource[endpos:i] + closing + csource[i:]
             #print repr(''.join(parts)+csource)
         parts.append(csource)
    diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py
    --- a/lib_pypy/cffi/model.py
    +++ b/lib_pypy/cffi/model.py
    @@ -514,12 +514,17 @@
             if self.baseinttype is not None:
                 return self.baseinttype.get_cached_btype(ffi, finishlist)
             #
    +        from . import api
             if self.enumvalues:
                 smallest_value = min(self.enumvalues)
                 largest_value = max(self.enumvalues)
             else:
    -            smallest_value = 0
    -            largest_value = 0
    +            import warnings
    +            warnings.warn("%r has no values explicitly defined; next version "
    +                          "will refuse to guess which integer type it is "
    +                          "meant to be (unsigned/signed, int/long)"
    +                          % self._get_c_name())
    +            smallest_value = largest_value = 0
             if smallest_value < 0:   # needs a signed type
                 sign = 1
                 candidate1 = PrimitiveType("int")
    diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
    --- a/pypy/doc/contributor.rst
    +++ b/pypy/doc/contributor.rst
    @@ -26,15 +26,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    -  Richard Plangger
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -170,9 +170,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -204,6 +207,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -214,6 +218,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -223,6 +228,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -280,13 +286,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -298,6 +307,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst
    --- a/pypy/doc/index-of-release-notes.rst
    +++ b/pypy/doc/index-of-release-notes.rst
    @@ -6,6 +6,7 @@
     
     .. toctree::
     
    +   release-4.0.1.rst
        release-4.0.0.rst
        release-2.6.1.rst
        release-2.6.0.rst
    diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst
    --- a/pypy/doc/index-of-whatsnew.rst
    +++ b/pypy/doc/index-of-whatsnew.rst
    @@ -7,6 +7,7 @@
     .. toctree::
     
        whatsnew-head.rst
    +   whatsnew-4.0.1.rst
        whatsnew-4.0.0.rst
        whatsnew-2.6.1.rst
        whatsnew-2.6.0.rst
    diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/release-4.0.1.rst
    @@ -0,0 +1,106 @@
    +==========
    +PyPy 4.0.1
    +==========
    +
    +We have released PyPy 4.0.1, three weeks after PyPy 4.0.0. We have fixed
    +a few critical bugs in the JIT compiled code, reported by users. We therefore
    +encourage all users of PyPy to update to this version. There are a few minor
    +enhancements in this version as well.
    +
    +You can download the PyPy 4.0.1 release here:
    +
    +    http://pypy.org/download.html
    +
    +We would like to thank our donors for the continued support of the PyPy
    +project.
    +
    +We would also like to thank our contributors and 
    +encourage new people to join the project. PyPy has many
    +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation
    +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ 
    +with making RPython's JIT even better. 
    +
    +CFFI
    +====
    +
    +While not applicable only to PyPy, `cffi`_ is arguably our most significant
    +contribution to the python ecosystem. PyPy 4.0.1 ships with 
    +`cffi-1.3.1`_ with the improvements it brings.
    +
    +.. _`PyPy`: http://doc.pypy.org 
    +.. _`RPython`: https://rpython.readthedocs.org
    +.. _`cffi`: https://cffi.readthedocs.org
    +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1
    +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly
    +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html
    +.. _`numpy`: https://bitbucket.org/pypy/numpy
    +
    +What is PyPy?
    +=============
    +
    +PyPy is a very compliant Python interpreter, almost a drop-in replacement for
    +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison)
    +due to its integrated tracing JIT compiler.
    +
    +We also welcome developers of other
    +`dynamic languages`_ to see what RPython can do for them.
    +
    +This release supports **x86** machines on most common operating systems
    +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd),
    +newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the
    +big- and little-endian variants of **ppc64** running Linux.
    +
    +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org
    +.. _`dynamic languages`: http://pypyjs.org
    +
    +Other Highlights (since 4.0.0 released three weeks ago)
    +=======================================================
    +
    +* Bug Fixes
    +
    +  * Fix a bug when unrolling double loops in JITted code
    +
    +  * Fix multiple memory leaks in the ssl module, one of which affected
    +    `cpython` as well (thanks to Alex Gaynor for pointing those out)
    +
    +  * Use pkg-config to find ssl headers on OS-X
    +
    +  * Issues reported with our previous release were resolved_ after reports from users on
    +    our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
    +    #pypy
    +
    +* New features:
    +
    +  * Internal cleanup of RPython class handling
    +
    +  * Support stackless and greenlets on PPC machines
    +
    +  * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d
    +    for example to have all subprocesses write the JIT log to a file
    +    called 'log.%d', with '%d' replaced with the subprocess' PID.
    +
    +  * Support PyOS_double_to_string in our cpyext capi compatibility layer
    +
    +* Numpy:
    +
    +  * Improve support for __array_interface__
    +
    +  * Propagate NAN mantissas through float16-float32-float64 conversions
    +
    +
    +* Performance improvements and refactorings:
    +
    +  * Improvements in slicing byte arrays
    +
    +  * Improvements in enumerate()
    +
    +  * Silence some warnings while translating
    +
    +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html
    +
    +Please update, and continue to help us make PyPy better.
    +
    +Cheers
    +
    +The PyPy Team
    +
    diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
    --- a/pypy/doc/tool/makecontributor.py
    +++ b/pypy/doc/tool/makecontributor.py
    @@ -69,7 +69,9 @@
         'Rami Chowdhury': ['necaris'],
         'Stanislaw Halik':['w31rd0'],
         'Wenzhu Man':['wenzhu man', 'wenzhuman'],
    -    'Anton Gulenko':['anton gulenko'],
    +    'Anton Gulenko':['anton gulenko', 'anton_gulenko'],
    +    'Richard Lancaster':['richardlancaster'],
    +    'William Leslie':['William ML Leslie'],
         }
     
     alias_map = {}
    diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/whatsnew-4.0.1.rst
    @@ -0,0 +1,35 @@
    +=========================
    +What's new in PyPy 4.0.1
    +=========================
    +
    +.. this is a revision shortly after release-4.0.0
    +.. startrev: 57c9a47c70f6
    +
    +.. branch: 2174-fix-osx-10-11-translation
    +
    +Use pkg-config to find ssl headers on OS-X
    +
    +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    +
    +.. branch: ppc-stacklet
    +
    +The PPC machines now support the _continuation module (stackless, greenlets)
    +
    +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227
    +
    +Document that libgdbm-dev is required for translation/packaging
    +
    +.. branch: propogate-nans
    +
    +Ensure that ndarray conversion from int16->float16->float32->float16->int16
    +preserves all int16 values, even across nan conversions. Also fix argmax, argmin
    +for nan comparisons
    +
    +.. branch: array_interface
    +
    +Support common use-cases for __array_interface__, passes upstream tests
    +
    +.. branch: no-class-specialize
    +
    +Some refactoring of class handling in the annotator. 
    +Remove class specialisation and _settled_ flag.
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -2,34 +2,6 @@
     What's new in PyPy 4.0.+
     =========================
     
    -.. this is a revision shortly after release-4.0.0
    -.. startrev: 57c9a47c70f6
    +.. this is a revision shortly after release-4.0.1
    +.. startrev: 4b5c840d0da2
     
    -.. branch: 2174-fix-osx-10-11-translation
    -
    -Use pkg-config to find ssl headers on OS-X
    -
    -.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    -
    -.. branch: ppc-stacklet
    -
    -The PPC machines now support the _continuation module (stackless, greenlets)
    -
    -.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227
    -
    -Document that libgdbm-dev is required for translation/packaging
    -
    -.. branch: propogate-nans
    -
    -Ensure that ndarray conversion from int16->float16->float32->float16->int16
    -preserves all int16 values, even across nan conversions. Also fix argmax, argmin
    -for nan comparisons
    -
    -.. branch: array_interface
    -
    -Support common use-cases for __array_interface__, passes upstream tests
    -
    -.. branch: no-class-specialize
    -
    -Some refactoring of class handling in the annotator. 
    -Remove class specialisation and _settled_ flag.
    diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
    --- a/pypy/interpreter/baseobjspace.py
    +++ b/pypy/interpreter/baseobjspace.py
    @@ -391,7 +391,7 @@
             self.check_signal_action = None   # changed by the signal module
             self.user_del_action = UserDelAction(self)
             self._code_of_sys_exc_info = None
    -
    +        
             # can be overridden to a subclass
             self.initialize()
     
    diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
    --- a/pypy/interpreter/pycode.py
    +++ b/pypy/interpreter/pycode.py
    @@ -50,6 +50,9 @@
         kwargname = varnames[argcount] if code.co_flags & CO_VARKEYWORDS else None
         return Signature(argnames, varargname, kwargname)
     
    +class CodeHookCache(object):
    +    def __init__(self, space):
    +        self._code_hook = None
     
     class PyCode(eval.Code):
         "CPython-style code objects."
    @@ -86,6 +89,15 @@
             self._signature = cpython_code_signature(self)
             self._initialize()
             self._init_ready()
    +        self.new_code_hook()
    +
    +    def new_code_hook(self):
    +        code_hook = self.space.fromcache(CodeHookCache)._code_hook
    +        if code_hook is not None:
    +            try:
    +                self.space.call_function(code_hook, self)
    +            except OperationError, e:
    +                e.write_unraisable(self.space, "new_code_hook()")
     
         def _initialize(self):
             if self.co_cellvars:
    diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
    --- a/pypy/module/__pypy__/__init__.py
    +++ b/pypy/module/__pypy__/__init__.py
    @@ -86,6 +86,7 @@
             'specialized_zip_2_lists'   : 'interp_magic.specialized_zip_2_lists',
             'set_debug'                 : 'interp_magic.set_debug',
             'locals_to_fast'            : 'interp_magic.locals_to_fast',
    +        'set_code_callback'         : 'interp_magic.set_code_callback',
             'save_module_content_for_future_reload':
                               'interp_magic.save_module_content_for_future_reload',
         }
    diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py
    --- a/pypy/module/__pypy__/interp_magic.py
    +++ b/pypy/module/__pypy__/interp_magic.py
    @@ -1,5 +1,6 @@
     from pypy.interpreter.error import OperationError, wrap_oserror
     from pypy.interpreter.gateway import unwrap_spec
    +from pypy.interpreter.pycode import CodeHookCache
     from pypy.interpreter.pyframe import PyFrame
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib.objectmodel import we_are_translated
    @@ -151,3 +152,10 @@
     def specialized_zip_2_lists(space, w_list1, w_list2):
         from pypy.objspace.std.specialisedtupleobject import specialized_zip_2_lists
         return specialized_zip_2_lists(space, w_list1, w_list2)
    +
    +def set_code_callback(space, w_callable):
    +    cache = space.fromcache(CodeHookCache)
    +    if space.is_none(w_callable):
    +        cache._code_hook = None
    +    else:
    +        cache._code_hook = w_callable
    \ No newline at end of file
    diff --git a/pypy/module/__pypy__/test/test_magic.py b/pypy/module/__pypy__/test/test_magic.py
    --- a/pypy/module/__pypy__/test/test_magic.py
    +++ b/pypy/module/__pypy__/test/test_magic.py
    @@ -13,3 +13,21 @@
             #
             sys.dont_write_bytecode = d
             __pypy__.save_module_content_for_future_reload(sys)
    +
    +    def test_new_code_hook(self):
    +        l = []
    +
    +        def callable(code):
    +            l.append(code)
    +
    +        import __pypy__
    +        __pypy__.set_code_callback(callable)
    +        d = {}
    +        try:
    +            exec """
    +def f():
    +    pass
    +""" in d
    +        finally:
    +            __pypy__.set_code_callback(None)
    +        assert d['f'].__code__ in l
    \ No newline at end of file
    diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
    --- a/pypy/module/_cffi_backend/__init__.py
    +++ b/pypy/module/_cffi_backend/__init__.py
    @@ -2,7 +2,7 @@
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib import rdynload, clibffi
     
    -VERSION = "1.3.0"
    +VERSION = "1.3.1"
     
     FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI
     try:
    diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
    --- a/pypy/module/_cffi_backend/ffi_obj.py
    +++ b/pypy/module/_cffi_backend/ffi_obj.py
    @@ -448,7 +448,7 @@
     
     'alloc' is called with the size as argument.  If it returns NULL, a
     MemoryError is raised.  'free' is called with the result of 'alloc'
    -as argument.  Both can be either Python function or directly C
    +as argument.  Both can be either Python functions or directly C
     functions.  If 'free' is None, then no free function is called.
     If both 'alloc' and 'free' are None, the default is used.
     
    diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c
    --- a/pypy/module/_cffi_backend/src/parse_c_type.c
    +++ b/pypy/module/_cffi_backend/src/parse_c_type.c
    @@ -4,6 +4,7 @@
     #include 
     
     #if defined(_MSC_VER)
    +# define MS_WIN32
     typedef size_t uintptr_t;
     #else
     # include 
    diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
    --- a/pypy/module/_cffi_backend/test/_backend_test_c.py
    +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
    @@ -1,7 +1,7 @@
     # ____________________________________________________________
     
     import sys
    -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version"
    +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version"
                                     " of cffi that differs from the one that we"
                                     " get from 'import _cffi_backend'")
     if sys.version_info < (3,):
    diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py
    --- a/pypy/module/_cffi_backend/test/test_recompiler.py
    +++ b/pypy/module/_cffi_backend/test/test_recompiler.py
    @@ -16,8 +16,8 @@
             from cffi import ffiplatform
         except ImportError:
             py.test.skip("system cffi module not found or older than 1.0.0")
    -    if cffi.__version_info__ < (1, 2, 0):
    -        py.test.skip("system cffi module needs to be at least 1.2.0")
    +    if cffi.__version_info__ < (1, 3, 0):
    +        py.test.skip("system cffi module needs to be at least 1.3.0")
         space.appexec([], """():
             import _cffi_backend     # force it to be initialized
         """)
    diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py
    --- a/pypy/module/micronumpy/loop.py
    +++ b/pypy/module/micronumpy/loop.py
    @@ -684,8 +684,9 @@
         arr_iter, arr_state = arr.create_iter()
         arr_dtype = arr.get_dtype()
         index_dtype = index.get_dtype()
    -    # XXX length of shape of index as well?
    -    while not index_iter.done(index_state):
    +    # support the deprecated form where arr([True]) will return arr[0, ...]
    +    # by iterating over res_iter, not index_iter
    +    while not res_iter.done(res_state):
             getitem_filter_driver.jit_merge_point(shapelen=shapelen,
                                                   index_dtype=index_dtype,
                                                   arr_dtype=arr_dtype,
    diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
    --- a/pypy/module/micronumpy/test/test_ndarray.py
    +++ b/pypy/module/micronumpy/test/test_ndarray.py
    @@ -2238,6 +2238,9 @@
             c = array([True,False,True],bool)
             b = a[c]
             assert (a[c] == [[1, 2, 3], [7, 8, 9]]).all()
    +        c = array([True])
    +        b = a[c]
    +        assert b.shape == (1, 3)
     
         def test_bool_array_index_setitem(self):
             from numpy import arange, array
    diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py
    --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py
    +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py
    @@ -1336,7 +1336,8 @@
             # these depend on user-defined data, so should not be shared
             assert ffi1.typeof("struct foo") is not ffi2.typeof("struct foo")
             assert ffi1.typeof("union foo *") is not ffi2.typeof("union foo*")
    -        assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo")
    +        # the following test is an opaque enum, which we no longer support
    +        #assert ffi1.typeof("enum foo") is not ffi2.typeof("enum foo")
             # sanity check: twice 'ffi1'
             assert ffi1.typeof("struct foo*") is ffi1.typeof("struct foo *")
     
    @@ -1348,6 +1349,17 @@
             assert ffi.getctype("pe") == 'e *'
             assert ffi.getctype("e1*") == 'e1 *'
     
    +    def test_opaque_enum(self):
    +        ffi = FFI(backend=self.Backend())
    +        ffi.cdef("enum foo;")
    +        from cffi import __version_info__
    +        if __version_info__ < (1, 4):
    +            py.test.skip("re-enable me in version 1.4")
    +        e = py.test.raises(CDefError, ffi.cast, "enum foo", -1)
    +        assert str(e.value) == (
    +            "'enum foo' has no values explicitly defined: refusing to guess "
    +            "which integer type it is meant to be (unsigned/signed, int/long)")
    +
         def test_new_ctype(self):
             ffi = FFI(backend=self.Backend())
             p = ffi.new("int *")
    diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py
    @@ -0,0 +1,35 @@
    +# Generated by pypy/tool/import_cffi.py
    +import py, os, cffi, re
    +import _cffi_backend
    +
    +
    +def getlines():
    +    try:
    +        f = open(os.path.join(os.path.dirname(cffi.__file__),
    +                              '..', 'c', 'commontypes.c'))
    +    except IOError:
    +        py.test.skip("cannot find ../c/commontypes.c")
    +    lines = [line for line in f.readlines() if line.strip().startswith('EQ(')]
    +    f.close()
    +    return lines
    +
    +def test_alphabetical_order():
    +    lines = getlines()
    +    assert lines == sorted(lines)
    +
    +def test_dependencies():
    +    r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?')
    +    lines = getlines()
    +    d = {}
    +    for line in lines:
    +        match = r.search(line)
    +        if match is not None:
    +            d[match.group(1)] = match.group(2)
    +    for value in d.values():
    +        if value:
    +            assert value in d
    +
    +def test_get_common_types():
    +    d = {}
    +    _cffi_backend._get_common_types(d)
    +    assert d["bool"] == "_Bool"
    diff --git a/pypy/objspace/std/test/test_tupleobject.py b/pypy/objspace/std/test/test_tupleobject.py
    --- a/pypy/objspace/std/test/test_tupleobject.py
    +++ b/pypy/objspace/std/test/test_tupleobject.py
    @@ -413,8 +413,9 @@
                 from __pypy__ import specialized_zip_2_lists
             except ImportError:
                 specialized_zip_2_lists = zip
    -        raises(TypeError, specialized_zip_2_lists, [], ())
    -        raises(TypeError, specialized_zip_2_lists, (), [])
    +        else:
    +            raises(TypeError, specialized_zip_2_lists, [], ())
    +            raises(TypeError, specialized_zip_2_lists, (), [])
             assert specialized_zip_2_lists([], []) == [
                 ]
             assert specialized_zip_2_lists([2, 3], []) == [
    diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py
    --- a/rpython/rtyper/lltypesystem/lltype.py
    +++ b/rpython/rtyper/lltypesystem/lltype.py
    @@ -1469,7 +1469,10 @@
             result = intmask(obj._getid())
             # assume that id() returns an addressish value which is
             # not zero and aligned to at least a multiple of 4
    -        assert result != 0 and (result & 3) == 0
    +        # (at least for GC pointers; we can't really assume anything
    +        # for raw addresses)
    +        if self._T._gckind == 'gc':
    +            assert result != 0 and (result & 3) == 0
             return result
     
         def _cast_to_adr(self):
    diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c
    --- a/rpython/translator/c/src/debug_print.c
    +++ b/rpython/translator/c/src/debug_print.c
    @@ -23,13 +23,14 @@
     static char *debug_start_colors_2 = "";
     static char *debug_stop_colors = "";
     static char *debug_prefix = NULL;
    -static char *debug_filename = NULL;
    -static char *debug_filename_with_fork = NULL;
     
    -static void _pypy_debug_open(char *filename)
    +static void pypy_debug_open(void)
     {
    +  char *filename = getenv("PYPYLOG");
    +
       if (filename && filename[0])
         {
    +      char *newfilename = NULL, *escape;
           char *colon = strchr(filename, ':');
           if (filename[0] == '+')
             {
    @@ -51,11 +52,38 @@
               debug_prefix[n] = '\0';
               filename = colon + 1;
             }
    +      escape = strstr(filename, "%d");
    +      if (escape)  /* a "%d" in the filename is replaced with the pid */
    +        {
    +          newfilename = malloc(strlen(filename) + 32);
    +          if (newfilename != NULL)
    +            {
    +              char *p = newfilename;
    +              memcpy(p, filename, escape - filename);
    +              p += escape - filename;
    +              sprintf(p, "%ld", (long)getpid());
    +              strcat(p, escape + 2);
    +              filename = newfilename;
    +            }
    +        }
           if (strcmp(filename, "-") != 0)
             {
    -          debug_filename = strdup(filename);
               pypy_debug_file = fopen(filename, "w");
             }
    +
    +      if (escape)
    +        {
    +          free(newfilename);   /* if not null */
    +          /* the env var is kept and passed to subprocesses */
    +        }
    +      else
    +        {
    +#ifndef _WIN32
    +          unsetenv("PYPYLOG");
    +#else
    +          putenv("PYPYLOG=");
    +#endif
    +        }
         }
       if (!pypy_debug_file)
         {
    @@ -67,27 +95,21 @@
               debug_stop_colors = "\033[0m";
             }
         }
    -  if (filename)
    -#ifndef _WIN32
    -    unsetenv("PYPYLOG");   /* don't pass it to subprocesses */
    -#else
    -    putenv("PYPYLOG=");    /* don't pass it to subprocesses */
    -#endif
       debug_ready = 1;
     }
     
    -static void pypy_debug_open(void)
    -{
    -    _pypy_debug_open(getenv("PYPYLOG"));
    -}
    -
     long pypy_debug_offset(void)
     {
       if (!debug_ready)
         return -1;
    +  /* The following fflush() makes sure everything is written now, which
    +     is just before a fork().  So we can fork() and close the file in
    +     the subprocess without ending up with the content of the buffer
    +     written twice. */
    +  fflush(pypy_debug_file);
    +
       // note that we deliberately ignore errno, since -1 is fine
       // in case this is not a real file
    -  fflush(pypy_debug_file);
       return ftell(pypy_debug_file);
     }
     
    @@ -99,21 +121,20 @@
     
     void pypy_debug_forked(long original_offset)
     {
    -  if (debug_filename != NULL)
    +  /* 'original_offset' ignored.  It used to be that the forked log
    +     files started with this offset printed out, so that we can
    +     rebuild the tree structure.  That's overkill... */
    +  (void)original_offset;
    +
    +  if (pypy_debug_file)
         {
    -      char *filename = malloc(strlen(debug_filename) + 32);
    -      fclose(pypy_debug_file);
    +      if (pypy_debug_file != stderr)
    +        fclose(pypy_debug_file);
           pypy_debug_file = NULL;
    -      if (filename == NULL)
    -        return;   /* bah */
    -      sprintf(filename, "%s.fork%ld", debug_filename, (long)getpid());
    -      pypy_debug_file = fopen(filename, "w");
    -      if (pypy_debug_file)
    -        fprintf(pypy_debug_file, "FORKED: %ld %s\n", original_offset,
    -                debug_filename_with_fork ? debug_filename_with_fork
    -                                         : debug_filename);
    -      free(debug_filename_with_fork);
    -      debug_filename_with_fork = filename;
    +      /* if PYPYLOG was set to a name with "%d" in it, it is still
    +         alive, and will be reopened with the new subprocess' pid as
    +         soon as it logs anything */
    +      debug_ready = 0;
         }
     }
     
    diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h
    --- a/rpython/translator/c/src/debug_print.h
    +++ b/rpython/translator/c/src/debug_print.h
    @@ -21,6 +21,10 @@
        subsections.
     
        Note that 'fname' can be '-' to send the logging data to stderr.
    +   If 'fname' includes the substring '%d' it is replaced with the
    +   current process id and you get the log for all subprocesses (and
    +   forks) in different files.  If 'fname' does not include '%d', it is
    +   removed from the environment and not passed to subprocesses.
     */
     
     /* macros used by the generated code */
    diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
    --- a/rpython/translator/c/test/test_standalone.py
    +++ b/rpython/translator/c/test/test_standalone.py
    @@ -531,6 +531,7 @@
                 py.test.skip("requires fork()")
     
             def entry_point(argv):
    +            print "parentpid =", os.getpid()
                 debug_start("foo")
                 debug_print("test line")
                 childpid = os.fork()
    @@ -543,40 +544,46 @@
             t, cbuilder = self.compile(entry_point)
             path = udir.join('test_debug_print_fork.log')
             out, err = cbuilder.cmdexec("", err=True,
    -                                    env={'PYPYLOG': ':%s' % path})
    +                                    env={'PYPYLOG': ':%s.%%d' % path})
             assert not err
    +        import time
    +        time.sleep(0.5)    # time for the forked children to finish
             #
    -        f = open(str(path), 'r')
    +        lines = out.splitlines()
    +        assert lines[-1].startswith('parentpid = ')
    +        parentpid = int(lines[-1][12:])
    +        #
    +        f = open('%s.%d' % (path, parentpid), 'r')
             lines = f.readlines()
             f.close()
             assert '{foo' in lines[0]
             assert lines[1] == "test line\n"
    -        offset1 = len(lines[0]) + len(lines[1])
    +        #offset1 = len(lines[0]) + len(lines[1])
             assert lines[2].startswith('childpid = ')
             childpid = int(lines[2][11:])
             assert childpid != 0
             assert 'foo}' in lines[3]
             assert len(lines) == 4
             #
    -        f = open('%s.fork%d' % (path, childpid), 'r')
    +        f = open('%s.%d' % (path, childpid), 'r')
             lines = f.readlines()
             f.close()
    -        assert lines[0] == 'FORKED: %d %s\n' % (offset1, path)
    -        assert lines[1] == 'childpid = 0\n'
    -        offset2 = len(lines[0]) + len(lines[1])
    -        assert lines[2].startswith('childpid2 = ')
    -        childpid2 = int(lines[2][11:])
    +        #assert lines[0] == 'FORKED: %d %s\n' % (offset1, path)
    +        assert lines[0] == 'childpid = 0\n'
    +        #offset2 = len(lines[0]) + len(lines[1])
    +        assert lines[1].startswith('childpid2 = ')
    +        childpid2 = int(lines[1][11:])
             assert childpid2 != 0
    -        assert 'foo}' in lines[3]
    -        assert len(lines) == 4
    +        assert 'foo}' in lines[2]
    +        assert len(lines) == 3
             #
    -        f = open('%s.fork%d' % (path, childpid2), 'r')
    +        f = open('%s.%d' % (path, childpid2), 'r')
             lines = f.readlines()
             f.close()
    -        assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid)
    -        assert lines[1] == 'childpid2 = 0\n'
    -        assert 'foo}' in lines[2]
    -        assert len(lines) == 3
    +        #assert lines[0] == 'FORKED: %d %s.fork%d\n' % (offset2, path, childpid)
    +        assert lines[0] == 'childpid2 = 0\n'
    +        assert 'foo}' in lines[1]
    +        assert len(lines) == 2
     
         def test_debug_flush_at_exit(self):
             def entry_point(argv):
    diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
    --- a/rpython/translator/driver.py
    +++ b/rpython/translator/driver.py
    @@ -502,7 +502,6 @@
                             shutil.copyfile(str(name), str(newname.new(ext=ext)))
                             self.log.info("copied: %s" % (newname,))
                 self.c_entryp = newexename
    -        self.log.info('usession directory: %s' % (udir,))
             self.log.info("created: %s" % (self.c_entryp,))
     
         @taskdef(['source_c'], "Compiling c source")
    @@ -548,7 +547,9 @@
                 goals = [goals]
             goals.extend(self.extra_goals)
             goals = self.backend_select_goals(goals)
    -        return self._execute(goals, task_skip = self._maybe_skip())
    +        result = self._execute(goals, task_skip = self._maybe_skip())
    +        self.log.info('usession directory: %s' % (udir,))
    +        return result
     
         @staticmethod
         def from_targetspec(targetspec_dic, config=None, args=None,
    diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py
    --- a/rpython/translator/platform/posix.py
    +++ b/rpython/translator/platform/posix.py
    @@ -138,6 +138,13 @@
                 rel = lpath.relto(rpypath)
                 if rel:
                     return os.path.join('$(RPYDIR)', rel)
    +            # Hack: also relativize from the path '$RPYDIR/..'.
    +            # Otherwise, when translating pypy, we get the paths in
    +            # pypy/module/* that are kept as absolute, which makes the
    +            # whole purpose of $RPYDIR rather pointless.
    +            rel = lpath.relto(rpypath.join('..'))
    +            if rel:
    +                return os.path.join('$(RPYDIR)', '..', rel)
                 m_dir = m.makefile_dir
                 if m_dir == lpath:
                     return '.'
    
    From noreply at buildbot.pypy.org  Sat Nov 21 09:51:09 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Sat, 21 Nov 2015 15:51:09 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: blindly try to make this test
     passing on big-endian machines
    Message-ID: <20151121145109.4A10C1C1248@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80816:8846f2974ae5
    Date: 2015-11-21 15:51 +0100
    http://bitbucket.org/pypy/pypy/changeset/8846f2974ae5/
    
    Log:	blindly try to make this test passing on big-endian machines
    
    diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py
    --- a/rpython/jit/metainterp/test/test_strstorage.py
    +++ b/rpython/jit/metainterp/test/test_strstorage.py
    @@ -1,4 +1,5 @@
     import py
    +import sys
     import struct
     from rpython.rtyper.lltypesystem import lltype, rffi
     from rpython.rlib.strstorage import str_storage_getitem
    @@ -30,9 +31,13 @@
     
     
         def test_force_virtual_str_storage(self):
    +        byteorder = sys.byteorder
             size = rffi.sizeof(lltype.Signed)
             def f(val):
    -            x = chr(val) + '\x00'*(size-1)
    +            if byteorder == 'little':
    +                x = chr(val) + '\x00'*(size-1)
    +            else:
    +                x = '\x00'*(size-1) + chr(val)
                 return str_storage_getitem(lltype.Signed, x, 0)
             res = self.interp_operations(f, [42], supports_singlefloats=True)
             assert res == 42
    
    From noreply at buildbot.pypy.org  Sat Nov 21 11:38:32 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sat, 21 Nov 2015 17:38:32 +0100 (CET)
    Subject: [pypy-commit] pypy anntype: Close branch anntype
    Message-ID: <20151121163832.30B021C1D32@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype
    Changeset: r80817:927882e0a003
    Date: 2015-11-21 16:39 +0000
    http://bitbucket.org/pypy/pypy/changeset/927882e0a003/
    
    Log:	Close branch anntype
    
    
    From noreply at buildbot.pypy.org  Sat Nov 21 11:38:36 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sat, 21 Nov 2015 17:38:36 +0100 (CET)
    Subject: [pypy-commit] pypy default: Merged in anntype (pull request #359)
    Message-ID: <20151121163836.BD70B1C1D32@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: 
    Changeset: r80818:f174c2bebfa6
    Date: 2015-11-21 16:39 +0000
    http://bitbucket.org/pypy/pypy/changeset/f174c2bebfa6/
    
    Log:	Merged in anntype (pull request #359)
    
    	Refactor and improve exception analysis in the annotator.
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -1,15 +1,17 @@
     from __future__ import absolute_import
     
     import types
    +from collections import defaultdict
     
     from rpython.tool.ansi_print import ansi_log
     from rpython.tool.pairtype import pair
     from rpython.tool.error import (format_blocked_annotation_error,
                                  gather_error, source_lines)
    -from rpython.flowspace.model import (
    -    Variable, Constant, FunctionGraph, checkgraph)
    +from rpython.flowspace.model import Variable, Constant, checkgraph
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
    +from rpython.annotator.model import (
    +        typeof, SomeExceptCase, s_ImpossibleValue)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    @@ -209,7 +211,7 @@
             for graph in newgraphs:
                 v = graph.getreturnvar()
                 if v.annotation is None:
    -                self.setbinding(v, annmodel.s_ImpossibleValue)
    +                self.setbinding(v, s_ImpossibleValue)
     
         def validate(self):
             """Check that the annotation results are valid"""
    @@ -281,7 +283,7 @@
             except KeyError:
                 # the function didn't reach any return statement so far.
                 # (some functions actually never do, they always raise exceptions)
    -            return annmodel.s_ImpossibleValue
    +            return s_ImpossibleValue
     
         def reflowfromposition(self, position_key):
             graph, block, index = position_key
    @@ -387,6 +389,34 @@
             if unions != oldcells:
                 self.bindinputargs(graph, block, unions)
     
    +    def apply_renaming(self, s_out, renaming):
    +        if hasattr(s_out, 'is_type_of'):
    +            renamed_is_type_of = []
    +            for v in s_out.is_type_of:
    +                renamed_is_type_of += renaming[v]
    +            assert s_out.knowntype is type
    +            newcell = typeof(renamed_is_type_of)
    +            if s_out.is_constant():
    +                newcell.const = s_out.const
    +            s_out = newcell
    +
    +        if hasattr(s_out, 'knowntypedata'):
    +            renamed_knowntypedata = {}
    +            for value, constraints in s_out.knowntypedata.items():
    +                renamed_knowntypedata[value] = {}
    +                for v, s in constraints.items():
    +                    new_vs = renaming.get(v, [])
    +                    for new_v in new_vs:
    +                        renamed_knowntypedata[value][new_v] = s
    +            assert isinstance(s_out, annmodel.SomeBool)
    +            newcell = annmodel.SomeBool()
    +            if s_out.is_constant():
    +                newcell.const = s_out.const
    +            s_out = newcell
    +            s_out.set_knowntypedata(renamed_knowntypedata)
    +        return s_out
    +
    +
         def whereami(self, position_key):
             graph, block, i = position_key
             blk = ""
    @@ -456,33 +486,43 @@
                         exits = [link for link in exits
                                       if link.exitcase == s_exitswitch.const]
     
    -        # filter out those exceptions which cannot
    -        # occour for this specific, typed operation.
             if block.canraise:
                 op = block.raising_op
                 can_only_throw = op.get_can_only_throw(self)
                 if can_only_throw is not None:
    -                candidates = can_only_throw
    -                candidate_exits = exits
    -                exits = []
    -                for link in candidate_exits:
    +                # filter out those exceptions which cannot
    +                # occur for this specific, typed operation.
    +                s_exception = self.bookkeeper.new_exception(can_only_throw)
    +                for link in exits:
                         case = link.exitcase
                         if case is None:
    -                        exits.append(link)
    +                        self.follow_link(graph, link, {})
                             continue
    -                    covered = [c for c in candidates if issubclass(c, case)]
    -                    if covered:
    -                        exits.append(link)
    -                        candidates = [c for c in candidates if c not in covered]
    +                    if s_exception == s_ImpossibleValue:
    +                        break
    +                    s_case = SomeExceptCase(
    +                            self.bookkeeper.getuniqueclassdef(case))
    +                    s_matching_exc = s_exception.intersection(s_case)
    +                    if s_matching_exc != s_ImpossibleValue:
    +                        self.follow_raise_link(graph, link, s_matching_exc)
    +                    s_exception = s_exception.difference(s_case)
    +            else:
    +                for link in exits:
    +                    if link.exitcase is None:
    +                        self.follow_link(graph, link, {})
    +                    else:
    +                        s_exception = self.bookkeeper.valueoftype(link.exitcase)
    +                        self.follow_raise_link(graph, link, s_exception)
    +        else:
    +            if isinstance(block.exitswitch, Variable):
    +                knowntypedata = getattr(block.exitswitch.annotation,
    +                                            "knowntypedata", {})
    +            else:
    +                knowntypedata = {}
    +            for link in exits:
    +                constraints = knowntypedata.get(link.exitcase, {})
    +                self.follow_link(graph, link, constraints)
     
    -        # mapping (exitcase, variable) -> s_annotation
    -        # that can be attached to booleans, exitswitches
    -        knowntypedata = {}
    -        if isinstance(block.exitswitch, Variable):
    -            knowntypedata = getattr(self.binding(block.exitswitch),
    -                                    "knowntypedata", {})
    -        for link in exits:
    -            self.follow_link(graph, link, knowntypedata)
             if block in self.notify:
                 # reflow from certain positions when this block is done
                 for callback in self.notify[block]:
    @@ -491,84 +531,66 @@
                     else:
                         callback()
     
    -    def follow_link(self, graph, link, knowntypedata):
    -        in_except_block = False
    -        v_last_exc_type = link.last_exception  # may be None for non-exception link
    -        v_last_exc_value = link.last_exc_value  # may be None for non-exception link
     
    -        if (isinstance(link.exitcase, (types.ClassType, type)) and
    -                issubclass(link.exitcase, BaseException)):
    -            assert v_last_exc_type and v_last_exc_value
    -            s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase)
    -            s_last_exc_type = annmodel.SomeType()
    -            if isinstance(v_last_exc_type, Constant):
    -                s_last_exc_type.const = v_last_exc_type.value
    -            s_last_exc_type.is_type_of = [v_last_exc_value]
    -
    -            if isinstance(v_last_exc_type, Variable):
    -                self.setbinding(v_last_exc_type, s_last_exc_type)
    -            if isinstance(v_last_exc_value, Variable):
    -                self.setbinding(v_last_exc_value, s_last_exc_value)
    -
    -            s_last_exc_type = annmodel.SomeType()
    -            if isinstance(v_last_exc_type, Constant):
    -                s_last_exc_type.const = v_last_exc_type.value
    -            last_exc_value_vars = []
    -            in_except_block = True
    +    def follow_link(self, graph, link, constraints):
    +        assert not (isinstance(link.exitcase, (types.ClassType, type)) and
    +                issubclass(link.exitcase, BaseException))
     
             ignore_link = False
             inputs_s = []
    -        renaming = {}
    +        renaming = defaultdict(list)
             for v_out, v_input in zip(link.args, link.target.inputargs):
    -            renaming.setdefault(v_out, []).append(v_input)
    -        for v_out, v_input in zip(link.args, link.target.inputargs):
    -            if v_out == v_last_exc_type:
    -                assert in_except_block
    -                inputs_s.append(s_last_exc_type)
    -            elif v_out == v_last_exc_value:
    -                assert in_except_block
    -                inputs_s.append(s_last_exc_value)
    -                last_exc_value_vars.append(v_input)
    -            else:
    -                s_out = self.annotation(v_out)
    -                if (link.exitcase, v_out) in knowntypedata:
    -                    knownvarvalue = knowntypedata[(link.exitcase, v_out)]
    -                    s_out = pair(s_out, knownvarvalue).improve()
    -                    # ignore links that try to pass impossible values
    -                    if s_out == annmodel.s_ImpossibleValue:
    -                        ignore_link = True
    +            renaming[v_out].append(v_input)
     
    -                if hasattr(s_out,'is_type_of'):
    -                    renamed_is_type_of = []
    -                    for v in s_out.is_type_of:
    -                        new_vs = renaming.get(v, [])
    -                        renamed_is_type_of += new_vs
    -                    assert s_out.knowntype is type
    -                    newcell = annmodel.SomeType()
    -                    if s_out.is_constant():
    -                        newcell.const = s_out.const
    -                    s_out = newcell
    -                    s_out.is_type_of = renamed_is_type_of
    -
    -                if hasattr(s_out, 'knowntypedata'):
    -                    renamed_knowntypedata = {}
    -                    for (value, v), s in s_out.knowntypedata.items():
    -                        new_vs = renaming.get(v, [])
    -                        for new_v in new_vs:
    -                            renamed_knowntypedata[value, new_v] = s
    -                    assert isinstance(s_out, annmodel.SomeBool)
    -                    newcell = annmodel.SomeBool()
    -                    if s_out.is_constant():
    -                        newcell.const = s_out.const
    -                    s_out = newcell
    -                    s_out.set_knowntypedata(renamed_knowntypedata)
    -
    -                inputs_s.append(s_out)
    +        for v_out in link.args:
    +            s_out = self.annotation(v_out)
    +            if v_out in constraints:
    +                s_constraint = constraints[v_out]
    +                s_out = pair(s_out, s_constraint).improve()
    +                # ignore links that try to pass impossible values
    +                if s_out == s_ImpossibleValue:
    +                    ignore_link = True
    +            s_out = self.apply_renaming(s_out, renaming)
    +            inputs_s.append(s_out)
             if ignore_link:
                 return
     
    -        if in_except_block:
    -            s_last_exc_type.is_type_of = last_exc_value_vars
    +        self.links_followed[link] = True
    +        self.addpendingblock(graph, link.target, inputs_s)
    +
    +    def follow_raise_link(self, graph, link, s_last_exc_value):
    +        v_last_exc_type = link.last_exception
    +        v_last_exc_value = link.last_exc_value
    +
    +        assert (isinstance(link.exitcase, (types.ClassType, type)) and
    +                issubclass(link.exitcase, BaseException))
    +
    +        assert v_last_exc_type and v_last_exc_value
    +
    +        if isinstance(v_last_exc_value, Variable):
    +            self.setbinding(v_last_exc_value, s_last_exc_value)
    +
    +        if isinstance(v_last_exc_type, Variable):
    +            self.setbinding(v_last_exc_type, typeof([v_last_exc_value]))
    +
    +        inputs_s = []
    +        renaming = defaultdict(list)
    +        for v_out, v_input in zip(link.args, link.target.inputargs):
    +            renaming[v_out].append(v_input)
    +
    +        for v_out, v_input in zip(link.args, link.target.inputargs):
    +            if v_out == v_last_exc_type:
    +                s_out = typeof(renaming[v_last_exc_value])
    +                if isinstance(v_last_exc_type, Constant):
    +                    s_out.const = v_last_exc_type.value
    +                elif v_last_exc_type.annotation.is_constant():
    +                    s_out.const = v_last_exc_type.annotation.const
    +                inputs_s.append(s_out)
    +            else:
    +                s_out = self.annotation(v_out)
    +                s_out = self.apply_renaming(s_out, renaming)
    +                inputs_s.append(s_out)
    +
             self.links_followed[link] = True
             self.addpendingblock(graph, link.target, inputs_s)
     
    @@ -586,8 +608,8 @@
                     raise BlockedInference(self, op, -1)
             resultcell = op.consider(self)
             if resultcell is None:
    -            resultcell = annmodel.s_ImpossibleValue
    -        elif resultcell == annmodel.s_ImpossibleValue:
    +            resultcell = s_ImpossibleValue
    +        elif resultcell == s_ImpossibleValue:
                 raise BlockedInference(self, op, -1) # the operation cannot succeed
             assert isinstance(resultcell, annmodel.SomeObject)
             assert isinstance(op.result, Variable)
    diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
    --- a/rpython/annotator/binaryop.py
    +++ b/rpython/annotator/binaryop.py
    @@ -1,18 +1,19 @@
     """
     Binary operations between SomeValues.
     """
    +from collections import defaultdict
     
     from rpython.tool.pairtype import pair, pairtype
     from rpython.annotator.model import (
         SomeObject, SomeInteger, SomeBool, s_Bool, SomeString, SomeChar, SomeList,
    -    SomeDict, SomeUnicodeCodePoint, SomeUnicodeString,
    +    SomeDict, SomeUnicodeCodePoint, SomeUnicodeString, SomeException,
         SomeTuple, SomeImpossibleValue, s_ImpossibleValue, SomeInstance,
         SomeBuiltinMethod, SomeIterator, SomePBC, SomeNone, SomeFloat, s_None,
         SomeByteArray, SomeWeakRef, SomeSingleFloat,
    -    SomeLongFloat, SomeType, SomeConstantType, unionof, UnionError,
    +    SomeLongFloat, SomeType, SomeTypeOf, SomeConstantType, unionof, UnionError,
         read_can_only_throw, add_knowntypedata,
         merge_knowntypedata,)
    -from rpython.annotator.bookkeeper import immutablevalue
    +from rpython.annotator.bookkeeper import immutablevalue, getbookkeeper
     from rpython.flowspace.model import Variable, Constant, const
     from rpython.flowspace.operation import op
     from rpython.rlib import rarithmetic
    @@ -35,7 +36,7 @@
         elif s_obj1.is_constant():
             if s_obj1.const is None and not s_obj2.can_be_none():
                 r.const = False
    -    knowntypedata = {}
    +    knowntypedata = defaultdict(dict)
         bk = annotator.bookkeeper
     
         def bind(src_obj, tgt_obj):
    @@ -145,24 +146,18 @@
     
         def union((obj1, obj2)):
             result = SomeType()
    -        is_type_of1 = getattr(obj1, 'is_type_of', None)
    -        is_type_of2 = getattr(obj2, 'is_type_of', None)
             if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const:
                 result.const = obj1.const
    -            is_type_of = {}
    -            if is_type_of1:
    -                for v in is_type_of1:
    -                    is_type_of[v] = True
    -            if is_type_of2:
    -                for v in is_type_of2:
    -                    is_type_of[v] = True
    -            if is_type_of:
    -                result.is_type_of = is_type_of.keys()
    -        else:
    -            if is_type_of1 and is_type_of1 == is_type_of2:
    -                result.is_type_of = is_type_of1
             return result
     
    +class __extend__(pairtype(SomeTypeOf, SomeTypeOf)):
    +    def union((s_obj1, s_obj2)):
    +        vars = list(set(s_obj1.is_type_of) | set(s_obj2.is_type_of))
    +        result = SomeTypeOf(vars)
    +        if (s_obj1.is_immutable_constant() and s_obj2.is_immutable_constant()
    +                and s_obj1.const == s_obj2.const):
    +            result.const = obj1.const
    +        return result
     
     # cloning a function with identical code, for the can_only_throw attribute
     def _clone(f, can_only_throw = None):
    @@ -263,7 +258,7 @@
             if not (rarithmetic.signedtype(s_int1.knowntype) and
                     rarithmetic.signedtype(s_int2.knowntype)):
                 return r
    -        knowntypedata = {}
    +        knowntypedata = defaultdict(dict)
             def tointtype(s_int0):
                 if s_int0.knowntype is bool:
                     return int
    @@ -682,6 +677,22 @@
                 thistype = pairtype(SomeInstance, SomeInstance)
                 return super(thistype, pair(ins1, ins2)).improve()
     
    +class __extend__(
    +        pairtype(SomeException, SomeInstance),
    +        pairtype(SomeException, SomeNone)):
    +    def union((s_exc, s_inst)):
    +        return unionof(s_exc.as_SomeInstance(), s_inst)
    +
    +class __extend__(
    +        pairtype(SomeInstance, SomeException),
    +        pairtype(SomeNone, SomeException)):
    +    def union((s_inst, s_exc)):
    +        return unionof(s_exc.as_SomeInstance(), s_inst)
    +
    +class __extend__(pairtype(SomeException, SomeException)):
    +    def union((s_exc1, s_exc2)):
    +        return SomeException(s_exc1.classdefs | s_exc2.classdefs)
    +
     
     @op.getitem.register_transform(SomeInstance, SomeObject)
     def getitem_SomeInstance(annotator, v_ins, v_idx):
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -12,7 +12,7 @@
     from rpython.annotator.model import (
         SomeOrderedDict, SomeString, SomeChar, SomeFloat, unionof, SomeInstance,
         SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint,
    -    s_None, s_ImpossibleValue, SomeBool, SomeTuple,
    +    s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeException,
         SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked,
         SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty)
     from rpython.annotator.classdesc import ClassDef, ClassDesc
    @@ -167,6 +167,10 @@
             desc = self.getdesc(cls)
             return desc.getuniqueclassdef()
     
    +    def new_exception(self, exc_classes):
    +        clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
    +        return SomeException(clsdefs)
    +
         def getlistdef(self, **flags_if_new):
             """Get the ListDef associated with the current position."""
             try:
    diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py
    --- a/rpython/annotator/builtin.py
    +++ b/rpython/annotator/builtin.py
    @@ -2,7 +2,7 @@
     Built-in functions.
     """
     import sys
    -from collections import OrderedDict
    +from collections import OrderedDict, defaultdict
     
     from rpython.annotator.model import (
         SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple,
    @@ -188,7 +188,7 @@
                 variables = [op.args[1]]
             for variable in variables:
                 assert bk.annotator.binding(variable) == s_obj
    -        knowntypedata = {}
    +        knowntypedata = defaultdict(dict)
             if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC):
                 add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ))
             r.set_knowntypedata(knowntypedata)
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -32,7 +32,7 @@
     import inspect
     import weakref
     from types import BuiltinFunctionType, MethodType
    -from collections import OrderedDict
    +from collections import OrderedDict, defaultdict
     
     import rpython
     from rpython.tool import descriptor
    @@ -138,6 +138,23 @@
         def can_be_none(self):
             return False
     
    +class SomeTypeOf(SomeType):
    +    """The type of a variable"""
    +    def __init__(self, args_v):
    +        self.is_type_of = args_v
    +
    +def typeof(args_v):
    +    if args_v:
    +        result = SomeTypeOf(args_v)
    +        if len(args_v) == 1:
    +            s_arg = args_v[0].annotation
    +            if isinstance(s_arg, SomeException) and len(s_arg.classdefs) == 1:
    +                cdef, = s_arg.classdefs
    +                result.const = cdef.classdesc.pyobj
    +        return result
    +    else:
    +        return SomeType()
    +
     
     class SomeFloat(SomeObject):
         "Stands for a float or an integer."
    @@ -437,6 +454,39 @@
         def noneify(self):
             return SomeInstance(self.classdef, can_be_None=True)
     
    +class SomeException(SomeObject):
    +    """The set of exceptions obeying type(exc) in self.classes"""
    +    def __init__(self, classdefs):
    +        self.classdefs = classdefs
    +
    +    def intersection(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
    +        if classdefs:
    +            return SomeException(classdefs)
    +        else:
    +            return s_ImpossibleValue
    +
    +    def difference(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
    +        if classdefs:
    +            return SomeException(classdefs)
    +        else:
    +            return s_ImpossibleValue
    +
    +    def as_SomeInstance(self):
    +        return unionof(*[SomeInstance(cdef) for cdef in self.classdefs])
    +
    +
    +class SomeExceptCase(SomeObject):
    +    """The set of exceptions that match a given except clause.
    +
    +    IOW, the set of exceptions that verify isinstance(exc, self.case).
    +    """
    +    def __init__(self, case):
    +        self.case = case
    +
     
     class SomePBC(SomeObject):
         """Stands for a global user instance, built prior to the analysis,
    @@ -682,14 +732,15 @@
     
     def add_knowntypedata(ktd, truth, vars, s_obj):
         for v in vars:
    -        ktd[(truth, v)] = s_obj
    +        ktd[truth][v] = s_obj
     
     
     def merge_knowntypedata(ktd1, ktd2):
    -    r = {}
    -    for truth_v in ktd1:
    -        if truth_v in ktd2:
    -            r[truth_v] = unionof(ktd1[truth_v], ktd2[truth_v])
    +    r = defaultdict(dict)
    +    for truth, constraints in ktd1.items():
    +        for v in constraints:
    +            if truth in ktd2 and v in ktd2[truth]:
    +                r[truth][v] = unionof(ktd1[truth][v], ktd2[truth][v])
         return r
     
     
    diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py
    --- a/rpython/annotator/test/test_annrpython.py
    +++ b/rpython/annotator/test/test_annrpython.py
    @@ -698,6 +698,56 @@
             s = a.build_types(snippet.exc_deduction_our_excs_plus_others, [])
             assert isinstance(s, annmodel.SomeInteger)
     
    +    def test_complex_exception_deduction(self):
    +        class InternalError(Exception):
    +            def __init__(self, msg):
    +                self.msg = msg
    +
    +        class AppError(Exception):
    +            def __init__(self, msg):
    +                self.msg = msg
    +        def apperror(msg):
    +            return AppError(msg)
    +
    +        def f(string):
    +            if not string:
    +                raise InternalError('Empty string')
    +            return string, None
    +        def cleanup():
    +            pass
    +
    +        def g(string):
    +            try:
    +                try:
    +                    string, _ = f(string)
    +                except ZeroDivisionError:
    +                    raise apperror('ZeroDivisionError')
    +                try:
    +                    result, _ = f(string)
    +                finally:
    +                    cleanup()
    +            except InternalError as e:
    +                raise apperror(e.msg)
    +            return result
    +
    +        a = self.RPythonAnnotator()
    +        s_result = a.build_types(g, [str])
    +        assert isinstance(s_result, annmodel.SomeString)
    +
    +    def test_method_exception_specialization(self):
    +        def f(l):
    +            try:
    +                return l.pop()
    +            except Exception:
    +                raise
    +        a = self.RPythonAnnotator()
    +        s = a.build_types(f, [[int]])
    +        graph = graphof(a, f)
    +        etype, evalue = graph.exceptblock.inputargs
    +        assert evalue.annotation.classdefs == {
    +                a.bookkeeper.getuniqueclassdef(IndexError)}
    +        assert etype.annotation.const == IndexError
    +
         def test_operation_always_raising(self):
             def operation_always_raising(n):
                 lst = []
    @@ -1376,11 +1426,11 @@
             a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    +        t = annmodel.SomeTypeOf([ev])
             t.const = KeyError
    -        t.is_type_of = [ev]
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError)
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert s_ev == a.bookkeeper.new_exception([KeyError])
     
         def test_reraiseAnything(self):
             def f(dic):
    @@ -1392,11 +1442,11 @@
             a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    -        t.is_type_of = [ev]
    -        t.const = KeyError    # IndexError ignored because 'dic' is a dict
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError)
    +        t = annmodel.SomeTypeOf([ev])
    +        t.const = KeyError  # IndexError ignored because 'dic' is a dict
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert s_ev == a.bookkeeper.new_exception([KeyError])
     
         def test_exception_mixing(self):
             def h():
    @@ -1427,10 +1477,11 @@
             a.build_types(f, [int, somelist(annmodel.s_Int)])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    -        t.is_type_of = [ev]
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception)
    +        t = annmodel.SomeTypeOf([ev])
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert (isinstance(s_ev, annmodel.SomeInstance) and
    +                s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception))
     
         def test_try_except_raise_finally1(self):
             def h(): pass
    @@ -1449,10 +1500,11 @@
             a.build_types(f, [])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    -        t.is_type_of = [ev]
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception)
    +        t = annmodel.SomeTypeOf([ev])
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert (isinstance(s_ev, annmodel.SomeInstance) and
    +                s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception))
     
         def test_inplace_div(self):
             def f(n):
    diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py
    --- a/rpython/annotator/test/test_model.py
    +++ b/rpython/annotator/test/test_model.py
    @@ -1,8 +1,14 @@
    -import py
    +import pytest
     
     from rpython.annotator.model import *
     from rpython.annotator.listdef import ListDef
     from rpython.translator.translator import TranslationContext
    +from rpython.annotator import unaryop, binaryop  # for side-effects
    +
    + at pytest.fixture()
    +def annotator():
    +    t = TranslationContext()
    +    return t.buildannotator()
     
     
     listdef1 = ListDef(None, SomeTuple([SomeInteger(nonneg=True), SomeString()]))
    @@ -100,19 +106,21 @@
     class AAA(object):
         pass
     
    -def test_blocked_inference1():
    +def test_blocked_inference1(annotator):
         def blocked_inference():
             return AAA().m()
     
    -    py.test.raises(AnnotatorError, compile_function, blocked_inference)
    +    with pytest.raises(AnnotatorError):
    +        annotator.build_types(blocked_inference, [])
     
    -def test_blocked_inference2():
    +def test_blocked_inference2(annotator):
         def blocked_inference():
             a = AAA()
             b = a.x
             return b
     
    -    py.test.raises(AnnotatorError, compile_function, blocked_inference)
    +    with pytest.raises(AnnotatorError):
    +        annotator.build_types(blocked_inference, [])
     
     
     def test_not_const():
    @@ -129,3 +137,17 @@
         assert s.no_nul is True
         s = SomeChar().nonnulify()
         assert s.no_nul is True
    +
    +def test_SomeException_union(annotator):
    +    bk = annotator.bookkeeper
    +    someinst = lambda cls, **kw: SomeInstance(bk.getuniqueclassdef(cls), **kw)
    +    s_inst = someinst(Exception)
    +    s_exc = bk.new_exception([ValueError, IndexError])
    +    assert unionof(s_exc, s_inst) == s_inst
    +    assert unionof(s_inst, s_exc) == s_inst
    +    s_nullable = unionof(s_None, bk.new_exception([ValueError]))
    +    assert isinstance(s_nullable, SomeInstance)
    +    assert s_nullable.can_be_None
    +    s_exc1 = bk.new_exception([ValueError])
    +    s_exc2 = bk.new_exception([IndexError])
    +    unionof(s_exc1, s_exc2) == unionof(s_exc2, s_exc1)
    diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
    --- a/rpython/annotator/unaryop.py
    +++ b/rpython/annotator/unaryop.py
    @@ -1,8 +1,9 @@
     """
     Unary operations on SomeValues.
     """
    +from __future__ import absolute_import
     
    -from __future__ import absolute_import
    +from collections import defaultdict
     
     from rpython.tool.pairtype import pair
     from rpython.flowspace.operation import op
    @@ -11,7 +12,7 @@
     from rpython.annotator.model import (SomeObject, SomeInteger, SomeBool,
         SomeString, SomeChar, SomeList, SomeDict, SomeTuple, SomeImpossibleValue,
         SomeUnicodeCodePoint, SomeInstance, SomeBuiltin, SomeBuiltinMethod,
    -    SomeFloat, SomeIterator, SomePBC, SomeNone, SomeType, s_ImpossibleValue,
    +    SomeFloat, SomeIterator, SomePBC, SomeNone, SomeTypeOf, s_ImpossibleValue,
         s_Bool, s_None, s_Int, unionof, add_knowntypedata,
         SomeWeakRef, SomeUnicodeString, SomeByteArray)
     from rpython.annotator.bookkeeper import getbookkeeper, immutablevalue
    @@ -26,11 +27,11 @@
                             if oper.dispatch == 1])
     UNARY_OPERATIONS.remove('contains')
     
    +
     @op.type.register(SomeObject)
    -def type_SomeObject(annotator, arg):
    -    r = SomeType()
    -    r.is_type_of = [arg]
    -    return r
    +def type_SomeObject(annotator, v_arg):
    +    return SomeTypeOf([v_arg])
    +
     
     @op.bool.register(SomeObject)
     def bool_SomeObject(annotator, obj):
    @@ -39,7 +40,7 @@
         s_nonnone_obj = annotator.annotation(obj)
         if s_nonnone_obj.can_be_none():
             s_nonnone_obj = s_nonnone_obj.nonnoneify()
    -    knowntypedata = {}
    +    knowntypedata = defaultdict(dict)
         add_knowntypedata(knowntypedata, True, [obj], s_nonnone_obj)
         r.set_knowntypedata(knowntypedata)
         return r
    @@ -99,18 +100,17 @@
         callspec = complex_args([annotator.annotation(v_arg) for v_arg in args_v])
         return annotator.annotation(func).call(callspec)
     
    + at op.issubtype.register(SomeObject)
    +def issubtype(annotator, v_type, v_cls):
    +    s_type = v_type.annotation
    +    s_cls = annotator.annotation(v_cls)
    +    if s_type.is_constant() and s_cls.is_constant():
    +        return annotator.bookkeeper.immutablevalue(
    +            issubclass(s_type.const, s_cls.const))
    +    return s_Bool
    +
     class __extend__(SomeObject):
     
    -    def issubtype(self, s_cls):
    -        if hasattr(self, 'is_type_of'):
    -            vars = self.is_type_of
    -            annotator = getbookkeeper().annotator
    -            return builtin.builtin_isinstance(annotator.binding(vars[0]),
    -                                              s_cls, vars)
    -        if self.is_constant() and s_cls.is_constant():
    -            return immutablevalue(issubclass(self.const, s_cls.const))
    -        return s_Bool
    -
         def len(self):
             return SomeInteger(nonneg=True)
     
    @@ -520,7 +520,7 @@
     def contains_String(annotator, string, char):
         if annotator.annotation(char).is_constant() and annotator.annotation(char).const == "\0":
             r = SomeBool()
    -        knowntypedata = {}
    +        knowntypedata = defaultdict(dict)
             add_knowntypedata(knowntypedata, False, [string],
                               annotator.annotation(string).nonnulify())
             r.set_knowntypedata(knowntypedata)
    @@ -913,6 +913,12 @@
             # really crash translated code).  It can be generalized later.
             return SomeImpossibleValue()
     
    + at op.issubtype.register(SomeTypeOf)
    +def issubtype(annotator, v_type, v_cls):
    +    args_v = v_type.annotation.is_type_of
    +    return builtin.builtin_isinstance(
    +        args_v[0].annotation, annotator.annotation(v_cls), args_v)
    +
     #_________________________________________
     # weakrefs
     
    diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
    --- a/rpython/rtyper/rclass.py
    +++ b/rpython/rtyper/rclass.py
    @@ -445,6 +445,13 @@
         def rtyper_makekey(self):
             return self.__class__, self.classdef
     
    +class __extend__(annmodel.SomeException):
    +    def rtyper_makerepr(self, rtyper):
    +        return self.as_SomeInstance().rtyper_makerepr(rtyper)
    +
    +    def rtyper_makekey(self):
    +        return self.__class__, frozenset(self.classdefs)
    +
     class __extend__(annmodel.SomeType):
         def rtyper_makerepr(self, rtyper):
             return get_type_repr(rtyper)
    diff --git a/rpython/translator/goal/query.py b/rpython/translator/goal/query.py
    --- a/rpython/translator/goal/query.py
    +++ b/rpython/translator/goal/query.py
    @@ -48,7 +48,7 @@
             s_ev = annotator.annotation(ev)
             if s_et:
                 if s_et.knowntype == type:
    -                if s_et.__class__ == annmodel.SomeType:
    +                if s_et.__class__ == annmodel.SomeTypeOf:
                         if hasattr(s_et, 'is_type_of') and  s_et.is_type_of == [ev]:
                             continue
                     else:
    diff --git a/rpython/translator/transform.py b/rpython/translator/transform.py
    --- a/rpython/translator/transform.py
    +++ b/rpython/translator/transform.py
    @@ -189,8 +189,7 @@
         self.links_followed[errlink] = True
         # fix the annotation of the exceptblock.inputargs
         etype, evalue = graph.exceptblock.inputargs
    -    s_type = annmodel.SomeType()
    -    s_type.is_type_of = [evalue]
    +    s_type = annmodel.SomeTypeOf([evalue])
         s_value = annmodel.SomeInstance(self.bookkeeper.getuniqueclassdef(Exception))
         self.setbinding(etype, s_type)
         self.setbinding(evalue, s_value)
    
    From noreply at buildbot.pypy.org  Sat Nov 21 11:40:56 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sat, 21 Nov 2015 17:40:56 +0100 (CET)
    Subject: [pypy-commit] pypy default: Document merged branch
    Message-ID: <20151121164056.DADBB1C122B@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: 
    Changeset: r80819:d983bf130cff
    Date: 2015-11-21 16:41 +0000
    http://bitbucket.org/pypy/pypy/changeset/d983bf130cff/
    
    Log:	Document merged branch
    
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -13,3 +13,6 @@
     .. branch: osx-flat-namespace
     
     Fix the cpyext tests on OSX by linking with -flat_namespace
    +
    +.. branch: anntype
    +Refactor and improve exception analysis in the annotator.
    
    From noreply at buildbot.pypy.org  Sat Nov 21 11:50:31 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sat, 21 Nov 2015 17:50:31 +0100 (CET)
    Subject: [pypy-commit] pypy exc-later: hg merge default
    Message-ID: <20151121165031.B1CC61C122B@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: exc-later
    Changeset: r80820:c61a1f069e26
    Date: 2015-11-21 16:50 +0000
    http://bitbucket.org/pypy/pypy/changeset/c61a1f069e26/
    
    Log:	hg merge default
    
    diff too long, truncating to 2000 out of 10259 lines
    
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -17,3 +17,4 @@
     295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
     f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
     850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
    +5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
    diff --git a/LICENSE b/LICENSE
    --- a/LICENSE
    +++ b/LICENSE
    @@ -56,14 +56,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -87,7 +88,6 @@
       Ludovic Aubry
       Jacob Hallen
       Jason Creighton
    -  Richard Plangger
       Alex Martelli
       Michal Bendowski
       stian
    @@ -200,9 +200,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -234,6 +237,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -244,6 +248,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -253,6 +258,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -283,6 +289,7 @@
       shoma hosaka
       Daniel Neuhäuser
       Ben Mather
    +  Niclas Olofsson
       halgari
       Boglarka Vezer
       Chris Pressey
    @@ -309,13 +316,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -327,6 +337,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
    --- a/lib_pypy/cffi.egg-info/PKG-INFO
    +++ b/lib_pypy/cffi.egg-info/PKG-INFO
    @@ -1,6 +1,6 @@
     Metadata-Version: 1.1
     Name: cffi
    -Version: 1.3.0
    +Version: 1.3.1
     Summary: Foreign Function Interface for Python calling C code.
     Home-page: http://cffi.readthedocs.org
     Author: Armin Rigo, Maciej Fijalkowski
    diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
    --- a/lib_pypy/cffi/__init__.py
    +++ b/lib_pypy/cffi/__init__.py
    @@ -4,8 +4,8 @@
     from .api import FFI, CDefError, FFIError
     from .ffiplatform import VerificationError, VerificationMissing
     
    -__version__ = "1.3.0"
    -__version_info__ = (1, 3, 0)
    +__version__ = "1.3.1"
    +__version_info__ = (1, 3, 1)
     
     # The verifier module file names are based on the CRC32 of a string that
     # contains the following version number.  It may be older than __version__
    diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py
    --- a/lib_pypy/cffi/cffi_opcode.py
    +++ b/lib_pypy/cffi/cffi_opcode.py
    @@ -110,6 +110,8 @@
     _UNKNOWN_FLOAT_PRIM    = -2
     _UNKNOWN_LONG_DOUBLE   = -3
     
    +_IO_FILE_STRUCT        = -1
    +
     PRIMITIVE_TO_INDEX = {
         'char':               PRIM_CHAR,
         'short':              PRIM_SHORT,
    diff --git a/lib_pypy/cffi/commontypes.py b/lib_pypy/cffi/commontypes.py
    --- a/lib_pypy/cffi/commontypes.py
    +++ b/lib_pypy/cffi/commontypes.py
    @@ -2,10 +2,17 @@
     from . import api, model
     
     
    -COMMON_TYPES = {
    -    'FILE': model.unknown_type('FILE', '_IO_FILE'),
    -    'bool': '_Bool',
    -    }
    +COMMON_TYPES = {}
    +
    +try:
    +    # fetch "bool" and all simple Windows types
    +    from _cffi_backend import _get_common_types
    +    _get_common_types(COMMON_TYPES)
    +except ImportError:
    +    pass
    +
    +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE')
    +COMMON_TYPES['bool'] = '_Bool'    # in case we got ImportError above
     
     for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES:
         if _type.endswith('_t'):
    @@ -14,212 +21,35 @@
     
     _CACHE = {}
     
    -def resolve_common_type(commontype):
    +def resolve_common_type(parser, commontype):
         try:
             return _CACHE[commontype]
         except KeyError:
    -        result = COMMON_TYPES.get(commontype, commontype)
    -        if not isinstance(result, str):
    -            pass    # result is already a BaseType
    -        elif result.endswith(' *'):
    -            if result.startswith('const '):
    -                result = model.ConstPointerType(
    -                    resolve_common_type(result[6:-2]))
    -            else:
    -                result = model.PointerType(resolve_common_type(result[:-2]))
    -        elif result in model.PrimitiveType.ALL_PRIMITIVE_TYPES:
    -            result = model.PrimitiveType(result)
    -        elif result == 'set-unicode-needed':
    +        cdecl = COMMON_TYPES.get(commontype, commontype)
    +        if not isinstance(cdecl, str):
    +            result, quals = cdecl, 0    # cdecl is already a BaseType
    +        elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES:
    +            result, quals = model.PrimitiveType(cdecl), 0
    +        elif cdecl == 'set-unicode-needed':
                 raise api.FFIError("The Windows type %r is only available after "
                                    "you call ffi.set_unicode()" % (commontype,))
             else:
    -            if commontype == result:
    +            if commontype == cdecl:
                     raise api.FFIError("Unsupported type: %r.  Please file a bug "
                                        "if you think it should be." % (commontype,))
    -            result = resolve_common_type(result)   # recursively
    +            result, quals = parser.parse_type_and_quals(cdecl)   # recursive
    +
             assert isinstance(result, model.BaseTypeByIdentity)
    -        _CACHE[commontype] = result
    -        return result
    +        _CACHE[commontype] = result, quals
    +        return result, quals
     
     
     # ____________________________________________________________
    -# Windows common types
    +# extra types for Windows (most of them are in commontypes.c)
     
     
    -def win_common_types(maxsize):
    -    result = {}
    -    if maxsize < (1<<32):
    -        result.update({      # Windows 32-bits
    -            'HALF_PTR': 'short',
    -            'INT_PTR': 'int',
    -            'LONG_PTR': 'long',
    -            'UHALF_PTR': 'unsigned short',
    -            'UINT_PTR': 'unsigned int',
    -            'ULONG_PTR': 'unsigned long',
    -            })
    -    else:
    -        result.update({      # Windows 64-bits
    -            'HALF_PTR': 'int',
    -            'INT_PTR': 'long long',
    -            'LONG_PTR': 'long long',
    -            'UHALF_PTR': 'unsigned int',
    -            'UINT_PTR': 'unsigned long long',
    -            'ULONG_PTR': 'unsigned long long',
    -            })
    -    result.update({
    -        "BYTE": "unsigned char",
    -        "BOOL": "int",
    -        "CCHAR": "char",
    -        "CHAR": "char",
    -        "DWORD": "unsigned long",
    -        "DWORD32": "unsigned int",
    -        "DWORD64": "unsigned long long",
    -        "FLOAT": "float",
    -        "INT": "int",
    -        "INT8": "signed char",
    -        "INT16": "short",
    -        "INT32": "int",
    -        "INT64": "long long",
    -        "LONG": "long",
    -        "LONGLONG": "long long",
    -        "LONG32": "int",
    -        "LONG64": "long long",
    -        "WORD": "unsigned short",
    -        "PVOID": model.voidp_type,
    -        "ULONGLONG": "unsigned long long",
    -        "WCHAR": "wchar_t",
    -        "SHORT": "short",
    -        "UCHAR": "unsigned char",
    -        "UINT": "unsigned int",
    -        "UINT8": "unsigned char",
    -        "UINT16": "unsigned short",
    -        "UINT32": "unsigned int",
    -        "UINT64": "unsigned long long",
    -        "ULONG": "unsigned long",
    -        "ULONG32": "unsigned int",
    -        "ULONG64": "unsigned long long",
    -        "USHORT": "unsigned short",
    -
    -        "SIZE_T": "ULONG_PTR",
    -        "SSIZE_T": "LONG_PTR",
    -        "ATOM": "WORD",
    -        "BOOLEAN": "BYTE",
    -        "COLORREF": "DWORD",
    -
    -        "HANDLE": "PVOID",
    -        "DWORDLONG": "ULONGLONG",
    -        "DWORD_PTR": "ULONG_PTR",
    -        "HACCEL": "HANDLE",
    -
    -        "HBITMAP": "HANDLE",
    -        "HBRUSH": "HANDLE",
    -        "HCOLORSPACE": "HANDLE",
    -        "HCONV": "HANDLE",
    -        "HCONVLIST": "HANDLE",
    -        "HDC": "HANDLE",
    -        "HDDEDATA": "HANDLE",
    -        "HDESK": "HANDLE",
    -        "HDROP": "HANDLE",
    -        "HDWP": "HANDLE",
    -        "HENHMETAFILE": "HANDLE",
    -        "HFILE": "int",
    -        "HFONT": "HANDLE",
    -        "HGDIOBJ": "HANDLE",
    -        "HGLOBAL": "HANDLE",
    -        "HHOOK": "HANDLE",
    -        "HICON": "HANDLE",
    -        "HCURSOR": "HICON",
    -        "HINSTANCE": "HANDLE",
    -        "HKEY": "HANDLE",
    -        "HKL": "HANDLE",
    -        "HLOCAL": "HANDLE",
    -        "HMENU": "HANDLE",
    -        "HMETAFILE": "HANDLE",
    -        "HMODULE": "HINSTANCE",
    -        "HMONITOR": "HANDLE",
    -        "HPALETTE": "HANDLE",
    -        "HPEN": "HANDLE",
    -        "HRESULT": "LONG",
    -        "HRGN": "HANDLE",
    -        "HRSRC": "HANDLE",
    -        "HSZ": "HANDLE",
    -        "WINSTA": "HANDLE",
    -        "HWND": "HANDLE",
    -
    -        "LANGID": "WORD",
    -        "LCID": "DWORD",
    -        "LCTYPE": "DWORD",
    -        "LGRPID": "DWORD",
    -        "LPARAM": "LONG_PTR",
    -        "LPBOOL": "BOOL *",
    -        "LPBYTE": "BYTE *",
    -        "LPCOLORREF": "DWORD *",
    -        "LPCSTR": "const char *",
    -
    -        "LPCVOID": model.const_voidp_type,
    -        "LPCWSTR": "const WCHAR *",
    -        "LPDWORD": "DWORD *",
    -        "LPHANDLE": "HANDLE *",
    -        "LPINT": "int *",
    -        "LPLONG": "long *",
    -        "LPSTR": "CHAR *",
    -        "LPWSTR": "WCHAR *",
    -        "LPVOID": model.voidp_type,
    -        "LPWORD": "WORD *",
    -        "LRESULT": "LONG_PTR",
    -        "PBOOL": "BOOL *",
    -        "PBOOLEAN": "BOOLEAN *",
    -        "PBYTE": "BYTE *",
    -        "PCHAR": "CHAR *",
    -        "PCSTR": "const CHAR *",
    -        "PCWSTR": "const WCHAR *",
    -        "PDWORD": "DWORD *",
    -        "PDWORDLONG": "DWORDLONG *",
    -        "PDWORD_PTR": "DWORD_PTR *",
    -        "PDWORD32": "DWORD32 *",
    -        "PDWORD64": "DWORD64 *",
    -        "PFLOAT": "FLOAT *",
    -        "PHALF_PTR": "HALF_PTR *",
    -        "PHANDLE": "HANDLE *",
    -        "PHKEY": "HKEY *",
    -        "PINT": "int *",
    -        "PINT_PTR": "INT_PTR *",
    -        "PINT8": "INT8 *",
    -        "PINT16": "INT16 *",
    -        "PINT32": "INT32 *",
    -        "PINT64": "INT64 *",
    -        "PLCID": "PDWORD",
    -        "PLONG": "LONG *",
    -        "PLONGLONG": "LONGLONG *",
    -        "PLONG_PTR": "LONG_PTR *",
    -        "PLONG32": "LONG32 *",
    -        "PLONG64": "LONG64 *",
    -        "PSHORT": "SHORT *",
    -        "PSIZE_T": "SIZE_T *",
    -        "PSSIZE_T": "SSIZE_T *",
    -        "PSTR": "CHAR *",
    -        "PUCHAR": "UCHAR *",
    -        "PUHALF_PTR": "UHALF_PTR *",
    -        "PUINT": "UINT *",
    -        "PUINT_PTR": "UINT_PTR *",
    -        "PUINT8": "UINT8 *",
    -        "PUINT16": "UINT16 *",
    -        "PUINT32": "UINT32 *",
    -        "PUINT64": "UINT64 *",
    -        "PULONG": "ULONG *",
    -        "PULONGLONG": "ULONGLONG *",
    -        "PULONG_PTR": "ULONG_PTR *",
    -        "PULONG32": "ULONG32 *",
    -        "PULONG64": "ULONG64 *",
    -        "PUSHORT": "USHORT *",
    -        "PWCHAR": "WCHAR *",
    -        "PWORD": "WORD *",
    -        "PWSTR": "WCHAR *",
    -        "QWORD": "unsigned long long",
    -        "SC_HANDLE": "HANDLE",
    -        "SC_LOCK": "LPVOID",
    -        "SERVICE_STATUS_HANDLE": "HANDLE",
    -
    +def win_common_types():
    +    return {
             "UNICODE_STRING": model.StructType(
                 "_UNICODE_STRING",
                 ["Length",
    @@ -232,10 +62,6 @@
             "PUNICODE_STRING": "UNICODE_STRING *",
             "PCUNICODE_STRING": "const UNICODE_STRING *",
     
    -        "USN": "LONGLONG",
    -        "VOID": model.void_type,
    -        "WPARAM": "UINT_PTR",
    -
             "TBYTE": "set-unicode-needed",
             "TCHAR": "set-unicode-needed",
             "LPCTSTR": "set-unicode-needed",
    @@ -244,9 +70,7 @@
             "PTSTR": "set-unicode-needed",
             "PTBYTE": "set-unicode-needed",
             "PTCHAR": "set-unicode-needed",
    -        })
    -    return result
    -
    +        }
     
     if sys.platform == 'win32':
    -    COMMON_TYPES.update(win_common_types(sys.maxsize))
    +    COMMON_TYPES.update(win_common_types())
    diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py
    --- a/lib_pypy/cffi/cparser.py
    +++ b/lib_pypy/cffi/cparser.py
    @@ -29,6 +29,8 @@
     _r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b")
     _r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b")
     _r_cdecl = re.compile(r"\b__cdecl\b")
    +_r_star_const_space = re.compile(       # matches "* const "
    +    r"[*]\s*((const|volatile|restrict)\b\s*)+")
     
     def _get_parser():
         global _parser_cache
    @@ -36,6 +38,48 @@
             _parser_cache = pycparser.CParser()
         return _parser_cache
     
    +def _workaround_for_old_pycparser(csource):
    +    # Workaround for a pycparser issue (fixed between pycparser 2.10 and
    +    # 2.14): "char*const***" gives us a wrong syntax tree, the same as
    +    # for "char***(*const)".  This means we can't tell the difference
    +    # afterwards.  But "char(*const(***))" gives us the right syntax
    +    # tree.  The issue only occurs if there are several stars in
    +    # sequence with no parenthesis inbetween, just possibly qualifiers.
    +    # Attempt to fix it by adding some parentheses in the source: each
    +    # time we see "* const" or "* const *", we add an opening
    +    # parenthesis before each star---the hard part is figuring out where
    +    # to close them.
    +    parts = []
    +    while True:
    +        match = _r_star_const_space.search(csource)
    +        if not match:
    +            break
    +        #print repr(''.join(parts)+csource), '=>',
    +        parts.append(csource[:match.start()])
    +        parts.append('('); closing = ')'
    +        parts.append(match.group())   # e.g. "* const "
    +        endpos = match.end()
    +        if csource.startswith('*', endpos):
    +            parts.append('('); closing += ')'
    +        level = 0
    +        i = endpos
    +        while i < len(csource):
    +            c = csource[i]
    +            if c == '(':
    +                level += 1
    +            elif c == ')':
    +                if level == 0:
    +                    break
    +                level -= 1
    +            elif c in ',;=':
    +                if level == 0:
    +                    break
    +            i += 1
    +        csource = csource[endpos:i] + closing + csource[i:]
    +        #print repr(''.join(parts)+csource)
    +    parts.append(csource)
    +    return ''.join(parts)
    +
     def _preprocess(csource):
         # Remove comments.  NOTE: this only work because the cdef() section
         # should not contain any string literal!
    @@ -47,6 +91,10 @@
             macrovalue = macrovalue.replace('\\\n', '').strip()
             macros[macroname] = macrovalue
         csource = _r_define.sub('', csource)
    +    #
    +    if pycparser.__version__ < '2.14':
    +        csource = _workaround_for_old_pycparser(csource)
    +    #
         # BIG HACK: replace WINAPI or __stdcall with "volatile const".
         # It doesn't make sense for the return type of a function to be
         # "volatile volatile const", so we abuse it to detect __stdcall...
    @@ -320,13 +368,15 @@
                         self._declare('variable ' + decl.name, tp, quals=quals)
     
         def parse_type(self, cdecl):
    +        return self.parse_type_and_quals(cdecl)[0]
    +
    +    def parse_type_and_quals(self, cdecl):
             ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2]
             assert not macros
             exprnode = ast.ext[-1].type.args.params[0]
             if isinstance(exprnode, pycparser.c_ast.ID):
                 raise api.CDefError("unknown identifier '%s'" % (exprnode.name,))
    -        tp, quals = self._get_type_and_quals(exprnode.type)
    -        return tp
    +        return self._get_type_and_quals(exprnode.type)
     
         def _declare(self, name, obj, included=False, quals=0):
             if name in self._declarations:
    @@ -348,6 +398,8 @@
                                  pycparser.c_ast.PtrDecl)):
                 if 'const' in type.quals:
                     quals |= model.Q_CONST
    +            if 'volatile' in type.quals:
    +                quals |= model.Q_VOLATILE
                 if 'restrict' in type.quals:
                     quals |= model.Q_RESTRICT
             return quals
    @@ -422,7 +474,8 @@
                     if ident == '__dotdotdot__':
                         raise api.FFIError(':%d: bad usage of "..."' %
                                 typenode.coord.line)
    -                return resolve_common_type(ident), quals
    +                tp0, quals0 = resolve_common_type(self, ident)
    +                return tp0, (quals | quals0)
                 #
                 if isinstance(type, pycparser.c_ast.Struct):
                     # 'struct foobar'
    @@ -456,6 +509,13 @@
     
         def _parse_function_type(self, typenode, funcname=None):
             params = list(getattr(typenode.args, 'params', []))
    +        for i, arg in enumerate(params):
    +            if not hasattr(arg, 'type'):
    +                raise api.CDefError("%s arg %d: unknown type '%s'"
    +                    " (if you meant to use the old C syntax of giving"
    +                    " untyped arguments, it is not supported)"
    +                    % (funcname or 'in expression', i + 1,
    +                       getattr(arg, 'name', '?')))
             ellipsis = (
                 len(params) > 0 and
                 isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and
    diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py
    --- a/lib_pypy/cffi/model.py
    +++ b/lib_pypy/cffi/model.py
    @@ -7,10 +7,13 @@
     # type qualifiers
     Q_CONST    = 0x01
     Q_RESTRICT = 0x02
    +Q_VOLATILE = 0x04
     
     def qualify(quals, replace_with):
         if quals & Q_CONST:
             replace_with = ' const ' + replace_with.lstrip()
    +    if quals & Q_VOLATILE:
    +        replace_with = ' volatile ' + replace_with.lstrip()
         if quals & Q_RESTRICT:
             # It seems that __restrict is supported by gcc and msvc.
             # If you hit some different compiler, add a #define in
    @@ -511,12 +514,17 @@
             if self.baseinttype is not None:
                 return self.baseinttype.get_cached_btype(ffi, finishlist)
             #
    +        from . import api
             if self.enumvalues:
                 smallest_value = min(self.enumvalues)
                 largest_value = max(self.enumvalues)
             else:
    -            smallest_value = 0
    -            largest_value = 0
    +            import warnings
    +            warnings.warn("%r has no values explicitly defined; next version "
    +                          "will refuse to guess which integer type it is "
    +                          "meant to be (unsigned/signed, int/long)"
    +                          % self._get_c_name())
    +            smallest_value = largest_value = 0
             if smallest_value < 0:   # needs a signed type
                 sign = 1
                 candidate1 = PrimitiveType("int")
    diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h
    --- a/lib_pypy/cffi/parse_c_type.h
    +++ b/lib_pypy/cffi/parse_c_type.h
    @@ -83,6 +83,8 @@
     #define _CFFI__UNKNOWN_FLOAT_PRIM     (-2)
     #define _CFFI__UNKNOWN_LONG_DOUBLE    (-3)
     
    +#define _CFFI__IO_FILE_STRUCT         (-1)
    +
     
     struct _cffi_global_s {
         const char *name;
    diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
    --- a/lib_pypy/greenlet.py
    +++ b/lib_pypy/greenlet.py
    @@ -88,9 +88,19 @@
             #
             try:
                 unbound_method = getattr(_continulet, methodname)
    +            _tls.leaving = current
                 args, kwds = unbound_method(current, *baseargs, to=target)
    -        finally:
                 _tls.current = current
    +        except:
    +            _tls.current = current
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            _tls.leaving = None
    +            raise
    +        else:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            _tls.leaving = None
             #
             if kwds:
                 if args:
    @@ -122,6 +132,34 @@
             return f.f_back.f_back.f_back   # go past start(), __switch(), switch()
     
     # ____________________________________________________________
    +# Recent additions
    +
    +GREENLET_USE_GC = True
    +GREENLET_USE_TRACING = True
    +
    +def gettrace():
    +    return getattr(_tls, 'trace', None)
    +
    +def settrace(callback):
    +    try:
    +        prev = _tls.trace
    +        del _tls.trace
    +    except AttributeError:
    +        prev = None
    +    if callback is not None:
    +        _tls.trace = callback
    +    return prev
    +
    +def _run_trace_callback(event):
    +    try:
    +        _tls.trace(event, (_tls.leaving, _tls.current))
    +    except:
    +        # In case of exceptions trace function is removed
    +        if hasattr(_tls, 'trace'):
    +            del _tls.trace
    +        raise
    +
    +# ____________________________________________________________
     # Internal stuff
     
     try:
    @@ -143,22 +181,32 @@
         _tls.current = gmain
     
     def _greenlet_start(greenlet, args):
    -    args, kwds = args
    -    _tls.current = greenlet
         try:
    -        res = greenlet.run(*args, **kwds)
    -    except GreenletExit, e:
    -        res = e
    +        args, kwds = args
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            res = greenlet.run(*args, **kwds)
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
     
     def _greenlet_throw(greenlet, exc, value, tb):
    -    _tls.current = greenlet
         try:
    -        raise exc, value, tb
    -    except GreenletExit, e:
    -        res = e
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            raise exc, value, tb
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
    diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
    --- a/pypy/config/pypyoption.py
    +++ b/pypy/config/pypyoption.py
    @@ -76,10 +76,10 @@
         if "cppyy" in working_modules:
             working_modules.remove("cppyy")  # depends on ctypes
     
    -if sys.platform.startswith("linux"):
    -    _mach = os.popen('uname -m', 'r').read().strip()
    -    if _mach.startswith('ppc'):
    -        working_modules.remove("_continuation")
    +#if sys.platform.startswith("linux"):
    +#    _mach = os.popen('uname -m', 'r').read().strip()
    +#    if _mach.startswith(...):
    +#        working_modules.remove("_continuation")
     
     
     module_dependencies = {
    diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
    --- a/pypy/doc/build.rst
    +++ b/pypy/doc/build.rst
    @@ -85,13 +85,16 @@
     _ssl
         libssl
     
    +gdbm
    +    libgdbm-dev
    +
     Make sure to have these libraries (with development headers) installed before
     building PyPy, otherwise the resulting binary will not contain these modules.
     
     On Debian, this is the command to install all build-time dependencies::
     
         apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \
    -    libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev
    +    libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev
     
     For the optional lzma module on PyPy3 you will also need ``liblzma-dev``.
     
    diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
    --- a/pypy/doc/contributor.rst
    +++ b/pypy/doc/contributor.rst
    @@ -26,15 +26,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    -  Richard Plangger
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -170,9 +170,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -204,6 +207,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -214,6 +218,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -223,6 +228,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -280,13 +286,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -298,6 +307,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/pypy/doc/index-of-release-notes.rst b/pypy/doc/index-of-release-notes.rst
    --- a/pypy/doc/index-of-release-notes.rst
    +++ b/pypy/doc/index-of-release-notes.rst
    @@ -6,6 +6,7 @@
     
     .. toctree::
     
    +   release-4.0.1.rst
        release-4.0.0.rst
        release-2.6.1.rst
        release-2.6.0.rst
    diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst
    --- a/pypy/doc/index-of-whatsnew.rst
    +++ b/pypy/doc/index-of-whatsnew.rst
    @@ -7,6 +7,7 @@
     .. toctree::
     
        whatsnew-head.rst
    +   whatsnew-4.0.1.rst
        whatsnew-4.0.0.rst
        whatsnew-2.6.1.rst
        whatsnew-2.6.0.rst
    diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/release-4.0.1.rst
    @@ -0,0 +1,106 @@
    +==========
    +PyPy 4.0.1
    +==========
    +
    +We have released PyPy 4.0.1, three weeks after PyPy 4.0.0. We have fixed
    +a few critical bugs in the JIT compiled code, reported by users. We therefore
    +encourage all users of PyPy to update to this version. There are a few minor
    +enhancements in this version as well.
    +
    +You can download the PyPy 4.0.1 release here:
    +
    +    http://pypy.org/download.html
    +
    +We would like to thank our donors for the continued support of the PyPy
    +project.
    +
    +We would also like to thank our contributors and 
    +encourage new people to join the project. PyPy has many
    +layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation
    +improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ 
    +with making RPython's JIT even better. 
    +
    +CFFI
    +====
    +
    +While not applicable only to PyPy, `cffi`_ is arguably our most significant
    +contribution to the python ecosystem. PyPy 4.0.1 ships with 
    +`cffi-1.3.1`_ with the improvements it brings.
    +
    +.. _`PyPy`: http://doc.pypy.org 
    +.. _`RPython`: https://rpython.readthedocs.org
    +.. _`cffi`: https://cffi.readthedocs.org
    +.. _`cffi-1.3.1`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-1
    +.. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly
    +.. _`help`: http://doc.pypy.org/en/latest/project-ideas.html
    +.. _`numpy`: https://bitbucket.org/pypy/numpy
    +
    +What is PyPy?
    +=============
    +
    +PyPy is a very compliant Python interpreter, almost a drop-in replacement for
    +CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison)
    +due to its integrated tracing JIT compiler.
    +
    +We also welcome developers of other
    +`dynamic languages`_ to see what RPython can do for them.
    +
    +This release supports **x86** machines on most common operating systems
    +(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd),
    +newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the
    +big- and little-endian variants of **ppc64** running Linux.
    +
    +.. _`pypy and cpython 2.7.x`: http://speed.pypy.org
    +.. _`dynamic languages`: http://pypyjs.org
    +
    +Other Highlights (since 4.0.0 released three weeks ago)
    +=======================================================
    +
    +* Bug Fixes
    +
    +  * Fix a bug when unrolling double loops in JITted code
    +
    +  * Fix multiple memory leaks in the ssl module, one of which affected
    +    `cpython` as well (thanks to Alex Gaynor for pointing those out)
    +
    +  * Use pkg-config to find ssl headers on OS-X
    +
    +  * Issues reported with our previous release were resolved_ after reports from users on
    +    our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
    +    #pypy
    +
    +* New features:
    +
    +  * Internal cleanup of RPython class handling
    +
    +  * Support stackless and greenlets on PPC machines
    +
    +  * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d
    +    for example to have all subprocesses write the JIT log to a file
    +    called 'log.%d', with '%d' replaced with the subprocess' PID.
    +
    +  * Support PyOS_double_to_string in our cpyext capi compatibility layer
    +
    +* Numpy:
    +
    +  * Improve support for __array_interface__
    +
    +  * Propagate NAN mantissas through float16-float32-float64 conversions
    +
    +
    +* Performance improvements and refactorings:
    +
    +  * Improvements in slicing byte arrays
    +
    +  * Improvements in enumerate()
    +
    +  * Silence some warnings while translating
    +
    +.. _resolved: http://doc.pypy.org/en/latest/whatsnew-4.0.1.html
    +
    +Please update, and continue to help us make PyPy better.
    +
    +Cheers
    +
    +The PyPy Team
    +
    diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
    --- a/pypy/doc/tool/makecontributor.py
    +++ b/pypy/doc/tool/makecontributor.py
    @@ -69,7 +69,9 @@
         'Rami Chowdhury': ['necaris'],
         'Stanislaw Halik':['w31rd0'],
         'Wenzhu Man':['wenzhu man', 'wenzhuman'],
    -    'Anton Gulenko':['anton gulenko'],
    +    'Anton Gulenko':['anton gulenko', 'anton_gulenko'],
    +    'Richard Lancaster':['richardlancaster'],
    +    'William Leslie':['William ML Leslie'],
         }
     
     alias_map = {}
    diff --git a/pypy/doc/whatsnew-4.0.1.rst b/pypy/doc/whatsnew-4.0.1.rst
    new file mode 100644
    --- /dev/null
    +++ b/pypy/doc/whatsnew-4.0.1.rst
    @@ -0,0 +1,35 @@
    +=========================
    +What's new in PyPy 4.0.1
    +=========================
    +
    +.. this is a revision shortly after release-4.0.0
    +.. startrev: 57c9a47c70f6
    +
    +.. branch: 2174-fix-osx-10-11-translation
    +
    +Use pkg-config to find ssl headers on OS-X
    +
    +.. branch: Zearin/minor-whatsnewrst-markup-tweaks-edited-o-1446387512092
    +
    +.. branch: ppc-stacklet
    +
    +The PPC machines now support the _continuation module (stackless, greenlets)
    +
    +.. branch: int_0/i-need-this-library-to-build-on-ubuntu-1-1446717626227
    +
    +Document that libgdbm-dev is required for translation/packaging
    +
    +.. branch: propogate-nans
    +
    +Ensure that ndarray conversion from int16->float16->float32->float16->int16
    +preserves all int16 values, even across nan conversions. Also fix argmax, argmin
    +for nan comparisons
    +
    +.. branch: array_interface
    +
    +Support common use-cases for __array_interface__, passes upstream tests
    +
    +.. branch: no-class-specialize
    +
    +Some refactoring of class handling in the annotator. 
    +Remove class specialisation and _settled_ flag.
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -1,10 +1,18 @@
     =========================
    -What's new in PyPy 4.0.+
    +What's new in PyPy 4.1.+
     =========================
     
    -.. this is a revision shortly after release-4.0.0
    -.. startrev: 57c9a47c70f6
    +.. this is a revision shortly after release-4.0.1
    +.. startrev: 4b5c840d0da2
     
    -.. branch: 2174-fix-osx-10-11-translation
    +.. branch: numpy-1.10
     
    -Use pkg-config to find ssl headers on OS-X
    +Fix tests to run cleanly with -A and start to fix micronumpy for upstream numpy
    +which is now 1.10.2
    +
    +.. branch: osx-flat-namespace
    +
    +Fix the cpyext tests on OSX by linking with -flat_namespace
    +
    +.. branch: anntype
    +Refactor and improve exception analysis in the annotator.
    diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
    --- a/pypy/interpreter/baseobjspace.py
    +++ b/pypy/interpreter/baseobjspace.py
    @@ -28,7 +28,6 @@
         """This is the abstract root class of all wrapped objects that live
         in a 'normal' object space like StdObjSpace."""
         __slots__ = ()
    -    _settled_ = True
         user_overridden_class = False
     
         def getdict(self, space):
    @@ -392,7 +391,7 @@
             self.check_signal_action = None   # changed by the signal module
             self.user_del_action = UserDelAction(self)
             self._code_of_sys_exc_info = None
    -
    +        
             # can be overridden to a subclass
             self.initialize()
     
    diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
    --- a/pypy/interpreter/pycode.py
    +++ b/pypy/interpreter/pycode.py
    @@ -50,6 +50,9 @@
         kwargname = varnames[argcount] if code.co_flags & CO_VARKEYWORDS else None
         return Signature(argnames, varargname, kwargname)
     
    +class CodeHookCache(object):
    +    def __init__(self, space):
    +        self._code_hook = None
     
     class PyCode(eval.Code):
         "CPython-style code objects."
    @@ -86,6 +89,15 @@
             self._signature = cpython_code_signature(self)
             self._initialize()
             self._init_ready()
    +        self.new_code_hook()
    +
    +    def new_code_hook(self):
    +        code_hook = self.space.fromcache(CodeHookCache)._code_hook
    +        if code_hook is not None:
    +            try:
    +                self.space.call_function(code_hook, self)
    +            except OperationError, e:
    +                e.write_unraisable(self.space, "new_code_hook()")
     
         def _initialize(self):
             if self.co_cellvars:
    diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py
    --- a/pypy/interpreter/test/test_zzpickle_and_slow.py
    +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
    @@ -390,15 +390,20 @@
     
         def test_pickle_enum(self):
             import pickle
    -        e      = enumerate(range(10))
    +        e = enumerate(range(100, 106))
             e.next()
             e.next()
             pckl   = pickle.dumps(e)
             result = pickle.loads(pckl)
    -        e.next()
    -        result.next()
    +        res = e.next()
    +        assert res == (2, 102)
    +        res = result.next()
    +        assert res == (2, 102)
             assert type(e) is type(result)
    -        assert list(e) == list(result)
    +        res = list(e)
    +        assert res == [(3, 103), (4, 104), (5, 105)]
    +        res = list(result)
    +        assert res == [(3, 103), (4, 104), (5, 105)]
     
         def test_pickle_xrangeiter(self):
             import pickle
    diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py
    --- a/pypy/module/__builtin__/functional.py
    +++ b/pypy/module/__builtin__/functional.py
    @@ -8,7 +8,7 @@
     from pypy.interpreter.error import OperationError
     from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
     from pypy.interpreter.typedef import TypeDef
    -from rpython.rlib import jit
    +from rpython.rlib import jit, rarithmetic
     from rpython.rlib.objectmodel import specialize
     from rpython.rlib.rarithmetic import r_uint, intmask
     from rpython.rlib.rbigint import rbigint
    @@ -229,27 +229,70 @@
         return min_max(space, __args__, "min")
     
     
    +
     class W_Enumerate(W_Root):
    -    def __init__(self, w_iter, w_start):
    -        self.w_iter = w_iter
    +    def __init__(self, w_iter_or_list, start, w_start):
    +        # 'w_index' should never be a wrapped int here; if it would be,
    +        # then it is actually None and the unwrapped int is in 'index'.
    +        self.w_iter_or_list = w_iter_or_list
    +        self.index = start
             self.w_index = w_start
     
         def descr___new__(space, w_subtype, w_iterable, w_start=None):
    -        self = space.allocate_instance(W_Enumerate, w_subtype)
    +        from pypy.objspace.std.listobject import W_ListObject
    +
             if w_start is None:
    -            w_start = space.wrap(0)
    +            start = 0
             else:
                 w_start = space.index(w_start)
    -        self.__init__(space.iter(w_iterable), w_start)
    +            if space.is_w(space.type(w_start), space.w_int):
    +                start = space.int_w(w_start)
    +                w_start = None
    +            else:
    +                start = -1
    +
    +        if start == 0 and type(w_iterable) is W_ListObject:
    +            w_iter = w_iterable
    +        else:
    +            w_iter = space.iter(w_iterable)
    +
    +        self = space.allocate_instance(W_Enumerate, w_subtype)
    +        self.__init__(w_iter, start, w_start)
             return space.wrap(self)
     
         def descr___iter__(self, space):
             return space.wrap(self)
     
         def descr_next(self, space):
    -        w_item = space.next(self.w_iter)
    +        from pypy.objspace.std.listobject import W_ListObject
             w_index = self.w_index
    -        self.w_index = space.add(w_index, space.wrap(1))
    +        w_iter_or_list = self.w_iter_or_list
    +        w_item = None
    +        if w_index is None:
    +            index = self.index
    +            if type(w_iter_or_list) is W_ListObject:
    +                try:
    +                    w_item = w_iter_or_list.getitem(index)
    +                except IndexError:
    +                    self.w_iter_or_list = None
    +                    raise OperationError(space.w_StopIteration, space.w_None)
    +                self.index = index + 1
    +            elif w_iter_or_list is None:
    +                raise OperationError(space.w_StopIteration, space.w_None)
    +            else:
    +                try:
    +                    newval = rarithmetic.ovfcheck(index + 1)
    +                except OverflowError:
    +                    w_index = space.wrap(index)
    +                    self.w_index = space.add(w_index, space.wrap(1))
    +                    self.index = -1
    +                else:
    +                    self.index = newval
    +            w_index = space.wrap(index)
    +        else:
    +            self.w_index = space.add(w_index, space.wrap(1))
    +        if w_item is None:
    +            w_item = space.next(self.w_iter_or_list)
             return space.newtuple([w_index, w_item])
     
         def descr___reduce__(self, space):
    @@ -257,12 +300,20 @@
             w_mod    = space.getbuiltinmodule('_pickle_support')
             mod      = space.interp_w(MixedModule, w_mod)
             w_new_inst = mod.get('enumerate_new')
    -        w_info = space.newtuple([self.w_iter, self.w_index])
    +        w_index = self.w_index
    +        if w_index is None:
    +            w_index = space.wrap(self.index)
    +        w_info = space.newtuple([self.w_iter_or_list, w_index])
             return space.newtuple([w_new_inst, w_info])
     
     # exported through _pickle_support
    -def _make_enumerate(space, w_iter, w_index):
    -    return space.wrap(W_Enumerate(w_iter, w_index))
    +def _make_enumerate(space, w_iter_or_list, w_index):
    +    if space.is_w(space.type(w_index), space.w_int):
    +        index = space.int_w(w_index)
    +        w_index = None
    +    else:
    +        index = -1
    +    return space.wrap(W_Enumerate(w_iter_or_list, index, w_index))
     
     W_Enumerate.typedef = TypeDef("enumerate",
         __new__=interp2app(W_Enumerate.descr___new__.im_func),
    diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py
    --- a/pypy/module/__builtin__/test/test_builtin.py
    +++ b/pypy/module/__builtin__/test/test_builtin.py
    @@ -264,6 +264,7 @@
             raises(StopIteration,x.next)
     
         def test_enumerate(self):
    +        import sys
             seq = range(2,4)
             enum = enumerate(seq)
             assert enum.next() == (0, 2)
    @@ -274,6 +275,15 @@
             enum = enumerate(range(5), 2)
             assert list(enum) == zip(range(2, 7), range(5))
     
    +        enum = enumerate(range(2), 2**100)
    +        assert list(enum) == [(2**100, 0), (2**100+1, 1)]
    +
    +        enum = enumerate(range(2), sys.maxint)
    +        assert list(enum) == [(sys.maxint, 0), (sys.maxint+1, 1)]
    +
    +        raises(TypeError, enumerate, range(2), 5.5)
    +
    +
         def test_next(self):
             x = iter(['a', 'b', 'c'])
             assert next(x) == 'a'
    diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py
    --- a/pypy/module/__pypy__/__init__.py
    +++ b/pypy/module/__pypy__/__init__.py
    @@ -86,6 +86,7 @@
             'specialized_zip_2_lists'   : 'interp_magic.specialized_zip_2_lists',
             'set_debug'                 : 'interp_magic.set_debug',
             'locals_to_fast'            : 'interp_magic.locals_to_fast',
    +        'set_code_callback'         : 'interp_magic.set_code_callback',
             'save_module_content_for_future_reload':
                               'interp_magic.save_module_content_for_future_reload',
         }
    diff --git a/pypy/module/__pypy__/interp_magic.py b/pypy/module/__pypy__/interp_magic.py
    --- a/pypy/module/__pypy__/interp_magic.py
    +++ b/pypy/module/__pypy__/interp_magic.py
    @@ -1,5 +1,6 @@
     from pypy.interpreter.error import OperationError, wrap_oserror
     from pypy.interpreter.gateway import unwrap_spec
    +from pypy.interpreter.pycode import CodeHookCache
     from pypy.interpreter.pyframe import PyFrame
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib.objectmodel import we_are_translated
    @@ -151,3 +152,10 @@
     def specialized_zip_2_lists(space, w_list1, w_list2):
         from pypy.objspace.std.specialisedtupleobject import specialized_zip_2_lists
         return specialized_zip_2_lists(space, w_list1, w_list2)
    +
    +def set_code_callback(space, w_callable):
    +    cache = space.fromcache(CodeHookCache)
    +    if space.is_none(w_callable):
    +        cache._code_hook = None
    +    else:
    +        cache._code_hook = w_callable
    \ No newline at end of file
    diff --git a/pypy/module/__pypy__/test/test_magic.py b/pypy/module/__pypy__/test/test_magic.py
    --- a/pypy/module/__pypy__/test/test_magic.py
    +++ b/pypy/module/__pypy__/test/test_magic.py
    @@ -13,3 +13,21 @@
             #
             sys.dont_write_bytecode = d
             __pypy__.save_module_content_for_future_reload(sys)
    +
    +    def test_new_code_hook(self):
    +        l = []
    +
    +        def callable(code):
    +            l.append(code)
    +
    +        import __pypy__
    +        __pypy__.set_code_callback(callable)
    +        d = {}
    +        try:
    +            exec """
    +def f():
    +    pass
    +""" in d
    +        finally:
    +            __pypy__.set_code_callback(None)
    +        assert d['f'].__code__ in l
    \ No newline at end of file
    diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py
    --- a/pypy/module/_cffi_backend/__init__.py
    +++ b/pypy/module/_cffi_backend/__init__.py
    @@ -2,7 +2,7 @@
     from pypy.interpreter.mixedmodule import MixedModule
     from rpython.rlib import rdynload, clibffi
     
    -VERSION = "1.3.0"
    +VERSION = "1.3.1"
     
     FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI
     try:
    @@ -43,6 +43,7 @@
             'newp_handle': 'handle.newp_handle',
             'from_handle': 'handle.from_handle',
             '_get_types': 'func._get_types',
    +        '_get_common_types': 'func._get_common_types',
             'from_buffer': 'func.from_buffer',
     
             'string': 'func.string',
    diff --git a/pypy/module/_cffi_backend/cffi_opcode.py b/pypy/module/_cffi_backend/cffi_opcode.py
    --- a/pypy/module/_cffi_backend/cffi_opcode.py
    +++ b/pypy/module/_cffi_backend/cffi_opcode.py
    @@ -110,6 +110,9 @@
     _UNKNOWN_FLOAT_PRIM    = -2
     _UNKNOWN_LONG_DOUBLE   = -3
     
    +_IO_FILE_STRUCT        = -1
    +
    +
     PRIMITIVE_TO_INDEX = {
         'char':               PRIM_CHAR,
         'short':              PRIM_SHORT,
    diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
    --- a/pypy/module/_cffi_backend/ffi_obj.py
    +++ b/pypy/module/_cffi_backend/ffi_obj.py
    @@ -448,7 +448,7 @@
     
     'alloc' is called with the size as argument.  If it returns NULL, a
     MemoryError is raised.  'free' is called with the result of 'alloc'
    -as argument.  Both can be either Python function or directly C
    +as argument.  Both can be either Python functions or directly C
     functions.  If 'free' is None, then no free function is called.
     If both 'alloc' and 'free' are None, the default is used.
     
    diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py
    --- a/pypy/module/_cffi_backend/func.py
    +++ b/pypy/module/_cffi_backend/func.py
    @@ -84,6 +84,20 @@
     
     # ____________________________________________________________
     
    +def _get_common_types(space, w_dict):
    +    from pypy.module._cffi_backend.parse_c_type import ll_enum_common_types
    +    index = 0
    +    while True:
    +        p = ll_enum_common_types(rffi.cast(rffi.INT, index))
    +        if not p:
    +            break
    +        key = rffi.charp2str(p)
    +        value = rffi.charp2str(rffi.ptradd(p, len(key) + 1))
    +        space.setitem_str(w_dict, key, space.wrap(value))
    +        index += 1
    +
    +# ____________________________________________________________
    +
     def _fetch_as_read_buffer(space, w_x):
         # xxx do we really need to implement the same mess as in CPython 2.7
         # w.r.t. buffers and memoryviews??
    diff --git a/pypy/module/_cffi_backend/parse_c_type.py b/pypy/module/_cffi_backend/parse_c_type.py
    --- a/pypy/module/_cffi_backend/parse_c_type.py
    +++ b/pypy/module/_cffi_backend/parse_c_type.py
    @@ -87,6 +87,8 @@
     ll_set_cdl_realize_global_int = llexternal('pypy_set_cdl_realize_global_int',
                                                [lltype.Ptr(GLOBAL_S)],
                                                lltype.Void)
    +ll_enum_common_types = llexternal('pypy_enum_common_types',
    +                                  [rffi.INT], rffi.CCHARP)
     
     def parse_c_type(info, input):
         p_input = rffi.str2charp(input)
    diff --git a/pypy/module/_cffi_backend/realize_c_type.py b/pypy/module/_cffi_backend/realize_c_type.py
    --- a/pypy/module/_cffi_backend/realize_c_type.py
    +++ b/pypy/module/_cffi_backend/realize_c_type.py
    @@ -74,7 +74,15 @@
         assert len(NAMES) == cffi_opcode._NUM_PRIM
     
         def __init__(self, space):
    +        self.space = space
             self.all_primitives = [None] * cffi_opcode._NUM_PRIM
    +        self.file_struct = None
    +
    +    def get_file_struct(self):
    +        if self.file_struct is None:
    +            self.file_struct = ctypestruct.W_CTypeStruct(self.space, "FILE")
    +        return self.file_struct
    +
     
     def get_primitive_type(ffi, num):
         space = ffi.space
    @@ -266,6 +274,10 @@
     
     
     def _realize_c_struct_or_union(ffi, sindex):
    +    if sindex == cffi_opcode._IO_FILE_STRUCT:
    +        # returns a single global cached opaque type
    +        return ffi.space.fromcache(RealizeCache).get_file_struct()
    +
         s = ffi.ctxobj.ctx.c_struct_unions[sindex]
         type_index = rffi.getintfield(s, 'c_type_index')
         if ffi.cached_types[type_index] is not None:
    @@ -281,7 +293,10 @@
                 x = ctypestruct.W_CTypeUnion(space, name)
             else:
                 name = _realize_name("struct ", s.c_name)
    -            x = ctypestruct.W_CTypeStruct(space, name)
    +            if name == "struct _IO_FILE":
    +                x = space.fromcache(RealizeCache).get_file_struct()
    +            else:
    +                x = ctypestruct.W_CTypeStruct(space, name)
             if (c_flags & cffi_opcode.F_OPAQUE) == 0:
                 assert c_first_field_index >= 0
                 w_ctype = x
    diff --git a/pypy/module/_cffi_backend/src/commontypes.c b/pypy/module/_cffi_backend/src/commontypes.c
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/_cffi_backend/src/commontypes.c
    @@ -0,0 +1,207 @@
    +/* This file must be kept in alphabetical order.  See test_commontypes.py */
    +
    +#define EQ(key, value)    key "\0" value   /* string concatenation */
    +#ifdef _WIN64
    +#  define W32_64(X,Y)  Y
    +# else
    +#  define W32_64(X,Y)  X
    +# endif
    +
    +
    +static const char *common_simple_types[] = {
    +
    +#ifdef MS_WIN32   /* Windows types */
    +    EQ("ATOM", "WORD"),
    +    EQ("BOOL", "int"),
    +    EQ("BOOLEAN", "BYTE"),
    +    EQ("BYTE", "unsigned char"),
    +    EQ("CCHAR", "char"),
    +    EQ("CHAR", "char"),
    +    EQ("COLORREF", "DWORD"),
    +    EQ("DWORD", "unsigned long"),
    +    EQ("DWORD32", "unsigned int"),
    +    EQ("DWORD64", "unsigned long long"),
    +    EQ("DWORDLONG", "ULONGLONG"),
    +    EQ("DWORD_PTR", "ULONG_PTR"),
    +#endif
    +
    +    EQ("FILE", "struct _IO_FILE"),
    +
    +#ifdef MS_WIN32   /* more Windows types */
    +    EQ("FLOAT", "float"),
    +    EQ("HACCEL", "HANDLE"),
    +    EQ("HALF_PTR", W32_64("short","int")),
    +    EQ("HANDLE", "PVOID"),
    +    EQ("HBITMAP", "HANDLE"),
    +    EQ("HBRUSH", "HANDLE"),
    +    EQ("HCOLORSPACE", "HANDLE"),
    +    EQ("HCONV", "HANDLE"),
    +    EQ("HCONVLIST", "HANDLE"),
    +    EQ("HCURSOR", "HICON"),
    +    EQ("HDC", "HANDLE"),
    +    EQ("HDDEDATA", "HANDLE"),
    +    EQ("HDESK", "HANDLE"),
    +    EQ("HDROP", "HANDLE"),
    +    EQ("HDWP", "HANDLE"),
    +    EQ("HENHMETAFILE", "HANDLE"),
    +    EQ("HFILE", "int"),
    +    EQ("HFONT", "HANDLE"),
    +    EQ("HGDIOBJ", "HANDLE"),
    +    EQ("HGLOBAL", "HANDLE"),
    +    EQ("HHOOK", "HANDLE"),
    +    EQ("HICON", "HANDLE"),
    +    EQ("HINSTANCE", "HANDLE"),
    +    EQ("HKEY", "HANDLE"),
    +    EQ("HKL", "HANDLE"),
    +    EQ("HLOCAL", "HANDLE"),
    +    EQ("HMENU", "HANDLE"),
    +    EQ("HMETAFILE", "HANDLE"),
    +    EQ("HMODULE", "HINSTANCE"),
    +    EQ("HMONITOR", "HANDLE"),
    +    EQ("HPALETTE", "HANDLE"),
    +    EQ("HPEN", "HANDLE"),
    +    EQ("HRESULT", "LONG"),
    +    EQ("HRGN", "HANDLE"),
    +    EQ("HRSRC", "HANDLE"),
    +    EQ("HSZ", "HANDLE"),
    +    EQ("HWND", "HANDLE"),
    +    EQ("INT", "int"),
    +    EQ("INT16", "short"),
    +    EQ("INT32", "int"),
    +    EQ("INT64", "long long"),
    +    EQ("INT8", "signed char"),
    +    EQ("INT_PTR", W32_64("int","long long")),
    +    EQ("LANGID", "WORD"),
    +    EQ("LCID", "DWORD"),
    +    EQ("LCTYPE", "DWORD"),
    +    EQ("LGRPID", "DWORD"),
    +    EQ("LONG", "long"),
    +    EQ("LONG32", "int"),
    +    EQ("LONG64", "long long"),
    +    EQ("LONGLONG", "long long"),
    +    EQ("LONG_PTR", W32_64("long","long long")),
    +    EQ("LPARAM", "LONG_PTR"),
    +    EQ("LPBOOL", "BOOL *"),
    +    EQ("LPBYTE", "BYTE *"),
    +    EQ("LPCOLORREF", "DWORD *"),
    +    EQ("LPCSTR", "const char *"),
    +    EQ("LPCVOID", "const void *"),
    +    EQ("LPCWSTR", "const WCHAR *"),
    +    EQ("LPDWORD", "DWORD *"),
    +    EQ("LPHANDLE", "HANDLE *"),
    +    EQ("LPINT", "int *"),
    +    EQ("LPLONG", "long *"),
    +    EQ("LPSTR", "CHAR *"),
    +    EQ("LPVOID", "void *"),
    +    EQ("LPWORD", "WORD *"),
    +    EQ("LPWSTR", "WCHAR *"),
    +    EQ("LRESULT", "LONG_PTR"),
    +    EQ("PBOOL", "BOOL *"),
    +    EQ("PBOOLEAN", "BOOLEAN *"),
    +    EQ("PBYTE", "BYTE *"),
    +    EQ("PCHAR", "CHAR *"),
    +    EQ("PCSTR", "const CHAR *"),
    +    EQ("PCWSTR", "const WCHAR *"),
    +    EQ("PDWORD", "DWORD *"),
    +    EQ("PDWORD32", "DWORD32 *"),
    +    EQ("PDWORD64", "DWORD64 *"),
    +    EQ("PDWORDLONG", "DWORDLONG *"),
    +    EQ("PDWORD_PTR", "DWORD_PTR *"),
    +    EQ("PFLOAT", "FLOAT *"),
    +    EQ("PHALF_PTR", "HALF_PTR *"),
    +    EQ("PHANDLE", "HANDLE *"),
    +    EQ("PHKEY", "HKEY *"),
    +    EQ("PINT", "int *"),
    +    EQ("PINT16", "INT16 *"),
    +    EQ("PINT32", "INT32 *"),
    +    EQ("PINT64", "INT64 *"),
    +    EQ("PINT8", "INT8 *"),
    +    EQ("PINT_PTR", "INT_PTR *"),
    +    EQ("PLCID", "PDWORD"),
    +    EQ("PLONG", "LONG *"),
    +    EQ("PLONG32", "LONG32 *"),
    +    EQ("PLONG64", "LONG64 *"),
    +    EQ("PLONGLONG", "LONGLONG *"),
    +    EQ("PLONG_PTR", "LONG_PTR *"),
    +    EQ("PSHORT", "SHORT *"),
    +    EQ("PSIZE_T", "SIZE_T *"),
    +    EQ("PSSIZE_T", "SSIZE_T *"),
    +    EQ("PSTR", "CHAR *"),
    +    EQ("PUCHAR", "UCHAR *"),
    +    EQ("PUHALF_PTR", "UHALF_PTR *"),
    +    EQ("PUINT", "UINT *"),
    +    EQ("PUINT16", "UINT16 *"),
    +    EQ("PUINT32", "UINT32 *"),
    +    EQ("PUINT64", "UINT64 *"),
    +    EQ("PUINT8", "UINT8 *"),
    +    EQ("PUINT_PTR", "UINT_PTR *"),
    +    EQ("PULONG", "ULONG *"),
    +    EQ("PULONG32", "ULONG32 *"),
    +    EQ("PULONG64", "ULONG64 *"),
    +    EQ("PULONGLONG", "ULONGLONG *"),
    +    EQ("PULONG_PTR", "ULONG_PTR *"),
    +    EQ("PUSHORT", "USHORT *"),
    +    EQ("PVOID", "void *"),
    +    EQ("PWCHAR", "WCHAR *"),
    +    EQ("PWORD", "WORD *"),
    +    EQ("PWSTR", "WCHAR *"),
    +    EQ("QWORD", "unsigned long long"),
    +    EQ("SC_HANDLE", "HANDLE"),
    +    EQ("SC_LOCK", "LPVOID"),
    +    EQ("SERVICE_STATUS_HANDLE", "HANDLE"),
    +    EQ("SHORT", "short"),
    +    EQ("SIZE_T", "ULONG_PTR"),
    +    EQ("SSIZE_T", "LONG_PTR"),
    +    EQ("UCHAR", "unsigned char"),
    +    EQ("UHALF_PTR", W32_64("unsigned short","unsigned int")),
    +    EQ("UINT", "unsigned int"),
    +    EQ("UINT16", "unsigned short"),
    +    EQ("UINT32", "unsigned int"),
    +    EQ("UINT64", "unsigned long long"),
    +    EQ("UINT8", "unsigned char"),
    +    EQ("UINT_PTR", W32_64("unsigned int","unsigned long long")),
    +    EQ("ULONG", "unsigned long"),
    +    EQ("ULONG32", "unsigned int"),
    +    EQ("ULONG64", "unsigned long long"),
    +    EQ("ULONGLONG", "unsigned long long"),
    +    EQ("ULONG_PTR", W32_64("unsigned long","unsigned long long")),
    +    EQ("USHORT", "unsigned short"),
    +    EQ("USN", "LONGLONG"),
    +    EQ("VOID", "void"),
    +    EQ("WCHAR", "wchar_t"),
    +    EQ("WINSTA", "HANDLE"),
    +    EQ("WORD", "unsigned short"),
    +    EQ("WPARAM", "UINT_PTR"),
    +#endif
    +
    +    EQ("bool", "_Bool"),
    +};
    +
    +
    +#undef EQ
    +#undef W32_64
    +
    +#define num_common_simple_types    \
    +    (sizeof(common_simple_types) / sizeof(common_simple_types[0]))
    +
    +
    +static const char *get_common_type(const char *search, size_t search_len)
    +{
    +    const char *entry;
    +    int index = search_sorted(common_simple_types, sizeof(const char *),
    +                              num_common_simple_types, search, search_len);
    +    if (index < 0)
    +        return NULL;
    +
    +    entry = common_simple_types[index];
    +    return entry + strlen(entry) + 1;
    +}
    +
    +RPY_EXTERN
    +char *pypy_enum_common_types(int index)
    +{
    +    if (index < num_common_simple_types)
    +        return (char *)(common_simple_types[index]);
    +    else
    +        return NULL;
    +}
    diff --git a/pypy/module/_cffi_backend/src/parse_c_type.c b/pypy/module/_cffi_backend/src/parse_c_type.c
    --- a/pypy/module/_cffi_backend/src/parse_c_type.c
    +++ b/pypy/module/_cffi_backend/src/parse_c_type.c
    @@ -4,6 +4,7 @@
     #include 
     
     #if defined(_MSC_VER)
    +# define MS_WIN32
     typedef size_t uintptr_t;
     #else
     # include 
    @@ -231,6 +232,8 @@
     #define MAX_SSIZE_T  (((size_t)-1) >> 1)
     
     static int parse_complete(token_t *tok);
    +static const char *get_common_type(const char *search, size_t search_len);
    +static int parse_common_type_replacement(token_t *tok, const char *replacement);
     
     static int parse_sequel(token_t *tok, int outer)
     {
    @@ -387,11 +390,18 @@
     
                 case TOK_INTEGER:
                     errno = 0;
    -#ifndef _MSC_VER
    -                if (sizeof(length) > sizeof(unsigned long))
    +                if (sizeof(length) > sizeof(unsigned long)) {
    +#ifdef MS_WIN32
    +# ifdef _WIN64
    +                    length = _strtoui64(tok->p, &endptr, 0);
    +# else
    +                    abort();  /* unreachable */
    +# endif
    +#else
                         length = strtoull(tok->p, &endptr, 0);
    +#endif
    +                }
                     else
    -#endif
                         length = strtoul(tok->p, &endptr, 0);
                     if (endptr != tok->p + tok->size)
                         return parse_error(tok, "invalid number");
    @@ -446,26 +456,34 @@
         return _CFFI_GETARG(result);
     }
     
    +static int search_sorted(const char *const *base,
    +                         size_t item_size, int array_len,
    +                         const char *search, size_t search_len)
    +{
    +    int left = 0, right = array_len;
    +    const char *baseptr = (const char *)base;
     
    -#define MAKE_SEARCH_FUNC(FIELD)                                 \
    -  RPY_EXTERN int                                                \
    -  pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx,\
    -                        const char *search, size_t search_len)  \
    -  {                                                             \
    -      int left = 0, right = ctx->num_##FIELD;                   \
    -                                                                \
    -      while (left < right) {                                    \
    -          int middle = (left + right) / 2;                      \
    -          const char *src = ctx->FIELD[middle].name;            \
    -          int diff = strncmp(src, search, search_len);          \
    -          if (diff == 0 && src[search_len] == '\0')             \
    -              return middle;                                    \
    -          else if (diff >= 0)                                   \
    -              right = middle;                                   \
    -          else                                                  \
    -              left = middle + 1;                                \
    -      }                                                         \
    -      return -1;                                                \
    +    while (left < right) {
    +        int middle = (left + right) / 2;
    +        const char *src = *(const char *const *)(baseptr + middle * item_size);
    +        int diff = strncmp(src, search, search_len);
    +        if (diff == 0 && src[search_len] == '\0')
    +            return middle;
    +        else if (diff >= 0)
    +            right = middle;
    +        else
    +            left = middle + 1;
    +    }
    +    return -1;
    +}
    +
    +#define MAKE_SEARCH_FUNC(FIELD)                                         \
    +  RPY_EXTERN int                                                        \
    +  pypy_search_in_##FIELD(const struct _cffi_type_context_s *ctx,        \
    +                        const char *search, size_t search_len)          \
    +  {                                                                     \
    +      return search_sorted(&ctx->FIELD->name, sizeof(*ctx->FIELD),      \
    +                           ctx->num_##FIELD, search, search_len);       \
       }
     
     MAKE_SEARCH_FUNC(globals)
    @@ -719,6 +737,7 @@
                 break;
             case TOK_IDENTIFIER:
             {
    +            const char *replacement;
                 int n = search_in_typenames(tok->info->ctx, tok->p, tok->size);
                 if (n >= 0) {
                     t1 = _CFFI_OP(_CFFI_OP_TYPENAME, n);
    @@ -729,6 +748,14 @@
                     t1 = _CFFI_OP(_CFFI_OP_PRIMITIVE, n);
                     break;
                 }
    +            replacement = get_common_type(tok->p, tok->size);
    +            if (replacement != NULL) {
    +                n = parse_common_type_replacement(tok, replacement);
    +                if (n < 0)
    +                    return parse_error(tok, "internal error, please report!");
    +                t1 = _CFFI_OP(_CFFI_OP_NOOP, n);
    +                break;
    +            }
                 return parse_error(tok, "undefined type name");
             }
             case TOK_STRUCT:
    @@ -740,10 +767,15 @@
                     return parse_error(tok, "struct or union name expected");
     
                 n = search_in_struct_unions(tok->info->ctx, tok->p, tok->size);
    -            if (n < 0)
    -                return parse_error(tok, "undefined struct/union name");
    -            if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION) != 0)
    -                ^ (kind == TOK_UNION))
    +            if (n < 0) {
    +                if (kind == TOK_STRUCT && tok->size == 8 &&
    +                        !memcmp(tok->p, "_IO_FILE", 8))
    +                    n = _CFFI__IO_FILE_STRUCT;
    +                else
    +                    return parse_error(tok, "undefined struct/union name");
    +            }
    +            else if (((tok->info->ctx->struct_unions[n].flags & _CFFI_F_UNION)
    +                      != 0) ^ (kind == TOK_UNION))
                     return parse_error(tok, "wrong kind of tag: struct vs union");
     
                 t1 = _CFFI_OP(_CFFI_OP_STRUCT_UNION, n);
    @@ -773,8 +805,9 @@
     }
     
     
    -RPY_EXTERN
    -int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input)
    +static
    +int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index,
    +                      const char *input)
     {
         int result;
         token_t token;
    @@ -785,16 +818,33 @@
         token.p = input;
         token.size = 0;
         token.output = info->output;
    -    token.output_index = 0;
    +    token.output_index = *output_index;
     
         next_token(&token);
         result = parse_complete(&token);
     
    +    *output_index = token.output_index;
         if (token.kind != TOK_END)
             return parse_error(&token, "unexpected symbol");
         return result;
     }
     
    +RPY_EXTERN
    +int pypy_parse_c_type(struct _cffi_parse_info_s *info, const char *input)
    +{
    +    size_t output_index = 0;
    +    return parse_c_type_from(info, &output_index, input);
    +}
    +
    +static
    +int parse_common_type_replacement(token_t *tok, const char *replacement)
    +{
    +    return parse_c_type_from(tok->info, &tok->output_index, replacement);
    +}
    +
    +
    +#include "commontypes.c"      /* laziness hack: include this file here */
    +
     
     /************************************************************/
     /* extra from cdlopen.c                                     */
    diff --git a/pypy/module/_cffi_backend/src/parse_c_type.h b/pypy/module/_cffi_backend/src/parse_c_type.h
    --- a/pypy/module/_cffi_backend/src/parse_c_type.h
    +++ b/pypy/module/_cffi_backend/src/parse_c_type.h
    @@ -5,7 +5,7 @@
     
     #define _CFFI_OP(opcode, arg)   (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8))
     #define _CFFI_GETOP(cffi_opcode)    ((unsigned char)(uintptr_t)cffi_opcode)
    -#define _CFFI_GETARG(cffi_opcode)   (((uintptr_t)cffi_opcode) >> 8)
    +#define _CFFI_GETARG(cffi_opcode)   (((intptr_t)cffi_opcode) >> 8)
     
     #define _CFFI_OP_PRIMITIVE       1
     #define _CFFI_OP_POINTER         3
    @@ -25,6 +25,8 @@
     #define _CFFI_OP_CONSTANT_INT   31
     #define _CFFI_OP_GLOBAL_VAR     33
     #define _CFFI_OP_DLOPEN_FUNC    35
    +#define _CFFI_OP_DLOPEN_CONST   37
    +#define _CFFI_OP_GLOBAL_VAR_F   39
     
     #define _CFFI_PRIM_VOID          0
     #define _CFFI_PRIM_BOOL          1
    @@ -77,6 +79,11 @@
     #define _CFFI_PRIM_UINTMAX      47
     
     #define _CFFI__NUM_PRIM         48
    +#define _CFFI__UNKNOWN_PRIM           (-1)
    +#define _CFFI__UNKNOWN_FLOAT_PRIM     (-2)
    +#define _CFFI__UNKNOWN_LONG_DOUBLE    (-3)
    +
    +#define _CFFI__IO_FILE_STRUCT         (-1)
     
     
     struct _cffi_global_s {
    @@ -164,4 +171,6 @@
                                  const char *search, size_t search_len);
     RPY_EXTERN
     void pypy_set_cdl_realize_global_int(struct _cffi_global_s *target);
    +RPY_EXTERN
    +char *pypy_enum_common_types(int index);
     #endif
    diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
    --- a/pypy/module/_cffi_backend/test/_backend_test_c.py
    +++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
    @@ -1,7 +1,7 @@
     # ____________________________________________________________
     
     import sys
    -assert __version__ == "1.3.0", ("This test_c.py file is for testing a version"
    +assert __version__ == "1.3.1", ("This test_c.py file is for testing a version"
                                     " of cffi that differs from the one that we"
                                     " get from 'import _cffi_backend'")
     if sys.version_info < (3,):
    @@ -3509,3 +3509,8 @@
             assert repr(BFunc) == ""
         else:
             assert repr(BFunc) == ""
    +
    +def test_get_common_types():
    +    d = {}
    +    _get_common_types(d)
    +    assert d['bool'] == '_Bool'
    diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py
    --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py
    +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py
    @@ -424,3 +424,26 @@
                 return ffi.NULL
             alloc5 = ffi.new_allocator(myalloc5)
             raises(MemoryError, alloc5, "int[5]")
    +
    +    def test_bool_issue228(self):
    +        import _cffi_backend as _cffi1_backend
    +        ffi = _cffi1_backend.FFI()
    +        fntype = ffi.typeof("int(*callback)(bool is_valid)")
    +        assert repr(fntype.args[0]) == ""
    +
    +    def test_FILE_issue228(self):
    +        import _cffi_backend as _cffi1_backend
    +        fntype1 = _cffi1_backend.FFI().typeof("FILE *")
    +        fntype2 = _cffi1_backend.FFI().typeof("FILE *")
    +        assert repr(fntype1) == ""
    +        assert fntype1 is fntype2
    +
    +    def test_cast_from_int_type_to_bool(self):
    +        import _cffi_backend as _cffi1_backend
    +        ffi = _cffi1_backend.FFI()
    +        for basetype in ['char', 'short', 'int', 'long', 'long long']:
    +            for sign in ['signed', 'unsigned']:
    +                type = '%s %s' % (sign, basetype)
    +                assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1
    +                assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1
    +                assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0
    diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py b/pypy/module/_cffi_backend/test/test_recompiler.py
    --- a/pypy/module/_cffi_backend/test/test_recompiler.py
    +++ b/pypy/module/_cffi_backend/test/test_recompiler.py
    @@ -16,8 +16,8 @@
             from cffi import ffiplatform
         except ImportError:
             py.test.skip("system cffi module not found or older than 1.0.0")
    -    if cffi.__version_info__ < (1, 2, 0):
    -        py.test.skip("system cffi module needs to be at least 1.2.0")
    +    if cffi.__version_info__ < (1, 3, 0):
    +        py.test.skip("system cffi module needs to be at least 1.3.0")
         space.appexec([], """():
             import _cffi_backend     # force it to be initialized
         """)
    @@ -28,6 +28,7 @@
         module_name = '_CFFI_' + module_name
         rdir = udir.ensure('recompiler', dir=1)
         rdir.join('Python.h').write(
    +        '#include \n'
             '#define PYPY_VERSION XX\n'
             '#define PyMODINIT_FUNC /*exported*/ void\n'
             )
    @@ -1076,3 +1077,302 @@
             raises(ffi.error, getattr, lib, 'my_value')
             e = raises(ffi.error, setattr, lib, 'my_value', 50)
             assert str(e.value) == "global variable 'my_value' is at address NULL"
    +
    +    def test_const_fields(self):
    +        ffi, lib = self.prepare(
    +            """struct foo_s { const int a; void *const b; };""",
    +            'test_const_fields',
    +            """struct foo_s { const int a; void *const b; };""")
    +        foo_s = ffi.typeof("struct foo_s")
    +        assert foo_s.fields[0][0] == 'a'
    +        assert foo_s.fields[0][1].type is ffi.typeof("int")
    +        assert foo_s.fields[1][0] == 'b'
    +        assert foo_s.fields[1][1].type is ffi.typeof("void *")
    +
    +    def test_restrict_fields(self):
    +        ffi, lib = self.prepare(
    +            """struct foo_s { void * restrict b; };""",
    +            'test_restrict_fields',
    +            """struct foo_s { void * __restrict b; };""")
    +        foo_s = ffi.typeof("struct foo_s")
    +        assert foo_s.fields[0][0] == 'b'
    +        assert foo_s.fields[0][1].type is ffi.typeof("void *")
    +
    +    def test_volatile_fields(self):
    +        ffi, lib = self.prepare(
    +            """struct foo_s { void * volatile b; };""",
    +            'test_volatile_fields',
    +            """struct foo_s { void * volatile b; };""")
    +        foo_s = ffi.typeof("struct foo_s")
    +        assert foo_s.fields[0][0] == 'b'
    +        assert foo_s.fields[0][1].type is ffi.typeof("void *")
    +
    +    def test_const_array_fields(self):
    +        ffi, lib = self.prepare(
    +            """struct foo_s { const int a[4]; };""",
    +            'test_const_array_fields',
    +            """struct foo_s { const int a[4]; };""")
    +        foo_s = ffi.typeof("struct foo_s")
    +        assert foo_s.fields[0][0] == 'a'
    +        assert foo_s.fields[0][1].type is ffi.typeof("int[4]")
    +
    +    def test_const_array_fields_varlength(self):
    +        ffi, lib = self.prepare(
    +            """struct foo_s { const int a[]; ...; };""",
    +            'test_const_array_fields_varlength',
    +            """struct foo_s { const int a[4]; };""")
    +        foo_s = ffi.typeof("struct foo_s")
    +        assert foo_s.fields[0][0] == 'a'
    +        assert foo_s.fields[0][1].type is ffi.typeof("int[]")
    +
    +    def test_const_array_fields_unknownlength(self):
    +        ffi, lb = self.prepare(
    +            """struct foo_s { const int a[...]; ...; };""",
    +            'test_const_array_fields_unknownlength',
    +            """struct foo_s { const int a[4]; };""")
    
    From noreply at buildbot.pypy.org  Sat Nov 21 15:23:14 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Sat, 21 Nov 2015 21:23:14 +0100 (CET)
    Subject: [pypy-commit] pypy default: test, fix failures due to dtype=(('O',
     spec)) union, demarcate probable bug in upstream frompyfunc
    Message-ID: <20151121202314.8ED951C1248@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r80821:dcf9a1751e29
    Date: 2015-11-21 22:23 +0200
    http://bitbucket.org/pypy/pypy/changeset/dcf9a1751e29/
    
    Log:	test, fix failures due to dtype=(('O', spec)) union, demarcate
    	probable bug in upstream frompyfunc
    
    diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
    --- a/pypy/module/micronumpy/descriptor.py
    +++ b/pypy/module/micronumpy/descriptor.py
    @@ -422,6 +422,10 @@
             if space.is_w(self, w_other):
                 return True
             if isinstance(w_other, W_Dtype):
    +            if self.is_object() and w_other.is_object():
    +                # ignore possible 'record' unions
    +                # created from dtype(('O', spec))
    +                return True
                 return space.eq_w(self.descr_reduce(space),
                                   w_other.descr_reduce(space))
             return False
    @@ -1017,7 +1021,8 @@
                     raise oefmt(space.w_ValueError,
                         'mismatch in size of old and new data-descriptor')
                 retval = W_Dtype(w_dtype.itemtype, w_dtype.w_box_type,
    -                    names=w_dtype1.names[:], fields=w_dtype1.fields.copy())
    +                    names=w_dtype1.names[:], fields=w_dtype1.fields.copy(),
    +                    elsize=w_dtype1.elsize)
                 return retval
         if space.is_none(w_dtype):
             return cache.w_float64dtype
    diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
    --- a/pypy/module/micronumpy/ndarray.py
    +++ b/pypy/module/micronumpy/ndarray.py
    @@ -1002,7 +1002,7 @@
         # --------------------- operations ----------------------------
         # TODO: support all kwargs like numpy ufunc_object.c
         sig = None
    -    cast = 'unsafe'
    +    cast = 'safe'
         extobj = None
     
     
    diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
    --- a/pypy/module/micronumpy/test/test_dtypes.py
    +++ b/pypy/module/micronumpy/test/test_dtypes.py
    @@ -345,7 +345,7 @@
     
         def test_can_subclass(self):
             import numpy as np
    -        import sys
    +        import sys, pickle
             class xyz(np.void):
                 pass
             assert np.dtype(xyz).name == 'xyz'
    @@ -356,12 +356,18 @@
             data = [(1, 'a'), (2, 'bbb')]
             b = np.dtype((xyz, [('a', int), ('b', object)]))
             if '__pypy__' in sys.builtin_module_names:
    -            raises(NotImplemented, np.array, data, dtype=b)
    +            raises(NotImplementedError, np.array, data, dtype=b)
             else:
                 arr = np.array(data, dtype=b)
                 assert arr[0][0] == 1
                 assert arr[0][1] == 'a'
    -
    +        b = np.dtype((xyz, [("col1", "
    
    Author: mattip 
    Branch: 
    Changeset: r80822:fce4c7d4a8b9
    Date: 2015-11-22 00:02 +0200
    http://bitbucket.org/pypy/pypy/changeset/fce4c7d4a8b9/
    
    Log:	test, fix for disallowing record array with mixed object, non-object
    	values
    
    	until we figure out a way to mark the gc pointers in the raw storage
    
    diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
    --- a/pypy/module/micronumpy/ndarray.py
    +++ b/pypy/module/micronumpy/ndarray.py
    @@ -15,7 +15,7 @@
     from pypy.module.micronumpy.arrayops import repeat, choose, put
     from pypy.module.micronumpy.base import W_NDimArray, convert_to_array, \
         ArrayArgumentException, wrap_impl
    -from pypy.module.micronumpy.concrete import BaseConcreteArray
    +from pypy.module.micronumpy.concrete import BaseConcreteArray, V_OBJECTSTORE
     from pypy.module.micronumpy.converters import (
         multi_axis_converter, order_converter, shape_converter,
         searchside_converter, out_converter)
    @@ -288,6 +288,9 @@
                 raise oefmt(space.w_ValueError, "no field of name %s", field)
             arr = self.implementation
             ofs, subdtype = arr.dtype.fields[field][:2]
    +        if subdtype.is_object() and arr.gcstruct is V_OBJECTSTORE:
    +            raise oefmt(space.w_NotImplementedError,
    +                "cannot read object from array with no gc hook")
             # ofs only changes start
             # create a view of the original array by extending
             # the shape, strides, backstrides of the array
    diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py
    --- a/pypy/module/micronumpy/test/test_object_arrays.py
    +++ b/pypy/module/micronumpy/test/test_object_arrays.py
    @@ -126,8 +126,6 @@
             interface = dict(a.__array_interface__)
             interface['shape'] = tuple([3])
             interface['strides'] = tuple([0])
    -        if '__pypy__' in sys.builtin_module_names:
    -            skip('not implemented yet')
             c = np.array(DummyArray(interface, base=a))
             c.dtype = a.dtype
             #print c
    @@ -160,6 +158,9 @@
             import sys
             ytype = np.object_
             if '__pypy__' in sys.builtin_module_names:
    +            dt = np.dtype([('x', int), ('y', ytype)])
    +            x = np.empty((4, 0), dtype = dt)
    +            raises(NotImplementedError, x.__getitem__, 'y')
                 ytype = str
             dt = np.dtype([('x', int), ('y', ytype)])
             # Correct way
    diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
    --- a/pypy/module/micronumpy/types.py
    +++ b/pypy/module/micronumpy/types.py
    @@ -1851,6 +1851,9 @@
                         arr.gcstruct)
     
         def read(self, arr, i, offset, dtype):
    +        if arr.gcstruct is V_OBJECTSTORE:
    +            raise oefmt(self.space.w_NotImplementedError,
    +                "cannot read object from array with no gc hook")
             return self.box(self._read(arr.storage, i, offset))
     
         def byteswap(self, w_v):
    
    From noreply at buildbot.pypy.org  Sat Nov 21 17:04:44 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Sat, 21 Nov 2015 23:04:44 +0100 (CET)
    Subject: [pypy-commit] pypy default: unskip passing test
    Message-ID: <20151121220444.BD0301C1545@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r80823:89f29652c2b2
    Date: 2015-11-22 00:05 +0200
    http://bitbucket.org/pypy/pypy/changeset/89f29652c2b2/
    
    Log:	unskip passing test
    
    diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py
    --- a/pypy/module/micronumpy/test/test_object_arrays.py
    +++ b/pypy/module/micronumpy/test/test_object_arrays.py
    @@ -114,9 +114,6 @@
     
         def test_array_interface(self):
             import numpy as np
    -        if self.runappdirect:
    -            skip('requires numpy.core, test with numpy test suite instead')
    -        import sys
             class DummyArray(object):
                 def __init__(self, interface, base=None):
                     self.__array_interface__ = interface
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:22:57 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:22:57 +0100 (CET)
    Subject: [pypy-commit] pypy llvm-translation-backend: Fix prebuilt hash
     preservation.
    Message-ID: <20151122122257.2F2441C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: llvm-translation-backend
    Changeset: r80824:466d3372c513
    Date: 2015-11-19 16:15 +0100
    http://bitbucket.org/pypy/pypy/changeset/466d3372c513/
    
    Log:	Fix prebuilt hash preservation.
    
    diff --git a/rpython/translator/llvm/genllvm.py b/rpython/translator/llvm/genllvm.py
    --- a/rpython/translator/llvm/genllvm.py
    +++ b/rpython/translator/llvm/genllvm.py
    @@ -90,26 +90,34 @@
             else:
                 global_attrs += 'internal '
                 name = database.unique_name('@global')
    -        if self.varsize:
    -            extra_len = self.get_extra_len(obj)
    -            ptr_type.refs[obj] = 'bitcast({} {} to {})'.format(
    -                    ptr_type.repr_type(extra_len), name,
    -                    ptr_type.repr_type(None))
    -        else:
    -            ptr_type.refs[obj] = name
    -        hash_ = database.genllvm.gcpolicy.get_prebuilt_hash(obj)
             if (hasattr(obj._TYPE, '_hints') and
                 obj._TYPE._hints.get('immutable', False) and
                 obj._TYPE._gckind != 'gc'):
                 global_attrs += 'constant'
             else:
                 global_attrs += 'global'
    -        database.f.write('{} = {} {}\n'.format(
    -                name, global_attrs, self.repr_type_and_value(obj)))
    -        if hash_ is not None:
    -            database.f.write('{}_hash = {} {} {}\n'
    -                    .format(name, global_attrs, SIGNED_TYPE, hash_))
    -            database.hashes.append(name)
    +
    +        hash_ = database.genllvm.gcpolicy.get_prebuilt_hash(obj)
    +        if hash_ is None:
    +            if self.varsize:
    +                extra_len = self.get_extra_len(obj)
    +                ptr_type.refs[obj] = 'bitcast({} {} to {})'.format(
    +                        ptr_type.repr_type(extra_len), name,
    +                        ptr_type.repr_type(None))
    +            else:
    +                ptr_type.refs[obj] = name
    +            database.f.write('{} = {} {}\n'.format(
    +                    name, global_attrs, self.repr_type_and_value(obj)))
    +        else:
    +            assert not self.varsize
    +            with_hash_type = '{{ {}, {} }}'.format(
    +                    self.repr_type(), SIGNED_TYPE)
    +            ptr_type.refs[obj] = \
    +                'getelementptr({}, {}* {}_with_hash, i64 0, i32 0)'.format(
    +                    with_hash_type, with_hash_type, name)
    +            database.f.write('{}_with_hash = {} {} {{ {}, {} {} }}\n'.format(
    +                    name, global_attrs, with_hash_type,
    +                    self.repr_type_and_value(obj), SIGNED_TYPE, hash_))
     
     
     class VoidType(Type):
    @@ -765,7 +773,6 @@
             self.f = f
             self.names_counter = {}
             self.types = PRIMITIVES.copy()
    -        self.hashes = []
             self.stack_bottoms = []
             self.tls_getters = set()
             self.tls_addr_wrapper = False
    @@ -1875,12 +1882,6 @@
                 for export in self.entrypoints:
                     get_repr(export._as_ptr()).V
     
    -            if database.hashes:
    -                items = ('i8* bitcast({}* {}_hash to i8*)'
    -                        .format(SIGNED_TYPE, name) for name in database.hashes)
    -                f.write('@llvm.used = appending global [{} x i8*] [ {} ], '
    -                        'section "llvm.metadata"\n'
    -                        .format(len(database.hashes), ', '.join(items)))
                 if database.stack_bottoms:
                     items = ('i8* bitcast({} to i8*)'
                             .format(ref) for ref in database.stack_bottoms)
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:03 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:03 +0100 (CET)
    Subject: [pypy-commit] pypy llvm-translation-backend: hg merge default
    Message-ID: <20151122122303.8EB2C1C12CB@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: llvm-translation-backend
    Changeset: r80827:7557812bafd4
    Date: 2015-11-20 00:22 +0100
    http://bitbucket.org/pypy/pypy/changeset/7557812bafd4/
    
    Log:	hg merge default
    
    diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
    --- a/pypy/goal/targetpypystandalone.py
    +++ b/pypy/goal/targetpypystandalone.py
    @@ -302,7 +302,7 @@
         
         def hack_for_cffi_modules(self, driver):
             # HACKHACKHACK
    -        # ugly hack to modify target goal from compile_c to build_cffi_imports
    +        # ugly hack to modify target goal from compile_* to build_cffi_imports
             # this should probably get cleaned up and merged with driver.create_exe
             from rpython.translator.driver import taskdef
             import types
    @@ -316,7 +316,8 @@
                     name = name.new(ext='exe')
                 return name
     
    -        @taskdef(['compile_c'], "Create cffi bindings for modules")
    +        compile_goal, = driver.backend_select_goals(['compile'])
    +        @taskdef([compile_goal], "Create cffi bindings for modules")
             def task_build_cffi_imports(self):
                 from pypy.tool.build_cffi_imports import create_cffi_import_libraries
                 ''' Use cffi to compile cffi interfaces to modules'''
    @@ -335,7 +336,7 @@
                 # if failures, they were already printed
                 print  >> sys.stderr, str(exename),'successfully built, but errors while building the above modules will be ignored'
             driver.task_build_cffi_imports = types.MethodType(task_build_cffi_imports, driver)
    -        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, ['compile_c']
    +        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, [compile_goal]
             driver.default_goal = 'build_cffi_imports'
             # HACKHACKHACK end
     
    diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py
    --- a/rpython/translator/platform/darwin.py
    +++ b/rpython/translator/platform/darwin.py
    @@ -28,11 +28,11 @@
             # needed for cross compiling on ARM, needs fixing if relevant for darwin
             if len(rel_libdirs) > 0:
                 print 'in get_rpath_flags, rel_libdirs is not fixed up',rel_libdirs
    -        return self.rpath_flags 
    +        return self.rpath_flags
     
         def _args_for_shared(self, args):
             return (list(self.shared_only)
    -                + ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup']
    +                + ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup', '-flat_namespace']
                     + args)
     
         def _include_dirs_for_libffi(self):
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:22:59 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:22:59 +0100 (CET)
    Subject: [pypy-commit] pypy llvm-translation-backend: Special-case
     COMPILER_INFO constant in LLVM backend.
    Message-ID: <20151122122259.5BA8A1C05B6@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: llvm-translation-backend
    Changeset: r80825:65fa1e610d2f
    Date: 2015-11-19 20:05 +0100
    http://bitbucket.org/pypy/pypy/changeset/65fa1e610d2f/
    
    Log:	Special-case COMPILER_INFO constant in LLVM backend.
    
    diff --git a/rpython/translator/llvm/genllvm.py b/rpython/translator/llvm/genllvm.py
    --- a/rpython/translator/llvm/genllvm.py
    +++ b/rpython/translator/llvm/genllvm.py
    @@ -15,6 +15,7 @@
          ShadowStackFrameworkGCTransformer)
     from rpython.memory.gctypelayout import WEAKREF, convert_weakref_to
     from rpython.rlib import exports
    +from rpython.rlib.compilerinfo import COMPILER_INFO
     from rpython.rlib.jit import _we_are_jitted
     from rpython.rlib.objectmodel import (Symbolic, ComputedIntSymbolic,
          CDefinedIntSymbolic, malloc_zero_filled, running_on_llinterp)
    @@ -412,6 +413,8 @@
             return not value
     
         def repr_value(self, value, extra_len=None):
    +        if value is COMPILER_INFO:
    +            return database.compiler_info
             obj = value._obj
             if isinstance(obj, int):
                 return 'inttoptr({} {} to {})'.format(SIGNED_TYPE, obj,
    @@ -1600,6 +1603,8 @@
                 except lltype.DelayedPointer:
                     self.delayed_ptrs = True
                     return
    +            except AttributeError:
    +                return
                 if value is None:
                     return
             if isinstance(type, lltype.ContainerType):
    @@ -1832,6 +1837,13 @@
             self.gcpolicy.finish()
     
         def _write_special_declarations(self, f):
    +        compiler_info_str = "LLVM " + cmdexec('llvm-config --version').strip()
    +        cstr_type = '[{} x i8]'.format(len(compiler_info_str) + 1)
    +        f.write('@compiler_info = private unnamed_addr constant {} c"{}\\00"\n'
    +                .format(cstr_type, compiler_info_str))
    +        database.compiler_info = ('bitcast({}* @compiler_info to [0 x i8]*)'
    +                .format(cstr_type))
    +
             f.write('declare void @abort() noreturn nounwind\n')
             f.write('declare void @llvm.gcroot(i8** %ptrloc, i8* %metadata)\n')
             f.write('@__gcmap = external constant i8\n')
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:05 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:05 +0100 (CET)
    Subject: [pypy-commit] pypy llvm-translation-backend: Add stub for
     have_debug_prints_for() llop.
    Message-ID: <20151122122305.9A24A1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: llvm-translation-backend
    Changeset: r80828:75ba75ce5bee
    Date: 2015-11-22 11:51 +0100
    http://bitbucket.org/pypy/pypy/changeset/75ba75ce5bee/
    
    Log:	Add stub for have_debug_prints_for() llop.
    
    diff --git a/rpython/translator/llvm/genllvm.py b/rpython/translator/llvm/genllvm.py
    --- a/rpython/translator/llvm/genllvm.py
    +++ b/rpython/translator/llvm/genllvm.py
    @@ -1113,6 +1113,9 @@
         def op_have_debug_prints(self, result):
             self.w('{result.V} = bitcast i1 false to i1'.format(**locals()))
     
    +    def op_have_debug_prints_for(self, result, category_prefix):
    +        self.w('{result.V} = bitcast i1 false to i1'.format(**locals()))
    +
         def op_ll_read_timestamp(self, result):
             self.op_direct_call(result, get_repr(llvm_readcyclecounter))
     
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:07 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:07 +0100 (CET)
    Subject: [pypy-commit] pypy llvm-translation-backend: Implement field offset
     calculation for FixedSizeArrays.
    Message-ID: <20151122122307.B2F7D1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: llvm-translation-backend
    Changeset: r80829:2980f62bc491
    Date: 2015-11-22 11:55 +0100
    http://bitbucket.org/pypy/pypy/changeset/2980f62bc491/
    
    Log:	Implement field offset calculation for FixedSizeArrays.
    
    diff --git a/rpython/translator/llvm/genllvm.py b/rpython/translator/llvm/genllvm.py
    --- a/rpython/translator/llvm/genllvm.py
    +++ b/rpython/translator/llvm/genllvm.py
    @@ -237,9 +237,14 @@
                 indices.append('i64 0')
             if isinstance(offset, llmemory.FieldOffset):
                 type = database.get_type(offset.TYPE)
    -            indices.append('i32 {}'.format(
    -                    type.fldnames_wo_voids.index(offset.fldname)))
    -            return offset.TYPE._flds[offset.fldname]
    +            if isinstance(type, BareArrayType):
    +                assert offset.fldname.startswith('item')
    +                indices.append('i32 {}'.format(int(offset.fldname[4:])))
    +                return offset.TYPE.OF
    +            else:
    +                indices.append('i32 {}'.format(
    +                        type.fldnames_wo_voids.index(offset.fldname)))
    +                return offset.TYPE._flds[offset.fldname]
             if isinstance(offset, llmemory.ArrayLengthOffset):
                 if offset.TYPE._gckind == 'gc':
                     indices.append('i32 1')
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:01 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:01 +0100 (CET)
    Subject: [pypy-commit] pypy default: Make build_cffi_imports hack work with
     other backends than GenC.
    Message-ID: <20151122122301.6FD831C10AE@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: 
    Changeset: r80826:e4acc9f54fe0
    Date: 2015-11-20 00:22 +0100
    http://bitbucket.org/pypy/pypy/changeset/e4acc9f54fe0/
    
    Log:	Make build_cffi_imports hack work with other backends than GenC.
    
    diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
    --- a/pypy/goal/targetpypystandalone.py
    +++ b/pypy/goal/targetpypystandalone.py
    @@ -302,7 +302,7 @@
         
         def hack_for_cffi_modules(self, driver):
             # HACKHACKHACK
    -        # ugly hack to modify target goal from compile_c to build_cffi_imports
    +        # ugly hack to modify target goal from compile_* to build_cffi_imports
             # this should probably get cleaned up and merged with driver.create_exe
             from rpython.translator.driver import taskdef
             import types
    @@ -316,7 +316,8 @@
                     name = name.new(ext='exe')
                 return name
     
    -        @taskdef(['compile_c'], "Create cffi bindings for modules")
    +        compile_goal, = driver.backend_select_goals(['compile'])
    +        @taskdef([compile_goal], "Create cffi bindings for modules")
             def task_build_cffi_imports(self):
                 from pypy.tool.build_cffi_imports import create_cffi_import_libraries
                 ''' Use cffi to compile cffi interfaces to modules'''
    @@ -335,7 +336,7 @@
                 # if failures, they were already printed
                 print  >> sys.stderr, str(exename),'successfully built, but errors while building the above modules will be ignored'
             driver.task_build_cffi_imports = types.MethodType(task_build_cffi_imports, driver)
    -        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, ['compile_c']
    +        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, [compile_goal]
             driver.default_goal = 'build_cffi_imports'
             # HACKHACKHACK end
     
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:09 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:09 +0100 (CET)
    Subject: [pypy-commit] pypy llvm-translation-backend: Pass HALFWORD instead
     of Signed to llop.combine_ushort().
    Message-ID: <20151122122309.BD8401C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: llvm-translation-backend
    Changeset: r80830:0db1c150ce78
    Date: 2015-11-22 12:29 +0100
    http://bitbucket.org/pypy/pypy/changeset/0db1c150ce78/
    
    Log:	Pass HALFWORD instead of Signed to llop.combine_ushort().
    
    	The first argument to the combine_ushort() llop is "expected" to be
    	of type HALFWORD. I say "expected" because e.g. the docstring of
    	CombinedSymbolic (to which the operation is folded) says it combines
    	a half-word and a word. The LLVM backend relies on that.
    
    diff --git a/rpython/jit/backend/llsupport/descr.py b/rpython/jit/backend/llsupport/descr.py
    --- a/rpython/jit/backend/llsupport/descr.py
    +++ b/rpython/jit/backend/llsupport/descr.py
    @@ -1,5 +1,6 @@
     import py
     from rpython.rtyper.lltypesystem import lltype, rffi, llmemory
    +from rpython.rtyper.lltypesystem.llgroup import r_halfword
     from rpython.rtyper.lltypesystem.lloperation import llop
     from rpython.jit.backend.llsupport import symbolic, support
     from rpython.jit.metainterp.history import AbstractDescr, getkind, FLOAT, INT
    @@ -34,7 +35,7 @@
     
     class SizeDescr(AbstractDescr):
         size = 0      # help translation
    -    tid = llop.combine_ushort(lltype.Signed, 0, 0)
    +    tid = llop.combine_ushort(lltype.Signed, r_halfword(0), 0)
         vtable = lltype.nullptr(rclass.OBJECT_VTABLE)
         immutable_flag = False
     
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:15 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:15 +0100 (CET)
    Subject: [pypy-commit] pypy py3k: hg merge f321ba3efa8f (last revision of
     default branch which got into 4.0.1 release).
    Message-ID: <20151122122315.590551C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: py3k
    Changeset: r80831:80551260bb30
    Date: 2015-11-22 13:21 +0100
    http://bitbucket.org/pypy/pypy/changeset/80551260bb30/
    
    Log:	hg merge f321ba3efa8f (last revision of default branch which got
    	into 4.0.1 release).
    
    diff too long, truncating to 2000 out of 11756 lines
    
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -16,3 +16,4 @@
     e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0
     295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
     f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
    +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
    diff --git a/LICENSE b/LICENSE
    --- a/LICENSE
    +++ b/LICENSE
    @@ -56,14 +56,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -87,7 +88,6 @@
       Ludovic Aubry
       Jacob Hallen
       Jason Creighton
    -  Richard Plangger
       Alex Martelli
       Michal Bendowski
       stian
    @@ -200,9 +200,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -234,6 +237,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -244,6 +248,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -253,6 +258,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -283,6 +289,7 @@
       shoma hosaka
       Daniel Neuhäuser
       Ben Mather
    +  Niclas Olofsson
       halgari
       Boglarka Vezer
       Chris Pressey
    @@ -309,13 +316,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -327,6 +337,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/lib_pypy/_dbm.py b/lib_pypy/_dbm.py
    --- a/lib_pypy/_dbm.py
    +++ b/lib_pypy/_dbm.py
    @@ -153,6 +153,7 @@
     _init_func('store', (c_void_p, datum, datum, c_int), restype=c_int)
     _init_func('error', (c_void_p,), restype=c_int)
     _init_func('delete', (c_void_p, datum), restype=c_int)
    +_init_func('clearerr', (c_void_p,), restype=c_int)
     
     lib.DBM_INSERT = 0
     lib.DBM_REPLACE = 1
    diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py
    --- a/lib_pypy/_tkinter/tklib_build.py
    +++ b/lib_pypy/_tkinter/tklib_build.py
    @@ -212,8 +212,8 @@
     #include 
     #endif 
     
    -char *get_tk_version() { return TK_VERSION; }
    -char *get_tcl_version() { return TCL_VERSION; }
    +char *get_tk_version(void) { return TK_VERSION; }
    +char *get_tcl_version(void) { return TCL_VERSION; }
     """ % globals(),
     include_dirs=incdirs,
     libraries=linklibs,
    diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
    --- a/lib_pypy/cffi.egg-info/PKG-INFO
    +++ b/lib_pypy/cffi.egg-info/PKG-INFO
    @@ -1,6 +1,6 @@
     Metadata-Version: 1.1
     Name: cffi
    -Version: 1.3.0
    +Version: 1.3.1
     Summary: Foreign Function Interface for Python calling C code.
     Home-page: http://cffi.readthedocs.org
     Author: Armin Rigo, Maciej Fijalkowski
    diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
    --- a/lib_pypy/cffi/__init__.py
    +++ b/lib_pypy/cffi/__init__.py
    @@ -4,8 +4,8 @@
     from .api import FFI, CDefError, FFIError
     from .ffiplatform import VerificationError, VerificationMissing
     
    -__version__ = "1.3.0"
    -__version_info__ = (1, 3, 0)
    +__version__ = "1.3.1"
    +__version_info__ = (1, 3, 1)
     
     # The verifier module file names are based on the CRC32 of a string that
     # contains the following version number.  It may be older than __version__
    diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py
    --- a/lib_pypy/cffi/_pycparser/__init__.py
    +++ b/lib_pypy/cffi/_pycparser/__init__.py
    @@ -4,11 +4,11 @@
     # This package file exports some convenience functions for
     # interacting with pycparser
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     __all__ = ['c_lexer', 'c_parser', 'c_ast']
    -__version__ = '2.10'
    +__version__ = '2.14'
     
     from subprocess import Popen, PIPE
     from .c_parser import CParser
    @@ -91,4 +91,3 @@
         if parser is None:
             parser = CParser()
         return parser.parse(text, filename)
    -
    diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py
    --- a/lib_pypy/cffi/_pycparser/_ast_gen.py
    +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py
    @@ -1,13 +1,13 @@
     #-----------------------------------------------------------------
     # _ast_gen.py
     #
    -# Generates the AST Node classes from a specification given in 
    -# a .yaml file
    +# Generates the AST Node classes from a specification given in
    +# a configuration file
     #
     # The design of this module was inspired by astgen.py from the
     # Python 2.5 code-base.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     import pprint
    @@ -20,7 +20,7 @@
                 file.
             """
             self.cfg_filename = cfg_filename
    -        self.node_cfg = [NodeCfg(name, contents) 
    +        self.node_cfg = [NodeCfg(name, contents)
                 for (name, contents) in self.parse_cfgfile(cfg_filename)]
     
         def generate(self, file=None):
    @@ -28,11 +28,11 @@
             """
             src = Template(_PROLOGUE_COMMENT).substitute(
                 cfg_filename=self.cfg_filename)
    -        
    +
             src += _PROLOGUE_CODE
             for node_cfg in self.node_cfg:
                 src += node_cfg.generate_source() + '\n\n'
    -        
    +
             file.write(src)
     
         def parse_cfgfile(self, filename):
    @@ -57,10 +57,10 @@
     
     
     class NodeCfg(object):
    -    """ Node configuration. 
    +    """ Node configuration.
     
             name: node name
    -        contents: a list of contents - attributes and child nodes 
    +        contents: a list of contents - attributes and child nodes
             See comment at the top of the configuration file for details.
         """
         def __init__(self, name, contents):
    @@ -73,7 +73,7 @@
             for entry in contents:
                 clean_entry = entry.rstrip('*')
                 self.all_entries.append(clean_entry)
    -            
    +
                 if entry.endswith('**'):
                     self.seq_child.append(clean_entry)
                 elif entry.endswith('*'):
    @@ -86,26 +86,30 @@
             src += '\n' + self._gen_children()
             src += '\n' + self._gen_attr_names()
             return src
    -    
    +
         def _gen_init(self):
             src = "class %s(Node):\n" % self.name
     
             if self.all_entries:
                 args = ', '.join(self.all_entries)
    +            slots = ', '.join("'{0}'".format(e) for e in self.all_entries)
    +            slots += ", 'coord', '__weakref__'"
                 arglist = '(self, %s, coord=None)' % args
             else:
    +            slots = "'coord', '__weakref__'"
                 arglist = '(self, coord=None)'
    -        
    +
    +        src += "    __slots__ = (%s)\n" % slots
             src += "    def __init__%s:\n" % arglist
    -        
    +
             for name in self.all_entries + ['coord']:
                 src += "        self.%s = %s\n" % (name, name)
    -        
    +
             return src
     
         def _gen_children(self):
             src = '    def children(self):\n'
    -        
    +
             if self.all_entries:
                 src += '        nodelist = []\n'
     
    @@ -114,21 +118,21 @@
                         '        if self.%(child)s is not None:' +
                         ' nodelist.append(("%(child)s", self.%(child)s))\n') % (
                             dict(child=child))
    -                
    +
                 for seq_child in self.seq_child:
                     src += (
                         '        for i, child in enumerate(self.%(child)s or []):\n'
                         '            nodelist.append(("%(child)s[%%d]" %% i, child))\n') % (
                             dict(child=seq_child))
    -                    
    +
                 src += '        return tuple(nodelist)\n'
             else:
                 src += '        return ()\n'
    -            
    -        return src        
    +
    +        return src
     
         def _gen_attr_names(self):
    -        src = "    attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' 
    +        src = "    attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')'
             return src
     
     
    @@ -136,7 +140,7 @@
     r'''#-----------------------------------------------------------------
     # ** ATTENTION **
     # This code was automatically generated from the file:
    -# $cfg_filename 
    +# $cfg_filename
     #
     # Do not modify it directly. Modify the configuration file and
     # run the generator again.
    @@ -146,7 +150,7 @@
     #
     # AST Node classes.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
    @@ -157,6 +161,7 @@
     
     
     class Node(object):
    +    __slots__ = ()
         """ Abstract base class for AST nodes.
         """
         def children(self):
    @@ -167,21 +172,21 @@
         def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
             """ Pretty print the Node and all its attributes and
                 children (recursively) to a buffer.
    -            
    -            buf:   
    +
    +            buf:
                     Open IO buffer into which the Node is printed.
    -            
    -            offset: 
    -                Initial offset (amount of leading spaces) 
    -            
    +
    +            offset:
    +                Initial offset (amount of leading spaces)
    +
                 attrnames:
                     True if you want to see the attribute names in
                     name=value pairs. False to only see the values.
    -                
    +
                 nodenames:
    -                True if you want to see the actual node names 
    +                True if you want to see the actual node names
                     within their parents.
    -            
    +
                 showcoord:
                     Do you want the coordinates of each Node to be
                     displayed.
    @@ -216,47 +221,47 @@
     
     
     class NodeVisitor(object):
    -    """ A base NodeVisitor class for visiting c_ast nodes. 
    +    """ A base NodeVisitor class for visiting c_ast nodes.
             Subclass it and define your own visit_XXX methods, where
    -        XXX is the class name you want to visit with these 
    +        XXX is the class name you want to visit with these
             methods.
    -        
    +
             For example:
    -        
    +
             class ConstantVisitor(NodeVisitor):
                 def __init__(self):
                     self.values = []
    -            
    +
                 def visit_Constant(self, node):
                     self.values.append(node.value)
     
    -        Creates a list of values of all the constant nodes 
    +        Creates a list of values of all the constant nodes
             encountered below the given node. To use it:
    -        
    +
             cv = ConstantVisitor()
             cv.visit(node)
    -        
    +
             Notes:
    -        
    -        *   generic_visit() will be called for AST nodes for which 
    -            no visit_XXX method was defined. 
    -        *   The children of nodes for which a visit_XXX was 
    +
    +        *   generic_visit() will be called for AST nodes for which
    +            no visit_XXX method was defined.
    +        *   The children of nodes for which a visit_XXX was
                 defined will not be visited - if you need this, call
    -            generic_visit() on the node. 
    +            generic_visit() on the node.
                 You can use:
                     NodeVisitor.generic_visit(self, node)
             *   Modeled after Python's own AST visiting facilities
                 (the ast module of Python 3.0)
         """
         def visit(self, node):
    -        """ Visit a node. 
    +        """ Visit a node.
             """
             method = 'visit_' + node.__class__.__name__
             visitor = getattr(self, method, self.generic_visit)
             return visitor(node)
    -        
    +
         def generic_visit(self, node):
    -        """ Called if no explicit visitor function exists for a 
    +        """ Called if no explicit visitor function exists for a
                 node. Implements preorder visiting of the node.
             """
             for c_name, c in node.children():
    diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py
    --- a/lib_pypy/cffi/_pycparser/_build_tables.py
    +++ b/lib_pypy/cffi/_pycparser/_build_tables.py
    @@ -6,12 +6,11 @@
     # Also generates AST code from the configuration file.
     # Should be called from the pycparser directory.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
     # Generate c_ast.py
    -#
     from _ast_gen import ASTCodeGenerator
     ast_gen = ASTCodeGenerator('_c_ast.cfg')
     ast_gen.generate(open('c_ast.py', 'w'))
    diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg
    --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg
    +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg
    @@ -1,188 +1,189 @@
    -#-----------------------------------------------------------------
    -# pycparser: _c_ast_gen.cfg
    -#
    -# Defines the AST Node classes used in pycparser.
    -# 
    -# Each entry is a Node sub-class name, listing the attributes
    -# and child nodes of the class:
    -#   *     - a child node
    -#   **    - a sequence of child nodes
    -#         - an attribute
    -#
    -# Copyright (C) 2008-2012, Eli Bendersky
    -# License: BSD
    -#-----------------------------------------------------------------
    -
    -ArrayDecl: [type*, dim*]
    -
    -ArrayRef: [name*, subscript*]
    -
    -# op: =, +=, /= etc.
    -#
    -Assignment: [op, lvalue*, rvalue*]
    -
    -BinaryOp: [op, left*, right*]
    -
    -Break: []
    -
    -Case: [expr*, stmts**]
    -
    -Cast: [to_type*, expr*]
    -
    -# Compound statement in C99 is a list of block items (declarations or
    -# statements).
    -#
    -Compound: [block_items**]
    -
    -# Compound literal (anonymous aggregate) for C99.
    -# (type-name) {initializer_list}
    -# type: the typename
    -# init: InitList for the initializer list
    -#
    -CompoundLiteral: [type*, init*]
    -
    -# type: int, char, float, etc. see CLexer for constant token types
    -#
    -Constant: [type, value]
    -
    -Continue: []
    -
    -# name: the variable being declared
    -# quals: list of qualifiers (const, volatile)
    -# funcspec: list function specifiers (i.e. inline in C99)
    -# storage: list of storage specifiers (extern, register, etc.)
    -# type: declaration type (probably nested with all the modifiers)
    -# init: initialization value, or None
    -# bitsize: bit field size, or None
    -#
    -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*]
    -
    -DeclList: [decls**]
    -
    -Default: [stmts**]
    -
    -DoWhile: [cond*, stmt*]
    -
    -# Represents the ellipsis (...) parameter in a function 
    -# declaration
    -#
    -EllipsisParam: []
    -
    -# An empty statement (a semicolon ';' on its own)
    -#
    -EmptyStatement: []
    -
    -# Enumeration type specifier
    -# name: an optional ID
    -# values: an EnumeratorList
    -#
    -Enum: [name, values*]
    -
    -# A name/value pair for enumeration values
    -#
    -Enumerator: [name, value*]
    -
    -# A list of enumerators
    -#
    -EnumeratorList: [enumerators**]
    -
    -# A list of expressions separated by the comma operator.
    -#
    -ExprList: [exprs**]
    -
    -# This is the top of the AST, representing a single C file (a 
    -# translation unit in K&R jargon). It contains a list of 
    -# "external-declaration"s, which is either declarations (Decl),
    -# Typedef or function definitions (FuncDef).
    -# 
    -FileAST: [ext**]
    -
    -# for (init; cond; next) stmt
    -#
    -For: [init*, cond*, next*, stmt*]
    -
    -# name: Id
    -# args: ExprList
    -#
    -FuncCall: [name*, args*]
    -
    -# type (args)
    -#
    -FuncDecl: [args*, type*]
    -
    -# Function definition: a declarator for the function name and
    -# a body, which is a compound statement. 
    -# There's an optional list of parameter declarations for old
    -# K&R-style definitions
    -#
    -FuncDef: [decl*, param_decls**, body*]
    -
    -Goto: [name]
    -
    -ID: [name]
    -
    -# Holder for types that are a simple identifier (e.g. the built
    -# ins void, char etc. and typedef-defined types)
    -#
    -IdentifierType: [names]
    -
    -If: [cond*, iftrue*, iffalse*]
    -
    -# An initialization list used for compound literals.
    -#
    -InitList: [exprs**]
    -
    -Label: [name, stmt*]
    -
    -# A named initializer for C99.
    -# The name of a NamedInitializer is a sequence of Nodes, because
    -# names can be hierarchical and contain constant expressions.
    -#
    -NamedInitializer: [name**, expr*]
    -
    -# a list of comma separated function parameter declarations
    -#
    -ParamList: [params**]
    -
    -PtrDecl: [quals, type*]
    -
    -Return: [expr*]
    -
    -# name: struct tag name
    -# decls: declaration of members
    -#
    -Struct: [name, decls**]
    -
    -# type: . or ->
    -# name.field or name->field
    -#
    -StructRef: [name*, type, field*]
    -
    -Switch: [cond*, stmt*]
    -
    -# cond ? iftrue : iffalse
    -#
    -TernaryOp: [cond*, iftrue*, iffalse*]
    -
    -# A base type declaration
    -#
    -TypeDecl: [declname, quals, type*]
    -
    -# A typedef declaration.
    -# Very similar to Decl, but without some attributes
    -#
    -Typedef: [name, quals, storage, type*]
    -
    -Typename: [quals, type*]
    -
    -UnaryOp: [op, expr*]
    -
    -# name: union tag name
    -# decls: declaration of members
    -#
    -Union: [name, decls**]
    -
    -While: [cond*, stmt*]
    -
    -
    -
    +#-----------------------------------------------------------------
    +# pycparser: _c_ast.cfg
    +#
    +# Defines the AST Node classes used in pycparser.
    +#
    +# Each entry is a Node sub-class name, listing the attributes
    +# and child nodes of the class:
    +#   *     - a child node
    +#   **    - a sequence of child nodes
    +#         - an attribute
    +#
    +# Copyright (C) 2008-2015, Eli Bendersky
    +# License: BSD
    +#-----------------------------------------------------------------
    +
    +# ArrayDecl is a nested declaration of an array with the given type.
    +# dim: the dimension (for example, constant 42)
    +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const'
    +#            and 'static' within the array dimension in function declarations.
    +ArrayDecl: [type*, dim*, dim_quals]
    +
    +ArrayRef: [name*, subscript*]
    +
    +# op: =, +=, /= etc.
    +#
    +Assignment: [op, lvalue*, rvalue*]
    +
    +BinaryOp: [op, left*, right*]
    +
    +Break: []
    +
    +Case: [expr*, stmts**]
    +
    +Cast: [to_type*, expr*]
    +
    +# Compound statement in C99 is a list of block items (declarations or
    +# statements).
    +#
    +Compound: [block_items**]
    +
    +# Compound literal (anonymous aggregate) for C99.
    +# (type-name) {initializer_list}
    +# type: the typename
    +# init: InitList for the initializer list
    +#
    +CompoundLiteral: [type*, init*]
    +
    +# type: int, char, float, etc. see CLexer for constant token types
    +#
    +Constant: [type, value]
    +
    +Continue: []
    +
    +# name: the variable being declared
    +# quals: list of qualifiers (const, volatile)
    +# funcspec: list function specifiers (i.e. inline in C99)
    +# storage: list of storage specifiers (extern, register, etc.)
    +# type: declaration type (probably nested with all the modifiers)
    +# init: initialization value, or None
    +# bitsize: bit field size, or None
    +#
    +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*]
    +
    +DeclList: [decls**]
    +
    +Default: [stmts**]
    +
    +DoWhile: [cond*, stmt*]
    +
    +# Represents the ellipsis (...) parameter in a function
    +# declaration
    +#
    +EllipsisParam: []
    +
    +# An empty statement (a semicolon ';' on its own)
    +#
    +EmptyStatement: []
    +
    +# Enumeration type specifier
    +# name: an optional ID
    +# values: an EnumeratorList
    +#
    +Enum: [name, values*]
    +
    +# A name/value pair for enumeration values
    +#
    +Enumerator: [name, value*]
    +
    +# A list of enumerators
    +#
    +EnumeratorList: [enumerators**]
    +
    +# A list of expressions separated by the comma operator.
    +#
    +ExprList: [exprs**]
    +
    +# This is the top of the AST, representing a single C file (a
    +# translation unit in K&R jargon). It contains a list of
    +# "external-declaration"s, which is either declarations (Decl),
    +# Typedef or function definitions (FuncDef).
    +#
    +FileAST: [ext**]
    +
    +# for (init; cond; next) stmt
    +#
    +For: [init*, cond*, next*, stmt*]
    +
    +# name: Id
    +# args: ExprList
    +#
    +FuncCall: [name*, args*]
    +
    +# type (args)
    +#
    +FuncDecl: [args*, type*]
    +
    +# Function definition: a declarator for the function name and
    +# a body, which is a compound statement.
    +# There's an optional list of parameter declarations for old
    +# K&R-style definitions
    +#
    +FuncDef: [decl*, param_decls**, body*]
    +
    +Goto: [name]
    +
    +ID: [name]
    +
    +# Holder for types that are a simple identifier (e.g. the built
    +# ins void, char etc. and typedef-defined types)
    +#
    +IdentifierType: [names]
    +
    +If: [cond*, iftrue*, iffalse*]
    +
    +# An initialization list used for compound literals.
    +#
    +InitList: [exprs**]
    +
    +Label: [name, stmt*]
    +
    +# A named initializer for C99.
    +# The name of a NamedInitializer is a sequence of Nodes, because
    +# names can be hierarchical and contain constant expressions.
    +#
    +NamedInitializer: [name**, expr*]
    +
    +# a list of comma separated function parameter declarations
    +#
    +ParamList: [params**]
    +
    +PtrDecl: [quals, type*]
    +
    +Return: [expr*]
    +
    +# name: struct tag name
    +# decls: declaration of members
    +#
    +Struct: [name, decls**]
    +
    +# type: . or ->
    +# name.field or name->field
    +#
    +StructRef: [name*, type, field*]
    +
    +Switch: [cond*, stmt*]
    +
    +# cond ? iftrue : iffalse
    +#
    +TernaryOp: [cond*, iftrue*, iffalse*]
    +
    +# A base type declaration
    +#
    +TypeDecl: [declname, quals, type*]
    +
    +# A typedef declaration.
    +# Very similar to Decl, but without some attributes
    +#
    +Typedef: [name, quals, storage, type*]
    +
    +Typename: [name, quals, type*]
    +
    +UnaryOp: [op, expr*]
    +
    +# name: union tag name
    +# decls: declaration of members
    +#
    +Union: [name, decls**]
    +
    +While: [cond*, stmt*]
    diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py
    --- a/lib_pypy/cffi/_pycparser/ast_transforms.py
    +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py
    @@ -3,7 +3,7 @@
     #
     # Some utilities used by the parser to create a friendlier AST.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     
    @@ -84,7 +84,7 @@
                 _extract_nested_case(child, new_compound.block_items)
                 last_case = new_compound.block_items[-1]
             else:
    -            # Other statements are added as childrent to the last case, if it
    +            # Other statements are added as children to the last case, if it
                 # exists.
                 if last_case is None:
                     new_compound.block_items.append(child)
    diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py
    --- a/lib_pypy/cffi/_pycparser/c_ast.py
    +++ b/lib_pypy/cffi/_pycparser/c_ast.py
    @@ -1,7 +1,7 @@
     #-----------------------------------------------------------------
     # ** ATTENTION **
     # This code was automatically generated from the file:
    -# _c_ast.cfg 
    +# _c_ast.cfg
     #
     # Do not modify it directly. Modify the configuration file and
     # run the generator again.
    @@ -11,7 +11,7 @@
     #
     # AST Node classes.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
    @@ -20,6 +20,7 @@
     
     
     class Node(object):
    +    __slots__ = ()
         """ Abstract base class for AST nodes.
         """
         def children(self):
    @@ -30,21 +31,21 @@
         def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
             """ Pretty print the Node and all its attributes and
                 children (recursively) to a buffer.
    -            
    -            buf:   
    +
    +            buf:
                     Open IO buffer into which the Node is printed.
    -            
    -            offset: 
    -                Initial offset (amount of leading spaces) 
    -            
    +
    +            offset:
    +                Initial offset (amount of leading spaces)
    +
                 attrnames:
                     True if you want to see the attribute names in
                     name=value pairs. False to only see the values.
    -                
    +
                 nodenames:
    -                True if you want to see the actual node names 
    +                True if you want to see the actual node names
                     within their parents.
    -            
    +
                 showcoord:
                     Do you want the coordinates of each Node to be
                     displayed.
    @@ -79,47 +80,47 @@
     
     
     class NodeVisitor(object):
    -    """ A base NodeVisitor class for visiting c_ast nodes. 
    +    """ A base NodeVisitor class for visiting c_ast nodes.
             Subclass it and define your own visit_XXX methods, where
    -        XXX is the class name you want to visit with these 
    +        XXX is the class name you want to visit with these
             methods.
    -        
    +
             For example:
    -        
    +
             class ConstantVisitor(NodeVisitor):
                 def __init__(self):
                     self.values = []
    -            
    +
                 def visit_Constant(self, node):
                     self.values.append(node.value)
     
    -        Creates a list of values of all the constant nodes 
    +        Creates a list of values of all the constant nodes
             encountered below the given node. To use it:
    -        
    +
             cv = ConstantVisitor()
             cv.visit(node)
    -        
    +
             Notes:
    -        
    -        *   generic_visit() will be called for AST nodes for which 
    -            no visit_XXX method was defined. 
    -        *   The children of nodes for which a visit_XXX was 
    +
    +        *   generic_visit() will be called for AST nodes for which
    +            no visit_XXX method was defined.
    +        *   The children of nodes for which a visit_XXX was
                 defined will not be visited - if you need this, call
    -            generic_visit() on the node. 
    +            generic_visit() on the node.
                 You can use:
                     NodeVisitor.generic_visit(self, node)
             *   Modeled after Python's own AST visiting facilities
                 (the ast module of Python 3.0)
         """
         def visit(self, node):
    -        """ Visit a node. 
    +        """ Visit a node.
             """
             method = 'visit_' + node.__class__.__name__
             visitor = getattr(self, method, self.generic_visit)
             return visitor(node)
    -        
    +
         def generic_visit(self, node):
    -        """ Called if no explicit visitor function exists for a 
    +        """ Called if no explicit visitor function exists for a
                 node. Implements preorder visiting of the node.
             """
             for c_name, c in node.children():
    @@ -127,9 +128,11 @@
     
     
     class ArrayDecl(Node):
    -    def __init__(self, type, dim, coord=None):
    +    __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__')
    +    def __init__(self, type, dim, dim_quals, coord=None):
             self.type = type
             self.dim = dim
    +        self.dim_quals = dim_quals
             self.coord = coord
     
         def children(self):
    @@ -138,9 +141,10 @@
             if self.dim is not None: nodelist.append(("dim", self.dim))
             return tuple(nodelist)
     
    -    attr_names = ()
    +    attr_names = ('dim_quals', )
     
     class ArrayRef(Node):
    +    __slots__ = ('name', 'subscript', 'coord', '__weakref__')
         def __init__(self, name, subscript, coord=None):
             self.name = name
             self.subscript = subscript
    @@ -155,6 +159,7 @@
         attr_names = ()
     
     class Assignment(Node):
    +    __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__')
         def __init__(self, op, lvalue, rvalue, coord=None):
             self.op = op
             self.lvalue = lvalue
    @@ -167,9 +172,10 @@
             if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue))
             return tuple(nodelist)
     
    -    attr_names = ('op',)
    +    attr_names = ('op', )
     
     class BinaryOp(Node):
    +    __slots__ = ('op', 'left', 'right', 'coord', '__weakref__')
         def __init__(self, op, left, right, coord=None):
             self.op = op
             self.left = left
    @@ -182,9 +188,10 @@
             if self.right is not None: nodelist.append(("right", self.right))
             return tuple(nodelist)
     
    -    attr_names = ('op',)
    +    attr_names = ('op', )
     
     class Break(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -194,6 +201,7 @@
         attr_names = ()
     
     class Case(Node):
    +    __slots__ = ('expr', 'stmts', 'coord', '__weakref__')
         def __init__(self, expr, stmts, coord=None):
             self.expr = expr
             self.stmts = stmts
    @@ -209,6 +217,7 @@
         attr_names = ()
     
     class Cast(Node):
    +    __slots__ = ('to_type', 'expr', 'coord', '__weakref__')
         def __init__(self, to_type, expr, coord=None):
             self.to_type = to_type
             self.expr = expr
    @@ -223,6 +232,7 @@
         attr_names = ()
     
     class Compound(Node):
    +    __slots__ = ('block_items', 'coord', '__weakref__')
         def __init__(self, block_items, coord=None):
             self.block_items = block_items
             self.coord = coord
    @@ -236,6 +246,7 @@
         attr_names = ()
     
     class CompoundLiteral(Node):
    +    __slots__ = ('type', 'init', 'coord', '__weakref__')
         def __init__(self, type, init, coord=None):
             self.type = type
             self.init = init
    @@ -250,6 +261,7 @@
         attr_names = ()
     
     class Constant(Node):
    +    __slots__ = ('type', 'value', 'coord', '__weakref__')
         def __init__(self, type, value, coord=None):
             self.type = type
             self.value = value
    @@ -259,9 +271,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('type','value',)
    +    attr_names = ('type', 'value', )
     
     class Continue(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -271,6 +284,7 @@
         attr_names = ()
     
     class Decl(Node):
    +    __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__')
         def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None):
             self.name = name
             self.quals = quals
    @@ -288,9 +302,10 @@
             if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize))
             return tuple(nodelist)
     
    -    attr_names = ('name','quals','storage','funcspec',)
    +    attr_names = ('name', 'quals', 'storage', 'funcspec', )
     
     class DeclList(Node):
    +    __slots__ = ('decls', 'coord', '__weakref__')
         def __init__(self, decls, coord=None):
             self.decls = decls
             self.coord = coord
    @@ -304,6 +319,7 @@
         attr_names = ()
     
     class Default(Node):
    +    __slots__ = ('stmts', 'coord', '__weakref__')
         def __init__(self, stmts, coord=None):
             self.stmts = stmts
             self.coord = coord
    @@ -317,6 +333,7 @@
         attr_names = ()
     
     class DoWhile(Node):
    +    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
         def __init__(self, cond, stmt, coord=None):
             self.cond = cond
             self.stmt = stmt
    @@ -331,6 +348,7 @@
         attr_names = ()
     
     class EllipsisParam(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -340,6 +358,7 @@
         attr_names = ()
     
     class EmptyStatement(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -349,6 +368,7 @@
         attr_names = ()
     
     class Enum(Node):
    +    __slots__ = ('name', 'values', 'coord', '__weakref__')
         def __init__(self, name, values, coord=None):
             self.name = name
             self.values = values
    @@ -359,9 +379,10 @@
             if self.values is not None: nodelist.append(("values", self.values))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class Enumerator(Node):
    +    __slots__ = ('name', 'value', 'coord', '__weakref__')
         def __init__(self, name, value, coord=None):
             self.name = name
             self.value = value
    @@ -372,9 +393,10 @@
             if self.value is not None: nodelist.append(("value", self.value))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class EnumeratorList(Node):
    +    __slots__ = ('enumerators', 'coord', '__weakref__')
         def __init__(self, enumerators, coord=None):
             self.enumerators = enumerators
             self.coord = coord
    @@ -388,6 +410,7 @@
         attr_names = ()
     
     class ExprList(Node):
    +    __slots__ = ('exprs', 'coord', '__weakref__')
         def __init__(self, exprs, coord=None):
             self.exprs = exprs
             self.coord = coord
    @@ -401,6 +424,7 @@
         attr_names = ()
     
     class FileAST(Node):
    +    __slots__ = ('ext', 'coord', '__weakref__')
         def __init__(self, ext, coord=None):
             self.ext = ext
             self.coord = coord
    @@ -414,6 +438,7 @@
         attr_names = ()
     
     class For(Node):
    +    __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__')
         def __init__(self, init, cond, next, stmt, coord=None):
             self.init = init
             self.cond = cond
    @@ -432,6 +457,7 @@
         attr_names = ()
     
     class FuncCall(Node):
    +    __slots__ = ('name', 'args', 'coord', '__weakref__')
         def __init__(self, name, args, coord=None):
             self.name = name
             self.args = args
    @@ -446,6 +472,7 @@
         attr_names = ()
     
     class FuncDecl(Node):
    +    __slots__ = ('args', 'type', 'coord', '__weakref__')
         def __init__(self, args, type, coord=None):
             self.args = args
             self.type = type
    @@ -460,6 +487,7 @@
         attr_names = ()
     
     class FuncDef(Node):
    +    __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__')
         def __init__(self, decl, param_decls, body, coord=None):
             self.decl = decl
             self.param_decls = param_decls
    @@ -477,6 +505,7 @@
         attr_names = ()
     
     class Goto(Node):
    +    __slots__ = ('name', 'coord', '__weakref__')
         def __init__(self, name, coord=None):
             self.name = name
             self.coord = coord
    @@ -485,9 +514,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class ID(Node):
    +    __slots__ = ('name', 'coord', '__weakref__')
         def __init__(self, name, coord=None):
             self.name = name
             self.coord = coord
    @@ -496,9 +526,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class IdentifierType(Node):
    +    __slots__ = ('names', 'coord', '__weakref__')
         def __init__(self, names, coord=None):
             self.names = names
             self.coord = coord
    @@ -507,9 +538,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('names',)
    +    attr_names = ('names', )
     
     class If(Node):
    +    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
         def __init__(self, cond, iftrue, iffalse, coord=None):
             self.cond = cond
             self.iftrue = iftrue
    @@ -526,6 +558,7 @@
         attr_names = ()
     
     class InitList(Node):
    +    __slots__ = ('exprs', 'coord', '__weakref__')
         def __init__(self, exprs, coord=None):
             self.exprs = exprs
             self.coord = coord
    @@ -539,6 +572,7 @@
         attr_names = ()
     
     class Label(Node):
    +    __slots__ = ('name', 'stmt', 'coord', '__weakref__')
         def __init__(self, name, stmt, coord=None):
             self.name = name
             self.stmt = stmt
    @@ -549,9 +583,10 @@
             if self.stmt is not None: nodelist.append(("stmt", self.stmt))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class NamedInitializer(Node):
    +    __slots__ = ('name', 'expr', 'coord', '__weakref__')
         def __init__(self, name, expr, coord=None):
             self.name = name
             self.expr = expr
    @@ -567,6 +602,7 @@
         attr_names = ()
     
     class ParamList(Node):
    +    __slots__ = ('params', 'coord', '__weakref__')
         def __init__(self, params, coord=None):
             self.params = params
             self.coord = coord
    @@ -580,6 +616,7 @@
         attr_names = ()
     
     class PtrDecl(Node):
    +    __slots__ = ('quals', 'type', 'coord', '__weakref__')
         def __init__(self, quals, type, coord=None):
             self.quals = quals
             self.type = type
    @@ -590,9 +627,10 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('quals',)
    +    attr_names = ('quals', )
     
     class Return(Node):
    +    __slots__ = ('expr', 'coord', '__weakref__')
         def __init__(self, expr, coord=None):
             self.expr = expr
             self.coord = coord
    @@ -605,6 +643,7 @@
         attr_names = ()
     
     class Struct(Node):
    +    __slots__ = ('name', 'decls', 'coord', '__weakref__')
         def __init__(self, name, decls, coord=None):
             self.name = name
             self.decls = decls
    @@ -616,9 +655,10 @@
                 nodelist.append(("decls[%d]" % i, child))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class StructRef(Node):
    +    __slots__ = ('name', 'type', 'field', 'coord', '__weakref__')
         def __init__(self, name, type, field, coord=None):
             self.name = name
             self.type = type
    @@ -631,9 +671,10 @@
             if self.field is not None: nodelist.append(("field", self.field))
             return tuple(nodelist)
     
    -    attr_names = ('type',)
    +    attr_names = ('type', )
     
     class Switch(Node):
    +    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
         def __init__(self, cond, stmt, coord=None):
             self.cond = cond
             self.stmt = stmt
    @@ -648,6 +689,7 @@
         attr_names = ()
     
     class TernaryOp(Node):
    +    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
         def __init__(self, cond, iftrue, iffalse, coord=None):
             self.cond = cond
             self.iftrue = iftrue
    @@ -664,6 +706,7 @@
         attr_names = ()
     
     class TypeDecl(Node):
    +    __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__')
         def __init__(self, declname, quals, type, coord=None):
             self.declname = declname
             self.quals = quals
    @@ -675,9 +718,10 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('declname','quals',)
    +    attr_names = ('declname', 'quals', )
     
     class Typedef(Node):
    +    __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__')
         def __init__(self, name, quals, storage, type, coord=None):
             self.name = name
             self.quals = quals
    @@ -690,10 +734,12 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('name','quals','storage',)
    +    attr_names = ('name', 'quals', 'storage', )
     
     class Typename(Node):
    -    def __init__(self, quals, type, coord=None):
    +    __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__')
    +    def __init__(self, name, quals, type, coord=None):
    +        self.name = name
             self.quals = quals
             self.type = type
             self.coord = coord
    @@ -703,9 +749,10 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('quals',)
    +    attr_names = ('name', 'quals', )
     
     class UnaryOp(Node):
    +    __slots__ = ('op', 'expr', 'coord', '__weakref__')
         def __init__(self, op, expr, coord=None):
             self.op = op
             self.expr = expr
    @@ -716,9 +763,10 @@
             if self.expr is not None: nodelist.append(("expr", self.expr))
             return tuple(nodelist)
     
    -    attr_names = ('op',)
    +    attr_names = ('op', )
     
     class Union(Node):
    +    __slots__ = ('name', 'decls', 'coord', '__weakref__')
         def __init__(self, name, decls, coord=None):
             self.name = name
             self.decls = decls
    @@ -730,9 +778,10 @@
                 nodelist.append(("decls[%d]" % i, child))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class While(Node):
    +    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
         def __init__(self, cond, stmt, coord=None):
             self.cond = cond
             self.stmt = stmt
    diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py
    --- a/lib_pypy/cffi/_pycparser/c_generator.py
    +++ b/lib_pypy/cffi/_pycparser/c_generator.py
    @@ -3,7 +3,7 @@
     #
     # C code generator from pycparser AST nodes.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     from . import c_ast
    @@ -15,8 +15,6 @@
             generic_visit.
         """
         def __init__(self):
    -        self.output = ''
    -
             # Statements start with indentation of self.indent_level spaces, using
             # the _make_indent method
             #
    @@ -34,7 +32,7 @@
             if node is None:
                 return ''
             else:
    -            return ''.join(self.visit(c) for c in node.children())
    +            return ''.join(self.visit(c) for c_name, c in node.children())
     
         def visit_Constant(self, n):
             return n.value
    @@ -83,19 +81,22 @@
         def visit_IdentifierType(self, n):
             return ' '.join(n.names)
     
    +    def _visit_expr(self, n):
    +        if isinstance(n, c_ast.InitList):
    +            return '{' + self.visit(n) + '}'
    +        elif isinstance(n, c_ast.ExprList):
    +            return '(' + self.visit(n) + ')'
    +        else:
    +            return self.visit(n)
    +
         def visit_Decl(self, n, no_type=False):
             # no_type is used when a Decl is part of a DeclList, where the type is
    -        # explicitly only for the first delaration in a list.
    +        # explicitly only for the first declaration in a list.
             #
             s = n.name if no_type else self._generate_decl(n)
             if n.bitsize: s += ' : ' + self.visit(n.bitsize)
             if n.init:
    -            if isinstance(n.init, c_ast.InitList):
    -                s += ' = {' + self.visit(n.init) + '}'
    -            elif isinstance(n.init, c_ast.ExprList):
    -                s += ' = (' + self.visit(n.init) + ')'
    -            else:
    -                s += ' = ' + self.visit(n.init)
    +            s += ' = ' + self._visit_expr(n.init)
             return s
     
         def visit_DeclList(self, n):
    @@ -118,21 +119,13 @@
         def visit_ExprList(self, n):
             visited_subexprs = []
             for expr in n.exprs:
    -            if isinstance(expr, c_ast.ExprList):
    -                visited_subexprs.append('{' + self.visit(expr) + '}')
    -            else:
    -                visited_subexprs.append(self.visit(expr))
    +            visited_subexprs.append(self._visit_expr(expr))
             return ', '.join(visited_subexprs)
     
         def visit_InitList(self, n):
             visited_subexprs = []
             for expr in n.exprs:
    -            if isinstance(expr, c_ast.ExprList):
    -                visited_subexprs.append('(' + self.visit(expr) + ')')
    -            elif isinstance(expr, c_ast.InitList):
    -                visited_subexprs.append('{' + self.visit(expr) + '}')
    -            else:
    -                visited_subexprs.append(self.visit(expr))
    +            visited_subexprs.append(self._visit_expr(expr))
             return ', '.join(visited_subexprs)
     
         def visit_Enum(self, n):
    @@ -195,9 +188,9 @@
             return 'continue;'
     
         def visit_TernaryOp(self, n):
    -        s = self.visit(n.cond) + ' ? '
    -        s += self.visit(n.iftrue) + ' : '
    -        s += self.visit(n.iffalse)
    +        s = self._visit_expr(n.cond) + ' ? '
    +        s += self._visit_expr(n.iftrue) + ' : '
    +        s += self._visit_expr(n.iffalse)
             return s
     
         def visit_If(self, n):
    @@ -281,6 +274,9 @@
             s += ' = ' + self.visit(n.expr)
             return s
     
    +    def visit_FuncDecl(self, n):
    +        return self._generate_type(n)
    +
         def _generate_struct_union(self, n, name):
             """ Generates code for structs and unions. name should be either
                 'struct' or union.
    @@ -384,7 +380,7 @@
             """ Visits 'n' and returns its string representation, parenthesized
                 if the condition function applied to the node returns True.
             """
    -        s = self.visit(n)
    +        s = self._visit_expr(n)
             if condition(n):
                 return '(' + s + ')'
             else:
    @@ -401,5 +397,3 @@
             """
             return isinstance(n,(   c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
                                     c_ast.StructRef, c_ast.FuncCall))
    -
    -
    diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py
    --- a/lib_pypy/cffi/_pycparser/c_lexer.py
    +++ b/lib_pypy/cffi/_pycparser/c_lexer.py
    @@ -3,7 +3,7 @@
     #
     # CLexer class: lexer for the C language
     #
    -# Copyright (C) 2008-2013, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     import re
    @@ -102,7 +102,8 @@
         keywords = (
             '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST',
             'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN',
    -        'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER',
    +        'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 
    +        'REGISTER', 'OFFSETOF',
             'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT',
             'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID',
             'VOLATILE', 'WHILE',
    @@ -129,7 +130,7 @@
             'TYPEID',
     
             # constants
    -        'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX',
    +        'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN',
             'FLOAT_CONST', 'HEX_FLOAT_CONST',
             'CHAR_CONST',
             'WCHAR_CONST',
    @@ -183,12 +184,15 @@
     
         hex_prefix = '0[xX]'
         hex_digits = '[0-9a-fA-F]+'
    +    bin_prefix = '0[bB]'
    +    bin_digits = '[01]+'
     
         # integer constants (K&R2: A.2.5.1)
         integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?'
         decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')'
         octal_constant = '0[0-7]*'+integer_suffix_opt
         hex_constant = hex_prefix+hex_digits+integer_suffix_opt
    +    bin_constant = bin_prefix+bin_digits+integer_suffix_opt
     
         bad_octal_constant = '0[0-7]*[89]'
     
    @@ -302,7 +306,7 @@
             r'pragma'
             pass
     
    -    t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789'
    +    t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789'
     
         @TOKEN(string_literal)
         def t_pppragma_STR(self, t): pass
    @@ -419,6 +423,10 @@
         def t_INT_CONST_HEX(self, t):
             return t
     
    +    @TOKEN(bin_constant)
    +    def t_INT_CONST_BIN(self, t):
    +        return t
    +
         @TOKEN(bad_octal_constant)
         def t_BAD_CONST_OCT(self, t):
             msg = "Invalid octal constant"
    diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py
    --- a/lib_pypy/cffi/_pycparser/c_parser.py
    +++ b/lib_pypy/cffi/_pycparser/c_parser.py
    @@ -3,7 +3,7 @@
     #
     # CParser class: Parser and AST builder for the C language
     #
    -# Copyright (C) 2008-2013, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     import re
    @@ -23,7 +23,8 @@
                 lextab='cffi._pycparser.lextab',
                 yacc_optimize=True,
                 yacctab='cffi._pycparser.yacctab',
    -            yacc_debug=False):
    +            yacc_debug=False,
    +            taboutputdir=''):
             """ Create a new CParser.
     
                 Some arguments for controlling the debug/optimization
    @@ -64,6 +65,10 @@
                 yacc_debug:
                     Generate a parser.out file that explains how yacc
                     built the parsing table from the grammar.
    +
    +            taboutputdir:
    +                Set this parameter to control the location of generated
    +                lextab and yacctab files.
             """
             self.clex = CLexer(
                 error_func=self._lex_error_func,
    @@ -73,7 +78,8 @@
     
             self.clex.build(
                 optimize=lex_optimize,
    -            lextab=lextab)
    +            lextab=lextab,
    +            outputdir=taboutputdir)
             self.tokens = self.clex.tokens
     
             rules_with_opt = [
    @@ -85,6 +91,7 @@
                 'expression',
                 'identifier_list',
                 'init_declarator_list',
    +            'initializer_list',
                 'parameter_type_list',
                 'specifier_qualifier_list',
                 'block_item_list',
    @@ -100,7 +107,8 @@
                 start='translation_unit_or_empty',
                 debug=yacc_debug,
                 optimize=yacc_optimize,
    -            tabmodule=yacctab)
    +            tabmodule=yacctab,
    +            outputdir=taboutputdir)
     
             # Stack of scopes for keeping track of symbols. _scope_stack[-1] is
             # the current (topmost) scope. Each scope is a dictionary that
    @@ -211,13 +219,11 @@
         # The basic declaration here is 'int c', and the pointer and
         # the array are the modifiers.
         #
    -    # Basic declarations are represented by TypeDecl (from module
    -    # c_ast) and the modifiers are FuncDecl, PtrDecl and
    -    # ArrayDecl.
    +    # Basic declarations are represented by TypeDecl (from module c_ast) and the
    +    # modifiers are FuncDecl, PtrDecl and ArrayDecl.
         #
    -    # The standard states that whenever a new modifier is parsed,
    -    # it should be added to the end of the list of modifiers. For
    -    # example:
    +    # The standard states that whenever a new modifier is parsed, it should be
    +    # added to the end of the list of modifiers. For example:
         #
         # K&R2 A.8.6.2: Array Declarators
         #
    @@ -236,7 +242,6 @@
         # useful for pointers, that can come as a chain from the rule
         # p_pointer. In this case, the whole modifier list is spliced
         # into the new location.
    -    #
         def _type_modify_decl(self, decl, modifier):
             """ Tacks a type modifier on a declarator, and returns
                 the modified declarator.
    @@ -983,28 +988,52 @@
             p[0] = p[2]
     
         def p_direct_declarator_3(self, p):
    -        """ direct_declarator   : direct_declarator LBRACKET assignment_expression_opt RBRACKET
    +        """ direct_declarator   : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET
             """
    +        quals = (p[3] if len(p) > 5 else []) or []
    +        # Accept dimension qualifiers
    +        # Per C99 6.7.5.3 p7
             arr = c_ast.ArrayDecl(
                 type=None,
    -            dim=p[3],
    +            dim=p[4] if len(p) > 5 else p[3],
    +            dim_quals=quals,
    +            coord=p[1].coord)
    +
    +        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
    +
    +    def p_direct_declarator_4(self, p):
    +        """ direct_declarator   : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET
    +                                | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET
    +        """
    +        # Using slice notation for PLY objects doesn't work in Python 3 for the
    +        # version of PLY embedded with pycparser; see PLY Google Code issue 30.
    +        # Work around that here by listing the two elements separately.
    +        listed_quals = [item if isinstance(item, list) else [item]
    +            for item in [p[3],p[4]]]
    +        dim_quals = [qual for sublist in listed_quals for qual in sublist
    +            if qual is not None]
    +        arr = c_ast.ArrayDecl(
    +            type=None,
    +            dim=p[5],
    +            dim_quals=dim_quals,
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
     
         # Special for VLAs
         #
    -    def p_direct_declarator_4(self, p):
    -        """ direct_declarator   : direct_declarator LBRACKET TIMES RBRACKET
    +    def p_direct_declarator_5(self, p):
    +        """ direct_declarator   : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET
             """
             arr = c_ast.ArrayDecl(
                 type=None,
    -            dim=c_ast.ID(p[3], self._coord(p.lineno(3))),
    +            dim=c_ast.ID(p[4], self._coord(p.lineno(4))),
    +            dim_quals=p[3] if p[3] != None else [],
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
     
    -    def p_direct_declarator_5(self, p):
    +    def p_direct_declarator_6(self, p):
             """ direct_declarator   : direct_declarator LPAREN parameter_type_list RPAREN
                                     | direct_declarator LPAREN identifier_list_opt RPAREN
             """
    @@ -1037,11 +1066,30 @@
                         | TIMES type_qualifier_list_opt pointer
             """
             coord = self._coord(p.lineno(1))
    -
    -        p[0] = c_ast.PtrDecl(
    -            quals=p[2] or [],
    -            type=p[3] if len(p) > 3 else None,
    -            coord=coord)
    +        # Pointer decls nest from inside out. This is important when different
    +        # levels have different qualifiers. For example:
    +        #
    +        #  char * const * p;
    +        #
    +        # Means "pointer to const pointer to char"
    +        #
    +        # While: 
    +        #
    +        #  char ** const p;
    +        #
    +        # Means "const pointer to pointer to char"
    +        #
    +        # So when we construct PtrDecl nestings, the leftmost pointer goes in
    +        # as the most nested type.
    +        nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord)
    +        if len(p) > 3:
    +            tail_type = p[3]
    +            while tail_type.type is not None:
    +                tail_type = tail_type.type
    +            tail_type.type = nested_type
    +            p[0] = p[3]
    +        else:
    +            p[0] = nested_type
     
         def p_type_qualifier_list(self, p):
             """ type_qualifier_list : type_qualifier
    @@ -1101,6 +1149,7 @@
             #
             else:
                 decl = c_ast.Typename(
    +                name='',
                     quals=spec['qual'],
                     type=p[2] or c_ast.TypeDecl(None, None, None),
                     coord=self._coord(p.lineno(2)))
    @@ -1125,10 +1174,13 @@
             p[0] = p[1]
     
         def p_initializer_2(self, p):
    -        """ initializer : brace_open initializer_list brace_close
    +        """ initializer : brace_open initializer_list_opt brace_close
                             | brace_open initializer_list COMMA brace_close
             """
    -        p[0] = p[2]
    +        if p[2] is None:
    +            p[0] = c_ast.InitList([], self._coord(p.lineno(1)))
    +        else:
    +            p[0] = p[2]
     
         def p_initializer_list(self, p):
             """ initializer_list    : designation_opt initializer
    @@ -1172,6 +1224,7 @@
             #~ print '=========='
     
             typename = c_ast.Typename(
    +            name='',
                 quals=p[1]['qual'],
                 type=p[2] or c_ast.TypeDecl(None, None, None),
                 coord=self._coord(p.lineno(2)))
    @@ -1211,6 +1264,7 @@
             arr = c_ast.ArrayDecl(
                 type=None,
                 dim=p[3],
    +            dim_quals=[],
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
    @@ -1221,6 +1275,7 @@
             p[0] = c_ast.ArrayDecl(
                 type=c_ast.TypeDecl(None, None, None),
                 dim=p[2],
    +            dim_quals=[],
                 coord=self._coord(p.lineno(1)))
     
         def p_direct_abstract_declarator_4(self, p):
    @@ -1229,6 +1284,7 @@
             arr = c_ast.ArrayDecl(
                 type=None,
                 dim=c_ast.ID(p[3], self._coord(p.lineno(3))),
    +            dim_quals=[],
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
    @@ -1239,6 +1295,7 @@
             p[0] = c_ast.ArrayDecl(
                 type=c_ast.TypeDecl(None, None, None),
                 dim=c_ast.ID(p[3], self._coord(p.lineno(3))),
    +            dim_quals=[],
                 coord=self._coord(p.lineno(1)))
     
         def p_direct_abstract_declarator_6(self, p):
    @@ -1322,7 +1379,8 @@
     
         def p_iteration_statement_4(self, p):
             """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """
    -        p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1)))
    +        p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))),
    +                         p[4], p[6], p[8], self._coord(p.lineno(1)))
     
         def p_jump_statement_1(self, p):
             """ jump_statement  : GOTO ID SEMI """
    @@ -1525,6 +1583,14 @@
             """ primary_expression  : LPAREN expression RPAREN """
             p[0] = p[2]
     
    +    def p_primary_expression_5(self, p):
    +        """ primary_expression  : OFFSETOF LPAREN type_name COMMA identifier RPAREN
    +        """
    +        coord = self._coord(p.lineno(1))
    +        p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord),
    +                              c_ast.ExprList([p[3], p[5]], coord),
    +                              coord)
    +
         def p_argument_expression_list(self, p):
             """ argument_expression_list    : assignment_expression
                                             | argument_expression_list COMMA assignment_expression
    @@ -1543,6 +1609,7 @@
             """ constant    : INT_CONST_DEC
                             | INT_CONST_OCT
                             | INT_CONST_HEX
    +                        | INT_CONST_BIN
             """
             p[0] = c_ast.Constant(
                 'int', p[1], self._coord(p.lineno(1)))
    @@ -1585,7 +1652,7 @@
                 p[0] = c_ast.Constant(
                     'string', p[1], self._coord(p.lineno(1)))
             else:
    -            p[1].value = p[1].value.rstrip[:-1] + p[2][1:]
    +            p[1].value = p[1].value.rstrip()[:-1] + p[2][2:]
                 p[0] = p[1]
     
         def p_brace_open(self, p):
    diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py
    --- a/lib_pypy/cffi/_pycparser/lextab.py
    +++ b/lib_pypy/cffi/_pycparser/lextab.py
    @@ -1,9 +1,9 @@
     # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit!
     _tabversion   = '3.4'
    -_lextokens    = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1}
    +_lextokens    = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1}
     _lexreflags   = 0
     _lexliterals  = ''
     _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'}
    -_lexstatere   = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]}
    -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'}
    +_lexstatere   = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]}
    +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'}
     _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'}
    diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py
    --- a/lib_pypy/cffi/_pycparser/plyparser.py
    +++ b/lib_pypy/cffi/_pycparser/plyparser.py
    @@ -4,7 +4,7 @@
     # PLYParser class and other utilites for simplifying programming
     # parsers with PLY
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
    @@ -15,6 +15,7 @@
                 - Line number
                 - (optional) column number, for the Lexer
         """
    +    __slots__ = ('file', 'line', 'column', '__weakref__')
         def __init__(self, file, line, column=None):
             self.file = file
             self.line = line
    @@ -52,4 +53,3 @@
     
         def _parse_error(self, msg, coord):
             raise ParseError("%s: %s" % (coord, msg))
    -
    diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py
    --- a/lib_pypy/cffi/_pycparser/yacctab.py
    +++ b/lib_pypy/cffi/_pycparser/yacctab.py
    @@ -5,9 +5,9 @@
     
     _lr_method = 'LALR'
     
    -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87'
    +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b'
         
    -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),}
    +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),}
     
     _lr_action = { }
     for _k, _v in _lr_action_items.items():
    @@ -16,7 +16,7 @@
           _lr_action[_x][_k] = _y
     del _lr_action_items
     
    -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),}
    +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),}
     
     _lr_goto = { }
     for _k, _v in _lr_goto_items.items():
    @@ -26,261 +26,267 @@
     del _lr_goto_items
     _lr_productions = [
       ("S' -> translation_unit_or_empty","S'",1,None,None,None),
    -  ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41),
    -  ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42),
    -  ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41),
    -  ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42),
    -  ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41),
    -  ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42),
    -  ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41),
    -  ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42),
    -  ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41),
    -  ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42),
    -  ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41),
    -  ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42),
    -  ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41),
    -  ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42),
    -  ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41),
    -  ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42),
    -  ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41),
    -  ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',42),
    -  ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',41),
    -  ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','../pycparser/plyparser.py',42),
    -  ('specifier_qualifier_list_opt -> empty','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',41),
    -  ('specifier_qualifier_list_opt -> specifier_qualifier_list','specifier_qualifier_list_opt',1,'p_specifier_qualifier_list_opt','../pycparser/plyparser.py',42),
    -  ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',41),
    -  ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','../pycparser/plyparser.py',42),
    -  ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',41),
    -  ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','../pycparser/plyparser.py',42),
    -  ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',496),
    -  ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','../pycparser/c_parser.py',497),
    -  ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','../pycparser/c_parser.py',505),
    -  ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','../pycparser/c_parser.py',512),
    -  ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','../pycparser/c_parser.py',524),
    -  ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','../pycparser/c_parser.py',529),
    
    From noreply at buildbot.pypy.org  Sun Nov 22 07:23:17 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Sun, 22 Nov 2015 13:23:17 +0100 (CET)
    Subject: [pypy-commit] pypy default: hg merge
    Message-ID: <20151122122317.60B4C1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: 
    Changeset: r80832:2bd0965ba1ae
    Date: 2015-11-22 13:23 +0100
    http://bitbucket.org/pypy/pypy/changeset/2bd0965ba1ae/
    
    Log:	hg merge
    
    diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
    --- a/pypy/goal/targetpypystandalone.py
    +++ b/pypy/goal/targetpypystandalone.py
    @@ -302,7 +302,7 @@
         
         def hack_for_cffi_modules(self, driver):
             # HACKHACKHACK
    -        # ugly hack to modify target goal from compile_c to build_cffi_imports
    +        # ugly hack to modify target goal from compile_* to build_cffi_imports
             # this should probably get cleaned up and merged with driver.create_exe
             from rpython.translator.driver import taskdef
             import types
    @@ -316,7 +316,8 @@
                     name = name.new(ext='exe')
                 return name
     
    -        @taskdef(['compile_c'], "Create cffi bindings for modules")
    +        compile_goal, = driver.backend_select_goals(['compile'])
    +        @taskdef([compile_goal], "Create cffi bindings for modules")
             def task_build_cffi_imports(self):
                 from pypy.tool.build_cffi_imports import create_cffi_import_libraries
                 ''' Use cffi to compile cffi interfaces to modules'''
    @@ -335,7 +336,7 @@
                 # if failures, they were already printed
                 print  >> sys.stderr, str(exename),'successfully built, but errors while building the above modules will be ignored'
             driver.task_build_cffi_imports = types.MethodType(task_build_cffi_imports, driver)
    -        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, ['compile_c']
    +        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, [compile_goal]
             driver.default_goal = 'build_cffi_imports'
             # HACKHACKHACK end
     
    
    From noreply at buildbot.pypy.org  Sun Nov 22 13:00:01 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sun, 22 Nov 2015 19:00:01 +0100 (CET)
    Subject: [pypy-commit] pypy exc-later: Use annotations to represent the
     exception behaviour of operations
    Message-ID: <20151122180001.BB39A1C1453@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: exc-later
    Changeset: r80833:9c9c044a9aff
    Date: 2015-11-22 01:50 +0000
    http://bitbucket.org/pypy/pypy/changeset/9c9c044a9aff/
    
    Log:	Use annotations to represent the exception behaviour of operations
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -11,7 +11,7 @@
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, SomeExceptCase, s_ImpossibleValue)
    +        typeof, SomeExceptCase, s_ImpossibleValue, SomeInstance)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    @@ -488,31 +488,20 @@
     
             if block.canraise:
                 op = block.raising_op
    -            can_only_throw = op.get_can_only_throw(self)
    -            if can_only_throw is not None:
    -                # filter out those exceptions which cannot
    -                # occur for this specific, typed operation.
    -                s_exception = self.bookkeeper.new_exception(can_only_throw)
    -                for link in exits:
    -                    case = link.exitcase
    -                    if case is None:
    -                        self.follow_link(graph, link, {})
    -                        continue
    -                    if s_exception == s_ImpossibleValue:
    -                        break
    -                    s_case = SomeExceptCase(
    -                            self.bookkeeper.getuniqueclassdef(case))
    -                    s_matching_exc = s_exception.intersection(s_case)
    -                    if s_matching_exc != s_ImpossibleValue:
    -                        self.follow_raise_link(graph, link, s_matching_exc)
    -                    s_exception = s_exception.difference(s_case)
    -            else:
    -                for link in exits:
    -                    if link.exitcase is None:
    -                        self.follow_link(graph, link, {})
    -                    else:
    -                        s_exception = self.bookkeeper.valueoftype(link.exitcase)
    -                        self.follow_raise_link(graph, link, s_exception)
    +            s_exception = self.get_exception(op)
    +            for link in exits:
    +                case = link.exitcase
    +                if case is None:
    +                    self.follow_link(graph, link, {})
    +                    continue
    +                if s_exception == s_ImpossibleValue:
    +                    break
    +                s_case = SomeExceptCase(
    +                        self.bookkeeper.getuniqueclassdef(case))
    +                s_matching_exc = s_exception.intersection(s_case)
    +                if s_matching_exc != s_ImpossibleValue:
    +                    self.follow_raise_link(graph, link, s_matching_exc)
    +                s_exception = s_exception.difference(s_case)
             else:
                 if isinstance(block.exitswitch, Variable):
                     knowntypedata = getattr(block.exitswitch.annotation,
    @@ -615,6 +604,16 @@
             assert isinstance(op.result, Variable)
             self.setbinding(op.result, resultcell)  # bind resultcell to op.result
     
    +    def get_exception(self, operation):
    +        """
    +        Return the annotation for all exceptions that `operation` may raise.
    +        """
    +        can_only_throw = operation.get_can_only_throw(self)
    +        if can_only_throw is None:
    +            return SomeInstance(self.bookkeeper.getuniqueclassdef(Exception))
    +        else:
    +            return self.bookkeeper.new_exception(can_only_throw)
    +
     
     class BlockedInference(Exception):
         """This exception signals the type inference engine that the situation
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -445,6 +445,22 @@
             else:
                 return None
     
    +    def intersection(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        if self.classdef.issubclass(other.case):
    +            return self
    +        elif other.case.issubclass(self.classdef):
    +            return SomeInstance(other.case)
    +        else:
    +            return s_ImpossibleValue
    +
    +    def difference(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        if self.classdef.issubclass(other.case):
    +            return s_ImpossibleValue
    +        else:
    +            return self
    +
         def can_be_none(self):
             return self.can_be_None
     
    
    From noreply at buildbot.pypy.org  Sun Nov 22 13:00:03 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sun, 22 Nov 2015 19:00:03 +0100 (CET)
    Subject: [pypy-commit] pypy exc-later: Replace all uses of SomeExceptCase
     with SomeInstance
    Message-ID: <20151122180003.E31311C1453@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: exc-later
    Changeset: r80834:bcf830d9e710
    Date: 2015-11-22 05:38 +0000
    http://bitbucket.org/pypy/pypy/changeset/bcf830d9e710/
    
    Log:	Replace all uses of SomeExceptCase with SomeInstance
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -11,7 +11,7 @@
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, SomeExceptCase, s_ImpossibleValue, SomeInstance)
    +        typeof, s_ImpossibleValue, SomeInstance)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    @@ -496,8 +496,7 @@
                         continue
                     if s_exception == s_ImpossibleValue:
                         break
    -                s_case = SomeExceptCase(
    -                        self.bookkeeper.getuniqueclassdef(case))
    +                s_case = SomeInstance(self.bookkeeper.getuniqueclassdef(case))
                     s_matching_exc = s_exception.intersection(s_case)
                     if s_matching_exc != s_ImpossibleValue:
                         self.follow_raise_link(graph, link, s_matching_exc)
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -446,17 +446,18 @@
                 return None
     
         def intersection(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        if self.classdef.issubclass(other.case):
    -            return self
    -        elif other.case.issubclass(self.classdef):
    -            return SomeInstance(other.case)
    +        assert isinstance(other, SomeInstance)
    +        can_be_None = self.can_be_None and other.can_be_None
    +        if self.classdef.issubclass(other.classdef):
    +            return SomeInstance(self.classdef, can_be_None=can_be_None)
    +        elif other.classdef.issubclass(self.classdef):
    +            return SomeInstance(other.classdef, can_be_None=can_be_None)
             else:
                 return s_ImpossibleValue
     
         def difference(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        if self.classdef.issubclass(other.case):
    +        assert isinstance(other, SomeInstance)
    +        if self.classdef.issubclass(other.classdef):
                 return s_ImpossibleValue
             else:
                 return self
    @@ -476,16 +477,16 @@
             self.classdefs = classdefs
     
         def intersection(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
    +        assert isinstance(other, SomeInstance)
    +        classdefs = {c for c in self.classdefs if c.issubclass(other.classdef)}
             if classdefs:
                 return SomeException(classdefs)
             else:
                 return s_ImpossibleValue
     
         def difference(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
    +        assert isinstance(other, SomeInstance)
    +        classdefs = {c for c in self.classdefs if not c.issubclass(other.classdef)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    @@ -495,15 +496,6 @@
             return unionof(*[SomeInstance(cdef) for cdef in self.classdefs])
     
     
    -class SomeExceptCase(SomeObject):
    -    """The set of exceptions that match a given except clause.
    -
    -    IOW, the set of exceptions that verify isinstance(exc, self.case).
    -    """
    -    def __init__(self, case):
    -        self.case = case
    -
    -
     class SomePBC(SomeObject):
         """Stands for a global user instance, built prior to the analysis,
         or a set of such instances."""
    
    From noreply at buildbot.pypy.org  Sun Nov 22 13:00:06 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sun, 22 Nov 2015 19:00:06 +0100 (CET)
    Subject: [pypy-commit] pypy exc-later: Propagate exception annotations from
     functions to their callers (work in progress)
    Message-ID: <20151122180006.03BD71C1453@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: exc-later
    Changeset: r80835:ec9ba2968c66
    Date: 2015-11-22 18:00 +0000
    http://bitbucket.org/pypy/pypy/changeset/ec9ba2968c66/
    
    Log:	Propagate exception annotations from functions to their callers
    	(work in progress)
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -7,12 +7,12 @@
     from rpython.tool.pairtype import pair
     from rpython.tool.error import (format_blocked_annotation_error,
                                  gather_error, source_lines)
    -from rpython.flowspace.model import Variable, Constant, checkgraph
    +from rpython.flowspace.model import Variable, Constant, checkgraph, FunctionGraph
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, s_ImpossibleValue, SomeInstance)
    -from rpython.annotator.bookkeeper import Bookkeeper
    +    unionof, typeof, s_ImpossibleValue, SomeInstance, SomePBC)
    +from rpython.annotator.bookkeeper import Bookkeeper, simple_args
     from rpython.rtyper.normalizecalls import perform_normalizations
     
     import py
    @@ -265,6 +265,7 @@
             # points to this func which triggers a reflow whenever the
             # return block of this graph has been analysed.
             callpositions = self.notify.setdefault(graph.returnblock, {})
    +        callpositions2 = self.notify.setdefault(graph.exceptblock, {})
             if whence is not None:
                 if callable(whence):
                     def callback():
    @@ -272,6 +273,7 @@
                 else:
                     callback = whence
                 callpositions[callback] = True
    +            callpositions2[callback] = True
     
             # generalize the function's input arguments
             self.addpendingblock(graph, graph.startblock, inputcells)
    @@ -607,6 +609,24 @@
             """
             Return the annotation for all exceptions that `operation` may raise.
             """
    +        from rpython.flowspace.operation import SimpleCall
    +        if isinstance(operation, SimpleCall):
    +            s_func = self.annotation(operation.args[0])
    +            if (isinstance(s_func, SomePBC) and
    +                    hasattr(s_func.getKind(), 'get_graph')):  # exclude ClassDesc
    +                args_s = [self.annotation(v) for v in operation.args[1:]]
    +                argspec = simple_args(args_s)
    +                exceptions_s = []
    +                for desc in s_func.descriptions:
    +                    with self.bookkeeper.at_position(None):
    +                        graph = desc.get_graph(argspec, operation)
    +                    if not isinstance(graph, FunctionGraph):
    +                        break
    +                    s_exc = graph.exceptblock.inputargs[1].annotation
    +                    if s_exc is not None:
    +                        exceptions_s.append(s_exc)
    +                else:
    +                    return unionof(*exceptions_s)
             can_only_throw = operation.get_can_only_throw(self)
             if can_only_throw is None:
                 return SomeInstance(self.bookkeeper.getuniqueclassdef(Exception))
    
    From noreply at buildbot.pypy.org  Sun Nov 22 15:26:29 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sun, 22 Nov 2015 21:26:29 +0100 (CET)
    Subject: [pypy-commit] pypy anntype2: Following up on branch 'anntype'
    Message-ID: <20151122202629.3DD791C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype2
    Changeset: r80836:f84f99b5bf95
    Date: 2015-11-22 20:05 +0000
    http://bitbucket.org/pypy/pypy/changeset/f84f99b5bf95/
    
    Log:	Following up on branch 'anntype'
    
    
    From noreply at buildbot.pypy.org  Sun Nov 22 15:26:31 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sun, 22 Nov 2015 21:26:31 +0100 (CET)
    Subject: [pypy-commit] pypy anntype2: Use annotations to represent the
     exception behaviour of operations
    Message-ID: <20151122202631.698CD1C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype2
    Changeset: r80837:5b6b723dac8f
    Date: 2015-11-22 01:50 +0000
    http://bitbucket.org/pypy/pypy/changeset/5b6b723dac8f/
    
    Log:	Use annotations to represent the exception behaviour of operations
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -11,7 +11,7 @@
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, SomeExceptCase, s_ImpossibleValue)
    +        typeof, SomeExceptCase, s_ImpossibleValue, SomeInstance)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    @@ -488,31 +488,20 @@
     
             if block.canraise:
                 op = block.raising_op
    -            can_only_throw = op.get_can_only_throw(self)
    -            if can_only_throw is not None:
    -                # filter out those exceptions which cannot
    -                # occur for this specific, typed operation.
    -                s_exception = self.bookkeeper.new_exception(can_only_throw)
    -                for link in exits:
    -                    case = link.exitcase
    -                    if case is None:
    -                        self.follow_link(graph, link, {})
    -                        continue
    -                    if s_exception == s_ImpossibleValue:
    -                        break
    -                    s_case = SomeExceptCase(
    -                            self.bookkeeper.getuniqueclassdef(case))
    -                    s_matching_exc = s_exception.intersection(s_case)
    -                    if s_matching_exc != s_ImpossibleValue:
    -                        self.follow_raise_link(graph, link, s_matching_exc)
    -                    s_exception = s_exception.difference(s_case)
    -            else:
    -                for link in exits:
    -                    if link.exitcase is None:
    -                        self.follow_link(graph, link, {})
    -                    else:
    -                        s_exception = self.bookkeeper.valueoftype(link.exitcase)
    -                        self.follow_raise_link(graph, link, s_exception)
    +            s_exception = self.get_exception(op)
    +            for link in exits:
    +                case = link.exitcase
    +                if case is None:
    +                    self.follow_link(graph, link, {})
    +                    continue
    +                if s_exception == s_ImpossibleValue:
    +                    break
    +                s_case = SomeExceptCase(
    +                        self.bookkeeper.getuniqueclassdef(case))
    +                s_matching_exc = s_exception.intersection(s_case)
    +                if s_matching_exc != s_ImpossibleValue:
    +                    self.follow_raise_link(graph, link, s_matching_exc)
    +                s_exception = s_exception.difference(s_case)
             else:
                 if isinstance(block.exitswitch, Variable):
                     knowntypedata = getattr(block.exitswitch.annotation,
    @@ -615,6 +604,16 @@
             assert isinstance(op.result, Variable)
             self.setbinding(op.result, resultcell)  # bind resultcell to op.result
     
    +    def get_exception(self, operation):
    +        """
    +        Return the annotation for all exceptions that `operation` may raise.
    +        """
    +        can_only_throw = operation.get_can_only_throw(self)
    +        if can_only_throw is None:
    +            return SomeInstance(self.bookkeeper.getuniqueclassdef(Exception))
    +        else:
    +            return self.bookkeeper.new_exception(can_only_throw)
    +
     
     class BlockedInference(Exception):
         """This exception signals the type inference engine that the situation
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -445,6 +445,22 @@
             else:
                 return None
     
    +    def intersection(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        if self.classdef.issubclass(other.case):
    +            return self
    +        elif other.case.issubclass(self.classdef):
    +            return SomeInstance(other.case)
    +        else:
    +            return s_ImpossibleValue
    +
    +    def difference(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        if self.classdef.issubclass(other.case):
    +            return s_ImpossibleValue
    +        else:
    +            return self
    +
         def can_be_none(self):
             return self.can_be_None
     
    
    From noreply at buildbot.pypy.org  Sun Nov 22 15:26:33 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Sun, 22 Nov 2015 21:26:33 +0100 (CET)
    Subject: [pypy-commit] pypy anntype2: Replace all uses of SomeExceptCase
     with SomeInstance
    Message-ID: <20151122202633.821EF1C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype2
    Changeset: r80838:fd73e9433923
    Date: 2015-11-22 05:38 +0000
    http://bitbucket.org/pypy/pypy/changeset/fd73e9433923/
    
    Log:	Replace all uses of SomeExceptCase with SomeInstance
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -11,7 +11,7 @@
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, SomeExceptCase, s_ImpossibleValue, SomeInstance)
    +        typeof, s_ImpossibleValue, SomeInstance)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    @@ -496,8 +496,7 @@
                         continue
                     if s_exception == s_ImpossibleValue:
                         break
    -                s_case = SomeExceptCase(
    -                        self.bookkeeper.getuniqueclassdef(case))
    +                s_case = SomeInstance(self.bookkeeper.getuniqueclassdef(case))
                     s_matching_exc = s_exception.intersection(s_case)
                     if s_matching_exc != s_ImpossibleValue:
                         self.follow_raise_link(graph, link, s_matching_exc)
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -446,17 +446,18 @@
                 return None
     
         def intersection(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        if self.classdef.issubclass(other.case):
    -            return self
    -        elif other.case.issubclass(self.classdef):
    -            return SomeInstance(other.case)
    +        assert isinstance(other, SomeInstance)
    +        can_be_None = self.can_be_None and other.can_be_None
    +        if self.classdef.issubclass(other.classdef):
    +            return SomeInstance(self.classdef, can_be_None=can_be_None)
    +        elif other.classdef.issubclass(self.classdef):
    +            return SomeInstance(other.classdef, can_be_None=can_be_None)
             else:
                 return s_ImpossibleValue
     
         def difference(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        if self.classdef.issubclass(other.case):
    +        assert isinstance(other, SomeInstance)
    +        if self.classdef.issubclass(other.classdef):
                 return s_ImpossibleValue
             else:
                 return self
    @@ -476,16 +477,16 @@
             self.classdefs = classdefs
     
         def intersection(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
    +        assert isinstance(other, SomeInstance)
    +        classdefs = {c for c in self.classdefs if c.issubclass(other.classdef)}
             if classdefs:
                 return SomeException(classdefs)
             else:
                 return s_ImpossibleValue
     
         def difference(self, other):
    -        assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
    +        assert isinstance(other, SomeInstance)
    +        classdefs = {c for c in self.classdefs if not c.issubclass(other.classdef)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    @@ -495,15 +496,6 @@
             return unionof(*[SomeInstance(cdef) for cdef in self.classdefs])
     
     
    -class SomeExceptCase(SomeObject):
    -    """The set of exceptions that match a given except clause.
    -
    -    IOW, the set of exceptions that verify isinstance(exc, self.case).
    -    """
    -    def __init__(self, case):
    -        self.case = case
    -
    -
     class SomePBC(SomeObject):
         """Stands for a global user instance, built prior to the analysis,
         or a set of such instances."""
    
    From noreply at buildbot.pypy.org  Sun Nov 22 15:46:48 2015
    From: noreply at buildbot.pypy.org (mattip)
    Date: Sun, 22 Nov 2015 21:46:48 +0100 (CET)
    Subject: [pypy-commit] pypy default: fix translated tests by partially
     recreating app level functions called by appbridge in rpython
    Message-ID: <20151122204648.376DD1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: mattip 
    Branch: 
    Changeset: r80839:a50cf6604948
    Date: 2015-11-22 22:44 +0200
    http://bitbucket.org/pypy/pypy/changeset/a50cf6604948/
    
    Log:	fix translated tests by partially recreating app level functions
    	called by appbridge in rpython
    
    diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
    --- a/pypy/module/micronumpy/descriptor.py
    +++ b/pypy/module/micronumpy/descriptor.py
    @@ -816,8 +816,8 @@
     def _usefields(space, w_dict, align):
         # Only for testing, a shortened version of the real _usefields
         allfields = []
    -    for fname in w_dict.iterkeys().iterator:
    -        obj = _get_list_or_none(space, w_dict, fname)
    +    for fname_w in space.unpackiterable(w_dict):
    +        obj = _get_list_or_none(space, w_dict, space.str_w(fname_w))
             num = space.int_w(obj[1])
             if align:
                 alignment = 0
    @@ -828,8 +828,8 @@
                 title = space.wrap(obj[2])
             else:
                 title = space.w_None
    -        allfields.append((space.wrap(fname), format, num, title))
    -    allfields.sort(key=lambda x: x[2])
    +        allfields.append((fname_w, format, num, title))
    +    #allfields.sort(key=lambda x: x[2])
         names   = [space.newtuple([x[0], x[3]]) for x in allfields]
         formats = [x[1] for x in allfields]
         offsets = [x[2] for x in allfields]
    @@ -853,12 +853,14 @@
         aligned_w = _get_val_or_none(space, w_dict, 'aligned')
         itemsize_w = _get_val_or_none(space, w_dict, 'itemsize')
         if names_w is None or formats_w is None:
    -        if we_are_translated():
    +        try:
                 return get_appbridge_cache(space).call_method(space,
                     'numpy.core._internal', '_usefields', Arguments(space, 
                                     [w_dict, space.wrap(alignment >= 0)]))
    -        else:
    -            return _usefields(space, w_dict, alignment >= 0)
    +        except OperationError as e:
    +            if e.match(space, space.w_ImportError):
    +                return _usefields(space, w_dict, alignment >= 0)
    +            raise
         n = len(names_w)
         if (n != len(formats_w) or 
             (offsets_w is not None and n != len(offsets_w)) or
    @@ -898,16 +900,17 @@
     
     def dtype_from_spec(space, w_spec, alignment):
     
    -    if we_are_translated():
    +    w_lst = w_spec
    +    try:
             w_lst = get_appbridge_cache(space).call_method(space,
                 'numpy.core._internal', '_commastring', Arguments(space, [w_spec]))
    -    else:
    +    except OperationError as e:
    +        if not e.match(space, space.w_ImportError):
    +            raise
             # handle only simple cases for testing
             if space.isinstance_w(w_spec, space.w_str):
                 spec = [s.strip() for s in space.str_w(w_spec).split(',')]
                 w_lst = space.newlist([space.wrap(s) for s in spec]) 
    -        elif space.isinstance_w(w_spec, space.w_list):
    -            w_lst = w_spec
         if not space.isinstance_w(w_lst, space.w_list) or space.len_w(w_lst) < 1:
             raise oefmt(space.w_RuntimeError,
                         "_commastring is not returning a list with len >= 1")
    
    From noreply at buildbot.pypy.org  Mon Nov 23 00:40:32 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Mon, 23 Nov 2015 06:40:32 +0100 (CET)
    Subject: [pypy-commit] pypy anntype2: Implement @doubledispatch decorator
    Message-ID: <20151123054032.B32831C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype2
    Changeset: r80840:d8221802192d
    Date: 2015-11-23 02:13 +0000
    http://bitbucket.org/pypy/pypy/changeset/d8221802192d/
    
    Log:	Implement @doubledispatch decorator
    
    diff --git a/rpython/tool/pairtype.py b/rpython/tool/pairtype.py
    --- a/rpython/tool/pairtype.py
    +++ b/rpython/tool/pairtype.py
    @@ -94,3 +94,40 @@
         def __setitem__(self, clspair, value):
             self._registry[clspair] = value
             self._cache = self._registry.copy()
    +
    +def doubledispatch(func):
    +    """
    +    Decorator returning a double-dispatch function
    +
    +    Usage
    +    -----
    +        >>> @doubledispatch
    +        ... def func(x, y):
    +        ...     return 0
    +        >>> @func.register(basestring, basestring)
    +        ... def func_string_string(x, y):
    +        ...     return 42
    +        >>> func(1, 2)
    +        0
    +        >>> func('x', u'y')
    +        42
    +    """
    +    return DoubleDispatchFunction(func)
    +
    +class DoubleDispatchFunction(object):
    +    def __init__(self, func):
    +        self._registry = DoubleDispatchRegistry()
    +        self._default = func
    +
    +    def __call__(self, arg1, arg2, *args, **kwargs):
    +        try:
    +            func = self._registry[type(arg1), type(arg2)]
    +        except KeyError:
    +            func = self._default
    +        return func(arg1, arg2, *args, **kwargs)
    +
    +    def register(self, cls1, cls2):
    +        def decorator(func):
    +            self._registry[cls1, cls2] = func
    +            return func
    +        return decorator
    diff --git a/rpython/tool/test/test_pairtype.py b/rpython/tool/test/test_pairtype.py
    --- a/rpython/tool/test/test_pairtype.py
    +++ b/rpython/tool/test/test_pairtype.py
    @@ -1,5 +1,6 @@
     from rpython.tool.pairtype import (
    -    pairtype, pair, extendabletype, pairmro, DoubleDispatchRegistry)
    +    pairtype, pair, extendabletype, pairmro, DoubleDispatchRegistry,
    +    doubledispatch)
     
     def test_binop():
         ### Binary operation example
    @@ -115,7 +116,7 @@
         parent_pairtypes = pairtype(A3, B2).__mro__[:-2]
         assert (tuple(pairtype(a, b) for a, b in pairmro(A3, B2)) == parent_pairtypes)
     
    -def test_doubledispatch():
    +def test_doubledispatch_registry():
         class A(object): pass
         class A2(A): pass
         class A3(A2): pass
    @@ -129,3 +130,15 @@
         assert reg[A3, B2] == "A2-B2"
         reg[A3, B] = "A3-B"
         assert reg[A3, B2] == "A2-B2"  # note that A2,B2 wins over A3,B
    +
    +def test_doubledispatch_function():
    +    @doubledispatch
    +    def f(x, y, z):
    +        return z
    +
    +    @f.register(int, int)
    +    def f_int(x, y, z):
    +        return 42
    +
    +    assert f(1., 1., 0) == 0
    +    assert f(1, 1, 0) == 42
    
    From noreply at buildbot.pypy.org  Mon Nov 23 00:40:35 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Mon, 23 Nov 2015 06:40:35 +0100 (CET)
    Subject: [pypy-commit] pypy anntype2: Use @doubledispatch for intersection()
     and difference()
    Message-ID: <20151123054035.3026D1C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype2
    Changeset: r80841:5acb90f641dd
    Date: 2015-11-23 04:51 +0000
    http://bitbucket.org/pypy/pypy/changeset/5acb90f641dd/
    
    Log:	Use @doubledispatch for intersection() and difference()
    
    diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
    --- a/rpython/annotator/annrpython.py
    +++ b/rpython/annotator/annrpython.py
    @@ -11,7 +11,7 @@
     from rpython.translator import simplify, transform
     from rpython.annotator import model as annmodel, signature
     from rpython.annotator.model import (
    -        typeof, s_ImpossibleValue, SomeInstance)
    +    typeof, s_ImpossibleValue, SomeInstance, intersection, difference)
     from rpython.annotator.bookkeeper import Bookkeeper
     from rpython.rtyper.normalizecalls import perform_normalizations
     
    @@ -497,14 +497,14 @@
                     if s_exception == s_ImpossibleValue:
                         break
                     s_case = SomeInstance(self.bookkeeper.getuniqueclassdef(case))
    -                s_matching_exc = s_exception.intersection(s_case)
    +                s_matching_exc = intersection(s_exception, s_case)
                     if s_matching_exc != s_ImpossibleValue:
                         self.follow_raise_link(graph, link, s_matching_exc)
    -                s_exception = s_exception.difference(s_case)
    +                s_exception = difference(s_exception, s_case)
             else:
                 if isinstance(block.exitswitch, Variable):
    -                knowntypedata = getattr(block.exitswitch.annotation,
    -                                            "knowntypedata", {})
    +                knowntypedata = getattr(
    +                    block.exitswitch.annotation, "knowntypedata", {})
                 else:
                     knowntypedata = {}
                 for link in exits:
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -36,7 +36,7 @@
     
     import rpython
     from rpython.tool import descriptor
    -from rpython.tool.pairtype import pair, extendabletype
    +from rpython.tool.pairtype import pair, extendabletype, doubledispatch
     from rpython.rlib.rarithmetic import r_uint, base_int, r_singlefloat, r_longfloat
     
     
    @@ -129,6 +129,16 @@
         def nonnoneify(self):
             return self
     
    + at doubledispatch
    +def intersection(s_obj1, s_obj2):
    +    """Return the intersection of two annotations, or an over-approximation thereof"""
    +    raise NotImplementedError
    +
    + at doubledispatch
    +def difference(s_obj1, s_obj2):
    +    """Return the set difference of two annotations, or an over-approximation thereof"""
    +    raise NotImplementedError
    +
     
     class SomeType(SomeObject):
         "Stands for a type.  We might not be sure which one it is."
    @@ -445,23 +455,6 @@
             else:
                 return None
     
    -    def intersection(self, other):
    -        assert isinstance(other, SomeInstance)
    -        can_be_None = self.can_be_None and other.can_be_None
    -        if self.classdef.issubclass(other.classdef):
    -            return SomeInstance(self.classdef, can_be_None=can_be_None)
    -        elif other.classdef.issubclass(self.classdef):
    -            return SomeInstance(other.classdef, can_be_None=can_be_None)
    -        else:
    -            return s_ImpossibleValue
    -
    -    def difference(self, other):
    -        assert isinstance(other, SomeInstance)
    -        if self.classdef.issubclass(other.classdef):
    -            return s_ImpossibleValue
    -        else:
    -            return self
    -
         def can_be_none(self):
             return self.can_be_None
     
    @@ -471,30 +464,52 @@
         def noneify(self):
             return SomeInstance(self.classdef, can_be_None=True)
     
    + at intersection.register(SomeInstance, SomeInstance)
    +def intersection_Instance(s_inst1, s_inst2):
    +    can_be_None = s_inst1.can_be_None and s_inst2.can_be_None
    +    if s_inst1.classdef.issubclass(s_inst2.classdef):
    +        return SomeInstance(s_inst1.classdef, can_be_None=can_be_None)
    +    elif s_inst2.classdef.issubclass(s_inst1.classdef):
    +        return SomeInstance(s_inst2.classdef, can_be_None=can_be_None)
    +    else:
    +        return s_ImpossibleValue
    +
    + at difference.register(SomeInstance, SomeInstance)
    +def difference_Instance_Instance(s_inst1, s_inst2):
    +    if s_inst1.classdef.issubclass(s_inst2.classdef):
    +        return s_ImpossibleValue
    +    else:
    +        return s_inst1
    +
    +
     class SomeException(SomeObject):
         """The set of exceptions obeying type(exc) in self.classes"""
         def __init__(self, classdefs):
             self.classdefs = classdefs
     
    -    def intersection(self, other):
    -        assert isinstance(other, SomeInstance)
    -        classdefs = {c for c in self.classdefs if c.issubclass(other.classdef)}
    -        if classdefs:
    -            return SomeException(classdefs)
    -        else:
    -            return s_ImpossibleValue
    -
    -    def difference(self, other):
    -        assert isinstance(other, SomeInstance)
    -        classdefs = {c for c in self.classdefs if not c.issubclass(other.classdef)}
    -        if classdefs:
    -            return SomeException(classdefs)
    -        else:
    -            return s_ImpossibleValue
    -
         def as_SomeInstance(self):
             return unionof(*[SomeInstance(cdef) for cdef in self.classdefs])
     
    + at intersection.register(SomeException, SomeInstance)
    +def intersection_Exception_Instance(s_exc, s_inst):
    +    classdefs = {c for c in s_exc.classdefs if c.issubclass(s_inst.classdef)}
    +    if classdefs:
    +        return SomeException(classdefs)
    +    else:
    +        return s_ImpossibleValue
    +
    + at intersection.register(SomeInstance, SomeException)
    +def intersection_Exception_Instance(s_inst, s_exc):
    +    return intersection(s_exc, s_inst)
    +
    + at difference.register(SomeException, SomeInstance)
    +def difference_Exception_Instance(s_exc, s_inst):
    +    classdefs = {c for c in s_exc.classdefs
    +        if not c.issubclass(s_inst.classdef)}
    +    if classdefs:
    +        return SomeException(classdefs)
    +    else:
    +        return s_ImpossibleValue
     
     class SomePBC(SomeObject):
         """Stands for a global user instance, built prior to the analysis,
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:16:35 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:16:35 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: merged default
    Message-ID: <20151123071635.A9D7D1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80842:7372febfd770
    Date: 2015-11-23 08:17 +0100
    http://bitbucket.org/pypy/pypy/changeset/7372febfd770/
    
    Log:	merged default
    
    diff too long, truncating to 2000 out of 2102 lines
    
    diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
    --- a/lib_pypy/greenlet.py
    +++ b/lib_pypy/greenlet.py
    @@ -88,9 +88,19 @@
             #
             try:
                 unbound_method = getattr(_continulet, methodname)
    +            _tls.leaving = current
                 args, kwds = unbound_method(current, *baseargs, to=target)
    -        finally:
                 _tls.current = current
    +        except:
    +            _tls.current = current
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            _tls.leaving = None
    +            raise
    +        else:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            _tls.leaving = None
             #
             if kwds:
                 if args:
    @@ -122,6 +132,34 @@
             return f.f_back.f_back.f_back   # go past start(), __switch(), switch()
     
     # ____________________________________________________________
    +# Recent additions
    +
    +GREENLET_USE_GC = True
    +GREENLET_USE_TRACING = True
    +
    +def gettrace():
    +    return getattr(_tls, 'trace', None)
    +
    +def settrace(callback):
    +    try:
    +        prev = _tls.trace
    +        del _tls.trace
    +    except AttributeError:
    +        prev = None
    +    if callback is not None:
    +        _tls.trace = callback
    +    return prev
    +
    +def _run_trace_callback(event):
    +    try:
    +        _tls.trace(event, (_tls.leaving, _tls.current))
    +    except:
    +        # In case of exceptions trace function is removed
    +        if hasattr(_tls, 'trace'):
    +            del _tls.trace
    +        raise
    +
    +# ____________________________________________________________
     # Internal stuff
     
     try:
    @@ -143,22 +181,32 @@
         _tls.current = gmain
     
     def _greenlet_start(greenlet, args):
    -    args, kwds = args
    -    _tls.current = greenlet
         try:
    -        res = greenlet.run(*args, **kwds)
    -    except GreenletExit, e:
    -        res = e
    +        args, kwds = args
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('switch')
    +            res = greenlet.run(*args, **kwds)
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
     
     def _greenlet_throw(greenlet, exc, value, tb):
    -    _tls.current = greenlet
         try:
    -        raise exc, value, tb
    -    except GreenletExit, e:
    -        res = e
    +        _tls.current = greenlet
    +        try:
    +            if hasattr(_tls, 'trace'):
    +                _run_trace_callback('throw')
    +            raise exc, value, tb
    +        except GreenletExit, e:
    +            res = e
    +        finally:
    +            _continuation.permute(greenlet, greenlet.parent)
    +        return ((res,), None)
         finally:
    -        _continuation.permute(greenlet, greenlet.parent)
    -    return ((res,), None)
    +        _tls.leaving = greenlet
    diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
    --- a/pypy/doc/whatsnew-head.rst
    +++ b/pypy/doc/whatsnew-head.rst
    @@ -1,7 +1,18 @@
     =========================
    -What's new in PyPy 4.0.+
    +What's new in PyPy 4.1.+
     =========================
     
     .. this is a revision shortly after release-4.0.1
     .. startrev: 4b5c840d0da2
     
    +.. branch: numpy-1.10
    +
    +Fix tests to run cleanly with -A and start to fix micronumpy for upstream numpy
    +which is now 1.10.2
    +
    +.. branch: osx-flat-namespace
    +
    +Fix the cpyext tests on OSX by linking with -flat_namespace
    +
    +.. branch: anntype
    +Refactor and improve exception analysis in the annotator.
    diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
    --- a/pypy/goal/targetpypystandalone.py
    +++ b/pypy/goal/targetpypystandalone.py
    @@ -302,7 +302,7 @@
         
         def hack_for_cffi_modules(self, driver):
             # HACKHACKHACK
    -        # ugly hack to modify target goal from compile_c to build_cffi_imports
    +        # ugly hack to modify target goal from compile_* to build_cffi_imports
             # this should probably get cleaned up and merged with driver.create_exe
             from rpython.translator.driver import taskdef
             import types
    @@ -316,7 +316,8 @@
                     name = name.new(ext='exe')
                 return name
     
    -        @taskdef(['compile_c'], "Create cffi bindings for modules")
    +        compile_goal, = driver.backend_select_goals(['compile'])
    +        @taskdef([compile_goal], "Create cffi bindings for modules")
             def task_build_cffi_imports(self):
                 from pypy.tool.build_cffi_imports import create_cffi_import_libraries
                 ''' Use cffi to compile cffi interfaces to modules'''
    @@ -335,7 +336,7 @@
                 # if failures, they were already printed
                 print  >> sys.stderr, str(exename),'successfully built, but errors while building the above modules will be ignored'
             driver.task_build_cffi_imports = types.MethodType(task_build_cffi_imports, driver)
    -        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, ['compile_c']
    +        driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, [compile_goal]
             driver.default_goal = 'build_cffi_imports'
             # HACKHACKHACK end
     
    diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
    --- a/pypy/module/cpyext/include/patchlevel.h
    +++ b/pypy/module/cpyext/include/patchlevel.h
    @@ -29,7 +29,7 @@
     #define PY_VERSION		"2.7.10"
     
     /* PyPy version as a string */
    -#define PYPY_VERSION "4.0.1-alpha0"
    +#define PYPY_VERSION "4.1.0-alpha0"
     
     /* Subversion Revision number of this file (not of the repository).
      * Empty since Mercurial migration. */
    diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
    --- a/pypy/module/micronumpy/__init__.py
    +++ b/pypy/module/micronumpy/__init__.py
    @@ -34,6 +34,7 @@
             'nditer': 'nditer.W_NDIter',
     
             'set_docstring': 'support.descr_set_docstring',
    +        'VisibleDeprecationWarning': 'support.W_VisibleDeprecationWarning',
         }
         for c in ['MAXDIMS', 'CLIP', 'WRAP', 'RAISE']:
             interpleveldefs[c] = 'space.wrap(constants.%s)' % c
    @@ -42,6 +43,7 @@
             from pypy.module.micronumpy.concrete import _setup
             _setup()
     
    +
     class UMathModule(MixedModule):
         appleveldefs = {}
         interpleveldefs = {
    @@ -138,3 +140,9 @@
             'multiarray': MultiArrayModule,
             'umath': UMathModule,
         }
    +
    +    def setup_after_space_initialization(self):
    +        from pypy.module.micronumpy.support import W_VisibleDeprecationWarning
    +        for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items():
    +            setattr(self.space, 'w_' + name, self.space.gettypefor(w_type))
    +
    diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py
    --- a/pypy/module/micronumpy/base.py
    +++ b/pypy/module/micronumpy/base.py
    @@ -44,7 +44,7 @@
             from pypy.module.micronumpy.strides import calc_strides
             if len(shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(shape) * dtype.elsize)
             except OverflowError as e:
    @@ -69,7 +69,7 @@
             isize = dtype.elsize
             if len(shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 totalsize = ovfcheck(support.product_check(shape) * isize)
             except OverflowError as e:
    diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py
    --- a/pypy/module/micronumpy/boxes.py
    +++ b/pypy/module/micronumpy/boxes.py
    @@ -444,7 +444,7 @@
     
         @unwrap_spec(axis1=int, axis2=int)
         def descr_swapaxes(self, space, axis1, axis2):
    -        return self
    +        raise oefmt(space.w_ValueError, 'bad axis1 argument to swapaxes')
     
         def descr_fill(self, space, w_value):
             self.get_dtype(space).coerce(space, w_value)
    @@ -573,7 +573,7 @@
             try:
                 ofs, dtype = self.dtype.fields[item]
             except KeyError:
    -            raise oefmt(space.w_IndexError, "invalid index")
    +            raise oefmt(space.w_ValueError, "no field of name %s", item)
     
             from pypy.module.micronumpy.types import VoidType
             if isinstance(dtype.itemtype, VoidType):
    diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
    --- a/pypy/module/micronumpy/compile.py
    +++ b/pypy/module/micronumpy/compile.py
    @@ -65,6 +65,7 @@
         w_KeyError = W_TypeObject("KeyError")
         w_SystemExit = W_TypeObject("SystemExit")
         w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt")
    +    w_VisibleDeprecationWarning = W_TypeObject("VisibleDeprecationWarning")
         w_None = None
     
         w_bool = W_TypeObject("bool")
    @@ -402,6 +403,9 @@
             assert isinstance(w_check_class, W_TypeObject)
             return w_exc_type.name == w_check_class.name
     
    +    def warn(self, w_msg, w_warn_type):
    +        pass
    +
     class FloatObject(W_Root):
         tp = FakeSpace.w_float
         def __init__(self, floatval):
    diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py
    --- a/pypy/module/micronumpy/concrete.py
    +++ b/pypy/module/micronumpy/concrete.py
    @@ -457,7 +457,7 @@
         def set_shape(self, space, orig_array, new_shape):
             if len(new_shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(new_shape) * self.dtype.elsize)
             except OverflowError as e:
    @@ -601,7 +601,7 @@
         def set_shape(self, space, orig_array, new_shape):
             if len(new_shape) > NPY.MAXDIMS:
                 raise oefmt(space.w_ValueError,
    -                "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +                "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
             try:
                 ovfcheck(support.product_check(new_shape) * self.dtype.elsize)
             except OverflowError as e:
    diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
    --- a/pypy/module/micronumpy/ctors.py
    +++ b/pypy/module/micronumpy/ctors.py
    @@ -18,7 +18,7 @@
             raise oefmt(space.w_TypeError,
                         "argument 1 must be numpy.dtype, not %T", w_dtype)
         if w_dtype.elsize == 0:
    -        raise oefmt(space.w_ValueError, "itemsize cannot be zero")
    +        raise oefmt(space.w_TypeError, "Empty data-type")
         if not space.isinstance_w(w_state, space.w_str):
             raise oefmt(space.w_TypeError, "initializing object must be a string")
         if space.len_w(w_state) != w_dtype.elsize:
    diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
    --- a/pypy/module/micronumpy/descriptor.py
    +++ b/pypy/module/micronumpy/descriptor.py
    @@ -217,6 +217,8 @@
                 endian = ignore
             if self.num == NPY.UNICODE:
                 size >>= 2
    +        if self.num == NPY.OBJECT:
    +            return "%s%s" %(endian, basic)
             return "%s%s%s" % (endian, basic, size)
     
         def descr_get_descr(self, space, style='descr', force_dict=False):
    @@ -420,6 +422,10 @@
             if space.is_w(self, w_other):
                 return True
             if isinstance(w_other, W_Dtype):
    +            if self.is_object() and w_other.is_object():
    +                # ignore possible 'record' unions
    +                # created from dtype(('O', spec))
    +                return True
                 return space.eq_w(self.descr_reduce(space),
                                   w_other.descr_reduce(space))
             return False
    @@ -485,7 +491,12 @@
     
         def descr_str(self, space):
             if self.fields:
    -            return space.str(self.descr_get_descr(space, style='str'))
    +            r = self.descr_get_descr(space, style='str')
    +            name = space.str_w(space.str(self.w_box_type))
    +            if name != "":
    +                boxname = space.str(self.w_box_type)
    +                r = space.newtuple([self.w_box_type, r])
    +            return space.str(r)
             elif self.subdtype is not None:
                 return space.str(space.newtuple([
                     self.subdtype.descr_get_str(space),
    @@ -497,8 +508,13 @@
                     return self.descr_get_name(space)
     
         def descr_repr(self, space):
    +        if isinstance(self.itemtype, types.CharType):
    +            return space.wrap("dtype('S1')")
             if self.fields:
                 r = self.descr_get_descr(space, style='repr')
    +            name = space.str_w(space.str(self.w_box_type))
    +            if name != "":
    +                r = space.newtuple([space.wrap(self.w_box_type), r])
             elif self.subdtype is not None:
                 r = space.newtuple([self.subdtype.descr_get_str(space),
                                     self.descr_get_shape(space)])
    @@ -800,8 +816,8 @@
     def _usefields(space, w_dict, align):
         # Only for testing, a shortened version of the real _usefields
         allfields = []
    -    for fname in w_dict.iterkeys().iterator:
    -        obj = _get_list_or_none(space, w_dict, fname)
    +    for fname_w in space.unpackiterable(w_dict):
    +        obj = _get_list_or_none(space, w_dict, space.str_w(fname_w))
             num = space.int_w(obj[1])
             if align:
                 alignment = 0
    @@ -812,8 +828,8 @@
                 title = space.wrap(obj[2])
             else:
                 title = space.w_None
    -        allfields.append((space.wrap(fname), format, num, title))
    -    allfields.sort(key=lambda x: x[2])
    +        allfields.append((fname_w, format, num, title))
    +    #allfields.sort(key=lambda x: x[2])
         names   = [space.newtuple([x[0], x[3]]) for x in allfields]
         formats = [x[1] for x in allfields]
         offsets = [x[2] for x in allfields]
    @@ -837,12 +853,14 @@
         aligned_w = _get_val_or_none(space, w_dict, 'aligned')
         itemsize_w = _get_val_or_none(space, w_dict, 'itemsize')
         if names_w is None or formats_w is None:
    -        if we_are_translated():
    +        try:
                 return get_appbridge_cache(space).call_method(space,
                     'numpy.core._internal', '_usefields', Arguments(space, 
                                     [w_dict, space.wrap(alignment >= 0)]))
    -        else:
    -            return _usefields(space, w_dict, alignment >= 0)
    +        except OperationError as e:
    +            if e.match(space, space.w_ImportError):
    +                return _usefields(space, w_dict, alignment >= 0)
    +            raise
         n = len(names_w)
         if (n != len(formats_w) or 
             (offsets_w is not None and n != len(offsets_w)) or
    @@ -882,16 +900,17 @@
     
     def dtype_from_spec(space, w_spec, alignment):
     
    -    if we_are_translated():
    +    w_lst = w_spec
    +    try:
             w_lst = get_appbridge_cache(space).call_method(space,
                 'numpy.core._internal', '_commastring', Arguments(space, [w_spec]))
    -    else:
    +    except OperationError as e:
    +        if not e.match(space, space.w_ImportError):
    +            raise
             # handle only simple cases for testing
             if space.isinstance_w(w_spec, space.w_str):
                 spec = [s.strip() for s in space.str_w(w_spec).split(',')]
                 w_lst = space.newlist([space.wrap(s) for s in spec]) 
    -        elif space.isinstance_w(w_spec, space.w_list):
    -            w_lst = w_spec
         if not space.isinstance_w(w_lst, space.w_list) or space.len_w(w_lst) < 1:
             raise oefmt(space.w_RuntimeError,
                         "_commastring is not returning a list with len >= 1")
    @@ -942,7 +961,7 @@
         shape_w = space.fixedview(w_shape)
         if len(shape_w) < 1:
             return None
    -    elif len(shape_w) == 1 and space.isinstance_w(shape_w[0], space.w_tuple):
    +    elif space.isinstance_w(shape_w[0], space.w_tuple):
             # (base_dtype, new_dtype) dtype spectification
             return None
         shape = []
    @@ -997,12 +1016,17 @@
             if len(spec) > 0:
                 # this is (base_dtype, new_dtype) so just make it a union by setting both
                 # parts' offset to 0
    -            try:
    -                dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment)
    -            except:
    -                raise
    -            raise oefmt(space.w_NotImplementedError, 
    -                "(base_dtype, new_dtype) dtype spectification discouraged, not implemented")
    +            w_dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment)
    +            assert isinstance(w_dtype, W_Dtype)
    +            assert isinstance(w_dtype1, W_Dtype)
    +            if (w_dtype.elsize != 0 and w_dtype1.elsize != 0 and 
    +                    w_dtype1.elsize != w_dtype.elsize):
    +                raise oefmt(space.w_ValueError,
    +                    'mismatch in size of old and new data-descriptor')
    +            retval = W_Dtype(w_dtype.itemtype, w_dtype.w_box_type,
    +                    names=w_dtype1.names[:], fields=w_dtype1.fields.copy(),
    +                    elsize=w_dtype1.elsize)
    +            return retval
         if space.is_none(w_dtype):
             return cache.w_float64dtype
         if space.isinstance_w(w_dtype, w_subtype):
    @@ -1032,19 +1056,22 @@
         elif space.isinstance_w(w_dtype, space.w_tuple):
             w_dtype0 = space.getitem(w_dtype, space.wrap(0))
             w_dtype1 = space.getitem(w_dtype, space.wrap(1))
    -        if space.isinstance_w(w_dtype0, space.w_type) and \
    -           space.isinstance_w(w_dtype1, space.w_list):
    -            #obscure api - (subclass, spec). Ignore the subclass
    -            return make_new_dtype(space, w_subtype, w_dtype1, alignment, 
    -                        copy=copy, w_shape=w_shape, w_metadata=w_metadata)
    -        subdtype = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy)
    -        assert isinstance(subdtype, W_Dtype)
    -        if subdtype.elsize == 0:
    -            name = "%s%d" % (subdtype.kind, space.int_w(w_dtype1))
    +        # create a new dtype object
    +        l_side = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy)
    +        assert isinstance(l_side, W_Dtype)
    +        if l_side.elsize == 0 and space.isinstance_w(w_dtype1, space.w_int):
    +            #(flexible_dtype, itemsize)
    +            name = "%s%d" % (l_side.kind, space.int_w(w_dtype1))
                 retval = make_new_dtype(space, w_subtype, space.wrap(name), alignment, copy)
    -        else:
    -            retval = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy, w_shape=w_dtype1)
    -        return _set_metadata_and_copy(space, w_metadata, retval, copy)
    +            return _set_metadata_and_copy(space, w_metadata, retval, copy)
    +        elif (space.isinstance_w(w_dtype1, space.w_int) or
    +                space.isinstance_w(w_dtype1, space.w_tuple) or 
    +                space.isinstance_w(w_dtype1, space.w_list) or 
    +                isinstance(w_dtype1, W_NDimArray)):
    +            #(fixed_dtype, shape) or (base_dtype, new_dtype)
    +            retval = make_new_dtype(space, w_subtype, l_side, alignment,
    +                                    copy, w_shape=w_dtype1)
    +            return _set_metadata_and_copy(space, w_metadata, retval, copy)
         elif space.isinstance_w(w_dtype, space.w_dict):
             return _set_metadata_and_copy(space, w_metadata,
                     dtype_from_dict(space, w_dtype, alignment), copy)
    @@ -1122,7 +1149,7 @@
                 size = int(name[1:])
             except ValueError:
                 raise oefmt(space.w_TypeError, "data type not understood")
    -    if char == NPY.CHARLTR:
    +    if char == NPY.CHARLTR and size == 0:
             return W_Dtype(
                 types.CharType(space),
                 elsize=1,
    @@ -1133,7 +1160,7 @@
             return new_unicode_dtype(space, size)
         elif char == NPY.VOIDLTR:
             return new_void_dtype(space, size)
    -    assert False
    +    raise oefmt(space.w_TypeError, 'data type "%s" not understood', name)
     
     
     def new_string_dtype(space, size):
    diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py
    --- a/pypy/module/micronumpy/ndarray.py
    +++ b/pypy/module/micronumpy/ndarray.py
    @@ -15,7 +15,7 @@
     from pypy.module.micronumpy.arrayops import repeat, choose, put
     from pypy.module.micronumpy.base import W_NDimArray, convert_to_array, \
         ArrayArgumentException, wrap_impl
    -from pypy.module.micronumpy.concrete import BaseConcreteArray
    +from pypy.module.micronumpy.concrete import BaseConcreteArray, V_OBJECTSTORE
     from pypy.module.micronumpy.converters import (
         multi_axis_converter, order_converter, shape_converter,
         searchside_converter, out_converter)
    @@ -75,7 +75,7 @@
             dtype = space.interp_w(descriptor.W_Dtype, space.call_function(
                 space.gettypefor(descriptor.W_Dtype), w_dtype))
             if (dtype.elsize != self.get_dtype().elsize or
    -                dtype.is_flexible() or self.get_dtype().is_flexible()):
    +                (not dtype.is_record() and self.get_dtype().is_flexible())):
                 raise OperationError(space.w_ValueError, space.wrap(
                     "new type not compatible with array."))
             self.implementation.set_dtype(space, dtype)
    @@ -116,6 +116,13 @@
                     "index out of range for array"))
             size = loop.count_all_true(arr)
             if arr.ndims() == 1:
    +            if self.ndims() > 1 and arr.get_shape()[0] != self.get_shape()[0]:
    +                msg = ("boolean index did not match indexed array along"
    +                      " dimension 0; dimension is %d but corresponding"
    +                      " boolean dimension is %d" % (self.get_shape()[0],
    +                      arr.get_shape()[0]))
    +                #warning = space.gettypefor(support.W_VisibleDeprecationWarning)
    +                space.warn(space.wrap(msg), space.w_VisibleDeprecationWarning)
                 res_shape = [size] + self.get_shape()[1:]
             else:
                 res_shape = [size]
    @@ -278,9 +285,12 @@
         def getfield(self, space, field):
             dtype = self.get_dtype()
             if field not in dtype.fields:
    -            raise oefmt(space.w_ValueError, "field named %s not found", field)
    +            raise oefmt(space.w_ValueError, "no field of name %s", field)
             arr = self.implementation
             ofs, subdtype = arr.dtype.fields[field][:2]
    +        if subdtype.is_object() and arr.gcstruct is V_OBJECTSTORE:
    +            raise oefmt(space.w_NotImplementedError,
    +                "cannot read object from array with no gc hook")
             # ofs only changes start
             # create a view of the original array by extending
             # the shape, strides, backstrides of the array
    @@ -489,10 +499,8 @@
             numpy.swapaxes : equivalent function
             """
             if axis1 == axis2:
    -            return self
    +            return self.descr_view(space)
             n = self.ndims()
    -        if n <= 1:
    -            return self
             if axis1 < 0:
                 axis1 += n
             if axis2 < 0:
    @@ -501,6 +509,8 @@
                 raise oefmt(space.w_ValueError, "bad axis1 argument to swapaxes")
             if axis2 < 0 or axis2 >= n:
                 raise oefmt(space.w_ValueError, "bad axis2 argument to swapaxes")
    +        if n <= 1:
    +            return self
             return self.implementation.swapaxes(space, self, axis1, axis2)
     
         def descr_nonzero(self, space):
    @@ -899,7 +909,7 @@
                         if cur_shape[i] != 1:
                             raise OperationError(space.w_ValueError, space.wrap(
                                 "cannot select an axis to squeeze out "
    -                            "which has size greater than one"))
    +                            "which has size not equal to one"))
                     else:
                         new_shape.append(cur_shape[i])
             else:
    @@ -995,7 +1005,7 @@
         # --------------------- operations ----------------------------
         # TODO: support all kwargs like numpy ufunc_object.c
         sig = None
    -    cast = 'unsafe'
    +    cast = 'safe'
         extobj = None
     
     
    @@ -1374,7 +1384,7 @@
         shape = shape_converter(space, w_shape, dtype)
         if len(shape) > NPY.MAXDIMS:
             raise oefmt(space.w_ValueError,
    -            "sequence too large; must be smaller than %d", NPY.MAXDIMS)
    +            "sequence too large; cannot be greater than %d", NPY.MAXDIMS)
         if not space.is_none(w_buffer):
             if (not space.is_none(w_strides)):
                 strides = [space.int_w(w_i) for w_i in
    diff --git a/pypy/module/micronumpy/support.py b/pypy/module/micronumpy/support.py
    --- a/pypy/module/micronumpy/support.py
    +++ b/pypy/module/micronumpy/support.py
    @@ -8,6 +8,17 @@
     from pypy.objspace.std.typeobject import W_TypeObject
     from pypy.objspace.std.objspace import StdObjSpace
     from pypy.module.micronumpy import constants as NPY
    +from pypy.module.exceptions.interp_exceptions import _new_exception, W_UserWarning
    +
    +W_VisibleDeprecationWarning = _new_exception('VisibleDeprecationWarning', W_UserWarning,
    +    """Visible deprecation warning.
    +
    +    By default, python will not show deprecation warnings, so this class
    +    can be used when a very visible warning is helpful, for example because
    +    the usage is most likely a user bug.
    +
    +    """)
    +
     
     def issequence_w(space, w_obj):
         from pypy.module.micronumpy.base import W_NDimArray
    diff --git a/pypy/module/micronumpy/test/test_deprecations.py b/pypy/module/micronumpy/test/test_deprecations.py
    new file mode 100644
    --- /dev/null
    +++ b/pypy/module/micronumpy/test/test_deprecations.py
    @@ -0,0 +1,33 @@
    +import py
    +import sys
    +
    +from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
    +
    +
    +class AppTestDeprecations(BaseNumpyAppTest):
    +    spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"])
    +
    +    def test_getitem(self):
    +        import numpy as np
    +        import warnings, sys
    +        warnings.simplefilter('error', np.VisibleDeprecationWarning)
    +        try:
    +            arr = np.ones((5, 4, 3))
    +            index = np.array([True])
    +            raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +
    +            index = np.array([False] * 6)
    +            raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +
    +            index = np.zeros((4, 4), dtype=bool)
    +            if '__pypy__' in sys.builtin_module_names:
    +                # boolean indexing matches the dims in index
    +                # to the first index.ndims in arr, not implemented in pypy yet
    +                raises(IndexError, arr.__getitem__, index)
    +                raises(TypeError, arr.__getitem__, (slice(None), index))
    +            else:
    +                raises(np.VisibleDeprecationWarning, arr.__getitem__, index)
    +                raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index))
    +        finally:
    +            warnings.simplefilter('default', np.VisibleDeprecationWarning)
    +
    diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
    --- a/pypy/module/micronumpy/test/test_dtypes.py
    +++ b/pypy/module/micronumpy/test/test_dtypes.py
    @@ -345,14 +345,29 @@
     
         def test_can_subclass(self):
             import numpy as np
    +        import sys, pickle
             class xyz(np.void):
                 pass
             assert np.dtype(xyz).name == 'xyz'
             # another obscure API, used in numpy record.py
    -        # it seems numpy throws away the subclass type and parses the spec
             a = np.dtype((xyz, [('x', 'int32'), ('y', 'float32')]))
    -        assert repr(a) == "dtype([('x', ' s_annotation
    -        # that can be attached to booleans, exitswitches
    -        knowntypedata = {}
    -        if isinstance(block.exitswitch, Variable):
    -            knowntypedata = getattr(self.binding(block.exitswitch),
    -                                    "knowntypedata", {})
    -        for link in exits:
    -            self.follow_link(graph, link, knowntypedata)
             if block in self.notify:
                 # reflow from certain positions when this block is done
                 for callback in self.notify[block]:
    @@ -491,84 +531,66 @@
                     else:
                         callback()
     
    -    def follow_link(self, graph, link, knowntypedata):
    -        in_except_block = False
    -        v_last_exc_type = link.last_exception  # may be None for non-exception link
    -        v_last_exc_value = link.last_exc_value  # may be None for non-exception link
     
    -        if (isinstance(link.exitcase, (types.ClassType, type)) and
    -                issubclass(link.exitcase, BaseException)):
    -            assert v_last_exc_type and v_last_exc_value
    -            s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase)
    -            s_last_exc_type = annmodel.SomeType()
    -            if isinstance(v_last_exc_type, Constant):
    -                s_last_exc_type.const = v_last_exc_type.value
    -            s_last_exc_type.is_type_of = [v_last_exc_value]
    -
    -            if isinstance(v_last_exc_type, Variable):
    -                self.setbinding(v_last_exc_type, s_last_exc_type)
    -            if isinstance(v_last_exc_value, Variable):
    -                self.setbinding(v_last_exc_value, s_last_exc_value)
    -
    -            s_last_exc_type = annmodel.SomeType()
    -            if isinstance(v_last_exc_type, Constant):
    -                s_last_exc_type.const = v_last_exc_type.value
    -            last_exc_value_vars = []
    -            in_except_block = True
    +    def follow_link(self, graph, link, constraints):
    +        assert not (isinstance(link.exitcase, (types.ClassType, type)) and
    +                issubclass(link.exitcase, BaseException))
     
             ignore_link = False
             inputs_s = []
    -        renaming = {}
    +        renaming = defaultdict(list)
             for v_out, v_input in zip(link.args, link.target.inputargs):
    -            renaming.setdefault(v_out, []).append(v_input)
    -        for v_out, v_input in zip(link.args, link.target.inputargs):
    -            if v_out == v_last_exc_type:
    -                assert in_except_block
    -                inputs_s.append(s_last_exc_type)
    -            elif v_out == v_last_exc_value:
    -                assert in_except_block
    -                inputs_s.append(s_last_exc_value)
    -                last_exc_value_vars.append(v_input)
    -            else:
    -                s_out = self.annotation(v_out)
    -                if (link.exitcase, v_out) in knowntypedata:
    -                    knownvarvalue = knowntypedata[(link.exitcase, v_out)]
    -                    s_out = pair(s_out, knownvarvalue).improve()
    -                    # ignore links that try to pass impossible values
    -                    if s_out == annmodel.s_ImpossibleValue:
    -                        ignore_link = True
    +            renaming[v_out].append(v_input)
     
    -                if hasattr(s_out,'is_type_of'):
    -                    renamed_is_type_of = []
    -                    for v in s_out.is_type_of:
    -                        new_vs = renaming.get(v, [])
    -                        renamed_is_type_of += new_vs
    -                    assert s_out.knowntype is type
    -                    newcell = annmodel.SomeType()
    -                    if s_out.is_constant():
    -                        newcell.const = s_out.const
    -                    s_out = newcell
    -                    s_out.is_type_of = renamed_is_type_of
    -
    -                if hasattr(s_out, 'knowntypedata'):
    -                    renamed_knowntypedata = {}
    -                    for (value, v), s in s_out.knowntypedata.items():
    -                        new_vs = renaming.get(v, [])
    -                        for new_v in new_vs:
    -                            renamed_knowntypedata[value, new_v] = s
    -                    assert isinstance(s_out, annmodel.SomeBool)
    -                    newcell = annmodel.SomeBool()
    -                    if s_out.is_constant():
    -                        newcell.const = s_out.const
    -                    s_out = newcell
    -                    s_out.set_knowntypedata(renamed_knowntypedata)
    -
    -                inputs_s.append(s_out)
    +        for v_out in link.args:
    +            s_out = self.annotation(v_out)
    +            if v_out in constraints:
    +                s_constraint = constraints[v_out]
    +                s_out = pair(s_out, s_constraint).improve()
    +                # ignore links that try to pass impossible values
    +                if s_out == s_ImpossibleValue:
    +                    ignore_link = True
    +            s_out = self.apply_renaming(s_out, renaming)
    +            inputs_s.append(s_out)
             if ignore_link:
                 return
     
    -        if in_except_block:
    -            s_last_exc_type.is_type_of = last_exc_value_vars
    +        self.links_followed[link] = True
    +        self.addpendingblock(graph, link.target, inputs_s)
    +
    +    def follow_raise_link(self, graph, link, s_last_exc_value):
    +        v_last_exc_type = link.last_exception
    +        v_last_exc_value = link.last_exc_value
    +
    +        assert (isinstance(link.exitcase, (types.ClassType, type)) and
    +                issubclass(link.exitcase, BaseException))
    +
    +        assert v_last_exc_type and v_last_exc_value
    +
    +        if isinstance(v_last_exc_value, Variable):
    +            self.setbinding(v_last_exc_value, s_last_exc_value)
    +
    +        if isinstance(v_last_exc_type, Variable):
    +            self.setbinding(v_last_exc_type, typeof([v_last_exc_value]))
    +
    +        inputs_s = []
    +        renaming = defaultdict(list)
    +        for v_out, v_input in zip(link.args, link.target.inputargs):
    +            renaming[v_out].append(v_input)
    +
    +        for v_out, v_input in zip(link.args, link.target.inputargs):
    +            if v_out == v_last_exc_type:
    +                s_out = typeof(renaming[v_last_exc_value])
    +                if isinstance(v_last_exc_type, Constant):
    +                    s_out.const = v_last_exc_type.value
    +                elif v_last_exc_type.annotation.is_constant():
    +                    s_out.const = v_last_exc_type.annotation.const
    +                inputs_s.append(s_out)
    +            else:
    +                s_out = self.annotation(v_out)
    +                s_out = self.apply_renaming(s_out, renaming)
    +                inputs_s.append(s_out)
    +
             self.links_followed[link] = True
             self.addpendingblock(graph, link.target, inputs_s)
     
    @@ -586,8 +608,8 @@
                     raise BlockedInference(self, op, -1)
             resultcell = op.consider(self)
             if resultcell is None:
    -            resultcell = annmodel.s_ImpossibleValue
    -        elif resultcell == annmodel.s_ImpossibleValue:
    +            resultcell = s_ImpossibleValue
    +        elif resultcell == s_ImpossibleValue:
                 raise BlockedInference(self, op, -1) # the operation cannot succeed
             assert isinstance(resultcell, annmodel.SomeObject)
             assert isinstance(op.result, Variable)
    diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
    --- a/rpython/annotator/binaryop.py
    +++ b/rpython/annotator/binaryop.py
    @@ -1,18 +1,19 @@
     """
     Binary operations between SomeValues.
     """
    +from collections import defaultdict
     
     from rpython.tool.pairtype import pair, pairtype
     from rpython.annotator.model import (
         SomeObject, SomeInteger, SomeBool, s_Bool, SomeString, SomeChar, SomeList,
    -    SomeDict, SomeUnicodeCodePoint, SomeUnicodeString,
    +    SomeDict, SomeUnicodeCodePoint, SomeUnicodeString, SomeException,
         SomeTuple, SomeImpossibleValue, s_ImpossibleValue, SomeInstance,
         SomeBuiltinMethod, SomeIterator, SomePBC, SomeNone, SomeFloat, s_None,
         SomeByteArray, SomeWeakRef, SomeSingleFloat,
    -    SomeLongFloat, SomeType, SomeConstantType, unionof, UnionError,
    +    SomeLongFloat, SomeType, SomeTypeOf, SomeConstantType, unionof, UnionError,
         read_can_only_throw, add_knowntypedata,
         merge_knowntypedata,)
    -from rpython.annotator.bookkeeper import immutablevalue
    +from rpython.annotator.bookkeeper import immutablevalue, getbookkeeper
     from rpython.flowspace.model import Variable, Constant, const
     from rpython.flowspace.operation import op
     from rpython.rlib import rarithmetic
    @@ -35,7 +36,7 @@
         elif s_obj1.is_constant():
             if s_obj1.const is None and not s_obj2.can_be_none():
                 r.const = False
    -    knowntypedata = {}
    +    knowntypedata = defaultdict(dict)
         bk = annotator.bookkeeper
     
         def bind(src_obj, tgt_obj):
    @@ -145,24 +146,18 @@
     
         def union((obj1, obj2)):
             result = SomeType()
    -        is_type_of1 = getattr(obj1, 'is_type_of', None)
    -        is_type_of2 = getattr(obj2, 'is_type_of', None)
             if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const:
                 result.const = obj1.const
    -            is_type_of = {}
    -            if is_type_of1:
    -                for v in is_type_of1:
    -                    is_type_of[v] = True
    -            if is_type_of2:
    -                for v in is_type_of2:
    -                    is_type_of[v] = True
    -            if is_type_of:
    -                result.is_type_of = is_type_of.keys()
    -        else:
    -            if is_type_of1 and is_type_of1 == is_type_of2:
    -                result.is_type_of = is_type_of1
             return result
     
    +class __extend__(pairtype(SomeTypeOf, SomeTypeOf)):
    +    def union((s_obj1, s_obj2)):
    +        vars = list(set(s_obj1.is_type_of) | set(s_obj2.is_type_of))
    +        result = SomeTypeOf(vars)
    +        if (s_obj1.is_immutable_constant() and s_obj2.is_immutable_constant()
    +                and s_obj1.const == s_obj2.const):
    +            result.const = obj1.const
    +        return result
     
     # cloning a function with identical code, for the can_only_throw attribute
     def _clone(f, can_only_throw = None):
    @@ -263,7 +258,7 @@
             if not (rarithmetic.signedtype(s_int1.knowntype) and
                     rarithmetic.signedtype(s_int2.knowntype)):
                 return r
    -        knowntypedata = {}
    +        knowntypedata = defaultdict(dict)
             def tointtype(s_int0):
                 if s_int0.knowntype is bool:
                     return int
    @@ -682,6 +677,22 @@
                 thistype = pairtype(SomeInstance, SomeInstance)
                 return super(thistype, pair(ins1, ins2)).improve()
     
    +class __extend__(
    +        pairtype(SomeException, SomeInstance),
    +        pairtype(SomeException, SomeNone)):
    +    def union((s_exc, s_inst)):
    +        return unionof(s_exc.as_SomeInstance(), s_inst)
    +
    +class __extend__(
    +        pairtype(SomeInstance, SomeException),
    +        pairtype(SomeNone, SomeException)):
    +    def union((s_inst, s_exc)):
    +        return unionof(s_exc.as_SomeInstance(), s_inst)
    +
    +class __extend__(pairtype(SomeException, SomeException)):
    +    def union((s_exc1, s_exc2)):
    +        return SomeException(s_exc1.classdefs | s_exc2.classdefs)
    +
     
     @op.getitem.register_transform(SomeInstance, SomeObject)
     def getitem_SomeInstance(annotator, v_ins, v_idx):
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -12,7 +12,7 @@
     from rpython.annotator.model import (
         SomeOrderedDict, SomeString, SomeChar, SomeFloat, unionof, SomeInstance,
         SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint,
    -    s_None, s_ImpossibleValue, SomeBool, SomeTuple,
    +    s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeException,
         SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked,
         SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty)
     from rpython.annotator.classdesc import ClassDef, ClassDesc
    @@ -167,6 +167,10 @@
             desc = self.getdesc(cls)
             return desc.getuniqueclassdef()
     
    +    def new_exception(self, exc_classes):
    +        clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
    +        return SomeException(clsdefs)
    +
         def getlistdef(self, **flags_if_new):
             """Get the ListDef associated with the current position."""
             try:
    diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py
    --- a/rpython/annotator/builtin.py
    +++ b/rpython/annotator/builtin.py
    @@ -2,7 +2,7 @@
     Built-in functions.
     """
     import sys
    -from collections import OrderedDict
    +from collections import OrderedDict, defaultdict
     
     from rpython.annotator.model import (
         SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple,
    @@ -188,7 +188,7 @@
                 variables = [op.args[1]]
             for variable in variables:
                 assert bk.annotator.binding(variable) == s_obj
    -        knowntypedata = {}
    +        knowntypedata = defaultdict(dict)
             if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC):
                 add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ))
             r.set_knowntypedata(knowntypedata)
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -32,7 +32,7 @@
     import inspect
     import weakref
     from types import BuiltinFunctionType, MethodType
    -from collections import OrderedDict
    +from collections import OrderedDict, defaultdict
     
     import rpython
     from rpython.tool import descriptor
    @@ -138,6 +138,23 @@
         def can_be_none(self):
             return False
     
    +class SomeTypeOf(SomeType):
    +    """The type of a variable"""
    +    def __init__(self, args_v):
    +        self.is_type_of = args_v
    +
    +def typeof(args_v):
    +    if args_v:
    +        result = SomeTypeOf(args_v)
    +        if len(args_v) == 1:
    +            s_arg = args_v[0].annotation
    +            if isinstance(s_arg, SomeException) and len(s_arg.classdefs) == 1:
    +                cdef, = s_arg.classdefs
    +                result.const = cdef.classdesc.pyobj
    +        return result
    +    else:
    +        return SomeType()
    +
     
     class SomeFloat(SomeObject):
         "Stands for a float or an integer."
    @@ -437,6 +454,39 @@
         def noneify(self):
             return SomeInstance(self.classdef, can_be_None=True)
     
    +class SomeException(SomeObject):
    +    """The set of exceptions obeying type(exc) in self.classes"""
    +    def __init__(self, classdefs):
    +        self.classdefs = classdefs
    +
    +    def intersection(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        classdefs = {c:None for c in self.classdefs if c.issubclass(other.case)}
    +        if classdefs:
    +            return SomeException(classdefs)
    +        else:
    +            return s_ImpossibleValue
    +
    +    def difference(self, other):
    +        assert isinstance(other, SomeExceptCase)
    +        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
    +        if classdefs:
    +            return SomeException(classdefs)
    +        else:
    +            return s_ImpossibleValue
    +
    +    def as_SomeInstance(self):
    +        return unionof(*[SomeInstance(cdef) for cdef in self.classdefs])
    +
    +
    +class SomeExceptCase(SomeObject):
    +    """The set of exceptions that match a given except clause.
    +
    +    IOW, the set of exceptions that verify isinstance(exc, self.case).
    +    """
    +    def __init__(self, case):
    +        self.case = case
    +
     
     class SomePBC(SomeObject):
         """Stands for a global user instance, built prior to the analysis,
    @@ -682,14 +732,15 @@
     
     def add_knowntypedata(ktd, truth, vars, s_obj):
         for v in vars:
    -        ktd[(truth, v)] = s_obj
    +        ktd[truth][v] = s_obj
     
     
     def merge_knowntypedata(ktd1, ktd2):
    -    r = {}
    -    for truth_v in ktd1:
    -        if truth_v in ktd2:
    -            r[truth_v] = unionof(ktd1[truth_v], ktd2[truth_v])
    +    r = defaultdict(dict)
    +    for truth, constraints in ktd1.items():
    +        for v in constraints:
    +            if truth in ktd2 and v in ktd2[truth]:
    +                r[truth][v] = unionof(ktd1[truth][v], ktd2[truth][v])
         return r
     
     
    diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py
    --- a/rpython/annotator/test/test_annrpython.py
    +++ b/rpython/annotator/test/test_annrpython.py
    @@ -698,6 +698,56 @@
             s = a.build_types(snippet.exc_deduction_our_excs_plus_others, [])
             assert isinstance(s, annmodel.SomeInteger)
     
    +    def test_complex_exception_deduction(self):
    +        class InternalError(Exception):
    +            def __init__(self, msg):
    +                self.msg = msg
    +
    +        class AppError(Exception):
    +            def __init__(self, msg):
    +                self.msg = msg
    +        def apperror(msg):
    +            return AppError(msg)
    +
    +        def f(string):
    +            if not string:
    +                raise InternalError('Empty string')
    +            return string, None
    +        def cleanup():
    +            pass
    +
    +        def g(string):
    +            try:
    +                try:
    +                    string, _ = f(string)
    +                except ZeroDivisionError:
    +                    raise apperror('ZeroDivisionError')
    +                try:
    +                    result, _ = f(string)
    +                finally:
    +                    cleanup()
    +            except InternalError as e:
    +                raise apperror(e.msg)
    +            return result
    +
    +        a = self.RPythonAnnotator()
    +        s_result = a.build_types(g, [str])
    +        assert isinstance(s_result, annmodel.SomeString)
    +
    +    def test_method_exception_specialization(self):
    +        def f(l):
    +            try:
    +                return l.pop()
    +            except Exception:
    +                raise
    +        a = self.RPythonAnnotator()
    +        s = a.build_types(f, [[int]])
    +        graph = graphof(a, f)
    +        etype, evalue = graph.exceptblock.inputargs
    +        assert evalue.annotation.classdefs == {
    +                a.bookkeeper.getuniqueclassdef(IndexError)}
    +        assert etype.annotation.const == IndexError
    +
         def test_operation_always_raising(self):
             def operation_always_raising(n):
                 lst = []
    @@ -1376,11 +1426,11 @@
             a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    +        t = annmodel.SomeTypeOf([ev])
             t.const = KeyError
    -        t.is_type_of = [ev]
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError)
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert s_ev == a.bookkeeper.new_exception([KeyError])
     
         def test_reraiseAnything(self):
             def f(dic):
    @@ -1392,11 +1442,11 @@
             a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    -        t.is_type_of = [ev]
    -        t.const = KeyError    # IndexError ignored because 'dic' is a dict
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError)
    +        t = annmodel.SomeTypeOf([ev])
    +        t.const = KeyError  # IndexError ignored because 'dic' is a dict
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert s_ev == a.bookkeeper.new_exception([KeyError])
     
         def test_exception_mixing(self):
             def h():
    @@ -1427,10 +1477,11 @@
             a.build_types(f, [int, somelist(annmodel.s_Int)])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    -        t.is_type_of = [ev]
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception)
    +        t = annmodel.SomeTypeOf([ev])
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert (isinstance(s_ev, annmodel.SomeInstance) and
    +                s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception))
     
         def test_try_except_raise_finally1(self):
             def h(): pass
    @@ -1449,10 +1500,11 @@
             a.build_types(f, [])
             fg = graphof(a, f)
             et, ev = fg.exceptblock.inputargs
    -        t = annmodel.SomeType()
    -        t.is_type_of = [ev]
    -        assert a.binding(et) == t
    -        assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception)
    +        t = annmodel.SomeTypeOf([ev])
    +        assert et.annotation == t
    +        s_ev = ev.annotation
    +        assert (isinstance(s_ev, annmodel.SomeInstance) and
    +                s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception))
     
         def test_inplace_div(self):
             def f(n):
    diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py
    --- a/rpython/annotator/test/test_model.py
    +++ b/rpython/annotator/test/test_model.py
    @@ -1,8 +1,14 @@
    -import py
    +import pytest
     
     from rpython.annotator.model import *
     from rpython.annotator.listdef import ListDef
     from rpython.translator.translator import TranslationContext
    +from rpython.annotator import unaryop, binaryop  # for side-effects
    +
    + at pytest.fixture()
    +def annotator():
    +    t = TranslationContext()
    +    return t.buildannotator()
     
     
     listdef1 = ListDef(None, SomeTuple([SomeInteger(nonneg=True), SomeString()]))
    @@ -100,19 +106,21 @@
     class AAA(object):
         pass
     
    -def test_blocked_inference1():
    +def test_blocked_inference1(annotator):
         def blocked_inference():
             return AAA().m()
     
    -    py.test.raises(AnnotatorError, compile_function, blocked_inference)
    +    with pytest.raises(AnnotatorError):
    +        annotator.build_types(blocked_inference, [])
     
    -def test_blocked_inference2():
    +def test_blocked_inference2(annotator):
         def blocked_inference():
             a = AAA()
             b = a.x
             return b
     
    -    py.test.raises(AnnotatorError, compile_function, blocked_inference)
    +    with pytest.raises(AnnotatorError):
    +        annotator.build_types(blocked_inference, [])
     
     
     def test_not_const():
    @@ -129,3 +137,17 @@
         assert s.no_nul is True
         s = SomeChar().nonnulify()
         assert s.no_nul is True
    +
    +def test_SomeException_union(annotator):
    +    bk = annotator.bookkeeper
    +    someinst = lambda cls, **kw: SomeInstance(bk.getuniqueclassdef(cls), **kw)
    +    s_inst = someinst(Exception)
    +    s_exc = bk.new_exception([ValueError, IndexError])
    +    assert unionof(s_exc, s_inst) == s_inst
    +    assert unionof(s_inst, s_exc) == s_inst
    +    s_nullable = unionof(s_None, bk.new_exception([ValueError]))
    +    assert isinstance(s_nullable, SomeInstance)
    +    assert s_nullable.can_be_None
    +    s_exc1 = bk.new_exception([ValueError])
    +    s_exc2 = bk.new_exception([IndexError])
    +    unionof(s_exc1, s_exc2) == unionof(s_exc2, s_exc1)
    diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
    --- a/rpython/annotator/unaryop.py
    +++ b/rpython/annotator/unaryop.py
    @@ -1,8 +1,9 @@
     """
     Unary operations on SomeValues.
     """
    +from __future__ import absolute_import
     
    -from __future__ import absolute_import
    +from collections import defaultdict
     
     from rpython.tool.pairtype import pair
     from rpython.flowspace.operation import op
    @@ -11,7 +12,7 @@
     from rpython.annotator.model import (SomeObject, SomeInteger, SomeBool,
         SomeString, SomeChar, SomeList, SomeDict, SomeTuple, SomeImpossibleValue,
         SomeUnicodeCodePoint, SomeInstance, SomeBuiltin, SomeBuiltinMethod,
    -    SomeFloat, SomeIterator, SomePBC, SomeNone, SomeType, s_ImpossibleValue,
    +    SomeFloat, SomeIterator, SomePBC, SomeNone, SomeTypeOf, s_ImpossibleValue,
         s_Bool, s_None, s_Int, unionof, add_knowntypedata,
         SomeWeakRef, SomeUnicodeString, SomeByteArray)
     from rpython.annotator.bookkeeper import getbookkeeper, immutablevalue
    @@ -26,11 +27,11 @@
                             if oper.dispatch == 1])
     UNARY_OPERATIONS.remove('contains')
     
    +
     @op.type.register(SomeObject)
    -def type_SomeObject(annotator, arg):
    -    r = SomeType()
    -    r.is_type_of = [arg]
    -    return r
    +def type_SomeObject(annotator, v_arg):
    +    return SomeTypeOf([v_arg])
    +
     
     @op.bool.register(SomeObject)
     def bool_SomeObject(annotator, obj):
    @@ -39,7 +40,7 @@
         s_nonnone_obj = annotator.annotation(obj)
         if s_nonnone_obj.can_be_none():
             s_nonnone_obj = s_nonnone_obj.nonnoneify()
    -    knowntypedata = {}
    +    knowntypedata = defaultdict(dict)
         add_knowntypedata(knowntypedata, True, [obj], s_nonnone_obj)
         r.set_knowntypedata(knowntypedata)
         return r
    @@ -99,18 +100,17 @@
         callspec = complex_args([annotator.annotation(v_arg) for v_arg in args_v])
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:17:23 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:17:23 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: reverted change
    Message-ID: <20151123071723.041011C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80843:f7d1843208b9
    Date: 2015-11-23 08:17 +0100
    http://bitbucket.org/pypy/pypy/changeset/f7d1843208b9/
    
    Log:	reverted change
    
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -461,7 +461,7 @@
     
         def intersection(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = {c:None for c in self.classdefs if c.issubclass(other.case)}
    +        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:26:21 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:26:21 +0100 (CET)
    Subject: [pypy-commit] pypy default: reverted 2.7 {k for k ...} set syntax
     to an explicit for loop + set init. (s390x machine only has cpython 2.6
     installed)
    Message-ID: <20151123072621.58D071C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: 
    Changeset: r80844:95fa20db8791
    Date: 2015-11-23 08:22 +0100
    http://bitbucket.org/pypy/pypy/changeset/95fa20db8791/
    
    Log:	reverted 2.7 {k for k ...} set syntax to an explicit for loop + set
    	init. (s390x machine only has cpython 2.6 installed)
    
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -461,7 +461,10 @@
     
         def intersection(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
    +        classdefs = set()
    +        for c in self.classdefs:
    +            if c.issubclass(other.case):
    +                classdefs.add(c)
             if classdefs:
                 return SomeException(classdefs)
             else:
    @@ -469,7 +472,10 @@
     
         def difference(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
    +        classdefs = set()
    +        for c in self.classdefs:
    +            if not c.issubclass(other.case):
    +                classdefs.add(c)
             if classdefs:
                 return SomeException(classdefs)
             else:
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:26:23 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:26:23 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: merged default
    Message-ID: <20151123072623.5EC951C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80845:ec399b39378a
    Date: 2015-11-23 08:22 +0100
    http://bitbucket.org/pypy/pypy/changeset/ec399b39378a/
    
    Log:	merged default
    
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -461,7 +461,10 @@
     
         def intersection(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
    +        classdefs = set()
    +        for c in self.classdefs:
    +            if c.issubclass(other.case):
    +                classdefs.add(c)
             if classdefs:
                 return SomeException(classdefs)
             else:
    @@ -469,7 +472,10 @@
     
         def difference(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
    +        classdefs = set()
    +        for c in self.classdefs:
    +            if not c.issubclass(other.case):
    +                classdefs.add(c)
             if classdefs:
                 return SomeException(classdefs)
             else:
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:26:25 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:26:25 +0100 (CET)
    Subject: [pypy-commit] pypy default: yet another {k for k ...} set syntax
     converted to an explicit for loop
    Message-ID: <20151123072625.632BB1C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: 
    Changeset: r80846:856bc46f9525
    Date: 2015-11-23 08:25 +0100
    http://bitbucket.org/pypy/pypy/changeset/856bc46f9525/
    
    Log:	yet another {k for k ...} set syntax converted to an explicit for
    	loop
    
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -168,7 +168,9 @@
             return desc.getuniqueclassdef()
     
         def new_exception(self, exc_classes):
    -        clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
    +        clsdefs = set()
    +        for cls in exc_classes:
    +            clsdefs.add(self.getuniqueclassdef(cls))
             return SomeException(clsdefs)
     
         def getlistdef(self, **flags_if_new):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:27:33 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:27:33 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: merged default
    Message-ID: <20151123072733.273DB1C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80847:4dcc42d4c820
    Date: 2015-11-23 08:28 +0100
    http://bitbucket.org/pypy/pypy/changeset/4dcc42d4c820/
    
    Log:	merged default
    
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -168,7 +168,9 @@
             return desc.getuniqueclassdef()
     
         def new_exception(self, exc_classes):
    -        clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
    +        clsdefs = set()
    +        for cls in exc_classes:
    +            clsdefs.add(self.getuniqueclassdef(cls))
             return SomeException(clsdefs)
     
         def getlistdef(self, **flags_if_new):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:48:23 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:48:23 +0100 (CET)
    Subject: [pypy-commit] pypy default: reverted previous changes (did not know
     we do not support 2.6 anymore)
    Message-ID: <20151123074823.6EC641C05B6@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: 
    Changeset: r80848:ed910c5221d9
    Date: 2015-11-23 08:48 +0100
    http://bitbucket.org/pypy/pypy/changeset/ed910c5221d9/
    
    Log:	reverted previous changes (did not know we do not support 2.6
    	anymore)
    
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -168,9 +168,7 @@
             return desc.getuniqueclassdef()
     
         def new_exception(self, exc_classes):
    -        clsdefs = set()
    -        for cls in exc_classes:
    -            clsdefs.add(self.getuniqueclassdef(cls))
    +        clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
             return SomeException(clsdefs)
     
         def getlistdef(self, **flags_if_new):
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -461,10 +461,7 @@
     
         def intersection(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = set()
    -        for c in self.classdefs:
    -            if c.issubclass(other.case):
    -                classdefs.add(c)
    +        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    @@ -472,10 +469,7 @@
     
         def difference(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = set()
    -        for c in self.classdefs:
    -            if not c.issubclass(other.case):
    -                classdefs.add(c)
    +        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    
    From noreply at buildbot.pypy.org  Mon Nov 23 02:48:25 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 08:48:25 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: merged default
    Message-ID: <20151123074825.73C071C05B6@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80849:d454a5a7d9cd
    Date: 2015-11-23 08:48 +0100
    http://bitbucket.org/pypy/pypy/changeset/d454a5a7d9cd/
    
    Log:	merged default
    
    diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
    --- a/rpython/annotator/bookkeeper.py
    +++ b/rpython/annotator/bookkeeper.py
    @@ -168,9 +168,7 @@
             return desc.getuniqueclassdef()
     
         def new_exception(self, exc_classes):
    -        clsdefs = set()
    -        for cls in exc_classes:
    -            clsdefs.add(self.getuniqueclassdef(cls))
    +        clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
             return SomeException(clsdefs)
     
         def getlistdef(self, **flags_if_new):
    diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
    --- a/rpython/annotator/model.py
    +++ b/rpython/annotator/model.py
    @@ -461,10 +461,7 @@
     
         def intersection(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = set()
    -        for c in self.classdefs:
    -            if c.issubclass(other.case):
    -                classdefs.add(c)
    +        classdefs = {c for c in self.classdefs if c.issubclass(other.case)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    @@ -472,10 +469,7 @@
     
         def difference(self, other):
             assert isinstance(other, SomeExceptCase)
    -        classdefs = set()
    -        for c in self.classdefs:
    -            if not c.issubclass(other.case):
    -                classdefs.add(c)
    +        classdefs = {c for c in self.classdefs if not c.issubclass(other.case)}
             if classdefs:
                 return SomeException(classdefs)
             else:
    
    From noreply at buildbot.pypy.org  Mon Nov 23 03:11:18 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 09:11:18 +0100 (CET)
    Subject: [pypy-commit] pypy memop-simplify: new branch, new chance!
    Message-ID: <20151123081118.DD0041C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: memop-simplify
    Changeset: r80850:08f48e6704e1
    Date: 2015-11-23 08:57 +0100
    http://bitbucket.org/pypy/pypy/changeset/08f48e6704e1/
    
    Log:	new branch, new chance!
    
    
    From noreply at buildbot.pypy.org  Mon Nov 23 03:11:21 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 09:11:21 +0100 (CET)
    Subject: [pypy-commit] pypy memop-simplify: commented the 'to be removed'
     resops and added gc_load, gc_load_indexed, raw_load_indexed, gc_store,
     gc_store_indexed, raw_store_indexed
    Message-ID: <20151123081121.0D9861C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: memop-simplify
    Changeset: r80851:d26f61e6dde0
    Date: 2015-11-23 09:11 +0100
    http://bitbucket.org/pypy/pypy/changeset/d26f61e6dde0/
    
    Log:	commented the 'to be removed' resops and added gc_load,
    	gc_load_indexed, raw_load_indexed, gc_store, gc_store_indexed,
    	raw_store_indexed
    
    diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
    --- a/rpython/jit/metainterp/resoperation.py
    +++ b/rpython/jit/metainterp/resoperation.py
    @@ -1087,30 +1087,34 @@
         'INSTANCE_PTR_NE/2b/i',
         'NURSERY_PTR_INCREMENT/2/r',
         #
    -    'ARRAYLEN_GC/1d/i',
    -    'STRLEN/1/i',
    -    'STRGETITEM/2/i',
    -    'GETFIELD_GC_PURE/1d/rfi',
    -    'GETARRAYITEM_GC_PURE/2d/rfi',
    +    #'ARRAYLEN_GC/1d/i',
    +    #'STRLEN/1/i',
    +    # DEL 'STRGETITEM/2/i',
    +    # DEL 'GETFIELD_GC_PURE/1d/rfi',
    +    # DEL 'GETARRAYITEM_GC_PURE/2d/rfi',
         #'GETFIELD_RAW_PURE/1d/rfi',     these two operations not useful and
         #'GETARRAYITEM_RAW_PURE/2d/fi',  dangerous when unrolling speculatively
    -    'UNICODELEN/1/i',
    -    'UNICODEGETITEM/2/i',
    +    #'UNICODELEN/1/i',
    +    # DEL 'UNICODEGETITEM/2/i',
         #
         '_ALWAYS_PURE_LAST',  # ----- end of always_pure operations -----
     
         '_RAW_LOAD_FIRST',
    -    'GETARRAYITEM_GC/2d/rfi',
    -    'VEC_GETARRAYITEM_GC/2d/fi',
    -    'GETARRAYITEM_RAW/2d/fi',
    -    'VEC_GETARRAYITEM_RAW/2d/fi',
    -    'RAW_LOAD/2d/fi',
    -    'VEC_RAW_LOAD/2d/fi',
    +    #'GETARRAYITEM_GC/2d/rfi',
    +    #'VEC_GETARRAYITEM_GC/2d/fi',
    +    #'GETARRAYITEM_RAW/2d/fi',
    +    #'VEC_GETARRAYITEM_RAW/2d/fi',
    +    'RAW_LOAD/2d/rfi',
    +    'RAW_LOAD_INDEXED/2d/rfi',
    +    'VEC_RAW_LOAD/2d/rfi',
         '_RAW_LOAD_LAST',
     
    -    'GETINTERIORFIELD_GC/2d/rfi',
    -    'GETFIELD_GC/1d/rfi',
    -    'GETFIELD_RAW/1d/rfi',
    +    'GC_LOAD/2d/rfi',
    +    'GC_LOAD_INDEXED/2d/rfi',
    +
    +    # DEL 'GETINTERIORFIELD_GC/2d/rfi',
    +    # DEL 'GETFIELD_GC/1d/rfi',
    +    # DEL 'GETFIELD_RAW/1d/rfi',
         '_MALLOC_FIRST',
         'NEW/0d/r',           #-> GcStruct, gcptrs inside are zeroed (not the rest)
         'NEW_WITH_VTABLE/0d/r',#-> GcStruct with vtable, gcptrs inside are zeroed
    @@ -1127,23 +1131,28 @@
     
         'INCREMENT_DEBUG_COUNTER/1/n',
         '_RAW_STORE_FIRST',
    -    'SETARRAYITEM_GC/3d/n',
    -    'VEC_SETARRAYITEM_GC/3d/n',
    -    'SETARRAYITEM_RAW/3d/n',
    -    'VEC_SETARRAYITEM_RAW/3d/n',
    +    # DEL 'SETARRAYITEM_GC/3d/n',
    +    # DEL 'VEC_SETARRAYITEM_GC/3d/n',
    +    # DEL 'SETARRAYITEM_RAW/3d/n',
    +    # DEL 'VEC_SETARRAYITEM_RAW/3d/n',
         'RAW_STORE/3d/n',
    +    'RAW_STORE_INDEXED/3d/n',
         'VEC_RAW_STORE/3d/n',
         '_RAW_STORE_LAST',
    -    'SETINTERIORFIELD_GC/3d/n',
    -    'SETINTERIORFIELD_RAW/3d/n',    # right now, only used by tests
    -    'SETFIELD_GC/2d/n',
    +
    +    'GC_STORE/3d/n',
    +    'GC_STORE_INDEXED/3d/n',
    +
    +    # DEL 'SETINTERIORFIELD_GC/3d/n',
    +    # DEL 'SETINTERIORFIELD_RAW/3d/n',    # right now, only used by tests
    +    # DEL 'SETFIELD_GC/2d/n',
         'ZERO_PTR_FIELD/2/n', # only emitted by the rewrite, clears a pointer field
                             # at a given constant offset, no descr
         'ZERO_ARRAY/3d/n',  # only emitted by the rewrite, clears (part of) an array
                             # [arraygcptr, firstindex, length], descr=ArrayDescr
    -    'SETFIELD_RAW/2d/n',
    -    'STRSETITEM/3/n',
    -    'UNICODESETITEM/3/n',
    +    # DEL 'SETFIELD_RAW/2d/n',
    +    # DEL 'STRSETITEM/3/n',
    +    # DEL 'UNICODESETITEM/3/n',
         'COND_CALL_GC_WB/1d/n',       # [objptr] (for the write barrier)
         'COND_CALL_GC_WB_ARRAY/2d/n', # [objptr, arrayindex] (write barr. for array)
         '_JIT_DEBUG_FIRST',
    
    From noreply at buildbot.pypy.org  Mon Nov 23 03:58:40 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 09:58:40 +0100 (CET)
    Subject: [pypy-commit] pypy memop-simplify: added indexing_factors to CPU,
     started to rewrite jtransform to emit gc_load/raw_load for
     getarrayitem
    Message-ID: <20151123085840.C54281C13E6@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: memop-simplify
    Changeset: r80852:4a41f12f2981
    Date: 2015-11-23 09:59 +0100
    http://bitbucket.org/pypy/pypy/changeset/4a41f12f2981/
    
    Log:	added indexing_factors to CPU, started to rewrite jtransform to emit
    	gc_load/raw_load for getarrayitem
    
    diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py
    --- a/rpython/jit/backend/llsupport/llmodel.py
    +++ b/rpython/jit/backend/llsupport/llmodel.py
    @@ -32,6 +32,10 @@
         done_with_this_frame_descr_void     = None
         exit_frame_with_exception_descr_ref = None
     
    +    # which operations can be specified in the ISA of this
    +    # cpu? E.g. x86 can multiply an index with 1,2,4,8 while loading/storing
    +    indexing_factors = [1]
    +
         vector_extension = False
         vector_register_size = 0 # in bytes
         vector_horizontal_operations = False
    diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
    --- a/rpython/jit/codewriter/jtransform.py
    +++ b/rpython/jit/codewriter/jtransform.py
    @@ -703,16 +703,14 @@
                 pure = '_pure'
             arraydescr = self.cpu.arraydescrof(ARRAY)
             kind = getkind(op.result.concretetype)
    -        if ARRAY._gckind != 'gc':
    -            assert ARRAY._gckind == 'raw'
    -            if kind == 'r':
    -                raise Exception("getarrayitem_raw_r not supported")
    -            pure = ''   # always redetected from pyjitpl.py: we don't need
    -                        # a '_pure' version of getarrayitem_raw
    -        return SpaceOperation('getarrayitem_%s_%s%s' % (ARRAY._gckind,
    -                                                        kind[0], pure),
    -                              [op.args[0], op.args[1], arraydescr],
    -                              op.result)
    +        index_ops = []
    +        obj = op.args[0]
    +        index = op.args[1]
    +
    +        assert ARRAY._gckind in ('gc','raw')
    +        name = '%s_load_%s' % (ARRAY._gckind, kind[0])
    +        args = [obj, index, arraydescr]
    +        return index_ops + [SpaceOperation(name, args, op.result)]
     
         def rewrite_op_setarrayitem(self, op):
             ARRAY = op.args[0].concretetype.TO
    diff --git a/rpython/jit/codewriter/test/test_jtransform.py b/rpython/jit/codewriter/test/test_jtransform.py
    --- a/rpython/jit/codewriter/test/test_jtransform.py
    +++ b/rpython/jit/codewriter/test/test_jtransform.py
    @@ -1,19 +1,7 @@
     
     import py
     import random
    -try:
    -    from itertools import product
    -except ImportError:
    -    # Python 2.5, this is taken from the CPython docs, but simplified.
    -    def product(*args):
    -        # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
    -        # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
    -        pools = map(tuple, args)
    -        result = [[]]
    -        for pool in pools:
    -            result = [x+[y] for x in result for y in pool]
    -        for prod in result:
    -            yield tuple(prod)
    +from itertools import product
     
     from rpython.flowspace.model import FunctionGraph, Block, Link, c_last_exception
     from rpython.flowspace.model import SpaceOperation, Variable, Constant
    @@ -996,7 +984,7 @@
         v2 = varoftype(lltype.Char)
         op = SpaceOperation('getfield', [v1, Constant('x', lltype.Void)], v2)
         op1 = Transformer(FakeCPU()).rewrite_operation(op)
    -    assert op1.opname == 'getfield_gc_i'
    +    assert op1.opname == 'gc_load_i'
         assert op1.args == [v1, ('fielddescr', S, 'x')]
         assert op1.result == v2
     
    diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
    --- a/rpython/jit/metainterp/resoperation.py
    +++ b/rpython/jit/metainterp/resoperation.py
    @@ -1087,14 +1087,14 @@
         'INSTANCE_PTR_NE/2b/i',
         'NURSERY_PTR_INCREMENT/2/r',
         #
    -    #'ARRAYLEN_GC/1d/i',
    -    #'STRLEN/1/i',
    -    # DEL 'STRGETITEM/2/i',
    -    # DEL 'GETFIELD_GC_PURE/1d/rfi',
    +    # DEL 'ARRAYLEN_GC/1d/i',
    +    # DEL 'STRLEN/1/i',
    +    'STRGETITEM/2/i',
    +    'GETFIELD_GC_PURE/1d/rfi',
         # DEL 'GETARRAYITEM_GC_PURE/2d/rfi',
         #'GETFIELD_RAW_PURE/1d/rfi',     these two operations not useful and
         #'GETARRAYITEM_RAW_PURE/2d/fi',  dangerous when unrolling speculatively
    -    #'UNICODELEN/1/i',
    +    # DEL 'UNICODELEN/1/i',
         # DEL 'UNICODEGETITEM/2/i',
         #
         '_ALWAYS_PURE_LAST',  # ----- end of always_pure operations -----
    @@ -1374,17 +1374,20 @@
     _opvector = {
         rop.RAW_LOAD_I:         rop.VEC_RAW_LOAD_I,
         rop.RAW_LOAD_F:         rop.VEC_RAW_LOAD_F,
    -    rop.GETARRAYITEM_RAW_I: rop.VEC_GETARRAYITEM_RAW_I,
    -    rop.GETARRAYITEM_RAW_F: rop.VEC_GETARRAYITEM_RAW_F,
    -    rop.GETARRAYITEM_GC_I: rop.VEC_GETARRAYITEM_GC_I,
    -    rop.GETARRAYITEM_GC_F: rop.VEC_GETARRAYITEM_GC_F,
    +    rop.GC_LOAD_I:         rop.VEC_RAW_LOAD_I,
    +    rop.GC_LOAD_F:         rop.VEC_RAW_LOAD_F,
    +    #rop.GETARRAYITEM_RAW_I: rop.VEC_GETARRAYITEM_RAW_I,
    +    #rop.GETARRAYITEM_RAW_F: rop.VEC_GETARRAYITEM_RAW_F,
    +    #rop.GETARRAYITEM_GC_I: rop.VEC_GETARRAYITEM_GC_I,
    +    #rop.GETARRAYITEM_GC_F: rop.VEC_GETARRAYITEM_GC_F,
         # note that there is no _PURE operation for vector operations.
         # reason: currently we do not care if it is pure or not!
    -    rop.GETARRAYITEM_GC_PURE_I: rop.VEC_GETARRAYITEM_GC_I,
    -    rop.GETARRAYITEM_GC_PURE_F: rop.VEC_GETARRAYITEM_GC_F,
    +    #rop.GETARRAYITEM_GC_PURE_I: rop.VEC_GETARRAYITEM_GC_I,
    +    #rop.GETARRAYITEM_GC_PURE_F: rop.VEC_GETARRAYITEM_GC_F,
         rop.RAW_STORE:        rop.VEC_RAW_STORE,
    -    rop.SETARRAYITEM_RAW: rop.VEC_SETARRAYITEM_RAW,
    -    rop.SETARRAYITEM_GC: rop.VEC_SETARRAYITEM_GC,
    +    rop.GC_STORE:         rop.VEC_RAW_STORE, # TODO
    +    #rop.SETARRAYITEM_RAW: rop.VEC_SETARRAYITEM_RAW,
    +    #rop.SETARRAYITEM_GC: rop.VEC_SETARRAYITEM_GC,
     
         rop.INT_ADD:   rop.VEC_INT_ADD,
         rop.INT_SUB:   rop.VEC_INT_SUB,
    
    From noreply at buildbot.pypy.org  Mon Nov 23 05:21:03 2015
    From: noreply at buildbot.pypy.org (Raemi)
    Date: Mon, 23 Nov 2015 11:21:03 +0100 (CET)
    Subject: [pypy-commit] benchmarks default: some cleanup
    Message-ID: <20151123102103.34AED1C12C6@cobra.cs.uni-duesseldorf.de>
    
    Author: Remi Meier 
    Branch: 
    Changeset: r343:770e56a1296f
    Date: 2015-11-23 11:23 +0100
    http://bitbucket.org/pypy/benchmarks/changeset/770e56a1296f/
    
    Log:	some cleanup
    
    diff --git a/multithread/lee_routing/lee_router_tm.py b/multithread/lee_routing/lee_router_tm.py
    --- a/multithread/lee_routing/lee_router_tm.py
    +++ b/multithread/lee_routing/lee_router_tm.py
    @@ -60,12 +60,13 @@
     #
     #  * Use a deque() where Java used a Vector. deque is much better
     #    to pop an element from the front and append at the end.
    +#    This change vastly reduced GC pressure.
     #
     
     import time
     import sys, math
     import threading
    -import collections
    +from collections import deque as Deque
     
     try:
         from pypystm import atomic, hint_commit_soon
    @@ -204,6 +205,8 @@
             self.lr = lr
             self.wq = None
             self.tempgrid = Grid(GRID_SIZE, GRID_SIZE, 2)
    +        #self._ = Grid(GRID_SIZE*2, GRID_SIZE*2, 2)
    +
     
         def run(self):
             while True:
    @@ -229,7 +232,6 @@
             self.workQ = WorkQueue(self._work)
             #
             self.grid_lock = atomic#threading.Lock()
    -        self.view = Viewer()
     
         def _parse_data_file(self, file_name):
             with open(file_name, 'r') as file:
    @@ -305,8 +307,8 @@
             #
             # g[x_goal][y_goal][0] = EMPTY; // set goal as empty
     	# g[x_goal][y_goal][1] = EMPTY; // set goal as empty
    -        front = collections.deque()#[]
    -        tmp_front = collections.deque()#[]
    +        front = Deque()
    +        tmp_front = Deque()
             tempgrid[x, y, 0] = 1
             tempgrid[x, y, 1] = 1
             #
    @@ -357,7 +359,7 @@
             if sqval in (VIA, BVIA):
                 return False
             #
    -        if tempgrid[x, y, zo] <= tempgrid[x, y, z]:
    +        if sqval <= tempgrid[x, y, z]:
                 return (tempgrid[x-1, y, zo] < sqval or tempgrid[x+1, y, zo] < sqval
                         or tempgrid[x, y-1, zo] < sqval or tempgrid[x, y+1, zo] < sqval)
             return False
    @@ -397,7 +399,7 @@
                   ( -1, 1, 0, 0 ))
             #
             temp_y, temp_x, temp_z = y_goal, x_goal, z_goal
    -        while (temp_x != x_start) or (temp_y != y_start): # PDL: until back
    +        while (temp_x, temp_y) != (x_start, y_start): # PDL: until back
                 # at starting point
                 advanced = False
                 min_dir = 0
    @@ -417,7 +419,7 @@
                 if (self._path_from_other_side(tempgrid, temp_x, temp_y, temp_z)
                     # not preferred dir for this layer
                     and ((min_dir > 1 and distsofar > 15
    -                      and self._tlength(temp_x, temp_y, x_start, y_start) > 15)
    +                      and LeeRouter._tlength(temp_x, temp_y, x_start, y_start) > 15)
                          or (not advanced and
                              grid[temp_x, temp_y, temp_z] not in (VIA, BVIA)
                          ))):
    @@ -465,19 +467,7 @@
                 self._backtrack_from(xg, yg, xs, ys, net_no, tempgrid, grid)
             return found
     
    -    def disp_grid(self, z):
    -        laycol = (MAGENTA, GREEN)[z]
    -        for y in reversed(range(GRID_SIZE)): #WTF
    -            for x in range(GRID_SIZE):
    -                gg = self.grid[x, y, z]
    -                if gg == OCC:
    -                    self.view.point(x, y, CYAN)
    -                elif gg == VIA:
    -                    self.view.point(x, y, YELLOW)
    -                elif gg == BVIA:
    -                    self.view.point(x, y, RED)
    -                elif gg == TRACK:
    -                    self.view.point(x, y, laycol)
    +
     
     
     
    @@ -488,28 +478,35 @@
         #
         num_threads = int(args[0])
         filename = args[1]
    -    lr = LeeRouter(filename)
         #
    -    # setup the benchmark
    -    start_time = 0
    -    current_time = 0
    +    # Setup data:
    +    import pypyjit
    +    for _ in range(2):
    +        lr = LeeRouter(filename)
    +        print "Loaded data, starting benchmark"
    +        #
    +        thread = [lr.create_thread() for _ in range(num_threads)]
    +        start_time = time.time()
    +        for t in thread:
    +            t.start()
    +        current_time = time.time()
    +        for t in thread:
    +            t.join()
    +        #
    +        elapsed_time = current_time - start_time
    +        print "Numthreads:", num_threads
    +        print "ElapsedTime:", elapsed_time, "s"
    +        report(start_time)
    +        #
    +        print "turn off jit"
    +        pypyjit.set_param("off")
    +        pypyjit.set_param("threshold=9999999,trace_eagerness=999999")
         #
    -    thread = [lr.create_thread() for _ in range(num_threads)]
    -    start_time = time.time()
    -    for t in thread:
    -        t.start()
    -    current_time = time.time()
    -    for t in thread:
    -        t.join()
    -    #
    -    elapsed_time = current_time - start_time
    -    print "Numthreads:", num_threads
    -    print "ElapsedTime:", elapsed_time, "s"
    -    report(start_time)
         if DEBUG:
    -        lr.disp_grid(0)
    -        lr.disp_grid(1)
    -        lr.view.show()
    +        v = Viewer()
    +        v.disp_grid(lr.grid, 0)
    +        v.disp_grid(lr.grid, 1)
    +        v.show()
     
     
     
    @@ -543,6 +540,20 @@
                 #c.create_oval(x-1, y-1, x+1, y+1, fill=col, width=0)
             Tkinter.mainloop()
     
    +    def disp_grid(self, grid, z):
    +        laycol = (MAGENTA, GREEN)[z]
    +        for y in reversed(range(GRID_SIZE)): #WTF
    +            for x in range(GRID_SIZE):
    +                gg = grid[x, y, z]
    +                if gg == OCC:
    +                    self.point(x, y, CYAN)
    +                elif gg == VIA:
    +                    self.point(x, y, YELLOW)
    +                elif gg == BVIA:
    +                    self.point(x, y, RED)
    +                elif gg == TRACK:
    +                    self.point(x, y, laycol)
    +
     
     
     if __name__ == '__main__':
    
    From noreply at buildbot.pypy.org  Mon Nov 23 05:22:36 2015
    From: noreply at buildbot.pypy.org (Raemi)
    Date: Mon, 23 Nov 2015 11:22:36 +0100 (CET)
    Subject: [pypy-commit] pypy stmgc-c8: import stmgc
    Message-ID: <20151123102236.A77991C12C6@cobra.cs.uni-duesseldorf.de>
    
    Author: Remi Meier 
    Branch: stmgc-c8
    Changeset: r80853:f41aa8585729
    Date: 2015-11-23 11:24 +0100
    http://bitbucket.org/pypy/pypy/changeset/f41aa8585729/
    
    Log:	import stmgc
    
    diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
    --- a/rpython/translator/stm/src_stm/revision
    +++ b/rpython/translator/stm/src_stm/revision
    @@ -1,1 +1,1 @@
    -72facb6e4533
    +e3071642fd5c
    diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c
    --- a/rpython/translator/stm/src_stm/stm/core.c
    +++ b/rpython/translator/stm/src_stm/stm/core.c
    @@ -1561,6 +1561,14 @@
     
         list_clear(pseg->objects_pointing_to_nursery);
         list_clear(pseg->old_objects_with_cards_set);
    +    LIST_FOREACH_R(pseg->large_overflow_objects, uintptr_t /*item*/,
    +        {
    +            if (is_small_uniform((object_t*)item)) {
    +                //_stm_small_free()
    +            } else {
    +                _stm_large_free(stm_object_pages + item);
    +            }
    +        });
         list_clear(pseg->large_overflow_objects);
         list_clear(pseg->young_weakrefs);
     #pragma pop_macro("STM_SEGMENT")
    diff --git a/rpython/translator/stm/src_stm/stm/detach.c b/rpython/translator/stm/src_stm/stm/detach.c
    --- a/rpython/translator/stm/src_stm/stm/detach.c
    +++ b/rpython/translator/stm/src_stm/stm/detach.c
    @@ -127,6 +127,7 @@
             // XXX: not sure if the next line is a good idea
             tl->last_associated_segment_num = remote_seg_num;
             ensure_gs_register(remote_seg_num);
    +        assert(old_tl == STM_SEGMENT->running_thread);
             timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH);
             commit_external_inevitable_transaction();
         }
    @@ -186,6 +187,7 @@
         assert(segnum > 0);
     
         ensure_gs_register(segnum);
    +    assert(((stm_thread_local_t *)old) == STM_SEGMENT->running_thread);
         timing_event(STM_SEGMENT->running_thread, STM_TRANSACTION_REATTACH);
         commit_external_inevitable_transaction();
         ensure_gs_register(mysegnum);
    
    From noreply at buildbot.pypy.org  Mon Nov 23 05:47:17 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 11:47:17 +0100 (CET)
    Subject: [pypy-commit] cffi default: issue #233: ffi.init_once()
    Message-ID: <20151123104717.BFFCB1C21F4@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2423:a8c61fee71e3
    Date: 2015-11-23 11:48 +0100
    http://bitbucket.org/cffi/cffi/changeset/a8c61fee71e3/
    
    Log:	issue #233: ffi.init_once()
    
    diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
    --- a/c/_cffi_backend.c
    +++ b/c/_cffi_backend.c
    @@ -103,7 +103,11 @@
     #endif
     
     #if PY_MAJOR_VERSION < 3
    -#define PyCapsule_New(pointer, name, destructor)        \
    +# undef PyCapsule_GetPointer
    +# undef PyCapsule_New
    +# define PyCapsule_GetPointer(capsule, name) \
    +    (PyCObject_AsVoidPtr(capsule))
    +# define PyCapsule_New(pointer, name, destructor) \
         (PyCObject_FromVoidPtr(pointer, destructor))
     #endif
     
    diff --git a/c/ffi_obj.c b/c/ffi_obj.c
    --- a/c/ffi_obj.c
    +++ b/c/ffi_obj.c
    @@ -24,6 +24,7 @@
     struct FFIObject_s {
         PyObject_HEAD
         PyObject *gc_wrefs, *gc_wrefs_freelist;
    +    PyObject *init_once_cache;
         struct _cffi_parse_info_s info;
         char ctx_is_static, ctx_is_nonempty;
         builder_c_t types_builder;
    @@ -52,6 +53,7 @@
         }
         ffi->gc_wrefs = NULL;
         ffi->gc_wrefs_freelist = NULL;
    +    ffi->init_once_cache = NULL;
         ffi->info.ctx = &ffi->types_builder.ctx;
         ffi->info.output = internal_output;
         ffi->info.output_size = FFI_COMPLEXITY_OUTPUT;
    @@ -65,6 +67,7 @@
         PyObject_GC_UnTrack(ffi);
         Py_XDECREF(ffi->gc_wrefs);
         Py_XDECREF(ffi->gc_wrefs_freelist);
    +    Py_XDECREF(ffi->init_once_cache);
     
         free_builder_c(&ffi->types_builder, ffi->ctx_is_static);
     
    @@ -881,6 +884,130 @@
     #define ffi_memmove  b_memmove     /* ffi_memmove() => b_memmove()
                                           from _cffi_backend.c */
     
    +#ifdef WITH_THREAD
    +# include "pythread.h"
    +#else
    +typedef void *PyThread_type_lock;
    +# define PyThread_allocate_lock()        ((void *)-1)
    +# define PyThread_free_lock(lock)        ((void)(lock))
    +# define PyThread_acquire_lock(lock, _)  ((void)(lock))
    +# define PyThread_release_lock(lock)     ((void)(lock))
    +#endif
    +
    +PyDoc_STRVAR(ffi_init_once_doc,
    +             "XXX document me");
    +
    +#if PY_MAJOR_VERSION < 3
    +/* PyCapsule_New is redefined to be PyCObject_FromVoidPtr in _cffi_backend,
    +   which gives 2.6 compatibility; but the destructor signature is different */
    +static void _free_init_once_lock(void *lock)
    +{
    +    PyThread_free_lock((PyThread_type_lock)lock);
    +}
    +#else
    +static void _free_init_once_lock(PyObject *capsule)
    +{
    +    PyThread_type_lock lock;
    +    lock = PyCapsule_GetPointer(capsule, "cffi_init_once_lock");
    +    if (lock != NULL)
    +        PyThread_free_lock(lock);
    +}
    +#endif
    +
    +static PyObject *ffi_init_once(FFIObject *self, PyObject *args, PyObject *kwds)
    +{
    +    static char *keywords[] = {"func", "tag", NULL};
    +    PyObject *cache, *func, *tag, *tup, *res, *x, *lockobj;
    +    PyThread_type_lock lock;
    +
    +    if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO", keywords, &func, &tag))
    +        return NULL;
    +
    +    /* a lot of fun with reference counting and error checking
    +       in this function */
    +
    +    /* atomically get or create a new dict (no GIL release) */
    +    cache = self->init_once_cache;
    +    if (cache == NULL) {
    +        cache = PyDict_New();
    +        if (cache == NULL)
    +            return NULL;
    +        self->init_once_cache = cache;
    +    }
    +
    +    /* get the tuple from cache[tag], or make a new one: (False, lock) */
    +    tup = PyDict_GetItem(cache, tag);
    +    if (tup == NULL) {
    +        lock = PyThread_allocate_lock();
    +        if (lock == NULL)
    +            return NULL;
    +        x = PyCapsule_New(lock, "cffi_init_once_lock", _free_init_once_lock);
    +        if (x == NULL) {
    +            PyThread_free_lock(lock);
    +            return NULL;
    +        }
    +        tup = PyTuple_Pack(2, Py_False, x);
    +        Py_DECREF(x);
    +        if (tup == NULL)
    +            return NULL;
    +        x = tup;
    +
    +        /* Possible corner case if 'tag' is an object overriding __eq__
    +           in pure Python: the GIL may be released when we are running it.
    +           We really need to call dict.setdefault(). */
    +        tup = PyObject_CallMethod(cache, "setdefault", "OO", tag, x);
    +        Py_DECREF(x);
    +        if (tup == NULL)
    +            return NULL;
    +
    +        Py_DECREF(tup);   /* there is still a ref inside the dict */
    +    }
    +
    +    res = PyTuple_GET_ITEM(tup, 1);
    +    Py_INCREF(res);
    +
    +    if (PyTuple_GET_ITEM(tup, 0) == Py_True) {
    +        /* tup == (True, result): return the result. */
    +        return res;
    +    }
    +
    +    /* tup == (False, lock) */
    +    lockobj = res;
    +    lock = (PyThread_type_lock)PyCapsule_GetPointer(lockobj,
    +                                                    "cffi_init_once_lock");
    +    if (lock == NULL) {
    +        Py_DECREF(lockobj);
    +        return NULL;
    +    }
    +
    +    Py_BEGIN_ALLOW_THREADS
    +    PyThread_acquire_lock(lock, WAIT_LOCK);
    +    Py_END_ALLOW_THREADS
    +
    +    x = PyDict_GetItem(cache, tag);
    +    if (x != NULL && PyTuple_GET_ITEM(x, 0) == Py_True) {
    +        /* the real result was put in the dict while we were waiting
    +           for PyThread_acquire_lock() above */
    +        res = PyTuple_GET_ITEM(x, 1);
    +        Py_INCREF(res);
    +    }
    +    else {
    +        res = PyObject_CallFunction(func, "");
    +        if (res != NULL) {
    +            tup = PyTuple_Pack(2, Py_True, res);
    +            if (tup == NULL || PyDict_SetItem(cache, tag, tup) < 0) {
    +                Py_XDECREF(tup);
    +                Py_DECREF(res);
    +                res = NULL;
    +            }
    +        }
    +    }
    +
    +    PyThread_release_lock(lock);
    +    Py_DECREF(lockobj);
    +    return res;
    +}
    +
     
     #define METH_VKW  (METH_VARARGS | METH_KEYWORDS)
     static PyMethodDef ffi_methods[] = {
    @@ -898,6 +1025,7 @@
     #ifdef MS_WIN32
      {"getwinerror",(PyCFunction)ffi_getwinerror,METH_VKW,     ffi_getwinerror_doc},
     #endif
    + {"init_once",  (PyCFunction)ffi_init_once,  METH_VKW,     ffi_init_once_doc},
      {"integer_const",(PyCFunction)ffi_int_const,METH_VKW,     ffi_int_const_doc},
      {"memmove",    (PyCFunction)ffi_memmove,    METH_VKW,     ffi_memmove_doc},
      {"new",        (PyCFunction)ffi_new,        METH_VKW,     ffi_new_doc},
    diff --git a/cffi/api.py b/cffi/api.py
    --- a/cffi/api.py
    +++ b/cffi/api.py
    @@ -72,6 +72,7 @@
             self._cdefsources = []
             self._included_ffis = []
             self._windows_unicode = None
    +        self._init_once_cache = {}
             if hasattr(backend, 'set_ffi'):
                 backend.set_ffi(self)
             for name in backend.__dict__:
    @@ -598,6 +599,30 @@
             return recompile(self, module_name, source, tmpdir=tmpdir,
                              source_extension=source_extension, **kwds)
     
    +    def init_once(self, func, tag):
    +        # Read _init_once_cache[tag], which is either (False, lock) if
    +        # we're calling the function now in some thread, or (True, result).
    +        # Don't call setdefault() in most cases, to avoid allocating and
    +        # immediately freeing a lock; but still use setdefaut() to avoid
    +        # races.
    +        try:
    +            x = self._init_once_cache[tag]
    +        except KeyError:
    +            x = self._init_once_cache.setdefault(tag, (False, allocate_lock()))
    +        # Common case: we got (True, result), so we return the result.
    +        if x[0]:
    +            return x[1]
    +        # Else, it's a lock.  Acquire it to serialize the following tests.
    +        with x[1]:
    +            # Read again from _init_once_cache the current status.
    +            x = self._init_once_cache[tag]
    +            if x[0]:
    +                return x[1]
    +            # Call the function and store the result back.
    +            result = func()
    +            self._init_once_cache[tag] = (True, result)
    +        return result
    +
     
     def _load_backend_lib(backend, name, flags):
         if name is None:
    diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py
    --- a/testing/cffi0/backend_tests.py
    +++ b/testing/cffi0/backend_tests.py
    @@ -1809,3 +1809,35 @@
             assert lib.EE1 == 0
             assert lib.EE2 == 0
             assert lib.EE3 == 1
    +
    +    def test_init_once(self):
    +        def do_init():
    +            seen.append(1)
    +            return 42
    +        ffi = FFI()
    +        seen = []
    +        for i in range(3):
    +            res = ffi.init_once(do_init, "tag1")
    +            assert res == 42
    +            assert seen == [1]
    +        for i in range(3):
    +            res = ffi.init_once(do_init, "tag2")
    +            assert res == 42
    +            assert seen == [1, 1]
    +
    +    def test_init_once_multithread(self):
    +        import thread, time
    +        def do_init():
    +            seen.append('init!')
    +            time.sleep(1)
    +            seen.append('init done')
    +            return 7
    +        ffi = FFI()
    +        seen = []
    +        for i in range(6):
    +            def f():
    +                res = ffi.init_once(do_init, "tag")
    +                seen.append(res)
    +            thread.start_new_thread(f, ())
    +        time.sleep(1.5)
    +        assert seen == ['init!', 'init done'] + 6 * [7]
    diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py
    --- a/testing/cffi1/test_ffi_obj.py
    +++ b/testing/cffi1/test_ffi_obj.py
    @@ -415,3 +415,37 @@
                 assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1
                 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1
                 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0
    +
    +def test_init_once():
    +    def do_init():
    +        seen.append(1)
    +        return 42
    +    ffi = _cffi1_backend.FFI()
    +    seen = []
    +    for i in range(3):
    +        res = ffi.init_once(do_init, "tag1")
    +        assert res == 42
    +        assert seen == [1]
    +    for i in range(3):
    +        res = ffi.init_once(do_init, "tag2")
    +        assert res == 42
    +        assert seen == [1, 1]
    +
    +def test_init_once_multithread():
    +    import thread, time
    +    def do_init():
    +        print 'init!'
    +        seen.append('init!')
    +        time.sleep(1)
    +        seen.append('init done')
    +        print 'init done'
    +        return 7
    +    ffi = _cffi1_backend.FFI()
    +    seen = []
    +    for i in range(6):
    +        def f():
    +            res = ffi.init_once(do_init, "tag")
    +            seen.append(res)
    +        thread.start_new_thread(f, ())
    +    time.sleep(1.5)
    +    assert seen == ['init!', 'init done'] + 6 * [7]
    
    From noreply at buildbot.pypy.org  Mon Nov 23 07:22:13 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 13:22:13 +0100 (CET)
    Subject: [pypy-commit] cffi default: Copy the PyPy behavior on CPython too:
     two calls to new_handle(x), 
    Message-ID: <20151123122213.5C2E21C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2424:af8f2df87b10
    Date: 2015-11-23 13:17 +0100
    http://bitbucket.org/cffi/cffi/changeset/af8f2df87b10/
    
    Log:	Copy the PyPy behavior on CPython too: two calls to new_handle(x),
    	even with the same x, now return cdatas that compare as different.
    
    diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
    --- a/c/_cffi_backend.c
    +++ b/c/_cffi_backend.c
    @@ -1611,7 +1611,7 @@
         PyObject_GC_UnTrack(cd);
     
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        PyObject *x = ((CDataObject_own_structptr *)cd)->structobj;
             Py_DECREF(x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -1631,7 +1631,7 @@
     static int cdataowninggc_traverse(CDataObject *cd, visitproc visit, void *arg)
     {
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        PyObject *x = ((CDataObject_own_structptr *)cd)->structobj;
             Py_VISIT(x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -1649,9 +1649,10 @@
     static int cdataowninggc_clear(CDataObject *cd)
     {
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        CDataObject_own_structptr *cd1 = (CDataObject_own_structptr *)cd;
    +        PyObject *x = cd1->structobj;
             Py_INCREF(Py_None);
    -        cd->c_data = ((char *)Py_None) - 42;
    +        cd1->structobj = Py_None;
             Py_DECREF(x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -1839,7 +1840,7 @@
     static PyObject *cdataowninggc_repr(CDataObject *cd)
     {
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        PyObject *x = ((CDataObject_own_structptr *)cd)->structobj;
             return _cdata_repr2(cd, "handle to", x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -5609,10 +5610,26 @@
         return Py_None;
     }
     
    +static PyObject *newp_handle(CTypeDescrObject *ct_voidp, PyObject *x)
    +{
    +    CDataObject_own_structptr *cd;
    +    cd = (CDataObject_own_structptr *)PyObject_GC_New(CDataObject_own_structptr,
    +                                                      &CDataOwningGC_Type);
    +    if (cd == NULL)
    +        return NULL;
    +    Py_INCREF(ct_voidp);
    +    cd->head.c_type = ct_voidp;
    +    cd->head.c_data = (char *)cd;
    +    cd->head.c_weakreflist = NULL;
    +    Py_INCREF(x);
    +    cd->structobj = x;
    +    PyObject_GC_Track(cd);
    +    return (PyObject *)cd;
    +}
    +
     static PyObject *b_newp_handle(PyObject *self, PyObject *args)
     {
         CTypeDescrObject *ct;
    -    CDataObject *cd;
         PyObject *x;
         if (!PyArg_ParseTuple(args, "O!O", &CTypeDescr_Type, &ct, &x))
             return NULL;
    @@ -5622,47 +5639,38 @@
             return NULL;
         }
     
    -    cd = (CDataObject *)PyObject_GC_New(CDataObject, &CDataOwningGC_Type);
    -    if (cd == NULL)
    -        return NULL;
    -    Py_INCREF(ct);
    -    cd->c_type = ct;
    -    Py_INCREF(x);
    -    cd->c_data = ((char *)x) - 42;
    -    cd->c_weakreflist = NULL;
    -    PyObject_GC_Track(cd);
    -    return (PyObject *)cd;
    +    return newp_handle(ct, x);
     }
     
     static PyObject *b_from_handle(PyObject *self, PyObject *arg)
     {
         CTypeDescrObject *ct;
    -    char *raw;
    +    CDataObject_own_structptr *orgcd;
         PyObject *x;
         if (!CData_Check(arg)) {
             PyErr_SetString(PyExc_TypeError, "expected a 'cdata' object");
             return NULL;
         }
         ct = ((CDataObject *)arg)->c_type;
    -    raw = ((CDataObject *)arg)->c_data;
         if (!(ct->ct_flags & CT_CAST_ANYTHING)) {
             PyErr_Format(PyExc_TypeError,
                          "expected a 'cdata' object with a 'void *' out of "
                          "new_handle(), got '%s'", ct->ct_name);
             return NULL;
         }
    -    if (!raw) {
    +    orgcd = (CDataObject_own_structptr *)((CDataObject *)arg)->c_data;
    +    if (!orgcd) {
             PyErr_SetString(PyExc_RuntimeError,
                             "cannot use from_handle() on NULL pointer");
             return NULL;
         }
    -    x = (PyObject *)(raw + 42);
    -    if (Py_REFCNT(x) <= 0) {
    +    if (Py_REFCNT(orgcd) <= 0 || Py_TYPE(orgcd) != &CDataOwningGC_Type) {
             Py_FatalError("ffi.from_handle() detected that the address passed "
                           "points to garbage. If it is really the result of "
                           "ffi.new_handle(), then the Python object has already "
                           "been garbage collected");
         }
    +    x = orgcd->structobj;
         Py_INCREF(x);
         return x;
     }
    diff --git a/c/ffi_obj.c b/c/ffi_obj.c
    --- a/c/ffi_obj.c
    +++ b/c/ffi_obj.c
    @@ -679,18 +679,8 @@
     
     static PyObject *ffi_new_handle(FFIObject *self, PyObject *arg)
     {
    -    CDataObject *cd;
    -
    -    cd = (CDataObject *)PyObject_GC_New(CDataObject, &CDataOwningGC_Type);
    -    if (cd == NULL)
    -        return NULL;
    -    Py_INCREF(g_ct_voidp);     // 
    -    cd->c_type = g_ct_voidp;
    -    Py_INCREF(arg);
    -    cd->c_data = ((char *)arg) - 42;
    -    cd->c_weakreflist = NULL;
    -    PyObject_GC_Track(cd);
    -    return (PyObject *)cd;
    +    /* g_ct_voidp is equal to  */
    +    return newp_handle(g_ct_voidp, arg);
     }
     
     PyDoc_STRVAR(ffi_from_handle_doc,
    @@ -699,32 +689,8 @@
     "cdata object returned by new_handle() is still alive (somewhere else\n"
     "in the program).  Failure to follow these rules will crash.");
     
    -static PyObject *ffi_from_handle(PyObject *self, PyObject *arg)
    -{
    -    CTypeDescrObject *ct;
    -    char *raw;
    -    PyObject *x;
    -    if (!CData_Check(arg)) {
    -        PyErr_SetString(PyExc_TypeError, "expected a 'cdata' object");
    -        return NULL;
    -    }
    -    ct = ((CDataObject *)arg)->c_type;
    -    raw = ((CDataObject *)arg)->c_data;
    -    if (!(ct->ct_flags & CT_CAST_ANYTHING)) {
    -        PyErr_Format(PyExc_TypeError,
    -                     "expected a 'cdata' object with a 'void *' out of "
    -                     "new_handle(), got '%s'", ct->ct_name);
    -        return NULL;
    -    }
    -    if (!raw) {
    -        PyErr_SetString(PyExc_RuntimeError,
    -                        "cannot use from_handle() on NULL pointer");
    -        return NULL;
    -    }
    -    x = (PyObject *)(raw + 42);
    -    Py_INCREF(x);
    -    return x;
    -}
    +#define ffi_from_handle  b_from_handle   /* ffi_from_handle => b_from_handle
    +                                            from _cffi_backend.c */
     
     PyDoc_STRVAR(ffi_from_buffer_doc,
     "Return a  that points to the data of the given Python\n"
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -833,16 +833,18 @@
     *Calling ffi.from_handle(p) is invalid and will likely crash if
     the cdata object returned by new_handle() is not kept alive!*
     
    -(In case you are wondering, this ``void *`` is not a ``PyObject *``
    +(In case you are wondering, this ``void *`` is not the ``PyObject *``
     pointer.  This wouldn't make sense on PyPy anyway.)
     
     The ``ffi.new_handle()/from_handle()`` functions *conceptually* work
     like this:
     
    -* ``new_handle()`` returns a cdata object that contains a reference to
    -  the Python object; we call them collectively the "handle" cdata
    -  objects.  The ``void *`` value in this handle cdata object is random
    -  but unique.
    +* ``new_handle()`` returns cdata objects that contains references to
    +  the Python objects; we call them collectively the "handle" cdata
    +  objects.  The ``void *`` value in these handle cdata objects are
    +  random but unique.  *New in version 1.4:* two calls to
    +  ``new_handle(x)`` are guaranteed to return cdata objects with
    +  different ``void *`` values, even with the same ``x``.
     
     * ``from_handle(p)`` searches all live "handle" cdata objects for the
       one that has the same value ``p`` as its ``void *`` value.  It then
    diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py
    --- a/testing/cffi1/test_ffi_obj.py
    +++ b/testing/cffi1/test_ffi_obj.py
    @@ -193,6 +193,11 @@
         yp = ffi.new_handle([6, 4, 2])
         assert ffi.from_handle(yp) == [6, 4, 2]
     
    +def test_handle_unique():
    +    ffi = _cffi1_backend.FFI()
    +    assert ffi.new_handle(None) is not ffi.new_handle(None)
    +    assert ffi.new_handle(None) != ffi.new_handle(None)
    +
     def test_ffi_cast():
         ffi = _cffi1_backend.FFI()
         assert ffi.cast("int(*)(int)", 0) == ffi.NULL
    
    From noreply at buildbot.pypy.org  Mon Nov 23 07:22:15 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 13:22:15 +0100 (CET)
    Subject: [pypy-commit] cffi default: Add whatsnew
    Message-ID: <20151123122215.4C3861C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2425:76cf0a4277ed
    Date: 2015-11-23 13:23 +0100
    http://bitbucket.org/cffi/cffi/changeset/76cf0a4277ed/
    
    Log:	Add whatsnew
    
    diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
    --- a/doc/source/whatsnew.rst
    +++ b/doc/source/whatsnew.rst
    @@ -3,6 +3,18 @@
     ======================
     
     
    +v1.4.0
    +======
    +
    +* ``ffi.new_handle()`` is now guaranteed to return unique ``void *``
    +  values, even if called twice on the same object.  Previously, in
    +  that case, CPython (but not PyPy) would return different ``cdata``
    +  objects with the same ``void *`` value.  This is useful to add and
    +  remove handles from a global set without worrying about duplicates.
    +
    +* ``ffi.init_once()`` XXX
    +
    +
     v1.3.1
     ======
     
    
    From noreply at buildbot.pypy.org  Mon Nov 23 08:34:01 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 14:34:01 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: passing floating point guard
     instructions! nan handling was a little bit delicate for equal. stores
     information on an extra bit for float comparison
    Message-ID: <20151123133401.97EF41C134D@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80854:bf6e032b454c
    Date: 2015-11-23 14:34 +0100
    http://bitbucket.org/pypy/pypy/changeset/bf6e032b454c/
    
    Log:	passing floating point guard instructions! nan handling was a little
    	bit delicate for equal. stores information on an extra bit for float
    	comparison
    
    diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py
    --- a/rpython/jit/backend/zarch/conditions.py
    +++ b/rpython/jit/backend/zarch/conditions.py
    @@ -1,37 +1,60 @@
     from rpython.jit.backend.zarch import locations as loc
     from rpython.rlib.objectmodel import specialize
     
    +class ConditionLocation(loc.ImmLocation):
    +    def __repr__(self):
    +        s = ""
    +        if self.value & 0x10 != 0:
    +            s += "!FLOAT! "
    +        if self.value & 0x1 != 0:
    +            s += "OF"
    +        if self.value & 0x2 != 0:
    +            s += " GT"
    +        if self.value & 0x4 != 0:
    +            s += " LT"
    +        if self.value & 0x8 != 0:
    +            s += " EQ"
    +        return "cond(%s)" % s
    +
     # normal branch instructions
    -EQ = loc.imm(0x8)
    -LT = loc.imm(0x4)
    -GT = loc.imm(0x2)
    -OF = loc.imm(0x1) # overflow
    -LE = loc.imm(EQ.value | LT.value)
    -GE = loc.imm(EQ.value | GT.value)
    -NE = loc.imm(LT.value | GT.value)
    -NO = loc.imm(0xe) # NO overflow
    -ANY = loc.imm(0xf)
    +FLOAT = ConditionLocation(0x10)
    +EQ = ConditionLocation(0x8)
    +LT = ConditionLocation(0x4)
    +GT = ConditionLocation(0x2)
    +OF = ConditionLocation(0x1) # overflow
    +LE = ConditionLocation(EQ.value | LT.value)
    +GE = ConditionLocation(EQ.value | GT.value)
    +NE = ConditionLocation(LT.value | GT.value | OF.value)
    +NO = ConditionLocation(0xe) # NO overflow
    +ANY = ConditionLocation(0xf)
     
     FP_ROUND_DEFAULT = loc.imm(0x0)
     FP_TOWARDS_ZERO = loc.imm(0x5)
     
     cond_none = loc.imm(0x0)
     
    - at specialize.arg(1)
    -def negate(cond, inv_overflow=False):
    -    if cond is OF:
    -        return NO
    -    if cond is NO:
    -        return OF
    -    overflow = cond.value & 0x1
    -    value = (~cond.value) & 0xe
    -    return loc.imm(value | overflow)
    +def negate(cond):
    +    isfloat = (cond.value & 0x10) != 0
    +    if isfloat:
    +        # inverting is handeled differently for floats
    +        # overflow is never inverted
    +        value = (~cond.value) & 0xf
    +        return ConditionLocation(value | FLOAT.value)
    +    value = (~cond.value) & 0xf
    +    return ConditionLocation(value)
     
    -assert negate(EQ).value == NE.value
    -assert negate(NE).value == EQ.value
    -assert negate(LT).value == GE.value
    -assert negate(LE).value == GT.value
    -assert negate(GT).value == LE.value
    -assert negate(GE).value == LT.value
    +def prepare_float_condition(cond):
    +    newcond = ConditionLocation(cond.value | FLOAT.value)
    +    return newcond
    +
    +def _assert_invert(v1, v2):
    +    assert (v1.value & 0xe) == (v2.value & 0xe)
    +_assert_invert(negate(EQ), NE)
    +_assert_invert(negate(NE), EQ)
    +_assert_invert(negate(LT), GE)
    +_assert_invert(negate(LE), GT)
    +_assert_invert(negate(GT), LE)
    +_assert_invert(negate(GE), LT)
    +assert negate(NO).value == OF.value
     assert negate(OF).value == NO.value
    -assert negate(NO).value == OF.value
    +del _assert_invert
    diff --git a/rpython/jit/backend/zarch/helper/assembler.py b/rpython/jit/backend/zarch/helper/assembler.py
    --- a/rpython/jit/backend/zarch/helper/assembler.py
    +++ b/rpython/jit/backend/zarch/helper/assembler.py
    @@ -14,20 +14,10 @@
         self.mc.cmp_op(l0, l1, pool=l1.is_in_pool(), imm=l1.is_imm(), signed=signed, fp=fp)
     
         if fp:
    -        # Support for NaNs: with LE or GE, if one of the operands is a
    -        # NaN, we get CR=1,0,0,0 (unordered bit only).  We're about to
    -        # check "not GT" or "not LT", but in case of NaN we want to
    -        # get the answer False.
    -        if condition == c.LE:
    -            pass
    -            # TODO xxx
    -            #self.mc.crnor(1, 1, 3)
    -            #condition = c.GT
    -        elif condition == c.GE:
    -            pass
    -            #xxx
    -            #self.mc.crnor(0, 0, 3)
    -            #condition = c.LT
    +        # Support for NaNs: S390X sets condition register to 0x3 (unordered)
    +        # as soon as any of the operands is NaN
    +        condition = c.prepare_float_condition(condition)
    +        print("condition is:", condition)
         self.flush_cc(condition, arglocs[2])
     
     
    diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py
    --- a/rpython/jit/backend/zarch/opassembler.py
    +++ b/rpython/jit/backend/zarch/opassembler.py
    @@ -228,10 +228,12 @@
             return token
     
         def emit_guard_true(self, op, arglocs, regalloc):
    +        print("GUARD_TRUE condition to jump is:", self.guard_success_cc)
             self._emit_guard(op, arglocs)
     
         def emit_guard_false(self, op, arglocs, regalloc):
             self.guard_success_cc = c.negate(self.guard_success_cc)
    +        print("GUARD_FALSE condition to jump is:", self.guard_success_cc)
             self._emit_guard(op, arglocs)
     
         def emit_guard_overflow(self, op, arglocs, regalloc):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 08:36:27 2015
    From: noreply at buildbot.pypy.org (Raemi)
    Date: Mon, 23 Nov 2015 14:36:27 +0100 (CET)
    Subject: [pypy-commit] stmgc default: make slow tests run last
    Message-ID: <20151123133627.A112C1C134D@cobra.cs.uni-duesseldorf.de>
    
    Author: Remi Meier 
    Branch: 
    Changeset: r1970:c00e63d20b20
    Date: 2015-11-23 14:09 +0100
    http://bitbucket.org/pypy/stmgc/changeset/c00e63d20b20/
    
    Log:	make slow tests run last
    
    	I was finally annoyed enough.
    
    diff --git a/c8/test/test_demo.py b/c8/test/test_ydemo.py
    rename from c8/test/test_demo.py
    rename to c8/test/test_ydemo.py
    diff --git a/c8/test/test_random.py b/c8/test/test_zrandom.py
    rename from c8/test/test_random.py
    rename to c8/test/test_zrandom.py
    
    From noreply at buildbot.pypy.org  Mon Nov 23 08:36:29 2015
    From: noreply at buildbot.pypy.org (Raemi)
    Date: Mon, 23 Nov 2015 14:36:29 +0100 (CET)
    Subject: [pypy-commit] stmgc default: avoid triggering a segfault to call a
     function
    Message-ID: <20151123133629.9E7661C134D@cobra.cs.uni-duesseldorf.de>
    
    Author: Remi Meier 
    Branch: 
    Changeset: r1971:d31c9f671775
    Date: 2015-11-23 14:23 +0100
    http://bitbucket.org/pypy/stmgc/changeset/d31c9f671775/
    
    Log:	avoid triggering a segfault to call a function
    
    	Apparently, the obvious thing to do is not always obvious.
    
    diff --git a/c8/stm/core.c b/c8/stm/core.c
    --- a/c8/stm/core.c
    +++ b/c8/stm/core.c
    @@ -925,8 +925,7 @@
     
     static void touch_all_pages_of_obj(object_t *obj, size_t obj_size)
     {
    -    /* XXX should it be simpler, just really trying to read a dummy
    -       byte in each page? */
    +    /* XXX: make this function not needed */
         int my_segnum = STM_SEGMENT->segment_num;
         uintptr_t end_page, first_page = ((uintptr_t)obj) / 4096UL;
     
    @@ -942,8 +941,8 @@
         for (page = first_page; page <= end_page; page++) {
             if (get_page_status_in(my_segnum, page) == PAGE_NO_ACCESS) {
                 release_privatization_lock(STM_SEGMENT->segment_num);
    -            volatile char *dummy = REAL_ADDRESS(STM_SEGMENT->segment_base, page * 4096UL);
    -            *dummy;            /* force segfault */
    +            /* emulate pagefault -> PAGE_ACCESSIBLE: */
    +            handle_segfault_in_page(page);
                 acquire_privatization_lock(STM_SEGMENT->segment_num);
             }
         }
    
    From noreply at buildbot.pypy.org  Mon Nov 23 08:36:43 2015
    From: noreply at buildbot.pypy.org (Raemi)
    Date: Mon, 23 Nov 2015 14:36:43 +0100 (CET)
    Subject: [pypy-commit] pypy stmgc-c8: minor tweak
    Message-ID: <20151123133643.F38371C134D@cobra.cs.uni-duesseldorf.de>
    
    Author: Remi Meier 
    Branch: stmgc-c8
    Changeset: r80855:fb5ae8f4f26c
    Date: 2015-11-23 14:34 +0100
    http://bitbucket.org/pypy/pypy/changeset/fb5ae8f4f26c/
    
    Log:	minor tweak
    
    	In STM, we call the trace callback even if an obj doesn't have any
    	gcptrs in it, since we unify STM and GC write barriers and don't
    	make use of this information.
    
    diff --git a/rpython/memory/gctransform/stmframework.py b/rpython/memory/gctransform/stmframework.py
    --- a/rpython/memory/gctransform/stmframework.py
    +++ b/rpython/memory/gctransform/stmframework.py
    @@ -57,6 +57,13 @@
                       annmodel.SomeInteger()))
             #
             def pypy_stmcb_trace(obj, visit_fn):
    +            typeid = gc.get_type_id(obj)
    +            if not gc.has_gcptr(typeid):
    +                # fastpath, since in STM we don't distinguish between objs
    +                # that have gcptrs and those that don't. It would make only
    +                # little sense in STM, since all objs need write barriers, even
    +                # those without gcptrs. (still, possible XXX)
    +                return
                 gc.tracei(obj, invokecallback, visit_fn)
             pypy_stmcb_trace.c_name = "pypy_stmcb_trace"
             self.autoregister_ptrs.append(
    
    From noreply at buildbot.pypy.org  Mon Nov 23 08:36:46 2015
    From: noreply at buildbot.pypy.org (Raemi)
    Date: Mon, 23 Nov 2015 14:36:46 +0100 (CET)
    Subject: [pypy-commit] pypy stmgc-c8: import stmgc
    Message-ID: <20151123133646.1A3341C134D@cobra.cs.uni-duesseldorf.de>
    
    Author: Remi Meier 
    Branch: stmgc-c8
    Changeset: r80856:30d48688fee4
    Date: 2015-11-23 14:38 +0100
    http://bitbucket.org/pypy/pypy/changeset/30d48688fee4/
    
    Log:	import stmgc
    
    	(~20% reduction in 'sys' time observed, 1.2s -> 1.0s)
    
    diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
    --- a/rpython/translator/stm/src_stm/revision
    +++ b/rpython/translator/stm/src_stm/revision
    @@ -1,1 +1,1 @@
    -e3071642fd5c
    +d31c9f671775
    diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c
    --- a/rpython/translator/stm/src_stm/stm/core.c
    +++ b/rpython/translator/stm/src_stm/stm/core.c
    @@ -925,8 +925,7 @@
     
     static void touch_all_pages_of_obj(object_t *obj, size_t obj_size)
     {
    -    /* XXX should it be simpler, just really trying to read a dummy
    -       byte in each page? */
    +    /* XXX: make this function not needed */
         int my_segnum = STM_SEGMENT->segment_num;
         uintptr_t end_page, first_page = ((uintptr_t)obj) / 4096UL;
     
    @@ -942,8 +941,8 @@
         for (page = first_page; page <= end_page; page++) {
             if (get_page_status_in(my_segnum, page) == PAGE_NO_ACCESS) {
                 release_privatization_lock(STM_SEGMENT->segment_num);
    -            volatile char *dummy = REAL_ADDRESS(STM_SEGMENT->segment_base, page * 4096UL);
    -            *dummy;            /* force segfault */
    +            /* emulate pagefault -> PAGE_ACCESSIBLE: */
    +            handle_segfault_in_page(page);
                 acquire_privatization_lock(STM_SEGMENT->segment_num);
             }
         }
    
    From noreply at buildbot.pypy.org  Mon Nov 23 09:14:19 2015
    From: noreply at buildbot.pypy.org (plan_rich)
    Date: Mon, 23 Nov 2015 15:14:19 +0100 (CET)
    Subject: [pypy-commit] pypy s390x-backend: added regalloc_push/regalloc_pop
    Message-ID: <20151123141419.9A2981C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Richard Plangger 
    Branch: s390x-backend
    Changeset: r80857:91919df0fc41
    Date: 2015-11-23 15:14 +0100
    http://bitbucket.org/pypy/pypy/changeset/91919df0fc41/
    
    Log:	added regalloc_push/regalloc_pop
    
    diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py
    --- a/rpython/jit/backend/zarch/assembler.py
    +++ b/rpython/jit/backend/zarch/assembler.py
    @@ -376,6 +376,41 @@
                 self.mc.BRC(condition, l.imm(off)) # branch over LGHI
                 self.mc.XGR(result_loc, result_loc)
     
    +    def regalloc_push(self, loc, already_pushed):
    +        """Pushes the value stored in loc to the stack
    +        Can trash the current value of SCRATCH when pushing a stack
    +        loc"""
    +
    +        index = WORD * (~already_pushed)
    +
    +        if loc.type == FLOAT:
    +            if not loc.is_fp_reg():
    +                self.regalloc_mov(loc, r.FP_SCRATCH)
    +                loc = r.FP_SCRATCH
    +            self.mc.STD(loc, l.addr(index, r.SP))
    +        else:
    +            if not loc.is_core_reg():
    +                self.regalloc_mov(loc, r.SCRATCH)
    +                loc = r.SCRATCH
    +            self.mc.SG(loc, l.addr(index, r.SP))
    +
    +    def regalloc_pop(self, loc, already_pushed):
    +        """Pops the value on top of the stack to loc. Can trash the current
    +        value of SCRATCH when popping to a stack loc"""
    +        index = WORD * (~already_pushed)
    +
    +        if loc.type == FLOAT:
    +            if loc.is_fp_reg():
    +                self.mc.LD(loc, l.addr(index, r.SP))
    +            else:
    +                self.mc.LD(r.FP_SCRATCH, l.addr(index, r.SP))
    +                self.regalloc_mov(r.FP_SCRATCH, loc)
    +        else:
    +            if loc.is_core_reg():
    +                self.mc.LG(loc, l.addr(index, r.SP))
    +            else:
    +                self.mc.LG(r.SCRATCH, l.addr(index, r.SP))
    +                self.regalloc_mov(r.SCRATCH, loc)
     
         def _assemble(self, regalloc, inputargs, operations):
             self._regalloc = regalloc
    diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py
    --- a/rpython/jit/backend/zarch/locations.py
    +++ b/rpython/jit/backend/zarch/locations.py
    @@ -15,6 +15,9 @@
             return False
     
         def is_reg(self):
    +        return self.is_core_reg()
    +
    +    def is_core_reg(self):
             return False
     
         def is_fp_reg(self):
    @@ -45,7 +48,7 @@
         def __repr__(self):
             return 'r%d' % self.value
     
    -    def is_reg(self):
    +    def is_core_reg(self):
             return True
     
         def is_even(self):
    @@ -66,7 +69,7 @@
         def __repr__(self):
             return 'f%d' % self.value
     
    -    def is_reg(self):
    +    def is_core_reg(self):
             return False
     
         def is_fp_reg(self):
    diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py
    --- a/rpython/jit/backend/zarch/regalloc.py
    +++ b/rpython/jit/backend/zarch/regalloc.py
    @@ -377,7 +377,7 @@
                     loc = r.SPP
                 arg = inputargs[i]
                 i += 1
    -            if loc.is_reg():
    +            if loc.is_core_reg():
                     if loc is r.SPP:
                         self.rm.bindings_to_frame_reg[arg] = None
                     else:
    @@ -514,7 +514,7 @@
                     continue
                 if box.type == REF and self.rm.is_still_alive(box):
                     assert not noregs
    -                assert loc.is_reg()
    +                assert loc.is_core_reg()
                     val = self.assembler.cpu.all_reg_indexes[loc.value]
                     gcmap[val // WORD // 8] |= r_uint(1) << (val % (WORD * 8))
             for box, loc in self.fm.bindings.iteritems():
    @@ -787,7 +787,7 @@
                 loc = self.loc(arg)
                 assert loc is not r.SPP
                 arglocs[i] = loc
    -            if loc.is_reg():
    +            if loc.is_core_reg():
                     self.fm.mark_as_free(arg)
             #
             # if we are too close to the start of the loop, the label's target may
    diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py
    --- a/rpython/jit/backend/zarch/registers.py
    +++ b/rpython/jit/backend/zarch/registers.py
    @@ -19,7 +19,7 @@
     [f0,f1,f2,f3,f4,f5,f6,f7,f8,
      f9,f10,f11,f12,f13,f14,f15] = fpregisters
     
    -FSCRATCH = f0
    +FP_SCRATCH = f0
     
     MANAGED_FP_REGS = fpregisters[1:]
     VOLATILES_FLOAT = []
    diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py
    --- a/rpython/jit/backend/zarch/runner.py
    +++ b/rpython/jit/backend/zarch/runner.py
    @@ -19,6 +19,7 @@
     class CPU_S390_64(AbstractZARCHCPU):
         dont_keepalive_stuff = True
         supports_floats = True
    +    from rpython.jit.backend.zarch.registers import JITFRAME_FIXED_SIZE
     
         IS_64_BIT = True
     
    
    From noreply at buildbot.pypy.org  Mon Nov 23 09:55:01 2015
    From: noreply at buildbot.pypy.org (the_drow)
    Date: Mon, 23 Nov 2015 15:55:01 +0100 (CET)
    Subject: [pypy-commit] pypy py3.3: Added a __reduce__ method to the
     accumulate iterator.
    Message-ID: <20151123145501.32A031C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Omer Katz 
    Branch: py3.3
    Changeset: r80858:5a174924685f
    Date: 2015-11-23 12:56 +0200
    http://bitbucket.org/pypy/pypy/changeset/5a174924685f/
    
    Log:	Added a __reduce__ method to the accumulate iterator.
    
    diff --git a/pypy/module/itertools/interp_itertools.py b/pypy/module/itertools/interp_itertools.py
    --- a/pypy/module/itertools/interp_itertools.py
    +++ b/pypy/module/itertools/interp_itertools.py
    @@ -1217,6 +1217,13 @@
                 self.w_total = self.space.call_function(self.w_func, self.w_total, w_value)
             return self.w_total
     
    +    def reduce_w(self):
    +            space = self.space
    +            w_total = space.w_None if self.w_total is None else self.w_total
    +            w_func = space.w_None if self.w_func is None else self.w_func
    +            return space.newtuple([space.gettypefor(W_Accumulate),
    +                                   space.newtuple([self.w_iterable, w_func]), w_total])
    +
     def W_Accumulate__new__(space, w_subtype, w_iterable, w_func=None):
         r = space.allocate_instance(W_Accumulate, w_subtype)
         r.__init__(space, space.iter(w_iterable), w_func)
    @@ -1226,8 +1233,8 @@
         __new__  = interp2app(W_Accumulate__new__),
         __iter__ = interp2app(W_Accumulate.iter_w),
         __next__ = interp2app(W_Accumulate.next_w),
    +    __reduce__ = interp2app(W_Accumulate.reduce_w),
         __doc__  = """\
     "accumulate(iterable) --> accumulate object
     
     Return series of accumulated sums.""")
    -
    diff --git a/pypy/module/itertools/test/test_itertools.py b/pypy/module/itertools/test/test_itertools.py
    --- a/pypy/module/itertools/test/test_itertools.py
    +++ b/pypy/module/itertools/test/test_itertools.py
    @@ -2,7 +2,7 @@
     import pytest
     
     
    -class AppTestItertools: 
    +class AppTestItertools:
         spaceconfig = dict(usemodules=['itertools'])
     
         def test_count(self):
    @@ -298,11 +298,11 @@
     
         def test_chain(self):
             import itertools
    -        
    +
             it = itertools.chain()
             raises(StopIteration, next, it)
             raises(StopIteration, next, it)
    -        
    +
             it = itertools.chain([1, 2, 3])
             for x in [1, 2, 3]:
                 assert next(it) == x
    @@ -322,7 +322,7 @@
     
             it = itertools.cycle([])
             raises(StopIteration, next, it)
    -        
    +
             it = itertools.cycle([1, 2, 3])
             for x in [1, 2, 3, 1, 2, 3, 1, 2, 3]:
                 assert next(it) == x
    @@ -378,7 +378,7 @@
     
         def test_tee_wrongargs(self):
             import itertools
    -        
    +
             raises(TypeError, itertools.tee, 0)
             raises(ValueError, itertools.tee, [], -1)
             raises(TypeError, itertools.tee, [], None)
    @@ -416,7 +416,7 @@
     
         def test_groupby(self):
             import itertools
    -        
    +
             it = itertools.groupby([])
             raises(StopIteration, next, it)
     
    @@ -493,7 +493,7 @@
                 assert next(g) is x
                 raises(StopIteration, next, g)
             raises(StopIteration, next, it)
    -        
    +
             # Grouping is based on key equality
             class AlwaysEqual(object):
                 def __eq__(self, other):
    @@ -516,7 +516,7 @@
     
         def test_iterables(self):
             import itertools
    -    
    +
             iterables = [
                 itertools.chain(),
                 itertools.count(),
    @@ -531,7 +531,7 @@
                 itertools.tee([])[0],
                 itertools.tee([])[1],
                 ]
    -    
    +
             for it in iterables:
                 assert hasattr(it, '__iter__')
                 assert iter(it) is it
    @@ -540,7 +540,7 @@
     
         def test_docstrings(self):
             import itertools
    -        
    +
             assert itertools.__doc__
             methods = [
                 itertools.chain,
    @@ -981,7 +981,7 @@
             # kw arg
             assert list(accumulate(iterable=range(10))) == expected
             # multiple types
    -        for typ in int, complex, Decimal, Fraction:                 
    +        for typ in int, complex, Decimal, Fraction:
                 assert list(accumulate(map(typ, range(10)))) == list(map(typ, expected))
             assert list(accumulate('abc')) == ['a', 'ab', 'abc']   # works with non-numeric
             assert list(accumulate([])) == []                  # empty iterable
    @@ -998,3 +998,9 @@
             raises(TypeError, list, accumulate(s, chr))        # unary-operation
             raises(TypeError, list, accumulate(s, lambda x,y,z: None))  # ternary
     
    +        it = iter([10, 50, 150])
    +        a = accumulate(it)
    +        assert a.__reduce__() == (accumulate, (it, None), None)
    +        next(a)
    +        next(a)
    +        assert a.__reduce__() == (accumulate, (it, None), 60)
    
    From noreply at buildbot.pypy.org  Mon Nov 23 09:55:03 2015
    From: noreply at buildbot.pypy.org (the_drow)
    Date: Mon, 23 Nov 2015 15:55:03 +0100 (CET)
    Subject: [pypy-commit] pypy py3.3: Implemented the __setstate__ method for
     accumulate.
    Message-ID: <20151123145503.630B61C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Omer Katz 
    Branch: py3.3
    Changeset: r80859:f070ee413b8a
    Date: 2015-11-23 14:56 +0200
    http://bitbucket.org/pypy/pypy/changeset/f070ee413b8a/
    
    Log:	Implemented the __setstate__ method for accumulate.
    
    diff --git a/pypy/module/itertools/interp_itertools.py b/pypy/module/itertools/interp_itertools.py
    --- a/pypy/module/itertools/interp_itertools.py
    +++ b/pypy/module/itertools/interp_itertools.py
    @@ -1224,6 +1224,10 @@
                 return space.newtuple([space.gettypefor(W_Accumulate),
                                        space.newtuple([self.w_iterable, w_func]), w_total])
     
    +    def setstate_w(self, w_total):
    +        space = self.space
    +        self.w_total = w_total
    +
     def W_Accumulate__new__(space, w_subtype, w_iterable, w_func=None):
         r = space.allocate_instance(W_Accumulate, w_subtype)
         r.__init__(space, space.iter(w_iterable), w_func)
    @@ -1234,6 +1238,7 @@
         __iter__ = interp2app(W_Accumulate.iter_w),
         __next__ = interp2app(W_Accumulate.next_w),
         __reduce__ = interp2app(W_Accumulate.reduce_w),
    +    __setstate__ = interp2app(W_Accumulate.setstate_w),
         __doc__  = """\
     "accumulate(iterable) --> accumulate object
     
    diff --git a/pypy/module/itertools/test/test_itertools.py b/pypy/module/itertools/test/test_itertools.py
    --- a/pypy/module/itertools/test/test_itertools.py
    +++ b/pypy/module/itertools/test/test_itertools.py
    @@ -1004,3 +1004,8 @@
             next(a)
             next(a)
             assert a.__reduce__() == (accumulate, (it, None), 60)
    +
    +        it = iter([10, 50, 150])
    +        a = accumulate(it)
    +        a.__setstate__(20)
    +        assert a.__reduce__() == (accumulate, (it, None), 20)
    
    From noreply at buildbot.pypy.org  Mon Nov 23 09:55:05 2015
    From: noreply at buildbot.pypy.org (the_drow)
    Date: Mon, 23 Nov 2015 15:55:05 +0100 (CET)
    Subject: [pypy-commit] pypy py3.3: removed unneeded space local variable.
    Message-ID: <20151123145505.7B3181C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Omer Katz 
    Branch: py3.3
    Changeset: r80860:3f40096028b0
    Date: 2015-11-23 16:44 +0200
    http://bitbucket.org/pypy/pypy/changeset/3f40096028b0/
    
    Log:	removed unneeded space local variable.
    
    diff --git a/pypy/module/itertools/interp_itertools.py b/pypy/module/itertools/interp_itertools.py
    --- a/pypy/module/itertools/interp_itertools.py
    +++ b/pypy/module/itertools/interp_itertools.py
    @@ -1225,7 +1225,6 @@
                                        space.newtuple([self.w_iterable, w_func]), w_total])
     
         def setstate_w(self, w_total):
    -        space = self.space
             self.w_total = w_total
     
     def W_Accumulate__new__(space, w_subtype, w_iterable, w_func=None):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 09:55:07 2015
    From: noreply at buildbot.pypy.org (the_drow)
    Date: Mon, 23 Nov 2015 15:55:07 +0100 (CET)
    Subject: [pypy-commit] pypy py3.3: Fixed extra indentation.
    Message-ID: <20151123145507.8B79E1C12E8@cobra.cs.uni-duesseldorf.de>
    
    Author: Omer Katz 
    Branch: py3.3
    Changeset: r80861:4af8035b618c
    Date: 2015-11-23 16:50 +0200
    http://bitbucket.org/pypy/pypy/changeset/4af8035b618c/
    
    Log:	Fixed extra indentation.
    
    diff --git a/pypy/module/itertools/interp_itertools.py b/pypy/module/itertools/interp_itertools.py
    --- a/pypy/module/itertools/interp_itertools.py
    +++ b/pypy/module/itertools/interp_itertools.py
    @@ -1218,11 +1218,11 @@
             return self.w_total
     
         def reduce_w(self):
    -            space = self.space
    -            w_total = space.w_None if self.w_total is None else self.w_total
    -            w_func = space.w_None if self.w_func is None else self.w_func
    -            return space.newtuple([space.gettypefor(W_Accumulate),
    -                                   space.newtuple([self.w_iterable, w_func]), w_total])
    +        space = self.space
    +        w_total = space.w_None if self.w_total is None else self.w_total
    +        w_func = space.w_None if self.w_func is None else self.w_func
    +        return space.newtuple([space.gettypefor(W_Accumulate),
    +                               space.newtuple([self.w_iterable, w_func]), w_total])
     
         def setstate_w(self, w_total):
             self.w_total = w_total
    
    From noreply at buildbot.pypy.org  Mon Nov 23 10:10:51 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 16:10:51 +0100 (CET)
    Subject: [pypy-commit] cffi static-callback: hg merge default
    Message-ID: <20151123151051.E78CC1C04CF@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: static-callback
    Changeset: r2426:b5b5fb2182e7
    Date: 2015-11-23 16:11 +0100
    http://bitbucket.org/cffi/cffi/changeset/b5b5fb2182e7/
    
    Log:	hg merge default
    
    diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
    --- a/c/_cffi_backend.c
    +++ b/c/_cffi_backend.c
    @@ -103,7 +103,11 @@
     #endif
     
     #if PY_MAJOR_VERSION < 3
    -#define PyCapsule_New(pointer, name, destructor)        \
    +# undef PyCapsule_GetPointer
    +# undef PyCapsule_New
    +# define PyCapsule_GetPointer(capsule, name) \
    +    (PyCObject_AsVoidPtr(capsule))
    +# define PyCapsule_New(pointer, name, destructor) \
         (PyCObject_FromVoidPtr(pointer, destructor))
     #endif
     
    @@ -1607,7 +1611,7 @@
         PyObject_GC_UnTrack(cd);
     
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        PyObject *x = ((CDataObject_own_structptr *)cd)->structobj;
             Py_DECREF(x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -1627,7 +1631,7 @@
     static int cdataowninggc_traverse(CDataObject *cd, visitproc visit, void *arg)
     {
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        PyObject *x = ((CDataObject_own_structptr *)cd)->structobj;
             Py_VISIT(x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -1645,9 +1649,10 @@
     static int cdataowninggc_clear(CDataObject *cd)
     {
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        CDataObject_own_structptr *cd1 = (CDataObject_own_structptr *)cd;
    +        PyObject *x = cd1->structobj;
             Py_INCREF(Py_None);
    -        cd->c_data = ((char *)Py_None) - 42;
    +        cd1->structobj = Py_None;
             Py_DECREF(x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -1835,7 +1840,7 @@
     static PyObject *cdataowninggc_repr(CDataObject *cd)
     {
         if (cd->c_type->ct_flags & CT_IS_VOID_PTR) {        /* a handle */
    -        PyObject *x = (PyObject *)(cd->c_data + 42);
    +        PyObject *x = ((CDataObject_own_structptr *)cd)->structobj;
             return _cdata_repr2(cd, "handle to", x);
         }
         else if (cd->c_type->ct_flags & CT_FUNCTIONPTR) {   /* a callback */
    @@ -5649,10 +5654,26 @@
         return Py_None;
     }
     
    +static PyObject *newp_handle(CTypeDescrObject *ct_voidp, PyObject *x)
    +{
    +    CDataObject_own_structptr *cd;
    +    cd = (CDataObject_own_structptr *)PyObject_GC_New(CDataObject_own_structptr,
    +                                                      &CDataOwningGC_Type);
    +    if (cd == NULL)
    +        return NULL;
    +    Py_INCREF(ct_voidp);
    +    cd->head.c_type = ct_voidp;
    +    cd->head.c_data = (char *)cd;
    +    cd->head.c_weakreflist = NULL;
    +    Py_INCREF(x);
    +    cd->structobj = x;
    +    PyObject_GC_Track(cd);
    +    return (PyObject *)cd;
    +}
    +
     static PyObject *b_newp_handle(PyObject *self, PyObject *args)
     {
         CTypeDescrObject *ct;
    -    CDataObject *cd;
         PyObject *x;
         if (!PyArg_ParseTuple(args, "O!O", &CTypeDescr_Type, &ct, &x))
             return NULL;
    @@ -5662,47 +5683,38 @@
             return NULL;
         }
     
    -    cd = (CDataObject *)PyObject_GC_New(CDataObject, &CDataOwningGC_Type);
    -    if (cd == NULL)
    -        return NULL;
    -    Py_INCREF(ct);
    -    cd->c_type = ct;
    -    Py_INCREF(x);
    -    cd->c_data = ((char *)x) - 42;
    -    cd->c_weakreflist = NULL;
    -    PyObject_GC_Track(cd);
    -    return (PyObject *)cd;
    +    return newp_handle(ct, x);
     }
     
     static PyObject *b_from_handle(PyObject *self, PyObject *arg)
     {
         CTypeDescrObject *ct;
    -    char *raw;
    +    CDataObject_own_structptr *orgcd;
         PyObject *x;
         if (!CData_Check(arg)) {
             PyErr_SetString(PyExc_TypeError, "expected a 'cdata' object");
             return NULL;
         }
         ct = ((CDataObject *)arg)->c_type;
    -    raw = ((CDataObject *)arg)->c_data;
         if (!(ct->ct_flags & CT_CAST_ANYTHING)) {
             PyErr_Format(PyExc_TypeError,
                          "expected a 'cdata' object with a 'void *' out of "
                          "new_handle(), got '%s'", ct->ct_name);
             return NULL;
         }
    -    if (!raw) {
    +    orgcd = (CDataObject_own_structptr *)((CDataObject *)arg)->c_data;
    +    if (!orgcd) {
             PyErr_SetString(PyExc_RuntimeError,
                             "cannot use from_handle() on NULL pointer");
             return NULL;
         }
    -    x = (PyObject *)(raw + 42);
    -    if (Py_REFCNT(x) <= 0) {
    +    if (Py_REFCNT(orgcd) <= 0 || Py_TYPE(orgcd) != &CDataOwningGC_Type) {
             Py_FatalError("ffi.from_handle() detected that the address passed "
                           "points to garbage. If it is really the result of "
                           "ffi.new_handle(), then the Python object has already "
                           "been garbage collected");
         }
    +    x = orgcd->structobj;
         Py_INCREF(x);
         return x;
     }
    diff --git a/c/ffi_obj.c b/c/ffi_obj.c
    --- a/c/ffi_obj.c
    +++ b/c/ffi_obj.c
    @@ -24,6 +24,7 @@
     struct FFIObject_s {
         PyObject_HEAD
         PyObject *gc_wrefs, *gc_wrefs_freelist;
    +    PyObject *init_once_cache;
         struct _cffi_parse_info_s info;
         char ctx_is_static, ctx_is_nonempty;
         builder_c_t types_builder;
    @@ -52,6 +53,7 @@
         }
         ffi->gc_wrefs = NULL;
         ffi->gc_wrefs_freelist = NULL;
    +    ffi->init_once_cache = NULL;
         ffi->info.ctx = &ffi->types_builder.ctx;
         ffi->info.output = internal_output;
         ffi->info.output_size = FFI_COMPLEXITY_OUTPUT;
    @@ -65,6 +67,7 @@
         PyObject_GC_UnTrack(ffi);
         Py_XDECREF(ffi->gc_wrefs);
         Py_XDECREF(ffi->gc_wrefs_freelist);
    +    Py_XDECREF(ffi->init_once_cache);
     
         free_builder_c(&ffi->types_builder, ffi->ctx_is_static);
     
    @@ -676,18 +679,8 @@
     
     static PyObject *ffi_new_handle(FFIObject *self, PyObject *arg)
     {
    -    CDataObject *cd;
    -
    -    cd = (CDataObject *)PyObject_GC_New(CDataObject, &CDataOwningGC_Type);
    -    if (cd == NULL)
    -        return NULL;
    -    Py_INCREF(g_ct_voidp);     // 
    -    cd->c_type = g_ct_voidp;
    -    Py_INCREF(arg);
    -    cd->c_data = ((char *)arg) - 42;
    -    cd->c_weakreflist = NULL;
    -    PyObject_GC_Track(cd);
    -    return (PyObject *)cd;
    +    /* g_ct_voidp is equal to  */
    +    return newp_handle(g_ct_voidp, arg);
     }
     
     PyDoc_STRVAR(ffi_from_handle_doc,
    @@ -696,32 +689,8 @@
     "cdata object returned by new_handle() is still alive (somewhere else\n"
     "in the program).  Failure to follow these rules will crash.");
     
    -static PyObject *ffi_from_handle(PyObject *self, PyObject *arg)
    -{
    -    CTypeDescrObject *ct;
    -    char *raw;
    -    PyObject *x;
    -    if (!CData_Check(arg)) {
    -        PyErr_SetString(PyExc_TypeError, "expected a 'cdata' object");
    -        return NULL;
    -    }
    -    ct = ((CDataObject *)arg)->c_type;
    -    raw = ((CDataObject *)arg)->c_data;
    -    if (!(ct->ct_flags & CT_CAST_ANYTHING)) {
    -        PyErr_Format(PyExc_TypeError,
    -                     "expected a 'cdata' object with a 'void *' out of "
    -                     "new_handle(), got '%s'", ct->ct_name);
    -        return NULL;
    -    }
    -    if (!raw) {
    -        PyErr_SetString(PyExc_RuntimeError,
    -                        "cannot use from_handle() on NULL pointer");
    -        return NULL;
    -    }
    -    x = (PyObject *)(raw + 42);
    -    Py_INCREF(x);
    -    return x;
    -}
    +#define ffi_from_handle  b_from_handle   /* ffi_from_handle => b_from_handle
    +                                            from _cffi_backend.c */
     
     PyDoc_STRVAR(ffi_from_buffer_doc,
     "Return a  that points to the data of the given Python\n"
    @@ -916,6 +885,130 @@
     #define ffi_memmove  b_memmove     /* ffi_memmove() => b_memmove()
                                           from _cffi_backend.c */
     
    +#ifdef WITH_THREAD
    +# include "pythread.h"
    +#else
    +typedef void *PyThread_type_lock;
    +# define PyThread_allocate_lock()        ((void *)-1)
    +# define PyThread_free_lock(lock)        ((void)(lock))
    +# define PyThread_acquire_lock(lock, _)  ((void)(lock))
    +# define PyThread_release_lock(lock)     ((void)(lock))
    +#endif
    +
    +PyDoc_STRVAR(ffi_init_once_doc,
    +             "XXX document me");
    +
    +#if PY_MAJOR_VERSION < 3
    +/* PyCapsule_New is redefined to be PyCObject_FromVoidPtr in _cffi_backend,
    +   which gives 2.6 compatibility; but the destructor signature is different */
    +static void _free_init_once_lock(void *lock)
    +{
    +    PyThread_free_lock((PyThread_type_lock)lock);
    +}
    +#else
    +static void _free_init_once_lock(PyObject *capsule)
    +{
    +    PyThread_type_lock lock;
    +    lock = PyCapsule_GetPointer(capsule, "cffi_init_once_lock");
    +    if (lock != NULL)
    +        PyThread_free_lock(lock);
    +}
    +#endif
    +
    +static PyObject *ffi_init_once(FFIObject *self, PyObject *args, PyObject *kwds)
    +{
    +    static char *keywords[] = {"func", "tag", NULL};
    +    PyObject *cache, *func, *tag, *tup, *res, *x, *lockobj;
    +    PyThread_type_lock lock;
    +
    +    if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO", keywords, &func, &tag))
    +        return NULL;
    +
    +    /* a lot of fun with reference counting and error checking
    +       in this function */
    +
    +    /* atomically get or create a new dict (no GIL release) */
    +    cache = self->init_once_cache;
    +    if (cache == NULL) {
    +        cache = PyDict_New();
    +        if (cache == NULL)
    +            return NULL;
    +        self->init_once_cache = cache;
    +    }
    +
    +    /* get the tuple from cache[tag], or make a new one: (False, lock) */
    +    tup = PyDict_GetItem(cache, tag);
    +    if (tup == NULL) {
    +        lock = PyThread_allocate_lock();
    +        if (lock == NULL)
    +            return NULL;
    +        x = PyCapsule_New(lock, "cffi_init_once_lock", _free_init_once_lock);
    +        if (x == NULL) {
    +            PyThread_free_lock(lock);
    +            return NULL;
    +        }
    +        tup = PyTuple_Pack(2, Py_False, x);
    +        Py_DECREF(x);
    +        if (tup == NULL)
    +            return NULL;
    +        x = tup;
    +
    +        /* Possible corner case if 'tag' is an object overriding __eq__
    +           in pure Python: the GIL may be released when we are running it.
    +           We really need to call dict.setdefault(). */
    +        tup = PyObject_CallMethod(cache, "setdefault", "OO", tag, x);
    +        Py_DECREF(x);
    +        if (tup == NULL)
    +            return NULL;
    +
    +        Py_DECREF(tup);   /* there is still a ref inside the dict */
    +    }
    +
    +    res = PyTuple_GET_ITEM(tup, 1);
    +    Py_INCREF(res);
    +
    +    if (PyTuple_GET_ITEM(tup, 0) == Py_True) {
    +        /* tup == (True, result): return the result. */
    +        return res;
    +    }
    +
    +    /* tup == (False, lock) */
    +    lockobj = res;
    +    lock = (PyThread_type_lock)PyCapsule_GetPointer(lockobj,
    +                                                    "cffi_init_once_lock");
    +    if (lock == NULL) {
    +        Py_DECREF(lockobj);
    +        return NULL;
    +    }
    +
    +    Py_BEGIN_ALLOW_THREADS
    +    PyThread_acquire_lock(lock, WAIT_LOCK);
    +    Py_END_ALLOW_THREADS
    +
    +    x = PyDict_GetItem(cache, tag);
    +    if (x != NULL && PyTuple_GET_ITEM(x, 0) == Py_True) {
    +        /* the real result was put in the dict while we were waiting
    +           for PyThread_acquire_lock() above */
    +        res = PyTuple_GET_ITEM(x, 1);
    +        Py_INCREF(res);
    +    }
    +    else {
    +        res = PyObject_CallFunction(func, "");
    +        if (res != NULL) {
    +            tup = PyTuple_Pack(2, Py_True, res);
    +            if (tup == NULL || PyDict_SetItem(cache, tag, tup) < 0) {
    +                Py_XDECREF(tup);
    +                Py_DECREF(res);
    +                res = NULL;
    +            }
    +        }
    +    }
    +
    +    PyThread_release_lock(lock);
    +    Py_DECREF(lockobj);
    +    return res;
    +}
    +
     
     #define METH_VKW  (METH_VARARGS | METH_KEYWORDS)
     static PyMethodDef ffi_methods[] = {
    @@ -934,6 +1027,7 @@
     #ifdef MS_WIN32
      {"getwinerror",(PyCFunction)ffi_getwinerror,METH_VKW,     ffi_getwinerror_doc},
     #endif
    + {"init_once",  (PyCFunction)ffi_init_once,  METH_VKW,     ffi_init_once_doc},
      {"integer_const",(PyCFunction)ffi_int_const,METH_VKW,     ffi_int_const_doc},
      {"memmove",    (PyCFunction)ffi_memmove,    METH_VKW,     ffi_memmove_doc},
      {"new",        (PyCFunction)ffi_new,        METH_VKW,     ffi_new_doc},
    diff --git a/cffi/api.py b/cffi/api.py
    --- a/cffi/api.py
    +++ b/cffi/api.py
    @@ -72,6 +72,7 @@
             self._cdefsources = []
             self._included_ffis = []
             self._windows_unicode = None
    +        self._init_once_cache = {}
             if hasattr(backend, 'set_ffi'):
                 backend.set_ffi(self)
             for name in backend.__dict__:
    @@ -598,6 +599,30 @@
             return recompile(self, module_name, source, tmpdir=tmpdir,
                              source_extension=source_extension, **kwds)
     
    +    def init_once(self, func, tag):
    +        # Read _init_once_cache[tag], which is either (False, lock) if
    +        # we're calling the function now in some thread, or (True, result).
    +        # Don't call setdefault() in most cases, to avoid allocating and
    +        # immediately freeing a lock; but still use setdefaut() to avoid
    +        # races.
    +        try:
    +            x = self._init_once_cache[tag]
    +        except KeyError:
    +            x = self._init_once_cache.setdefault(tag, (False, allocate_lock()))
    +        # Common case: we got (True, result), so we return the result.
    +        if x[0]:
    +            return x[1]
    +        # Else, it's a lock.  Acquire it to serialize the following tests.
    +        with x[1]:
    +            # Read again from _init_once_cache the current status.
    +            x = self._init_once_cache[tag]
    +            if x[0]:
    +                return x[1]
    +            # Call the function and store the result back.
    +            result = func()
    +            self._init_once_cache[tag] = (True, result)
    +        return result
    +
     
     def _load_backend_lib(backend, name, flags):
         if name is None:
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -1046,16 +1046,18 @@
     *Calling ffi.from_handle(p) is invalid and will likely crash if
     the cdata object returned by new_handle() is not kept alive!*
     
    -(In case you are wondering, this ``void *`` is not a ``PyObject *``
    +(In case you are wondering, this ``void *`` is not the ``PyObject *``
     pointer.  This wouldn't make sense on PyPy anyway.)
     
     The ``ffi.new_handle()/from_handle()`` functions *conceptually* work
     like this:
     
    -* ``new_handle()`` returns a cdata object that contains a reference to
    -  the Python object; we call them collectively the "handle" cdata
    -  objects.  The ``void *`` value in this handle cdata object is random
    -  but unique.
    +* ``new_handle()`` returns cdata objects that contains references to
    +  the Python objects; we call them collectively the "handle" cdata
    +  objects.  The ``void *`` value in these handle cdata objects are
    +  random but unique.  *New in version 1.4:* two calls to
    +  ``new_handle(x)`` are guaranteed to return cdata objects with
    +  different ``void *`` values, even with the same ``x``.
     
     * ``from_handle(p)`` searches all live "handle" cdata objects for the
       one that has the same value ``p`` as its ``void *`` value.  It then
    diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
    --- a/doc/source/whatsnew.rst
    +++ b/doc/source/whatsnew.rst
    @@ -3,6 +3,18 @@
     ======================
     
     
    +v1.4.0
    +======
    +
    +* ``ffi.new_handle()`` is now guaranteed to return unique ``void *``
    +  values, even if called twice on the same object.  Previously, in
    +  that case, CPython (but not PyPy) would return different ``cdata``
    +  objects with the same ``void *`` value.  This is useful to add and
    +  remove handles from a global set without worrying about duplicates.
    +
    +* ``ffi.init_once()`` XXX
    +
    +
     v1.3.1
     ======
     
    diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py
    --- a/testing/cffi0/backend_tests.py
    +++ b/testing/cffi0/backend_tests.py
    @@ -1809,3 +1809,35 @@
             assert lib.EE1 == 0
             assert lib.EE2 == 0
             assert lib.EE3 == 1
    +
    +    def test_init_once(self):
    +        def do_init():
    +            seen.append(1)
    +            return 42
    +        ffi = FFI()
    +        seen = []
    +        for i in range(3):
    +            res = ffi.init_once(do_init, "tag1")
    +            assert res == 42
    +            assert seen == [1]
    +        for i in range(3):
    +            res = ffi.init_once(do_init, "tag2")
    +            assert res == 42
    +            assert seen == [1, 1]
    +
    +    def test_init_once_multithread(self):
    +        import thread, time
    +        def do_init():
    +            seen.append('init!')
    +            time.sleep(1)
    +            seen.append('init done')
    +            return 7
    +        ffi = FFI()
    +        seen = []
    +        for i in range(6):
    +            def f():
    +                res = ffi.init_once(do_init, "tag")
    +                seen.append(res)
    +            thread.start_new_thread(f, ())
    +        time.sleep(1.5)
    +        assert seen == ['init!', 'init done'] + 6 * [7]
    diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py
    --- a/testing/cffi0/test_function.py
    +++ b/testing/cffi0/test_function.py
    @@ -464,7 +464,7 @@
             ffi = FFI(backend=self.Backend())
             ffi.cdef("double __stdcall sin(double x);")     # stdcall ignored
             m = ffi.dlopen(lib_m)
    -        if (sys.platform == 'win32' and sys.maxint < 2**32 and 
    +        if (sys.platform == 'win32' and sys.maxsize < 2**32 and 
                     self.Backend is not CTypesBackend):
                 assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin))
             else:
    diff --git a/testing/cffi1/test_ffi_obj.py b/testing/cffi1/test_ffi_obj.py
    --- a/testing/cffi1/test_ffi_obj.py
    +++ b/testing/cffi1/test_ffi_obj.py
    @@ -193,6 +193,11 @@
         yp = ffi.new_handle([6, 4, 2])
         assert ffi.from_handle(yp) == [6, 4, 2]
     
    +def test_handle_unique():
    +    ffi = _cffi1_backend.FFI()
    +    assert ffi.new_handle(None) is not ffi.new_handle(None)
    +    assert ffi.new_handle(None) != ffi.new_handle(None)
    +
     def test_ffi_cast():
         ffi = _cffi1_backend.FFI()
         assert ffi.cast("int(*)(int)", 0) == ffi.NULL
    @@ -415,3 +420,37 @@
                 assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1
                 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1
                 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0
    +
    +def test_init_once():
    +    def do_init():
    +        seen.append(1)
    +        return 42
    +    ffi = _cffi1_backend.FFI()
    +    seen = []
    +    for i in range(3):
    +        res = ffi.init_once(do_init, "tag1")
    +        assert res == 42
    +        assert seen == [1]
    +    for i in range(3):
    +        res = ffi.init_once(do_init, "tag2")
    +        assert res == 42
    +        assert seen == [1, 1]
    +
    +def test_init_once_multithread():
    +    import thread, time
    +    def do_init():
    +        print 'init!'
    +        seen.append('init!')
    +        time.sleep(1)
    +        seen.append('init done')
    +        print 'init done'
    +        return 7
    +    ffi = _cffi1_backend.FFI()
    +    seen = []
    +    for i in range(6):
    +        def f():
    +            res = ffi.init_once(do_init, "tag")
    +            seen.append(res)
    +        thread.start_new_thread(f, ())
    +    time.sleep(1.5)
    +    assert seen == ['init!', 'init done'] + 6 * [7]
    
    From noreply at buildbot.pypy.org  Mon Nov 23 10:13:09 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 16:13:09 +0100 (CET)
    Subject: [pypy-commit] cffi default: Link to issue 233
    Message-ID: <20151123151309.53C481C05B6@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2427:851d1dbeeb12
    Date: 2015-11-23 16:14 +0100
    http://bitbucket.org/cffi/cffi/changeset/851d1dbeeb12/
    
    Log:	Link to issue 233
    
    diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
    --- a/doc/source/whatsnew.rst
    +++ b/doc/source/whatsnew.rst
    @@ -13,6 +13,7 @@
       remove handles from a global set without worrying about duplicates.
     
     * ``ffi.init_once()`` XXX
    +  https://bitbucket.org/cffi/cffi/issues/233/
     
     
     v1.3.1
    
    From noreply at buildbot.pypy.org  Mon Nov 23 10:30:48 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 16:30:48 +0100 (CET)
    Subject: [pypy-commit] cffi default: ffi.addressof(lib,
     "name") does not work with ffi.verify()
    Message-ID: <20151123153048.E04DA1C12CB@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2428:040da4f57982
    Date: 2015-11-23 16:31 +0100
    http://bitbucket.org/cffi/cffi/changeset/040da4f57982/
    
    Log:	ffi.addressof(lib, "name") does not work with ffi.verify()
    
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -365,8 +365,9 @@
     works on them.  To get a cdata containing a regular function pointer,
     use ``ffi.addressof(lib, "name")`` (new in version 1.1).
     
    -Before version 1.1, if you really need a cdata pointer to the function,
    -use the following workaround:
    +Before version 1.1 (or with the deprecated ``ffi.verify()``), if you
    +really need a cdata pointer to the function, use the following
    +workaround:
     
     .. code-block:: python
       
    
    From noreply at buildbot.pypy.org  Mon Nov 23 13:56:48 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Mon, 23 Nov 2015 19:56:48 +0100 (CET)
    Subject: [pypy-commit] pypy py3k: 2to3
    Message-ID: <20151123185648.E8F2C1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: py3k
    Changeset: r80862:d6232c50f187
    Date: 2015-11-23 18:11 +0100
    http://bitbucket.org/pypy/pypy/changeset/d6232c50f187/
    
    Log:	2to3
    
    diff --git a/pypy/module/__builtin__/functional.py b/pypy/module/__builtin__/functional.py
    --- a/pypy/module/__builtin__/functional.py
    +++ b/pypy/module/__builtin__/functional.py
    @@ -214,10 +214,12 @@
                 start = 0
             else:
                 w_start = space.index(w_start)
    -            if space.is_w(space.type(w_start), space.w_int):
    +            try:
                     start = space.int_w(w_start)
                     w_start = None
    -            else:
    +            except OperationError as e:
    +                if not e.match(space, space.w_OverflowError):
    +                    raise
                     start = -1
     
             if start == 0 and type(w_iterable) is W_ListObject:
    diff --git a/pypy/module/__builtin__/test/test_builtin.py b/pypy/module/__builtin__/test/test_builtin.py
    --- a/pypy/module/__builtin__/test/test_builtin.py
    +++ b/pypy/module/__builtin__/test/test_builtin.py
    @@ -313,8 +313,8 @@
             enum = enumerate(range(2), 2**100)
             assert list(enum) == [(2**100, 0), (2**100+1, 1)]
     
    -        enum = enumerate(range(2), sys.maxint)
    -        assert list(enum) == [(sys.maxint, 0), (sys.maxint+1, 1)]
    +        enum = enumerate(range(2), sys.maxsize)
    +        assert list(enum) == [(sys.maxsize, 0), (sys.maxsize+1, 1)]
     
             raises(TypeError, enumerate, range(2), 5.5)
     
    
    From noreply at buildbot.pypy.org  Mon Nov 23 13:56:50 2015
    From: noreply at buildbot.pypy.org (mjacob)
    Date: Mon, 23 Nov 2015 19:56:50 +0100 (CET)
    Subject: [pypy-commit] pypy py3k: Fix syntax error. However this test still
     crashes for another reason.
    Message-ID: <20151123185650.F28461C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Manuel Jacob 
    Branch: py3k
    Changeset: r80863:3f769149a919
    Date: 2015-11-23 18:17 +0100
    http://bitbucket.org/pypy/pypy/changeset/3f769149a919/
    
    Log:	Fix syntax error. However this test still crashes for another
    	reason.
    
    diff --git a/pypy/module/array/test/test_array.py b/pypy/module/array/test/test_array.py
    --- a/pypy/module/array/test/test_array.py
    +++ b/pypy/module/array/test/test_array.py
    @@ -851,9 +851,9 @@
             import sys
             if sys.maxunicode == 0xffff:
                 skip("test for 32-bit unicodes")
    -        a = self.array('u', '\xff\xff\xff\xff')
    +        a = self.array('u', b'\xff\xff\xff\xff')
             assert len(a) == 1
    -        assert repr(a[0]) == "u'\Uffffffff'"
    +        assert repr(a[0]) == r"'\Uffffffff'"
             if sys.maxint == 2147483647:
                 assert ord(a[0]) == -1
             else:
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:17:38 2015
    From: noreply at buildbot.pypy.org (Matt Bogosian)
    Date: Mon, 23 Nov 2015 21:17:38 +0100 (CET)
    Subject: [pypy-commit] pypy posita/2193-datetime-timedelta-integrals: Fix
     #2193. `isinstance(..., int)` => `isinstance(...,
     numbers.Integral)` to allow for alternate `int`-like implementations (e.g.,
     `future.types.newint`).
    Message-ID: <20151123201738.EBD791C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Matt Bogosian 
    Branch: posita/2193-datetime-timedelta-integrals
    Changeset: r80864:7c2b59d96efe
    Date: 2015-11-23 10:09 -0800
    http://bitbucket.org/pypy/pypy/changeset/7c2b59d96efe/
    
    Log:	Fix #2193. `isinstance(..., int)` => `isinstance(...,
    	numbers.Integral)` to allow for alternate `int`-like implementations
    	(e.g., `future.types.newint`).
    
    diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
    --- a/lib_pypy/datetime.py
    +++ b/lib_pypy/datetime.py
    @@ -17,6 +17,7 @@
     """
     
     from __future__ import division
    +import numbers as _numbers
     import time as _time
     import math as _math
     import struct as _struct
    @@ -278,7 +279,7 @@
             except AttributeError:
                 pass
             else:
    -            if isinstance(value, (int, long)):
    +            if isinstance(value, _numbers.Integral):
                     return value
                 raise TypeError('__int__ method should return an integer')
             raise TypeError('an integer is required')
    @@ -468,7 +469,7 @@
                 d = days
             assert isinstance(daysecondsfrac, float)
             assert abs(daysecondsfrac) <= 1.0
    -        assert isinstance(d, (int, long))
    +        assert isinstance(d, _numbers.Integral)
             assert abs(s) <= 24 * 3600
             # days isn't referenced again before redefinition
     
    @@ -484,11 +485,11 @@
             assert isinstance(secondsfrac, float)
             assert abs(secondsfrac) <= 2.0
     
    -        assert isinstance(seconds, (int, long))
    +        assert isinstance(seconds, _numbers.Integral)
             days, seconds = divmod(seconds, 24*3600)
             d += days
             s += int(seconds)    # can't overflow
    -        assert isinstance(s, int)
    +        assert isinstance(s, _numbers.Integral)
             assert abs(s) <= 2 * 24 * 3600
             # seconds isn't referenced again before redefinition
     
    @@ -510,8 +511,8 @@
                 d += days
                 s += int(seconds)
                 microseconds = _round(microseconds + usdouble)
    -        assert isinstance(s, int)
    -        assert isinstance(microseconds, int)
    +        assert isinstance(s, _numbers.Integral)
    +        assert isinstance(microseconds, _numbers.Integral)
             assert abs(s) <= 3 * 24 * 3600
             assert abs(microseconds) < 3.1e6
     
    @@ -521,9 +522,9 @@
             days, s = divmod(s, 24*3600)
             d += days
     
    -        assert isinstance(d, (int, long))
    -        assert isinstance(s, int) and 0 <= s < 24*3600
    -        assert isinstance(us, int) and 0 <= us < 1000000
    +        assert isinstance(d, _numbers.Integral)
    +        assert isinstance(s, _numbers.Integral) and 0 <= s < 24*3600
    +        assert isinstance(us, _numbers.Integral) and 0 <= us < 1000000
     
             if abs(d) > 999999999:
                 raise OverflowError("timedelta # of days is too large: %d" % d)
    @@ -623,7 +624,7 @@
                 return self
     
         def __mul__(self, other):
    -        if isinstance(other, (int, long)):
    +        if isinstance(other, _numbers.Integral):
                 # for CPython compatibility, we cannot use
                 # our __class__ here, but need a real timedelta
                 return timedelta(self._days * other,
    @@ -638,7 +639,7 @@
                     self._microseconds)
     
         def __div__(self, other):
    -        if not isinstance(other, (int, long)):
    +        if not isinstance(other, _numbers.Integral):
                 return NotImplemented
             usec = self._to_microseconds()
             return timedelta(0, 0, usec // other)
    @@ -1510,7 +1511,7 @@
     
             converter = _time.localtime if tz is None else _time.gmtime
     
    -        if isinstance(timestamp, int):
    +        if isinstance(timestamp, _numbers.Integral):
                 us = 0
             else:
                 t_full = timestamp
    @@ -1535,7 +1536,7 @@
         @classmethod
         def utcfromtimestamp(cls, t):
             "Construct a UTC datetime from a POSIX timestamp (like time.time())."
    -        if isinstance(t, int):
    +        if isinstance(t, _numbers.Integral):
                 us = 0
             else:
                 t_full = t
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:17:40 2015
    From: noreply at buildbot.pypy.org (Matt Bogosian)
    Date: Mon, 23 Nov 2015 21:17:40 +0100 (CET)
    Subject: [pypy-commit] pypy posita/2193-datetime-timedelta-integrals: Add
     optional tests for #2193 (requires future).
    Message-ID: <20151123201740.F18BA1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Matt Bogosian 
    Branch: posita/2193-datetime-timedelta-integrals
    Changeset: r80865:49965339e4f4
    Date: 2015-11-23 11:33 -0800
    http://bitbucket.org/pypy/pypy/changeset/49965339e4f4/
    
    Log:	Add optional tests for #2193 (requires future).
    
    diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py
    --- a/pypy/module/test_lib_pypy/test_datetime.py
    +++ b/pypy/module/test_lib_pypy/test_datetime.py
    @@ -242,6 +242,64 @@
                 naive == aware
             assert str(e.value) == "can't compare offset-naive and offset-aware times"
     
    +    def test_future_types_newint(self):
    +        try:
    +            from future.types.newint import newint
    +        except ImportError:
    +            py.test.skip('requires future')
    +
    +        dt_from_ints = datetime.datetime(2015, 12, 31, 12, 34, 56)
    +        dt_from_newints = datetime.datetime(newint(2015), newint(12), newint(31), newint(12), newint(34), newint(56))
    +        dt_from_mixed = datetime.datetime(2015, newint(12), 31, newint(12), 34, newint(56))
    +        assert dt_from_ints == dt_from_newints
    +        assert dt_from_newints == dt_from_mixed
    +        assert dt_from_mixed == dt_from_ints
    +
    +        d_from_int = datetime.date.fromtimestamp(1431216000)
    +        d_from_newint = datetime.date.fromtimestamp(newint(1431216000))
    +        assert d_from_int == d_from_newint
    +
    +        dt_from_int = datetime.datetime.fromtimestamp(1431216000)
    +        dt_from_newint = datetime.datetime.fromtimestamp(newint(1431216000))
    +        assert dt_from_int == dt_from_newint
    +
    +        dtu_from_int = datetime.datetime.utcfromtimestamp(1431216000)
    +        dtu_from_newint = datetime.datetime.utcfromtimestamp(newint(1431216000))
    +        assert dtu_from_int == dtu_from_newint
    +
    +        td_from_int = datetime.timedelta(16565)
    +        tds_from_int = datetime.timedelta(seconds=1431216000)
    +        td_from_newint = datetime.timedelta(newint(16565))
    +        tds_from_newint = datetime.timedelta(seconds=newint(1431216000))
    +        assert td_from_int == tds_from_int
    +        assert td_from_int == td_from_newint
    +        assert td_from_int == tds_from_newint
    +        assert tds_from_int == td_from_newint
    +        assert tds_from_int == tds_from_newint
    +        assert td_from_newint == tds_from_newint
    +
    +        td_mul_int_int = td_from_int * 2
    +        td_mul_int_newint = td_from_int * newint(2)
    +        td_mul_newint_int = td_from_newint * 2
    +        td_mul_newint_newint = td_from_newint * newint(2)
    +        assert td_mul_int_int == td_mul_int_newint
    +        assert td_mul_int_int == td_mul_newint_int
    +        assert td_mul_int_int == td_mul_newint_newint
    +        assert td_mul_int_newint == td_mul_newint_int
    +        assert td_mul_int_newint == td_mul_newint_newint
    +        assert td_mul_newint_int == td_mul_newint_newint
    +
    +        td_div_int_int = td_from_int / 3600
    +        td_div_int_newint = td_from_int / newint(3600)
    +        td_div_newint_int = td_from_newint / 3600
    +        td_div_newint_newint = td_from_newint / newint(3600)
    +        assert td_div_int_int == td_div_int_newint
    +        assert td_div_int_int == td_div_newint_int
    +        assert td_div_int_int == td_div_newint_newint
    +        assert td_div_int_newint == td_div_newint_int
    +        assert td_div_int_newint == td_div_newint_newint
    +        assert td_div_newint_int == td_div_newint_newint
    +
     
     class TestDatetimeHost(BaseTestDatetime):
         def setup_class(cls):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:17:43 2015
    From: noreply at buildbot.pypy.org (bdkearns)
    Date: Mon, 23 Nov 2015 21:17:43 +0100 (CET)
    Subject: [pypy-commit] pypy default: Merged in
     posita/pypy/posita/2193-datetime-timedelta-integrals (pull request #361)
    Message-ID: <20151123201743.08E501C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Brian Kearns 
    Branch: 
    Changeset: r80866:3e66caad1c36
    Date: 2015-11-23 12:18 -0800
    http://bitbucket.org/pypy/pypy/changeset/3e66caad1c36/
    
    Log:	Merged in posita/pypy/posita/2193-datetime-timedelta-integrals (pull
    	request #361)
    
    	Fix #2193.
    
    diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
    --- a/lib_pypy/datetime.py
    +++ b/lib_pypy/datetime.py
    @@ -17,6 +17,7 @@
     """
     
     from __future__ import division
    +import numbers as _numbers
     import time as _time
     import math as _math
     import struct as _struct
    @@ -278,7 +279,7 @@
             except AttributeError:
                 pass
             else:
    -            if isinstance(value, (int, long)):
    +            if isinstance(value, _numbers.Integral):
                     return value
                 raise TypeError('__int__ method should return an integer')
             raise TypeError('an integer is required')
    @@ -468,7 +469,7 @@
                 d = days
             assert isinstance(daysecondsfrac, float)
             assert abs(daysecondsfrac) <= 1.0
    -        assert isinstance(d, (int, long))
    +        assert isinstance(d, _numbers.Integral)
             assert abs(s) <= 24 * 3600
             # days isn't referenced again before redefinition
     
    @@ -484,11 +485,11 @@
             assert isinstance(secondsfrac, float)
             assert abs(secondsfrac) <= 2.0
     
    -        assert isinstance(seconds, (int, long))
    +        assert isinstance(seconds, _numbers.Integral)
             days, seconds = divmod(seconds, 24*3600)
             d += days
             s += int(seconds)    # can't overflow
    -        assert isinstance(s, int)
    +        assert isinstance(s, _numbers.Integral)
             assert abs(s) <= 2 * 24 * 3600
             # seconds isn't referenced again before redefinition
     
    @@ -510,8 +511,8 @@
                 d += days
                 s += int(seconds)
                 microseconds = _round(microseconds + usdouble)
    -        assert isinstance(s, int)
    -        assert isinstance(microseconds, int)
    +        assert isinstance(s, _numbers.Integral)
    +        assert isinstance(microseconds, _numbers.Integral)
             assert abs(s) <= 3 * 24 * 3600
             assert abs(microseconds) < 3.1e6
     
    @@ -521,9 +522,9 @@
             days, s = divmod(s, 24*3600)
             d += days
     
    -        assert isinstance(d, (int, long))
    -        assert isinstance(s, int) and 0 <= s < 24*3600
    -        assert isinstance(us, int) and 0 <= us < 1000000
    +        assert isinstance(d, _numbers.Integral)
    +        assert isinstance(s, _numbers.Integral) and 0 <= s < 24*3600
    +        assert isinstance(us, _numbers.Integral) and 0 <= us < 1000000
     
             if abs(d) > 999999999:
                 raise OverflowError("timedelta # of days is too large: %d" % d)
    @@ -623,7 +624,7 @@
                 return self
     
         def __mul__(self, other):
    -        if isinstance(other, (int, long)):
    +        if isinstance(other, _numbers.Integral):
                 # for CPython compatibility, we cannot use
                 # our __class__ here, but need a real timedelta
                 return timedelta(self._days * other,
    @@ -638,7 +639,7 @@
                     self._microseconds)
     
         def __div__(self, other):
    -        if not isinstance(other, (int, long)):
    +        if not isinstance(other, _numbers.Integral):
                 return NotImplemented
             usec = self._to_microseconds()
             return timedelta(0, 0, usec // other)
    @@ -1510,7 +1511,7 @@
     
             converter = _time.localtime if tz is None else _time.gmtime
     
    -        if isinstance(timestamp, int):
    +        if isinstance(timestamp, _numbers.Integral):
                 us = 0
             else:
                 t_full = timestamp
    @@ -1535,7 +1536,7 @@
         @classmethod
         def utcfromtimestamp(cls, t):
             "Construct a UTC datetime from a POSIX timestamp (like time.time())."
    -        if isinstance(t, int):
    +        if isinstance(t, _numbers.Integral):
                 us = 0
             else:
                 t_full = t
    diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py
    --- a/pypy/module/test_lib_pypy/test_datetime.py
    +++ b/pypy/module/test_lib_pypy/test_datetime.py
    @@ -242,6 +242,64 @@
                 naive == aware
             assert str(e.value) == "can't compare offset-naive and offset-aware times"
     
    +    def test_future_types_newint(self):
    +        try:
    +            from future.types.newint import newint
    +        except ImportError:
    +            py.test.skip('requires future')
    +
    +        dt_from_ints = datetime.datetime(2015, 12, 31, 12, 34, 56)
    +        dt_from_newints = datetime.datetime(newint(2015), newint(12), newint(31), newint(12), newint(34), newint(56))
    +        dt_from_mixed = datetime.datetime(2015, newint(12), 31, newint(12), 34, newint(56))
    +        assert dt_from_ints == dt_from_newints
    +        assert dt_from_newints == dt_from_mixed
    +        assert dt_from_mixed == dt_from_ints
    +
    +        d_from_int = datetime.date.fromtimestamp(1431216000)
    +        d_from_newint = datetime.date.fromtimestamp(newint(1431216000))
    +        assert d_from_int == d_from_newint
    +
    +        dt_from_int = datetime.datetime.fromtimestamp(1431216000)
    +        dt_from_newint = datetime.datetime.fromtimestamp(newint(1431216000))
    +        assert dt_from_int == dt_from_newint
    +
    +        dtu_from_int = datetime.datetime.utcfromtimestamp(1431216000)
    +        dtu_from_newint = datetime.datetime.utcfromtimestamp(newint(1431216000))
    +        assert dtu_from_int == dtu_from_newint
    +
    +        td_from_int = datetime.timedelta(16565)
    +        tds_from_int = datetime.timedelta(seconds=1431216000)
    +        td_from_newint = datetime.timedelta(newint(16565))
    +        tds_from_newint = datetime.timedelta(seconds=newint(1431216000))
    +        assert td_from_int == tds_from_int
    +        assert td_from_int == td_from_newint
    +        assert td_from_int == tds_from_newint
    +        assert tds_from_int == td_from_newint
    +        assert tds_from_int == tds_from_newint
    +        assert td_from_newint == tds_from_newint
    +
    +        td_mul_int_int = td_from_int * 2
    +        td_mul_int_newint = td_from_int * newint(2)
    +        td_mul_newint_int = td_from_newint * 2
    +        td_mul_newint_newint = td_from_newint * newint(2)
    +        assert td_mul_int_int == td_mul_int_newint
    +        assert td_mul_int_int == td_mul_newint_int
    +        assert td_mul_int_int == td_mul_newint_newint
    +        assert td_mul_int_newint == td_mul_newint_int
    +        assert td_mul_int_newint == td_mul_newint_newint
    +        assert td_mul_newint_int == td_mul_newint_newint
    +
    +        td_div_int_int = td_from_int / 3600
    +        td_div_int_newint = td_from_int / newint(3600)
    +        td_div_newint_int = td_from_newint / 3600
    +        td_div_newint_newint = td_from_newint / newint(3600)
    +        assert td_div_int_int == td_div_int_newint
    +        assert td_div_int_int == td_div_newint_int
    +        assert td_div_int_int == td_div_newint_newint
    +        assert td_div_int_newint == td_div_newint_int
    +        assert td_div_int_newint == td_div_newint_newint
    +        assert td_div_newint_int == td_div_newint_newint
    +
     
     class TestDatetimeHost(BaseTestDatetime):
         def setup_class(cls):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:31:57 2015
    From: noreply at buildbot.pypy.org (cfbolz)
    Date: Mon, 23 Nov 2015 21:31:57 +0100 (CET)
    Subject: [pypy-commit] pypy remove-getfield-pure: merge default
    Message-ID: <20151123203157.2FB2E1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Carl Friedrich Bolz 
    Branch: remove-getfield-pure
    Changeset: r80867:9138c5e2bd04
    Date: 2015-11-23 19:31 +0100
    http://bitbucket.org/pypy/pypy/changeset/9138c5e2bd04/
    
    Log:	merge default
    
    diff too long, truncating to 2000 out of 41224 lines
    
    diff --git a/.gitignore b/.gitignore
    --- a/.gitignore
    +++ b/.gitignore
    @@ -1,9 +1,14 @@
     .hg
     .svn
     
    +# VIM
    +*.swp
    +*.swo
    +
     *.pyc
     *.pyo
     *~
    +__pycache__/
     
     bin/pypy-c
     include/*.h
    @@ -22,4 +27,6 @@
     pypy/translator/goal/pypy-c
     pypy/translator/goal/target*-c
     release/
    +!pypy/tool/release/
     rpython/_cache/
    +__pycache__/
    diff --git a/.hgtags b/.hgtags
    --- a/.hgtags
    +++ b/.hgtags
    @@ -16,3 +16,5 @@
     e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0
     295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
     f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
    +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
    +5f8302b8bf9f53056e40426f10c72151564e5b19 release-4.0.1
    diff --git a/LICENSE b/LICENSE
    --- a/LICENSE
    +++ b/LICENSE
    @@ -56,14 +56,15 @@
       Anders Chrigstrom
       Eric van Riet Paap
       Wim Lavrijsen
    +  Richard Plangger
       Richard Emslie
       Alexander Schremmer
       Dan Villiom Podlaski Christiansen
       Lukas Diekmann
       Sven Hager
       Anders Lehmann
    +  Remi Meier
       Aurelien Campeas
    -  Remi Meier
       Niklaus Haldimann
       Camillo Bruni
       Laura Creighton
    @@ -87,7 +88,6 @@
       Ludovic Aubry
       Jacob Hallen
       Jason Creighton
    -  Richard Plangger
       Alex Martelli
       Michal Bendowski
       stian
    @@ -200,9 +200,12 @@
       Alex Perry
       Vincent Legoll
       Alan McIntyre
    +  Spenser Bauman
       Alexander Sedov
       Attila Gobi
       Christopher Pope
    +  Devin Jeanpierre
    +  Vaibhav Sood
       Christian Tismer 
       Marc Abramowitz
       Dan Stromberg
    @@ -234,6 +237,7 @@
       Lutz Paelike
       Lucio Torre
       Lars Wassermann
    +  Philipp Rustemeuer
       Henrik Vendelbo
       Dan Buch
       Miguel de Val Borro
    @@ -244,6 +248,7 @@
       Martin Blais
       Lene Wagner
       Tomo Cocoa
    +  Kim Jin Su
       Toni Mattis
       Lucas Stadler
       Julian Berman
    @@ -253,6 +258,7 @@
       Anna Katrina Dominguez
       William Leslie
       Bobby Impollonia
    +  Faye Zhao
       timo at eistee.fritz.box
       Andrew Thompson
       Yusei Tahara
    @@ -283,6 +289,7 @@
       shoma hosaka
       Daniel Neuhäuser
       Ben Mather
    +  Niclas Olofsson
       halgari
       Boglarka Vezer
       Chris Pressey
    @@ -309,13 +316,16 @@
       Stefan Marr
       jiaaro
       Mads Kiilerich
    +  Richard Lancaster
       opassembler.py
       Antony Lee
    +  Yaroslav Fedevych
       Jim Hunziker
       Markus Unterwaditzer
       Even Wiik Thomassen
       jbs
       squeaky
    +  Zearin
       soareschen
       Kurt Griffiths
       Mike Bayer
    @@ -327,6 +337,7 @@
       Anna Ravencroft
       Andrey Churin
       Dan Crosta
    +  Tobias Diaz
       Julien Phalip
       Roman Podoliaka
       Dan Loewenherz
    diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py
    --- a/lib_pypy/_tkinter/tklib_build.py
    +++ b/lib_pypy/_tkinter/tklib_build.py
    @@ -212,8 +212,8 @@
     #include 
     #endif 
     
    -char *get_tk_version() { return TK_VERSION; }
    -char *get_tcl_version() { return TCL_VERSION; }
    +char *get_tk_version(void) { return TK_VERSION; }
    +char *get_tcl_version(void) { return TCL_VERSION; }
     """ % globals(),
     include_dirs=incdirs,
     libraries=linklibs,
    diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
    --- a/lib_pypy/cffi.egg-info/PKG-INFO
    +++ b/lib_pypy/cffi.egg-info/PKG-INFO
    @@ -1,6 +1,6 @@
     Metadata-Version: 1.1
     Name: cffi
    -Version: 1.3.0
    +Version: 1.3.1
     Summary: Foreign Function Interface for Python calling C code.
     Home-page: http://cffi.readthedocs.org
     Author: Armin Rigo, Maciej Fijalkowski
    diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
    --- a/lib_pypy/cffi/__init__.py
    +++ b/lib_pypy/cffi/__init__.py
    @@ -4,8 +4,8 @@
     from .api import FFI, CDefError, FFIError
     from .ffiplatform import VerificationError, VerificationMissing
     
    -__version__ = "1.3.0"
    -__version_info__ = (1, 3, 0)
    +__version__ = "1.3.1"
    +__version_info__ = (1, 3, 1)
     
     # The verifier module file names are based on the CRC32 of a string that
     # contains the following version number.  It may be older than __version__
    diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py
    --- a/lib_pypy/cffi/_pycparser/__init__.py
    +++ b/lib_pypy/cffi/_pycparser/__init__.py
    @@ -4,11 +4,11 @@
     # This package file exports some convenience functions for
     # interacting with pycparser
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     __all__ = ['c_lexer', 'c_parser', 'c_ast']
    -__version__ = '2.10'
    +__version__ = '2.14'
     
     from subprocess import Popen, PIPE
     from .c_parser import CParser
    @@ -91,4 +91,3 @@
         if parser is None:
             parser = CParser()
         return parser.parse(text, filename)
    -
    diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py
    --- a/lib_pypy/cffi/_pycparser/_ast_gen.py
    +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py
    @@ -1,13 +1,13 @@
     #-----------------------------------------------------------------
     # _ast_gen.py
     #
    -# Generates the AST Node classes from a specification given in 
    -# a .yaml file
    +# Generates the AST Node classes from a specification given in
    +# a configuration file
     #
     # The design of this module was inspired by astgen.py from the
     # Python 2.5 code-base.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     import pprint
    @@ -20,7 +20,7 @@
                 file.
             """
             self.cfg_filename = cfg_filename
    -        self.node_cfg = [NodeCfg(name, contents) 
    +        self.node_cfg = [NodeCfg(name, contents)
                 for (name, contents) in self.parse_cfgfile(cfg_filename)]
     
         def generate(self, file=None):
    @@ -28,11 +28,11 @@
             """
             src = Template(_PROLOGUE_COMMENT).substitute(
                 cfg_filename=self.cfg_filename)
    -        
    +
             src += _PROLOGUE_CODE
             for node_cfg in self.node_cfg:
                 src += node_cfg.generate_source() + '\n\n'
    -        
    +
             file.write(src)
     
         def parse_cfgfile(self, filename):
    @@ -57,10 +57,10 @@
     
     
     class NodeCfg(object):
    -    """ Node configuration. 
    +    """ Node configuration.
     
             name: node name
    -        contents: a list of contents - attributes and child nodes 
    +        contents: a list of contents - attributes and child nodes
             See comment at the top of the configuration file for details.
         """
         def __init__(self, name, contents):
    @@ -73,7 +73,7 @@
             for entry in contents:
                 clean_entry = entry.rstrip('*')
                 self.all_entries.append(clean_entry)
    -            
    +
                 if entry.endswith('**'):
                     self.seq_child.append(clean_entry)
                 elif entry.endswith('*'):
    @@ -86,26 +86,30 @@
             src += '\n' + self._gen_children()
             src += '\n' + self._gen_attr_names()
             return src
    -    
    +
         def _gen_init(self):
             src = "class %s(Node):\n" % self.name
     
             if self.all_entries:
                 args = ', '.join(self.all_entries)
    +            slots = ', '.join("'{0}'".format(e) for e in self.all_entries)
    +            slots += ", 'coord', '__weakref__'"
                 arglist = '(self, %s, coord=None)' % args
             else:
    +            slots = "'coord', '__weakref__'"
                 arglist = '(self, coord=None)'
    -        
    +
    +        src += "    __slots__ = (%s)\n" % slots
             src += "    def __init__%s:\n" % arglist
    -        
    +
             for name in self.all_entries + ['coord']:
                 src += "        self.%s = %s\n" % (name, name)
    -        
    +
             return src
     
         def _gen_children(self):
             src = '    def children(self):\n'
    -        
    +
             if self.all_entries:
                 src += '        nodelist = []\n'
     
    @@ -114,21 +118,21 @@
                         '        if self.%(child)s is not None:' +
                         ' nodelist.append(("%(child)s", self.%(child)s))\n') % (
                             dict(child=child))
    -                
    +
                 for seq_child in self.seq_child:
                     src += (
                         '        for i, child in enumerate(self.%(child)s or []):\n'
                         '            nodelist.append(("%(child)s[%%d]" %% i, child))\n') % (
                             dict(child=seq_child))
    -                    
    +
                 src += '        return tuple(nodelist)\n'
             else:
                 src += '        return ()\n'
    -            
    -        return src        
    +
    +        return src
     
         def _gen_attr_names(self):
    -        src = "    attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' 
    +        src = "    attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')'
             return src
     
     
    @@ -136,7 +140,7 @@
     r'''#-----------------------------------------------------------------
     # ** ATTENTION **
     # This code was automatically generated from the file:
    -# $cfg_filename 
    +# $cfg_filename
     #
     # Do not modify it directly. Modify the configuration file and
     # run the generator again.
    @@ -146,7 +150,7 @@
     #
     # AST Node classes.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
    @@ -157,6 +161,7 @@
     
     
     class Node(object):
    +    __slots__ = ()
         """ Abstract base class for AST nodes.
         """
         def children(self):
    @@ -167,21 +172,21 @@
         def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
             """ Pretty print the Node and all its attributes and
                 children (recursively) to a buffer.
    -            
    -            buf:   
    +
    +            buf:
                     Open IO buffer into which the Node is printed.
    -            
    -            offset: 
    -                Initial offset (amount of leading spaces) 
    -            
    +
    +            offset:
    +                Initial offset (amount of leading spaces)
    +
                 attrnames:
                     True if you want to see the attribute names in
                     name=value pairs. False to only see the values.
    -                
    +
                 nodenames:
    -                True if you want to see the actual node names 
    +                True if you want to see the actual node names
                     within their parents.
    -            
    +
                 showcoord:
                     Do you want the coordinates of each Node to be
                     displayed.
    @@ -216,47 +221,47 @@
     
     
     class NodeVisitor(object):
    -    """ A base NodeVisitor class for visiting c_ast nodes. 
    +    """ A base NodeVisitor class for visiting c_ast nodes.
             Subclass it and define your own visit_XXX methods, where
    -        XXX is the class name you want to visit with these 
    +        XXX is the class name you want to visit with these
             methods.
    -        
    +
             For example:
    -        
    +
             class ConstantVisitor(NodeVisitor):
                 def __init__(self):
                     self.values = []
    -            
    +
                 def visit_Constant(self, node):
                     self.values.append(node.value)
     
    -        Creates a list of values of all the constant nodes 
    +        Creates a list of values of all the constant nodes
             encountered below the given node. To use it:
    -        
    +
             cv = ConstantVisitor()
             cv.visit(node)
    -        
    +
             Notes:
    -        
    -        *   generic_visit() will be called for AST nodes for which 
    -            no visit_XXX method was defined. 
    -        *   The children of nodes for which a visit_XXX was 
    +
    +        *   generic_visit() will be called for AST nodes for which
    +            no visit_XXX method was defined.
    +        *   The children of nodes for which a visit_XXX was
                 defined will not be visited - if you need this, call
    -            generic_visit() on the node. 
    +            generic_visit() on the node.
                 You can use:
                     NodeVisitor.generic_visit(self, node)
             *   Modeled after Python's own AST visiting facilities
                 (the ast module of Python 3.0)
         """
         def visit(self, node):
    -        """ Visit a node. 
    +        """ Visit a node.
             """
             method = 'visit_' + node.__class__.__name__
             visitor = getattr(self, method, self.generic_visit)
             return visitor(node)
    -        
    +
         def generic_visit(self, node):
    -        """ Called if no explicit visitor function exists for a 
    +        """ Called if no explicit visitor function exists for a
                 node. Implements preorder visiting of the node.
             """
             for c_name, c in node.children():
    diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py
    --- a/lib_pypy/cffi/_pycparser/_build_tables.py
    +++ b/lib_pypy/cffi/_pycparser/_build_tables.py
    @@ -6,12 +6,11 @@
     # Also generates AST code from the configuration file.
     # Should be called from the pycparser directory.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
     # Generate c_ast.py
    -#
     from _ast_gen import ASTCodeGenerator
     ast_gen = ASTCodeGenerator('_c_ast.cfg')
     ast_gen.generate(open('c_ast.py', 'w'))
    diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg
    --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg
    +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg
    @@ -1,188 +1,189 @@
    -#-----------------------------------------------------------------
    -# pycparser: _c_ast_gen.cfg
    -#
    -# Defines the AST Node classes used in pycparser.
    -# 
    -# Each entry is a Node sub-class name, listing the attributes
    -# and child nodes of the class:
    -#   *     - a child node
    -#   **    - a sequence of child nodes
    -#         - an attribute
    -#
    -# Copyright (C) 2008-2012, Eli Bendersky
    -# License: BSD
    -#-----------------------------------------------------------------
    -
    -ArrayDecl: [type*, dim*]
    -
    -ArrayRef: [name*, subscript*]
    -
    -# op: =, +=, /= etc.
    -#
    -Assignment: [op, lvalue*, rvalue*]
    -
    -BinaryOp: [op, left*, right*]
    -
    -Break: []
    -
    -Case: [expr*, stmts**]
    -
    -Cast: [to_type*, expr*]
    -
    -# Compound statement in C99 is a list of block items (declarations or
    -# statements).
    -#
    -Compound: [block_items**]
    -
    -# Compound literal (anonymous aggregate) for C99.
    -# (type-name) {initializer_list}
    -# type: the typename
    -# init: InitList for the initializer list
    -#
    -CompoundLiteral: [type*, init*]
    -
    -# type: int, char, float, etc. see CLexer for constant token types
    -#
    -Constant: [type, value]
    -
    -Continue: []
    -
    -# name: the variable being declared
    -# quals: list of qualifiers (const, volatile)
    -# funcspec: list function specifiers (i.e. inline in C99)
    -# storage: list of storage specifiers (extern, register, etc.)
    -# type: declaration type (probably nested with all the modifiers)
    -# init: initialization value, or None
    -# bitsize: bit field size, or None
    -#
    -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*]
    -
    -DeclList: [decls**]
    -
    -Default: [stmts**]
    -
    -DoWhile: [cond*, stmt*]
    -
    -# Represents the ellipsis (...) parameter in a function 
    -# declaration
    -#
    -EllipsisParam: []
    -
    -# An empty statement (a semicolon ';' on its own)
    -#
    -EmptyStatement: []
    -
    -# Enumeration type specifier
    -# name: an optional ID
    -# values: an EnumeratorList
    -#
    -Enum: [name, values*]
    -
    -# A name/value pair for enumeration values
    -#
    -Enumerator: [name, value*]
    -
    -# A list of enumerators
    -#
    -EnumeratorList: [enumerators**]
    -
    -# A list of expressions separated by the comma operator.
    -#
    -ExprList: [exprs**]
    -
    -# This is the top of the AST, representing a single C file (a 
    -# translation unit in K&R jargon). It contains a list of 
    -# "external-declaration"s, which is either declarations (Decl),
    -# Typedef or function definitions (FuncDef).
    -# 
    -FileAST: [ext**]
    -
    -# for (init; cond; next) stmt
    -#
    -For: [init*, cond*, next*, stmt*]
    -
    -# name: Id
    -# args: ExprList
    -#
    -FuncCall: [name*, args*]
    -
    -# type (args)
    -#
    -FuncDecl: [args*, type*]
    -
    -# Function definition: a declarator for the function name and
    -# a body, which is a compound statement. 
    -# There's an optional list of parameter declarations for old
    -# K&R-style definitions
    -#
    -FuncDef: [decl*, param_decls**, body*]
    -
    -Goto: [name]
    -
    -ID: [name]
    -
    -# Holder for types that are a simple identifier (e.g. the built
    -# ins void, char etc. and typedef-defined types)
    -#
    -IdentifierType: [names]
    -
    -If: [cond*, iftrue*, iffalse*]
    -
    -# An initialization list used for compound literals.
    -#
    -InitList: [exprs**]
    -
    -Label: [name, stmt*]
    -
    -# A named initializer for C99.
    -# The name of a NamedInitializer is a sequence of Nodes, because
    -# names can be hierarchical and contain constant expressions.
    -#
    -NamedInitializer: [name**, expr*]
    -
    -# a list of comma separated function parameter declarations
    -#
    -ParamList: [params**]
    -
    -PtrDecl: [quals, type*]
    -
    -Return: [expr*]
    -
    -# name: struct tag name
    -# decls: declaration of members
    -#
    -Struct: [name, decls**]
    -
    -# type: . or ->
    -# name.field or name->field
    -#
    -StructRef: [name*, type, field*]
    -
    -Switch: [cond*, stmt*]
    -
    -# cond ? iftrue : iffalse
    -#
    -TernaryOp: [cond*, iftrue*, iffalse*]
    -
    -# A base type declaration
    -#
    -TypeDecl: [declname, quals, type*]
    -
    -# A typedef declaration.
    -# Very similar to Decl, but without some attributes
    -#
    -Typedef: [name, quals, storage, type*]
    -
    -Typename: [quals, type*]
    -
    -UnaryOp: [op, expr*]
    -
    -# name: union tag name
    -# decls: declaration of members
    -#
    -Union: [name, decls**]
    -
    -While: [cond*, stmt*]
    -
    -
    -
    +#-----------------------------------------------------------------
    +# pycparser: _c_ast.cfg
    +#
    +# Defines the AST Node classes used in pycparser.
    +#
    +# Each entry is a Node sub-class name, listing the attributes
    +# and child nodes of the class:
    +#   *     - a child node
    +#   **    - a sequence of child nodes
    +#         - an attribute
    +#
    +# Copyright (C) 2008-2015, Eli Bendersky
    +# License: BSD
    +#-----------------------------------------------------------------
    +
    +# ArrayDecl is a nested declaration of an array with the given type.
    +# dim: the dimension (for example, constant 42)
    +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const'
    +#            and 'static' within the array dimension in function declarations.
    +ArrayDecl: [type*, dim*, dim_quals]
    +
    +ArrayRef: [name*, subscript*]
    +
    +# op: =, +=, /= etc.
    +#
    +Assignment: [op, lvalue*, rvalue*]
    +
    +BinaryOp: [op, left*, right*]
    +
    +Break: []
    +
    +Case: [expr*, stmts**]
    +
    +Cast: [to_type*, expr*]
    +
    +# Compound statement in C99 is a list of block items (declarations or
    +# statements).
    +#
    +Compound: [block_items**]
    +
    +# Compound literal (anonymous aggregate) for C99.
    +# (type-name) {initializer_list}
    +# type: the typename
    +# init: InitList for the initializer list
    +#
    +CompoundLiteral: [type*, init*]
    +
    +# type: int, char, float, etc. see CLexer for constant token types
    +#
    +Constant: [type, value]
    +
    +Continue: []
    +
    +# name: the variable being declared
    +# quals: list of qualifiers (const, volatile)
    +# funcspec: list function specifiers (i.e. inline in C99)
    +# storage: list of storage specifiers (extern, register, etc.)
    +# type: declaration type (probably nested with all the modifiers)
    +# init: initialization value, or None
    +# bitsize: bit field size, or None
    +#
    +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*]
    +
    +DeclList: [decls**]
    +
    +Default: [stmts**]
    +
    +DoWhile: [cond*, stmt*]
    +
    +# Represents the ellipsis (...) parameter in a function
    +# declaration
    +#
    +EllipsisParam: []
    +
    +# An empty statement (a semicolon ';' on its own)
    +#
    +EmptyStatement: []
    +
    +# Enumeration type specifier
    +# name: an optional ID
    +# values: an EnumeratorList
    +#
    +Enum: [name, values*]
    +
    +# A name/value pair for enumeration values
    +#
    +Enumerator: [name, value*]
    +
    +# A list of enumerators
    +#
    +EnumeratorList: [enumerators**]
    +
    +# A list of expressions separated by the comma operator.
    +#
    +ExprList: [exprs**]
    +
    +# This is the top of the AST, representing a single C file (a
    +# translation unit in K&R jargon). It contains a list of
    +# "external-declaration"s, which is either declarations (Decl),
    +# Typedef or function definitions (FuncDef).
    +#
    +FileAST: [ext**]
    +
    +# for (init; cond; next) stmt
    +#
    +For: [init*, cond*, next*, stmt*]
    +
    +# name: Id
    +# args: ExprList
    +#
    +FuncCall: [name*, args*]
    +
    +# type (args)
    +#
    +FuncDecl: [args*, type*]
    +
    +# Function definition: a declarator for the function name and
    +# a body, which is a compound statement.
    +# There's an optional list of parameter declarations for old
    +# K&R-style definitions
    +#
    +FuncDef: [decl*, param_decls**, body*]
    +
    +Goto: [name]
    +
    +ID: [name]
    +
    +# Holder for types that are a simple identifier (e.g. the built
    +# ins void, char etc. and typedef-defined types)
    +#
    +IdentifierType: [names]
    +
    +If: [cond*, iftrue*, iffalse*]
    +
    +# An initialization list used for compound literals.
    +#
    +InitList: [exprs**]
    +
    +Label: [name, stmt*]
    +
    +# A named initializer for C99.
    +# The name of a NamedInitializer is a sequence of Nodes, because
    +# names can be hierarchical and contain constant expressions.
    +#
    +NamedInitializer: [name**, expr*]
    +
    +# a list of comma separated function parameter declarations
    +#
    +ParamList: [params**]
    +
    +PtrDecl: [quals, type*]
    +
    +Return: [expr*]
    +
    +# name: struct tag name
    +# decls: declaration of members
    +#
    +Struct: [name, decls**]
    +
    +# type: . or ->
    +# name.field or name->field
    +#
    +StructRef: [name*, type, field*]
    +
    +Switch: [cond*, stmt*]
    +
    +# cond ? iftrue : iffalse
    +#
    +TernaryOp: [cond*, iftrue*, iffalse*]
    +
    +# A base type declaration
    +#
    +TypeDecl: [declname, quals, type*]
    +
    +# A typedef declaration.
    +# Very similar to Decl, but without some attributes
    +#
    +Typedef: [name, quals, storage, type*]
    +
    +Typename: [name, quals, type*]
    +
    +UnaryOp: [op, expr*]
    +
    +# name: union tag name
    +# decls: declaration of members
    +#
    +Union: [name, decls**]
    +
    +While: [cond*, stmt*]
    diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py
    --- a/lib_pypy/cffi/_pycparser/ast_transforms.py
    +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py
    @@ -3,7 +3,7 @@
     #
     # Some utilities used by the parser to create a friendlier AST.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     
    @@ -84,7 +84,7 @@
                 _extract_nested_case(child, new_compound.block_items)
                 last_case = new_compound.block_items[-1]
             else:
    -            # Other statements are added as childrent to the last case, if it
    +            # Other statements are added as children to the last case, if it
                 # exists.
                 if last_case is None:
                     new_compound.block_items.append(child)
    diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py
    --- a/lib_pypy/cffi/_pycparser/c_ast.py
    +++ b/lib_pypy/cffi/_pycparser/c_ast.py
    @@ -1,7 +1,7 @@
     #-----------------------------------------------------------------
     # ** ATTENTION **
     # This code was automatically generated from the file:
    -# _c_ast.cfg 
    +# _c_ast.cfg
     #
     # Do not modify it directly. Modify the configuration file and
     # run the generator again.
    @@ -11,7 +11,7 @@
     #
     # AST Node classes.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
    @@ -20,6 +20,7 @@
     
     
     class Node(object):
    +    __slots__ = ()
         """ Abstract base class for AST nodes.
         """
         def children(self):
    @@ -30,21 +31,21 @@
         def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
             """ Pretty print the Node and all its attributes and
                 children (recursively) to a buffer.
    -            
    -            buf:   
    +
    +            buf:
                     Open IO buffer into which the Node is printed.
    -            
    -            offset: 
    -                Initial offset (amount of leading spaces) 
    -            
    +
    +            offset:
    +                Initial offset (amount of leading spaces)
    +
                 attrnames:
                     True if you want to see the attribute names in
                     name=value pairs. False to only see the values.
    -                
    +
                 nodenames:
    -                True if you want to see the actual node names 
    +                True if you want to see the actual node names
                     within their parents.
    -            
    +
                 showcoord:
                     Do you want the coordinates of each Node to be
                     displayed.
    @@ -79,47 +80,47 @@
     
     
     class NodeVisitor(object):
    -    """ A base NodeVisitor class for visiting c_ast nodes. 
    +    """ A base NodeVisitor class for visiting c_ast nodes.
             Subclass it and define your own visit_XXX methods, where
    -        XXX is the class name you want to visit with these 
    +        XXX is the class name you want to visit with these
             methods.
    -        
    +
             For example:
    -        
    +
             class ConstantVisitor(NodeVisitor):
                 def __init__(self):
                     self.values = []
    -            
    +
                 def visit_Constant(self, node):
                     self.values.append(node.value)
     
    -        Creates a list of values of all the constant nodes 
    +        Creates a list of values of all the constant nodes
             encountered below the given node. To use it:
    -        
    +
             cv = ConstantVisitor()
             cv.visit(node)
    -        
    +
             Notes:
    -        
    -        *   generic_visit() will be called for AST nodes for which 
    -            no visit_XXX method was defined. 
    -        *   The children of nodes for which a visit_XXX was 
    +
    +        *   generic_visit() will be called for AST nodes for which
    +            no visit_XXX method was defined.
    +        *   The children of nodes for which a visit_XXX was
                 defined will not be visited - if you need this, call
    -            generic_visit() on the node. 
    +            generic_visit() on the node.
                 You can use:
                     NodeVisitor.generic_visit(self, node)
             *   Modeled after Python's own AST visiting facilities
                 (the ast module of Python 3.0)
         """
         def visit(self, node):
    -        """ Visit a node. 
    +        """ Visit a node.
             """
             method = 'visit_' + node.__class__.__name__
             visitor = getattr(self, method, self.generic_visit)
             return visitor(node)
    -        
    +
         def generic_visit(self, node):
    -        """ Called if no explicit visitor function exists for a 
    +        """ Called if no explicit visitor function exists for a
                 node. Implements preorder visiting of the node.
             """
             for c_name, c in node.children():
    @@ -127,9 +128,11 @@
     
     
     class ArrayDecl(Node):
    -    def __init__(self, type, dim, coord=None):
    +    __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__')
    +    def __init__(self, type, dim, dim_quals, coord=None):
             self.type = type
             self.dim = dim
    +        self.dim_quals = dim_quals
             self.coord = coord
     
         def children(self):
    @@ -138,9 +141,10 @@
             if self.dim is not None: nodelist.append(("dim", self.dim))
             return tuple(nodelist)
     
    -    attr_names = ()
    +    attr_names = ('dim_quals', )
     
     class ArrayRef(Node):
    +    __slots__ = ('name', 'subscript', 'coord', '__weakref__')
         def __init__(self, name, subscript, coord=None):
             self.name = name
             self.subscript = subscript
    @@ -155,6 +159,7 @@
         attr_names = ()
     
     class Assignment(Node):
    +    __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__')
         def __init__(self, op, lvalue, rvalue, coord=None):
             self.op = op
             self.lvalue = lvalue
    @@ -167,9 +172,10 @@
             if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue))
             return tuple(nodelist)
     
    -    attr_names = ('op',)
    +    attr_names = ('op', )
     
     class BinaryOp(Node):
    +    __slots__ = ('op', 'left', 'right', 'coord', '__weakref__')
         def __init__(self, op, left, right, coord=None):
             self.op = op
             self.left = left
    @@ -182,9 +188,10 @@
             if self.right is not None: nodelist.append(("right", self.right))
             return tuple(nodelist)
     
    -    attr_names = ('op',)
    +    attr_names = ('op', )
     
     class Break(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -194,6 +201,7 @@
         attr_names = ()
     
     class Case(Node):
    +    __slots__ = ('expr', 'stmts', 'coord', '__weakref__')
         def __init__(self, expr, stmts, coord=None):
             self.expr = expr
             self.stmts = stmts
    @@ -209,6 +217,7 @@
         attr_names = ()
     
     class Cast(Node):
    +    __slots__ = ('to_type', 'expr', 'coord', '__weakref__')
         def __init__(self, to_type, expr, coord=None):
             self.to_type = to_type
             self.expr = expr
    @@ -223,6 +232,7 @@
         attr_names = ()
     
     class Compound(Node):
    +    __slots__ = ('block_items', 'coord', '__weakref__')
         def __init__(self, block_items, coord=None):
             self.block_items = block_items
             self.coord = coord
    @@ -236,6 +246,7 @@
         attr_names = ()
     
     class CompoundLiteral(Node):
    +    __slots__ = ('type', 'init', 'coord', '__weakref__')
         def __init__(self, type, init, coord=None):
             self.type = type
             self.init = init
    @@ -250,6 +261,7 @@
         attr_names = ()
     
     class Constant(Node):
    +    __slots__ = ('type', 'value', 'coord', '__weakref__')
         def __init__(self, type, value, coord=None):
             self.type = type
             self.value = value
    @@ -259,9 +271,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('type','value',)
    +    attr_names = ('type', 'value', )
     
     class Continue(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -271,6 +284,7 @@
         attr_names = ()
     
     class Decl(Node):
    +    __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__')
         def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None):
             self.name = name
             self.quals = quals
    @@ -288,9 +302,10 @@
             if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize))
             return tuple(nodelist)
     
    -    attr_names = ('name','quals','storage','funcspec',)
    +    attr_names = ('name', 'quals', 'storage', 'funcspec', )
     
     class DeclList(Node):
    +    __slots__ = ('decls', 'coord', '__weakref__')
         def __init__(self, decls, coord=None):
             self.decls = decls
             self.coord = coord
    @@ -304,6 +319,7 @@
         attr_names = ()
     
     class Default(Node):
    +    __slots__ = ('stmts', 'coord', '__weakref__')
         def __init__(self, stmts, coord=None):
             self.stmts = stmts
             self.coord = coord
    @@ -317,6 +333,7 @@
         attr_names = ()
     
     class DoWhile(Node):
    +    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
         def __init__(self, cond, stmt, coord=None):
             self.cond = cond
             self.stmt = stmt
    @@ -331,6 +348,7 @@
         attr_names = ()
     
     class EllipsisParam(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -340,6 +358,7 @@
         attr_names = ()
     
     class EmptyStatement(Node):
    +    __slots__ = ('coord', '__weakref__')
         def __init__(self, coord=None):
             self.coord = coord
     
    @@ -349,6 +368,7 @@
         attr_names = ()
     
     class Enum(Node):
    +    __slots__ = ('name', 'values', 'coord', '__weakref__')
         def __init__(self, name, values, coord=None):
             self.name = name
             self.values = values
    @@ -359,9 +379,10 @@
             if self.values is not None: nodelist.append(("values", self.values))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class Enumerator(Node):
    +    __slots__ = ('name', 'value', 'coord', '__weakref__')
         def __init__(self, name, value, coord=None):
             self.name = name
             self.value = value
    @@ -372,9 +393,10 @@
             if self.value is not None: nodelist.append(("value", self.value))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class EnumeratorList(Node):
    +    __slots__ = ('enumerators', 'coord', '__weakref__')
         def __init__(self, enumerators, coord=None):
             self.enumerators = enumerators
             self.coord = coord
    @@ -388,6 +410,7 @@
         attr_names = ()
     
     class ExprList(Node):
    +    __slots__ = ('exprs', 'coord', '__weakref__')
         def __init__(self, exprs, coord=None):
             self.exprs = exprs
             self.coord = coord
    @@ -401,6 +424,7 @@
         attr_names = ()
     
     class FileAST(Node):
    +    __slots__ = ('ext', 'coord', '__weakref__')
         def __init__(self, ext, coord=None):
             self.ext = ext
             self.coord = coord
    @@ -414,6 +438,7 @@
         attr_names = ()
     
     class For(Node):
    +    __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__')
         def __init__(self, init, cond, next, stmt, coord=None):
             self.init = init
             self.cond = cond
    @@ -432,6 +457,7 @@
         attr_names = ()
     
     class FuncCall(Node):
    +    __slots__ = ('name', 'args', 'coord', '__weakref__')
         def __init__(self, name, args, coord=None):
             self.name = name
             self.args = args
    @@ -446,6 +472,7 @@
         attr_names = ()
     
     class FuncDecl(Node):
    +    __slots__ = ('args', 'type', 'coord', '__weakref__')
         def __init__(self, args, type, coord=None):
             self.args = args
             self.type = type
    @@ -460,6 +487,7 @@
         attr_names = ()
     
     class FuncDef(Node):
    +    __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__')
         def __init__(self, decl, param_decls, body, coord=None):
             self.decl = decl
             self.param_decls = param_decls
    @@ -477,6 +505,7 @@
         attr_names = ()
     
     class Goto(Node):
    +    __slots__ = ('name', 'coord', '__weakref__')
         def __init__(self, name, coord=None):
             self.name = name
             self.coord = coord
    @@ -485,9 +514,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class ID(Node):
    +    __slots__ = ('name', 'coord', '__weakref__')
         def __init__(self, name, coord=None):
             self.name = name
             self.coord = coord
    @@ -496,9 +526,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class IdentifierType(Node):
    +    __slots__ = ('names', 'coord', '__weakref__')
         def __init__(self, names, coord=None):
             self.names = names
             self.coord = coord
    @@ -507,9 +538,10 @@
             nodelist = []
             return tuple(nodelist)
     
    -    attr_names = ('names',)
    +    attr_names = ('names', )
     
     class If(Node):
    +    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
         def __init__(self, cond, iftrue, iffalse, coord=None):
             self.cond = cond
             self.iftrue = iftrue
    @@ -526,6 +558,7 @@
         attr_names = ()
     
     class InitList(Node):
    +    __slots__ = ('exprs', 'coord', '__weakref__')
         def __init__(self, exprs, coord=None):
             self.exprs = exprs
             self.coord = coord
    @@ -539,6 +572,7 @@
         attr_names = ()
     
     class Label(Node):
    +    __slots__ = ('name', 'stmt', 'coord', '__weakref__')
         def __init__(self, name, stmt, coord=None):
             self.name = name
             self.stmt = stmt
    @@ -549,9 +583,10 @@
             if self.stmt is not None: nodelist.append(("stmt", self.stmt))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class NamedInitializer(Node):
    +    __slots__ = ('name', 'expr', 'coord', '__weakref__')
         def __init__(self, name, expr, coord=None):
             self.name = name
             self.expr = expr
    @@ -567,6 +602,7 @@
         attr_names = ()
     
     class ParamList(Node):
    +    __slots__ = ('params', 'coord', '__weakref__')
         def __init__(self, params, coord=None):
             self.params = params
             self.coord = coord
    @@ -580,6 +616,7 @@
         attr_names = ()
     
     class PtrDecl(Node):
    +    __slots__ = ('quals', 'type', 'coord', '__weakref__')
         def __init__(self, quals, type, coord=None):
             self.quals = quals
             self.type = type
    @@ -590,9 +627,10 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('quals',)
    +    attr_names = ('quals', )
     
     class Return(Node):
    +    __slots__ = ('expr', 'coord', '__weakref__')
         def __init__(self, expr, coord=None):
             self.expr = expr
             self.coord = coord
    @@ -605,6 +643,7 @@
         attr_names = ()
     
     class Struct(Node):
    +    __slots__ = ('name', 'decls', 'coord', '__weakref__')
         def __init__(self, name, decls, coord=None):
             self.name = name
             self.decls = decls
    @@ -616,9 +655,10 @@
                 nodelist.append(("decls[%d]" % i, child))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class StructRef(Node):
    +    __slots__ = ('name', 'type', 'field', 'coord', '__weakref__')
         def __init__(self, name, type, field, coord=None):
             self.name = name
             self.type = type
    @@ -631,9 +671,10 @@
             if self.field is not None: nodelist.append(("field", self.field))
             return tuple(nodelist)
     
    -    attr_names = ('type',)
    +    attr_names = ('type', )
     
     class Switch(Node):
    +    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
         def __init__(self, cond, stmt, coord=None):
             self.cond = cond
             self.stmt = stmt
    @@ -648,6 +689,7 @@
         attr_names = ()
     
     class TernaryOp(Node):
    +    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
         def __init__(self, cond, iftrue, iffalse, coord=None):
             self.cond = cond
             self.iftrue = iftrue
    @@ -664,6 +706,7 @@
         attr_names = ()
     
     class TypeDecl(Node):
    +    __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__')
         def __init__(self, declname, quals, type, coord=None):
             self.declname = declname
             self.quals = quals
    @@ -675,9 +718,10 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('declname','quals',)
    +    attr_names = ('declname', 'quals', )
     
     class Typedef(Node):
    +    __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__')
         def __init__(self, name, quals, storage, type, coord=None):
             self.name = name
             self.quals = quals
    @@ -690,10 +734,12 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('name','quals','storage',)
    +    attr_names = ('name', 'quals', 'storage', )
     
     class Typename(Node):
    -    def __init__(self, quals, type, coord=None):
    +    __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__')
    +    def __init__(self, name, quals, type, coord=None):
    +        self.name = name
             self.quals = quals
             self.type = type
             self.coord = coord
    @@ -703,9 +749,10 @@
             if self.type is not None: nodelist.append(("type", self.type))
             return tuple(nodelist)
     
    -    attr_names = ('quals',)
    +    attr_names = ('name', 'quals', )
     
     class UnaryOp(Node):
    +    __slots__ = ('op', 'expr', 'coord', '__weakref__')
         def __init__(self, op, expr, coord=None):
             self.op = op
             self.expr = expr
    @@ -716,9 +763,10 @@
             if self.expr is not None: nodelist.append(("expr", self.expr))
             return tuple(nodelist)
     
    -    attr_names = ('op',)
    +    attr_names = ('op', )
     
     class Union(Node):
    +    __slots__ = ('name', 'decls', 'coord', '__weakref__')
         def __init__(self, name, decls, coord=None):
             self.name = name
             self.decls = decls
    @@ -730,9 +778,10 @@
                 nodelist.append(("decls[%d]" % i, child))
             return tuple(nodelist)
     
    -    attr_names = ('name',)
    +    attr_names = ('name', )
     
     class While(Node):
    +    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
         def __init__(self, cond, stmt, coord=None):
             self.cond = cond
             self.stmt = stmt
    diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py
    --- a/lib_pypy/cffi/_pycparser/c_generator.py
    +++ b/lib_pypy/cffi/_pycparser/c_generator.py
    @@ -3,7 +3,7 @@
     #
     # C code generator from pycparser AST nodes.
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     from . import c_ast
    @@ -15,8 +15,6 @@
             generic_visit.
         """
         def __init__(self):
    -        self.output = ''
    -
             # Statements start with indentation of self.indent_level spaces, using
             # the _make_indent method
             #
    @@ -34,7 +32,7 @@
             if node is None:
                 return ''
             else:
    -            return ''.join(self.visit(c) for c in node.children())
    +            return ''.join(self.visit(c) for c_name, c in node.children())
     
         def visit_Constant(self, n):
             return n.value
    @@ -83,19 +81,22 @@
         def visit_IdentifierType(self, n):
             return ' '.join(n.names)
     
    +    def _visit_expr(self, n):
    +        if isinstance(n, c_ast.InitList):
    +            return '{' + self.visit(n) + '}'
    +        elif isinstance(n, c_ast.ExprList):
    +            return '(' + self.visit(n) + ')'
    +        else:
    +            return self.visit(n)
    +
         def visit_Decl(self, n, no_type=False):
             # no_type is used when a Decl is part of a DeclList, where the type is
    -        # explicitly only for the first delaration in a list.
    +        # explicitly only for the first declaration in a list.
             #
             s = n.name if no_type else self._generate_decl(n)
             if n.bitsize: s += ' : ' + self.visit(n.bitsize)
             if n.init:
    -            if isinstance(n.init, c_ast.InitList):
    -                s += ' = {' + self.visit(n.init) + '}'
    -            elif isinstance(n.init, c_ast.ExprList):
    -                s += ' = (' + self.visit(n.init) + ')'
    -            else:
    -                s += ' = ' + self.visit(n.init)
    +            s += ' = ' + self._visit_expr(n.init)
             return s
     
         def visit_DeclList(self, n):
    @@ -118,21 +119,13 @@
         def visit_ExprList(self, n):
             visited_subexprs = []
             for expr in n.exprs:
    -            if isinstance(expr, c_ast.ExprList):
    -                visited_subexprs.append('{' + self.visit(expr) + '}')
    -            else:
    -                visited_subexprs.append(self.visit(expr))
    +            visited_subexprs.append(self._visit_expr(expr))
             return ', '.join(visited_subexprs)
     
         def visit_InitList(self, n):
             visited_subexprs = []
             for expr in n.exprs:
    -            if isinstance(expr, c_ast.ExprList):
    -                visited_subexprs.append('(' + self.visit(expr) + ')')
    -            elif isinstance(expr, c_ast.InitList):
    -                visited_subexprs.append('{' + self.visit(expr) + '}')
    -            else:
    -                visited_subexprs.append(self.visit(expr))
    +            visited_subexprs.append(self._visit_expr(expr))
             return ', '.join(visited_subexprs)
     
         def visit_Enum(self, n):
    @@ -195,9 +188,9 @@
             return 'continue;'
     
         def visit_TernaryOp(self, n):
    -        s = self.visit(n.cond) + ' ? '
    -        s += self.visit(n.iftrue) + ' : '
    -        s += self.visit(n.iffalse)
    +        s = self._visit_expr(n.cond) + ' ? '
    +        s += self._visit_expr(n.iftrue) + ' : '
    +        s += self._visit_expr(n.iffalse)
             return s
     
         def visit_If(self, n):
    @@ -281,6 +274,9 @@
             s += ' = ' + self.visit(n.expr)
             return s
     
    +    def visit_FuncDecl(self, n):
    +        return self._generate_type(n)
    +
         def _generate_struct_union(self, n, name):
             """ Generates code for structs and unions. name should be either
                 'struct' or union.
    @@ -384,7 +380,7 @@
             """ Visits 'n' and returns its string representation, parenthesized
                 if the condition function applied to the node returns True.
             """
    -        s = self.visit(n)
    +        s = self._visit_expr(n)
             if condition(n):
                 return '(' + s + ')'
             else:
    @@ -401,5 +397,3 @@
             """
             return isinstance(n,(   c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
                                     c_ast.StructRef, c_ast.FuncCall))
    -
    -
    diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py
    --- a/lib_pypy/cffi/_pycparser/c_lexer.py
    +++ b/lib_pypy/cffi/_pycparser/c_lexer.py
    @@ -3,7 +3,7 @@
     #
     # CLexer class: lexer for the C language
     #
    -# Copyright (C) 2008-2013, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     import re
    @@ -102,7 +102,8 @@
         keywords = (
             '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST',
             'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN',
    -        'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER',
    +        'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 
    +        'REGISTER', 'OFFSETOF',
             'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT',
             'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID',
             'VOLATILE', 'WHILE',
    @@ -129,7 +130,7 @@
             'TYPEID',
     
             # constants
    -        'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX',
    +        'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN',
             'FLOAT_CONST', 'HEX_FLOAT_CONST',
             'CHAR_CONST',
             'WCHAR_CONST',
    @@ -183,12 +184,15 @@
     
         hex_prefix = '0[xX]'
         hex_digits = '[0-9a-fA-F]+'
    +    bin_prefix = '0[bB]'
    +    bin_digits = '[01]+'
     
         # integer constants (K&R2: A.2.5.1)
         integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?'
         decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')'
         octal_constant = '0[0-7]*'+integer_suffix_opt
         hex_constant = hex_prefix+hex_digits+integer_suffix_opt
    +    bin_constant = bin_prefix+bin_digits+integer_suffix_opt
     
         bad_octal_constant = '0[0-7]*[89]'
     
    @@ -302,7 +306,7 @@
             r'pragma'
             pass
     
    -    t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789'
    +    t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789'
     
         @TOKEN(string_literal)
         def t_pppragma_STR(self, t): pass
    @@ -419,6 +423,10 @@
         def t_INT_CONST_HEX(self, t):
             return t
     
    +    @TOKEN(bin_constant)
    +    def t_INT_CONST_BIN(self, t):
    +        return t
    +
         @TOKEN(bad_octal_constant)
         def t_BAD_CONST_OCT(self, t):
             msg = "Invalid octal constant"
    diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py
    --- a/lib_pypy/cffi/_pycparser/c_parser.py
    +++ b/lib_pypy/cffi/_pycparser/c_parser.py
    @@ -3,7 +3,7 @@
     #
     # CParser class: Parser and AST builder for the C language
     #
    -# Copyright (C) 2008-2013, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #------------------------------------------------------------------------------
     import re
    @@ -23,7 +23,8 @@
                 lextab='cffi._pycparser.lextab',
                 yacc_optimize=True,
                 yacctab='cffi._pycparser.yacctab',
    -            yacc_debug=False):
    +            yacc_debug=False,
    +            taboutputdir=''):
             """ Create a new CParser.
     
                 Some arguments for controlling the debug/optimization
    @@ -64,6 +65,10 @@
                 yacc_debug:
                     Generate a parser.out file that explains how yacc
                     built the parsing table from the grammar.
    +
    +            taboutputdir:
    +                Set this parameter to control the location of generated
    +                lextab and yacctab files.
             """
             self.clex = CLexer(
                 error_func=self._lex_error_func,
    @@ -73,7 +78,8 @@
     
             self.clex.build(
                 optimize=lex_optimize,
    -            lextab=lextab)
    +            lextab=lextab,
    +            outputdir=taboutputdir)
             self.tokens = self.clex.tokens
     
             rules_with_opt = [
    @@ -85,6 +91,7 @@
                 'expression',
                 'identifier_list',
                 'init_declarator_list',
    +            'initializer_list',
                 'parameter_type_list',
                 'specifier_qualifier_list',
                 'block_item_list',
    @@ -100,7 +107,8 @@
                 start='translation_unit_or_empty',
                 debug=yacc_debug,
                 optimize=yacc_optimize,
    -            tabmodule=yacctab)
    +            tabmodule=yacctab,
    +            outputdir=taboutputdir)
     
             # Stack of scopes for keeping track of symbols. _scope_stack[-1] is
             # the current (topmost) scope. Each scope is a dictionary that
    @@ -211,13 +219,11 @@
         # The basic declaration here is 'int c', and the pointer and
         # the array are the modifiers.
         #
    -    # Basic declarations are represented by TypeDecl (from module
    -    # c_ast) and the modifiers are FuncDecl, PtrDecl and
    -    # ArrayDecl.
    +    # Basic declarations are represented by TypeDecl (from module c_ast) and the
    +    # modifiers are FuncDecl, PtrDecl and ArrayDecl.
         #
    -    # The standard states that whenever a new modifier is parsed,
    -    # it should be added to the end of the list of modifiers. For
    -    # example:
    +    # The standard states that whenever a new modifier is parsed, it should be
    +    # added to the end of the list of modifiers. For example:
         #
         # K&R2 A.8.6.2: Array Declarators
         #
    @@ -236,7 +242,6 @@
         # useful for pointers, that can come as a chain from the rule
         # p_pointer. In this case, the whole modifier list is spliced
         # into the new location.
    -    #
         def _type_modify_decl(self, decl, modifier):
             """ Tacks a type modifier on a declarator, and returns
                 the modified declarator.
    @@ -983,28 +988,52 @@
             p[0] = p[2]
     
         def p_direct_declarator_3(self, p):
    -        """ direct_declarator   : direct_declarator LBRACKET assignment_expression_opt RBRACKET
    +        """ direct_declarator   : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET
             """
    +        quals = (p[3] if len(p) > 5 else []) or []
    +        # Accept dimension qualifiers
    +        # Per C99 6.7.5.3 p7
             arr = c_ast.ArrayDecl(
                 type=None,
    -            dim=p[3],
    +            dim=p[4] if len(p) > 5 else p[3],
    +            dim_quals=quals,
    +            coord=p[1].coord)
    +
    +        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
    +
    +    def p_direct_declarator_4(self, p):
    +        """ direct_declarator   : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET
    +                                | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET
    +        """
    +        # Using slice notation for PLY objects doesn't work in Python 3 for the
    +        # version of PLY embedded with pycparser; see PLY Google Code issue 30.
    +        # Work around that here by listing the two elements separately.
    +        listed_quals = [item if isinstance(item, list) else [item]
    +            for item in [p[3],p[4]]]
    +        dim_quals = [qual for sublist in listed_quals for qual in sublist
    +            if qual is not None]
    +        arr = c_ast.ArrayDecl(
    +            type=None,
    +            dim=p[5],
    +            dim_quals=dim_quals,
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
     
         # Special for VLAs
         #
    -    def p_direct_declarator_4(self, p):
    -        """ direct_declarator   : direct_declarator LBRACKET TIMES RBRACKET
    +    def p_direct_declarator_5(self, p):
    +        """ direct_declarator   : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET
             """
             arr = c_ast.ArrayDecl(
                 type=None,
    -            dim=c_ast.ID(p[3], self._coord(p.lineno(3))),
    +            dim=c_ast.ID(p[4], self._coord(p.lineno(4))),
    +            dim_quals=p[3] if p[3] != None else [],
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
     
    -    def p_direct_declarator_5(self, p):
    +    def p_direct_declarator_6(self, p):
             """ direct_declarator   : direct_declarator LPAREN parameter_type_list RPAREN
                                     | direct_declarator LPAREN identifier_list_opt RPAREN
             """
    @@ -1037,11 +1066,30 @@
                         | TIMES type_qualifier_list_opt pointer
             """
             coord = self._coord(p.lineno(1))
    -
    -        p[0] = c_ast.PtrDecl(
    -            quals=p[2] or [],
    -            type=p[3] if len(p) > 3 else None,
    -            coord=coord)
    +        # Pointer decls nest from inside out. This is important when different
    +        # levels have different qualifiers. For example:
    +        #
    +        #  char * const * p;
    +        #
    +        # Means "pointer to const pointer to char"
    +        #
    +        # While: 
    +        #
    +        #  char ** const p;
    +        #
    +        # Means "const pointer to pointer to char"
    +        #
    +        # So when we construct PtrDecl nestings, the leftmost pointer goes in
    +        # as the most nested type.
    +        nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord)
    +        if len(p) > 3:
    +            tail_type = p[3]
    +            while tail_type.type is not None:
    +                tail_type = tail_type.type
    +            tail_type.type = nested_type
    +            p[0] = p[3]
    +        else:
    +            p[0] = nested_type
     
         def p_type_qualifier_list(self, p):
             """ type_qualifier_list : type_qualifier
    @@ -1101,6 +1149,7 @@
             #
             else:
                 decl = c_ast.Typename(
    +                name='',
                     quals=spec['qual'],
                     type=p[2] or c_ast.TypeDecl(None, None, None),
                     coord=self._coord(p.lineno(2)))
    @@ -1125,10 +1174,13 @@
             p[0] = p[1]
     
         def p_initializer_2(self, p):
    -        """ initializer : brace_open initializer_list brace_close
    +        """ initializer : brace_open initializer_list_opt brace_close
                             | brace_open initializer_list COMMA brace_close
             """
    -        p[0] = p[2]
    +        if p[2] is None:
    +            p[0] = c_ast.InitList([], self._coord(p.lineno(1)))
    +        else:
    +            p[0] = p[2]
     
         def p_initializer_list(self, p):
             """ initializer_list    : designation_opt initializer
    @@ -1172,6 +1224,7 @@
             #~ print '=========='
     
             typename = c_ast.Typename(
    +            name='',
                 quals=p[1]['qual'],
                 type=p[2] or c_ast.TypeDecl(None, None, None),
                 coord=self._coord(p.lineno(2)))
    @@ -1211,6 +1264,7 @@
             arr = c_ast.ArrayDecl(
                 type=None,
                 dim=p[3],
    +            dim_quals=[],
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
    @@ -1221,6 +1275,7 @@
             p[0] = c_ast.ArrayDecl(
                 type=c_ast.TypeDecl(None, None, None),
                 dim=p[2],
    +            dim_quals=[],
                 coord=self._coord(p.lineno(1)))
     
         def p_direct_abstract_declarator_4(self, p):
    @@ -1229,6 +1284,7 @@
             arr = c_ast.ArrayDecl(
                 type=None,
                 dim=c_ast.ID(p[3], self._coord(p.lineno(3))),
    +            dim_quals=[],
                 coord=p[1].coord)
     
             p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
    @@ -1239,6 +1295,7 @@
             p[0] = c_ast.ArrayDecl(
                 type=c_ast.TypeDecl(None, None, None),
                 dim=c_ast.ID(p[3], self._coord(p.lineno(3))),
    +            dim_quals=[],
                 coord=self._coord(p.lineno(1)))
     
         def p_direct_abstract_declarator_6(self, p):
    @@ -1322,7 +1379,8 @@
     
         def p_iteration_statement_4(self, p):
             """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """
    -        p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1)))
    +        p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))),
    +                         p[4], p[6], p[8], self._coord(p.lineno(1)))
     
         def p_jump_statement_1(self, p):
             """ jump_statement  : GOTO ID SEMI """
    @@ -1525,6 +1583,14 @@
             """ primary_expression  : LPAREN expression RPAREN """
             p[0] = p[2]
     
    +    def p_primary_expression_5(self, p):
    +        """ primary_expression  : OFFSETOF LPAREN type_name COMMA identifier RPAREN
    +        """
    +        coord = self._coord(p.lineno(1))
    +        p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord),
    +                              c_ast.ExprList([p[3], p[5]], coord),
    +                              coord)
    +
         def p_argument_expression_list(self, p):
             """ argument_expression_list    : assignment_expression
                                             | argument_expression_list COMMA assignment_expression
    @@ -1543,6 +1609,7 @@
             """ constant    : INT_CONST_DEC
                             | INT_CONST_OCT
                             | INT_CONST_HEX
    +                        | INT_CONST_BIN
             """
             p[0] = c_ast.Constant(
                 'int', p[1], self._coord(p.lineno(1)))
    @@ -1585,7 +1652,7 @@
                 p[0] = c_ast.Constant(
                     'string', p[1], self._coord(p.lineno(1)))
             else:
    -            p[1].value = p[1].value.rstrip[:-1] + p[2][1:]
    +            p[1].value = p[1].value.rstrip()[:-1] + p[2][2:]
                 p[0] = p[1]
     
         def p_brace_open(self, p):
    diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py
    --- a/lib_pypy/cffi/_pycparser/lextab.py
    +++ b/lib_pypy/cffi/_pycparser/lextab.py
    @@ -1,9 +1,9 @@
     # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit!
     _tabversion   = '3.4'
    -_lextokens    = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1}
    +_lextokens    = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1}
     _lexreflags   = 0
     _lexliterals  = ''
     _lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'}
    -_lexstatere   = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL')]), ('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)|(?P\\])', [None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET')]), ('(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P&=)|(?P-=)|(?P\\.)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'ANDEQUAL'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]}
    -_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'}
    +_lexstatere   = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, None, None, None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR'), None, None, None, None, None, None, ('t_pppragma_ID', 'ID')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX')]), ('(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))\')|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])[^\'\\n]*\'))', [None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST')]), ('(?PL"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-7])([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\(([a-zA-Z._~!=&\\^\\-\\\\?\'"])|(\\d+)|(x[0-9a-fA-F]+))))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)|(?P\\+)|(?P%=)|(?P/=)', [None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, None, None, None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, None, None, None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL'), (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL')]), ('(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]}
    +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789', 'INITIAL': ' \t'}
     _lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'}
    diff --git a/lib_pypy/cffi/_pycparser/plyparser.py b/lib_pypy/cffi/_pycparser/plyparser.py
    --- a/lib_pypy/cffi/_pycparser/plyparser.py
    +++ b/lib_pypy/cffi/_pycparser/plyparser.py
    @@ -4,7 +4,7 @@
     # PLYParser class and other utilites for simplifying programming
     # parsers with PLY
     #
    -# Copyright (C) 2008-2012, Eli Bendersky
    +# Copyright (C) 2008-2015, Eli Bendersky
     # License: BSD
     #-----------------------------------------------------------------
     
    @@ -15,6 +15,7 @@
                 - Line number
                 - (optional) column number, for the Lexer
         """
    +    __slots__ = ('file', 'line', 'column', '__weakref__')
         def __init__(self, file, line, column=None):
             self.file = file
             self.line = line
    @@ -52,4 +53,3 @@
     
         def _parse_error(self, msg, coord):
             raise ParseError("%s: %s" % (coord, msg))
    -
    diff --git a/lib_pypy/cffi/_pycparser/yacctab.py b/lib_pypy/cffi/_pycparser/yacctab.py
    --- a/lib_pypy/cffi/_pycparser/yacctab.py
    +++ b/lib_pypy/cffi/_pycparser/yacctab.py
    @@ -5,9 +5,9 @@
     
     _lr_method = 'LALR'
     
    -_lr_signature = '"\xce\xf2\x9e\xca\x17\xf7\xe0\x81\x1f\r\xc4\x0b+;\x87'
    +_lr_signature = '\x11\x82\x05\xfb:\x10\xfeo5\xb4\x11N\xe7S\xb4b'
         
    -_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[6,6,-61,-72,-71,-58,-54,-55,-33,-29,-59,6,-34,-53,-68,-63,-52,6,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,6,-67,6,-70,-74,6,-57,-84,-255,-83,6,-111,-110,-30,6,-100,-99,6,6,-45,-46,6,-113,6,6,6,6,-90,6,6,6,6,-36,6,-47,6,6,-85,-91,-256,6,-114,6,6,-115,-117,-116,6,-101,-37,-39,-42,-38,-40,6,-152,-151,-43,-153,-41,-87,-86,-92,-93,6,-103,-102,-171,-170,6,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,64,65,67,68,69,70,74,78,81,83,84,86,90,94,96,97,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,136,145,146,150,154,163,164,171,173,174,175,176,177,197,200,201,203,207,213,217,238,239,249,252,253,257,263,264,265,293,295,296,305,306,307,308,311,315,319,320,343,344,347,350,352,354,355,356,377,378,384,386,411,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,62,-66,-257,-69,72,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,62,-100,-99,-26,-118,-120,-25,72,72,161,-48,-51,72,-113,-257,-257,72,-239,-249,-253,-250,-247,-237,-238,205,-246,-224,-243,-251,-244,-236,-248,-245,72,-121,-119,161,259,72,72,-85,-256,-21,-82,-22,-81,-254,-252,-233,-232,-114,-115,72,-117,-116,-101,-146,-148,-136,259,-150,-144,-243,-87,-86,-231,-230,-229,-228,-227,-240,72,72,-103,-102,-139,259,-137,-145,-147,-149,-225,-226,259,-138,259,-234,-235,]),'WCHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,103,103,103,-45,-223,103,-221,103,-220,103,-219,103,103,-218,-222,-219,103,-257,-219,103,103,-256,103,-180,-183,-181,-177,-178,-182,-184,103,-186,-187,-179,-185,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-12,103,103,-11,-219,-39,-42,-38,103,-40,103,103,-152,-151,-43,-153,103,-41,103,103,103,-257,-135,-171,-170,103,-168,103,103,-154,103,-167,-155,103,103,103,103,-257,103,103,-166,-169,103,-158,103,-156,103,103,-157,103,103,103,-257,103,-162,-161,-159,103,103,103,-163,-160,103,-165,-164,]),'FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,104,104,104,-45,-223,104,-221,104,-220,104,-219,104,104,-218,-222,-219,104,-257,-219,104,104,-256,104,-180,-183,-181,-177,-178,-182,-184,104,-186,-187,-179,-185,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,-12,104,104,-11,-219,-39,-42,-38,104,-40,104,104,-152,-151,-43,-153,104,-41,104,104,104,-257,-135,-171,-170,104,-168,104,104,-154,104,-167,-155,104,104,104,104,-257,104,104,-166,-169,104,-158,104,-156,104,104,-157,104,104,104,-257,104,-162,-161,-159,104,104,104,-163,-160,104,-165,-164,]),'MINUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,107,107,107,-45,-223,-210,-239,-249,-253,-250,-247,-237,107,-221,-238,-212,-191,107,-220,107,-246,-219,-224,107,107,-243,-251,-218,-244,-236,222,-248,-245,-222,-219,107,-257,-219,107,107,-256,107,-180,-183,-181,-177,-178,-182,-184,107,-186,-187,-179,-185,-254,107,-216,-252,-233,-232,107,107,107,-210,-215,107,-213,-214,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,-12,107,107,-11,-219,-39,-42,-38,107,-40,107,107,-152,-151,-43,-153,107,-41,-243,107,-231,-230,-229,-228,-227,-240,107,107,222,222,222,-196,222,222,222,-195,222,222,-193,-192,222,222,222,222,222,-194,-257,-135,-171,-170,107,-168,107,107,-154,107,-167,-155,107,107,-217,-225,-226,107,107,-211,-257,107,107,-166,-169,107,-158,107,-156,107,107,-157,107,107,107,-257,-234,107,-162,-161,-159,-235,107,107,107,-163,-160,107,-165,-164,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,63,64,65,67,68,69,70,74,78,81,83,84,90,94,96,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,132,133,134,135,136,137,138,139,145,146,150,157,158,159,160,162,163,164,171,173,174,175,176,177,197,199,200,201,203,206,207,209,210,212,213,214,215,216,217,218,238,239,240,241,242,243,249,252,253,264,265,268,278,295,296,303,304,305,306,307,308,310,311,312,313,314,315,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,340,341,342,343,344,354,355,356,366,376,377,378,382,383,394,396,399,400,402,412,414,417,419,420,421,424,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,90,-84,-83,-49,-111,-110,-257,-100,-99,-26,-118,-120,-25,-141,-257,-143,-48,-51,-113,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,238,-15,239,-124,-257,-16,-122,-128,-121,-119,-142,-19,-20,264,265,-257,-141,-257,-85,-256,-21,-82,-22,-81,-254,-216,-252,-233,-232,311,-114,-210,-215,-213,-115,315,317,-172,-257,-214,-117,-116,-127,-2,-126,-1,-101,-146,-148,-150,-144,356,-14,-87,-86,-176,376,-231,-230,-229,-228,-241,-227,378,380,381,-240,-140,-257,-141,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-129,-123,-125,-103,-102,-145,-147,-149,-13,-217,-225,-226,-173,-211,406,408,410,-242,-190,-234,-257,422,-235,-257,425,428,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[19,19,-61,-72,-71,-58,-54,-55,-33,-29,-59,19,-34,-53,-68,-63,-52,19,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,19,-67,19,-70,-74,19,-57,-84,-255,-83,19,-111,-110,-30,19,-100,-99,19,19,-45,-46,19,-113,19,19,19,19,-90,19,19,19,19,-36,19,-47,19,19,-85,-91,-256,19,-114,19,19,-115,-117,-116,19,-101,-37,-39,-42,-38,-40,19,-152,-151,-43,-153,-41,-87,-86,-92,-93,19,-103,-102,-171,-170,19,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUS':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,113,113,113,-45,-223,-210,-239,-249,-253,-250,-247,-237,113,-221,-238,-212,-191,113,-220,113,-246,-219,-224,113,113,-243,-251,-218,-244,-236,226,-248,-245,-222,-219,113,-257,-219,113,113,-256,113,-180,-183,-181,-177,-178,-182,-184,113,-186,-187,-179,-185,-254,113,-216,-252,-233,-232,113,113,113,-210,-215,113,-213,-214,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,-12,113,113,-11,-219,-39,-42,-38,113,-40,113,113,-152,-151,-43,-153,113,-41,-243,113,-231,-230,-229,-228,-227,-240,113,113,226,226,226,-196,226,226,226,-195,226,226,-193,-192,226,226,226,226,226,-194,-257,-135,-171,-170,113,-168,113,113,-154,113,-167,-155,113,113,-217,-225,-226,113,113,-211,-257,113,113,-166,-169,113,-158,113,-156,113,113,-157,113,113,113,-257,-234,113,-162,-161,-159,-235,113,113,113,-163,-160,113,-165,-164,]),'ELLIPSIS':([245,],[341,]),'GT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,227,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,227,-198,-196,-200,227,-199,-195,-202,227,-193,-192,-201,227,227,227,227,-194,-217,-225,-226,-211,-234,-235,]),'GOTO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,271,-256,-39,-42,-38,-40,271,-152,-151,-43,-153,271,-41,-171,-170,-168,271,-154,-167,-155,271,-166,-169,-158,271,-156,271,-157,271,271,-162,-161,-159,271,271,-163,-160,271,-165,-164,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[26,26,-61,-72,-71,-58,-54,-55,-33,-29,-59,26,-34,-53,-68,-63,-52,26,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,26,-67,26,-70,-74,26,-57,-84,-255,-83,26,-111,-110,-30,26,-100,-99,26,26,-45,-46,26,-113,26,26,26,26,-90,26,26,26,26,-36,26,-47,26,26,-85,-91,-256,26,-114,26,26,-115,-117,-116,26,-101,-37,-39,-42,-38,-40,26,-152,-151,-43,-153,-41,-87,-86,-92,-93,26,-103,-102,-171,-170,26,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PERIOD':([55,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,154,173,197,200,201,203,257,263,293,305,306,307,308,311,315,347,350,352,377,378,384,386,411,412,419,],[-255,-239,-249,-253,-250,-247,-237,-238,204,-246,-224,-243,-251,-244,-236,-248,-245,258,-256,-254,-252,-233,-232,-136,258,-243,-231,-230,-229,-228,-227,-240,-139,258,-137,-225,-226,258,-138,258,-234,-235,]),'GE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,231,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,231,-198,-196,-200,231,-199,-195,-202,231,-193,-192,-201,231,231,231,231,-194,-217,-225,-226,-211,-234,-235,]),'INT_CONST_DEC':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,124,124,124,-45,-223,124,-221,124,-220,124,-219,124,124,-218,-222,-219,124,-257,-219,124,124,-256,124,-180,-183,-181,-177,-178,-182,-184,124,-186,-187,-179,-185,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-219,-39,-42,-38,124,-40,124,124,-152,-151,-43,-153,124,-41,124,124,124,-257,-135,-171,-170,124,-168,124,124,-154,124,-167,-155,124,124,124,124,-257,124,124,-166,-169,124,-158,124,-156,124,124,-157,124,124,124,-257,124,-162,-161,-159,124,124,124,-163,-160,124,-165,-164,]),'ARROW':([100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,200,201,203,293,305,306,307,308,311,315,377,378,412,419,],[-239,-249,-253,-250,-247,-237,-238,202,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-252,-233,-232,-243,-231,-230,-229,-228,-227,-240,-225,-226,-234,-235,]),'HEX_FLOAT_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,127,127,127,-45,-223,127,-221,127,-220,127,-219,127,127,-218,-222,-219,127,-257,-219,127,127,-256,127,-180,-183,-181,-177,-178,-182,-184,127,-186,-187,-179,-185,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-219,-39,-42,-38,127,-40,127,127,-152,-151,-43,-153,127,-41,127,127,127,-257,-135,-171,-170,127,-168,127,127,-154,127,-167,-155,127,127,127,127,-257,127,127,-166,-169,127,-158,127,-156,127,127,-157,127,127,127,-257,127,-162,-161,-159,127,127,127,-163,-160,127,-165,-164,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[40,40,-61,-72,-71,-58,-54,-55,-33,-29,-59,40,-34,-53,-68,-63,-52,40,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,40,-67,40,-70,-74,40,-57,-84,-255,-83,40,-111,-110,-30,40,-100,-99,40,40,-45,-46,40,-113,40,40,40,40,-90,40,40,40,40,-36,40,-47,40,40,-85,-91,-256,40,-114,40,40,-115,-117,-116,40,-101,-37,-39,-42,-38,-40,40,-152,-151,-43,-153,-41,-87,-86,-92,-93,40,-103,-102,-171,-170,40,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MINUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[186,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'INT_CONST_OCT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,128,128,128,-45,-223,128,-221,128,-220,128,-219,128,128,-218,-222,-219,128,-257,-219,128,128,-256,128,-180,-183,-181,-177,-178,-182,-184,128,-186,-187,-179,-185,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-219,-39,-42,-38,128,-40,128,128,-152,-151,-43,-153,128,-41,128,128,128,-257,-135,-171,-170,128,-168,128,128,-154,128,-167,-155,128,128,128,128,-257,128,128,-166,-169,128,-158,128,-156,128,128,-157,128,128,128,-257,128,-162,-161,-159,128,128,128,-163,-160,128,-165,-164,]),'TIMESEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[195,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'OR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,236,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,236,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[2,2,-61,-72,-71,-58,-54,-55,-33,-29,-59,2,-34,-53,-68,-63,-52,2,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,2,-67,2,-70,-74,2,-57,-84,-255,-83,2,-111,-110,-30,2,-100,-99,2,2,-45,-46,2,-113,2,2,2,2,-90,2,2,2,2,-36,2,-47,2,2,-85,-91,-256,2,-114,2,2,-115,-117,-116,2,-101,-37,-39,-42,-38,-40,2,-152,-151,-43,-153,-41,-87,-86,-92,-93,2,-103,-102,-171,-170,2,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'RETURN':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,274,-256,-39,-42,-38,-40,274,-152,-151,-43,-153,274,-41,-171,-170,-168,274,-154,-167,-155,274,-166,-169,-158,274,-156,274,-157,274,274,-162,-161,-159,274,274,-163,-160,274,-165,-164,]),'RSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[196,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[32,32,-61,-72,-71,-58,-54,-55,-33,-29,-59,32,-34,-53,-68,-63,-52,32,-56,-174,-109,-66,32,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,32,-67,32,-70,-74,32,-57,-84,-255,-83,32,-111,-110,-30,32,-100,-99,32,-120,32,32,-45,-46,32,-113,32,32,32,32,-90,32,32,-121,32,32,-36,32,-47,32,32,-85,-91,-256,32,-114,32,32,-115,-117,-116,32,-101,-37,-39,-42,-38,-40,32,-152,-151,-43,-153,-41,-87,-86,-92,-93,32,-103,-102,-171,-170,32,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[9,9,-61,-72,-71,-58,-54,-55,-33,-29,-59,9,-34,-53,-68,-63,-52,9,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,9,-67,9,-70,-74,9,-57,-84,-255,-83,-111,-110,-30,9,-100,-99,9,9,-45,-46,9,-113,9,9,-36,9,-47,-85,-256,-114,-115,-117,-116,9,-101,-37,-39,-42,-38,-40,9,-152,-151,-43,-153,-41,-87,-86,9,-103,-102,-171,-170,9,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIZEOF':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,106,106,106,-45,-223,106,-221,106,-220,106,-219,106,106,-218,-222,-219,106,-257,-219,106,106,-256,106,-180,-183,-181,-177,-178,-182,-184,106,-186,-187,-179,-185,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,-12,106,106,-11,-219,-39,-42,-38,106,-40,106,106,-152,-151,-43,-153,106,-41,106,106,106,-257,-135,-171,-170,106,-168,106,106,-154,106,-167,-155,106,106,106,106,-257,106,106,-166,-169,106,-158,106,-156,106,106,-157,106,106,106,-257,106,-162,-161,-159,106,106,106,-163,-160,106,-165,-164,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[18,18,-61,-72,-71,-58,-54,-55,-33,-29,-59,18,-34,-53,-68,-63,-52,18,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,18,-67,18,-70,-74,18,-57,-84,-255,-83,18,-111,-110,-30,18,-100,-99,18,18,-45,-46,18,-113,18,18,18,18,-90,18,18,18,18,-36,18,-47,18,18,-85,-91,-256,18,-114,18,18,-115,-117,-116,18,-101,-37,-39,-42,-38,-40,18,-152,-151,-43,-153,-41,-87,-86,-92,-93,18,-103,-102,-171,-170,18,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[20,20,-61,-72,-71,-58,-54,-55,-33,-29,-59,20,-34,-53,-68,-63,-52,20,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,20,-67,20,-70,-74,20,-57,-84,-255,-83,20,-111,-110,-30,20,-100,-99,20,20,-45,-46,20,-113,20,20,20,20,-90,20,20,20,20,-36,20,-47,20,20,-85,-91,-256,20,-114,20,20,-115,-117,-116,20,-101,-37,-39,-42,-38,-40,20,-152,-151,-43,-153,-41,-87,-86,-92,-93,20,-103,-102,-171,-170,20,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'COLON':([2,3,5,6,13,18,19,24,25,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,64,65,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,171,173,174,175,176,177,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,279,293,295,296,298,299,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,343,344,365,376,377,378,382,383,402,412,419,],[-61,-72,-71,-58,-59,-68,-63,-174,-109,-66,-69,-73,-112,-64,-60,-62,-65,-67,-70,-74,-84,-83,-111,-110,-100,-99,-113,-257,-257,178,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-85,-256,-21,-82,-22,-81,302,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,363,372,-87,-86,-188,178,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,385,-206,-194,-103,-102,395,-217,-225,-226,-173,-211,-190,-234,-235,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,166,173,255,371,],[-257,0,-33,-29,-34,-27,-32,-31,-35,-28,-30,-45,-36,-256,-37,-155,]),'WSTRING_LITERAL':([55,62,72,77,82,98,100,102,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,102,102,102,-45,-223,197,-253,102,-221,102,-220,102,-219,102,102,-218,-222,-219,102,-257,-219,102,102,-256,102,-180,-183,-181,-177,-178,-182,-184,102,-186,-187,-179,-185,-254,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,-12,102,102,-11,-219,-39,-42,-38,102,-40,102,102,-152,-151,-43,-153,102,-41,102,102,102,-257,-135,-171,-170,102,-168,102,102,-154,102,-167,-155,102,102,102,102,-257,102,102,-166,-169,102,-158,102,-156,102,102,-157,102,102,102,-257,102,-162,-161,-159,102,102,102,-163,-160,102,-165,-164,]),'DIVIDE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,229,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,229,229,229,229,229,229,229,229,229,229,-193,-192,229,229,229,229,229,-194,-217,-225,-226,-211,-234,-235,]),'FOR':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,276,-256,-39,-42,-38,-40,276,-152,-151,-43,-153,276,-41,-171,-170,-168,276,-154,-167,-155,276,-166,-169,-158,276,-156,276,-157,276,276,-162,-161,-159,276,276,-163,-160,276,-165,-164,]),'PLUSPLUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,115,115,115,-45,-223,-239,-249,-253,-250,-247,-237,115,-221,-238,203,115,-220,115,-246,-219,-224,115,115,-243,-251,-218,-244,-236,-248,-245,-222,-219,115,-257,-219,115,115,-256,115,-180,-183,-181,-177,-178,-182,-184,115,-186,-187,-179,-185,-254,115,-252,-233,-232,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,-12,115,115,-11,-219,-39,-42,-38,115,-40,115,115,-152,-151,-43,-153,115,-41,-243,115,-231,-230,-229,-228,-227,-240,115,115,-257,-135,-171,-170,115,-168,115,115,-154,115,-167,-155,115,115,-225,-226,115,115,-257,115,115,-166,-169,115,-158,115,-156,115,115,-157,115,115,115,-257,-234,115,-162,-161,-159,-235,115,115,115,-163,-160,115,-165,-164,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,76,83,84,86,90,99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,144,165,171,173,197,199,200,201,203,207,209,210,212,213,218,238,239,249,257,263,293,295,296,305,306,307,308,311,315,343,344,347,352,376,377,378,383,386,412,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-69,77,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,151,-48,-51,77,-113,188,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,250,151,-85,-256,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-214,-117,-116,-101,-136,353,-243,-87,-86,-231,-230,-229,-228,-227,-240,-103,-102,-139,-137,-217,-225,-226,-211,-138,-234,-235,]),'ELSE':([173,269,270,273,275,286,291,358,359,362,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[-256,-39,-42,-38,-40,-43,-41,-171,-170,-168,-167,-155,-166,-169,-158,-156,-157,-162,-161,423,-163,-160,-165,-164,]),'ANDEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[193,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EQ':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,233,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,233,-198,-196,-200,-204,-199,-195,-202,233,-193,-192,-201,233,-203,233,233,-194,-217,-225,-226,-211,-234,-235,]),'AND':([55,62,72,77,82,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,123,123,123,-45,-223,-210,-239,-249,-253,-250,-247,-237,123,-221,-238,-212,-191,123,-220,123,-246,-219,-224,123,123,-243,-251,-218,-244,-236,234,-248,-245,-222,-219,123,-257,-219,123,123,-256,123,-180,-183,-181,-177,-178,-182,-184,123,-186,-187,-179,-185,-254,123,-216,-252,-233,-232,123,123,123,-210,-215,123,-213,-214,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-219,-39,-42,-38,123,-40,123,123,-152,-151,-43,-153,123,-41,-243,123,-231,-230,-229,-228,-227,-240,123,123,-197,234,-198,-196,-200,-204,-199,-195,-202,234,-193,-192,-201,234,-203,-205,234,-194,-257,-135,-171,-170,123,-168,123,123,-154,123,-167,-155,123,123,-217,-225,-226,123,123,-211,-257,123,123,-166,-169,123,-158,123,-156,123,123,-157,123,123,123,-257,-234,123,-162,-161,-159,-235,123,123,123,-163,-160,123,-165,-164,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,68,69,70,74,76,78,82,87,89,90,91,92,93,94,95,96,119,145,146,162,163,164,166,167,168,169,170,171,172,173,198,202,204,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[24,24,-61,-72,-71,-58,54,-54,-55,-33,-29,-59,24,-34,59,-53,-68,-63,-89,-52,24,-56,-174,-109,64,-66,-257,-69,-32,-73,-112,-88,-64,-31,-60,-35,-62,-65,24,-67,24,-70,-74,24,-57,-84,-255,-83,24,-111,-110,-30,24,-100,-99,-26,-118,-120,-25,59,24,24,-45,-46,24,-113,24,24,24,24,-90,24,24,-121,-119,24,59,24,-36,24,-47,24,24,-85,-91,-256,24,305,307,-114,24,24,-115,-117,-116,24,-101,-37,-39,-42,-38,-40,24,-152,-151,-43,-153,-41,-87,-86,-92,-93,24,-103,-102,-171,-170,24,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LBRACE':([7,20,25,26,33,34,48,54,55,56,59,60,64,65,76,77,82,85,87,88,89,90,151,152,154,167,168,173,207,213,238,239,256,260,261,269,270,273,275,282,284,285,286,288,290,291,317,350,353,358,359,362,363,367,369,371,372,376,380,381,384,387,389,390,393,395,398,406,407,408,410,411,415,416,418,423,425,426,427,428,429,430,],[55,-89,-109,55,-112,-88,-257,55,-255,55,-111,-110,55,55,-257,55,-45,-7,-46,55,-8,-113,55,55,-257,55,-47,-256,-114,-115,-117,-116,-12,55,-11,-39,-42,-38,-40,55,-152,-151,-43,-153,55,-41,55,-257,-135,-171,-170,-168,55,-154,-167,-155,55,55,55,55,-257,55,-166,-169,-158,55,-156,55,-157,55,55,-257,-162,-161,-159,55,55,-163,-160,55,-165,-164,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,166,173,255,371,],[38,-33,-29,-34,38,-32,-31,-35,-30,-45,-36,-256,-37,-155,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[39,39,-61,-72,-71,-58,-54,-55,-33,-29,-59,39,-34,-53,-68,-63,-52,39,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,39,-67,39,-70,-74,39,-57,-84,-255,-83,39,-111,-110,-30,39,-100,-99,39,39,-45,-46,39,-113,39,39,39,39,-90,39,39,39,39,-36,39,-47,39,39,-85,-91,-256,39,-114,39,39,-115,-117,-116,39,-101,-37,-39,-42,-38,-40,39,-152,-151,-43,-153,-41,-87,-86,-92,-93,39,-103,-102,-171,-170,39,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[43,43,-61,-72,-71,-58,-54,-55,-33,-29,-59,43,-34,-53,-68,-63,-52,43,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,43,-67,43,-70,-74,43,-57,-84,-255,-83,43,-111,-110,-30,43,-100,-99,43,43,-45,-46,43,-113,43,43,43,43,-90,43,43,43,43,-36,43,-47,43,43,-85,-91,-256,43,-114,43,43,-115,-117,-116,43,-101,-37,-39,-42,-38,-40,43,-152,-151,-43,-153,-41,-87,-86,-92,-93,43,-103,-102,-171,-170,43,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONTINUE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,277,-256,-39,-42,-38,-40,277,-152,-151,-43,-153,277,-41,-171,-170,-168,277,-154,-167,-155,277,-166,-169,-158,277,-156,277,-157,277,277,-162,-161,-159,277,277,-163,-160,277,-165,-164,]),'NOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,131,131,131,-45,-223,131,-221,131,-220,131,-219,131,131,-218,-222,-219,131,-257,-219,131,131,-256,131,-180,-183,-181,-177,-178,-182,-184,131,-186,-187,-179,-185,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,-12,131,131,-11,-219,-39,-42,-38,131,-40,131,131,-152,-151,-43,-153,131,-41,131,131,131,-257,-135,-171,-170,131,-168,131,131,-154,131,-167,-155,131,131,131,131,-257,131,131,-166,-169,131,-158,131,-156,131,131,-157,131,131,131,-257,131,-162,-161,-159,131,131,131,-163,-160,131,-165,-164,]),'OREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[194,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'MOD':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,237,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,237,237,237,237,237,237,237,237,237,237,-193,-192,237,237,237,237,237,-194,-217,-225,-226,-211,-234,-235,]),'RSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,219,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,219,-198,-196,219,219,219,-195,219,219,-193,-192,219,219,219,219,219,-194,-217,-225,-226,-211,-234,-235,]),'DEFAULT':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,279,-256,-39,-42,-38,-40,279,-152,-151,-43,-153,279,-41,-171,-170,-168,279,-154,-167,-155,279,-166,-169,-158,279,-156,279,-157,279,279,-162,-161,-159,279,279,-163,-160,279,-165,-164,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[37,37,-61,-72,-71,-58,-54,-55,-33,-29,-59,37,-34,-53,-68,-63,-52,37,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,37,-67,37,-70,-74,37,-57,-84,-255,-83,37,-111,-110,-30,37,-100,-99,37,37,-45,-46,37,-113,37,37,37,37,-90,37,37,37,37,-36,37,-47,37,37,-85,-91,-256,37,-114,37,37,-115,-117,-116,37,-101,-37,-39,-42,-38,-40,37,-152,-151,-43,-153,-41,-87,-86,-92,-93,37,-103,-102,-171,-170,37,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'WHILE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,370,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,280,-256,-39,-42,-38,-40,280,-152,-151,-43,-153,280,-41,-171,-170,-168,280,-154,-167,397,-155,280,-166,-169,-158,280,-156,280,-157,280,280,-162,-161,-159,280,280,-163,-160,280,-165,-164,]),'DIVEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[185,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[10,10,-61,-72,-71,-58,-54,-55,-33,-29,-59,10,-34,-53,-68,-63,-52,10,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,10,-67,10,-70,-74,10,-57,-84,-255,-83,-111,-110,-30,10,-100,-99,10,10,-45,-46,10,-113,10,10,-36,10,-47,-85,-256,-114,-115,-117,-116,10,-101,-37,-39,-42,-38,-40,10,-152,-151,-43,-153,-41,-87,-86,10,-103,-102,-171,-170,10,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CASE':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,281,-256,-39,-42,-38,-40,281,-152,-151,-43,-153,281,-41,-171,-170,-168,281,-154,-167,-155,281,-166,-169,-158,281,-156,281,-157,281,281,-162,-161,-159,281,281,-163,-160,281,-165,-164,]),'LAND':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,232,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,232,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[17,17,-61,-72,-71,-58,-54,-55,-33,-29,-59,17,-34,-53,-68,-63,-52,17,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,17,-67,17,-70,-74,17,-57,-84,-255,-83,-111,-110,-30,17,-100,-99,17,17,-45,-46,17,-113,17,17,-36,17,-47,-85,-256,-114,-115,-117,-116,17,-101,-37,-39,-42,-38,-40,17,-152,-151,-43,-153,-41,-87,-86,17,-103,-102,-171,-170,17,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'MODEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[187,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'NE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,224,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,224,-198,-196,-200,-204,-199,-195,-202,224,-193,-192,-201,224,-203,224,224,-194,-217,-225,-226,-211,-234,-235,]),'SWITCH':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,283,-256,-39,-42,-38,-40,283,-152,-151,-43,-153,283,-41,-171,-170,-168,283,-154,-167,-155,283,-166,-169,-158,283,-156,283,-157,283,283,-162,-161,-159,283,283,-163,-160,283,-165,-164,]),'INT_CONST_HEX':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,116,116,116,-45,-223,116,-221,116,-220,116,-219,116,116,-218,-222,-219,116,-257,-219,116,116,-256,116,-180,-183,-181,-177,-178,-182,-184,116,-186,-187,-179,-185,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,-12,116,116,-11,-219,-39,-42,-38,116,-40,116,116,-152,-151,-43,-153,116,-41,116,116,116,-257,-135,-171,-170,116,-168,116,116,-154,116,-167,-155,116,116,116,116,-257,116,116,-166,-169,116,-158,116,-156,116,116,-157,116,116,116,-257,116,-162,-161,-159,116,116,116,-163,-160,116,-165,-164,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[27,27,-61,-72,-71,-58,-54,-55,-33,-29,-59,27,-34,-53,-68,-63,-52,27,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,27,-67,27,-70,-74,27,-57,-84,-255,-83,27,-111,-110,-30,27,-100,-99,27,27,-45,-46,27,-113,27,27,27,27,-90,27,27,27,27,-36,27,-47,27,27,-85,-91,-256,27,-114,27,27,-115,-117,-116,27,-101,-37,-39,-42,-38,-40,27,-152,-151,-43,-153,-41,-87,-86,-92,-93,27,-103,-102,-171,-170,27,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'PLUSEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[190,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[34,34,-61,-72,-71,-58,-54,-55,-33,-29,-59,34,-34,-53,-68,-63,-52,34,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,34,-67,34,-70,-74,34,-57,-84,-255,-83,34,-111,-110,-30,34,-100,-99,34,34,-45,-46,34,-113,34,34,34,34,-90,34,34,34,34,-36,34,-47,34,34,-85,-91,-256,34,-114,34,34,-115,-117,-116,34,-101,-37,-39,-42,-38,-40,34,-152,-151,-43,-153,-41,-87,-86,-92,-93,34,-103,-102,-171,-170,34,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'CONDOP':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,235,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'BREAK':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,287,-256,-39,-42,-38,-40,287,-152,-151,-43,-153,287,-41,-171,-170,-168,287,-154,-167,-155,287,-166,-169,-158,287,-156,287,-157,287,287,-162,-161,-159,287,287,-163,-160,287,-165,-164,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[46,46,-61,-72,-71,-58,-54,-55,-33,-29,-59,46,-34,-53,-68,-63,-52,46,-56,-174,-109,-66,46,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,46,-67,46,-70,-74,46,-57,-84,-255,-83,46,-111,-110,-30,46,-100,-99,46,-120,46,46,-45,-46,46,-113,46,46,46,46,-90,46,46,-121,46,46,-36,46,-47,46,46,-85,-91,-256,46,-114,46,46,-115,-117,-116,46,-101,-37,-39,-42,-38,-40,46,-152,-151,-43,-153,-41,-87,-86,-92,-93,46,-103,-102,-171,-170,46,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[49,49,-61,-72,-71,-58,-54,-55,-33,-29,-59,49,-34,-53,-68,-63,-52,49,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,49,-67,49,-70,-74,49,-57,-84,-255,-83,-111,-110,-30,49,-100,-99,49,49,-45,-46,49,-113,49,49,-36,49,-47,-85,-256,-114,-115,-117,-116,49,-101,-37,-39,-42,-38,-40,49,-152,-151,-43,-153,-41,-87,-86,49,-103,-102,-171,-170,49,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'DO':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,290,-256,-39,-42,-38,-40,290,-152,-151,-43,-153,290,-41,-171,-170,-168,290,-154,-167,-155,290,-166,-169,-158,290,-156,290,-157,290,290,-162,-161,-159,290,290,-163,-160,290,-165,-164,]),'LNOT':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,98,98,98,-45,-223,98,-221,98,-220,98,-219,98,98,-218,-222,-219,98,-257,-219,98,98,-256,98,-180,-183,-181,-177,-178,-182,-184,98,-186,-187,-179,-185,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-12,98,98,-11,-219,-39,-42,-38,98,-40,98,98,-152,-151,-43,-153,98,-41,98,98,98,-257,-135,-171,-170,98,-168,98,98,-154,98,-167,-155,98,98,98,98,-257,98,98,-166,-169,98,-158,98,-156,98,98,-157,98,98,98,-257,98,-162,-161,-159,98,98,98,-163,-160,98,-165,-164,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,67,69,76,78,82,87,89,90,91,92,93,94,95,96,119,145,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[3,3,-61,-72,-71,-58,-54,-55,-33,-29,-59,3,-34,-53,-68,-63,-52,3,-56,-174,-109,-66,3,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,3,-67,3,-70,-74,3,-57,-84,-255,-83,3,-111,-110,-30,3,-100,-99,3,-120,3,3,-45,-46,3,-113,3,3,3,3,-90,3,3,-121,3,3,-36,3,-47,3,3,-85,-91,-256,3,-114,3,3,-115,-117,-116,3,-101,-37,-39,-42,-38,-40,3,-152,-151,-43,-153,-41,-87,-86,-92,-93,3,-103,-102,-171,-170,3,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,220,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-217,-225,-226,-211,-234,-235,]),'CHAR_CONST':([55,62,72,77,82,98,106,107,112,113,115,117,119,120,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,101,101,101,-45,-223,101,-221,101,-220,101,-219,101,101,-218,-222,-219,101,-257,-219,101,101,-256,101,-180,-183,-181,-177,-178,-182,-184,101,-186,-187,-179,-185,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,-12,101,101,-11,-219,-39,-42,-38,101,-40,101,101,-152,-151,-43,-153,101,-41,101,101,101,-257,-135,-171,-170,101,-168,101,101,-154,101,-167,-155,101,101,101,101,-257,101,101,-166,-169,101,-158,101,-156,101,101,-157,101,101,101,-257,101,-162,-161,-159,101,101,101,-163,-160,101,-165,-164,]),'LSHIFT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,221,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,221,-198,-196,221,221,221,-195,221,221,-193,-192,221,221,221,221,221,-194,-217,-225,-226,-211,-234,-235,]),'RBRACE':([55,82,93,95,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,142,143,144,155,167,169,170,172,173,197,199,200,201,203,209,210,212,218,246,247,248,262,269,270,273,275,282,284,285,286,288,289,291,292,298,300,301,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,345,346,349,350,351,358,359,362,367,369,371,376,377,378,383,388,389,390,393,398,401,402,403,407,411,412,415,416,418,419,426,427,429,430,],[-255,-45,173,-90,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-104,173,-107,-130,-257,173,173,-91,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,173,173,-105,173,-39,-42,-38,-40,-6,-152,-151,-43,-153,-5,-41,173,-188,-92,-93,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-106,-108,-133,173,-131,-171,-170,-168,-154,-167,-155,-217,-225,-226,-211,-132,-166,-169,-158,-156,173,-190,-134,-157,173,-234,-162,-161,-159,-235,-163,-160,-165,-164,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[13,13,-61,-72,-71,-58,-54,-55,-33,-29,-59,13,-34,-53,-68,-63,-52,13,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,13,-67,13,-70,-74,13,-57,-84,-255,-83,13,-111,-110,-30,13,-100,-99,13,13,-45,-46,13,-113,13,13,13,13,-90,13,13,13,13,-36,13,-47,13,13,-85,-91,-256,13,-114,13,13,-115,-117,-116,13,-101,-37,-39,-42,-38,-40,13,-152,-151,-43,-153,-41,-87,-86,-92,-93,13,-103,-102,-171,-170,13,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'LE':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,223,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,223,-198,-196,-200,223,-199,-195,-202,223,-193,-192,-201,223,223,223,223,-194,-217,-225,-226,-211,-234,-235,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,64,65,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,145,146,150,153,155,163,165,166,167,171,173,174,175,176,177,179,180,181,182,183,184,197,199,200,201,203,207,209,210,212,213,216,218,238,239,249,251,252,253,254,255,264,265,269,270,272,273,274,275,277,278,282,284,285,286,287,288,289,290,291,293,295,296,297,298,303,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,351,354,355,356,357,358,359,360,361,362,363,366,367,369,371,372,374,375,376,377,378,382,383,388,389,390,391,392,393,395,398,402,404,405,406,407,408,410,412,413,415,416,418,419,422,423,425,426,427,428,429,430,],[15,-257,-61,-72,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,15,-56,-174,-109,-66,-257,-69,-257,-32,-73,-112,-64,-31,-60,-35,-62,-65,82,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-111,-110,-30,-100,-99,-26,-118,-120,-25,-18,-44,-141,-17,-79,-78,-75,-143,-45,-48,-51,-257,-113,-257,-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-121,-119,-142,-77,-130,-141,-79,-36,-257,-85,-256,-21,-82,-22,-81,-24,300,-94,301,-23,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,-172,-214,-117,-116,-101,-76,-146,-148,-80,-37,-150,-144,-39,-42,358,-38,359,-40,362,-14,-257,-152,-151,-43,369,-153,-13,-257,-41,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,-103,-102,-131,-145,-147,-149,389,-171,-170,390,-257,-168,-257,-13,-154,-167,-155,-257,-95,-97,-217,-225,-226,-173,-211,-132,-166,-169,404,-257,-158,-257,-156,-190,-257,414,-257,-157,-257,-257,-234,420,-162,-161,-159,-235,426,-257,-257,-163,-160,-257,-165,-164,]),'LT':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,225,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,225,-198,-196,-200,225,-199,-195,-202,225,-193,-192,-201,225,225,225,225,-194,-217,-225,-226,-211,-234,-235,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,24,25,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,64,65,67,68,69,70,71,74,76,79,80,81,83,84,90,99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,130,135,136,137,138,139,142,143,144,145,146,150,153,155,163,165,171,173,179,181,184,197,199,200,201,203,207,209,210,212,213,214,216,218,238,239,240,241,242,243,246,247,248,249,251,252,253,254,262,264,265,278,293,295,296,297,298,303,305,306,307,308,309,310,311,312,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,342,343,344,345,346,349,351,354,355,356,360,374,375,376,377,378,382,383,388,394,396,399,400,401,402,403,412,417,419,],[-257,-61,-72,-71,-58,-54,-55,-59,-257,-53,-68,-63,-52,-56,-174,-109,-66,-257,-69,-73,-112,-64,-60,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-83,-49,-111,-110,-100,-99,-26,-118,-120,-25,147,-141,-79,-78,-75,-143,-48,-51,-113,-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,-189,-248,-245,-175,-124,-257,244,245,-128,-104,248,-107,-121,-119,-142,-77,-130,-141,-79,-85,-256,299,-94,-96,-254,-216,-252,-233,-232,-114,-210,-215,-213,-115,316,-172,-214,-117,-116,-127,-2,-126,-1,248,248,-105,-101,-76,-146,-148,-80,350,-150,-144,316,-243,-87,-86,-98,-188,-176,-231,-230,-229,-228,316,-241,-227,379,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,316,-206,-194,-129,-125,-103,-102,-106,-108,-133,-131,-145,-147,-149,316,-95,-97,-217,-225,-226,-173,-211,-132,316,316,316,-242,411,-190,-134,-234,316,-235,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[23,23,-61,-72,-71,-58,-54,-55,-33,-29,-59,23,-34,-53,-68,-63,-52,23,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,23,-67,23,-70,-74,23,-57,-84,-255,-83,-111,-110,-30,23,-100,-99,23,23,-45,-46,23,-113,23,23,-36,23,-47,-85,-256,-114,-115,-117,-116,23,-101,-37,-39,-42,-38,-40,23,-152,-151,-43,-153,-41,-87,-86,23,-103,-102,-171,-170,23,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOR':([99,100,101,102,103,104,105,108,109,111,116,118,121,122,124,125,126,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,376,377,378,383,412,419,],[-210,-239,-249,-253,-250,-247,-237,-238,-212,-191,-246,-224,-243,-251,-244,-236,228,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-197,228,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,228,-203,-205,228,-194,-217,-225,-226,-211,-234,-235,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,63,64,65,76,78,82,87,89,90,162,164,166,167,168,171,173,207,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[21,21,-61,-72,-71,-58,-54,-55,-33,-29,-59,21,-34,-53,-68,-63,-52,21,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,21,-67,21,-70,-74,21,-57,-84,-255,-83,-111,-110,-30,21,-100,-99,21,21,-45,-46,21,-113,21,21,-36,21,-47,-85,-256,-114,-115,-117,-116,21,-101,-37,-39,-42,-38,-40,21,-152,-151,-43,-153,-41,-87,-86,21,-103,-102,-171,-170,21,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,64,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,115,116,117,118,119,120,121,122,123,124,125,126,127,128,131,136,145,147,149,151,154,156,161,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,203,205,206,208,209,210,211,212,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,249,250,255,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,295,296,299,302,305,306,307,308,311,315,316,317,319,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,376,377,378,379,380,383,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[28,-257,-61,-72,28,-71,-58,-54,-55,-33,-29,-59,-257,-34,-53,-68,-63,-52,28,-56,-174,-66,-257,-69,28,-32,-73,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,117,-100,-99,-26,28,-120,-25,149,156,28,-45,-48,-51,28,-257,-257,28,-223,-210,-239,-249,-253,-250,-247,-237,156,-221,-238,-212,-191,156,-220,156,-246,-219,-224,156,156,-243,-251,-218,-244,-236,230,-248,-245,-222,28,-121,28,-219,156,-257,-219,267,28,-36,156,-85,-256,-21,-82,-22,-81,156,-180,-183,-181,-177,-178,-182,-184,156,-186,-187,-179,-185,-254,156,-216,-252,-233,-232,156,156,156,-210,-215,156,-213,28,-214,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,-101,156,-37,-12,156,156,-11,-219,-39,-42,-38,156,-40,156,156,-152,-151,-43,-153,156,-41,-243,-87,-86,28,156,-231,-230,-229,-228,-227,-240,156,156,28,230,230,230,230,230,230,230,230,230,230,-193,-192,230,230,230,230,230,-194,-103,-102,-257,-135,-171,-170,156,-168,156,156,-154,156,-167,-155,156,156,-217,-225,-226,156,156,-211,-257,156,156,-166,-169,156,-158,156,-156,156,156,-157,156,156,156,-257,-234,156,-162,-161,-159,-235,156,156,156,-163,-160,156,-165,-164,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,64,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,136,145,146,147,149,150,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,207,208,211,213,217,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,249,250,252,253,255,256,259,260,261,264,265,267,269,270,273,274,275,276,280,281,282,283,284,285,286,288,290,291,293,294,295,296,299,302,305,306,307,308,311,315,316,317,319,320,343,344,350,353,354,355,356,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,397,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[4,-257,-61,-72,4,-71,-58,-54,-55,-33,-29,-59,-257,-34,4,-53,-68,-63,-52,4,-56,-174,63,-66,-257,-69,78,-32,-73,-112,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,63,-30,119,-100,-99,-26,-118,-120,-25,119,78,119,78,162,-45,-48,-51,164,-113,-257,-257,164,-223,-239,-249,-253,-250,-247,-237,198,-221,-238,206,208,-220,211,-246,-219,-224,119,211,-243,-251,-218,-244,-236,-248,-245,-222,78,-121,-119,4,-219,162,119,-257,-219,119,164,164,-36,119,-85,-256,-21,-82,-22,-81,208,-180,-183,-181,-177,-178,-182,-184,119,-186,-187,-179,-185,-254,119,-252,-233,-232,119,119,-114,119,119,-115,319,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,119,208,208,-117,-116,-101,208,-146,-148,-37,-12,208,119,-11,-150,-144,-219,-39,-42,-38,119,-40,361,364,208,119,368,-152,-151,-43,-153,119,-41,-243,373,-87,-86,4,208,-231,-230,-229,-228,-227,-240,119,208,319,319,-103,-102,-257,-135,-145,-147,-149,-171,-170,119,-168,119,119,-154,119,-167,-155,119,119,-225,-226,119,208,-257,208,119,-166,-169,119,-158,119,409,-156,119,119,-157,119,119,119,-257,-234,119,-162,-161,-159,-235,119,119,119,-163,-160,119,-165,-164,]),'MINUSMINUS':([55,62,72,77,82,98,100,101,102,103,104,105,106,107,108,109,112,113,115,116,117,118,119,120,121,122,123,124,125,127,128,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,203,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,293,302,305,306,307,308,311,315,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,377,378,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,412,414,415,416,418,419,420,423,425,426,427,428,429,430,],[-255,120,120,120,-45,-223,-239,-249,-253,-250,-247,-237,120,-221,-238,201,120,-220,120,-246,-219,-224,120,120,-243,-251,-218,-244,-236,-248,-245,-222,-219,120,-257,-219,120,120,-256,120,-180,-183,-181,-177,-178,-182,-184,120,-186,-187,-179,-185,-254,120,-252,-233,-232,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,-12,120,120,-11,-219,-39,-42,-38,120,-40,120,120,-152,-151,-43,-153,120,-41,-243,120,-231,-230,-229,-228,-227,-240,120,120,-257,-135,-171,-170,120,-168,120,120,-154,120,-167,-155,120,120,-225,-226,120,120,-257,120,120,-166,-169,120,-158,120,-156,120,120,-157,120,120,120,-257,-234,120,-162,-161,-159,-235,120,120,120,-163,-160,120,-165,-164,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,106,107,112,113,115,117,119,120,123,131,136,140,141,145,146,147,149,151,154,156,161,163,164,166,167,171,173,174,175,176,177,178,185,186,187,188,189,190,191,192,193,194,195,196,198,202,204,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,248,249,250,255,256,258,259,260,261,267,269,270,271,273,274,275,281,282,284,285,286,288,290,291,295,296,299,302,316,317,343,344,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[33,-257,-61,-72,33,-71,-58,56,-54,-55,-33,-29,-59,-257,-34,33,-53,-68,-63,-89,-52,33,-56,-174,65,-66,-257,-69,33,-32,-73,-88,-64,-31,-60,-35,-62,-65,-257,-67,-257,-70,-74,-57,-50,-9,-10,-84,-255,-83,-49,-30,121,121,-100,-99,144,-26,-118,-120,-25,121,33,121,33,-45,-48,-51,33,-257,-257,33,-223,121,-221,121,-220,121,-219,121,121,-218,-222,33,144,144,-121,-119,33,-219,121,-257,-219,121,33,33,-36,293,-85,-256,-21,-82,-22,-81,121,-180,-183,-181,-177,-178,-182,-184,121,-186,-187,-179,-185,121,306,308,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,144,-101,121,-37,-12,121,121,121,-11,-219,-39,-42,357,-38,121,-40,121,293,-152,-151,-43,-153,293,-41,-87,-86,33,121,121,121,-103,-102,-257,-135,-171,-170,121,-168,293,121,-154,121,-167,-155,293,121,121,121,-257,121,121,-166,-169,121,-158,293,-156,121,293,-157,293,121,293,-257,121,-162,-161,-159,121,293,293,-163,-160,293,-165,-164,]),'IF':([55,82,167,173,269,270,273,275,282,284,285,286,288,290,291,358,359,362,363,367,369,371,372,389,390,393,395,398,406,407,408,410,415,416,418,423,425,426,427,428,429,430,],[-255,-45,294,-256,-39,-42,-38,-40,294,-152,-151,-43,-153,294,-41,-171,-170,-168,294,-154,-167,-155,294,-166,-169,-158,294,-156,294,-157,294,294,-162,-161,-159,294,294,-163,-160,294,-165,-164,]),'STRING_LITERAL':([55,62,72,77,82,98,106,107,108,112,113,115,117,119,120,122,123,131,149,151,154,156,161,167,173,178,185,186,187,188,189,190,191,192,193,194,195,196,198,200,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,256,259,260,261,267,269,270,273,274,275,281,282,284,285,286,288,290,291,302,316,317,350,353,358,359,361,362,363,364,367,368,369,371,372,373,379,380,384,385,387,389,390,392,393,395,398,404,406,407,408,409,410,411,414,415,416,418,420,423,425,426,427,428,429,430,],[-255,122,122,122,-45,-223,122,-221,200,122,-220,122,-219,122,122,-251,-218,-222,-219,122,-257,-219,122,122,-256,122,-180,-183,-181,-177,-178,-182,-184,122,-186,-187,-179,-185,122,-252,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-219,-39,-42,-38,122,-40,122,122,-152,-151,-43,-153,122,-41,122,122,122,-257,-135,-171,-170,122,-168,122,122,-154,122,-167,-155,122,122,122,122,-257,122,122,-166,-169,122,-158,122,-156,122,122,-157,122,122,122,-257,122,-162,-161,-159,122,122,122,-163,-160,122,-165,-164,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,24,25,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,63,64,65,76,78,82,87,89,90,91,92,93,94,95,96,119,162,164,166,167,168,169,170,171,172,173,198,207,208,211,213,238,239,245,249,255,269,270,273,275,282,284,285,286,288,291,295,296,300,301,319,343,344,358,359,361,362,367,369,371,389,390,393,398,407,415,416,418,426,427,429,430,],[35,35,-61,-72,-71,-58,-54,-55,-33,-29,-59,35,-34,-53,-68,-63,-52,35,-56,-174,-109,-66,-69,-32,-73,-112,-64,-31,-60,-35,-62,-65,35,-67,35,-70,-74,35,-57,-84,-255,-83,35,-111,-110,-30,35,-100,-99,35,35,-45,-46,35,-113,35,35,35,35,-90,35,35,35,35,-36,35,-47,35,35,-85,-91,-256,35,-114,35,35,-115,-117,-116,35,-101,-37,-39,-42,-38,-40,35,-152,-151,-43,-153,-41,-87,-86,-92,-93,35,-103,-102,-171,-170,35,-168,-154,-167,-155,-166,-169,-158,-156,-157,-162,-161,-159,-163,-160,-165,-164,]),'XOREQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[189,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'LSHIFTEQUAL':([99,100,101,102,103,104,105,108,109,116,118,121,122,124,125,127,128,173,197,199,200,201,203,209,210,212,218,293,305,306,307,308,311,315,376,377,378,383,412,419,],[191,-239,-249,-253,-250,-247,-237,-238,-212,-246,-224,-243,-251,-244,-236,-248,-245,-256,-254,-216,-252,-233,-232,-210,-215,-213,-214,-243,-231,-230,-229,-228,-227,-240,-217,-225,-226,-211,-234,-235,]),'RBRACKET':([62,72,99,100,101,102,103,104,105,108,109,110,111,114,116,117,118,121,122,124,125,126,127,128,129,130,148,149,161,173,197,199,200,201,203,209,210,212,216,218,266,267,298,303,305,306,307,308,309,311,315,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,338,339,348,376,377,378,382,383,402,412,419,],[-257,-257,-210,-239,-249,-253,-250,-247,-237,-238,-212,207,-191,-4,-246,213,-224,-243,-251,-244,-236,-189,-248,-245,-3,-175,252,253,-257,-256,-254,-216,-252,-233,-232,-210,-215,-213,-172,-214,354,355,-188,-176,-231,-230,-229,-228,377,-227,-240,-197,-209,-198,-196,-200,-204,-199,-195,-202,-207,-193,-192,-201,-208,-203,-205,-206,-194,386,-217,-225,-226,-173,-211,-190,-234,-235,]),}
    +_lr_action_items = {'VOID':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[6,6,-63,-74,-73,-60,-56,-57,-35,-31,-61,6,-36,-55,-70,-65,-54,6,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,6,-69,6,-72,-76,6,-59,-86,-261,-85,6,-113,-112,-32,-102,-101,6,6,6,-47,-48,6,-115,6,6,6,6,-92,6,6,6,6,-38,6,-49,6,6,-87,-93,-262,-103,-121,-120,6,6,6,6,6,-39,-41,-44,-40,-42,6,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,6,-175,-174,6,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACKET':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,62,63,67,68,69,70,74,78,81,83,84,86,90,94,96,97,110,112,115,116,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,153,155,166,167,174,176,177,178,179,180,191,197,198,218,221,222,224,228,235,239,262,267,269,270,300,302,303,310,311,314,315,323,324,325,326,329,334,338,339,360,362,364,366,367,368,388,389,391,392,399,401,428,429,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,65,-68,-263,-71,72,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,65,-102,-101,-28,-122,-124,-27,72,72,164,-50,-53,72,-115,-263,-263,72,72,-248,-125,-123,-252,-243,-255,-259,-256,-253,-241,-242,226,-251,-228,-257,-249,-240,-254,-250,164,264,72,72,-87,-262,-23,-84,-24,-83,-103,-121,-120,-260,-258,-237,-236,-150,-152,72,-140,264,-154,-148,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,72,72,-143,264,-141,-149,-151,-153,-118,-117,-229,-230,264,-142,-245,264,-238,-239,]),'WCHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,124,124,-47,124,-28,-263,-125,-227,124,-225,124,-224,124,-223,124,124,-222,-226,-263,-223,124,124,124,-262,124,124,-223,124,124,-184,-187,-185,-181,-182,-186,-188,124,-190,-191,-183,-189,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,-12,124,124,-11,-223,-41,-44,-40,124,-42,124,124,-156,-155,-45,-157,124,-43,124,124,124,-263,-139,-175,-174,124,-172,124,124,-158,124,-171,-159,124,124,124,124,-263,124,124,-11,-170,-173,124,-162,124,-160,124,124,-161,124,124,124,-263,124,-166,-165,-163,124,124,124,-167,-164,124,-169,-168,]),'FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,125,125,-47,125,-28,-263,-125,-227,125,-225,125,-224,125,-223,125,125,-222,-226,-263,-223,125,125,125,-262,125,125,-223,125,125,-184,-187,-185,-181,-182,-186,-188,125,-190,-191,-183,-189,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,-12,125,125,-11,-223,-41,-44,-40,125,-42,125,125,-156,-155,-45,-157,125,-43,125,125,125,-263,-139,-175,-174,125,-172,125,125,-158,125,-171,-159,125,125,125,125,-263,125,125,-11,-170,-173,125,-162,125,-160,125,125,-161,125,125,125,-263,125,-166,-165,-163,125,125,125,-167,-164,125,-169,-168,]),'MINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,128,128,-47,128,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,128,-225,-242,-216,-195,128,-224,128,-251,-223,-228,128,128,-257,-222,-249,-240,244,-254,-250,-226,-263,-223,128,128,128,-262,128,128,-223,128,128,-184,-187,-185,-181,-182,-186,-188,128,-190,-191,-183,-189,-260,128,-220,-258,-237,-236,128,128,128,-214,-219,128,-217,-218,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,-12,128,128,-11,-223,-41,-44,-40,128,-42,128,128,-156,-155,-45,-157,128,-43,-248,128,-235,-234,-233,-232,-231,-244,128,128,244,244,244,-200,244,244,244,-199,244,244,-197,-196,244,244,244,244,244,-198,-263,-139,-175,-174,128,-172,128,128,-158,128,-171,-159,128,128,-221,-229,-230,128,128,-215,-263,128,128,-11,-170,-173,128,-162,128,-160,128,128,-161,128,128,128,-245,-263,-238,128,-166,-165,-163,-239,128,128,128,-167,-164,128,-169,-168,]),'RPAREN':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,53,54,56,58,59,60,62,63,66,67,68,69,70,74,78,81,83,84,90,94,96,106,107,108,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,158,159,160,161,165,166,167,174,176,177,178,179,180,191,197,198,199,200,201,202,218,220,221,222,224,227,228,231,232,234,235,236,237,238,239,240,269,270,275,285,302,303,310,311,314,315,318,319,320,321,322,323,324,325,326,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,366,367,368,378,388,389,390,391,392,397,398,410,412,415,416,417,419,428,430,432,435,437,438,439,442,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,90,-86,-85,-51,-113,-112,-102,-101,-263,-28,-122,-124,-27,-145,-263,-147,-50,-53,-115,-263,-263,197,-15,198,-128,-263,-16,-248,-126,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-21,-22,269,270,-263,-145,-263,-87,-262,-23,-84,-24,-83,-103,-121,-120,-131,-1,-2,-130,-260,-220,-258,-237,-236,329,-150,-214,-219,-217,-152,334,336,-176,-263,-218,-154,-148,368,-14,-89,-88,-105,-104,-116,-119,-133,-127,-129,-180,390,-235,-234,-233,-232,-246,-231,392,395,396,-244,-144,-263,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-149,-151,-153,-13,-118,-117,-221,-229,-230,-177,-215,423,425,427,-247,428,-194,-245,-238,-263,440,-239,-263,443,446,]),'LONG':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[19,19,-63,-74,-73,-60,-56,-57,-35,-31,-61,19,-36,-55,-70,-65,-54,19,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,19,-69,19,-72,-76,19,-59,-86,-261,-85,19,-113,-112,-32,-102,-101,19,19,19,-47,-48,19,-115,19,19,19,19,-92,19,19,19,19,-38,19,-49,19,19,-87,-93,-262,-103,-121,-120,19,19,19,19,19,-39,-41,-44,-40,-42,19,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,19,-175,-174,19,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,135,135,-47,135,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,135,-225,-242,-216,-195,135,-224,135,-251,-223,-228,135,135,-257,-222,-249,-240,248,-254,-250,-226,-263,-223,135,135,135,-262,135,135,-223,135,135,-184,-187,-185,-181,-182,-186,-188,135,-190,-191,-183,-189,-260,135,-220,-258,-237,-236,135,135,135,-214,-219,135,-217,-218,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-12,135,135,-11,-223,-41,-44,-40,135,-42,135,135,-156,-155,-45,-157,135,-43,-248,135,-235,-234,-233,-232,-231,-244,135,135,248,248,248,-200,248,248,248,-199,248,248,-197,-196,248,248,248,248,248,-198,-263,-139,-175,-174,135,-172,135,135,-158,135,-171,-159,135,135,-221,-229,-230,135,135,-215,-263,135,135,-11,-170,-173,135,-162,135,-160,135,135,-161,135,135,135,-245,-263,-238,135,-166,-165,-163,-239,135,135,135,-167,-164,135,-169,-168,]),'ELLIPSIS':([204,],[319,]),'GT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,249,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,249,-202,-200,-204,249,-203,-199,-206,249,-197,-196,-205,249,249,249,249,-198,-221,-229,-230,-215,-245,-238,-239,]),'GOTO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,278,-262,-41,-44,-40,-42,278,-156,-155,-45,-157,278,-43,-175,-174,-172,278,-158,-171,-159,278,-170,-173,-162,278,-160,278,-161,278,278,-166,-165,-163,278,278,-167,-164,278,-169,-168,]),'ENUM':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[24,24,-63,-74,-73,-60,-56,-57,-35,-31,-61,24,-36,-55,-70,-65,-54,24,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,24,-69,24,-72,-76,24,-59,-86,-261,-85,24,-113,-112,-32,-102,-101,24,24,24,-47,-48,24,-115,24,24,24,24,-92,24,24,24,24,-38,24,-49,24,24,-87,-93,-262,-103,-121,-120,24,24,24,24,24,-39,-41,-44,-40,-42,24,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,24,-175,-174,24,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PERIOD':([55,112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,155,176,218,221,222,224,262,267,300,323,324,325,326,329,334,360,362,364,391,392,399,401,428,429,430,437,],[-261,-248,-252,-243,-255,-259,-256,-253,-241,-242,225,-251,-228,-257,-249,-240,-254,-250,263,-262,-260,-258,-237,-236,-140,263,-248,-235,-234,-233,-232,-231,-244,-143,263,-141,-229,-230,263,-142,-245,263,-238,-239,]),'GE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,253,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,253,-202,-200,-204,253,-203,-199,-206,253,-197,-196,-205,253,253,253,253,-198,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_DEC':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,145,145,-47,145,-28,-263,-125,-227,145,-225,145,-224,145,-223,145,145,-222,-226,-263,-223,145,145,145,-262,145,145,-223,145,145,-184,-187,-185,-181,-182,-186,-188,145,-190,-191,-183,-189,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-12,145,145,-11,-223,-41,-44,-40,145,-42,145,145,-156,-155,-45,-157,145,-43,145,145,145,-263,-139,-175,-174,145,-172,145,145,-158,145,-171,-159,145,145,145,145,-263,145,145,-11,-170,-173,145,-162,145,-160,145,145,-161,145,145,145,-263,145,-166,-165,-163,145,145,145,-167,-164,145,-169,-168,]),'ARROW':([112,118,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,221,222,224,300,323,324,325,326,329,334,391,392,428,430,437,],[-248,-252,-243,-255,-259,-256,-253,-241,-242,223,-251,-228,-257,-249,-240,-254,-250,-262,-260,-258,-237,-236,-248,-235,-234,-233,-232,-231,-244,-229,-230,-245,-238,-239,]),'HEX_FLOAT_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,148,148,-47,148,-28,-263,-125,-227,148,-225,148,-224,148,-223,148,148,-222,-226,-263,-223,148,148,148,-262,148,148,-223,148,148,-184,-187,-185,-181,-182,-186,-188,148,-190,-191,-183,-189,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-12,148,148,-11,-223,-41,-44,-40,148,-42,148,148,-156,-155,-45,-157,148,-43,148,148,148,-263,-139,-175,-174,148,-172,148,148,-158,148,-171,-159,148,148,148,148,-263,148,148,-11,-170,-173,148,-162,148,-160,148,148,-161,148,148,148,-263,148,-166,-165,-163,148,148,148,-167,-164,148,-169,-168,]),'DOUBLE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[40,40,-63,-74,-73,-60,-56,-57,-35,-31,-61,40,-36,-55,-70,-65,-54,40,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,40,-69,40,-72,-76,40,-59,-86,-261,-85,40,-113,-112,-32,-102,-101,40,40,40,-47,-48,40,-115,40,40,40,40,-92,40,40,40,40,-38,40,-49,40,40,-87,-93,-262,-103,-121,-120,40,40,40,40,40,-39,-41,-44,-40,-42,40,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,40,-175,-174,40,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MINUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,207,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'INT_CONST_OCT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,149,149,-47,149,-28,-263,-125,-227,149,-225,149,-224,149,-223,149,149,-222,-226,-263,-223,149,149,149,-262,149,149,-223,149,149,-184,-187,-185,-181,-182,-186,-188,149,-190,-191,-183,-189,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-12,149,149,-11,-223,-41,-44,-40,149,-42,149,149,-156,-155,-45,-157,149,-43,149,149,149,-263,-139,-175,-174,149,-172,149,149,-158,149,-171,-159,149,149,149,149,-263,149,149,-11,-170,-173,149,-162,149,-160,149,149,-161,149,149,149,-263,149,-166,-165,-163,149,149,149,-167,-164,149,-169,-168,]),'TIMESEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,216,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'OR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,258,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,258,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,258,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'SHORT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[2,2,-63,-74,-73,-60,-56,-57,-35,-31,-61,2,-36,-55,-70,-65,-54,2,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,2,-69,2,-72,-76,2,-59,-86,-261,-85,2,-113,-112,-32,-102,-101,2,2,2,-47,-48,2,-115,2,2,2,2,-92,2,2,2,2,-38,2,-49,2,2,-87,-93,-262,-103,-121,-120,2,2,2,2,2,-39,-41,-44,-40,-42,2,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,2,-175,-174,2,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'RETURN':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,281,-262,-41,-44,-40,-42,281,-156,-155,-45,-157,281,-43,-175,-174,-172,281,-158,-171,-159,281,-170,-173,-162,281,-160,281,-161,281,281,-166,-165,-163,281,281,-167,-164,281,-169,-168,]),'RSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,217,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RESTRICT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[32,32,-63,-74,-73,-60,-56,-57,-35,-31,-61,32,-36,-55,-70,-65,-54,32,-58,-178,-111,-68,32,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,32,-69,32,-72,-76,32,-59,-86,-261,-85,32,-113,-112,-32,-102,-101,32,32,32,-124,32,32,-47,-48,32,-115,32,32,32,32,-92,32,32,32,-125,32,32,32,-38,32,-49,32,32,-87,-93,-262,-103,-121,-120,32,32,32,32,32,-39,-41,-44,-40,-42,32,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,32,-175,-174,32,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'STATIC':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,65,66,69,78,80,82,87,89,90,104,115,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[9,9,-63,-74,-73,-60,-56,-57,-35,-31,-61,9,-36,-55,-70,-65,-54,9,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,9,-69,9,-72,-76,9,-59,-86,-261,-85,-113,-112,-32,-102,-101,105,9,-124,9,9,-47,-48,9,-115,195,-125,9,9,-38,9,-49,-87,-262,-103,-121,-120,9,-39,-41,-44,-40,-42,9,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,9,-175,-174,9,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIZEOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,127,127,-47,127,-28,-263,-125,-227,127,-225,127,-224,127,-223,127,127,-222,-226,-263,-223,127,127,127,-262,127,127,-223,127,127,-184,-187,-185,-181,-182,-186,-188,127,-190,-191,-183,-189,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,-12,127,127,-11,-223,-41,-44,-40,127,-42,127,127,-156,-155,-45,-157,127,-43,127,127,127,-263,-139,-175,-174,127,-172,127,127,-158,127,-171,-159,127,127,127,127,-263,127,127,-11,-170,-173,127,-162,127,-160,127,127,-161,127,127,127,-263,127,-166,-165,-163,127,127,127,-167,-164,127,-169,-168,]),'UNSIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[18,18,-63,-74,-73,-60,-56,-57,-35,-31,-61,18,-36,-55,-70,-65,-54,18,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,18,-69,18,-72,-76,18,-59,-86,-261,-85,18,-113,-112,-32,-102,-101,18,18,18,-47,-48,18,-115,18,18,18,18,-92,18,18,18,18,-38,18,-49,18,18,-87,-93,-262,-103,-121,-120,18,18,18,18,18,-39,-41,-44,-40,-42,18,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,18,-175,-174,18,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'UNION':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[20,20,-63,-74,-73,-60,-56,-57,-35,-31,-61,20,-36,-55,-70,-65,-54,20,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,20,-69,20,-72,-76,20,-59,-86,-261,-85,20,-113,-112,-32,-102,-101,20,20,20,-47,-48,20,-115,20,20,20,20,-92,20,20,20,20,-38,20,-49,20,20,-87,-93,-262,-103,-121,-120,20,20,20,20,20,-39,-41,-44,-40,-42,20,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,20,-175,-174,20,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'COLON':([2,3,5,6,13,18,19,25,26,27,29,32,33,35,37,39,40,43,45,46,54,56,59,60,62,63,90,94,96,97,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,174,176,177,178,179,180,187,191,197,198,218,220,221,222,224,231,232,234,238,240,286,300,302,303,305,306,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,377,388,389,390,391,392,397,398,419,428,430,437,],[-63,-74,-73,-60,-61,-70,-65,-178,-111,-68,-71,-75,-114,-66,-62,-64,-67,-69,-72,-76,-86,-85,-113,-112,-102,-101,-115,-263,-263,181,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-87,-262,-23,-84,-24,-83,309,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,375,384,-89,-88,-192,181,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,400,-210,-198,411,-118,-117,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),'$end':([0,8,11,12,15,22,31,36,38,47,61,82,169,176,272,383,],[-263,0,-35,-31,-36,-29,-34,-33,-37,-30,-32,-47,-38,-262,-39,-159,]),'WSTRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,121,123,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,123,123,-47,123,-28,-263,-125,-227,218,-259,123,-225,123,-224,123,-223,123,123,-222,-226,-263,-223,123,123,123,-262,123,123,-223,123,123,-184,-187,-185,-181,-182,-186,-188,123,-190,-191,-183,-189,-260,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,-12,123,123,-11,-223,-41,-44,-40,123,-42,123,123,-156,-155,-45,-157,123,-43,123,123,123,-263,-139,-175,-174,123,-172,123,123,-158,123,-171,-159,123,123,123,123,-263,123,123,-11,-170,-173,123,-162,123,-160,123,123,-161,123,123,123,-263,123,-166,-165,-163,123,123,123,-167,-164,123,-169,-168,]),'DIVIDE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,251,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,251,251,251,251,251,251,251,251,251,251,-197,-196,251,251,251,251,251,-198,-221,-229,-230,-215,-245,-238,-239,]),'FOR':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,283,-262,-41,-44,-40,-42,283,-156,-155,-45,-157,283,-43,-175,-174,-172,283,-158,-171,-159,283,-170,-173,-162,283,-160,283,-161,283,283,-166,-165,-163,283,283,-167,-164,283,-169,-168,]),'PLUSPLUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,137,137,-47,137,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,137,-225,-242,224,137,-224,137,-251,-223,-228,137,137,-257,-222,-249,-240,-254,-250,-226,-263,-223,137,137,137,-262,137,137,-223,137,137,-184,-187,-185,-181,-182,-186,-188,137,-190,-191,-183,-189,-260,137,-258,-237,-236,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-12,137,137,-11,-223,-41,-44,-40,137,-42,137,137,-156,-155,-45,-157,137,-43,-248,137,-235,-234,-233,-232,-231,-244,137,137,-263,-139,-175,-174,137,-172,137,137,-158,137,-171,-159,137,137,-229,-230,137,137,-263,137,137,-11,-170,-173,137,-162,137,-160,137,137,-161,137,137,137,-245,-263,-238,137,-166,-165,-163,-239,137,137,137,-167,-164,137,-169,-168,]),'EQUALS':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,29,30,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,80,83,84,86,90,102,112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,168,174,176,191,197,198,218,220,221,222,224,231,232,234,240,262,267,300,302,303,310,311,314,315,323,324,325,326,329,334,360,364,388,389,390,391,392,398,401,428,430,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-71,77,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,162,-50,-53,77,-115,192,-248,-252,209,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,162,-87,-262,-103,-121,-120,-260,-220,-258,-237,-236,-214,-219,-217,-218,-140,365,-248,-89,-88,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,-143,-141,-118,-117,-221,-229,-230,-215,-142,-245,-238,-239,]),'ELSE':([176,276,277,280,282,293,298,370,371,374,381,383,405,406,409,414,424,433,434,436,444,445,447,448,],[-262,-41,-44,-40,-42,-45,-43,-175,-174,-172,-171,-159,-170,-173,-162,-160,-161,-166,-165,441,-167,-164,-169,-168,]),'ANDEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,214,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EQ':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,255,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,255,-202,-200,-204,-208,-203,-199,-206,255,-197,-196,-205,255,-207,255,255,-198,-221,-229,-230,-215,-245,-238,-239,]),'AND':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,144,144,-47,144,-28,-263,-248,-125,-252,-227,-214,-243,-255,-259,-256,-253,-241,144,-225,-242,-216,-195,144,-224,144,-251,-223,-228,144,144,-257,-222,-249,-240,256,-254,-250,-226,-263,-223,144,144,144,-262,144,144,-223,144,144,-184,-187,-185,-181,-182,-186,-188,144,-190,-191,-183,-189,-260,144,-220,-258,-237,-236,144,144,144,-214,-219,144,-217,-218,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,-12,144,144,-11,-223,-41,-44,-40,144,-42,144,144,-156,-155,-45,-157,144,-43,-248,144,-235,-234,-233,-232,-231,-244,144,144,-201,256,-202,-200,-204,-208,-203,-199,-206,256,-197,-196,-205,256,-207,-209,256,-198,-263,-139,-175,-174,144,-172,144,144,-158,144,-171,-159,144,144,-221,-229,-230,144,144,-215,-263,144,144,-11,-170,-173,144,-162,144,-160,144,144,-161,144,144,144,-245,-263,-238,144,-166,-165,-163,-239,144,144,144,-167,-164,144,-169,-168,]),'TYPEID':([0,1,2,3,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,67,68,69,70,74,78,80,82,87,89,90,91,92,93,94,95,96,115,116,141,165,166,167,169,170,171,172,173,174,175,176,191,197,198,204,219,223,225,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[25,25,-63,-74,-73,-60,54,-56,-57,-35,-31,-61,25,-36,59,-55,-70,-65,-91,-54,25,-58,62,-178,-111,-68,-263,-71,-34,-75,-114,-90,-66,-33,-62,-37,-64,-67,25,-69,25,-72,-76,25,-59,-86,-261,-85,25,-113,-112,-32,-102,-101,25,-28,-122,-124,-27,59,25,25,-47,-48,25,-115,25,25,25,25,-92,25,-125,-123,25,25,59,25,-38,25,-49,25,25,-87,-93,-262,-103,-121,-120,25,25,323,325,25,25,25,-39,-41,-44,-40,-42,25,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,25,-175,-174,25,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LBRACE':([7,20,24,26,33,34,48,54,55,56,59,60,62,63,77,80,82,85,87,88,89,90,155,162,163,170,171,176,197,198,260,266,268,276,277,280,282,289,291,292,293,295,297,298,314,315,336,362,365,370,371,374,375,379,381,383,384,388,389,390,395,396,399,402,403,405,406,409,411,414,423,424,425,427,429,433,434,436,441,443,444,445,446,447,448,],[55,-91,55,-111,-114,-90,-263,55,-261,55,-113,-112,55,55,55,-263,-47,-7,-48,55,-8,-115,-263,55,55,55,-49,-262,-121,-120,-12,55,-11,-41,-44,-40,-42,55,-156,-155,-45,-157,55,-43,-116,-119,55,-263,-139,-175,-174,-172,55,-158,-171,-159,55,-118,-117,55,55,55,-263,55,-11,-170,-173,-162,55,-160,55,-161,55,55,-263,-166,-165,-163,55,55,-167,-164,55,-169,-168,]),'PPHASH':([0,11,12,15,22,31,36,38,61,82,169,176,272,383,],[38,-35,-31,-36,38,-34,-33,-37,-32,-47,-38,-262,-39,-159,]),'INT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[39,39,-63,-74,-73,-60,-56,-57,-35,-31,-61,39,-36,-55,-70,-65,-54,39,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,39,-69,39,-72,-76,39,-59,-86,-261,-85,39,-113,-112,-32,-102,-101,39,39,39,-47,-48,39,-115,39,39,39,39,-92,39,39,39,39,-38,39,-49,39,39,-87,-93,-262,-103,-121,-120,39,39,39,39,39,-39,-41,-44,-40,-42,39,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,39,-175,-174,39,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'SIGNED':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[43,43,-63,-74,-73,-60,-56,-57,-35,-31,-61,43,-36,-55,-70,-65,-54,43,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,43,-69,43,-72,-76,43,-59,-86,-261,-85,43,-113,-112,-32,-102,-101,43,43,43,-47,-48,43,-115,43,43,43,43,-92,43,43,43,43,-38,43,-49,43,43,-87,-93,-262,-103,-121,-120,43,43,43,43,43,-39,-41,-44,-40,-42,43,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,43,-175,-174,43,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONTINUE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,284,-262,-41,-44,-40,-42,284,-156,-155,-45,-157,284,-43,-175,-174,-172,284,-158,-171,-159,284,-170,-173,-162,284,-160,284,-161,284,284,-166,-165,-163,284,284,-167,-164,284,-169,-168,]),'NOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,152,152,-47,152,-28,-263,-125,-227,152,-225,152,-224,152,-223,152,152,-222,-226,-263,-223,152,152,152,-262,152,152,-223,152,152,-184,-187,-185,-181,-182,-186,-188,152,-190,-191,-183,-189,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-12,152,152,-11,-223,-41,-44,-40,152,-42,152,152,-156,-155,-45,-157,152,-43,152,152,152,-263,-139,-175,-174,152,-172,152,152,-158,152,-171,-159,152,152,152,152,-263,152,152,-11,-170,-173,152,-162,152,-160,152,152,-161,152,152,152,-263,152,-166,-165,-163,152,152,152,-167,-164,152,-169,-168,]),'OREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,215,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'MOD':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,259,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,259,259,259,259,259,259,259,259,259,259,-197,-196,259,259,259,259,259,-198,-221,-229,-230,-215,-245,-238,-239,]),'RSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,241,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,241,-202,-200,241,241,241,-199,241,241,-197,-196,241,241,241,241,241,-198,-221,-229,-230,-215,-245,-238,-239,]),'DEFAULT':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,286,-262,-41,-44,-40,-42,286,-156,-155,-45,-157,286,-43,-175,-174,-172,286,-158,-171,-159,286,-170,-173,-162,286,-160,286,-161,286,286,-166,-165,-163,286,286,-167,-164,286,-169,-168,]),'CHAR':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[37,37,-63,-74,-73,-60,-56,-57,-35,-31,-61,37,-36,-55,-70,-65,-54,37,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,37,-69,37,-72,-76,37,-59,-86,-261,-85,37,-113,-112,-32,-102,-101,37,37,37,-47,-48,37,-115,37,37,37,37,-92,37,37,37,37,-38,37,-49,37,37,-87,-93,-262,-103,-121,-120,37,37,37,37,37,-39,-41,-44,-40,-42,37,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,37,-175,-174,37,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'WHILE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,382,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,287,-262,-41,-44,-40,-42,287,-156,-155,-45,-157,287,-43,-175,-174,-172,287,-158,-171,413,-159,287,-170,-173,-162,287,-160,287,-161,287,287,-166,-165,-163,287,287,-167,-164,287,-169,-168,]),'DIVEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,206,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'EXTERN':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[10,10,-63,-74,-73,-60,-56,-57,-35,-31,-61,10,-36,-55,-70,-65,-54,10,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,10,-69,10,-72,-76,10,-59,-86,-261,-85,-113,-112,-32,-102,-101,10,10,10,-47,-48,10,-115,10,10,-38,10,-49,-87,-262,-103,-121,-120,10,-39,-41,-44,-40,-42,10,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,10,-175,-174,10,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CASE':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,288,-262,-41,-44,-40,-42,288,-156,-155,-45,-157,288,-43,-175,-174,-172,288,-158,-171,-159,288,-170,-173,-162,288,-160,288,-161,288,288,-166,-165,-163,288,288,-167,-164,288,-169,-168,]),'LAND':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,254,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,254,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'REGISTER':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[17,17,-63,-74,-73,-60,-56,-57,-35,-31,-61,17,-36,-55,-70,-65,-54,17,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,17,-69,17,-72,-76,17,-59,-86,-261,-85,-113,-112,-32,-102,-101,17,17,17,-47,-48,17,-115,17,17,-38,17,-49,-87,-262,-103,-121,-120,17,-39,-41,-44,-40,-42,17,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,17,-175,-174,17,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'MODEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,208,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'NE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,246,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,246,-202,-200,-204,-208,-203,-199,-206,246,-197,-196,-205,246,-207,246,246,-198,-221,-229,-230,-215,-245,-238,-239,]),'SWITCH':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,290,-262,-41,-44,-40,-42,290,-156,-155,-45,-157,290,-43,-175,-174,-172,290,-158,-171,-159,290,-170,-173,-162,290,-160,290,-161,290,290,-166,-165,-163,290,290,-167,-164,290,-169,-168,]),'INT_CONST_HEX':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,138,138,-47,138,-28,-263,-125,-227,138,-225,138,-224,138,-223,138,138,-222,-226,-263,-223,138,138,138,-262,138,138,-223,138,138,-184,-187,-185,-181,-182,-186,-188,138,-190,-191,-183,-189,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-12,138,138,-11,-223,-41,-44,-40,138,-42,138,138,-156,-155,-45,-157,138,-43,138,138,138,-263,-139,-175,-174,138,-172,138,138,-158,138,-171,-159,138,138,138,138,-263,138,138,-11,-170,-173,138,-162,138,-160,138,138,-161,138,138,138,-263,138,-166,-165,-163,138,138,138,-167,-164,138,-169,-168,]),'_COMPLEX':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[27,27,-63,-74,-73,-60,-56,-57,-35,-31,-61,27,-36,-55,-70,-65,-54,27,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,27,-69,27,-72,-76,27,-59,-86,-261,-85,27,-113,-112,-32,-102,-101,27,27,27,-47,-48,27,-115,27,27,27,27,-92,27,27,27,27,-38,27,-49,27,27,-87,-93,-262,-103,-121,-120,27,27,27,27,27,-39,-41,-44,-40,-42,27,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,27,-175,-174,27,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'PLUSEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,211,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'STRUCT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[34,34,-63,-74,-73,-60,-56,-57,-35,-31,-61,34,-36,-55,-70,-65,-54,34,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,34,-69,34,-72,-76,34,-59,-86,-261,-85,34,-113,-112,-32,-102,-101,34,34,34,-47,-48,34,-115,34,34,34,34,-92,34,34,34,34,-38,34,-49,34,34,-87,-93,-262,-103,-121,-120,34,34,34,34,34,-39,-41,-44,-40,-42,34,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,34,-175,-174,34,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'CONDOP':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,257,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'BREAK':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,294,-262,-41,-44,-40,-42,294,-156,-155,-45,-157,294,-43,-175,-174,-172,294,-158,-171,-159,294,-170,-173,-162,294,-160,294,-161,294,294,-166,-165,-163,294,294,-167,-164,294,-169,-168,]),'VOLATILE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[46,46,-63,-74,-73,-60,-56,-57,-35,-31,-61,46,-36,-55,-70,-65,-54,46,-58,-178,-111,-68,46,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,46,-69,46,-72,-76,46,-59,-86,-261,-85,46,-113,-112,-32,-102,-101,46,46,46,-124,46,46,-47,-48,46,-115,46,46,46,46,-92,46,46,46,-125,46,46,46,-38,46,-49,46,46,-87,-93,-262,-103,-121,-120,46,46,46,46,46,-39,-41,-44,-40,-42,46,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,46,-175,-174,46,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INLINE':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[49,49,-63,-74,-73,-60,-56,-57,-35,-31,-61,49,-36,-55,-70,-65,-54,49,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,49,-69,49,-72,-76,49,-59,-86,-261,-85,-113,-112,-32,-102,-101,49,49,49,-47,-48,49,-115,49,49,-38,49,-49,-87,-262,-103,-121,-120,49,-39,-41,-44,-40,-42,49,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,49,-175,-174,49,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'INT_CONST_BIN':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,118,118,-47,118,-28,-263,-125,-227,118,-225,118,-224,118,-223,118,118,-222,-226,-263,-223,118,118,118,-262,118,118,-223,118,118,-184,-187,-185,-181,-182,-186,-188,118,-190,-191,-183,-189,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,-12,118,118,-11,-223,-41,-44,-40,118,-42,118,118,-156,-155,-45,-157,118,-43,118,118,118,-263,-139,-175,-174,118,-172,118,118,-158,118,-171,-159,118,118,118,118,-263,118,118,-11,-170,-173,118,-162,118,-160,118,118,-161,118,118,118,-263,118,-166,-165,-163,118,118,118,-167,-164,118,-169,-168,]),'DO':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,297,-262,-41,-44,-40,-42,297,-156,-155,-45,-157,297,-43,-175,-174,-172,297,-158,-171,-159,297,-170,-173,-162,297,-160,297,-161,297,297,-166,-165,-163,297,297,-167,-164,297,-169,-168,]),'LNOT':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,119,119,-47,119,-28,-263,-125,-227,119,-225,119,-224,119,-223,119,119,-222,-226,-263,-223,119,119,119,-262,119,119,-223,119,119,-184,-187,-185,-181,-182,-186,-188,119,-190,-191,-183,-189,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,-12,119,119,-11,-223,-41,-44,-40,119,-42,119,119,-156,-155,-45,-157,119,-43,119,119,119,-263,-139,-175,-174,119,-172,119,119,-158,119,-171,-159,119,119,119,119,-263,119,119,-11,-170,-173,119,-162,119,-160,119,119,-161,119,119,119,-263,119,-166,-165,-163,119,119,119,-167,-164,119,-169,-168,]),'CONST':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,65,66,67,69,78,80,82,87,89,90,91,92,93,94,95,96,104,105,115,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[3,3,-63,-74,-73,-60,-56,-57,-35,-31,-61,3,-36,-55,-70,-65,-54,3,-58,-178,-111,-68,3,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,3,-69,3,-72,-76,3,-59,-86,-261,-85,3,-113,-112,-32,-102,-101,3,3,3,-124,3,3,-47,-48,3,-115,3,3,3,3,-92,3,3,3,-125,3,3,3,-38,3,-49,3,3,-87,-93,-262,-103,-121,-120,3,3,3,3,3,-39,-41,-44,-40,-42,3,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,3,-175,-174,3,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,242,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-221,-229,-230,-215,-245,-238,-239,]),'CHAR_CONST':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,122,122,-47,122,-28,-263,-125,-227,122,-225,122,-224,122,-223,122,122,-222,-226,-263,-223,122,122,122,-262,122,122,-223,122,122,-184,-187,-185,-181,-182,-186,-188,122,-190,-191,-183,-189,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,-12,122,122,-11,-223,-41,-44,-40,122,-42,122,122,-156,-155,-45,-157,122,-43,122,122,122,-263,-139,-175,-174,122,-172,122,122,-158,122,-171,-159,122,122,122,122,-263,122,122,-11,-170,-173,122,-162,122,-160,122,122,-161,122,122,122,-263,122,-166,-165,-163,122,122,122,-167,-164,122,-169,-168,]),'LSHIFT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,243,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,243,-202,-200,243,243,243,-199,243,243,-197,-196,243,243,243,243,243,-198,-221,-229,-230,-215,-245,-238,-239,]),'RBRACE':([55,82,93,95,100,101,102,112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,155,156,170,172,173,175,176,188,189,190,218,220,221,222,224,231,232,234,240,261,265,268,276,277,280,282,289,291,292,293,295,296,298,299,305,307,308,312,313,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,362,363,370,371,374,379,381,383,390,391,392,398,404,405,406,409,414,418,419,420,424,428,429,430,433,434,436,437,444,445,447,448,],[-261,-47,176,-92,-106,176,-109,-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-263,-134,-263,176,176,-93,-262,176,176,-107,-260,-220,-258,-237,-236,-214,-219,-217,-218,176,-20,-19,-41,-44,-40,-42,-6,-156,-155,-45,-157,-5,-43,176,-192,-94,-95,-108,-110,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,176,-137,-175,-174,-172,-158,-171,-159,-221,-229,-230,-215,-136,-170,-173,-162,-160,176,-194,-138,-161,-245,176,-238,-166,-165,-163,-239,-167,-164,-169,-168,]),'_BOOL':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[13,13,-63,-74,-73,-60,-56,-57,-35,-31,-61,13,-36,-55,-70,-65,-54,13,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,13,-69,13,-72,-76,13,-59,-86,-261,-85,13,-113,-112,-32,-102,-101,13,13,13,-47,-48,13,-115,13,13,13,13,-92,13,13,13,13,-38,13,-49,13,13,-87,-93,-262,-103,-121,-120,13,13,13,13,13,-39,-41,-44,-40,-42,13,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,13,-175,-174,13,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'LE':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,245,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,245,-202,-200,-204,245,-203,-199,-206,245,-197,-196,-205,245,245,245,245,-198,-221,-229,-230,-215,-245,-238,-239,]),'SEMI':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52,54,55,56,58,59,60,61,62,63,67,68,69,70,71,73,74,75,76,79,80,81,82,83,84,86,90,94,96,97,112,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,169,170,174,176,177,178,179,180,182,183,184,185,186,187,191,197,198,205,218,220,221,222,224,228,231,232,234,235,238,240,269,270,271,272,276,277,279,280,281,282,284,285,289,291,292,293,294,295,296,297,298,300,302,303,304,305,310,311,314,315,321,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,359,366,367,368,369,370,371,372,373,374,375,378,379,381,383,384,386,387,388,389,390,391,392,397,398,404,405,406,407,408,409,411,414,419,421,422,423,424,425,427,428,430,431,433,434,436,437,440,441,443,444,445,446,447,448,],[15,-263,-63,-74,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,15,-58,-178,-111,-68,-263,-71,-263,-34,-75,-114,-66,-33,-62,-37,-64,-67,82,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-113,-112,-32,-102,-101,-28,-122,-124,-27,-18,-46,-145,-77,-17,-80,-81,-147,-47,-50,-53,-263,-115,-263,-263,-263,-248,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-38,-263,-87,-262,-23,-84,-24,-83,-26,307,-96,308,-25,-98,-103,-121,-120,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,-176,-218,-154,-148,-82,-39,-41,-44,370,-40,371,-42,374,-14,-263,-156,-155,-45,381,-157,-13,-263,-43,-248,-89,-88,-100,-192,-105,-104,-116,-119,-180,-235,-234,-233,-232,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,-135,-149,-151,-153,405,-175,-174,406,-263,-172,-263,-13,-158,-171,-159,-263,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,-170,-173,421,-263,-162,-263,-160,-194,-263,432,-263,-161,-263,-263,-245,-238,438,-166,-165,-163,-239,444,-263,-263,-167,-164,-263,-169,-168,]),'LT':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,247,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,247,-202,-200,-204,247,-203,-199,-206,247,-197,-196,-205,247,247,247,247,-198,-221,-229,-230,-215,-245,-238,-239,]),'COMMA':([1,2,3,5,6,9,10,13,14,17,18,19,21,23,25,26,27,28,29,32,33,35,37,39,40,42,43,44,45,46,49,50,51,52,54,56,58,59,60,62,63,67,68,69,70,71,74,75,79,80,81,83,84,90,94,96,100,101,102,109,110,111,112,113,114,115,116,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,151,153,154,156,166,168,174,176,177,178,179,180,182,184,187,188,189,190,191,197,198,199,200,201,202,205,218,220,221,222,224,228,231,232,234,235,236,238,239,240,265,269,270,271,285,300,302,303,304,305,310,311,312,313,314,315,318,320,321,323,324,325,326,327,328,329,330,331,334,337,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,363,366,367,368,372,386,387,388,389,390,391,392,397,398,404,410,412,415,416,418,419,420,428,430,435,437,],[-263,-63,-74,-73,-60,-56,-57,-61,-263,-55,-70,-65,-54,-58,-178,-111,-68,-263,-71,-75,-114,-66,-62,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-85,-51,-113,-112,-102,-101,-28,-122,-124,-27,117,-145,-77,-80,-81,-147,-50,-53,-115,-263,-263,-106,190,-109,-128,-263,203,-248,204,-132,-125,-123,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,-193,-254,-250,-179,-146,-79,-134,-145,-81,-87,-262,-23,-84,-24,-83,306,-96,-98,190,190,-107,-103,-121,-120,-131,-1,-2,-130,-78,-260,-220,-258,-237,-236,-150,-214,-219,-217,-152,335,-176,-263,-218,362,-154,-148,-82,335,-248,-89,-88,-100,-192,-105,-104,-108,-110,-116,-119,-133,-129,-180,-235,-234,-233,-232,335,-246,-231,393,394,-244,-144,-145,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,335,-210,-198,-135,-137,-149,-151,-153,335,-97,-99,-118,-117,-221,-229,-230,-177,-215,-136,335,335,335,-247,429,-194,-138,-245,-238,335,-239,]),'OFFSETOF':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,133,133,-47,133,-28,-263,-125,-227,133,-225,133,-224,133,-223,133,133,-222,-226,-263,-223,133,133,133,-262,133,133,-223,133,133,-184,-187,-185,-181,-182,-186,-188,133,-190,-191,-183,-189,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-12,133,133,-11,-223,-41,-44,-40,133,-42,133,133,-156,-155,-45,-157,133,-43,133,133,133,-263,-139,-175,-174,133,-172,133,133,-158,133,-171,-159,133,133,133,133,-263,133,133,-11,-170,-173,133,-162,133,-160,133,133,-161,133,133,133,-263,133,-166,-165,-163,133,133,133,-167,-164,133,-169,-168,]),'TYPEDEF':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[23,23,-63,-74,-73,-60,-56,-57,-35,-31,-61,23,-36,-55,-70,-65,-54,23,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,23,-69,23,-72,-76,23,-59,-86,-261,-85,-113,-112,-32,-102,-101,23,23,23,-47,-48,23,-115,23,23,-38,23,-49,-87,-262,-103,-121,-120,23,-39,-41,-44,-40,-42,23,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,23,-175,-174,23,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOR':([112,118,120,121,122,123,124,125,126,129,130,132,138,140,143,145,146,147,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,390,391,392,398,428,430,437,],[-248,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,-195,-251,-228,-257,-249,-240,250,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-201,250,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,250,-207,-209,250,-198,-221,-229,-230,-215,-245,-238,-239,]),'AUTO':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,59,60,61,62,63,66,78,80,82,87,89,90,165,167,169,170,171,174,176,191,197,198,204,272,276,277,280,282,289,291,292,293,295,298,302,303,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[21,21,-63,-74,-73,-60,-56,-57,-35,-31,-61,21,-36,-55,-70,-65,-54,21,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,21,-69,21,-72,-76,21,-59,-86,-261,-85,-113,-112,-32,-102,-101,21,21,21,-47,-48,21,-115,21,21,-38,21,-49,-87,-262,-103,-121,-120,21,-39,-41,-44,-40,-42,21,-156,-155,-45,-157,-43,-89,-88,-105,-104,-116,-119,21,-175,-174,21,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'TIMES':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,27,28,29,30,31,32,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,65,67,68,69,70,72,77,78,82,83,84,86,94,96,97,103,104,105,110,112,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,134,135,137,138,139,140,141,142,143,144,145,146,147,148,149,152,155,157,162,164,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,227,230,231,232,233,234,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,272,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,302,303,306,309,310,311,323,324,325,326,329,334,335,336,338,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,362,365,370,371,373,374,375,376,379,380,381,383,384,385,390,391,392,393,395,398,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[28,-263,-63,-74,28,-73,-60,-56,-57,-35,-31,-61,-263,-36,-55,-70,-65,-54,28,-58,-178,-68,-263,-71,28,-34,-75,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,-263,-28,28,-124,-27,139,157,28,-47,-50,-53,28,-263,-263,28,194,-28,-263,28,-248,-125,28,-252,-227,-214,-243,-255,-259,-256,-253,-241,157,-225,-242,-216,-195,157,-224,157,-251,-223,-228,157,157,-257,-222,-249,-240,252,-254,-250,-226,-263,-223,157,274,28,-38,157,-87,-262,-23,-84,-24,-83,157,-103,157,-223,157,157,-184,-187,-185,-181,-182,-186,-188,157,-190,-191,-183,-189,-260,157,-220,-258,-237,-236,157,157,157,-214,-219,157,-217,28,-218,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,157,-12,157,157,-11,-39,-223,-41,-44,-40,157,-42,157,157,-156,-155,-45,-157,157,-43,-248,-89,-88,28,157,-105,-104,-235,-234,-233,-232,-231,-244,157,157,28,252,252,252,252,252,252,252,252,252,252,-197,-196,252,252,252,252,252,-198,-263,-139,-175,-174,157,-172,157,157,-158,157,-171,-159,157,157,-221,-229,-230,157,157,-215,-263,157,157,-11,-170,-173,157,-162,157,-160,157,157,-161,157,157,157,-245,-263,-238,157,-166,-165,-163,-239,157,157,157,-167,-164,157,-169,-168,]),'LPAREN':([0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,60,61,62,63,65,67,68,69,70,72,74,77,78,81,82,83,84,86,90,94,96,97,103,104,105,110,112,115,116,117,118,119,121,122,123,124,125,126,127,128,129,130,133,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,153,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,191,192,194,195,196,197,198,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,228,230,233,235,239,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,269,270,272,274,276,277,280,281,282,283,287,288,289,290,291,292,293,295,297,298,300,301,302,303,306,309,310,311,314,315,323,324,325,326,329,334,335,336,338,339,362,365,366,367,368,370,371,373,374,375,376,379,380,381,383,384,385,388,389,391,392,393,395,399,400,402,403,405,406,408,409,411,413,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[4,-263,-63,-74,4,-73,-60,-56,-57,-35,-31,-61,-263,-36,4,-55,-70,-65,-54,4,-58,-178,66,-68,-263,-71,78,-34,-75,-114,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,66,-32,-102,-101,-263,-28,-122,-124,-27,141,78,141,78,165,-47,-50,-53,167,-115,-263,-263,167,141,-28,-263,78,-248,-125,-123,4,-252,-227,-243,-255,-259,-256,-253,-241,219,-225,-242,227,229,230,-224,233,-251,-223,-228,141,233,-257,-222,-249,-240,-254,-250,-226,165,-263,-223,141,141,167,167,-38,141,-87,-262,-23,-84,-24,-83,230,-103,230,-223,141,141,-121,-120,-184,-187,-185,-181,-182,-186,-188,141,-190,-191,-183,-189,-260,141,-258,-237,-236,141,141,-150,141,141,-152,338,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,141,230,230,-12,230,141,-11,-154,-148,-39,-223,-41,-44,-40,141,-42,373,376,230,141,380,-156,-155,-45,-157,141,-43,-248,385,-89,-88,4,230,-105,-104,-116,-119,-235,-234,-233,-232,-231,-244,141,230,338,338,-263,-139,-149,-151,-153,-175,-174,141,-172,141,141,-158,141,-171,-159,141,141,-118,-117,-229,-230,141,230,-263,230,141,-11,-170,-173,141,-162,141,426,-160,141,141,-161,141,141,141,-245,-263,-238,141,-166,-165,-163,-239,141,141,141,-167,-164,141,-169,-168,]),'MINUSMINUS':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,112,115,118,119,121,122,123,124,125,126,127,128,129,130,134,135,137,138,139,140,141,142,143,144,145,146,148,149,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,224,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,300,309,323,324,325,326,329,334,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,391,392,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,428,429,430,432,433,434,436,437,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,142,142,-47,142,-28,-263,-248,-125,-252,-227,-243,-255,-259,-256,-253,-241,142,-225,-242,222,142,-224,142,-251,-223,-228,142,142,-257,-222,-249,-240,-254,-250,-226,-263,-223,142,142,142,-262,142,142,-223,142,142,-184,-187,-185,-181,-182,-186,-188,142,-190,-191,-183,-189,-260,142,-258,-237,-236,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,-12,142,142,-11,-223,-41,-44,-40,142,-42,142,142,-156,-155,-45,-157,142,-43,-248,142,-235,-234,-233,-232,-231,-244,142,142,-263,-139,-175,-174,142,-172,142,142,-158,142,-171,-159,142,142,-229,-230,142,142,-263,142,142,-11,-170,-173,142,-162,142,-160,142,142,-161,142,142,142,-245,-263,-238,142,-166,-165,-163,-239,142,142,142,-167,-164,142,-169,-168,]),'ID':([0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,49,50,51,52,54,55,56,58,61,62,63,64,65,66,67,68,69,70,72,74,77,78,82,83,84,86,94,96,97,98,99,103,104,105,110,115,116,117,119,127,128,134,135,137,139,141,142,144,152,155,157,162,164,166,167,169,170,174,176,177,178,179,180,181,190,191,192,194,195,196,203,206,207,208,209,210,211,212,213,214,215,216,217,219,223,225,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,263,264,266,268,272,274,276,277,278,280,281,282,288,289,291,292,293,295,297,298,302,303,306,309,310,311,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,394,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[33,-263,-63,-74,33,-73,-60,56,-56,-57,-35,-31,-61,-263,-36,33,-55,-70,-65,-91,-54,33,-58,63,-178,-68,-263,-71,33,-34,-75,-90,-66,-33,-62,-37,-64,-67,-263,-69,-263,-72,-76,-59,-52,-9,-10,-86,-261,-85,-51,-32,-102,-101,102,-263,112,-28,-122,-124,-27,112,33,112,33,-47,-50,-53,33,-263,-263,33,102,102,112,-28,-263,33,-125,-123,33,-227,112,-225,112,-224,112,-223,112,112,-222,-226,-263,-223,112,112,33,33,-38,300,-87,-262,-23,-84,-24,-83,112,102,-103,112,-223,112,112,112,-184,-187,-185,-181,-182,-186,-188,112,-190,-191,-183,-189,112,324,326,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,-12,112,112,112,-11,-39,-223,-41,-44,369,-40,112,-42,112,300,-156,-155,-45,-157,300,-43,-89,-88,33,112,-105,-104,112,112,-263,-139,-175,-174,112,-172,300,112,-158,112,-171,-159,300,112,112,112,112,-263,112,112,-11,-170,-173,112,-162,300,-160,112,300,-161,300,112,300,-263,112,-166,-165,-163,112,300,300,-167,-164,300,-169,-168,]),'IF':([55,82,170,176,276,277,280,282,289,291,292,293,295,297,298,370,371,374,375,379,381,383,384,405,406,409,411,414,423,424,425,427,433,434,436,441,443,444,445,446,447,448,],[-261,-47,301,-262,-41,-44,-40,-42,301,-156,-155,-45,-157,301,-43,-175,-174,-172,301,-158,-171,-159,301,-170,-173,-162,301,-160,301,-161,301,301,-166,-165,-163,301,301,-167,-164,301,-169,-168,]),'STRING_LITERAL':([3,32,46,55,65,67,69,70,72,77,82,103,104,105,115,119,127,128,129,134,135,137,139,141,142,143,144,152,155,157,162,164,170,176,181,192,194,195,196,206,207,208,209,210,211,212,213,214,215,216,217,219,221,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,264,266,268,274,276,277,280,281,282,288,289,291,292,293,295,297,298,309,335,336,362,365,370,371,373,374,375,376,379,380,381,383,384,385,393,395,399,400,402,403,405,406,408,409,411,414,421,423,424,425,426,427,429,432,433,434,436,438,441,443,444,445,446,447,448,],[-74,-75,-76,-261,-263,-28,-124,-27,143,143,-47,143,-28,-263,-125,-227,143,-225,221,143,-224,143,-223,143,143,-257,-222,-226,-263,-223,143,143,143,-262,143,143,-223,143,143,-184,-187,-185,-181,-182,-186,-188,143,-190,-191,-183,-189,143,-258,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,-12,143,143,-11,-223,-41,-44,-40,143,-42,143,143,-156,-155,-45,-157,143,-43,143,143,143,-263,-139,-175,-174,143,-172,143,143,-158,143,-171,-159,143,143,143,143,-263,143,143,-11,-170,-173,143,-162,143,-160,143,143,-161,143,143,143,-263,143,-166,-165,-163,143,143,143,-167,-164,143,-169,-168,]),'FLOAT':([0,1,2,3,5,6,9,10,11,12,13,14,15,17,18,19,21,22,23,25,26,27,29,31,32,33,35,36,37,38,39,40,42,43,44,45,46,48,49,54,55,56,57,59,60,61,62,63,66,78,80,82,87,89,90,91,92,93,94,95,96,141,165,167,169,170,171,172,173,174,175,176,191,197,198,204,219,229,230,233,272,276,277,280,282,289,291,292,293,295,298,302,303,307,308,310,311,314,315,338,370,371,373,374,379,381,383,388,389,405,406,409,414,424,433,434,436,444,445,447,448,],[35,35,-63,-74,-73,-60,-56,-57,-35,-31,-61,35,-36,-55,-70,-65,-54,35,-58,-178,-111,-68,-71,-34,-75,-114,-66,-33,-62,-37,-64,-67,35,-69,35,-72,-76,35,-59,-86,-261,-85,35,-113,-112,-32,-102,-101,35,35,35,-47,-48,35,-115,35,35,35,35,-92,35,35,35,35,-38,35,-49,35,35,-87,-93,-262,-103,-121,-120,35,35,35,35,35,-39,-41,-44,-40,-42,35,-156,-155,-45,-157,-43,-89,-88,-94,-95,-105,-104,-116,-119,35,-175,-174,35,-172,-158,-171,-159,-118,-117,-170,-173,-162,-160,-161,-166,-165,-163,-167,-164,-169,-168,]),'XOREQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,210,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'LSHIFTEQUAL':([112,118,120,121,122,123,124,125,126,129,130,138,140,143,145,146,148,149,176,218,220,221,222,224,231,232,234,240,300,323,324,325,326,329,334,390,391,392,398,428,430,437,],[-248,-252,212,-243,-255,-259,-256,-253,-241,-242,-216,-251,-228,-257,-249,-240,-254,-250,-262,-260,-220,-258,-237,-236,-214,-219,-217,-218,-248,-235,-234,-233,-232,-231,-244,-221,-229,-230,-215,-245,-238,-239,]),'RBRACKET':([3,32,46,65,69,70,72,103,104,112,115,118,120,121,122,123,124,125,126,129,130,131,132,136,138,139,140,143,145,146,147,148,149,150,151,164,176,193,194,218,220,221,222,224,231,232,234,238,240,273,274,305,316,317,321,323,324,325,326,327,329,334,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,390,391,392,397,398,419,428,430,437,],[-74,-75,-76,-263,-124,-27,-263,-263,-28,-248,-125,-252,-214,-243,-255,-259,-256,-253,-241,-242,-216,228,-195,-4,-251,235,-228,-257,-249,-240,-193,-254,-250,-3,-179,-263,-262,314,315,-260,-220,-258,-237,-236,-214,-219,-217,-176,-218,366,367,-192,388,389,-180,-235,-234,-233,-232,391,-231,-244,-201,-213,-202,-200,-204,-208,-203,-199,-206,-211,-197,-196,-205,-212,-207,-209,-210,-198,401,-221,-229,-230,-177,-215,-194,-245,-238,-239,]),}
     
     _lr_action = { }
     for _k, _v in _lr_action_items.items():
    @@ -16,7 +16,7 @@
           _lr_action[_x][_k] = _y
     del _lr_action_items
     
    -_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([63,],[132,]),'parameter_declaration':([63,78,162,164,245,319,],[135,135,135,135,342,135,]),'selection_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[291,291,291,291,291,291,291,291,291,291,291,291,]),'constant':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,]),'unary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[99,99,99,199,209,212,99,218,99,99,99,209,99,99,99,99,99,99,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,99,209,209,209,209,99,99,209,99,99,209,99,209,99,99,99,99,99,99,99,209,209,99,99,99,99,99,99,99,99,99,99,99,99,99,]),'conditional_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,235,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[130,130,130,130,130,130,130,298,130,130,130,130,130,130,130,298,298,130,130,298,130,130,298,130,130,130,130,130,130,130,130,402,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'brace_close':([93,143,169,170,246,247,262,292,350,401,411,],[171,249,295,296,343,344,351,371,388,412,419,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,]),'abstract_declarator_opt':([136,217,],[240,318,]),'iteration_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[270,270,270,270,270,270,270,270,270,270,270,270,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,169,170,]),'block_item_list_opt':([167,],[292,]),'enumerator':([66,140,141,248,],[142,142,142,345,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,136,164,217,319,],[79,160,79,182,241,160,241,160,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,94,94,94,14,14,14,14,]),'designation':([154,350,384,411,],[256,256,256,256,]),'compound_statement':([88,152,167,282,290,363,372,395,406,408,410,423,425,428,],[166,255,275,275,275,275,275,275,275,275,275,275,275,275,]),'pointer':([0,4,22,30,68,78,86,97,136,147,164,217,299,319,],[16,16,16,74,146,74,163,163,74,16,163,320,16,320,]),'type_name':([119,198,208,211,],[215,304,313,314,]),'unified_string_literal':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,]),'postfix_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,]),'assignment_expression_opt':([62,72,161,],[110,148,266,]),'designation_opt':([154,350,384,411,],[260,387,260,387,]),'expression_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[269,269,269,269,269,269,269,269,269,269,269,269,]),'unary_operator':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,]),'cast_expression':([62,72,77,112,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[111,111,111,210,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,383,111,111,111,111,111,111,111,111,111,111,111,111,111,111,]),'init_declarator':([30,86,147,],[80,80,251,]),'struct_declarator_list':([97,],[179,]),'brace_open':([7,26,54,56,64,65,77,88,151,152,167,260,282,290,317,363,372,376,380,381,387,395,406,408,410,423,425,428,],[57,66,91,92,140,141,154,167,154,167,167,154,167,167,384,167,167,384,384,384,154,167,167,167,167,167,167,167,]),'assignment_operator':([99,],[192,]),'struct_or_union':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([62,63,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,244,250,258,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[125,139,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,340,125,347,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,]),'struct_declaration':([57,91,92,93,169,170,],[95,95,95,172,172,172,]),'assignment_expression':([62,72,77,119,151,161,167,192,198,205,206,208,211,235,260,274,282,290,316,361,363,364,368,372,373,379,387,392,395,404,406,408,409,410,414,420,423,425,428,],[114,114,155,216,155,114,216,303,216,216,310,216,216,216,155,216,216,216,382,216,216,216,216,216,216,400,155,216,216,216,216,216,216,216,216,216,216,216,216,]),'parameter_type_list':([63,78,162,164,319,],[134,158,158,158,158,]),'type_qualifier_list_opt':([28,],[68,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,136,147,163,164,299,],[25,25,60,25,25,60,25,25,25,25,25,60,25,25,]),'type_qualifier_list':([28,],[67,]),'designator':([154,263,350,384,411,],[257,352,257,257,257,]),'argument_expression_list':([206,],[312,]),'initializer':([77,151,260,387,],[153,254,349,403,]),'specifier_qualifier_list_opt':([94,96,],[175,177,]),'constant_expression':([178,250,259,281,302,],[297,346,348,365,375,]),'expression_opt':([167,282,290,361,363,372,392,395,404,406,408,410,414,420,423,425,428,],[272,272,272,391,272,272,405,272,413,272,272,272,421,424,272,272,272,]),'primary_expression':([62,72,77,106,112,115,119,120,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,317,361,363,364,368,372,373,379,380,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,118,]),'declaration_specifiers':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[30,52,52,30,52,52,86,136,86,136,86,136,136,86,136,86,136,86,]),'declaration':([0,22,48,76,89,167,282,361,],[31,31,87,87,168,285,285,392,]),'struct_declarator_list_opt':([97,],[180,]),'identifier_list':([63,],[137,]),'typedef_name':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,162,164,319,],[159,268,159,159,]),'jump_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[286,286,286,286,286,286,286,286,286,286,286,286,]),'declaration_list_opt':([48,76,],[88,152,]),'struct_declarator':([97,299,],[181,374,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([62,72,77,119,151,161,167,178,192,198,205,206,208,211,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,250,259,260,274,281,282,290,302,316,361,363,364,368,372,373,379,385,387,392,395,404,406,408,409,410,414,420,423,425,428,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,126,338,339,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'parameter_list':([63,78,162,164,319,],[138,138,138,138,138,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,63,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,76,89,167,282,361,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,63,67,76,78,89,91,92,93,94,96,119,162,164,167,169,170,198,208,211,245,282,319,361,],[42,42,42,42,69,42,42,42,96,42,145,42,42,42,96,96,96,96,96,96,42,42,42,96,96,96,96,96,42,42,42,42,]),'statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[284,284,370,393,398,407,415,416,418,427,429,430,]),'enumerator_list':([66,140,141,],[143,246,247,]),'labeled_statement':([167,282,290,363,372,395,406,408,410,423,425,428,],[273,273,273,273,273,273,273,273,273,273,273,273,]),'function_specifier':([0,1,14,22,42,44,48,63,76,78,89,162,164,167,245,282,319,361,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,119,169,170,198,208,211,],[97,97,97,97,176,176,217,97,97,217,217,217,]),'block_item':([167,282,],[288,367,]),'block_item_list':([167,],[282,]),'empty':([0,1,14,28,30,42,44,48,62,63,72,76,78,86,94,96,97,136,154,161,162,164,167,217,282,290,319,350,361,363,372,384,392,395,404,406,408,410,411,414,420,423,425,428,],[47,51,51,70,75,51,51,85,129,133,129,85,157,75,174,174,183,243,261,129,157,157,289,243,366,366,157,261,366,366,366,261,366,366,366,366,366,366,261,366,366,366,366,366,]),'translation_unit':([0,],[22,]),'initializer_list':([154,384,],[262,401,]),'declarator':([0,4,22,30,78,86,97,136,147,164,299,],[48,53,48,76,53,165,184,242,165,53,184,]),'direct_abstract_declarator':([30,74,78,86,97,136,163,164,217,319,320,],[81,150,81,81,81,81,150,81,81,81,150,]),'designator_list':([154,350,384,411,],[263,263,263,263,]),'declaration_list':([48,76,],[89,89,]),'expression':([119,167,198,205,208,211,235,274,282,290,361,363,364,368,372,373,392,395,404,406,408,409,410,414,420,423,425,428,],[214,278,214,309,214,214,337,360,278,278,278,278,394,396,278,399,278,278,278,278,278,417,278,278,278,278,278,278,]),}
    +_lr_goto_items = {'storage_class_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,]),'identifier_list_opt':([66,],[106,]),'selection_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[298,298,298,298,298,298,298,298,298,298,298,298,]),'constant':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,]),'unary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[120,120,120,220,231,234,120,240,120,120,120,231,231,120,120,120,120,120,120,120,120,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,120,231,231,231,120,120,231,120,120,231,120,231,120,120,120,120,120,120,120,231,231,120,120,120,120,120,120,120,120,120,120,120,120,120,]),'conditional_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,257,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[151,151,151,151,151,151,151,305,305,151,151,151,151,151,151,151,151,151,305,151,151,305,151,151,305,151,151,151,151,151,151,151,151,419,151,151,151,151,151,151,151,151,151,151,151,151,151,]),'brace_close':([93,101,172,173,188,189,261,299,362,418,429,],[174,191,302,303,310,311,359,383,404,430,437,]),'struct_or_union_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'unified_wstring_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,]),'abstract_declarator_opt':([110,239,],[199,337,]),'iteration_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[277,277,277,277,277,277,277,277,277,277,277,277,]),'init_declarator_list':([30,86,],[71,71,]),'translation_unit_or_empty':([0,],[8,]),'struct_declaration_list':([57,91,92,],[93,172,173,]),'block_item_list_opt':([170,],[299,]),'enumerator':([64,98,99,190,],[100,100,100,312,]),'pp_directive':([0,22,],[11,11,]),'abstract_declarator':([30,78,86,97,110,167,239,338,],[79,161,79,185,201,161,201,161,]),'declaration_specifiers_opt':([1,14,42,44,],[50,58,83,84,]),'external_declaration':([0,22,],[12,61,]),'type_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[14,14,14,14,14,14,14,94,14,14,14,14,94,94,94,94,94,94,14,14,14,94,94,14,94,94,94,94,14,14,14,]),'designation':([155,362,399,429,],[260,260,260,260,]),'compound_statement':([88,163,170,289,297,375,384,411,423,425,427,441,443,446,],[169,272,282,282,282,282,282,282,282,282,282,282,282,282,]),'pointer':([0,4,22,30,68,78,86,97,110,117,167,239,306,338,],[16,16,16,74,116,74,166,166,74,16,166,339,16,339,]),'type_name':([141,219,229,230,233,],[237,322,331,332,333,]),'unified_string_literal':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,]),'postfix_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,]),'assignment_expression_opt':([72,103,164,],[131,193,273,]),'designation_opt':([155,362,399,429,],[266,402,266,402,]),'expression_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[276,276,276,276,276,276,276,276,276,276,276,276,]),'parameter_declaration':([66,78,165,167,204,338,],[109,109,109,109,320,109,]),'initializer_list_opt':([155,],[261,]),'cast_expression':([72,77,103,134,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[132,132,132,232,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,398,132,132,132,132,132,132,132,132,132,132,132,132,132,132,]),'init_declarator':([30,86,117,],[75,75,205,]),'struct_declarator_list':([97,],[182,]),'unary_operator':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,]),'brace_open':([7,24,54,56,62,63,77,88,162,163,170,266,289,297,336,375,384,390,395,396,402,411,423,425,427,441,443,446,],[57,64,91,92,98,99,155,170,155,170,170,155,170,170,399,170,170,399,399,399,155,170,170,170,170,170,170,170,]),'assignment_operator':([120,],[213,]),'struct_or_union':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'identifier':([66,72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,203,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,263,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,394,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[114,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,318,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,360,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,417,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,]),'struct_declaration':([57,91,92,93,172,173,],[95,95,95,175,175,175,]),'assignment_expression':([72,77,103,141,162,164,170,195,196,213,219,226,227,230,233,257,266,281,289,297,335,373,375,376,380,384,385,393,402,408,411,421,423,425,426,427,432,438,441,443,446,],[136,156,136,238,156,136,238,316,317,321,238,238,328,238,238,238,156,238,238,238,397,238,238,238,238,238,238,416,156,238,238,238,238,238,238,238,238,238,238,238,238,]),'parameter_type_list':([66,78,165,167,338,],[108,159,159,159,159,]),'type_qualifier_list_opt':([28,65,105,],[68,103,196,]),'direct_declarator':([0,4,16,22,30,74,78,86,97,110,117,166,167,306,],[26,26,60,26,26,60,26,26,26,26,26,60,26,26,]),'type_qualifier_list':([28,65,105,],[67,104,67,]),'designator':([155,267,362,399,429,],[262,364,262,262,262,]),'argument_expression_list':([227,],[330,]),'initializer':([77,162,266,402,],[154,271,363,420,]),'specifier_qualifier_list_opt':([94,96,],[178,180,]),'constant_expression':([181,192,264,288,309,],[304,313,361,377,387,]),'expression_opt':([170,289,297,373,375,384,408,411,421,423,425,427,432,438,441,443,446,],[279,279,279,407,279,279,422,279,431,279,279,279,439,442,279,279,279,]),'primary_expression':([72,77,103,127,134,137,141,142,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,336,373,375,376,380,384,385,393,395,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,]),'declaration_specifiers':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[30,52,52,30,52,52,86,110,110,86,86,110,110,86,110,86,110,86,]),'declaration':([0,22,48,80,89,170,289,373,],[31,31,87,87,171,292,292,408,]),'struct_declarator_list_opt':([97,],[183,]),'identifier_list':([66,],[111,]),'typedef_name':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,]),'parameter_type_list_opt':([78,165,167,338,],[160,275,160,160,]),'jump_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[293,293,293,293,293,293,293,293,293,293,293,293,]),'declaration_list_opt':([48,80,],[88,163,]),'struct_declarator':([97,306,],[184,386,]),'function_definition':([0,22,],[36,36,]),'binary_expression':([72,77,103,141,162,164,170,181,192,195,196,213,219,226,227,230,233,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,264,266,281,288,289,297,309,335,373,375,376,380,384,385,393,400,402,408,411,421,423,425,426,427,432,438,441,443,446,],[147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,147,357,358,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,147,]),'parameter_list':([66,78,165,167,338,],[113,113,113,113,113,]),'init_declarator_list_opt':([30,86,],[73,73,]),'enum_specifier':([0,1,14,22,42,44,48,57,66,78,80,89,91,92,93,94,96,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'decl_body':([0,22,48,80,89,170,289,373,],[41,41,41,41,41,41,41,41,]),'type_qualifier':([0,1,14,22,28,42,44,48,57,65,66,67,78,80,89,91,92,93,94,96,104,105,141,165,167,170,172,173,204,219,229,230,233,289,338,373,],[42,42,42,42,69,42,42,42,96,69,42,115,42,42,42,96,96,96,96,96,115,69,96,42,42,42,96,96,42,96,96,96,96,42,42,42,]),'statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[291,291,382,409,414,424,433,434,436,445,447,448,]),'enumerator_list':([64,98,99,],[101,188,189,]),'labeled_statement':([170,289,297,375,384,411,423,425,427,441,443,446,],[280,280,280,280,280,280,280,280,280,280,280,280,]),'function_specifier':([0,1,14,22,42,44,48,66,78,80,89,165,167,170,204,289,338,373,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'specifier_qualifier_list':([57,91,92,93,94,96,141,172,173,219,229,230,233,],[97,97,97,97,179,179,239,97,97,239,239,239,239,]),'block_item':([170,289,],[295,379,]),'block_item_list':([170,],[289,]),'empty':([0,1,14,28,30,42,44,48,65,66,72,78,80,86,94,96,97,103,105,110,155,164,165,167,170,239,289,297,338,362,373,375,384,399,408,411,421,423,425,427,429,432,438,441,443,446,],[47,51,51,70,76,51,51,85,70,107,150,158,85,76,177,177,186,150,70,200,268,150,158,158,296,200,378,378,158,403,378,378,378,403,378,378,378,378,378,378,403,378,378,378,378,378,]),'translation_unit':([0,],[22,]),'initializer_list':([155,399,],[265,418,]),'declarator':([0,4,22,30,78,86,97,110,117,167,306,],[48,53,48,80,53,168,187,202,168,53,187,]),'direct_abstract_declarator':([30,74,78,86,97,110,166,167,239,338,339,],[81,153,81,81,81,81,153,81,81,81,153,]),'designator_list':([155,362,399,429,],[267,267,267,267,]),'declaration_list':([48,80,],[89,89,]),'expression':([141,170,219,226,230,233,257,281,289,297,373,375,376,380,384,385,408,411,421,423,425,426,427,432,438,441,443,446,],[236,285,236,327,236,236,356,372,285,285,285,285,410,412,285,415,285,285,285,285,285,435,285,285,285,285,285,285,]),}
     
     _lr_goto = { }
     for _k, _v in _lr_goto_items.items():
    @@ -26,261 +26,267 @@
     del _lr_goto_items
     _lr_productions = [
       ("S' -> translation_unit_or_empty","S'",1,None,None,None),
    -  ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',41),
    -  ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','../pycparser/plyparser.py',42),
    -  ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',41),
    -  ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','../pycparser/plyparser.py',42),
    -  ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',41),
    -  ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','../pycparser/plyparser.py',42),
    -  ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',41),
    -  ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','../pycparser/plyparser.py',42),
    -  ('declaration_specifiers_opt -> empty','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',41),
    -  ('declaration_specifiers_opt -> declaration_specifiers','declaration_specifiers_opt',1,'p_declaration_specifiers_opt','../pycparser/plyparser.py',42),
    -  ('designation_opt -> empty','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',41),
    -  ('designation_opt -> designation','designation_opt',1,'p_designation_opt','../pycparser/plyparser.py',42),
    -  ('expression_opt -> empty','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',41),
    -  ('expression_opt -> expression','expression_opt',1,'p_expression_opt','../pycparser/plyparser.py',42),
    -  ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',41),
    -  ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','../pycparser/plyparser.py',42),
    -  ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','../pycparser/plyparser.py',41),
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:31:59 2015
    From: noreply at buildbot.pypy.org (cfbolz)
    Date: Mon, 23 Nov 2015 21:31:59 +0100 (CET)
    Subject: [pypy-commit] pypy remove-getfield-pure: adapt
     protect_speculative_operation to getfield being handled by heap.py
    Message-ID: <20151123203159.5FFE81C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Carl Friedrich Bolz 
    Branch: remove-getfield-pure
    Changeset: r80868:c8e4c1dce446
    Date: 2015-11-23 21:31 +0100
    http://bitbucket.org/pypy/pypy/changeset/c8e4c1dce446/
    
    Log:	adapt protect_speculative_operation to getfield being handled by
    	heap.py
    
    diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py
    --- a/rpython/jit/metainterp/optimizeopt/heap.py
    +++ b/rpython/jit/metainterp/optimizeopt/heap.py
    @@ -600,12 +600,12 @@
     
         def optimize_QUASIIMMUT_FIELD(self, op):
             # Pattern: QUASIIMMUT_FIELD(s, descr=QuasiImmutDescr)
    -        #          x = GETFIELD_GC_PURE(s, descr='inst_x')
    +        #          x = GETFIELD_GC(s, descr='inst_x') # pure
             # If 's' is a constant (after optimizations) we rely on the rest of the
    -        # optimizations to constant-fold the following getfield_gc_pure.
    +        # optimizations to constant-fold the following pure getfield_gc.
             # in addition, we record the dependency here to make invalidation work
             # correctly.
    -        # NB: emitting the GETFIELD_GC_PURE is only safe because the
    +        # NB: emitting the pure GETFIELD_GC is only safe because the
             # QUASIIMMUT_FIELD is also emitted to make sure the dependency is
             # registered.
             structvalue = self.ensure_ptr_info_arg0(op)
    diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py
    --- a/rpython/jit/metainterp/optimizeopt/optimizer.py
    +++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
    @@ -5,11 +5,12 @@
          ConstIntBound, MININT, MAXINT, IntUnbounded
     from rpython.jit.metainterp.optimizeopt.util import make_dispatcher_method
     from rpython.jit.metainterp.resoperation import rop, AbstractResOp, GuardResOp,\
    -     OpHelpers, ResOperation
    +     OpHelpers, ResOperation, is_pure_getfield
     from rpython.jit.metainterp.optimizeopt import info
     from rpython.jit.metainterp.typesystem import llhelper
     from rpython.rlib.objectmodel import specialize, we_are_translated
     from rpython.rlib.debug import debug_print
    +from rpython.jit.metainterp.optimize import SpeculativeError
     
     
     
    @@ -736,12 +737,64 @@
             self.emit_operation(op)
     
         def constant_fold(self, op):
    +        self.protect_speculative_operation(op)
             argboxes = [self.get_constant_box(op.getarg(i))
                         for i in range(op.numargs())]
             return execute_nonspec_const(self.cpu, None,
                                            op.getopnum(), argboxes,
                                            op.getdescr(), op.type)
     
    +    def protect_speculative_operation(self, op):
    +        """When constant-folding a pure operation that reads memory from
    +        a gcref, make sure that the gcref is non-null and of a valid type.
    +        Otherwise, raise SpeculativeError.  This should only occur when
    +        unrolling and optimizing the unrolled loop.  Note that if
    +        cpu.supports_guard_gc_type is false, we can't really do this
    +        check at all, but then we don't unroll in that case.
    +        """
    +        opnum = op.getopnum()
    +        cpu = self.cpu
    +
    +        if is_pure_getfield(opnum, op.getdescr()):
    +            fielddescr = op.getdescr()
    +            ref = self.get_constant_box(op.getarg(0)).getref_base()
    +            cpu.protect_speculative_field(ref, fielddescr)
    +            return
    +
    +        elif (opnum == rop.GETARRAYITEM_GC_PURE_I or
    +              opnum == rop.GETARRAYITEM_GC_PURE_R or
    +              opnum == rop.GETARRAYITEM_GC_PURE_F or
    +              opnum == rop.ARRAYLEN_GC):
    +            arraydescr = op.getdescr()
    +            array = self.get_constant_box(op.getarg(0)).getref_base()
    +            cpu.protect_speculative_array(array, arraydescr)
    +            if opnum == rop.ARRAYLEN_GC:
    +                return
    +            arraylength = cpu.bh_arraylen_gc(array, arraydescr)
    +
    +        elif (opnum == rop.STRGETITEM or
    +              opnum == rop.STRLEN):
    +            string = self.get_constant_box(op.getarg(0)).getref_base()
    +            cpu.protect_speculative_string(string)
    +            if opnum == rop.STRLEN:
    +                return
    +            arraylength = cpu.bh_strlen(string)
    +
    +        elif (opnum == rop.UNICODEGETITEM or
    +              opnum == rop.UNICODELEN):
    +            unicode = self.get_constant_box(op.getarg(0)).getref_base()
    +            cpu.protect_speculative_unicode(unicode)
    +            if opnum == rop.UNICODELEN:
    +                return
    +            arraylength = cpu.bh_unicodelen(unicode)
    +
    +        else:
    +            return
    +
    +        index = self.get_constant_box(op.getarg(1)).getint()
    +        if not (0 <= index < arraylength):
    +            raise SpeculativeError
    +
         def is_virtual(self, op):
             if op.type == 'r':
                 opinfo = self.getptrinfo(op)
    diff --git a/rpython/jit/metainterp/optimizeopt/pure.py b/rpython/jit/metainterp/optimizeopt/pure.py
    --- a/rpython/jit/metainterp/optimizeopt/pure.py
    +++ b/rpython/jit/metainterp/optimizeopt/pure.py
    @@ -94,7 +94,6 @@
                         break
                 else:
                     # all constant arguments: constant-fold away
    -                self.protect_speculative_operation(op)
                     resbox = self.optimizer.constant_fold(op)
                     # note that INT_xxx_OVF is not done from here, and the
                     # overflows in the INT_xxx operations are ignored
    @@ -119,59 +118,6 @@
             if nextop:
                 self.emit_operation(nextop)
     
    -    def protect_speculative_operation(self, op):
    -        """When constant-folding a pure operation that reads memory from
    -        a gcref, make sure that the gcref is non-null and of a valid type.
    -        Otherwise, raise SpeculativeError.  This should only occur when
    -        unrolling and optimizing the unrolled loop.  Note that if
    -        cpu.supports_guard_gc_type is false, we can't really do this
    -        check at all, but then we don't unroll in that case.
    -        """
    -        opnum = op.getopnum()
    -        cpu = self.optimizer.cpu
    -
    -        if   (opnum == rop.GETFIELD_GC_PURE_I or
    -              opnum == rop.GETFIELD_GC_PURE_R or
    -              opnum == rop.GETFIELD_GC_PURE_F):
    -            fielddescr = op.getdescr()
    -            ref = self.get_constant_box(op.getarg(0)).getref_base()
    -            cpu.protect_speculative_field(ref, fielddescr)
    -            return
    -
    -        elif (opnum == rop.GETARRAYITEM_GC_PURE_I or
    -              opnum == rop.GETARRAYITEM_GC_PURE_R or
    -              opnum == rop.GETARRAYITEM_GC_PURE_F or
    -              opnum == rop.ARRAYLEN_GC):
    -            arraydescr = op.getdescr()
    -            array = self.get_constant_box(op.getarg(0)).getref_base()
    -            cpu.protect_speculative_array(array, arraydescr)
    -            if opnum == rop.ARRAYLEN_GC:
    -                return
    -            arraylength = cpu.bh_arraylen_gc(array, arraydescr)
    -
    -        elif (opnum == rop.STRGETITEM or
    -              opnum == rop.STRLEN):
    -            string = self.get_constant_box(op.getarg(0)).getref_base()
    -            cpu.protect_speculative_string(string)
    -            if opnum == rop.STRLEN:
    -                return
    -            arraylength = cpu.bh_strlen(string)
    -
    -        elif (opnum == rop.UNICODEGETITEM or
    -              opnum == rop.UNICODELEN):
    -            unicode = self.get_constant_box(op.getarg(0)).getref_base()
    -            cpu.protect_speculative_unicode(unicode)
    -            if opnum == rop.UNICODELEN:
    -                return
    -            arraylength = cpu.bh_unicodelen(unicode)
    -
    -        else:
    -            return
    -
    -        index = self.get_constant_box(op.getarg(1)).getint()
    -        if not (0 <= index < arraylength):
    -            raise SpeculativeError
    -
         def getrecentops(self, opnum):
             if rop._OVF_FIRST <= opnum <= rop._OVF_LAST:
                 opnum = opnum - rop._OVF_FIRST
    diff --git a/rpython/jit/metainterp/optimizeopt/test/test_dependency.py b/rpython/jit/metainterp/optimizeopt/test/test_dependency.py
    --- a/rpython/jit/metainterp/optimizeopt/test/test_dependency.py
    +++ b/rpython/jit/metainterp/optimizeopt/test/test_dependency.py
    @@ -520,8 +520,8 @@
         def test_getfield(self):
             graph = self.build_dependency("""
             [p0, p1] # 0: 1,2,5
    -        p2 = getfield_gc_r(p0) # 1: 3,5
    -        p3 = getfield_gc_r(p0) # 2: 4
    +        p2 = getfield_gc_r(p0, descr=valuedescr) # 1: 3,5
    +        p3 = getfield_gc_r(p0, descr=valuedescr) # 2: 4
             guard_nonnull(p2) [p2] # 3: 4,5
             guard_nonnull(p3) [p3] # 4: 5
             jump(p0,p2) # 5:
    @@ -531,10 +531,10 @@
         def test_cyclic(self):
             graph = self.build_dependency("""
             [p0, p1, p5, p6, p7, p9, p11, p12] # 0: 1,6
    -        p13 = getfield_gc_r(p9) # 1: 2,5
    +        p13 = getfield_gc_r(p9, descr=valuedescr) # 1: 2,5
             guard_nonnull(p13) [] # 2: 4,5
    -        i14 = getfield_gc_i(p9) # 3: 5
    -        p15 = getfield_gc_r(p13) # 4: 5
    +        i14 = getfield_gc_i(p9, descr=valuedescr) # 3: 5
    +        p15 = getfield_gc_r(p13, descr=valuedescr) # 4: 5
             guard_class(p15, 14073732) [p1, p0, p9, i14, p15, p13, p5, p6, p7] # 5: 6
             jump(p0,p1,p5,p6,p7,p9,p11,p12) # 6:
             """)
    diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
    --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
    +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
    @@ -1408,7 +1408,7 @@
             """
             self.optimize_loop(ops, expected)
     
    -    def test_getfield_gc_pure_1(self):
    +    def test_pure_getfield_gc_1(self):
             ops = """
             [i]
             p1 = new_with_vtable(descr=nodesize)
    @@ -1422,7 +1422,7 @@
             """
             self.optimize_loop(ops, expected)
     
    -    def test_getfield_gc_pure_2(self):
    +    def test_pure_getfield_gc_2(self):
             ops = """
             [i]
             i1 = getfield_gc_i(ConstPtr(myptr3), descr=valuedescr3)
    @@ -1435,7 +1435,7 @@
             self.node.value = 5
             self.optimize_loop(ops, expected)
     
    -    def test_getfield_gc_pure_3(self):
    +    def test_pure_getfield_gc_3(self):
             ops = """
             []
             p1 = escape_r()
    @@ -9030,7 +9030,7 @@
             [p0, i1]
             i2 = int_gt(i1, 0)
             guard_true(i2) []
    -        getfield_gc_pure_i(p0, descr=valuedescr)
    +        getfield_gc_i(p0, descr=valuedescr3)
             i3 = int_sub(i1, 1)
             jump(NULL, i3)
             """
    @@ -9041,9 +9041,9 @@
             [p0, i1]
             i2 = int_gt(i1, 0)
             guard_true(i2) []
    -        getfield_gc_pure_i(p0, descr=valuedescr)
    +        getfield_gc_i(p0, descr=valuedescr3)
             i3 = int_sub(i1, 1)
    -        jump(ConstPtr(myptr4), i3)
    +        jump(ConstPtr(myptr2), i3)
             """
             py.test.raises(InvalidLoop, self.optimize_loop, ops, ops)
     
    diff --git a/rpython/jit/metainterp/test/test_virtual.py b/rpython/jit/metainterp/test/test_virtual.py
    --- a/rpython/jit/metainterp/test/test_virtual.py
    +++ b/rpython/jit/metainterp/test/test_virtual.py
    @@ -1077,7 +1077,7 @@
             res = self.meta_interp(f, [], repeat=7)
             assert res == f()
     
    -    def test_getfield_gc_pure_nobug(self):
    +    def test_pure_getfield_gc_nobug(self):
             mydriver = JitDriver(reds=['i', 's', 'a'], greens=[])
     
             class A(object):
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:33:23 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 21:33:23 +0100 (CET)
    Subject: [pypy-commit] cffi default: Update this doc,
     which ends up (also) in C sources produced by
    Message-ID: <20151123203323.C21C21C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2429:861b87566560
    Date: 2015-11-23 17:51 +0100
    http://bitbucket.org/cffi/cffi/changeset/861b87566560/
    
    Log:	Update this doc, which ends up (also) in C sources produced by
    	ffi.set_source()
    
    diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h
    --- a/cffi/parse_c_type.h
    +++ b/cffi/parse_c_type.h
    @@ -1,5 +1,6 @@
     
    -/* See doc/misc/parse_c_type.rst in the source of CFFI for more information */
    +/* This part is from file 'cffi/parse_c_type.h'.  It is copied at the
    +   beginning of C sources generated by CFFI's ffi.set_source(). */
     
     typedef void *_cffi_opcode_t;
     
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:33:25 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 21:33:25 +0100 (CET)
    Subject: [pypy-commit] cffi static-callback: typo
    Message-ID: <20151123203325.C5D611C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: static-callback
    Changeset: r2430:c88007348969
    Date: 2015-11-23 18:14 +0100
    http://bitbucket.org/cffi/cffi/changeset/c88007348969/
    
    Log:	typo
    
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -597,7 +597,7 @@
             }
         """)
     
    -EXtern "Python": reference
    +Extern "Python": reference
     ~~~~~~~~~~~~~~~~~~~~~~~~~~
     
     ``extern "Python"`` must appear in the cdef().  Like the C++ ``extern
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:33:27 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Mon, 23 Nov 2015 21:33:27 +0100 (CET)
    Subject: [pypy-commit] cffi default: improve doc for the fix to
     ffi.new_handle()
    Message-ID: <20151123203327.A4A9B1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: 
    Changeset: r2431:fff3a26ea892
    Date: 2015-11-23 21:34 +0100
    http://bitbucket.org/cffi/cffi/changeset/fff3a26ea892/
    
    Log:	improve doc for the fix to ffi.new_handle()
    
    diff --git a/doc/source/using.rst b/doc/source/using.rst
    --- a/doc/source/using.rst
    +++ b/doc/source/using.rst
    @@ -843,9 +843,7 @@
     * ``new_handle()`` returns cdata objects that contains references to
       the Python objects; we call them collectively the "handle" cdata
       objects.  The ``void *`` value in these handle cdata objects are
    -  random but unique.  *New in version 1.4:* two calls to
    -  ``new_handle(x)`` are guaranteed to return cdata objects with
    -  different ``void *`` values, even with the same ``x``.
    +  random but unique.
     
     * ``from_handle(p)`` searches all live "handle" cdata objects for the
       one that has the same value ``p`` as its ``void *`` value.  It then
    @@ -858,6 +856,16 @@
     then the association ``void * -> python_object`` is dead and
     ``from_handle()`` will crash.
     
    +*New in version 1.4:* two calls to ``new_handle(x)`` are guaranteed to
    +return cdata objects with different ``void *`` values, even with the
    +same ``x``.  This is a useful feature that avoids issues with unexpected
    +duplicates in the following trick: if you need to keep alive the
    +"handle" until explicitly asked to free it, but don't have a natural
    +Python-side place to attach it to, then the easiest is to ``add()`` it
    +to a global set.  It can later be removed from the set by
    +``global_set.discard(p)``, with ``p`` any cdata object whose ``void *``
    +value compares equal.
    +
     
     .. _`ffi.addressof()`:
     
    diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst
    --- a/doc/source/whatsnew.rst
    +++ b/doc/source/whatsnew.rst
    @@ -8,9 +8,10 @@
     
     * ``ffi.new_handle()`` is now guaranteed to return unique ``void *``
       values, even if called twice on the same object.  Previously, in
    -  that case, CPython (but not PyPy) would return different ``cdata``
    -  objects with the same ``void *`` value.  This is useful to add and
    -  remove handles from a global set without worrying about duplicates.
    +  that case, CPython (but not PyPy) would return two ``cdata`` objects
    +  with the same ``void *`` value.  This change is useful to add and
    +  remove handles from a global dict or set without worrying about
    +  duplicates.
     
     * ``ffi.init_once()`` XXX
       https://bitbucket.org/cffi/cffi/issues/233/
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:36:54 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Mon, 23 Nov 2015 21:36:54 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: sanity check to ensure that the
     cast we do is actually valid. Currently it fails e.g. on win32 and 32bit
     ARM
    Message-ID: <20151123203654.922641C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80869:0a7af3c17db0
    Date: 2015-11-23 18:35 +0100
    http://bitbucket.org/pypy/pypy/changeset/0a7af3c17db0/
    
    Log:	sanity check to ensure that the cast we do is actually valid.
    	Currently it fails e.g. on win32 and 32bit ARM
    
    diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py
    --- a/rpython/rlib/strstorage.py
    +++ b/rpython/rlib/strstorage.py
    @@ -32,6 +32,18 @@
     from rpython.rtyper.annlowlevel import llstr
     from rpython.rlib.objectmodel import specialize
     
    +def compute_offsetof(TP, field):
    +    """
    +    NOT_RPYTHON
    +    """
    +    obj = lltype.malloc(TP, 0)
    +    baseadr = llmemory.cast_ptr_to_adr(obj)
    +    offset = llmemory.offsetof(TP, field)
    +    interioradr = baseadr + offset
    +    return (llmemory.cast_adr_to_int(interioradr, 'forced') -
    +            llmemory.cast_adr_to_int(baseadr, 'forced'))
    +
    +
     @specialize.memo()
     def rpy_string_as_type(TP):
         # sanity check that STR is actually what we think it is
    @@ -42,6 +54,8 @@
         STR_AS_TP = lltype.GcStruct('rpy_string_as_%s' % TP,
                                     ('hash',  lltype.Signed),
                                     ('chars', lltype.Array(TP, hints={'immutable': True})))
    +    # sanity check
    +    assert compute_offsetof(STR, 'chars') == compute_offsetof(STR_AS_TP, 'chars')
         return STR_AS_TP
     
     @specialize.ll()
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:36:56 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Mon, 23 Nov 2015 21:36:56 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: fix rstruct.unpack q and Q on
     systems which do not support str_storage_getitem,
     such as win32 and probably ARM 32 bit
    Message-ID: <20151123203656.B162C1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80870:f856371c182b
    Date: 2015-11-23 20:56 +0100
    http://bitbucket.org/pypy/pypy/changeset/f856371c182b/
    
    Log:	fix rstruct.unpack q and Q on systems which do not support
    	str_storage_getitem, such as win32 and probably ARM 32 bit
    
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -12,7 +12,7 @@
     from rpython.rlib.rstruct import ieee
     from rpython.rlib.rstruct.error import StructError, StructOverflowError
     from rpython.rlib.unroll import unrolling_iterable
    -from rpython.rlib.strstorage import str_storage_getitem
    +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported
     from rpython.rlib import rarithmetic
     from rpython.rtyper.lltypesystem import rffi
     
    @@ -229,7 +229,7 @@
     
         @specialize.argtype(0)
         def unpack_int_fastpath_maybe(fmtiter):
    -        if fmtiter.bigendian != native_is_bigendian:
    +        if fmtiter.bigendian != native_is_bigendian or not str_storage_supported(TYPE):
                 return False
             try:
                 intvalue = unpack_fastpath(TYPE)(fmtiter)
    diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py
    --- a/rpython/rlib/strstorage.py
    +++ b/rpython/rlib/strstorage.py
    @@ -58,6 +58,15 @@
         assert compute_offsetof(STR, 'chars') == compute_offsetof(STR_AS_TP, 'chars')
         return STR_AS_TP
     
    + at specialize.memo()
    +def str_storage_supported(TP):
    +    try:
    +        rpy_string_as_type(TP)
    +    except AssertionError:
    +        return False
    +    else:
    +        return True
    +
     @specialize.ll()
     def str_storage_getitem(TP, s, index):
         STR_AS_TP = rpy_string_as_type(TP)
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:36:58 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Mon, 23 Nov 2015 21:36:58 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: fix runpack('d') on win32 and
     32bit ARM. I tried to keep the fix and the implementation as least invasive
     as possible, because it will go away as soon as we have gc_load;
     but in the meantime, this fixes it with reasonable performance
    Message-ID: <20151123203658.C56AB1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80871:59a4b706d487
    Date: 2015-11-23 21:37 +0100
    http://bitbucket.org/pypy/pypy/changeset/59a4b706d487/
    
    Log:	fix runpack('d') on win32 and 32bit ARM. I tried to keep the fix and
    	the implementation as least invasive as possible, because it will go
    	away as soon as we have gc_load; but in the meantime, this fixes it
    	with reasonable performance
    
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -185,6 +185,13 @@
                 data = fmtiter.read(size)
                 fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian))
                 return
    +        if not str_storage_supported(TYPE):
    +            # this happens e.g. on win32 and ARM32: we cannot read the string
    +            # content as an array of doubles because it's not properly
    +            # aligned. But we can read a longlong and convert to float
    +            assert TYPE == rffi.DOUBLE
    +            assert rffi.sizeof(TYPE) == 8
    +            return unpack_longlong2float(fmtiter)
             try:
                 # fast path
                 val = unpack_fastpath(TYPE)(fmtiter)
    @@ -195,6 +202,16 @@
             fmtiter.appendobj(float(val))
         return unpack_ieee
     
    + at specialize.argtype(0)
    +def unpack_longlong2float(fmtiter):
    +    from rpython.rlib.rstruct.runpack import runpack
    +    from rpython.rlib.longlong2float import longlong2float
    +    s = fmtiter.read(8)
    +    llval = runpack('q', s) # this is a bit recursive, I know
    +    doubleval = longlong2float(llval)
    +    fmtiter.appendobj(doubleval)
    +
    +
     unpack_double = make_ieee_unpacker(rffi.DOUBLE)
     unpack_float = make_ieee_unpacker(rffi.FLOAT)
     
    
    From noreply at buildbot.pypy.org  Mon Nov 23 15:40:19 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Mon, 23 Nov 2015 21:40:19 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: skip this test on some platforms
    Message-ID: <20151123204019.850DD1C0155@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80872:783361f5f31e
    Date: 2015-11-23 21:40 +0100
    http://bitbucket.org/pypy/pypy/changeset/783361f5f31e/
    
    Log:	skip this test on some platforms
    
    diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py
    --- a/rpython/rlib/test/test_strstorage.py
    +++ b/rpython/rlib/test/test_strstorage.py
    @@ -1,7 +1,7 @@
     import py
     import struct
     from rpython.rtyper.lltypesystem import lltype, rffi
    -from rpython.rlib.strstorage import str_storage_getitem
    +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported
     from rpython.rlib.rarithmetic import r_singlefloat
     from rpython.rtyper.test.tool import BaseRtypingTest
     
    @@ -22,6 +22,8 @@
             assert int(x) == 43
     
         def test_float(self):
    +        if not str_storage_supported(lltype.Float):
    +            py.test.skip('str_storage_getitem(lltype.Float) not supported on this machine')
             buf = struct.pack('@dd', 12.3, 45.6)
             size = struct.calcsize('@d')
             assert self.str_storage_getitem(lltype.Float, buf, 0) == 12.3
    
    From noreply at buildbot.pypy.org  Mon Nov 23 16:29:46 2015
    From: noreply at buildbot.pypy.org (bdkearns)
    Date: Mon, 23 Nov 2015 22:29:46 +0100 (CET)
    Subject: [pypy-commit] pypy default: try to correct more differences in
     datetime
    Message-ID: <20151123212946.0F1D71C134D@cobra.cs.uni-duesseldorf.de>
    
    Author: Brian Kearns 
    Branch: 
    Changeset: r80873:89a6ae0a9ec2
    Date: 2015-11-23 16:29 -0500
    http://bitbucket.org/pypy/pypy/changeset/89a6ae0a9ec2/
    
    Log:	try to correct more differences in datetime
    
    diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
    --- a/lib_pypy/datetime.py
    +++ b/lib_pypy/datetime.py
    @@ -272,15 +272,17 @@
     
     def _check_int_field(value):
         if isinstance(value, int):
    -        return value
    +        return int(value)
         if not isinstance(value, float):
             try:
                 value = value.__int__()
             except AttributeError:
                 pass
             else:
    -            if isinstance(value, _numbers.Integral):
    -                return value
    +            if isinstance(value, int):
    +                return int(value)
    +            elif isinstance(value, long):
    +                return int(long(value))
                 raise TypeError('__int__ method should return an integer')
             raise TypeError('an integer is required')
         raise TypeError('integer argument expected, got float')
    @@ -624,7 +626,7 @@
                 return self
     
         def __mul__(self, other):
    -        if isinstance(other, _numbers.Integral):
    +        if isinstance(other, (int, long)):
                 # for CPython compatibility, we cannot use
                 # our __class__ here, but need a real timedelta
                 return timedelta(self._days * other,
    @@ -639,7 +641,7 @@
                     self._microseconds)
     
         def __div__(self, other):
    -        if not isinstance(other, _numbers.Integral):
    +        if not isinstance(other, (int, long)):
                 return NotImplemented
             usec = self._to_microseconds()
             return timedelta(0, 0, usec // other)
    diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py
    --- a/pypy/module/test_lib_pypy/test_datetime.py
    +++ b/pypy/module/test_lib_pypy/test_datetime.py
    @@ -170,14 +170,23 @@
                     self.value = value
                 def __int__(self):
                     return self.value
    +        class SubInt(int): pass
    +        class SubLong(long): pass
     
    +        dt10 = datetime.datetime(10, 10, 10, 10, 10, 10, 10)
             for xx in [10L,
                        decimal.Decimal(10),
                        decimal.Decimal('10.9'),
                        Number(10),
    -                   Number(10L)]:
    -            assert datetime.datetime(10, 10, 10, 10, 10, 10, 10) == \
    -                   datetime.datetime(xx, xx, xx, xx, xx, xx, xx)
    +                   Number(10L),
    +                   SubInt(10),
    +                   SubLong(10),
    +                   Number(SubInt(10)),
    +                   Number(SubLong(10))]:
    +            dtxx = datetime.datetime(xx, xx, xx, xx, xx, xx, xx)
    +            assert dt10 == dtxx
    +            assert type(dtxx.month) is int
    +            assert type(dtxx.second) is int
     
             with py.test.raises(TypeError) as e:
                 datetime.datetime(10, 10, '10')
    
    From noreply at buildbot.pypy.org  Mon Nov 23 18:58:28 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Tue, 24 Nov 2015 00:58:28 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: fix test_pypy_c/test_struct,
     to reflect the new optimization
    Message-ID: <20151123235828.295BD1C12CB@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80874:c32ced64c29f
    Date: 2015-11-24 00:58 +0100
    http://bitbucket.org/pypy/pypy/changeset/c32ced64c29f/
    
    Log:	fix test_pypy_c/test_struct, to reflect the new optimization
    
    diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py
    --- a/pypy/module/pypyjit/test_pypy_c/test_struct.py
    +++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
    @@ -19,7 +19,8 @@
                 import struct
                 i = 1
                 while i < n:
    -                x = struct.unpack("i", struct.pack("i", i))[0]  # ID: struct
    +                buf = struct.pack("i", i)       # ID: pack
    +                x = struct.unpack("i", buf)[0]  # ID: unpack
                     i += x / i
                 return i
     
    @@ -29,7 +30,7 @@
             loop, = log.loops_by_filename(self.filepath)
             # This could, of course stand some improvement, to remove all these
             # arithmatic ops, but we've removed all the core overhead.
    -        assert loop.match_by_id("struct", """
    +        assert loop.match_by_id("pack", """
                 guard_not_invalidated(descr=...)
                 # struct.pack
                 %s
    @@ -40,17 +41,22 @@
                 i17 = int_and(i16, 255)
                 i19 = int_rshift(i16, 8)
                 i20 = int_and(i19, 255)
    +        """ % extra)
     
    +        # the newstr and the strsetitems are because the string is forced,
    +        # which is in turn because the optimizer doesn't know how to handle a
    +        # getarrayitem_gc_i on a virtual string. It could be improved, but it
    +        # is also true that in real life cases struct.unpack is called on
    +        # strings which come from the outside, so it's a minor issue.
    +        assert loop.match_by_id("unpack", """
                 # struct.unpack
    -            i22 = int_lshift(i14, 8)
    -            i23 = int_or(i11, i22)
    -            i25 = int_lshift(i17, 16)
    -            i26 = int_or(i23, i25)
    -            i28 = int_ge(i20, 128)
    -            guard_false(i28, descr=...)
    -            i30 = int_lshift(i20, 24)
    -            i31 = int_or(i26, i30)
    -        """ % extra)
    +            p88 = newstr(4)
    +            strsetitem(p88, 0, i11)
    +            strsetitem(p88, 1, i14)
    +            strsetitem(p88, 2, i17)
    +            strsetitem(p88, 3, i20)
    +            i91 = getarrayitem_gc_i(p88, 0, descr=)
    +        """)
     
         def test_struct_object(self):
             def main(n):
    @@ -58,7 +64,8 @@
                 s = struct.Struct("i")
                 i = 1
                 while i < n:
    -                x = s.unpack(s.pack(i))[0]  # ID: struct
    +                buf = s.pack(i)       # ID: pack
    +                x = s.unpack(buf)[0]  # ID: unpack
                     i += x / i
                 return i
     
    @@ -66,7 +73,7 @@
             assert log.result == main(1000)
     
             loop, = log.loops_by_filename(self.filepath)
    -        assert loop.match_by_id('struct', """
    +        assert loop.match_by_id('pack', """
                 guard_not_invalidated(descr=...)
                 # struct.pack
                 %s
    @@ -77,14 +84,14 @@
                 i17 = int_and(i16, 255)
                 i19 = int_rshift(i16, 8)
                 i20 = int_and(i19, 255)
    +        """ % extra)
     
    +        assert loop.match_by_id('unpack', """
                 # struct.unpack
    -            i22 = int_lshift(i14, 8)
    -            i23 = int_or(i11, i22)
    -            i25 = int_lshift(i17, 16)
    -            i26 = int_or(i23, i25)
    -            i28 = int_ge(i20, 128)
    -            guard_false(i28, descr=...)
    -            i30 = int_lshift(i20, 24)
    -            i31 = int_or(i26, i30)
    -        """ % extra)
    +            p88 = newstr(4)
    +            strsetitem(p88, 0, i11)
    +            strsetitem(p88, 1, i14)
    +            strsetitem(p88, 2, i17)
    +            strsetitem(p88, 3, i20)
    +            i91 = getarrayitem_gc_i(p88, 0, descr=)
    +        """)
    
    From noreply at buildbot.pypy.org  Mon Nov 23 18:58:30 2015
    From: noreply at buildbot.pypy.org (antocuni)
    Date: Tue, 24 Nov 2015 00:58:30 +0100 (CET)
    Subject: [pypy-commit] pypy faster-rstruct: merge heads
    Message-ID: <20151123235830.2909A1C12CB@cobra.cs.uni-duesseldorf.de>
    
    Author: Antonio Cuni 
    Branch: faster-rstruct
    Changeset: r80875:c9ab4be2f15b
    Date: 2015-11-24 00:59 +0100
    http://bitbucket.org/pypy/pypy/changeset/c9ab4be2f15b/
    
    Log:	merge heads
    
    diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py
    --- a/rpython/rlib/rstruct/standardfmttable.py
    +++ b/rpython/rlib/rstruct/standardfmttable.py
    @@ -12,7 +12,7 @@
     from rpython.rlib.rstruct import ieee
     from rpython.rlib.rstruct.error import StructError, StructOverflowError
     from rpython.rlib.unroll import unrolling_iterable
    -from rpython.rlib.strstorage import str_storage_getitem
    +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported
     from rpython.rlib import rarithmetic
     from rpython.rtyper.lltypesystem import rffi
     
    @@ -185,6 +185,13 @@
                 data = fmtiter.read(size)
                 fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian))
                 return
    +        if not str_storage_supported(TYPE):
    +            # this happens e.g. on win32 and ARM32: we cannot read the string
    +            # content as an array of doubles because it's not properly
    +            # aligned. But we can read a longlong and convert to float
    +            assert TYPE == rffi.DOUBLE
    +            assert rffi.sizeof(TYPE) == 8
    +            return unpack_longlong2float(fmtiter)
             try:
                 # fast path
                 val = unpack_fastpath(TYPE)(fmtiter)
    @@ -195,6 +202,16 @@
             fmtiter.appendobj(float(val))
         return unpack_ieee
     
    + at specialize.argtype(0)
    +def unpack_longlong2float(fmtiter):
    +    from rpython.rlib.rstruct.runpack import runpack
    +    from rpython.rlib.longlong2float import longlong2float
    +    s = fmtiter.read(8)
    +    llval = runpack('q', s) # this is a bit recursive, I know
    +    doubleval = longlong2float(llval)
    +    fmtiter.appendobj(doubleval)
    +
    +
     unpack_double = make_ieee_unpacker(rffi.DOUBLE)
     unpack_float = make_ieee_unpacker(rffi.FLOAT)
     
    @@ -229,7 +246,7 @@
     
         @specialize.argtype(0)
         def unpack_int_fastpath_maybe(fmtiter):
    -        if fmtiter.bigendian != native_is_bigendian:
    +        if fmtiter.bigendian != native_is_bigendian or not str_storage_supported(TYPE):
                 return False
             try:
                 intvalue = unpack_fastpath(TYPE)(fmtiter)
    diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py
    --- a/rpython/rlib/strstorage.py
    +++ b/rpython/rlib/strstorage.py
    @@ -32,6 +32,18 @@
     from rpython.rtyper.annlowlevel import llstr
     from rpython.rlib.objectmodel import specialize
     
    +def compute_offsetof(TP, field):
    +    """
    +    NOT_RPYTHON
    +    """
    +    obj = lltype.malloc(TP, 0)
    +    baseadr = llmemory.cast_ptr_to_adr(obj)
    +    offset = llmemory.offsetof(TP, field)
    +    interioradr = baseadr + offset
    +    return (llmemory.cast_adr_to_int(interioradr, 'forced') -
    +            llmemory.cast_adr_to_int(baseadr, 'forced'))
    +
    +
     @specialize.memo()
     def rpy_string_as_type(TP):
         # sanity check that STR is actually what we think it is
    @@ -42,8 +54,19 @@
         STR_AS_TP = lltype.GcStruct('rpy_string_as_%s' % TP,
                                     ('hash',  lltype.Signed),
                                     ('chars', lltype.Array(TP, hints={'immutable': True})))
    +    # sanity check
    +    assert compute_offsetof(STR, 'chars') == compute_offsetof(STR_AS_TP, 'chars')
         return STR_AS_TP
     
    + at specialize.memo()
    +def str_storage_supported(TP):
    +    try:
    +        rpy_string_as_type(TP)
    +    except AssertionError:
    +        return False
    +    else:
    +        return True
    +
     @specialize.ll()
     def str_storage_getitem(TP, s, index):
         STR_AS_TP = rpy_string_as_type(TP)
    diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py
    --- a/rpython/rlib/test/test_strstorage.py
    +++ b/rpython/rlib/test/test_strstorage.py
    @@ -1,7 +1,7 @@
     import py
     import struct
     from rpython.rtyper.lltypesystem import lltype, rffi
    -from rpython.rlib.strstorage import str_storage_getitem
    +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported
     from rpython.rlib.rarithmetic import r_singlefloat
     from rpython.rtyper.test.tool import BaseRtypingTest
     
    @@ -22,6 +22,8 @@
             assert int(x) == 43
     
         def test_float(self):
    +        if not str_storage_supported(lltype.Float):
    +            py.test.skip('str_storage_getitem(lltype.Float) not supported on this machine')
             buf = struct.pack('@dd', 12.3, 45.6)
             size = struct.calcsize('@d')
             assert self.str_storage_getitem(lltype.Float, buf, 0) == 12.3
    
    From noreply at buildbot.pypy.org  Mon Nov 23 23:07:47 2015
    From: noreply at buildbot.pypy.org (rlamy)
    Date: Tue, 24 Nov 2015 05:07:47 +0100 (CET)
    Subject: [pypy-commit] pypy anntype2: Turn isinstance into a SpaceOperation
    Message-ID: <20151124040747.6BB2F1C12C6@cobra.cs.uni-duesseldorf.de>
    
    Author: Ronan Lamy 
    Branch: anntype2
    Changeset: r80876:be00d62b05dc
    Date: 2015-11-24 04:08 +0000
    http://bitbucket.org/pypy/pypy/changeset/be00d62b05dc/
    
    Log:	Turn isinstance into a SpaceOperation
    
    diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py
    --- a/rpython/annotator/builtin.py
    +++ b/rpython/annotator/builtin.py
    @@ -181,14 +181,10 @@
                                                        # from bool to int, notice that isinstance( , bool|int)
                                                        # is quite border case for RPython
                     r.const = False
    +        for v in variables:
    +            assert v.annotation == s_obj
    +        knowntypedata = defaultdict(dict)
             bk = getbookkeeper()
    -        if variables is None:
    -            op = bk._find_current_op("simple_call", 3)
    -            assert op.args[0] == Constant(isinstance)
    -            variables = [op.args[1]]
    -        for variable in variables:
    -            assert bk.annotator.binding(variable) == s_obj
    -        knowntypedata = defaultdict(dict)
             if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC):
                 add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ))
             r.set_knowntypedata(knowntypedata)
    diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py
    --- a/rpython/annotator/test/test_annrpython.py
    +++ b/rpython/annotator/test/test_annrpython.py
    @@ -1173,6 +1173,13 @@
             s = a.build_types(g, [int])
             assert s.const == True
     
    +    def test_isinstance_basic(self):
    +        def f():
    +            return isinstance(IndexError(), type)
    +        a = self.RPythonAnnotator()
    +        s = a.build_types(f, [])
    +        assert s.const == False
    +
         def test_alloc_like(self):
             class Base(object):
                 pass
    diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
    --- a/rpython/annotator/unaryop.py
    +++ b/rpython/annotator/unaryop.py
    @@ -32,6 +32,12 @@
     def type_SomeObject(annotator, v_arg):
         return SomeTypeOf([v_arg])
     
    + at op.isinstance.register(SomeObject)
    +def isinstance_SomeObject(annotator, v_obj, v_cls):
    +    return builtin.builtin_isinstance(annotator.annotation(v_obj),
    +                                      annotator.annotation(v_cls),
    +                                      variables=[v_obj])
    +
     
     @op.bool.register(SomeObject)
     def bool_SomeObject(annotator, obj):
    diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
    --- a/rpython/flowspace/flowcontext.py
    +++ b/rpython/flowspace/flowcontext.py
    @@ -597,7 +597,7 @@
     
             Returns an FSException object whose w_value is an instance of w_type.
             """
    -        w_is_type = op.simple_call(const(isinstance), w_arg1, const(type)).eval(self)
    +        w_is_type = op.isinstance(w_arg1, const(type)).eval(self)
             if self.guessbool(w_is_type):
                 # this is for all cases of the form (Class, something)
                 if self.guessbool(op.is_(w_arg2, w_None).eval(self)):
    diff --git a/rpython/flowspace/generator.py b/rpython/flowspace/generator.py
    --- a/rpython/flowspace/generator.py
    +++ b/rpython/flowspace/generator.py
    @@ -156,8 +156,7 @@
         regular_entry_block = Block([Variable('entry')])
         block = regular_entry_block
         for Resume in mappings:
    -        op_check = op.simple_call(
    -            const(isinstance), block.inputargs[0], const(Resume))
    +        op_check = op.isinstance(block.inputargs[0], const(Resume))
             block.operations.append(op_check)
             block.exitswitch = op_check.result
             link1 = Link([block.inputargs[0]], Resume.block)
    diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
    --- a/rpython/flowspace/operation.py
    +++ b/rpython/flowspace/operation.py
    @@ -413,6 +413,7 @@
     add_operator('id', 1, dispatch=1, pyfunc=id)
     add_operator('type', 1, dispatch=1, pyfunc=new_style_type, pure=True)
     add_operator('issubtype', 2, dispatch=1, pyfunc=issubclass, pure=True)  # not for old-style classes
    +add_operator('isinstance', 2, dispatch=1, pyfunc=isinstance, pure=True)
     add_operator('repr', 1, dispatch=1, pyfunc=repr, pure=True)
     add_operator('str', 1, dispatch=1, pyfunc=str, pure=True)
     add_operator('format', 2, pyfunc=unsupported)
    diff --git a/rpython/flowspace/specialcase.py b/rpython/flowspace/specialcase.py
    --- a/rpython/flowspace/specialcase.py
    +++ b/rpython/flowspace/specialcase.py
    @@ -1,5 +1,5 @@
     import os
    -from rpython.flowspace.model import Constant, const
    +from rpython.flowspace.model import Constant
     
     SPECIAL_CASES = {}
     
    @@ -40,12 +40,6 @@
             "pytest.ini from the root of the PyPy repository into your "
             "own project.")
     
    - at register_flow_sc(isinstance)
    -def sc_isinstance(ctx, w_instance, w_type):
    -    if w_instance.foldable() and w_type.foldable():
    -        return const(isinstance(w_instance.value, w_type.value))
    -    return ctx.appcall(isinstance, w_instance, w_type)
    -
     @register_flow_sc(getattr)
     def sc_getattr(ctx, w_obj, w_index, w_default=None):
         if w_default is not None:
    diff --git a/rpython/rtyper/rbuiltin.py b/rpython/rtyper/rbuiltin.py
    --- a/rpython/rtyper/rbuiltin.py
    +++ b/rpython/rtyper/rbuiltin.py
    @@ -676,24 +676,6 @@
                          resulttype=llmemory.Address)
     
     
    - at typer_for(isinstance)
    -def rtype_builtin_isinstance(hop):
    -    hop.exception_cannot_occur()
    -    if hop.s_result.is_constant():
    -        return hop.inputconst(lltype.Bool, hop.s_result.const)
    -
    -    if hop.args_s[1].is_constant() and hop.args_s[1].const in (str, list, unicode):
    -        if hop.args_s[0].knowntype not in (str, list, unicode):
    -            raise TyperError("isinstance(x, str/list/unicode) expects x to be known"
    -                             " statically to be a str/list/unicode or None")
    -        rstrlist = hop.args_r[0]
    -        vstrlist = hop.inputarg(rstrlist, arg=0)
    -        cnone = hop.inputconst(rstrlist, None)
    -        return hop.genop('ptr_ne', [vstrlist, cnone], resulttype=lltype.Bool)
    -
    -    assert isinstance(hop.args_r[0], rclass.InstanceRepr)
    -    return hop.args_r[0].rtype_isinstance(hop)
    -
     @typer_for(objectmodel.instantiate)
     def rtype_instantiate(hop, i_nonmovable=None):
         hop.exception_cannot_occur()
    diff --git a/rpython/rtyper/rmodel.py b/rpython/rtyper/rmodel.py
    --- a/rpython/rtyper/rmodel.py
    +++ b/rpython/rtyper/rmodel.py
    @@ -204,6 +204,21 @@
             else:
                 return hop.genop('int_is_true', [vlen], resulttype=Bool)
     
    +    def rtype_isinstance(self, hop):
    +        hop.exception_cannot_occur()
    +        if hop.s_result.is_constant():
    +            return hop.inputconst(lltype.Bool, hop.s_result.const)
    +
    +        if hop.args_s[1].is_constant() and hop.args_s[1].const in (str, list, unicode):
    +            if hop.args_s[0].knowntype not in (str, list, unicode):
    +                raise TyperError("isinstance(x, str/list/unicode) expects x to be known"
    +                                " statically to be a str/list/unicode or None")
    +            rstrlist = hop.args_r[0]
    +            vstrlist = hop.inputarg(rstrlist, arg=0)
    +            cnone = hop.inputconst(rstrlist, None)
    +            return hop.genop('ptr_ne', [vstrlist, cnone], resulttype=lltype.Bool)
    +        raise TyperError
    +
         def rtype_hash(self, hop):
             ll_hash = self.get_ll_hash_function()
             v, = hop.inputargs(self)
    diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
    --- a/rpython/translator/simplify.py
    +++ b/rpython/translator/simplify.py
    @@ -414,7 +414,7 @@
     CanRemove = {}
     for _op in '''
             newtuple newlist newdict bool
    -        is_ id type issubtype repr str len hash getattr getitem
    +        is_ id type issubtype isinstance repr str len hash getattr getitem
             pos neg abs hex oct ord invert add sub mul
             truediv floordiv div mod divmod pow lshift rshift and_ or_
             xor int float long lt le eq ne gt ge cmp coerce contains
    @@ -425,7 +425,6 @@
         CanRemove[_op] = True
     del _op
     CanRemoveBuiltins = {
    -    isinstance: True,
         hasattr: True,
         }
     
    
    From noreply at buildbot.pypy.org  Tue Nov 24 01:35:14 2015
    From: noreply at buildbot.pypy.org (arigo)
    Date: Tue, 24 Nov 2015 07:35:14 +0100 (CET)
    Subject: [pypy-commit] pypy.org extradoc: update the values
    Message-ID: <20151124063514.4CE631C12C6@cobra.cs.uni-duesseldorf.de>
    
    Author: Armin Rigo 
    Branch: extradoc
    Changeset: r660:64f62ae9038a
    Date: 2015-11-24 07:36 +0100
    http://bitbucket.org/pypy/pypy.org/changeset/64f62ae9038a/
    
    Log:	update the values
    
    diff --git a/don1.html b/don1.html
    --- a/don1.html
    +++ b/don1.html
    @@ -9,13 +9,13 @@
     
     
        
    -   $61249 of $105000 (58.3%)
    +   $61393 of $105000 (58.5%)
        
    @@ -23,7 +23,7 @@
  • diff --git a/don3.html b/don3.html --- a/don3.html +++ b/don3.html @@ -9,13 +9,13 @@ - $52636 of $60000 (87.7%) + $52688 of $60000 (87.8%)
    @@ -23,7 +23,7 @@
  • diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -9,7 +9,7 @@ @@ -17,7 +17,7 @@ 2nd call: - $29698 of $80000 (37.1%) + $29753 of $80000 (37.2%)
    @@ -25,7 +25,7 @@
  • From noreply at buildbot.pypy.org Tue Nov 24 03:45:24 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 09:45:24 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: SG substracts, STG stores. fixed problem that did not remap locations correctly, test_jump now passes Message-ID: <20151124084524.9FD481C052B@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80877:bc5a54c347e6 Date: 2015-11-24 09:45 +0100 http://bitbucket.org/pypy/pypy/changeset/bc5a54c347e6/ Log: SG substracts, STG stores. fixed problem that did not remap locations correctly, test_jump now passes diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -1222,6 +1222,59 @@ got = self.cpu.get_float_value(deadframe, k) assert got == retvalues[k] + def test_jump_simple(self): + # this test generates small loops where the JUMP passes many + # arguments of various types, shuffling them around. + arg_count = 15 + inputargs = [InputArgInt() for i in range(arg_count)] + # + index_counter = len(inputargs) + i0 = InputArgInt() + + jumpargs = inputargs[:] + remixing = [(0,1),(2,1),(4,7)] + for a,b in remixing: + jumpargs[a],jumpargs[b] = jumpargs[b],jumpargs[a] + # + looptoken = JitCellToken() + targettoken = TargetToken() + faildescr = BasicFailDescr(15) + inputargs.append(i0) + op0 = ResOperation(rop.LABEL, inputargs, descr=targettoken) + op1 = ResOperation(rop.INT_SUB, [i0, ConstInt(1)]) + op2 = ResOperation(rop.INT_GE, [op1, ConstInt(0)]) + op3 = ResOperation(rop.GUARD_TRUE, [op2]) + jumpargs.append(op1) + op4 = ResOperation(rop.JUMP, jumpargs, descr=targettoken) + operations = [op0, op1, op2, op3, op4] + operations[3].setfailargs(inputargs[:]) + operations[3].setdescr(faildescr) + # + loop_count = 11 + self.cpu.compile_loop(inputargs, operations, looptoken) + values = [i for i in range(arg_count)] + # + vals = values + [loop_count] + print("args", inputargs) + print("jump", jumpargs) + print("entering with values", vals) + deadframe = self.cpu.execute_token(looptoken, *vals) + fail = self.cpu.get_latest_descr(deadframe) + assert fail.identifier == 15 + # + dstvalues = values[:] + for _ in range(loop_count): + for a,b in remixing: + dstvalues[a],dstvalues[b] = dstvalues[b],dstvalues[a] + # + #assert dstvalues[index_counter] == loop_count + #dstvalues[index_counter] = 0 + expected = [self.cpu.get_int_value(deadframe, i) for i in range(arg_count)] + for i, (box, val) in enumerate(zip(inputargs[:-1], dstvalues)): + got = self.cpu.get_int_value(deadframe, i) + assert type(got) == type(val) + assert got == val + def test_jump(self): # this test generates small loops where the JUMP passes many # arguments of various types, shuffling them around. diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -382,6 +382,7 @@ loc""" index = WORD * (~already_pushed) + print("regalloc push", index) if loc.type == FLOAT: if not loc.is_fp_reg(): @@ -392,12 +393,13 @@ if not loc.is_core_reg(): self.regalloc_mov(loc, r.SCRATCH) loc = r.SCRATCH - self.mc.SG(loc, l.addr(index, r.SP)) + self.mc.STG(loc, l.addr(index, r.SP)) def regalloc_pop(self, loc, already_pushed): """Pops the value on top of the stack to loc. Can trash the current value of SCRATCH when popping to a stack loc""" index = WORD * (~already_pushed) + print("regalloc pop", index) if loc.type == FLOAT: if loc.is_fp_reg(): diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py --- a/rpython/jit/backend/zarch/instructions.py +++ b/rpython/jit/backend/zarch/instructions.py @@ -137,7 +137,6 @@ # store memory 'STMG': ('rsy_a', ['\xEB','\x24']), - 'ST': ('rx', ['\x50']), 'STG': ('rxy', ['\xE3','\x24']), 'STY': ('rxy', ['\xE3','\x50']), diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -816,7 +816,7 @@ # get temporary locs tmploc = r.SCRATCH - fptmploc = r.f0 + fptmploc = r.FP_SCRATCH # Part about non-floats src_locations1 = [] From noreply at buildbot.pypy.org Tue Nov 24 04:07:04 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 24 Nov 2015 10:07:04 +0100 (CET) Subject: [pypy-commit] pypy default: issue #2185: shooting in the dark Message-ID: <20151124090704.52AFB1C1293@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80878:8aadecc01b7d Date: 2015-11-24 09:11 +0000 http://bitbucket.org/pypy/pypy/changeset/8aadecc01b7d/ Log: issue #2185: shooting in the dark diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -314,9 +314,16 @@ args, virtuals = target_virtual_state.make_inputargs_and_virtuals( args, self.optimizer) short_preamble = target_token.short_preamble - extra = self.inline_short_preamble(args + virtuals, args, - short_preamble, self.optimizer.patchguardop, - target_token, label_op) + try: + extra = self.inline_short_preamble(args + virtuals, args, + short_preamble, self.optimizer.patchguardop, + target_token, label_op) + except KeyError: + # SHOULD NOT OCCUR BUT DOES: WHY?? issue #2185 + self.optimizer.metainterp_sd.logger_ops.log_short_preamble([], + short_preamble, {}) + raise + self.send_extra_operation(jump_op.copy_and_change(rop.JUMP, args=args + extra, descr=target_token)) From noreply at buildbot.pypy.org Tue Nov 24 05:26:31 2015 From: noreply at buildbot.pypy.org (fijal) Date: Tue, 24 Nov 2015 11:26:31 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: fix parts of test resume Message-ID: <20151124102631.34B0F1C11B3@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80879:d42389c1c4d6 Date: 2015-11-24 11:40 +0200 http://bitbucket.org/pypy/pypy/changeset/d42389c1c4d6/ Log: fix parts of test resume diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -208,6 +208,13 @@ UNINITIALIZED = tag(-2, TAGCONST) # used for uninitialized string characters +class NumberingState(object): + def __init__(self): + self.liveboxes = {} + self.current = [] + self.n = 0 + self.v = 0 + class ResumeDataLoopMemo(object): def __init__(self, metainterp_sd): @@ -259,9 +266,13 @@ # env numbering - def _number_boxes(self, boxes, liveboxes, optimizer, v, n): + def _number_boxes(self, boxes, optimizer, state): + """ Number boxes from one snapshot + """ + n = state.n + v = state.v + liveboxes = state.liveboxes length = len(boxes) - current = [] for i in range(length): box = boxes[i] box = optimizer.get_box_replacement(box) @@ -285,57 +296,48 @@ tagged = tag(n, TAGBOX) n += 1 liveboxes[box] = tagged - current.append(tagged) - return v, n, current + state.current.append(tagged) + state.n = n + state.v = v - def _get_prev_snapshot(self, snapshot): - cur_snapshot = snapshot - while True: - try: - return self.numberings[cur_snapshot], cur_snapshot - except KeyError: - pass - cur_snapshot = cur_snapshot.prev - if not cur_snapshot: - return (lltype.nullptr(resumecode.NUMBERING), 0, {}, 0), None +# def _get_prev_snapshot(self, snapshot): +# cur_snapshot = snapshot +# while True: +# try: +# return self.numberings[cur_snapshot], cur_snapshot +# except KeyError: +# pass +# cur_snapshot = cur_snapshot.prev +# if not cur_snapshot: +# return (lltype.nullptr(resumecode.NUMBERING), 0, {}, 0), None def number(self, optimizer, snapshot, frameinfo): - # find the parent + # flatten the list + cur = snapshot + snapshot_list = [] + framestack_list = [] + while cur: + if cur is not snapshot: + framestack_list.append(frameinfo) + frameinfo = frameinfo.prev + snapshot_list.append(cur) + cur = cur.prev + snapshot_list.reverse() + framestack_list.reverse() + state = NumberingState() - p = self._get_prev_snapshot(snapshot) - (prev_numb, prev_numb_index, liveboxes, v), s = p - n = len(liveboxes) - v - first = True - all_lists = [] - total_lgt = 0 - cur_snapshot = snapshot - liveboxes_to_save = [] - while cur_snapshot != s: - liveboxes_to_save.append((liveboxes.copy(), v)) - v, n, current = self._number_boxes(cur_snapshot.boxes, liveboxes, optimizer, - v, n) - cur_snapshot = cur_snapshot.prev - if first: - first = False - else: + for i in range(len(snapshot_list)): + self._number_boxes(snapshot_list[i].boxes, optimizer, state) + if i != 0: + frameinfo = framestack_list[i - 1] jitcode_pos, pc = unpack_uint(frameinfo.packed_jitcode_pc) - current.append(rffi.cast(rffi.USHORT, jitcode_pos)) - current.append(rffi.cast(rffi.USHORT, pc)) - lst = resumecode.create_numbering(current) - total_lgt += len(lst) - all_lists.append(lst) - numb = lltype.malloc(resumecode.NUMBERING, total_lgt) - numb.prev = prev_numb - numb.prev_index = rffi.cast(rffi.USHORT, prev_numb_index) - index = 0 - for i in range(len(all_lists)): - lst = all_lists[i] - liveboxes_snapshot, v = liveboxes_to_save[i] - self.numberings[snapshot] = (numb, index, liveboxes_snapshot, v) - resumecode.copy_from_list_to_numb(lst, numb, index) - index += len(lst) - snapshot = snapshot.prev - return numb, liveboxes, v + state.current.append(rffi.cast(rffi.USHORT, jitcode_pos)) + state.current.append(rffi.cast(rffi.USHORT, pc)) + + numb = resumecode.create_numbering(state.current, + lltype.nullptr(resumecode.NUMBERING), 0) + + return numb, state.liveboxes, state.v def forget_numberings(self): # XXX ideally clear only the affected numberings diff --git a/rpython/jit/metainterp/resumecode.py b/rpython/jit/metainterp/resumecode.py --- a/rpython/jit/metainterp/resumecode.py +++ b/rpython/jit/metainterp/resumecode.py @@ -18,22 +18,24 @@ ('code', lltype.Array(rffi.UCHAR))) NUMBERINGP.TO.become(NUMBERING) -def create_numbering(lst): +def create_numbering(lst, prev, prev_index): count = 0 for item in lst: if item > 127: count += 1 count += 1 - numb = [rffi.cast(rffi.UCHAR, 0)] * count + numb = lltype.malloc(NUMBERING, count) + numb.prev = prev + numb.prev_index = rffi.cast(rffi.USHORT, prev_index) index = 0 for item in lst: if item <= 128: - numb[index] = rffi.cast(rffi.UCHAR, item) + numb.code[index] = rffi.cast(rffi.UCHAR, item) index += 1 else: assert (item >> 8) <= 127 - numb[index] = rffi.cast(rffi.UCHAR, (item >> 8) | 0x80) - numb[index + 1] = rffi.cast(rffi.UCHAR, item & 0xff) + numb.code[index] = rffi.cast(rffi.UCHAR, (item >> 8) | 0x80) + numb.code[index + 1] = rffi.cast(rffi.UCHAR, item & 0xff) index += 2 return numb diff --git a/rpython/jit/metainterp/test/test_resume.py b/rpython/jit/metainterp/test/test_resume.py --- a/rpython/jit/metainterp/test/test_resume.py +++ b/rpython/jit/metainterp/test/test_resume.py @@ -11,6 +11,7 @@ VUniPlainInfo, VUniConcatInfo, VUniSliceInfo, Snapshot, FrameInfo,\ capture_resumedata, ResumeDataLoopMemo, UNASSIGNEDVIRTUAL, INT,\ annlowlevel, PENDINGFIELDSP, unpack_uint +from rpython.jit.metainterp.resumecode import unpack_numbering from rpython.jit.metainterp.optimizeopt import info from rpython.jit.metainterp.history import ConstInt, Const, AbstractDescr from rpython.jit.metainterp.history import ConstPtr, ConstFloat @@ -926,21 +927,19 @@ assert liveboxes == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b3: tag(2, TAGBOX)} - assert list(numb.nums) == [tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), - tag(1, TAGINT)] - assert list(numb.prev.nums) == [tag(0, TAGBOX), tag(1, TAGINT), - tag(1, TAGBOX), - tag(0, TAGBOX), tag(2, TAGINT)] - assert not numb.prev.prev + base = [tag(0, TAGBOX), tag(1, TAGINT), tag(1, TAGBOX), tag(0, TAGBOX), tag(2, TAGINT)] - numb2, liveboxes2, v = memo.number(FakeOptimizer(), snap2) + assert unpack_numbering(numb) == base + [ + tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), tag(1, TAGINT), 0, 0] + + numb2, liveboxes2, v = memo.number(FakeOptimizer(), snap2, frameinfo) assert v == 0 assert liveboxes2 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b3: tag(2, TAGBOX)} assert liveboxes2 is not liveboxes - assert list(numb2.nums) == [tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), - tag(3, TAGINT)] + assert unpack_numbering(numb2) == base + [ + tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), tag(3, TAGINT), 0, 0] assert numb2.prev == numb.prev env3 = [c3, b3, b1, c3] @@ -955,41 +954,39 @@ # renamed b3.set_forwarded(c4) - numb3, liveboxes3, v = memo.number(FakeOptimizer(), snap3) + numb3, liveboxes3, v = memo.number(FakeOptimizer(), snap3, frameinfo) assert v == 0 assert liveboxes3 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX)} - assert list(numb3.nums) == [tag(3, TAGINT), tag(4, TAGINT), tag(0, TAGBOX), - tag(3, TAGINT)] - assert numb3.prev == numb.prev + assert unpack_numbering(numb3) == base + [tag(3, TAGINT), tag(4, TAGINT), tag(0, TAGBOX), + tag(3, TAGINT), 0, 0] # virtual env4 = [c3, b4, b1, c3] snap4 = Snapshot(snap, env4) b4.set_forwarded(FakeVirtualInfo(True)) - numb4, liveboxes4, v = memo.number(FakeOptimizer(), snap4) + numb4, liveboxes4, v = memo.number(FakeOptimizer(), snap4, frameinfo) assert v == 1 assert liveboxes4 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b4: tag(0, TAGVIRTUAL)} - assert list(numb4.nums) == [tag(3, TAGINT), tag(0, TAGVIRTUAL), - tag(0, TAGBOX), tag(3, TAGINT)] - assert numb4.prev == numb.prev + assert unpack_numbering(numb4) == base + [tag(3, TAGINT), tag(0, TAGVIRTUAL), + tag(0, TAGBOX), tag(3, TAGINT), 0, 0] env5 = [b1, b4, b5] snap5 = Snapshot(snap4, env5) b4.set_forwarded(FakeVirtualInfo(True)) b5.set_forwarded(FakeVirtualInfo(True)) - numb5, liveboxes5, v = memo.number(FakeOptimizer(), snap5) + frameinfo = FrameInfo(frameinfo, FakeJitCode("foo", 2), 1) + numb5, liveboxes5, v = memo.number(FakeOptimizer(), snap5, frameinfo) assert v == 2 assert liveboxes5 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b4: tag(0, TAGVIRTUAL), b5: tag(1, TAGVIRTUAL)} - assert list(numb5.nums) == [tag(0, TAGBOX), tag(0, TAGVIRTUAL), - tag(1, TAGVIRTUAL)] - assert numb5.prev == numb4 + assert unpack_numbering(numb5) == unpack_numbering(numb4) + [tag(0, TAGBOX), tag(0, TAGVIRTUAL), + tag(1, TAGVIRTUAL), 2, 1] def test_ResumeDataLoopMemo_number_boxes(): memo = ResumeDataLoopMemo(FakeMetaInterpStaticData()) From noreply at buildbot.pypy.org Tue Nov 24 05:26:33 2015 From: noreply at buildbot.pypy.org (fijal) Date: Tue, 24 Nov 2015 11:26:33 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: small progress Message-ID: <20151124102633.49FE41C11B3@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80880:c73a5279a022 Date: 2015-11-24 12:26 +0200 http://bitbucket.org/pypy/pypy/changeset/c73a5279a022/ Log: small progress diff --git a/rpython/jit/codewriter/jitcode.py b/rpython/jit/codewriter/jitcode.py --- a/rpython/jit/codewriter/jitcode.py +++ b/rpython/jit/codewriter/jitcode.py @@ -142,6 +142,7 @@ return ord(self.live_f[index]) def enumerate_vars(self, callback_i, callback_r, callback_f, spec): + xxx index = 0 for i in range(self.get_register_count_i()): callback_i(index, self.get_register_index_i(i)) diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -978,7 +978,8 @@ def _init(self, cpu, storage): self.cpu = cpu - self.cur_numb = storage.rd_numb + self.numb = storage.rd_numb + self.cur_index = 0 self.count = storage.rd_count self.consts = storage.rd_consts @@ -1061,23 +1062,29 @@ def _prepare_next_section(self, info): # Use info.enumerate_vars(), normally dispatching to # rpython.jit.codewriter.jitcode. Some tests give a different 'info'. - info.enumerate_vars(self._callback_i, - self._callback_r, - self._callback_f, - self.unique_id) # <-- annotation hack - self.cur_numb = self.cur_numb.prev + self.cur_index = info.enumerate_vars(self._callback_i, + self._callback_r, + self._callback_f, + self.unique_id, # <-- annotation hack + self.cur_index) def _callback_i(self, index, register_index): - value = self.decode_int(self.cur_numb.nums[index]) + item, index = resumecode.numb_next_item(self.numb, index) + value = self.decode_int(item) self.write_an_int(register_index, value) + return index def _callback_r(self, index, register_index): - value = self.decode_ref(self.cur_numb.nums[index]) + item, index = resumecode.numb_next_item(self.numb, index) + value = self.decode_ref(item) self.write_a_ref(register_index, value) + return index def _callback_f(self, index, register_index): - value = self.decode_float(self.cur_numb.nums[index]) + item, index = resumecode.numb_next_item(self.numb, index) + value = self.decode_float(item) self.write_a_float(register_index, value) + return index # ---------- when resuming for pyjitpl.py, make boxes ---------- @@ -1379,6 +1386,7 @@ # # Now fill the blackhole interpreters with resume data. curbh = firstbh + xxxx numbering = storage.rd_numb.prev while True: jitcode_pos, pc = unpack_uint(numbering.packed_jitcode_pc) diff --git a/rpython/jit/metainterp/resumecode.py b/rpython/jit/metainterp/resumecode.py --- a/rpython/jit/metainterp/resumecode.py +++ b/rpython/jit/metainterp/resumecode.py @@ -17,6 +17,7 @@ ('prev_index', rffi.USHORT), ('code', lltype.Array(rffi.UCHAR))) NUMBERINGP.TO.become(NUMBERING) +NULL_NUMBER = lltype.nullptr(NUMBERING) def create_numbering(lst, prev, prev_index): count = 0 diff --git a/rpython/jit/metainterp/test/test_resume.py b/rpython/jit/metainterp/test/test_resume.py --- a/rpython/jit/metainterp/test/test_resume.py +++ b/rpython/jit/metainterp/test/test_resume.py @@ -11,7 +11,9 @@ VUniPlainInfo, VUniConcatInfo, VUniSliceInfo, Snapshot, FrameInfo,\ capture_resumedata, ResumeDataLoopMemo, UNASSIGNEDVIRTUAL, INT,\ annlowlevel, PENDINGFIELDSP, unpack_uint -from rpython.jit.metainterp.resumecode import unpack_numbering +from rpython.jit.metainterp.resumecode import unpack_numbering,\ + create_numbering, NULL_NUMBER + from rpython.jit.metainterp.optimizeopt import info from rpython.jit.metainterp.history import ConstInt, Const, AbstractDescr from rpython.jit.metainterp.history import ConstPtr, ConstFloat @@ -238,17 +240,18 @@ def get_current_position_info(self): class MyInfo: @staticmethod - def enumerate_vars(callback_i, callback_r, callback_f, _): + def enumerate_vars(callback_i, callback_r, callback_f, _, index): count_i = count_r = count_f = 0 - for index, ARG in enumerate(self.ARGS): + for ARG in self.ARGS: if ARG == lltype.Signed: - callback_i(index, count_i); count_i += 1 + index = callback_i(index, count_i); count_i += 1 elif ARG == llmemory.GCREF: - callback_r(index, count_r); count_r += 1 + index = callback_r(index, count_r); count_r += 1 elif ARG == longlong.FLOATSTORAGE: - callback_f(index, count_f); count_f += 1 + index = callback_f(index, count_f); count_f += 1 else: assert 0 + return index return MyInfo() def setarg_i(self, index, value): @@ -275,11 +278,8 @@ assert bh.written_f == expected_f -def Numbering(prev, nums): - numb = lltype.malloc(NUMBERING, len(nums)) - numb.prev = prev or lltype.nullptr(NUMBERING) - for i in range(len(nums)): - numb.nums[i] = nums[i] +def Numbering(nums): + numb = create_numbering(nums, NULL_NUMBER, 0) return numb def test_simple_read(): @@ -287,13 +287,10 @@ c1, c2, c3 = [ConstInt(111), ConstInt(222), ConstInt(333)] storage = Storage() storage.rd_consts = [c1, c2, c3] - numb = Numbering(None, [tag(0, TAGBOX), tag(1, TAGBOX), tag(2, TAGBOX)]) - numb = Numbering(numb, [tag(1, TAGCONST), tag(2, TAGCONST)]) - numb = Numbering(numb, [tag(0, TAGBOX), - tag(0, TAGCONST), - NULLREF, - tag(0, TAGBOX), - tag(1, TAGBOX)]) + numb = Numbering([tag(0, TAGBOX), tag(0, TAGCONST), + NULLREF, tag(0, TAGBOX), tag(1, TAGBOX)] + + [tag(1, TAGCONST), tag(2, TAGCONST)] + [0, 0] + + [tag(0, TAGBOX), tag(1, TAGBOX), tag(2, TAGBOX)] + [0, 0]) storage.rd_numb = numb storage.rd_count = 3 # @@ -1072,8 +1069,10 @@ snapshot = Snapshot(None, [b1, ConstInt(1), b1, b2]) snapshot = Snapshot(snapshot, [ConstInt(2), ConstInt(3)]) snapshot = Snapshot(snapshot, [b1, b2, b3]) + frameinfo = FrameInfo(FrameInfo(None, FakeJitCode("code1", 21), 22), + FakeJitCode("code2", 31), 32) storage.rd_snapshot = snapshot - storage.rd_frame_info_list = None + storage.rd_frame_info_list = frameinfo return storage def test_virtual_adder_int_constants(): From noreply at buildbot.pypy.org Tue Nov 24 05:50:13 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 11:50:13 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: removed custom test to more easily find the error in the more complex test Message-ID: <20151124105013.D849F1C11B3@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80881:6afaba9d83d4 Date: 2015-11-24 09:48 +0100 http://bitbucket.org/pypy/pypy/changeset/6afaba9d83d4/ Log: removed custom test to more easily find the error in the more complex test diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -1222,59 +1222,6 @@ got = self.cpu.get_float_value(deadframe, k) assert got == retvalues[k] - def test_jump_simple(self): - # this test generates small loops where the JUMP passes many - # arguments of various types, shuffling them around. - arg_count = 15 - inputargs = [InputArgInt() for i in range(arg_count)] - # - index_counter = len(inputargs) - i0 = InputArgInt() - - jumpargs = inputargs[:] - remixing = [(0,1),(2,1),(4,7)] - for a,b in remixing: - jumpargs[a],jumpargs[b] = jumpargs[b],jumpargs[a] - # - looptoken = JitCellToken() - targettoken = TargetToken() - faildescr = BasicFailDescr(15) - inputargs.append(i0) - op0 = ResOperation(rop.LABEL, inputargs, descr=targettoken) - op1 = ResOperation(rop.INT_SUB, [i0, ConstInt(1)]) - op2 = ResOperation(rop.INT_GE, [op1, ConstInt(0)]) - op3 = ResOperation(rop.GUARD_TRUE, [op2]) - jumpargs.append(op1) - op4 = ResOperation(rop.JUMP, jumpargs, descr=targettoken) - operations = [op0, op1, op2, op3, op4] - operations[3].setfailargs(inputargs[:]) - operations[3].setdescr(faildescr) - # - loop_count = 11 - self.cpu.compile_loop(inputargs, operations, looptoken) - values = [i for i in range(arg_count)] - # - vals = values + [loop_count] - print("args", inputargs) - print("jump", jumpargs) - print("entering with values", vals) - deadframe = self.cpu.execute_token(looptoken, *vals) - fail = self.cpu.get_latest_descr(deadframe) - assert fail.identifier == 15 - # - dstvalues = values[:] - for _ in range(loop_count): - for a,b in remixing: - dstvalues[a],dstvalues[b] = dstvalues[b],dstvalues[a] - # - #assert dstvalues[index_counter] == loop_count - #dstvalues[index_counter] = 0 - expected = [self.cpu.get_int_value(deadframe, i) for i in range(arg_count)] - for i, (box, val) in enumerate(zip(inputargs[:-1], dstvalues)): - got = self.cpu.get_int_value(deadframe, i) - assert type(got) == type(val) - assert got == val - def test_jump(self): # this test generates small loops where the JUMP passes many # arguments of various types, shuffling them around. From noreply at buildbot.pypy.org Tue Nov 24 05:50:16 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 11:50:16 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added the right parameters to obj dump and added test regex for compile_asm_len Message-ID: <20151124105016.0251E1C11B3@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80882:ab489b42ecd2 Date: 2015-11-24 11:50 +0100 http://bitbucket.org/pypy/pypy/changeset/ab489b42ecd2/ Log: added the right parameters to obj dump and added test regex for compile_asm_len diff --git a/rpython/jit/backend/llsupport/jump.py b/rpython/jit/backend/llsupport/jump.py --- a/rpython/jit/backend/llsupport/jump.py +++ b/rpython/jit/backend/llsupport/jump.py @@ -64,18 +64,16 @@ assert pending_dests == 0 def _move(assembler, src, dst, tmpreg): - if dst.is_stack() and src.is_stack(): - assembler.regalloc_mov(src, tmpreg) - src = tmpreg + # some assembler cannot handle memory to memory moves without + # a tmp register, thus prepare src according to the ISA capabilities + src = assembler.regalloc_prepare_move(src, dst, tmpreg) assembler.regalloc_mov(src, dst) def remap_frame_layout_mixed(assembler, src_locations1, dst_locations1, tmpreg1, - src_locations2, dst_locations2, tmpreg2): + src_locations2, dst_locations2, tmpreg2, WORD): # find and push the fp stack locations from src_locations2 that # are going to be overwritten by dst_locations1 - # TODO - from rpython.jit.backend.zarch.arch import WORD extrapushes = [] dst_keys = {} for loc in dst_locations1: diff --git a/rpython/jit/backend/tool/viewcode.py b/rpython/jit/backend/tool/viewcode.py --- a/rpython/jit/backend/tool/viewcode.py +++ b/rpython/jit/backend/tool/viewcode.py @@ -51,11 +51,13 @@ 'arm_32': 'arm', 'ppc' : 'powerpc:common64', 'ppc-64' : 'powerpc:common64', + 's390x': 's390:64-bit', } machine_endianness = { # default value: 'little' 'ppc' : sys.byteorder, # i.e. same as the running machine... 'ppc-64' : sys.byteorder, # i.e. same as the running machine... + 's390x' : sys.byteorder, # i.e. same as the running machine... } cmd = find_objdump() objdump = ('%(command)s -b binary -m %(machine)s ' diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -414,6 +414,15 @@ self.mc.LG(r.SCRATCH, l.addr(index, r.SP)) self.regalloc_mov(r.SCRATCH, loc) + def regalloc_prepare_move(self, src, dst, tmp): + if dst.is_stack() and src.is_stack(): + self.regalloc_mov(src, tmp) + return tmp + if dst.is_stack() and src.is_in_pool(): + self.regalloc_mov(src, tmp) + return tmp + return src + def _assemble(self, regalloc, inputargs, operations): self._regalloc = regalloc self.guard_success_cc = c.cond_none @@ -441,18 +450,18 @@ elif loc.is_stack(): with scratch_reg(self.mc): offset = loc.value - self.mc.load_imm(r.SCRATCH, value) - self.mc.store(r.SCRATCH.value, r.SPP, offset) + self.mc.load_imm(r.SCRATCH, prev_loc) + self.mc.STG(r.SCRATCH, l.addr(offset, r.SPP)) return assert 0, "not supported location" elif prev_loc.is_in_pool(): if loc.is_reg(): self.mc.LG(loc, prev_loc) + return elif loc.is_fp_reg(): self.mc.LD(loc, prev_loc) - else: - xxx - return + return + assert 0, "not supported location (previous is pool loc)" elif prev_loc.is_stack(): offset = prev_loc.value # move from memory to register diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py --- a/rpython/jit/backend/zarch/locations.py +++ b/rpython/jit/backend/zarch/locations.py @@ -194,6 +194,9 @@ if length: self.length = length.value + def as_key(self): + return self.displace + 100000 + class PoolLoc(AddressLocation): _immutable_ = True width = WORD @@ -218,7 +221,6 @@ def __repr__(self): return "pool(i,%d)" % self.displace - def addr(displace, basereg=None, indexreg=None, length=None): return AddressLocation(basereg, indexreg, displace, length) diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -251,12 +251,12 @@ if l0.is_reg(): if l1.is_imm(): - self.mc.cmp_op(0, l0.value, l1.getint(), imm=True) + self.mc.cmp_op(l0, l1, imm=True) else: - self.mc.cmp_op(0, l0.value, l1.value) + self.mc.cmp_op(l0, l1) elif l0.is_fp_reg(): assert l1.is_fp_reg() - self.mc.cmp_op(0, l0.value, l1.value, fp=True) + self.mc.cmp_op(l0, l1, fp=True) self.guard_success_cc = c.EQ self._emit_guard(op, failargs) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -570,9 +570,9 @@ if box.type == FLOAT: return self.fprm.ensure_reg(box) else: - if check_imm_box(box): + if helper.check_imm(box): return imm(box.getint()) - return self.rm.ensure_reg(box) + return self.rm.ensure_reg(box, force_in_reg=True) def ensure_reg_or_any_imm(self, box): if box.type == FLOAT: @@ -580,7 +580,7 @@ else: if isinstance(box, Const): return imm(box.getint()) - return self.rm.ensure_reg(box) + return self.rm.ensure_reg(box, force_in_reg=True) def get_scratch_reg(self, type): if type == FLOAT: @@ -759,6 +759,12 @@ prepare_guard_overflow = prepare_guard_no_exception prepare_guard_not_forced = prepare_guard_no_exception + def prepare_guard_value(self, op): + l0 = self.ensure_reg(op.getarg(0)) + l1 = self.ensure_reg_or_16bit_imm(op.getarg(1)) + arglocs = self._prepare_guard(op, [l0, l1]) + return arglocs + def prepare_label(self, op): descr = op.getdescr() assert isinstance(descr, TargetToken) @@ -838,7 +844,7 @@ remap_frame_layout_mixed(self.assembler, src_locations1, dst_locations1, tmploc, - src_locations2, dst_locations2, fptmploc) + src_locations2, dst_locations2, fptmploc, WORD) return [] def prepare_finish(self, op): diff --git a/rpython/jit/backend/zarch/test/test_runner.py b/rpython/jit/backend/zarch/test/test_runner.py --- a/rpython/jit/backend/zarch/test/test_runner.py +++ b/rpython/jit/backend/zarch/test/test_runner.py @@ -23,3 +23,7 @@ cpu = CPU_S390_64(rtyper=None, stats=FakeStats()) cpu.setup_once() return cpu + + # TODO verify: the lgr might be redundant! + add_loop_instructions = "lg; lgr; larl; agr; cgfi; je; j;$" + bridge_loop_instructions = ("larl; lg; br;") From noreply at buildbot.pypy.org Tue Nov 24 05:52:07 2015 From: noreply at buildbot.pypy.org (fijal) Date: Tue, 24 Nov 2015 11:52:07 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: whack at test_resume more Message-ID: <20151124105207.2829A1C11B3@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80883:d1ffcc38ac2c Date: 2015-11-24 12:52 +0200 http://bitbucket.org/pypy/pypy/changeset/d1ffcc38ac2c/ Log: whack at test_resume more diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -204,9 +204,9 @@ UNASSIGNED = tag(-1 << 13, TAGBOX) UNASSIGNEDVIRTUAL = tag(-1 << 13, TAGVIRTUAL) -NULLREF = tag(-1, TAGCONST) -UNINITIALIZED = tag(-2, TAGCONST) # used for uninitialized string characters - +NULLREF = tag(0, TAGCONST) +UNINITIALIZED = tag(1, TAGCONST) # used for uninitialized string characters +TAG_CONST_OFFSET = 2 class NumberingState(object): def __init__(self): @@ -260,7 +260,7 @@ return self._newconst(const) def _newconst(self, const): - result = tag(len(self.consts), TAGCONST) + result = tag(len(self.consts) + TAG_CONST_OFFSET, TAGCONST) self.consts.append(const) return result @@ -1143,6 +1143,7 @@ return [self.decode_ref(numb.nums[i]) for i in range(end)] def consume_vref_and_vable_boxes(self, vinfo, ginfo): + xxxx numb = self.cur_numb self.cur_numb = numb.prev if vinfo is not None: @@ -1294,7 +1295,7 @@ if tagged_eq(tagged, NULLREF): box = self.cpu.ts.CONST_NULL else: - box = self.consts[num] + box = self.consts[num - TAG_CONST_OFFSET] elif tag == TAGVIRTUAL: if kind == INT: box = self.getvirtual_int(num) @@ -1604,7 +1605,7 @@ def decode_int(self, tagged): num, tag = untag(tagged) if tag == TAGCONST: - return self.consts[num].getint() + return self.consts[num - TAG_CONST_OFFSET].getint() elif tag == TAGINT: return num elif tag == TAGVIRTUAL: @@ -1620,7 +1621,7 @@ if tag == TAGCONST: if tagged_eq(tagged, NULLREF): return self.cpu.ts.NULLREF - return self.consts[num].getref_base() + return self.consts[num - TAG_CONST_OFFSET].getref_base() elif tag == TAGVIRTUAL: return self.getvirtual_ptr(num) else: @@ -1632,7 +1633,7 @@ def decode_float(self, tagged): num, tag = untag(tagged) if tag == TAGCONST: - return self.consts[num].getfloatstorage() + return self.consts[num - TAG_CONST_OFFSET].getfloatstorage() else: assert tag == TAGBOX if num < 0: diff --git a/rpython/jit/metainterp/resumecode.py b/rpython/jit/metainterp/resumecode.py --- a/rpython/jit/metainterp/resumecode.py +++ b/rpython/jit/metainterp/resumecode.py @@ -30,6 +30,7 @@ numb.prev_index = rffi.cast(rffi.USHORT, prev_index) index = 0 for item in lst: + assert item >= 0 if item <= 128: numb.code[index] = rffi.cast(rffi.UCHAR, item) index += 1 diff --git a/rpython/jit/metainterp/test/test_resume.py b/rpython/jit/metainterp/test/test_resume.py --- a/rpython/jit/metainterp/test/test_resume.py +++ b/rpython/jit/metainterp/test/test_resume.py @@ -10,7 +10,7 @@ VArrayInfoNotClear, VStrPlainInfo, VStrConcatInfo, VStrSliceInfo,\ VUniPlainInfo, VUniConcatInfo, VUniSliceInfo, Snapshot, FrameInfo,\ capture_resumedata, ResumeDataLoopMemo, UNASSIGNEDVIRTUAL, INT,\ - annlowlevel, PENDINGFIELDSP, unpack_uint + annlowlevel, PENDINGFIELDSP, unpack_uint, TAG_CONST_OFFSET from rpython.jit.metainterp.resumecode import unpack_numbering,\ create_numbering, NULL_NUMBER @@ -282,15 +282,18 @@ numb = create_numbering(nums, NULL_NUMBER, 0) return numb +def tagconst(i): + return tag(i + TAG_CONST_OFFSET, TAGCONST) + def test_simple_read(): #b1, b2, b3 = [BoxInt(), InputArgRef(), BoxInt()] c1, c2, c3 = [ConstInt(111), ConstInt(222), ConstInt(333)] storage = Storage() storage.rd_consts = [c1, c2, c3] - numb = Numbering([tag(0, TAGBOX), tag(0, TAGCONST), + numb = Numbering([tag(0, TAGBOX), tagconst(0), NULLREF, tag(0, TAGBOX), tag(1, TAGBOX)] + - [tag(1, TAGCONST), tag(2, TAGCONST)] + [0, 0] + - [tag(0, TAGBOX), tag(1, TAGBOX), tag(2, TAGBOX)] + [0, 0]) + [tagconst(1), tagconst(2)] + + [tag(0, TAGBOX), tag(1, TAGBOX), tag(2, TAGBOX)]) storage.rd_numb = numb storage.rd_count = 3 # From noreply at buildbot.pypy.org Tue Nov 24 05:52:51 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 11:52:51 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: copy copy copy. void operations such as jit_debug. test passes Message-ID: <20151124105251.8F15D1C11B3@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80884:52e2814e517d Date: 2015-11-24 11:53 +0100 http://bitbucket.org/pypy/pypy/changeset/52e2814e517d/ Log: copy copy copy. void operations such as jit_debug. test passes diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -411,3 +411,14 @@ self.mc.AGHI(scratch, l.imm(1)) self.mc.STG(scratch, l.addr(0,addr)) + def emit_debug_merge_point(self, op, arglocs, regalloc): + pass + + emit_jit_debug = emit_debug_merge_point + emit_keepalive = emit_debug_merge_point + + def emit_enter_portal_frame(self, op, arglocs, regalloc): + self.enter_portal_frame(op) + + def emit_leave_portal_frame(self, op, arglocs, regalloc): + self.leave_portal_frame(op) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -707,6 +707,15 @@ prepare_same_as_r = helper.prepare_same_as prepare_same_as_f = helper.prepare_same_as + def void(self, op): + return [] + + prepare_debug_merge_point = void + prepare_jit_debug = void + prepare_keepalive = void + prepare_enter_portal_frame = void + prepare_leave_portal_frame = void + def prepare_cast_int_to_float(self, op): loc1 = self.ensure_reg(op.getarg(0)) res = self.fprm.force_allocate_reg(op) From noreply at buildbot.pypy.org Tue Nov 24 10:13:31 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 16:13:31 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: finally, the indices for storing/restoring from a register where slightly off, which read garbage from the jitframe (floating point issues) Message-ID: <20151124151331.D25F41C052B@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80885:c55975affb6c Date: 2015-11-24 16:13 +0100 http://bitbucket.org/pypy/pypy/changeset/c55975affb6c/ Log: finally, the indices for storing/restoring from a register where slightly off, which read garbage from the jitframe (floating point issues) diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -595,6 +595,7 @@ self.mc.AGHI(r.SP, l.imm(-STD_FRAME_SIZE_IN_BYTES)) # save r4, the second argument, to THREADLOCAL_ADDR_OFFSET + # TODO #self.mc.STG(r.r3, l.addr(THREADLOCAL_ADDR_OFFSET, r.SP)) # move the first argument to SPP: the jitframe object diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -309,7 +309,6 @@ self.base_ofs = base_ofs def frame_pos(self, loc, box_type): - #return l.StackLocation(loc, get_fp_offset(self.base_ofs, loc), box_type) return l.StackLocation(loc, get_fp_offset(self.base_ofs, loc), box_type) @staticmethod diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py --- a/rpython/jit/backend/zarch/runner.py +++ b/rpython/jit/backend/zarch/runner.py @@ -27,7 +27,7 @@ all_reg_indexes = [-1] * 32 for _i, _r in enumerate(r.registers): all_reg_indexes[_r.value] = _i - gen_regs = r.MANAGED_REGS + gen_regs = r.registers float_regs = r.MANAGED_FP_REGS def setup(self): From noreply at buildbot.pypy.org Tue Nov 24 10:21:03 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 16:21:03 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: forgot to rename FSCRATCH to FP_SCRATCH Message-ID: <20151124152103.8274A1C052B@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80886:78d26c28212c Date: 2015-11-24 16:21 +0100 http://bitbucket.org/pypy/pypy/changeset/78d26c28212c/ Log: forgot to rename FSCRATCH to FP_SCRATCH diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -671,8 +671,8 @@ [return_val, fail_descr_loc] = arglocs if op.getarg(0).type == FLOAT: if return_val.is_in_pool(): - self.mc.LDY(r.FSCRATCH, return_val) - return_val = r.FSCRATCH + self.mc.LDY(r.FP_SCRATCH, return_val) + return_val = r.FP_SCRATCH self.mc.STD(return_val, l.addr(base_ofs, r.SPP)) else: if return_val.is_in_pool(): From noreply at buildbot.pypy.org Tue Nov 24 10:30:49 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 24 Nov 2015 16:30:49 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: make some gc framework tests pass again Message-ID: <20151124153049.442891C052B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80887:00e26e7cf877 Date: 2015-11-24 09:27 +0100 http://bitbucket.org/pypy/pypy/changeset/00e26e7cf877/ Log: make some gc framework tests pass again diff --git a/rpython/memory/gc/stmgc.py b/rpython/memory/gc/stmgc.py --- a/rpython/memory/gc/stmgc.py +++ b/rpython/memory/gc/stmgc.py @@ -12,6 +12,8 @@ from rpython.rtyper.extregistry import ExtRegistryEntry from rpython.translator.stm import stmgcintf from rpython.rlib import rstm +from rpython.rlib.objectmodel import we_are_translated +from rpython.rtyper.lltypesystem.llmemory import raw_malloc_usage WORD = LONG_BIT // 8 NULL = llmemory.NULL @@ -74,15 +76,16 @@ needs_finalizer=False, is_finalizer_light=False, contains_weakptr=False): - if size < 16: - size = 16 # minimum size (test usually constant-folded) + rawsize = raw_malloc_usage(size) # unwrap for tests + if rawsize < 16: + rawsize = 16 # minimum size (test usually constant-folded) if contains_weakptr: # check constant-folded - return llop.stm_allocate_weakref(llmemory.GCREF, size, typeid16) + return llop.stm_allocate_weakref(llmemory.GCREF, rawsize, typeid16) if needs_finalizer: if is_finalizer_light: - return llop.stm_allocate_f_light(llmemory.GCREF, size, typeid16) - return llop.stm_allocate_finalizer(llmemory.GCREF, size, typeid16) - return llop.stm_allocate_tid(llmemory.GCREF, size, typeid16) + return llop.stm_allocate_f_light(llmemory.GCREF, rawsize, typeid16) + return llop.stm_allocate_finalizer(llmemory.GCREF, rawsize, typeid16) + return llop.stm_allocate_tid(llmemory.GCREF, rawsize, typeid16) def malloc_varsize(self, typeid16, length, size, itemsize, offset_to_length): diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -12,7 +12,7 @@ from rpython.memory.gctransform.transform import GcHighLevelOp from rpython.rtyper.rtyper import LowLevelOpList from rpython.translator.backendopt.all import backend_optimizations -from rpython.translator.c.gc import BasicFrameworkGcPolicy +from rpython.translator.c.gc import BasicFrameworkGcPolicy, StmFrameworkGcPolicy from rpython.translator.exceptiontransform import ExceptionTransformer from rpython.translator.translator import TranslationContext, graphof from rpython.translator.unsimplify import varoftype @@ -39,10 +39,13 @@ t = rtype(entrypoint, [s_list_of_strings]) if gc == "stmgc": t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + else: + gcpolicy = FrameworkGcPolicy2 t.config.translation.gc = gc - + cbuild = CStandaloneBuilder(t, entrypoint, t.config, - gcpolicy=FrameworkGcPolicy2) + gcpolicy=gcpolicy) db = cbuild.generate_graphs_for_llinterp() entrypointptr = cbuild.getentrypointptr() entrygraph = entrypointptr._obj.graph @@ -59,7 +62,7 @@ def test_framework_simple_stm(): test_framework_simple("stmgc") - + def test_cancollect(): S = lltype.GcStruct('S', ('x', lltype.Signed)) def g(): @@ -72,7 +75,7 @@ return -x t = rtype(g, [int]) gg = graphof(t, g) - assert not CollectAnalyzer(t).analyze_direct_call(gg) + assert not CollectAnalyzer(t).analyze_direct_call(gg) def test_cancollect_external(): fext1 = rffi.llexternal('fext1', [], lltype.Void, releasegil=False) @@ -99,7 +102,7 @@ t = rtype(g, []) gg = graphof(t, g) assert CollectAnalyzer(t).analyze_direct_call(gg) - + def test_no_collect(gc="minimark"): from rpython.rlib import rgc from rpython.translator.c.genc import CStandaloneBuilder @@ -113,13 +116,16 @@ def entrypoint(argv): return g() + 2 - + t = rtype(entrypoint, [s_list_of_strings]) if gc == "stmgc": t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + else: + gcpolicy = FrameworkGcPolicy2 t.config.translation.gc = gc cbuild = CStandaloneBuilder(t, entrypoint, t.config, - gcpolicy=FrameworkGcPolicy2) + gcpolicy=gcpolicy) db = cbuild.generate_graphs_for_llinterp() def test_no_collect_stm(): @@ -142,20 +148,23 @@ def entrypoint(argv): return g() + 2 - + t = rtype(entrypoint, [s_list_of_strings]) if gc == "stmgc": t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + else: + gcpolicy = FrameworkGcPolicy2 t.config.translation.gc = gc cbuild = CStandaloneBuilder(t, entrypoint, t.config, - gcpolicy=FrameworkGcPolicy2) + gcpolicy=gcpolicy) f = py.test.raises(Exception, cbuild.generate_graphs_for_llinterp) expected = "'no_collect' function can trigger collection: Author: Remi Meier Branch: stmgc-c8 Changeset: r80888:6882bd53ee96 Date: 2015-11-24 15:55 +0100 http://bitbucket.org/pypy/pypy/changeset/6882bd53ee96/ Log: add analysis for better write barrier placement Adds a class that looks for write/set-operations that do not require a write barrier since the target already had a barrier executed on all paths to these operations or the target is freshly allocated (with no can-collect inbetween). diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -52,6 +52,147 @@ return (op.opname in LL_OPERATIONS and LL_OPERATIONS[op.opname].canmallocgc) + +class WriteBarrierCollector(object): + """ + This class implements a forward data flow analysis to find all + set/write-operations in the graph that do *not* require a + barrier, either because they are freshly allocated or they + just had a barrier-requiring operation before them. + """ + + def __init__(self, graph, collect_analyzer): + self.graph = graph + self.collect_analyzer = collect_analyzer + self.clean_ops = set() + self._in_states = {} # block->state of each inputarg + self._out_states = {} # block->writable dict + self.in_stm_ignored = False + + def _merge_out_states(self, out_states): + assert out_states + # True: writeable or fresh, otherwise False + result = [True] * len(out_states[0]) + for outset in out_states: + for i, state in enumerate(outset): + result[i] = result[i] and state + return result + + def _set_into_gc_array_part(self, op): + if op.opname == 'setarrayitem': + return op.args[1] + if op.opname == 'setinteriorfield': + for v in op.args[1:-1]: + if v.concretetype is not lltype.Void: + return v + return None + + def _flow_through_block(self, block): + # get all out_state of predecessors and recalculate + # the in_state of our block (except for startblock) + insets = self._in_states + # + # get input variables and their states: + writeable = {} + for v, state in zip(block.inputargs, insets[block]): + writeable[v] = state + # + # flow through block and inspect operations that + # need a write barrier, and those that create new + # objects + for i, op in enumerate(block.operations): + if self.collect_analyzer.analyze(op): # incl. malloc, obviously + # clear all writeable status + writeable = {} + # + if op.opname == "stm_ignored_start": + self.in_stm_ignored = True + elif op.opname == "stm_ignored_stop": + self.in_stm_ignored = False + elif op.opname == "malloc": + rtti = get_rtti(op.args[0].value) + if rtti is not None and hasattr(rtti._obj, 'destructor_funcptr'): + # XXX: not sure why that matters, copied from + # find_initializing_stores + continue + writeable[op.result] = True + # + elif op.opname in ("cast_pointer", "same_as"): + if writeable.get(op.args[0], False): + writeable[op.result] = True + # + elif op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', 'raw_store'): + if op.args[-1].concretetype == lltype.Void: + self.clean_ops.add(op) + continue # ignore setfields of Void type + elif not var_needsgc(op.args[0]): + if (var_needsgc(op.args[-1]) and + 'is_excdata' not in op.args[0].concretetype.TO._hints): + raise Exception("%s: GC pointer written into a non-GC location" + % (op,)) + self.clean_ops.add(op) + continue + elif self.in_stm_ignored: + # detect if we're inside a 'stm_ignored' block and in + # that case don't call stm_write(). This only works for + # writing non-GC pointers. + if var_needsgc(op.args[-1]): + raise Exception("in stm_ignored block: write of a gc pointer") + self.clean_ops.add(op) + continue + elif self._set_into_gc_array_part(op) is None: + # full write barrier required + if writeable.get(op.args[0], False): + # already writeable, this op is also clean + self.clean_ops.add(op) + elif op in self.clean_ops: + # we require an stm_write + self.clean_ops.remove(op) + # always writeable after this op + writeable[op.args[0]] = True + else: + # things that need partial write barriers (card marking) + assert op not in self.clean_ops + # + # update in_states of all successors + updated = set() + for link in block.exits: + succ = link.target + outset = [writeable.get(v, False) for v in link.args] + if succ in insets: + to_merge = [insets[succ], outset] + new = self._merge_out_states(to_merge) + if new != insets[succ]: + updated.add(succ) + insets[succ] = new + else: + # block not processed yet + insets[succ] = outset + updated.add(succ) + return updated + + + def collect(self): + assert not self.clean_ops + assert not self.in_stm_ignored + # we implement a forward-flow analysis that determines the + # operations that do NOT need a write barrier + graph = self.graph + # + # initialize blocks + self._in_states = {} + self._in_states[graph.startblock] = [False] * len(graph.startblock.inputargs) + # + # fixpoint iteration + # XXX: reverse postorder traversal + pending = {graph.startblock,} + while pending: + block = pending.pop() + pending |= self._flow_through_block(block) + + + + def propagate_no_write_barrier_needed(result, block, mallocvars, collect_analyzer, entrymap, startindex=0): @@ -730,9 +871,14 @@ if self.write_barrier_ptr: from rpython.flowspace.model import mkentrymap self._entrymap = mkentrymap(graph) - self.clean_sets = ( - find_initializing_stores(self.collect_analyzer, graph, - self._entrymap)) + if self.translator.config.translation.stm: + wbc = WriteBarrierCollector(graph, self.collect_analyzer) + wbc.collect() + self.clean_sets = wbc.clean_ops + else: + self.clean_sets = ( + find_initializing_stores(self.collect_analyzer, graph, + self._entrymap)) if self.gcdata.gc.can_optimize_clean_setarrayitems(): self.clean_sets = self.clean_sets.union( find_clean_setarrayitems(self.collect_analyzer, graph)) diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -4,8 +4,9 @@ from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.lltypesystem.lloperation import llop from rpython.memory.gc.semispace import SemiSpaceGC -from rpython.memory.gctransform.framework import (CollectAnalyzer, - find_initializing_stores, find_clean_setarrayitems) +from rpython.memory.gctransform.framework import ( + CollectAnalyzer, WriteBarrierCollector, + find_initializing_stores, find_clean_setarrayitems) from rpython.memory.gctransform.shadowstack import ( ShadowStackFrameworkGCTransformer) from rpython.memory.gctransform.test.test_transform import rtype @@ -253,7 +254,7 @@ Constant('b', lltype.Void), varoftype(PTR_TYPE2)], varoftype(lltype.Void))) -def test_remove_duplicate_write_barrier(): +def test_remove_duplicate_write_barrier(gc="minimark"): from rpython.translator.c.genc import CStandaloneBuilder from rpython.flowspace.model import summary @@ -272,17 +273,59 @@ f(glob_a_2, 0) return 0 t = rtype(g, [s_list_of_strings]) - t.config.translation.gc = "minimark" + if gc == "stmgc": + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + else: + gcpolicy = FrameworkGcPolicy2 + t.config.translation.gc = gc cbuild = CStandaloneBuilder(t, g, t.config, - gcpolicy=FrameworkGcPolicy2) + gcpolicy=gcpolicy) db = cbuild.generate_graphs_for_llinterp() ff = graphof(t, f) #ff.show() - assert summary(ff)['direct_call'] == 1 # only one remember_young_pointer + if gc == "stmgc": + assert summary(ff)['stm_write'] == 1 + else: + assert summary(ff)['direct_call'] == 1 # only one remember_young_pointer -def test_find_initializing_stores(): +def test_remove_duplicate_write_barrier_stm(): + test_remove_duplicate_write_barrier("stmgc") +def test_remove_write_barrier_stm(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + + class A: pass + glob = A() + glob2 = A() + def f(n, g): + i = 0 + g.a = n + while i < n: + g.a = i + i += 1 + def g(argv): + if argv[1]: + f(int(argv[1]), glob) + else: + f(int(argv[1]), glob2) + return 0 + + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + ff.show() + assert summary(ff)['stm_write'] == 1 # only one remember_young_pointer + +def test_write_barrier_collector(): class A(object): pass class B(object): @@ -293,15 +336,19 @@ b.a = a b.b = 1 t = rtype(f, []) + t.config.translation.stm = True + #gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" etrafo = ExceptionTransformer(t) graphs = etrafo.transform_completely() collect_analyzer = CollectAnalyzer(t) - init_stores = find_initializing_stores(collect_analyzer, t.graphs[0], - mkentrymap(t.graphs[0])) - assert len(init_stores) == 4 -def test_find_initializing_stores_across_blocks(): + wbc = WriteBarrierCollector(t.graphs[0], collect_analyzer) + wbc.collect() + print wbc.clean_ops + assert len(wbc.clean_ops) == 4 +def test_write_barrier_collector_across_blocks(): class A(object): pass class B(object): @@ -319,12 +366,82 @@ b.c = a1 b.b = a2 t = rtype(f, [int]) + t.config.translation.stm = True + #gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" etrafo = ExceptionTransformer(t) graphs = etrafo.transform_completely() collect_analyzer = CollectAnalyzer(t) - init_stores = find_initializing_stores(collect_analyzer, t.graphs[0], - mkentrymap(t.graphs[0])) - assert len(init_stores) == 9 + + wbc = WriteBarrierCollector(t.graphs[0], collect_analyzer) + wbc.collect() + print "\n".join(map(str,wbc.clean_ops)) + assert len(wbc.clean_ops) == 9 + +def test_write_barrier_collector_blocks_merging(): + class A(object): + pass + class B(object): + pass + def f(x): + a1 = A() + a2 = A() + a = A() + b = B() + b.a = a + if x: + b.b = a1 + b.c = a2 + else: + b.c = a1 + b.b = a2 + a.c = a2 # WB + b.c = a1 + a.c = a1 # WB + a.b = a2 + t = rtype(f, [int]) + t.config.translation.stm = True + #gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + etrafo = ExceptionTransformer(t) + graphs = etrafo.transform_completely() + collect_analyzer = CollectAnalyzer(t) + + wbc = WriteBarrierCollector(t.graphs[0], collect_analyzer) + wbc.collect() + print "\n".join(map(str,wbc.clean_ops)) + assert len(wbc.clean_ops) == 11 + +def test_write_barrier_collector_loops(): + class A(object): + pass + class B(object): + pass + def f(x): + a1 = A() + a2 = A() + a = A() + b = B() + b.a = a + while x: + b.b = a1 + a.c = a2 + b.c = a1 + a.c = a1 + t = rtype(f, [int]) + t.config.translation.stm = True + #gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + etrafo = ExceptionTransformer(t) + graphs = etrafo.transform_completely() + collect_analyzer = CollectAnalyzer(t) + + wbc = WriteBarrierCollector(t.graphs[0], collect_analyzer) + wbc.collect() + print "\n".join(map(str,wbc.clean_ops)) + assert len(wbc.clean_ops) == 7 + + def test_find_clean_setarrayitems(): S = lltype.GcStruct('S') From noreply at buildbot.pypy.org Tue Nov 24 10:30:53 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 24 Nov 2015 16:30:53 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: support for explicit gc_writebarrier Message-ID: <20151124153053.85F631C052B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80889:1be321b9df2b Date: 2015-11-24 15:59 +0100 http://bitbucket.org/pypy/pypy/changeset/1be321b9df2b/ Log: support for explicit gc_writebarrier diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -109,6 +109,8 @@ self.in_stm_ignored = True elif op.opname == "stm_ignored_stop": self.in_stm_ignored = False + elif op.opname == "gc_writebarrier": + writeable[op.args[0]] = True elif op.opname == "malloc": rtti = get_rtti(op.args[0].value) if rtti is not None and hasattr(rtti._obj, 'destructor_funcptr'): diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -300,17 +300,19 @@ class A: pass glob = A() glob2 = A() - def f(n, g): + def f(n, g, g2): i = 0 - g.a = n + llop.gc_writebarrier(lltype.Void, g2) + g.a = n # WB while i < n: g.a = i + g2.a = i i += 1 def g(argv): if argv[1]: - f(int(argv[1]), glob) + f(int(argv[1]), glob, glob2) else: - f(int(argv[1]), glob2) + f(int(argv[1]), glob2, glob) return 0 t = rtype(g, [s_list_of_strings]) From noreply at buildbot.pypy.org Tue Nov 24 10:30:55 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 24 Nov 2015 16:30:55 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: fix test Message-ID: <20151124153055.91F111C052B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80890:861b9136b05a Date: 2015-11-24 16:04 +0100 http://bitbucket.org/pypy/pypy/changeset/861b9136b05a/ Log: fix test diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -325,7 +325,7 @@ ff = graphof(t, f) ff.show() - assert summary(ff)['stm_write'] == 1 # only one remember_young_pointer + assert summary(ff)['stm_write'] == 2 # only one remember_young_pointer def test_write_barrier_collector(): class A(object): From noreply at buildbot.pypy.org Tue Nov 24 10:30:57 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 24 Nov 2015 16:30:57 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: remove duplicate logic Message-ID: <20151124153057.A14DD1C052B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80891:17fb1d3c0092 Date: 2015-11-24 16:04 +0100 http://bitbucket.org/pypy/pypy/changeset/17fb1d3c0092/ Log: remove duplicate logic This logic is now implemented in the WriteBarrierCollector diff --git a/rpython/memory/gctransform/stmframework.py b/rpython/memory/gctransform/stmframework.py --- a/rpython/memory/gctransform/stmframework.py +++ b/rpython/memory/gctransform/stmframework.py @@ -153,22 +153,10 @@ v_struct = hop.spaceop.args[0] assert opname in ('setfield', 'setarrayitem', 'setinteriorfield', 'raw_store') - if hop.spaceop.args[-1].concretetype == lltype.Void: - pass # ignore setfields of a Void type - elif not var_needsgc(v_struct): - if (var_needsgc(hop.spaceop.args[-1]) and - 'is_excdata' not in hop.spaceop.args[0].concretetype.TO._hints): - raise Exception("%s: GC pointer written into a non-GC location" - % (hop.spaceop,)) - elif hop.spaceop not in self.clean_sets: - if self.in_stm_ignored: - # detect if we're inside a 'stm_ignored' block and in - # that case don't call stm_write(). This only works for - # writing non-GC pointers. - if var_needsgc(hop.spaceop.args[-1]): - raise Exception("in stm_ignored block: write of a gc " - "pointer") - elif self._set_into_gc_array_part(hop.spaceop) is not None: + # + # insert write barrier if we must + if hop.spaceop not in self.clean_sets: + if self._set_into_gc_array_part(hop.spaceop) is not None: self.write_barrier_from_array_calls += 1 v_index = self._set_into_gc_array_part(hop.spaceop) assert v_index.concretetype == lltype.Signed @@ -176,15 +164,7 @@ else: self.write_barrier_calls += 1 hop.genop("stm_write", [v_struct]) - # we just did a full write barrier here, so we can use - # this helper to propagate this knowledge forward and - # avoid to repeat the write barrier. - if self.curr_block is not None: # for tests - propagate_no_write_barrier_needed(self.clean_sets, - self.curr_block, - {v_struct: True}, - self.collect_analyzer, - self._entrymap) + # hop.rename('bare_' + opname) def gct_gc_writebarrier(self, hop): From noreply at buildbot.pypy.org Tue Nov 24 10:30:59 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Tue, 24 Nov 2015 16:30:59 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: more tests and fix Message-ID: <20151124153059.B25F61C052B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80892:1f6b1cc69bca Date: 2015-11-24 16:27 +0100 http://bitbucket.org/pypy/pypy/changeset/1f6b1cc69bca/ Log: more tests and fix diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -110,6 +110,7 @@ elif op.opname == "stm_ignored_stop": self.in_stm_ignored = False elif op.opname == "gc_writebarrier": + assert not self.in_stm_ignored writeable[op.args[0]] = True elif op.opname == "malloc": rtti = get_rtti(op.args[0].value) @@ -148,13 +149,16 @@ # already writeable, this op is also clean self.clean_ops.add(op) elif op in self.clean_ops: - # we require an stm_write + # we changed our opinion in this iteration self.clean_ops.remove(op) # always writeable after this op writeable[op.args[0]] = True else: # things that need partial write barriers (card marking) - assert op not in self.clean_ops + if writeable.get(op.args[0], False): + self.clean_ops.add(op) + elif op in self.clean_ops: + self.clean_ops.remove(op) # # update in_states of all successors updated = set() diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -19,6 +19,7 @@ from rpython.translator.unsimplify import varoftype import py +import pytest class FrameworkGcPolicy2(BasicFrameworkGcPolicy): class transformerclass(ShadowStackFrameworkGCTransformer): @@ -61,6 +62,7 @@ assert res == 2 + at pytest.mark.xfail(reason="llinterp does not implement stm_allocate_tid") def test_framework_simple_stm(): test_framework_simple("stmgc") @@ -324,8 +326,75 @@ db = cbuild.generate_graphs_for_llinterp() ff = graphof(t, f) - ff.show() - assert summary(ff)['stm_write'] == 2 # only one remember_young_pointer + #ff.show() + assert summary(ff)['stm_write'] == 2 + +def test_remove_write_barrier_stm2(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + from rpython.rlib.objectmodel import stm_ignored + + class A: pass + glob = A() + glob2 = A() + def f(n, g, g2): + i = 1 + while n: + g.a = i # WB + with stm_ignored: + g2.a = i + def g(argv): + if argv[1]: + f(int(argv[1]), glob, glob2) + else: + f(int(argv[1]), glob2, glob) + return 0 + + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 1 + +def test_remove_write_barrier_stm3(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + + S = lltype.GcStruct('S') + A = lltype.GcArray(lltype.Ptr(S)) + def f(l, l2, i): + s = lltype.malloc(S) + llop.gc_writebarrier(lltype.Void, l2) + while i: + l[i] = s # WB card + l[i] = s # WB card + l2[i] = s # no WB + def g(argv): + n = int(argv[1]) + l = lltype.malloc(A, n) + l[0] = lltype.malloc(S) + l[1] = lltype.malloc(S) + l[2] = lltype.malloc(S) + f(l, l, n) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 3 + def test_write_barrier_collector(): class A(object): From noreply at buildbot.pypy.org Tue Nov 24 10:33:52 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 16:33:52 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: copy copy copy. ptr_eq and ptr_ne added to regalloc and assembler Message-ID: <20151124153352.DFAC01C052B@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80893:5810bdb5f4eb Date: 2015-11-24 16:33 +0100 http://bitbucket.org/pypy/pypy/changeset/5810bdb5f4eb/ Log: copy copy copy. ptr_eq and ptr_ne added to regalloc and assembler diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py --- a/rpython/jit/backend/zarch/opassembler.py +++ b/rpython/jit/backend/zarch/opassembler.py @@ -91,27 +91,7 @@ emit_uint_floordiv = gen_emit_pool_or_rr_evenodd('DLG','DLGR') # NOTE division sets one register with the modulo value, thus # the regalloc ensures the right register survives. - #emit_int_mod = gen_emit_pool_or_rr_evenodd('DSG','DSGR') - def emit_int_mod(self, op, arglocs, regalloc): - lr, lq, l1 = arglocs # lr == remainer, lq == quotient - # when entering the function lr contains the dividend - # after this operation either lr or lq is used further - assert l1.is_in_pool() or not l1.is_imm() , "imm divider not supported" - # remainer is always a even register r0, r2, ... , r14 - assert lr.is_even() - assert lq.is_odd() - if l1.is_in_pool(): - self.mc.DSG(lr, l1) - # python behavior? - #off = self.mc.CGIJ_byte_count+self.mc.AG_byte_count - #self.mc.CGIJ(lr, l.imm(0), c.GE, l.imm(off)) - #self.mc.AG(lr, l1) - else: - self.mc.DSGR(lr, l1) - # python behavior? - #off = self.mc.CGIJ_byte_count+self.mc.AGR_byte_count - #self.mc.CGIJ(lr, l.imm(0), c.GE, l.imm(off)) - #self.mc.AGR(lr, l1) + emit_int_mod = gen_emit_pool_or_rr_evenodd('DSG','DSGR') def emit_int_invert(self, op, arglocs, regalloc): l0, = arglocs @@ -165,6 +145,12 @@ emit_int_eq = gen_emit_cmp_op(c.EQ) emit_int_ne = gen_emit_cmp_op(c.NE) + emit_ptr_eq = emit_int_eq + emit_ptr_ne = emit_int_ne + + emit_instance_ptr_eq = emit_ptr_eq + emit_instance_ptr_ne = emit_ptr_ne + emit_uint_le = gen_emit_cmp_op(c.LE, signed=False) emit_uint_lt = gen_emit_cmp_op(c.LT, signed=False) emit_uint_gt = gen_emit_cmp_op(c.GT, signed=False) diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -668,6 +668,12 @@ prepare_int_eq = helper.generate_cmp_op() prepare_int_ne = helper.generate_cmp_op() + prepare_ptr_eq = prepare_int_eq + prepare_ptr_ne = prepare_int_ne + + prepare_instance_ptr_eq = prepare_ptr_eq + prepare_instance_ptr_ne = prepare_ptr_ne + prepare_uint_le = helper.generate_cmp_op(signed=False) prepare_uint_lt = helper.generate_cmp_op(signed=False) prepare_uint_ge = helper.generate_cmp_op(signed=False) From noreply at buildbot.pypy.org Tue Nov 24 10:50:50 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Tue, 24 Nov 2015 16:50:50 +0100 (CET) Subject: [pypy-commit] pypy s390x-backend: added impl for guard_not_invalidated, passing tests for it Message-ID: <20151124155050.AE1B71C11C0@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: s390x-backend Changeset: r80894:c3188f41b276 Date: 2015-11-24 16:50 +0100 http://bitbucket.org/pypy/pypy/changeset/c3188f41b276/ Log: added impl for guard_not_invalidated, passing tests for it diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py --- a/rpython/jit/backend/zarch/assembler.py +++ b/rpython/jit/backend/zarch/assembler.py @@ -184,6 +184,10 @@ def _build_stack_check_slowpath(self): pass # TODO + def new_stack_loc(self, i, tp): + base_ofs = self.cpu.get_baseofs_of_frame_field() + return l.StackLocation(i, l.get_fp_offset(base_ofs, i), tp) + def _call_header_with_stack_check(self): self._call_header() if self.stack_check_slowpath == 0: diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py --- a/rpython/jit/backend/zarch/codebuilder.py +++ b/rpython/jit/backend/zarch/codebuilder.py @@ -104,6 +104,11 @@ def load(self, treg, sreg, offset): self.LG(treg, l.addr(offset, sreg)) + def nop(self): + # if the mask is zero it act as a NOP + # there is no special 'no operation' instruction + self.BCR_rr(0x0, 0x0) + def currpos(self): return self.get_relative_pos() diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py --- a/rpython/jit/backend/zarch/regalloc.py +++ b/rpython/jit/backend/zarch/regalloc.py @@ -108,6 +108,7 @@ save_around_call_regs = r.VOLATILES frame_reg = r.SPP assert set(save_around_call_regs).issubset(all_regs) + pool = None def __init__(self, longevity, frame_manager=None, assembler=None): RegisterManager.__init__(self, longevity, frame_manager, assembler) @@ -123,8 +124,8 @@ return rffi.cast(lltype.Signed, c.value) def convert_to_imm(self, c): - #val = self.convert_to_int(c) - return l.ImmLocation(val) + off = self.pool.get_offset(c) + return l.pool(off) def ensure_reg(self, box, force_in_reg): if isinstance(box, Const): @@ -342,6 +343,7 @@ self.rm = ZARCHRegisterManager(self.longevity, frame_manager = self.fm, assembler = self.assembler) + self.rm.pool = self.assembler.pool self.fprm = FPRegisterManager(self.longevity, frame_manager = self.fm, assembler = self.assembler) self.fprm.pool = self.assembler.pool @@ -779,6 +781,12 @@ arglocs = self._prepare_guard(op, [l0, l1]) return arglocs + def prepare_guard_not_invalidated(self, op): + pos = self.assembler.mc.get_relative_pos() + self.ensure_next_label_is_at_least_at_position(pos + 4) + locs = self._prepare_guard(op) + return locs + def prepare_label(self, op): descr = op.getdescr() assert isinstance(descr, TargetToken) diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py --- a/rpython/jit/backend/zarch/runner.py +++ b/rpython/jit/backend/zarch/runner.py @@ -1,6 +1,7 @@ from rpython.jit.backend.llsupport.llmodel import AbstractLLCPU from rpython.jit.backend.zarch import registers as r from rpython.jit.backend.zarch.assembler import AssemblerZARCH +from rpython.jit.backend.zarch.codebuilder import InstrBuilder from rpython.rlib import rgc from rpython.rtyper.lltypesystem import lltype, llmemory @@ -48,3 +49,19 @@ return self.assembler.assemble_bridge(faildescr, inputargs, operations, original_loop_token, log, logger) + def invalidate_loop(self, looptoken): + """Activate all GUARD_NOT_INVALIDATED in the loop and its attached + bridges. Before this call, all GUARD_NOT_INVALIDATED do nothing; + after this call, they all fail. Note that afterwards, if one such + guard fails often enough, it has a bridge attached to it; it is + possible then to re-call invalidate_loop() on the same looptoken, + which must invalidate all newer GUARD_NOT_INVALIDATED, but not the + old one that already has a bridge attached to it.""" + + for jmp, tgt in looptoken.compiled_loop_token.invalidate_positions: + mc = InstrBuilder() + # needs 4 bytes, ensured by the previous process + mc.b_offset(tgt) # a single instruction + mc.copy_to_raw_memory(jmp) + # positions invalidated + looptoken.compiled_loop_token.invalidate_positions = [] From noreply at buildbot.pypy.org Tue Nov 24 11:39:32 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 24 Nov 2015 17:39:32 +0100 (CET) Subject: [pypy-commit] cffi default: One more corner case Message-ID: <20151124163932.6F73F1C052B@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2432:cfc510bd81d7 Date: 2015-11-24 17:40 +0100 http://bitbucket.org/cffi/cffi/changeset/cfc510bd81d7/ Log: One more corner case diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -5778,6 +5778,10 @@ } view = PyObject_Malloc(sizeof(Py_buffer)); + if (view == NULL) { + PyErr_NoMemory(); + return NULL; + } if (_my_PyObject_GetContiguousBuffer(x, view, 0) < 0) goto error1; From noreply at buildbot.pypy.org Tue Nov 24 11:44:08 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 24 Nov 2015 17:44:08 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Move builtin_isinstance() to the only place where it's used: unaryop Message-ID: <20151124164408.3FD801C052B@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80895:64737284bb91 Date: 2015-11-24 06:18 +0000 http://bitbucket.org/pypy/pypy/changeset/64737284bb91/ Log: Move builtin_isinstance() to the only place where it's used: unaryop diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -123,73 +123,6 @@ def builtin_bytearray(s_str): return SomeByteArray() -def our_issubclass(cls1, cls2): - """ we're going to try to be less silly in the face of old-style classes""" - if cls2 is object: - return True - def classify(cls): - if isinstance(cls, ClassDef): - return 'def' - if cls.__module__ == '__builtin__': - return 'builtin' - else: - return 'cls' - kind1 = classify(cls1) - kind2 = classify(cls2) - if kind1 != 'def' and kind2 != 'def': - return issubclass(cls1, cls2) - if kind1 == 'builtin' and kind2 == 'def': - return False - elif kind1 == 'def' and kind2 == 'builtin': - return issubclass(object, cls2) - else: - bk = getbookkeeper() - def toclassdef(kind, cls): - if kind != 'def': - return bk.getuniqueclassdef(cls) - else: - return cls - return toclassdef(kind1, cls1).issubclass(toclassdef(kind2, cls2)) - - -def builtin_isinstance(s_obj, s_type, variables=None): - r = SomeBool() - if s_type.is_constant(): - typ = s_type.const - if issubclass(typ, rpython.rlib.rarithmetic.base_int): - try: - r.const = issubclass(s_obj.knowntype, typ) - except TypeError: # s_obj.knowntype is not a Python type at all - r.const = False - else: - if typ == long: - getbookkeeper().warning("isinstance(., long) is not RPython") - r.const = False - return r - - assert not issubclass(typ, (int, long)) or typ in (bool, int, long), ( - "for integers only isinstance(.,int|r_uint) are supported") - - if s_obj.is_constant(): - r.const = isinstance(s_obj.const, typ) - elif our_issubclass(s_obj.knowntype, typ): - if not s_obj.can_be_none(): - r.const = True - elif not our_issubclass(typ, s_obj.knowntype): - r.const = False - elif s_obj.knowntype == int and typ == bool: # xxx this will explode in case of generalisation - # from bool to int, notice that isinstance( , bool|int) - # is quite border case for RPython - r.const = False - for v in variables: - assert v.annotation == s_obj - knowntypedata = defaultdict(dict) - bk = getbookkeeper() - if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC): - add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ)) - r.set_knowntypedata(knowntypedata) - return r - # note that this one either needs to be constant, or we will create SomeObject def builtin_hasattr(s_obj, s_attr): if not s_attr.is_constant() or not isinstance(s_attr.const, str): diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -16,10 +16,10 @@ s_Bool, s_None, s_Int, unionof, add_knowntypedata, SomeWeakRef, SomeUnicodeString, SomeByteArray) from rpython.annotator.bookkeeper import getbookkeeper, immutablevalue -from rpython.annotator import builtin from rpython.annotator.binaryop import _clone ## XXX where to put this? from rpython.annotator.binaryop import _dict_can_only_throw_keyerror from rpython.annotator.binaryop import _dict_can_only_throw_nothing +from rpython.annotator.classdesc import ClassDef from rpython.annotator.model import AnnotatorError from rpython.annotator.argument import simple_args, complex_args @@ -32,11 +32,79 @@ def type_SomeObject(annotator, v_arg): return SomeTypeOf([v_arg]) + +def our_issubclass(bk, cls1, cls2): + """ we're going to try to be less silly in the face of old-style classes""" + if cls2 is object: + return True + def classify(cls): + if isinstance(cls, ClassDef): + return 'def' + if cls.__module__ == '__builtin__': + return 'builtin' + else: + return 'cls' + kind1 = classify(cls1) + kind2 = classify(cls2) + if kind1 != 'def' and kind2 != 'def': + return issubclass(cls1, cls2) + if kind1 == 'builtin' and kind2 == 'def': + return False + elif kind1 == 'def' and kind2 == 'builtin': + return issubclass(object, cls2) + else: + def toclassdef(kind, cls): + if kind != 'def': + return bk.getuniqueclassdef(cls) + else: + return cls + return toclassdef(kind1, cls1).issubclass(toclassdef(kind2, cls2)) + + +def s_isinstance(annotator, s_obj, s_type, variables): + from rpython.rlib.rarithmetic import base_int + if not s_type.is_constant(): + return SomeBool() + r = SomeBool() + typ = s_type.const + bk = annotator.bookkeeper + if issubclass(typ, base_int): + try: + r.const = issubclass(s_obj.knowntype, typ) + except TypeError: # s_obj.knowntype is not a Python type at all + r.const = False + elif typ == long: + bk.warning("isinstance(., long) is not RPython") + r.const = False + return r + else: + assert not issubclass(typ, (int, long)) or typ in (bool, int, long), ( + "for integers only isinstance(.,int|r_uint) are supported") + + if s_obj.is_constant(): + r.const = isinstance(s_obj.const, typ) + elif our_issubclass(bk, s_obj.knowntype, typ): + if not s_obj.can_be_none(): + r.const = True + elif not our_issubclass(bk, typ, s_obj.knowntype): + r.const = False + elif s_obj.knowntype == int and typ == bool: # xxx this will explode in case of generalisation + # from bool to int, notice that isinstance( , bool|int) + # is quite border case for RPython + r.const = False + for v in variables: + assert v.annotation == s_obj + knowntypedata = defaultdict(dict) + if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC): + add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ)) + r.set_knowntypedata(knowntypedata) + return r + @op.isinstance.register(SomeObject) def isinstance_SomeObject(annotator, v_obj, v_cls): - return builtin.builtin_isinstance(annotator.annotation(v_obj), - annotator.annotation(v_cls), - variables=[v_obj]) + s_obj = annotator.annotation(v_obj) + s_cls = annotator.annotation(v_cls) + return s_isinstance(annotator, s_obj, s_cls, variables=[v_obj]) @op.bool.register(SomeObject) @@ -922,8 +990,8 @@ @op.issubtype.register(SomeTypeOf) def issubtype(annotator, v_type, v_cls): args_v = v_type.annotation.is_type_of - return builtin.builtin_isinstance( - args_v[0].annotation, annotator.annotation(v_cls), args_v) + return s_isinstance(annotator, args_v[0].annotation, + annotator.annotation(v_cls), args_v) #_________________________________________ # weakrefs From noreply at buildbot.pypy.org Tue Nov 24 11:44:10 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 24 Nov 2015 17:44:10 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Simplify rarithmetic special-case in op.isinstance handling Message-ID: <20151124164410.481B41C052B@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80896:afb4e66fbc02 Date: 2015-11-24 16:43 +0000 http://bitbucket.org/pypy/pypy/changeset/afb4e66fbc02/ Log: Simplify rarithmetic special-case in op.isinstance handling diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -34,13 +34,13 @@ def our_issubclass(bk, cls1, cls2): - """ we're going to try to be less silly in the face of old-style classes""" if cls2 is object: return True def classify(cls): + from rpython.rlib.rarithmetic import base_int if isinstance(cls, ClassDef): return 'def' - if cls.__module__ == '__builtin__': + if cls.__module__ == '__builtin__' or issubclass(cls, base_int): return 'builtin' else: return 'cls' @@ -62,36 +62,22 @@ def s_isinstance(annotator, s_obj, s_type, variables): - from rpython.rlib.rarithmetic import base_int if not s_type.is_constant(): return SomeBool() r = SomeBool() typ = s_type.const bk = annotator.bookkeeper - if issubclass(typ, base_int): - try: - r.const = issubclass(s_obj.knowntype, typ) - except TypeError: # s_obj.knowntype is not a Python type at all - r.const = False - elif typ == long: - bk.warning("isinstance(., long) is not RPython") + if s_obj.is_constant(): + r.const = isinstance(s_obj.const, typ) + elif our_issubclass(bk, s_obj.knowntype, typ): + if not s_obj.can_be_none(): + r.const = True + elif not our_issubclass(bk, typ, s_obj.knowntype): r.const = False - return r - else: - assert not issubclass(typ, (int, long)) or typ in (bool, int, long), ( - "for integers only isinstance(.,int|r_uint) are supported") - - if s_obj.is_constant(): - r.const = isinstance(s_obj.const, typ) - elif our_issubclass(bk, s_obj.knowntype, typ): - if not s_obj.can_be_none(): - r.const = True - elif not our_issubclass(bk, typ, s_obj.knowntype): - r.const = False - elif s_obj.knowntype == int and typ == bool: # xxx this will explode in case of generalisation - # from bool to int, notice that isinstance( , bool|int) - # is quite border case for RPython - r.const = False + elif s_obj.knowntype == int and typ == bool: # xxx this will explode in case of generalisation + # from bool to int, notice that isinstance( , bool|int) + # is quite border case for RPython + r.const = False for v in variables: assert v.annotation == s_obj knowntypedata = defaultdict(dict) From noreply at buildbot.pypy.org Tue Nov 24 11:54:57 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 17:54:57 +0100 (CET) Subject: [pypy-commit] pypy default: fix whatsnew for merged branch Message-ID: <20151124165457.E5D861C11C0@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: Changeset: r80897:51561caea1d9 Date: 2015-11-24 18:53 +0200 http://bitbucket.org/pypy/pypy/changeset/51561caea1d9/ Log: fix whatsnew for merged branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -15,4 +15,10 @@ Fix the cpyext tests on OSX by linking with -flat_namespace .. branch: anntype + Refactor and improve exception analysis in the annotator. + +.. branch: posita/2193-datetime-timedelta-integrals + +Fix issue #2193. ``isinstance(..., int)`` => ``isinstance(..., numbers.Integral)`` +to allow for alternate ``int``-like implementations (e.g., ``future.types.newint``) From noreply at buildbot.pypy.org Tue Nov 24 12:10:01 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:10:01 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: in case of cross-compilation we need to delay the comparison of offsets until compile time (where FieldOffset is a symbolic correctly handled by the C compiler). However, we need to introduce a bit of extra machinery to make it working also in direct tests and on top of llinterp Message-ID: <20151124171001.A7F4F1C06F2@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80898:89a3ecaf0b2d Date: 2015-11-24 18:05 +0100 http://bitbucket.org/pypy/pypy/changeset/89a3ecaf0b2d/ Log: in case of cross-compilation we need to delay the comparison of offsets until compile time (where FieldOffset is a symbolic correctly handled by the C compiler). However, we need to introduce a bit of extra machinery to make it working also in direct tests and on top of llinterp diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py --- a/rpython/rlib/strstorage.py +++ b/rpython/rlib/strstorage.py @@ -30,22 +30,10 @@ from rpython.rtyper.lltypesystem import lltype, rffi, llmemory from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf from rpython.rtyper.annlowlevel import llstr -from rpython.rlib.objectmodel import specialize - -def compute_offsetof(TP, field): - """ - NOT_RPYTHON - """ - obj = lltype.malloc(TP, 0) - baseadr = llmemory.cast_ptr_to_adr(obj) - offset = llmemory.offsetof(TP, field) - interioradr = baseadr + offset - return (llmemory.cast_adr_to_int(interioradr, 'forced') - - llmemory.cast_adr_to_int(baseadr, 'forced')) - +from rpython.rlib.objectmodel import specialize, we_are_translated @specialize.memo() -def rpy_string_as_type(TP): +def _rpy_string_as_type(TP): # sanity check that STR is actually what we think it is assert STR._flds == { 'hash': lltype.Signed, @@ -54,23 +42,32 @@ STR_AS_TP = lltype.GcStruct('rpy_string_as_%s' % TP, ('hash', lltype.Signed), ('chars', lltype.Array(TP, hints={'immutable': True}))) - # sanity check - assert compute_offsetof(STR, 'chars') == compute_offsetof(STR_AS_TP, 'chars') return STR_AS_TP - at specialize.memo() + at specialize.arg(0) def str_storage_supported(TP): - try: - rpy_string_as_type(TP) - except AssertionError: - return False - else: - return True + STR_AS_TP = _rpy_string_as_type(TP) + return _offsetof_chars(STR) == _offsetof_chars(STR_AS_TP) @specialize.ll() def str_storage_getitem(TP, s, index): - STR_AS_TP = rpy_string_as_type(TP) + assert str_storage_supported(TP) # sanity check + STR_AS_TP = _rpy_string_as_type(TP) lls = llstr(s) str_as_tp = rffi.cast(lltype.Ptr(STR_AS_TP), lls) index = index / rffi.sizeof(TP) return str_as_tp.chars[index] + + at specialize.arg(0) +def _offsetof_chars(TP): + # we need to be careful in presence of cross-compilation, because we want + # to defer the actual check at compile-time on the target machine, NOT at + # translation time on the host machine. However, we still need to support + # direct tests, so if we are not translated, we immediately force the + # result into an actual int. + offset = llmemory.offsetof(TP, 'chars') + if we_are_translated(): + return offset # symbolic + else: + return offset.force_as_int() + return offset diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py --- a/rpython/rlib/test/test_strstorage.py +++ b/rpython/rlib/test/test_strstorage.py @@ -1,12 +1,29 @@ import py +import sys +import platform import struct from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported from rpython.rlib.rarithmetic import r_singlefloat from rpython.rtyper.test.tool import BaseRtypingTest +IS_WIN32 = (sys.platform == 'win32') +IS_ARM = (platform.machine().startswith('arm')) +IS_32BIT = (sys.maxint == 2147483647) + class BaseStrStorageTest: + def test_str_getitem_supported(self): + # on win32 or ARM32, we expect LONGLONG and DOUBLE to be NOT supported + # by str_storage_getitem + if IS_WIN32 or (IS_ARM and IS_32BIT): + expected = False + else: + expected = True + # + assert self.str_storage_supported(rffi.LONGLONG) == expected + assert self.str_storage_supported(rffi.DOUBLE) == expected + def test_signed(self): buf = struct.pack('@ll', 42, 43) size = struct.calcsize('@l') @@ -40,11 +57,18 @@ class TestDirect(BaseStrStorageTest): + def str_storage_supported(self, TYPE): + return str_storage_supported(TYPE) + def str_storage_getitem(self, TYPE, buf, offset): return str_storage_getitem(TYPE, buf, offset) +class TestRTyping(BaseStrStorageTest, BaseRtypingTest): -class TestRTyping(BaseStrStorageTest, BaseRtypingTest): + def str_storage_supported(self, TYPE): + def fn(): + return str_storage_supported(TYPE) + return self.interpret(fn, []) def str_storage_getitem(self, TYPE, buf, offset): def fn(offset): diff --git a/rpython/rtyper/lltypesystem/llmemory.py b/rpython/rtyper/lltypesystem/llmemory.py --- a/rpython/rtyper/lltypesystem/llmemory.py +++ b/rpython/rtyper/lltypesystem/llmemory.py @@ -214,6 +214,20 @@ dst = cast_adr_to_ptr(dstadr, PTR) _reccopy(src, dst) + def force_as_int(self): + """ + NOT_RPYTHON + Return the actual offset as an integer. + """ + if self.TYPE._arrayfld: + obj = lltype.malloc(self.TYPE, 0) + else: + obj = lltype.malloc(self.TYPE) + baseadr = cast_ptr_to_adr(obj) + interioradr = baseadr + self + return cast_adr_to_int(interioradr, 'forced') - cast_adr_to_int(baseadr, 'forced') + + class CompositeOffset(AddressOffset): diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py --- a/rpython/rtyper/lltypesystem/opimpl.py +++ b/rpython/rtyper/lltypesystem/opimpl.py @@ -103,6 +103,13 @@ def op_int_eq(x, y): + # so far we support only == and only for FieldOffset. In theory, we could + # generalize support for direct comparisons of AddressOffsets + if isinstance(x, llmemory.FieldOffset): + x = x.force_as_int() + if isinstance(y, llmemory.FieldOffset): + y = y.force_as_int() + # if not isinstance(x, (int, long)): from rpython.rtyper.lltypesystem import llgroup assert isinstance(x, llgroup.CombinedSymbolic), ( From noreply at buildbot.pypy.org Tue Nov 24 12:10:03 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:10:03 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: fix Message-ID: <20151124171003.D7D6B1C06F2@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80899:82d45be90c37 Date: 2015-11-24 18:09 +0100 http://bitbucket.org/pypy/pypy/changeset/82d45be90c37/ Log: fix diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py --- a/rpython/jit/metainterp/test/test_strstorage.py +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -29,6 +29,8 @@ return longlong.int2singlefloat(res) return res + def str_storage_supported(self, TYPE): + py.test.skip('this is not a JIT test') def test_force_virtual_str_storage(self): byteorder = sys.byteorder From noreply at buildbot.pypy.org Tue Nov 24 12:12:30 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:12:30 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: hg merge default Message-ID: <20151124171230.E08F01C06F2@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80900:ce2d724dad21 Date: 2015-11-24 18:12 +0100 http://bitbucket.org/pypy/pypy/changeset/ce2d724dad21/ Log: hg merge default diff too long, truncating to 2000 out of 2119 lines diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py --- a/lib_pypy/greenlet.py +++ b/lib_pypy/greenlet.py @@ -88,9 +88,19 @@ # try: unbound_method = getattr(_continulet, methodname) + _tls.leaving = current args, kwds = unbound_method(current, *baseargs, to=target) - finally: _tls.current = current + except: + _tls.current = current + if hasattr(_tls, 'trace'): + _run_trace_callback('throw') + _tls.leaving = None + raise + else: + if hasattr(_tls, 'trace'): + _run_trace_callback('switch') + _tls.leaving = None # if kwds: if args: @@ -122,6 +132,34 @@ return f.f_back.f_back.f_back # go past start(), __switch(), switch() # ____________________________________________________________ +# Recent additions + +GREENLET_USE_GC = True +GREENLET_USE_TRACING = True + +def gettrace(): + return getattr(_tls, 'trace', None) + +def settrace(callback): + try: + prev = _tls.trace + del _tls.trace + except AttributeError: + prev = None + if callback is not None: + _tls.trace = callback + return prev + +def _run_trace_callback(event): + try: + _tls.trace(event, (_tls.leaving, _tls.current)) + except: + # In case of exceptions trace function is removed + if hasattr(_tls, 'trace'): + del _tls.trace + raise + +# ____________________________________________________________ # Internal stuff try: @@ -143,22 +181,32 @@ _tls.current = gmain def _greenlet_start(greenlet, args): - args, kwds = args - _tls.current = greenlet try: - res = greenlet.run(*args, **kwds) - except GreenletExit, e: - res = e + args, kwds = args + _tls.current = greenlet + try: + if hasattr(_tls, 'trace'): + _run_trace_callback('switch') + res = greenlet.run(*args, **kwds) + except GreenletExit, e: + res = e + finally: + _continuation.permute(greenlet, greenlet.parent) + return ((res,), None) finally: - _continuation.permute(greenlet, greenlet.parent) - return ((res,), None) + _tls.leaving = greenlet def _greenlet_throw(greenlet, exc, value, tb): - _tls.current = greenlet try: - raise exc, value, tb - except GreenletExit, e: - res = e + _tls.current = greenlet + try: + if hasattr(_tls, 'trace'): + _run_trace_callback('throw') + raise exc, value, tb + except GreenletExit, e: + res = e + finally: + _continuation.permute(greenlet, greenlet.parent) + return ((res,), None) finally: - _continuation.permute(greenlet, greenlet.parent) - return ((res,), None) + _tls.leaving = greenlet diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -1,7 +1,18 @@ ========================= -What's new in PyPy 4.0.+ +What's new in PyPy 4.1.+ ========================= .. this is a revision shortly after release-4.0.1 .. startrev: 4b5c840d0da2 +.. branch: numpy-1.10 + +Fix tests to run cleanly with -A and start to fix micronumpy for upstream numpy +which is now 1.10.2 + +.. branch: osx-flat-namespace + +Fix the cpyext tests on OSX by linking with -flat_namespace + +.. branch: anntype +Refactor and improve exception analysis in the annotator. diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -302,7 +302,7 @@ def hack_for_cffi_modules(self, driver): # HACKHACKHACK - # ugly hack to modify target goal from compile_c to build_cffi_imports + # ugly hack to modify target goal from compile_* to build_cffi_imports # this should probably get cleaned up and merged with driver.create_exe from rpython.translator.driver import taskdef import types @@ -316,7 +316,8 @@ name = name.new(ext='exe') return name - @taskdef(['compile_c'], "Create cffi bindings for modules") + compile_goal, = driver.backend_select_goals(['compile']) + @taskdef([compile_goal], "Create cffi bindings for modules") def task_build_cffi_imports(self): from pypy.tool.build_cffi_imports import create_cffi_import_libraries ''' Use cffi to compile cffi interfaces to modules''' @@ -335,7 +336,7 @@ # if failures, they were already printed print >> sys.stderr, str(exename),'successfully built, but errors while building the above modules will be ignored' driver.task_build_cffi_imports = types.MethodType(task_build_cffi_imports, driver) - driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, ['compile_c'] + driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, [compile_goal] driver.default_goal = 'build_cffi_imports' # HACKHACKHACK end diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h --- a/pypy/module/cpyext/include/patchlevel.h +++ b/pypy/module/cpyext/include/patchlevel.h @@ -29,7 +29,7 @@ #define PY_VERSION "2.7.10" /* PyPy version as a string */ -#define PYPY_VERSION "4.0.1-alpha0" +#define PYPY_VERSION "4.1.0-alpha0" /* Subversion Revision number of this file (not of the repository). * Empty since Mercurial migration. */ diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py --- a/pypy/module/micronumpy/__init__.py +++ b/pypy/module/micronumpy/__init__.py @@ -34,6 +34,7 @@ 'nditer': 'nditer.W_NDIter', 'set_docstring': 'support.descr_set_docstring', + 'VisibleDeprecationWarning': 'support.W_VisibleDeprecationWarning', } for c in ['MAXDIMS', 'CLIP', 'WRAP', 'RAISE']: interpleveldefs[c] = 'space.wrap(constants.%s)' % c @@ -42,6 +43,7 @@ from pypy.module.micronumpy.concrete import _setup _setup() + class UMathModule(MixedModule): appleveldefs = {} interpleveldefs = { @@ -138,3 +140,9 @@ 'multiarray': MultiArrayModule, 'umath': UMathModule, } + + def setup_after_space_initialization(self): + from pypy.module.micronumpy.support import W_VisibleDeprecationWarning + for name, w_type in {'VisibleDeprecationWarning': W_VisibleDeprecationWarning}.items(): + setattr(self.space, 'w_' + name, self.space.gettypefor(w_type)) + diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py --- a/pypy/module/micronumpy/base.py +++ b/pypy/module/micronumpy/base.py @@ -44,7 +44,7 @@ from pypy.module.micronumpy.strides import calc_strides if len(shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: ovfcheck(support.product_check(shape) * dtype.elsize) except OverflowError as e: @@ -69,7 +69,7 @@ isize = dtype.elsize if len(shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: totalsize = ovfcheck(support.product_check(shape) * isize) except OverflowError as e: diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py --- a/pypy/module/micronumpy/boxes.py +++ b/pypy/module/micronumpy/boxes.py @@ -444,7 +444,7 @@ @unwrap_spec(axis1=int, axis2=int) def descr_swapaxes(self, space, axis1, axis2): - return self + raise oefmt(space.w_ValueError, 'bad axis1 argument to swapaxes') def descr_fill(self, space, w_value): self.get_dtype(space).coerce(space, w_value) @@ -573,7 +573,7 @@ try: ofs, dtype = self.dtype.fields[item] except KeyError: - raise oefmt(space.w_IndexError, "invalid index") + raise oefmt(space.w_ValueError, "no field of name %s", item) from pypy.module.micronumpy.types import VoidType if isinstance(dtype.itemtype, VoidType): diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -65,6 +65,7 @@ w_KeyError = W_TypeObject("KeyError") w_SystemExit = W_TypeObject("SystemExit") w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt") + w_VisibleDeprecationWarning = W_TypeObject("VisibleDeprecationWarning") w_None = None w_bool = W_TypeObject("bool") @@ -402,6 +403,9 @@ assert isinstance(w_check_class, W_TypeObject) return w_exc_type.name == w_check_class.name + def warn(self, w_msg, w_warn_type): + pass + class FloatObject(W_Root): tp = FakeSpace.w_float def __init__(self, floatval): diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py --- a/pypy/module/micronumpy/concrete.py +++ b/pypy/module/micronumpy/concrete.py @@ -457,7 +457,7 @@ def set_shape(self, space, orig_array, new_shape): if len(new_shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: ovfcheck(support.product_check(new_shape) * self.dtype.elsize) except OverflowError as e: @@ -601,7 +601,7 @@ def set_shape(self, space, orig_array, new_shape): if len(new_shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) try: ovfcheck(support.product_check(new_shape) * self.dtype.elsize) except OverflowError as e: diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py --- a/pypy/module/micronumpy/ctors.py +++ b/pypy/module/micronumpy/ctors.py @@ -18,7 +18,7 @@ raise oefmt(space.w_TypeError, "argument 1 must be numpy.dtype, not %T", w_dtype) if w_dtype.elsize == 0: - raise oefmt(space.w_ValueError, "itemsize cannot be zero") + raise oefmt(space.w_TypeError, "Empty data-type") if not space.isinstance_w(w_state, space.w_str): raise oefmt(space.w_TypeError, "initializing object must be a string") if space.len_w(w_state) != w_dtype.elsize: diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py --- a/pypy/module/micronumpy/descriptor.py +++ b/pypy/module/micronumpy/descriptor.py @@ -217,6 +217,8 @@ endian = ignore if self.num == NPY.UNICODE: size >>= 2 + if self.num == NPY.OBJECT: + return "%s%s" %(endian, basic) return "%s%s%s" % (endian, basic, size) def descr_get_descr(self, space, style='descr', force_dict=False): @@ -420,6 +422,10 @@ if space.is_w(self, w_other): return True if isinstance(w_other, W_Dtype): + if self.is_object() and w_other.is_object(): + # ignore possible 'record' unions + # created from dtype(('O', spec)) + return True return space.eq_w(self.descr_reduce(space), w_other.descr_reduce(space)) return False @@ -485,7 +491,12 @@ def descr_str(self, space): if self.fields: - return space.str(self.descr_get_descr(space, style='str')) + r = self.descr_get_descr(space, style='str') + name = space.str_w(space.str(self.w_box_type)) + if name != "": + boxname = space.str(self.w_box_type) + r = space.newtuple([self.w_box_type, r]) + return space.str(r) elif self.subdtype is not None: return space.str(space.newtuple([ self.subdtype.descr_get_str(space), @@ -497,8 +508,13 @@ return self.descr_get_name(space) def descr_repr(self, space): + if isinstance(self.itemtype, types.CharType): + return space.wrap("dtype('S1')") if self.fields: r = self.descr_get_descr(space, style='repr') + name = space.str_w(space.str(self.w_box_type)) + if name != "": + r = space.newtuple([space.wrap(self.w_box_type), r]) elif self.subdtype is not None: r = space.newtuple([self.subdtype.descr_get_str(space), self.descr_get_shape(space)]) @@ -800,8 +816,8 @@ def _usefields(space, w_dict, align): # Only for testing, a shortened version of the real _usefields allfields = [] - for fname in w_dict.iterkeys().iterator: - obj = _get_list_or_none(space, w_dict, fname) + for fname_w in space.unpackiterable(w_dict): + obj = _get_list_or_none(space, w_dict, space.str_w(fname_w)) num = space.int_w(obj[1]) if align: alignment = 0 @@ -812,8 +828,8 @@ title = space.wrap(obj[2]) else: title = space.w_None - allfields.append((space.wrap(fname), format, num, title)) - allfields.sort(key=lambda x: x[2]) + allfields.append((fname_w, format, num, title)) + #allfields.sort(key=lambda x: x[2]) names = [space.newtuple([x[0], x[3]]) for x in allfields] formats = [x[1] for x in allfields] offsets = [x[2] for x in allfields] @@ -837,12 +853,14 @@ aligned_w = _get_val_or_none(space, w_dict, 'aligned') itemsize_w = _get_val_or_none(space, w_dict, 'itemsize') if names_w is None or formats_w is None: - if we_are_translated(): + try: return get_appbridge_cache(space).call_method(space, 'numpy.core._internal', '_usefields', Arguments(space, [w_dict, space.wrap(alignment >= 0)])) - else: - return _usefields(space, w_dict, alignment >= 0) + except OperationError as e: + if e.match(space, space.w_ImportError): + return _usefields(space, w_dict, alignment >= 0) + raise n = len(names_w) if (n != len(formats_w) or (offsets_w is not None and n != len(offsets_w)) or @@ -882,16 +900,17 @@ def dtype_from_spec(space, w_spec, alignment): - if we_are_translated(): + w_lst = w_spec + try: w_lst = get_appbridge_cache(space).call_method(space, 'numpy.core._internal', '_commastring', Arguments(space, [w_spec])) - else: + except OperationError as e: + if not e.match(space, space.w_ImportError): + raise # handle only simple cases for testing if space.isinstance_w(w_spec, space.w_str): spec = [s.strip() for s in space.str_w(w_spec).split(',')] w_lst = space.newlist([space.wrap(s) for s in spec]) - elif space.isinstance_w(w_spec, space.w_list): - w_lst = w_spec if not space.isinstance_w(w_lst, space.w_list) or space.len_w(w_lst) < 1: raise oefmt(space.w_RuntimeError, "_commastring is not returning a list with len >= 1") @@ -942,7 +961,7 @@ shape_w = space.fixedview(w_shape) if len(shape_w) < 1: return None - elif len(shape_w) == 1 and space.isinstance_w(shape_w[0], space.w_tuple): + elif space.isinstance_w(shape_w[0], space.w_tuple): # (base_dtype, new_dtype) dtype spectification return None shape = [] @@ -997,12 +1016,17 @@ if len(spec) > 0: # this is (base_dtype, new_dtype) so just make it a union by setting both # parts' offset to 0 - try: - dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment) - except: - raise - raise oefmt(space.w_NotImplementedError, - "(base_dtype, new_dtype) dtype spectification discouraged, not implemented") + w_dtype1 = make_new_dtype(space, w_subtype, w_shape, alignment) + assert isinstance(w_dtype, W_Dtype) + assert isinstance(w_dtype1, W_Dtype) + if (w_dtype.elsize != 0 and w_dtype1.elsize != 0 and + w_dtype1.elsize != w_dtype.elsize): + raise oefmt(space.w_ValueError, + 'mismatch in size of old and new data-descriptor') + retval = W_Dtype(w_dtype.itemtype, w_dtype.w_box_type, + names=w_dtype1.names[:], fields=w_dtype1.fields.copy(), + elsize=w_dtype1.elsize) + return retval if space.is_none(w_dtype): return cache.w_float64dtype if space.isinstance_w(w_dtype, w_subtype): @@ -1032,19 +1056,22 @@ elif space.isinstance_w(w_dtype, space.w_tuple): w_dtype0 = space.getitem(w_dtype, space.wrap(0)) w_dtype1 = space.getitem(w_dtype, space.wrap(1)) - if space.isinstance_w(w_dtype0, space.w_type) and \ - space.isinstance_w(w_dtype1, space.w_list): - #obscure api - (subclass, spec). Ignore the subclass - return make_new_dtype(space, w_subtype, w_dtype1, alignment, - copy=copy, w_shape=w_shape, w_metadata=w_metadata) - subdtype = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy) - assert isinstance(subdtype, W_Dtype) - if subdtype.elsize == 0: - name = "%s%d" % (subdtype.kind, space.int_w(w_dtype1)) + # create a new dtype object + l_side = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy) + assert isinstance(l_side, W_Dtype) + if l_side.elsize == 0 and space.isinstance_w(w_dtype1, space.w_int): + #(flexible_dtype, itemsize) + name = "%s%d" % (l_side.kind, space.int_w(w_dtype1)) retval = make_new_dtype(space, w_subtype, space.wrap(name), alignment, copy) - else: - retval = make_new_dtype(space, w_subtype, w_dtype0, alignment, copy, w_shape=w_dtype1) - return _set_metadata_and_copy(space, w_metadata, retval, copy) + return _set_metadata_and_copy(space, w_metadata, retval, copy) + elif (space.isinstance_w(w_dtype1, space.w_int) or + space.isinstance_w(w_dtype1, space.w_tuple) or + space.isinstance_w(w_dtype1, space.w_list) or + isinstance(w_dtype1, W_NDimArray)): + #(fixed_dtype, shape) or (base_dtype, new_dtype) + retval = make_new_dtype(space, w_subtype, l_side, alignment, + copy, w_shape=w_dtype1) + return _set_metadata_and_copy(space, w_metadata, retval, copy) elif space.isinstance_w(w_dtype, space.w_dict): return _set_metadata_and_copy(space, w_metadata, dtype_from_dict(space, w_dtype, alignment), copy) @@ -1122,7 +1149,7 @@ size = int(name[1:]) except ValueError: raise oefmt(space.w_TypeError, "data type not understood") - if char == NPY.CHARLTR: + if char == NPY.CHARLTR and size == 0: return W_Dtype( types.CharType(space), elsize=1, @@ -1133,7 +1160,7 @@ return new_unicode_dtype(space, size) elif char == NPY.VOIDLTR: return new_void_dtype(space, size) - assert False + raise oefmt(space.w_TypeError, 'data type "%s" not understood', name) def new_string_dtype(space, size): diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -15,7 +15,7 @@ from pypy.module.micronumpy.arrayops import repeat, choose, put from pypy.module.micronumpy.base import W_NDimArray, convert_to_array, \ ArrayArgumentException, wrap_impl -from pypy.module.micronumpy.concrete import BaseConcreteArray +from pypy.module.micronumpy.concrete import BaseConcreteArray, V_OBJECTSTORE from pypy.module.micronumpy.converters import ( multi_axis_converter, order_converter, shape_converter, searchside_converter, out_converter) @@ -75,7 +75,7 @@ dtype = space.interp_w(descriptor.W_Dtype, space.call_function( space.gettypefor(descriptor.W_Dtype), w_dtype)) if (dtype.elsize != self.get_dtype().elsize or - dtype.is_flexible() or self.get_dtype().is_flexible()): + (not dtype.is_record() and self.get_dtype().is_flexible())): raise OperationError(space.w_ValueError, space.wrap( "new type not compatible with array.")) self.implementation.set_dtype(space, dtype) @@ -116,6 +116,13 @@ "index out of range for array")) size = loop.count_all_true(arr) if arr.ndims() == 1: + if self.ndims() > 1 and arr.get_shape()[0] != self.get_shape()[0]: + msg = ("boolean index did not match indexed array along" + " dimension 0; dimension is %d but corresponding" + " boolean dimension is %d" % (self.get_shape()[0], + arr.get_shape()[0])) + #warning = space.gettypefor(support.W_VisibleDeprecationWarning) + space.warn(space.wrap(msg), space.w_VisibleDeprecationWarning) res_shape = [size] + self.get_shape()[1:] else: res_shape = [size] @@ -278,9 +285,12 @@ def getfield(self, space, field): dtype = self.get_dtype() if field not in dtype.fields: - raise oefmt(space.w_ValueError, "field named %s not found", field) + raise oefmt(space.w_ValueError, "no field of name %s", field) arr = self.implementation ofs, subdtype = arr.dtype.fields[field][:2] + if subdtype.is_object() and arr.gcstruct is V_OBJECTSTORE: + raise oefmt(space.w_NotImplementedError, + "cannot read object from array with no gc hook") # ofs only changes start # create a view of the original array by extending # the shape, strides, backstrides of the array @@ -489,10 +499,8 @@ numpy.swapaxes : equivalent function """ if axis1 == axis2: - return self + return self.descr_view(space) n = self.ndims() - if n <= 1: - return self if axis1 < 0: axis1 += n if axis2 < 0: @@ -501,6 +509,8 @@ raise oefmt(space.w_ValueError, "bad axis1 argument to swapaxes") if axis2 < 0 or axis2 >= n: raise oefmt(space.w_ValueError, "bad axis2 argument to swapaxes") + if n <= 1: + return self return self.implementation.swapaxes(space, self, axis1, axis2) def descr_nonzero(self, space): @@ -899,7 +909,7 @@ if cur_shape[i] != 1: raise OperationError(space.w_ValueError, space.wrap( "cannot select an axis to squeeze out " - "which has size greater than one")) + "which has size not equal to one")) else: new_shape.append(cur_shape[i]) else: @@ -995,7 +1005,7 @@ # --------------------- operations ---------------------------- # TODO: support all kwargs like numpy ufunc_object.c sig = None - cast = 'unsafe' + cast = 'safe' extobj = None @@ -1374,7 +1384,7 @@ shape = shape_converter(space, w_shape, dtype) if len(shape) > NPY.MAXDIMS: raise oefmt(space.w_ValueError, - "sequence too large; must be smaller than %d", NPY.MAXDIMS) + "sequence too large; cannot be greater than %d", NPY.MAXDIMS) if not space.is_none(w_buffer): if (not space.is_none(w_strides)): strides = [space.int_w(w_i) for w_i in diff --git a/pypy/module/micronumpy/support.py b/pypy/module/micronumpy/support.py --- a/pypy/module/micronumpy/support.py +++ b/pypy/module/micronumpy/support.py @@ -8,6 +8,17 @@ from pypy.objspace.std.typeobject import W_TypeObject from pypy.objspace.std.objspace import StdObjSpace from pypy.module.micronumpy import constants as NPY +from pypy.module.exceptions.interp_exceptions import _new_exception, W_UserWarning + +W_VisibleDeprecationWarning = _new_exception('VisibleDeprecationWarning', W_UserWarning, + """Visible deprecation warning. + + By default, python will not show deprecation warnings, so this class + can be used when a very visible warning is helpful, for example because + the usage is most likely a user bug. + + """) + def issequence_w(space, w_obj): from pypy.module.micronumpy.base import W_NDimArray diff --git a/pypy/module/micronumpy/test/test_deprecations.py b/pypy/module/micronumpy/test/test_deprecations.py new file mode 100644 --- /dev/null +++ b/pypy/module/micronumpy/test/test_deprecations.py @@ -0,0 +1,33 @@ +import py +import sys + +from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest + + +class AppTestDeprecations(BaseNumpyAppTest): + spaceconfig = dict(usemodules=["micronumpy", "struct", "binascii"]) + + def test_getitem(self): + import numpy as np + import warnings, sys + warnings.simplefilter('error', np.VisibleDeprecationWarning) + try: + arr = np.ones((5, 4, 3)) + index = np.array([True]) + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + + index = np.array([False] * 6) + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + + index = np.zeros((4, 4), dtype=bool) + if '__pypy__' in sys.builtin_module_names: + # boolean indexing matches the dims in index + # to the first index.ndims in arr, not implemented in pypy yet + raises(IndexError, arr.__getitem__, index) + raises(TypeError, arr.__getitem__, (slice(None), index)) + else: + raises(np.VisibleDeprecationWarning, arr.__getitem__, index) + raises(np.VisibleDeprecationWarning, arr.__getitem__, (slice(None), index)) + finally: + warnings.simplefilter('default', np.VisibleDeprecationWarning) + diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -345,14 +345,29 @@ def test_can_subclass(self): import numpy as np + import sys, pickle class xyz(np.void): pass assert np.dtype(xyz).name == 'xyz' # another obscure API, used in numpy record.py - # it seems numpy throws away the subclass type and parses the spec a = np.dtype((xyz, [('x', 'int32'), ('y', 'float32')])) - assert repr(a) == "dtype([('x', ' s_annotation - # that can be attached to booleans, exitswitches - knowntypedata = {} - if isinstance(block.exitswitch, Variable): - knowntypedata = getattr(self.binding(block.exitswitch), - "knowntypedata", {}) - for link in exits: - self.follow_link(graph, link, knowntypedata) if block in self.notify: # reflow from certain positions when this block is done for callback in self.notify[block]: @@ -491,84 +531,66 @@ else: callback() - def follow_link(self, graph, link, knowntypedata): - in_except_block = False - v_last_exc_type = link.last_exception # may be None for non-exception link - v_last_exc_value = link.last_exc_value # may be None for non-exception link - if (isinstance(link.exitcase, (types.ClassType, type)) and - issubclass(link.exitcase, BaseException)): - assert v_last_exc_type and v_last_exc_value - s_last_exc_value = self.bookkeeper.valueoftype(link.exitcase) - s_last_exc_type = annmodel.SomeType() - if isinstance(v_last_exc_type, Constant): - s_last_exc_type.const = v_last_exc_type.value - s_last_exc_type.is_type_of = [v_last_exc_value] - - if isinstance(v_last_exc_type, Variable): - self.setbinding(v_last_exc_type, s_last_exc_type) - if isinstance(v_last_exc_value, Variable): - self.setbinding(v_last_exc_value, s_last_exc_value) - - s_last_exc_type = annmodel.SomeType() - if isinstance(v_last_exc_type, Constant): - s_last_exc_type.const = v_last_exc_type.value - last_exc_value_vars = [] - in_except_block = True + def follow_link(self, graph, link, constraints): + assert not (isinstance(link.exitcase, (types.ClassType, type)) and + issubclass(link.exitcase, BaseException)) ignore_link = False inputs_s = [] - renaming = {} + renaming = defaultdict(list) for v_out, v_input in zip(link.args, link.target.inputargs): - renaming.setdefault(v_out, []).append(v_input) - for v_out, v_input in zip(link.args, link.target.inputargs): - if v_out == v_last_exc_type: - assert in_except_block - inputs_s.append(s_last_exc_type) - elif v_out == v_last_exc_value: - assert in_except_block - inputs_s.append(s_last_exc_value) - last_exc_value_vars.append(v_input) - else: - s_out = self.annotation(v_out) - if (link.exitcase, v_out) in knowntypedata: - knownvarvalue = knowntypedata[(link.exitcase, v_out)] - s_out = pair(s_out, knownvarvalue).improve() - # ignore links that try to pass impossible values - if s_out == annmodel.s_ImpossibleValue: - ignore_link = True + renaming[v_out].append(v_input) - if hasattr(s_out,'is_type_of'): - renamed_is_type_of = [] - for v in s_out.is_type_of: - new_vs = renaming.get(v, []) - renamed_is_type_of += new_vs - assert s_out.knowntype is type - newcell = annmodel.SomeType() - if s_out.is_constant(): - newcell.const = s_out.const - s_out = newcell - s_out.is_type_of = renamed_is_type_of - - if hasattr(s_out, 'knowntypedata'): - renamed_knowntypedata = {} - for (value, v), s in s_out.knowntypedata.items(): - new_vs = renaming.get(v, []) - for new_v in new_vs: - renamed_knowntypedata[value, new_v] = s - assert isinstance(s_out, annmodel.SomeBool) - newcell = annmodel.SomeBool() - if s_out.is_constant(): - newcell.const = s_out.const - s_out = newcell - s_out.set_knowntypedata(renamed_knowntypedata) - - inputs_s.append(s_out) + for v_out in link.args: + s_out = self.annotation(v_out) + if v_out in constraints: + s_constraint = constraints[v_out] + s_out = pair(s_out, s_constraint).improve() + # ignore links that try to pass impossible values + if s_out == s_ImpossibleValue: + ignore_link = True + s_out = self.apply_renaming(s_out, renaming) + inputs_s.append(s_out) if ignore_link: return - if in_except_block: - s_last_exc_type.is_type_of = last_exc_value_vars + self.links_followed[link] = True + self.addpendingblock(graph, link.target, inputs_s) + + def follow_raise_link(self, graph, link, s_last_exc_value): + v_last_exc_type = link.last_exception + v_last_exc_value = link.last_exc_value + + assert (isinstance(link.exitcase, (types.ClassType, type)) and + issubclass(link.exitcase, BaseException)) + + assert v_last_exc_type and v_last_exc_value + + if isinstance(v_last_exc_value, Variable): + self.setbinding(v_last_exc_value, s_last_exc_value) + + if isinstance(v_last_exc_type, Variable): + self.setbinding(v_last_exc_type, typeof([v_last_exc_value])) + + inputs_s = [] + renaming = defaultdict(list) + for v_out, v_input in zip(link.args, link.target.inputargs): + renaming[v_out].append(v_input) + + for v_out, v_input in zip(link.args, link.target.inputargs): + if v_out == v_last_exc_type: + s_out = typeof(renaming[v_last_exc_value]) + if isinstance(v_last_exc_type, Constant): + s_out.const = v_last_exc_type.value + elif v_last_exc_type.annotation.is_constant(): + s_out.const = v_last_exc_type.annotation.const + inputs_s.append(s_out) + else: + s_out = self.annotation(v_out) + s_out = self.apply_renaming(s_out, renaming) + inputs_s.append(s_out) + self.links_followed[link] = True self.addpendingblock(graph, link.target, inputs_s) @@ -586,8 +608,8 @@ raise BlockedInference(self, op, -1) resultcell = op.consider(self) if resultcell is None: - resultcell = annmodel.s_ImpossibleValue - elif resultcell == annmodel.s_ImpossibleValue: + resultcell = s_ImpossibleValue + elif resultcell == s_ImpossibleValue: raise BlockedInference(self, op, -1) # the operation cannot succeed assert isinstance(resultcell, annmodel.SomeObject) assert isinstance(op.result, Variable) diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -1,18 +1,19 @@ """ Binary operations between SomeValues. """ +from collections import defaultdict from rpython.tool.pairtype import pair, pairtype from rpython.annotator.model import ( SomeObject, SomeInteger, SomeBool, s_Bool, SomeString, SomeChar, SomeList, - SomeDict, SomeUnicodeCodePoint, SomeUnicodeString, + SomeDict, SomeUnicodeCodePoint, SomeUnicodeString, SomeException, SomeTuple, SomeImpossibleValue, s_ImpossibleValue, SomeInstance, SomeBuiltinMethod, SomeIterator, SomePBC, SomeNone, SomeFloat, s_None, SomeByteArray, SomeWeakRef, SomeSingleFloat, - SomeLongFloat, SomeType, SomeConstantType, unionof, UnionError, + SomeLongFloat, SomeType, SomeTypeOf, SomeConstantType, unionof, UnionError, read_can_only_throw, add_knowntypedata, merge_knowntypedata,) -from rpython.annotator.bookkeeper import immutablevalue +from rpython.annotator.bookkeeper import immutablevalue, getbookkeeper from rpython.flowspace.model import Variable, Constant, const from rpython.flowspace.operation import op from rpython.rlib import rarithmetic @@ -35,7 +36,7 @@ elif s_obj1.is_constant(): if s_obj1.const is None and not s_obj2.can_be_none(): r.const = False - knowntypedata = {} + knowntypedata = defaultdict(dict) bk = annotator.bookkeeper def bind(src_obj, tgt_obj): @@ -145,24 +146,18 @@ def union((obj1, obj2)): result = SomeType() - is_type_of1 = getattr(obj1, 'is_type_of', None) - is_type_of2 = getattr(obj2, 'is_type_of', None) if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const: result.const = obj1.const - is_type_of = {} - if is_type_of1: - for v in is_type_of1: - is_type_of[v] = True - if is_type_of2: - for v in is_type_of2: - is_type_of[v] = True - if is_type_of: - result.is_type_of = is_type_of.keys() - else: - if is_type_of1 and is_type_of1 == is_type_of2: - result.is_type_of = is_type_of1 return result +class __extend__(pairtype(SomeTypeOf, SomeTypeOf)): + def union((s_obj1, s_obj2)): + vars = list(set(s_obj1.is_type_of) | set(s_obj2.is_type_of)) + result = SomeTypeOf(vars) + if (s_obj1.is_immutable_constant() and s_obj2.is_immutable_constant() + and s_obj1.const == s_obj2.const): + result.const = obj1.const + return result # cloning a function with identical code, for the can_only_throw attribute def _clone(f, can_only_throw = None): @@ -263,7 +258,7 @@ if not (rarithmetic.signedtype(s_int1.knowntype) and rarithmetic.signedtype(s_int2.knowntype)): return r - knowntypedata = {} + knowntypedata = defaultdict(dict) def tointtype(s_int0): if s_int0.knowntype is bool: return int @@ -682,6 +677,22 @@ thistype = pairtype(SomeInstance, SomeInstance) return super(thistype, pair(ins1, ins2)).improve() +class __extend__( + pairtype(SomeException, SomeInstance), + pairtype(SomeException, SomeNone)): + def union((s_exc, s_inst)): + return unionof(s_exc.as_SomeInstance(), s_inst) + +class __extend__( + pairtype(SomeInstance, SomeException), + pairtype(SomeNone, SomeException)): + def union((s_inst, s_exc)): + return unionof(s_exc.as_SomeInstance(), s_inst) + +class __extend__(pairtype(SomeException, SomeException)): + def union((s_exc1, s_exc2)): + return SomeException(s_exc1.classdefs | s_exc2.classdefs) + @op.getitem.register_transform(SomeInstance, SomeObject) def getitem_SomeInstance(annotator, v_ins, v_idx): diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py --- a/rpython/annotator/bookkeeper.py +++ b/rpython/annotator/bookkeeper.py @@ -12,7 +12,7 @@ from rpython.annotator.model import ( SomeOrderedDict, SomeString, SomeChar, SomeFloat, unionof, SomeInstance, SomeDict, SomeBuiltin, SomePBC, SomeInteger, TLS, SomeUnicodeCodePoint, - s_None, s_ImpossibleValue, SomeBool, SomeTuple, + s_None, s_ImpossibleValue, SomeBool, SomeTuple, SomeException, SomeImpossibleValue, SomeUnicodeString, SomeList, HarmlesslyBlocked, SomeWeakRef, SomeByteArray, SomeConstantType, SomeProperty) from rpython.annotator.classdesc import ClassDef, ClassDesc @@ -167,6 +167,10 @@ desc = self.getdesc(cls) return desc.getuniqueclassdef() + def new_exception(self, exc_classes): + clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes} + return SomeException(clsdefs) + def getlistdef(self, **flags_if_new): """Get the ListDef associated with the current position.""" try: diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py --- a/rpython/annotator/builtin.py +++ b/rpython/annotator/builtin.py @@ -2,7 +2,7 @@ Built-in functions. """ import sys -from collections import OrderedDict +from collections import OrderedDict, defaultdict from rpython.annotator.model import ( SomeInteger, SomeChar, SomeBool, SomeString, SomeTuple, @@ -188,7 +188,7 @@ variables = [op.args[1]] for variable in variables: assert bk.annotator.binding(variable) == s_obj - knowntypedata = {} + knowntypedata = defaultdict(dict) if not hasattr(typ, '_freeze_') and isinstance(s_type, SomePBC): add_knowntypedata(knowntypedata, True, variables, bk.valueoftype(typ)) r.set_knowntypedata(knowntypedata) diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -32,7 +32,7 @@ import inspect import weakref from types import BuiltinFunctionType, MethodType -from collections import OrderedDict +from collections import OrderedDict, defaultdict import rpython from rpython.tool import descriptor @@ -138,6 +138,23 @@ def can_be_none(self): return False +class SomeTypeOf(SomeType): + """The type of a variable""" + def __init__(self, args_v): + self.is_type_of = args_v + +def typeof(args_v): + if args_v: + result = SomeTypeOf(args_v) + if len(args_v) == 1: + s_arg = args_v[0].annotation + if isinstance(s_arg, SomeException) and len(s_arg.classdefs) == 1: + cdef, = s_arg.classdefs + result.const = cdef.classdesc.pyobj + return result + else: + return SomeType() + class SomeFloat(SomeObject): "Stands for a float or an integer." @@ -437,6 +454,39 @@ def noneify(self): return SomeInstance(self.classdef, can_be_None=True) +class SomeException(SomeObject): + """The set of exceptions obeying type(exc) in self.classes""" + def __init__(self, classdefs): + self.classdefs = classdefs + + def intersection(self, other): + assert isinstance(other, SomeExceptCase) + classdefs = {c for c in self.classdefs if c.issubclass(other.case)} + if classdefs: + return SomeException(classdefs) + else: + return s_ImpossibleValue + + def difference(self, other): + assert isinstance(other, SomeExceptCase) + classdefs = {c for c in self.classdefs if not c.issubclass(other.case)} + if classdefs: + return SomeException(classdefs) + else: + return s_ImpossibleValue + + def as_SomeInstance(self): + return unionof(*[SomeInstance(cdef) for cdef in self.classdefs]) + + +class SomeExceptCase(SomeObject): + """The set of exceptions that match a given except clause. + + IOW, the set of exceptions that verify isinstance(exc, self.case). + """ + def __init__(self, case): + self.case = case + class SomePBC(SomeObject): """Stands for a global user instance, built prior to the analysis, @@ -682,14 +732,15 @@ def add_knowntypedata(ktd, truth, vars, s_obj): for v in vars: - ktd[(truth, v)] = s_obj + ktd[truth][v] = s_obj def merge_knowntypedata(ktd1, ktd2): - r = {} - for truth_v in ktd1: - if truth_v in ktd2: - r[truth_v] = unionof(ktd1[truth_v], ktd2[truth_v]) + r = defaultdict(dict) + for truth, constraints in ktd1.items(): + for v in constraints: + if truth in ktd2 and v in ktd2[truth]: + r[truth][v] = unionof(ktd1[truth][v], ktd2[truth][v]) return r diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -698,6 +698,56 @@ s = a.build_types(snippet.exc_deduction_our_excs_plus_others, []) assert isinstance(s, annmodel.SomeInteger) + def test_complex_exception_deduction(self): + class InternalError(Exception): + def __init__(self, msg): + self.msg = msg + + class AppError(Exception): + def __init__(self, msg): + self.msg = msg + def apperror(msg): + return AppError(msg) + + def f(string): + if not string: + raise InternalError('Empty string') + return string, None + def cleanup(): + pass + + def g(string): + try: + try: + string, _ = f(string) + except ZeroDivisionError: + raise apperror('ZeroDivisionError') + try: + result, _ = f(string) + finally: + cleanup() + except InternalError as e: + raise apperror(e.msg) + return result + + a = self.RPythonAnnotator() + s_result = a.build_types(g, [str]) + assert isinstance(s_result, annmodel.SomeString) + + def test_method_exception_specialization(self): + def f(l): + try: + return l.pop() + except Exception: + raise + a = self.RPythonAnnotator() + s = a.build_types(f, [[int]]) + graph = graphof(a, f) + etype, evalue = graph.exceptblock.inputargs + assert evalue.annotation.classdefs == { + a.bookkeeper.getuniqueclassdef(IndexError)} + assert etype.annotation.const == IndexError + def test_operation_always_raising(self): def operation_always_raising(n): lst = [] @@ -1376,11 +1426,11 @@ a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)]) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() + t = annmodel.SomeTypeOf([ev]) t.const = KeyError - t.is_type_of = [ev] - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError) + assert et.annotation == t + s_ev = ev.annotation + assert s_ev == a.bookkeeper.new_exception([KeyError]) def test_reraiseAnything(self): def f(dic): @@ -1392,11 +1442,11 @@ a.build_types(f, [somedict(annmodel.s_Int, annmodel.s_Int)]) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() - t.is_type_of = [ev] - t.const = KeyError # IndexError ignored because 'dic' is a dict - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(KeyError) + t = annmodel.SomeTypeOf([ev]) + t.const = KeyError # IndexError ignored because 'dic' is a dict + assert et.annotation == t + s_ev = ev.annotation + assert s_ev == a.bookkeeper.new_exception([KeyError]) def test_exception_mixing(self): def h(): @@ -1427,10 +1477,11 @@ a.build_types(f, [int, somelist(annmodel.s_Int)]) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() - t.is_type_of = [ev] - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception) + t = annmodel.SomeTypeOf([ev]) + assert et.annotation == t + s_ev = ev.annotation + assert (isinstance(s_ev, annmodel.SomeInstance) and + s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception)) def test_try_except_raise_finally1(self): def h(): pass @@ -1449,10 +1500,11 @@ a.build_types(f, []) fg = graphof(a, f) et, ev = fg.exceptblock.inputargs - t = annmodel.SomeType() - t.is_type_of = [ev] - assert a.binding(et) == t - assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef == a.bookkeeper.getuniqueclassdef(Exception) + t = annmodel.SomeTypeOf([ev]) + assert et.annotation == t + s_ev = ev.annotation + assert (isinstance(s_ev, annmodel.SomeInstance) and + s_ev.classdef == a.bookkeeper.getuniqueclassdef(Exception)) def test_inplace_div(self): def f(n): diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py --- a/rpython/annotator/test/test_model.py +++ b/rpython/annotator/test/test_model.py @@ -1,8 +1,14 @@ -import py +import pytest from rpython.annotator.model import * from rpython.annotator.listdef import ListDef from rpython.translator.translator import TranslationContext +from rpython.annotator import unaryop, binaryop # for side-effects + + at pytest.fixture() +def annotator(): + t = TranslationContext() + return t.buildannotator() listdef1 = ListDef(None, SomeTuple([SomeInteger(nonneg=True), SomeString()])) @@ -100,19 +106,21 @@ class AAA(object): pass -def test_blocked_inference1(): +def test_blocked_inference1(annotator): def blocked_inference(): return AAA().m() - py.test.raises(AnnotatorError, compile_function, blocked_inference) + with pytest.raises(AnnotatorError): + annotator.build_types(blocked_inference, []) -def test_blocked_inference2(): +def test_blocked_inference2(annotator): def blocked_inference(): a = AAA() b = a.x return b - py.test.raises(AnnotatorError, compile_function, blocked_inference) + with pytest.raises(AnnotatorError): + annotator.build_types(blocked_inference, []) def test_not_const(): @@ -129,3 +137,17 @@ assert s.no_nul is True s = SomeChar().nonnulify() assert s.no_nul is True + +def test_SomeException_union(annotator): + bk = annotator.bookkeeper + someinst = lambda cls, **kw: SomeInstance(bk.getuniqueclassdef(cls), **kw) + s_inst = someinst(Exception) + s_exc = bk.new_exception([ValueError, IndexError]) + assert unionof(s_exc, s_inst) == s_inst + assert unionof(s_inst, s_exc) == s_inst + s_nullable = unionof(s_None, bk.new_exception([ValueError])) + assert isinstance(s_nullable, SomeInstance) + assert s_nullable.can_be_None + s_exc1 = bk.new_exception([ValueError]) + s_exc2 = bk.new_exception([IndexError]) + unionof(s_exc1, s_exc2) == unionof(s_exc2, s_exc1) diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -1,8 +1,9 @@ """ Unary operations on SomeValues. """ +from __future__ import absolute_import -from __future__ import absolute_import +from collections import defaultdict from rpython.tool.pairtype import pair from rpython.flowspace.operation import op @@ -11,7 +12,7 @@ from rpython.annotator.model import (SomeObject, SomeInteger, SomeBool, SomeString, SomeChar, SomeList, SomeDict, SomeTuple, SomeImpossibleValue, SomeUnicodeCodePoint, SomeInstance, SomeBuiltin, SomeBuiltinMethod, - SomeFloat, SomeIterator, SomePBC, SomeNone, SomeType, s_ImpossibleValue, + SomeFloat, SomeIterator, SomePBC, SomeNone, SomeTypeOf, s_ImpossibleValue, s_Bool, s_None, s_Int, unionof, add_knowntypedata, SomeWeakRef, SomeUnicodeString, SomeByteArray) from rpython.annotator.bookkeeper import getbookkeeper, immutablevalue @@ -26,11 +27,11 @@ if oper.dispatch == 1]) UNARY_OPERATIONS.remove('contains') + @op.type.register(SomeObject) -def type_SomeObject(annotator, arg): - r = SomeType() - r.is_type_of = [arg] - return r +def type_SomeObject(annotator, v_arg): + return SomeTypeOf([v_arg]) + @op.bool.register(SomeObject) def bool_SomeObject(annotator, obj): @@ -39,7 +40,7 @@ s_nonnone_obj = annotator.annotation(obj) if s_nonnone_obj.can_be_none(): s_nonnone_obj = s_nonnone_obj.nonnoneify() - knowntypedata = {} + knowntypedata = defaultdict(dict) add_knowntypedata(knowntypedata, True, [obj], s_nonnone_obj) r.set_knowntypedata(knowntypedata) return r @@ -99,18 +100,17 @@ callspec = complex_args([annotator.annotation(v_arg) for v_arg in args_v]) From noreply at buildbot.pypy.org Tue Nov 24 12:27:01 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 24 Nov 2015 18:27:01 +0100 (CET) Subject: [pypy-commit] cffi default: Mention jamadden's experience on irc Message-ID: <20151124172701.800451C134D@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r2433:36f23295979c Date: 2015-11-24 18:27 +0100 http://bitbucket.org/cffi/cffi/changeset/36f23295979c/ Log: Mention jamadden's experience on irc diff --git a/doc/source/using.rst b/doc/source/using.rst --- a/doc/source/using.rst +++ b/doc/source/using.rst @@ -1028,7 +1028,12 @@ Note that we assume that the called functions are *not* using the Python API from Python.h. For example, we don't check afterwards if they set a Python exception. You may work around it, but mixing - CFFI with ``Python.h`` is not recommended. + CFFI with ``Python.h`` is not recommended. (If you do that, on + PyPy and on some platforms like Windows, you may need to explicitly + link to ``libpypy-c.dll`` to access the CPython C API compatibility + layer; indeed, CFFI-generated modules on PyPy don't link to + ``libpypy-c.dll`` on their own. But really, don't do that in the + first place.) `(***)` ``long double`` support: From noreply at buildbot.pypy.org Tue Nov 24 12:31:39 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 18:31:39 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: remove verify from all the demos Message-ID: <20151124173139.8A7061C12C6@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2434:a7be543a732d Date: 2015-11-23 19:26 +0200 http://bitbucket.org/cffi/cffi/changeset/a7be543a732d/ Log: remove verify from all the demos From noreply at buildbot.pypy.org Tue Nov 24 12:31:41 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 18:31:41 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: fix one demo for verify -> set_source, compile Message-ID: <20151124173141.8EB141C12C6@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2435:a8a0693b9953 Date: 2015-11-24 19:29 +0200 http://bitbucket.org/cffi/cffi/changeset/a8a0693b9953/ Log: fix one demo for verify -> set_source, compile diff --git a/demo/xclient.py b/demo/xclient.py --- a/demo/xclient.py +++ b/demo/xclient.py @@ -1,40 +1,48 @@ -from cffi import FFI +import sys +sys.path.append('.') +try: + import _xclient +except ImportError: + from cffi import FFI + _ffi = FFI() + _ffi.cdef(""" -ffi = FFI() -ffi.cdef(""" + typedef ... Display; + typedef struct { ...; } Window; -typedef ... Display; -typedef struct { ...; } Window; + typedef struct { int type; ...; } XEvent; -typedef struct { int type; ...; } XEvent; + Display *XOpenDisplay(char *display_name); + Window DefaultRootWindow(Display *display); + int XMapRaised(Display *display, Window w); + Window XCreateSimpleWindow(Display *display, Window parent, int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, unsigned long border, + unsigned long background); + int XNextEvent(Display *display, XEvent *event_return); + """) -Display *XOpenDisplay(char *display_name); -Window DefaultRootWindow(Display *display); -int XMapRaised(Display *display, Window w); -Window XCreateSimpleWindow(Display *display, Window parent, int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, unsigned long border, - unsigned long background); -int XNextEvent(Display *display, XEvent *event_return); -""") -lib = ffi.verify(""" -#include -""", libraries=['X11']) + _ffi.set_source('_xclient', """ + #include + """, libraries=['X11']) + _ffi.compile() + import _xclient -globals().update(lib.__dict__) +ffi = _xclient.ffi +lib = _xclient.lib class XError(Exception): pass def main(): - display = XOpenDisplay(ffi.NULL) + display = lib.XOpenDisplay(ffi.NULL) if display == ffi.NULL: raise XError("cannot open display") - w = XCreateSimpleWindow(display, DefaultRootWindow(display), + w = lib.XCreateSimpleWindow(display, lib.DefaultRootWindow(display), 10, 10, 500, 350, 0, 0, 0) - XMapRaised(display, w) + lib.XMapRaised(display, w) event = ffi.new("XEvent *") - XNextEvent(display, event) + lib.XNextEvent(display, event) if __name__ == '__main__': main() From noreply at buildbot.pypy.org Tue Nov 24 12:44:10 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:44:10 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: dismiss the offsetof approach, as it's too complicate to make it working reliably in presence of cross-compilation. Simply disallow str_storage_getitem for types >= lltype.Signed Message-ID: <20151124174410.C07081C12C6@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80901:02f4fd70c0bb Date: 2015-11-24 18:44 +0100 http://bitbucket.org/pypy/pypy/changeset/02f4fd70c0bb/ Log: dismiss the offsetof approach, as it's too complicate to make it working reliably in presence of cross-compilation. Simply disallow str_storage_getitem for types >= lltype.Signed diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py --- a/rpython/rlib/strstorage.py +++ b/rpython/rlib/strstorage.py @@ -46,8 +46,11 @@ @specialize.arg(0) def str_storage_supported(TP): - STR_AS_TP = _rpy_string_as_type(TP) - return _offsetof_chars(STR) == _offsetof_chars(STR_AS_TP) + # on some architectures (e.g. win32 and arm32) an array of longlongs needs + # to be aligned at 8 bytes boundaries, so we cannot safely cast from STR + # to STR_AS_TP. In that case, we str_storage_getitem is simply not + # supported + return rffi.sizeof(TP) <= rffi.sizeof(lltype.Signed) @specialize.ll() def str_storage_getitem(TP, s, index): @@ -57,17 +60,3 @@ str_as_tp = rffi.cast(lltype.Ptr(STR_AS_TP), lls) index = index / rffi.sizeof(TP) return str_as_tp.chars[index] - - at specialize.arg(0) -def _offsetof_chars(TP): - # we need to be careful in presence of cross-compilation, because we want - # to defer the actual check at compile-time on the target machine, NOT at - # translation time on the host machine. However, we still need to support - # direct tests, so if we are not translated, we immediately force the - # result into an actual int. - offset = llmemory.offsetof(TP, 'chars') - if we_are_translated(): - return offset # symbolic - else: - return offset.force_as_int() - return offset From noreply at buildbot.pypy.org Tue Nov 24 12:46:52 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:46:52 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: this is now unsupported on linux x86_32 Message-ID: <20151124174652.EB61F1C12C6@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80902:a70875ac8f0e Date: 2015-11-24 18:46 +0100 http://bitbucket.org/pypy/pypy/changeset/a70875ac8f0e/ Log: this is now unsupported on linux x86_32 diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py --- a/rpython/rlib/test/test_strstorage.py +++ b/rpython/rlib/test/test_strstorage.py @@ -1,22 +1,17 @@ import py import sys -import platform import struct from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported from rpython.rlib.rarithmetic import r_singlefloat from rpython.rtyper.test.tool import BaseRtypingTest -IS_WIN32 = (sys.platform == 'win32') -IS_ARM = (platform.machine().startswith('arm')) IS_32BIT = (sys.maxint == 2147483647) class BaseStrStorageTest: def test_str_getitem_supported(self): - # on win32 or ARM32, we expect LONGLONG and DOUBLE to be NOT supported - # by str_storage_getitem - if IS_WIN32 or (IS_ARM and IS_32BIT): + if IS_32BIT: expected = False else: expected = True From noreply at buildbot.pypy.org Tue Nov 24 12:59:37 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:59:37 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: hg merge default Message-ID: <20151124175937.D3C1B1C12C6@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80903:56589ed1776a Date: 2015-11-24 18:57 +0100 http://bitbucket.org/pypy/pypy/changeset/56589ed1776a/ Log: hg merge default diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -17,6 +17,7 @@ """ from __future__ import division +import numbers as _numbers import time as _time import math as _math import struct as _struct @@ -271,15 +272,17 @@ def _check_int_field(value): if isinstance(value, int): - return value + return int(value) if not isinstance(value, float): try: value = value.__int__() except AttributeError: pass else: - if isinstance(value, (int, long)): - return value + if isinstance(value, int): + return int(value) + elif isinstance(value, long): + return int(long(value)) raise TypeError('__int__ method should return an integer') raise TypeError('an integer is required') raise TypeError('integer argument expected, got float') @@ -468,7 +471,7 @@ d = days assert isinstance(daysecondsfrac, float) assert abs(daysecondsfrac) <= 1.0 - assert isinstance(d, (int, long)) + assert isinstance(d, _numbers.Integral) assert abs(s) <= 24 * 3600 # days isn't referenced again before redefinition @@ -484,11 +487,11 @@ assert isinstance(secondsfrac, float) assert abs(secondsfrac) <= 2.0 - assert isinstance(seconds, (int, long)) + assert isinstance(seconds, _numbers.Integral) days, seconds = divmod(seconds, 24*3600) d += days s += int(seconds) # can't overflow - assert isinstance(s, int) + assert isinstance(s, _numbers.Integral) assert abs(s) <= 2 * 24 * 3600 # seconds isn't referenced again before redefinition @@ -510,8 +513,8 @@ d += days s += int(seconds) microseconds = _round(microseconds + usdouble) - assert isinstance(s, int) - assert isinstance(microseconds, int) + assert isinstance(s, _numbers.Integral) + assert isinstance(microseconds, _numbers.Integral) assert abs(s) <= 3 * 24 * 3600 assert abs(microseconds) < 3.1e6 @@ -521,9 +524,9 @@ days, s = divmod(s, 24*3600) d += days - assert isinstance(d, (int, long)) - assert isinstance(s, int) and 0 <= s < 24*3600 - assert isinstance(us, int) and 0 <= us < 1000000 + assert isinstance(d, _numbers.Integral) + assert isinstance(s, _numbers.Integral) and 0 <= s < 24*3600 + assert isinstance(us, _numbers.Integral) and 0 <= us < 1000000 if abs(d) > 999999999: raise OverflowError("timedelta # of days is too large: %d" % d) @@ -1510,7 +1513,7 @@ converter = _time.localtime if tz is None else _time.gmtime - if isinstance(timestamp, int): + if isinstance(timestamp, _numbers.Integral): us = 0 else: t_full = timestamp @@ -1535,7 +1538,7 @@ @classmethod def utcfromtimestamp(cls, t): "Construct a UTC datetime from a POSIX timestamp (like time.time())." - if isinstance(t, int): + if isinstance(t, _numbers.Integral): us = 0 else: t_full = t diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -15,4 +15,10 @@ Fix the cpyext tests on OSX by linking with -flat_namespace .. branch: anntype + Refactor and improve exception analysis in the annotator. + +.. branch: posita/2193-datetime-timedelta-integrals + +Fix issue #2193. ``isinstance(..., int)`` => ``isinstance(..., numbers.Integral)`` +to allow for alternate ``int``-like implementations (e.g., ``future.types.newint``) diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -170,14 +170,23 @@ self.value = value def __int__(self): return self.value + class SubInt(int): pass + class SubLong(long): pass + dt10 = datetime.datetime(10, 10, 10, 10, 10, 10, 10) for xx in [10L, decimal.Decimal(10), decimal.Decimal('10.9'), Number(10), - Number(10L)]: - assert datetime.datetime(10, 10, 10, 10, 10, 10, 10) == \ - datetime.datetime(xx, xx, xx, xx, xx, xx, xx) + Number(10L), + SubInt(10), + SubLong(10), + Number(SubInt(10)), + Number(SubLong(10))]: + dtxx = datetime.datetime(xx, xx, xx, xx, xx, xx, xx) + assert dt10 == dtxx + assert type(dtxx.month) is int + assert type(dtxx.second) is int with py.test.raises(TypeError) as e: datetime.datetime(10, 10, '10') @@ -242,6 +251,64 @@ naive == aware assert str(e.value) == "can't compare offset-naive and offset-aware times" + def test_future_types_newint(self): + try: + from future.types.newint import newint + except ImportError: + py.test.skip('requires future') + + dt_from_ints = datetime.datetime(2015, 12, 31, 12, 34, 56) + dt_from_newints = datetime.datetime(newint(2015), newint(12), newint(31), newint(12), newint(34), newint(56)) + dt_from_mixed = datetime.datetime(2015, newint(12), 31, newint(12), 34, newint(56)) + assert dt_from_ints == dt_from_newints + assert dt_from_newints == dt_from_mixed + assert dt_from_mixed == dt_from_ints + + d_from_int = datetime.date.fromtimestamp(1431216000) + d_from_newint = datetime.date.fromtimestamp(newint(1431216000)) + assert d_from_int == d_from_newint + + dt_from_int = datetime.datetime.fromtimestamp(1431216000) + dt_from_newint = datetime.datetime.fromtimestamp(newint(1431216000)) + assert dt_from_int == dt_from_newint + + dtu_from_int = datetime.datetime.utcfromtimestamp(1431216000) + dtu_from_newint = datetime.datetime.utcfromtimestamp(newint(1431216000)) + assert dtu_from_int == dtu_from_newint + + td_from_int = datetime.timedelta(16565) + tds_from_int = datetime.timedelta(seconds=1431216000) + td_from_newint = datetime.timedelta(newint(16565)) + tds_from_newint = datetime.timedelta(seconds=newint(1431216000)) + assert td_from_int == tds_from_int + assert td_from_int == td_from_newint + assert td_from_int == tds_from_newint + assert tds_from_int == td_from_newint + assert tds_from_int == tds_from_newint + assert td_from_newint == tds_from_newint + + td_mul_int_int = td_from_int * 2 + td_mul_int_newint = td_from_int * newint(2) + td_mul_newint_int = td_from_newint * 2 + td_mul_newint_newint = td_from_newint * newint(2) + assert td_mul_int_int == td_mul_int_newint + assert td_mul_int_int == td_mul_newint_int + assert td_mul_int_int == td_mul_newint_newint + assert td_mul_int_newint == td_mul_newint_int + assert td_mul_int_newint == td_mul_newint_newint + assert td_mul_newint_int == td_mul_newint_newint + + td_div_int_int = td_from_int / 3600 + td_div_int_newint = td_from_int / newint(3600) + td_div_newint_int = td_from_newint / 3600 + td_div_newint_newint = td_from_newint / newint(3600) + assert td_div_int_int == td_div_int_newint + assert td_div_int_int == td_div_newint_int + assert td_div_int_int == td_div_newint_newint + assert td_div_int_newint == td_div_newint_int + assert td_div_int_newint == td_div_newint_newint + assert td_div_newint_int == td_div_newint_newint + class TestDatetimeHost(BaseTestDatetime): def setup_class(cls): diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -314,9 +314,16 @@ args, virtuals = target_virtual_state.make_inputargs_and_virtuals( args, self.optimizer) short_preamble = target_token.short_preamble - extra = self.inline_short_preamble(args + virtuals, args, - short_preamble, self.optimizer.patchguardop, - target_token, label_op) + try: + extra = self.inline_short_preamble(args + virtuals, args, + short_preamble, self.optimizer.patchguardop, + target_token, label_op) + except KeyError: + # SHOULD NOT OCCUR BUT DOES: WHY?? issue #2185 + self.optimizer.metainterp_sd.logger_ops.log_short_preamble([], + short_preamble, {}) + raise + self.send_extra_operation(jump_op.copy_and_change(rop.JUMP, args=args + extra, descr=target_token)) From noreply at buildbot.pypy.org Tue Nov 24 12:59:39 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 18:59:39 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: temporarily disable micronumpy as it causes translation to fail Message-ID: <20151124175939.ED4271C12C6@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80904:ffe06132bdbc Date: 2015-11-24 19:00 +0100 http://bitbucket.org/pypy/pypy/changeset/ffe06132bdbc/ Log: temporarily disable micronumpy as it causes translation to fail diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -39,6 +39,8 @@ "_csv", "cppyy", "_pypyjson" ]) +working_modules.remove('micronumpy') # XXX temporary + if ((sys.platform.startswith('linux') or sys.platform == 'darwin') and os.uname()[4] == 'x86_64' and sys.maxint > 2**32): # it's not enough that we get x86_64 From noreply at buildbot.pypy.org Tue Nov 24 13:03:40 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 19:03:40 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: split the demo into two files Message-ID: <20151124180340.30EFD1C12C6@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2436:a34f6189d2b6 Date: 2015-11-24 20:04 +0200 http://bitbucket.org/cffi/cffi/changeset/a34f6189d2b6/ Log: split the demo into two files diff --git a/demo/xclient.py b/demo/xclient.py --- a/demo/xclient.py +++ b/demo/xclient.py @@ -1,35 +1,14 @@ -import sys +import sys, os + +# If the build script was run immediately before this script, the cffi module +# ends up in the current directory. Make sure we can import it. sys.path.append('.') + try: - import _xclient + from _xclient import ffi, lib except ImportError: - from cffi import FFI - _ffi = FFI() - _ffi.cdef(""" - - typedef ... Display; - typedef struct { ...; } Window; - - typedef struct { int type; ...; } XEvent; - - Display *XOpenDisplay(char *display_name); - Window DefaultRootWindow(Display *display); - int XMapRaised(Display *display, Window w); - Window XCreateSimpleWindow(Display *display, Window parent, int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, unsigned long border, - unsigned long background); - int XNextEvent(Display *display, XEvent *event_return); - """) - - _ffi.set_source('_xclient', """ - #include - """, libraries=['X11']) - _ffi.compile() - import _xclient - -ffi = _xclient.ffi -lib = _xclient.lib + print 'run %s_build first, then make sure the shared object is on sys.path' % os.path.splitext(__file__)[0] + sys.exit(-1) class XError(Exception): pass diff --git a/demo/xclient_build.py b/demo/xclient_build.py new file mode 100644 --- /dev/null +++ b/demo/xclient_build.py @@ -0,0 +1,24 @@ +from cffi import FFI +_ffi = FFI() +_ffi.cdef(""" + +typedef ... Display; +typedef struct { ...; } Window; + +typedef struct { int type; ...; } XEvent; + +Display *XOpenDisplay(char *display_name); +Window DefaultRootWindow(Display *display); +int XMapRaised(Display *display, Window w); +Window XCreateSimpleWindow(Display *display, Window parent, int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, unsigned long border, + unsigned long background); +int XNextEvent(Display *display, XEvent *event_return); +""") + +_ffi.set_source('_xclient', """ + #include +""", libraries=['X11']) +_ffi.compile() + From noreply at buildbot.pypy.org Tue Nov 24 13:04:15 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Tue, 24 Nov 2015 19:04:15 +0100 (CET) Subject: [pypy-commit] pypy default: isinstance(_, long) is not RPython: fix the micronumpy FakeSpace Message-ID: <20151124180415.E339E1C12C6@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80905:35a59456a15a Date: 2015-11-24 18:01 +0000 http://bitbucket.org/pypy/pypy/changeset/35a59456a15a/ Log: isinstance(_, long) is not RPython: fix the micronumpy FakeSpace diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -8,6 +8,7 @@ from pypy.interpreter.error import OperationError from rpython.rlib.objectmodel import specialize, instantiate from rpython.rlib.nonconst import NonConstant +from rpython.rlib.rarithmetic import base_int from pypy.module.micronumpy import boxes, ufuncs from pypy.module.micronumpy.arrayops import where from pypy.module.micronumpy.ndarray import W_NDimArray @@ -178,7 +179,7 @@ return BoolObject(obj) elif isinstance(obj, int): return IntObject(obj) - elif isinstance(obj, long): + elif isinstance(obj, base_int): return LongObject(obj) elif isinstance(obj, W_Root): return obj @@ -196,31 +197,31 @@ return self.float(f) def le(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_le(self, w_obj2) def lt(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_lt(self, w_obj2) def ge(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_ge(self, w_obj2) def add(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_add(self, w_obj2) def sub(self, w_obj1, w_obj2): return self.wrap(1) def mul(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_mul(self, w_obj2) def pow(self, w_obj1, w_obj2, _): @@ -836,7 +837,7 @@ elif self.name == 'reshape': w_arg = self.args[1] assert isinstance(w_arg, ArrayConstant) - order = -1 + order = -1 w_res = arr.reshape(interp.space, w_arg.wrap(interp.space), order) else: assert False From noreply at buildbot.pypy.org Tue Nov 24 13:21:21 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 19:21:21 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: try to disable this as well Message-ID: <20151124182121.E667E1C052B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80906:74414c3c9204 Date: 2015-11-24 19:21 +0100 http://bitbucket.org/pypy/pypy/changeset/74414c3c9204/ Log: try to disable this as well diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -40,6 +40,7 @@ ]) working_modules.remove('micronumpy') # XXX temporary +working_modules.remove('cpyext') if ((sys.platform.startswith('linux') or sys.platform == 'darwin') and os.uname()[4] == 'x86_64' and sys.maxint > 2**32): From noreply at buildbot.pypy.org Tue Nov 24 14:30:37 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 20:30:37 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151124193037.CD5731C12C6@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80908:367dea44b661 Date: 2015-11-24 14:30 -0500 http://bitbucket.org/pypy/pypy/changeset/367dea44b661/ Log: merge heads diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -8,6 +8,7 @@ from pypy.interpreter.error import OperationError from rpython.rlib.objectmodel import specialize, instantiate from rpython.rlib.nonconst import NonConstant +from rpython.rlib.rarithmetic import base_int from pypy.module.micronumpy import boxes, ufuncs from pypy.module.micronumpy.arrayops import where from pypy.module.micronumpy.ndarray import W_NDimArray @@ -178,7 +179,7 @@ return BoolObject(obj) elif isinstance(obj, int): return IntObject(obj) - elif isinstance(obj, long): + elif isinstance(obj, base_int): return LongObject(obj) elif isinstance(obj, W_Root): return obj @@ -196,31 +197,31 @@ return self.float(f) def le(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_le(self, w_obj2) def lt(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_lt(self, w_obj2) def ge(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_ge(self, w_obj2) def add(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_add(self, w_obj2) def sub(self, w_obj1, w_obj2): return self.wrap(1) def mul(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_mul(self, w_obj2) def pow(self, w_obj1, w_obj2, _): @@ -836,7 +837,7 @@ elif self.name == 'reshape': w_arg = self.args[1] assert isinstance(w_arg, ArrayConstant) - order = -1 + order = -1 w_res = arr.reshape(interp.space, w_arg.wrap(interp.space), order) else: assert False From noreply at buildbot.pypy.org Tue Nov 24 14:39:43 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Tue, 24 Nov 2015 20:39:43 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: try harder to disable cpyext Message-ID: <20151124193943.C560C1C052B@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80909:1bf434a1141d Date: 2015-11-24 20:39 +0100 http://bitbucket.org/pypy/pypy/changeset/1bf434a1141d/ Log: try harder to disable cpyext diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -335,6 +335,8 @@ def enable_allworkingmodules(config): + config.objspace.usemodules.cpyext = False # XXX + modules = working_modules.copy() if config.translation.sandbox: modules = default_modules @@ -344,6 +346,7 @@ config.objspace.usemodules.suggest(**dict.fromkeys(modules, True)) + def enable_translationmodules(config): modules = translation_modules modules = [name for name in modules if name not in essential_modules] From noreply at buildbot.pypy.org Tue Nov 24 14:30:35 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 20:30:35 +0100 (CET) Subject: [pypy-commit] pypy default: speed up timedelta creation Message-ID: <20151124193035.B16E21C1293@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80907:d41b9b35d3b5 Date: 2015-11-24 14:16 -0500 http://bitbucket.org/pypy/pypy/changeset/d41b9b35d3b5/ Log: speed up timedelta creation diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -22,6 +22,8 @@ import math as _math import struct as _struct +_SENTINEL = object() + def _cmp(x, y): return 0 if x == y else 1 if x > y else -1 @@ -32,6 +34,8 @@ MAXYEAR = 9999 _MINYEARFMT = 1900 +_MAX_DELTA_DAYS = 999999999 + # Utility functions, adapted from Python's Demo/classes/Dates.py, which # also assumes the current Gregorian calendar indefinitely extended in # both directions. Difference: Dates.py calls January 1 of year 0 day @@ -96,6 +100,15 @@ # pasting together 25 4-year cycles. assert _DI100Y == 25 * _DI4Y - 1 +_US_PER_US = 1 +_US_PER_MS = 1000 +_US_PER_SECOND = 1000000 +_US_PER_MINUTE = 60000000 +_SECONDS_PER_DAY = 24 * 3600 +_US_PER_HOUR = 3600000000 +_US_PER_DAY = 86400000000 +_US_PER_WEEK = 604800000000 + def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." @@ -417,6 +430,24 @@ self.hour, self.minute, self.second = hour, minute, second self.microsecond = microsecond +def _accum(tag, sofar, num, factor, leftover): + if isinstance(num, (int, long)): + prod = num * factor + rsum = sofar + prod + return rsum, leftover + if isinstance(num, float): + fracpart, intpart = _math.modf(num) + prod = int(intpart) * factor + rsum = sofar + prod + if fracpart == 0.0: + return rsum, leftover + assert isinstance(factor, (int, long)) + fracpart, intpart = _math.modf(factor * fracpart) + rsum += int(intpart) + return rsum, leftover + fracpart + raise TypeError("unsupported type for timedelta %s component: %s" % + (tag, type(num))) + class timedelta(object): """Represent the difference between two datetime objects. @@ -436,100 +467,35 @@ """ __slots__ = '_days', '_seconds', '_microseconds', '_hashcode' - def __new__(cls, days=0, seconds=0, microseconds=0, - milliseconds=0, minutes=0, hours=0, weeks=0): - # Doing this efficiently and accurately in C is going to be difficult - # and error-prone, due to ubiquitous overflow possibilities, and that - # C double doesn't have enough bits of precision to represent - # microseconds over 10K years faithfully. The code here tries to make - # explicit where go-fast assumptions can be relied on, in order to - # guide the C implementation; it's way more convoluted than speed- - # ignoring auto-overflow-to-long idiomatic Python could be. + def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL, + milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL): + x = 0 + leftover = 0.0 + if microseconds is not _SENTINEL: + x, leftover = _accum("microseconds", x, microseconds, _US_PER_US, leftover) + if milliseconds is not _SENTINEL: + x, leftover = _accum("milliseconds", x, milliseconds, _US_PER_MS, leftover) + if seconds is not _SENTINEL: + x, leftover = _accum("seconds", x, seconds, _US_PER_SECOND, leftover) + if minutes is not _SENTINEL: + x, leftover = _accum("minutes", x, minutes, _US_PER_MINUTE, leftover) + if hours is not _SENTINEL: + x, leftover = _accum("hours", x, hours, _US_PER_HOUR, leftover) + if days is not _SENTINEL: + x, leftover = _accum("days", x, days, _US_PER_DAY, leftover) + if weeks is not _SENTINEL: + x, leftover = _accum("weeks", x, weeks, _US_PER_WEEK, leftover) + if leftover != 0.0: + x += _round(leftover) + return cls._from_microseconds(x) - # XXX Check that all inputs are ints, longs or floats. + @classmethod + def _from_microseconds(cls, us): + s, us = divmod(us, _US_PER_SECOND) + d, s = divmod(s, _SECONDS_PER_DAY) - # Final values, all integer. - # s and us fit in 32-bit signed ints; d isn't bounded. - d = s = us = 0 - - # Normalize everything to days, seconds, microseconds. - days += weeks*7 - seconds += minutes*60 + hours*3600 - microseconds += milliseconds*1000 - - # Get rid of all fractions, and normalize s and us. - # Take a deep breath . - if isinstance(days, float): - dayfrac, days = _math.modf(days) - daysecondsfrac, daysecondswhole = _math.modf(dayfrac * (24.*3600.)) - assert daysecondswhole == int(daysecondswhole) # can't overflow - s = int(daysecondswhole) - assert days == int(days) - d = int(days) - else: - daysecondsfrac = 0.0 - d = days - assert isinstance(daysecondsfrac, float) - assert abs(daysecondsfrac) <= 1.0 - assert isinstance(d, _numbers.Integral) - assert abs(s) <= 24 * 3600 - # days isn't referenced again before redefinition - - if isinstance(seconds, float): - secondsfrac, seconds = _math.modf(seconds) - assert seconds == int(seconds) - seconds = int(seconds) - secondsfrac += daysecondsfrac - assert abs(secondsfrac) <= 2.0 - else: - secondsfrac = daysecondsfrac - # daysecondsfrac isn't referenced again - assert isinstance(secondsfrac, float) - assert abs(secondsfrac) <= 2.0 - - assert isinstance(seconds, _numbers.Integral) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) # can't overflow - assert isinstance(s, _numbers.Integral) - assert abs(s) <= 2 * 24 * 3600 - # seconds isn't referenced again before redefinition - - usdouble = secondsfrac * 1e6 - assert abs(usdouble) < 2.1e6 # exact value not critical - # secondsfrac isn't referenced again - - if isinstance(microseconds, float): - microseconds = _round(microseconds + usdouble) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = int(microseconds) - else: - microseconds = int(microseconds) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = _round(microseconds + usdouble) - assert isinstance(s, _numbers.Integral) - assert isinstance(microseconds, _numbers.Integral) - assert abs(s) <= 3 * 24 * 3600 - assert abs(microseconds) < 3.1e6 - - # Just a little bit of carrying possible for microseconds and seconds. - seconds, us = divmod(microseconds, 1000000) - s += seconds - days, s = divmod(s, 24*3600) - d += days - - assert isinstance(d, _numbers.Integral) - assert isinstance(s, _numbers.Integral) and 0 <= s < 24*3600 - assert isinstance(us, _numbers.Integral) and 0 <= us < 1000000 - - if abs(d) > 999999999: - raise OverflowError("timedelta # of days is too large: %d" % d) + if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS: + raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS)) self = object.__new__(cls) self._days = d @@ -538,6 +504,10 @@ self._hashcode = -1 return self + def _to_microseconds(self): + return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND + + self._microseconds) + def __repr__(self): module = "datetime." if self.__class__ is timedelta else "" if self._microseconds: @@ -626,25 +596,18 @@ return self def __mul__(self, other): - if isinstance(other, (int, long)): - # for CPython compatibility, we cannot use - # our __class__ here, but need a real timedelta - return timedelta(self._days * other, - self._seconds * other, - self._microseconds * other) - return NotImplemented + if not isinstance(other, (int, long)): + return NotImplemented + usec = self._to_microseconds() + return timedelta._from_microseconds(usec * other) __rmul__ = __mul__ - def _to_microseconds(self): - return ((self._days * (24*3600) + self._seconds) * 1000000 + - self._microseconds) - def __div__(self, other): if not isinstance(other, (int, long)): return NotImplemented usec = self._to_microseconds() - return timedelta(0, 0, usec // other) + return timedelta._from_microseconds(usec // other) __floordiv__ = __div__ @@ -708,9 +671,8 @@ def __reduce__(self): return (self.__class__, self._getstate()) -timedelta.min = timedelta(-999999999) -timedelta.max = timedelta(days=999999999, hours=23, minutes=59, seconds=59, - microseconds=999999) +timedelta.min = timedelta(-_MAX_DELTA_DAYS) +timedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1) timedelta.resolution = timedelta(microseconds=1) class date(object): From noreply at buildbot.pypy.org Tue Nov 24 15:36:35 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 21:36:35 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: update gmp demo Message-ID: <20151124203635.A47B71C1293@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2437:854dc393589a Date: 2015-11-24 21:28 +0200 http://bitbucket.org/cffi/cffi/changeset/854dc393589a/ Log: update gmp demo diff --git a/demo/btrfs-snap.py b/demo/btrfs-snap.py --- a/demo/btrfs-snap.py +++ b/demo/btrfs-snap.py @@ -22,9 +22,6 @@ }; """) -v = ffi.verify("#include ") - - parser = argparse.ArgumentParser(usage=__doc__.strip()) parser.add_argument('source', help='source subvolume') diff --git a/demo/fastcsv.py b/demo/fastcsv.py --- a/demo/fastcsv.py +++ b/demo/fastcsv.py @@ -26,7 +26,7 @@ else: d['is_escape_char'] = '&& 0' - lib = ffi.verify(r''' + ffi.set_source('_fastcsv', r''' typedef enum { START_RECORD, START_FIELD, ESCAPED_CHAR, IN_FIELD, diff --git a/demo/gmp.py b/demo/gmp.py --- a/demo/gmp.py +++ b/demo/gmp.py @@ -1,33 +1,29 @@ import sys -import cffi -# -# This is only a demo based on the GMP library. -# There is a rather more complete version available at: -# http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files -# +# If the build script was run immediately before this script, the cffi module +# ends up in the current directory. Make sure we can import it. +sys.path.append('.') -ffi = cffi.FFI() +try: + from _gmp import ffi, lib +except ImportError: + print 'run gmp_build first, then make sure the shared object is on sys.path' + sys.exit(-1) -ffi.cdef(""" - - typedef struct { ...; } MP_INT; - typedef MP_INT mpz_t[1]; - - int mpz_init_set_str (MP_INT *dest_integer, char *src_cstring, int base); - void mpz_add (MP_INT *sum, MP_INT *addend1, MP_INT *addend2); - char * mpz_get_str (char *string, int base, MP_INT *integer); - -""") - -lib = ffi.verify("#include ", - libraries=['gmp', 'm']) +# ffi "knows" about the declared variables and functions from the +# cdef parts of the module xclient_build created, +# lib "knows" how to call the functions from the set_source parts +# of the module. # ____________________________________________________________ a = ffi.new("mpz_t") b = ffi.new("mpz_t") +if len(sys.argv) < 3: + print 'call as %s bigint1, bigint2' % sys.argv[0] + sys.exit(-1) + lib.mpz_init_set_str(a, sys.argv[1], 10) # Assume decimal integers lib.mpz_init_set_str(b, sys.argv[2], 10) # Assume decimal integers lib.mpz_add(a, a, b) # a=a+b diff --git a/demo/gmp_build.py b/demo/gmp_build.py new file mode 100644 --- /dev/null +++ b/demo/gmp_build.py @@ -0,0 +1,27 @@ +import cffi + +# +# This is only a demo based on the GMP library. +# There is a rather more complete (but outdated) version available at: +# http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files +# + +ffi = cffi.FFI() + +ffi.cdef(""" + + typedef struct { ...; } MP_INT; + typedef MP_INT mpz_t[1]; + + int mpz_init_set_str (MP_INT *dest_integer, char *src_cstring, int base); + void mpz_add (MP_INT *sum, MP_INT *addend1, MP_INT *addend2); + char * mpz_get_str (char *string, int base, MP_INT *integer); + +""") + +ffi.set_source('_gmp', "#include ", + libraries=['gmp', 'm']) + +if __name__ == '__main__': + ffi.compile() + diff --git a/demo/xclient.py b/demo/xclient.py --- a/demo/xclient.py +++ b/demo/xclient.py @@ -7,9 +7,15 @@ try: from _xclient import ffi, lib except ImportError: - print 'run %s_build first, then make sure the shared object is on sys.path' % os.path.splitext(__file__)[0] + print 'run xclient_build first, then make sure the shared object is on sys.path' sys.exit(-1) +# ffi "knows" about the declared variables and functions from the +# cdef parts of the module xclient_build created, +# lib "knows" how to call the functions from the set_source parts +# of the module. + + class XError(Exception): pass diff --git a/demo/xclient_build.py b/demo/xclient_build.py --- a/demo/xclient_build.py +++ b/demo/xclient_build.py @@ -1,6 +1,6 @@ from cffi import FFI -_ffi = FFI() -_ffi.cdef(""" +ffi = FFI() +ffi.cdef(""" typedef ... Display; typedef struct { ...; } Window; @@ -17,8 +17,10 @@ int XNextEvent(Display *display, XEvent *event_return); """) -_ffi.set_source('_xclient', """ +ffi.set_source('_xclient', """ #include """, libraries=['X11']) -_ffi.compile() +if __name__ == '__main__': + ffi.compile() + From noreply at buildbot.pypy.org Tue Nov 24 15:36:37 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 21:36:37 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: fix comment Message-ID: <20151124203637.AFD8B1C1293@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2438:90de1ea93a3f Date: 2015-11-24 21:29 +0200 http://bitbucket.org/cffi/cffi/changeset/90de1ea93a3f/ Log: fix comment diff --git a/demo/gmp_build.py b/demo/gmp_build.py --- a/demo/gmp_build.py +++ b/demo/gmp_build.py @@ -2,7 +2,7 @@ # # This is only a demo based on the GMP library. -# There is a rather more complete (but outdated) version available at: +# There is a rather more complete (but perhaps outdated) version available at: # http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files # From noreply at buildbot.pypy.org Tue Nov 24 15:36:39 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 21:36:39 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: update and cleanup more demos Message-ID: <20151124203639.9C3EE1C1293@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2439:c7cec8d17b33 Date: 2015-11-24 21:50 +0200 http://bitbucket.org/cffi/cffi/changeset/c7cec8d17b33/ Log: update and cleanup more demos diff --git a/demo/gmp.py b/demo/gmp.py --- a/demo/gmp.py +++ b/demo/gmp.py @@ -1,4 +1,9 @@ import sys +# +# This is only a demo based on the GMP library. +# There is a rather more complete (but perhaps outdated) version available at: +# http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files +# # If the build script was run immediately before this script, the cffi module # ends up in the current directory. Make sure we can import it. diff --git a/demo/pwuid.py b/demo/pwuid.py --- a/demo/pwuid.py +++ b/demo/pwuid.py @@ -1,14 +1,18 @@ -from cffi import FFI -ffi = FFI() -ffi.cdef(""" // some declarations from the man page - struct passwd { - char *pw_name; - ...; - }; - struct passwd *getpwuid(int uid); -""") -C = ffi.verify(""" // passed to the real C compiler -#include -#include -""") -print ffi.string(C.getpwuid(0).pw_name) +import sys, os + +# If the build script was run immediately before this script, the cffi module +# ends up in the current directory. Make sure we can import it. +sys.path.append('.') + +try: + from _pwuid import ffi, lib +except ImportError: + print 'run pwuid_build first, then make sure the shared object is on sys.path' + sys.exit(-1) + +# ffi "knows" about the declared variables and functions from the +# cdef parts of the module xclient_build created, +# lib "knows" how to call the functions from the set_source parts +# of the module. + +print ffi.string(lib.getpwuid(0).pw_name) diff --git a/demo/pwuid_build.py b/demo/pwuid_build.py new file mode 100644 --- /dev/null +++ b/demo/pwuid_build.py @@ -0,0 +1,18 @@ +from cffi import FFI +ffi = FFI() +ffi.cdef(""" // some declarations from the man page + struct passwd { + char *pw_name; + ...; + }; + struct passwd *getpwuid(int uid); +""") + +ffi.set_source('_pwuid', """ // passed to the real C compiler +#include +#include +""") + + +if __name__ == '__main__': + ffi.compile() diff --git a/demo/readdir2.py b/demo/readdir2.py --- a/demo/readdir2.py +++ b/demo/readdir2.py @@ -1,11 +1,19 @@ -# A Linux-only demo, using verify() instead of hard-coding the exact layouts +# A Linux-only demo, using set_source() instead of hard-coding the exact layouts # import sys -from _readdir2 import ffi, lib if not sys.platform.startswith('linux'): raise Exception("Linux-only demo") +# If the build script was run immediately before this script, the cffi module +# ends up in the current directory. Make sure we can import it. +sys.path.append('.') + +try: + from _readdir2 import ffi, lib +except ImportError: + print 'run readdir2_build first, then make sure the shared object is on sys.path' + sys.exit(-1) def walk(basefd, path): print '{', path diff --git a/demo/winclipboard.py b/demo/winclipboard.py --- a/demo/winclipboard.py +++ b/demo/winclipboard.py @@ -1,60 +1,44 @@ __author__ = "Israel Fruchter " -from cffi import FFI +import sys, os -ffi = FFI() -ffi.cdef(''' - typedef void * HANDLE; - typedef HANDLE HWND; - typedef int BOOL; - typedef unsigned int UINT; - typedef int SIZE_T; - typedef char * LPTSTR; - typedef HANDLE HGLOBAL; - typedef HANDLE LPVOID; +if not sys.platform == 'win32': + raise Exception("Windows-only demo") - HWND GetConsoleWindow(void); +# If the build script was run immediately before this script, the cffi module +# ends up in the current directory. Make sure we can import it. +sys.path.append('.') - LPVOID GlobalLock( HGLOBAL hMem ); - BOOL GlobalUnlock( HGLOBAL hMem ); - HGLOBAL GlobalAlloc(UINT uFlags, SIZE_T dwBytes); +try: + from _winclipboard import ffi, lib +except ImportError: + print 'run winclipboard_build first, then make sure the shared object is on sys.path' + sys.exit(-1) - BOOL OpenClipboard(HWND hWndNewOwner); - BOOL CloseClipboard(void); - BOOL EmptyClipboard(void); - HANDLE SetClipboardData(UINT uFormat, HANDLE hMem); - - #define CF_TEXT ... - #define GMEM_MOVEABLE ... - - void * memcpy(void * s1, void * s2, int n); - ''') - -lib = ffi.verify(''' - #include -''', libraries=["user32"]) - -globals().update(lib.__dict__) +# ffi "knows" about the declared variables and functions from the +# cdef parts of the module xclient_build created, +# lib "knows" how to call the functions from the set_source parts +# of the module. def CopyToClipboard(string): ''' use win32 api to copy `string` to the clipboard ''' - hWnd = GetConsoleWindow() + hWnd = lib.GetConsoleWindow() - if OpenClipboard(hWnd): + if lib.OpenClipboard(hWnd): cstring = ffi.new("char[]", string) size = ffi.sizeof(cstring) # make it a moveable memory for other processes - hGlobal = GlobalAlloc(GMEM_MOVEABLE, size) - buffer = GlobalLock(hGlobal) + hGlobal = lib.GlobalAlloc(lib.GMEM_MOVEABLE, size) + buffer = lib.GlobalLock(hGlobal) memcpy(buffer, cstring, size) - GlobalUnlock(hGlobal) + lib.GlobalUnlock(hGlobal) - res = EmptyClipboard() - res = SetClipboardData(CF_TEXT, buffer) + res = lib.EmptyClipboard() + res = lib.SetClipboardData(lib.CF_TEXT, buffer) - CloseClipboard() + lib.CloseClipboard() CopyToClipboard("hello world from cffi") diff --git a/demo/winclipboard_build.py b/demo/winclipboard_build.py new file mode 100644 --- /dev/null +++ b/demo/winclipboard_build.py @@ -0,0 +1,36 @@ +from cffi import FFI + +ffi = FFI() +ffi.cdef(''' + typedef void * HANDLE; + typedef HANDLE HWND; + typedef int BOOL; + typedef unsigned int UINT; + typedef int SIZE_T; + typedef char * LPTSTR; + typedef HANDLE HGLOBAL; + typedef HANDLE LPVOID; + + HWND GetConsoleWindow(void); + + LPVOID GlobalLock( HGLOBAL hMem ); + BOOL GlobalUnlock( HGLOBAL hMem ); + HGLOBAL GlobalAlloc(UINT uFlags, SIZE_T dwBytes); + + BOOL OpenClipboard(HWND hWndNewOwner); + BOOL CloseClipboard(void); + BOOL EmptyClipboard(void); + HANDLE SetClipboardData(UINT uFormat, HANDLE hMem); + + #define CF_TEXT ... + #define GMEM_MOVEABLE ... + + void * memcpy(void * s1, void * s2, int n); + ''') + +ffi.set_source('_winclipboard', ''' + #include +''', libraries=["user32"]) + +if __name__ == '__main__': + ffi.compile() From noreply at buildbot.pypy.org Tue Nov 24 15:43:53 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 21:43:53 +0100 (CET) Subject: [pypy-commit] pypy default: unify datetime fromstimestamp methods Message-ID: <20151124204353.4E22C1C052B@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80910:4585e300d462 Date: 2015-11-24 15:24 -0500 http://bitbucket.org/pypy/pypy/changeset/4585e300d462/ Log: unify datetime fromstimestamp methods diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -1470,11 +1470,20 @@ A timezone info object may be passed in as well. """ + _check_tzinfo_arg(tz) + converter = _time.localtime if tz is None else _time.gmtime + self = cls._from_timestamp(converter, timestamp, tz) + if tz is not None: + self = tz.fromutc(self) + return self - _check_tzinfo_arg(tz) + @classmethod + def utcfromtimestamp(cls, t): + "Construct a UTC datetime from a POSIX timestamp (like time.time())." + return cls._from_timestamp(_time.gmtime, t, None) - converter = _time.localtime if tz is None else _time.gmtime - + @classmethod + def _from_timestamp(cls, converter, timestamp, tzinfo): if isinstance(timestamp, _numbers.Integral): us = 0 else: @@ -1492,32 +1501,7 @@ us = 0 y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp) ss = min(ss, 59) # clamp out leap seconds if the platform has them - result = cls(y, m, d, hh, mm, ss, us, tz) - if tz is not None: - result = tz.fromutc(result) - return result - - @classmethod - def utcfromtimestamp(cls, t): - "Construct a UTC datetime from a POSIX timestamp (like time.time())." - if isinstance(t, _numbers.Integral): - us = 0 - else: - t_full = t - t = int(_math.floor(t)) - frac = t_full - t - us = _round(frac * 1e6) - - # If timestamp is less than one microsecond smaller than a - # full second, us can be rounded up to 1000000. In this case, - # roll over to seconds, otherwise, ValueError is raised - # by the constructor. - if us == 1000000: - t += 1 - us = 0 - y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t) - ss = min(ss, 59) # clamp out leap seconds if the platform has them - return cls(y, m, d, hh, mm, ss, us) + return cls(y, m, d, hh, mm, ss, us, tzinfo) @classmethod def now(cls, tz=None): From noreply at buildbot.pypy.org Tue Nov 24 15:43:55 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 21:43:55 +0100 (CET) Subject: [pypy-commit] pypy default: speed up datetime fromtimestamp (this check costs time) Message-ID: <20151124204355.95E201C052B@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80911:6577bbdc8e76 Date: 2015-11-24 15:43 -0500 http://bitbucket.org/pypy/pypy/changeset/6577bbdc8e76/ Log: speed up datetime fromtimestamp (this check costs time) diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -17,7 +17,6 @@ """ from __future__ import division -import numbers as _numbers import time as _time import math as _math import struct as _struct @@ -1484,13 +1483,10 @@ @classmethod def _from_timestamp(cls, converter, timestamp, tzinfo): - if isinstance(timestamp, _numbers.Integral): - us = 0 - else: - t_full = timestamp - timestamp = int(_math.floor(timestamp)) - frac = t_full - timestamp - us = _round(frac * 1e6) + t_full = timestamp + timestamp = int(_math.floor(timestamp)) + frac = t_full - timestamp + us = _round(frac * 1e6) # If timestamp is less than one microsecond smaller than a # full second, us can be rounded up to 1000000. In this case, From noreply at buildbot.pypy.org Tue Nov 24 15:44:37 2015 From: noreply at buildbot.pypy.org (mattip) Date: Tue, 24 Nov 2015 21:44:37 +0100 (CET) Subject: [pypy-commit] cffi demo-cleanup: fix demo Message-ID: <20151124204437.7449D1C052B@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: demo-cleanup Changeset: r2440:51c5901067f0 Date: 2015-11-24 22:45 +0200 http://bitbucket.org/cffi/cffi/changeset/51c5901067f0/ Log: fix demo diff --git a/demo/winclipboard.py b/demo/winclipboard.py --- a/demo/winclipboard.py +++ b/demo/winclipboard.py @@ -33,7 +33,7 @@ # make it a moveable memory for other processes hGlobal = lib.GlobalAlloc(lib.GMEM_MOVEABLE, size) buffer = lib.GlobalLock(hGlobal) - memcpy(buffer, cstring, size) + lib.memcpy(buffer, cstring, size) lib.GlobalUnlock(hGlobal) res = lib.EmptyClipboard() From noreply at buildbot.pypy.org Tue Nov 24 15:53:18 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 21:53:18 +0100 (CET) Subject: [pypy-commit] pypy default: timedelta total_seconds use helper fn Message-ID: <20151124205318.C84961C1293@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80912:e1e1695047f4 Date: 2015-11-24 15:53 -0500 http://bitbucket.org/pypy/pypy/changeset/e1e1695047f4/ Log: timedelta total_seconds use helper fn diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -534,8 +534,7 @@ def total_seconds(self): """Total seconds in the duration.""" - return ((self.days * 86400 + self.seconds) * 10**6 + - self.microseconds) / 10**6 + return self._to_microseconds() / 10**6 # Read-only field accessors @property diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -309,6 +309,10 @@ assert td_div_int_newint == td_div_newint_newint assert td_div_newint_int == td_div_newint_newint + def test_return_types(self): + td = datetime.timedelta(5) + assert type(td.total_seconds()) is float + class TestDatetimeHost(BaseTestDatetime): def setup_class(cls): From noreply at buildbot.pypy.org Tue Nov 24 16:50:02 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 24 Nov 2015 22:50:02 +0100 (CET) Subject: [pypy-commit] pypy default: update to cffi/36f23295979c and implement ffi.init_once() Message-ID: <20151124215002.2A3D11C052B@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80913:e27e18a501ee Date: 2015-11-24 20:36 +0100 http://bitbucket.org/pypy/pypy/changeset/e27e18a501ee/ Log: update to cffi/36f23295979c and implement ffi.init_once() diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -72,6 +72,7 @@ self._cdefsources = [] self._included_ffis = [] self._windows_unicode = None + self._init_once_cache = {} if hasattr(backend, 'set_ffi'): backend.set_ffi(self) for name in backend.__dict__: @@ -598,6 +599,30 @@ return recompile(self, module_name, source, tmpdir=tmpdir, source_extension=source_extension, **kwds) + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + def _load_backend_lib(backend, name, flags): if name is None: diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -1,5 +1,6 @@ -/* See doc/misc/parse_c_type.rst in the source of CFFI for more information */ +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ typedef void *_cffi_opcode_t; diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -49,6 +49,7 @@ ACCEPT_CDATA = ACCEPT_CDATA w_gc_wref_remove = None + w_init_once_cache = None @jit.dont_look_inside def __init__(self, space, src_ctx): @@ -585,6 +586,39 @@ return w_result + def descr_init_once(self, w_func, w_tag): + """XXX document me""" + # + # atomically get or create a new dict (no GIL release) + space = self.space + w_cache = self.w_init_once_cache + if w_cache is None: + w_cache = self.w_init_once_cache = space.newdict() + # + # get the lock or result from cache[tag] + w_res = space.finditem(w_cache, w_tag) + if w_res is None: + w_res = W_InitOnceLock(space) + w_res = space.call_method(w_cache, 'setdefault', w_tag, w_res) + if not isinstance(w_res, W_InitOnceLock): + return w_res + with w_res.lock: + w_res = space.finditem(w_cache, w_tag) + if w_res is None or isinstance(w_res, W_InitOnceLock): + w_res = space.call_function(w_func) + space.setitem(w_cache, w_tag, w_res) + else: + # the real result was put in the dict while we were + # waiting for lock.__enter__() above + pass + return w_res + + +class W_InitOnceLock(W_Root): + def __init__(self, space): + self.lock = space.allocate_lock() + + @jit.dont_look_inside def make_plain_ffi_object(space, w_ffitype=None): if w_ffitype is None: @@ -641,6 +675,7 @@ from_handle = interp2app(W_FFIObject.descr_from_handle), gc = interp2app(W_FFIObject.descr_gc), getctype = interp2app(W_FFIObject.descr_getctype), + init_once = interp2app(W_FFIObject.descr_init_once), integer_const = interp2app(W_FFIObject.descr_integer_const), memmove = interp2app(W_FFIObject.descr_memmove), new = interp2app(W_FFIObject.descr_new), diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -447,3 +447,19 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + + def test_init_once(self): + import _cffi_backend as _cffi1_backend + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1810,3 +1810,35 @@ assert lib.EE1 == 0 assert lib.EE2 == 0 assert lib.EE3 == 1 + + def test_init_once(self): + def do_init(): + seen.append(1) + return 42 + ffi = FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + + def test_init_once_multithread(self): + import thread, time + def do_init(): + seen.append('init!') + time.sleep(1) + seen.append('init done') + return 7 + ffi = FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py @@ -487,7 +487,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -194,6 +194,11 @@ yp = ffi.new_handle([6, 4, 2]) assert ffi.from_handle(yp) == [6, 4, 2] +def test_handle_unique(): + ffi = _cffi1_backend.FFI() + assert ffi.new_handle(None) is not ffi.new_handle(None) + assert ffi.new_handle(None) != ffi.new_handle(None) + def test_ffi_cast(): ffi = _cffi1_backend.FFI() assert ffi.cast("int(*)(int)", 0) == ffi.NULL @@ -416,3 +421,37 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + +def test_init_once(): + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + +def test_init_once_multithread(): + import thread, time + def do_init(): + print 'init!' + seen.append('init!') + time.sleep(1) + seen.append('init done') + print 'init done' + return 7 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] From noreply at buildbot.pypy.org Tue Nov 24 16:50:04 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 24 Nov 2015 22:50:04 +0100 (CET) Subject: [pypy-commit] pypy default: A fast-path for the JIT: in the common case, ffi.init_once() is known Message-ID: <20151124215004.727961C052B@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80914:9bbd8daa83aa Date: 2015-11-24 22:00 +0100 http://bitbucket.org/pypy/pypy/changeset/9bbd8daa83aa/ Log: A fast-path for the JIT: in the common case, ffi.init_once() is known during tracing to have been done already, and turns into no code at all diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -50,6 +50,7 @@ w_gc_wref_remove = None w_init_once_cache = None + jit_init_once_cache = None @jit.dont_look_inside def __init__(self, space, src_ctx): @@ -589,11 +590,30 @@ def descr_init_once(self, w_func, w_tag): """XXX document me""" # - # atomically get or create a new dict (no GIL release) + # first, a fast-path for the JIT which only works if the very + # same w_tag object is passed; then it turns into no code at all + try: + return self._init_once_elidable(w_tag) + except KeyError: + return self._init_once_slowpath(w_func, w_tag) + + @jit.elidable + def _init_once_elidable(self, w_tag): + jit_cache = self.jit_init_once_cache + if jit_cache is not None: + return jit_cache[w_tag] + else: + raise KeyError + + @jit.dont_look_inside + def _init_once_slowpath(self, w_func, w_tag): space = self.space w_cache = self.w_init_once_cache if w_cache is None: - w_cache = self.w_init_once_cache = space.newdict() + w_cache = self.space.newdict() + jit_cache = {} + self.w_init_once_cache = w_cache + self.jit_init_once_cache = jit_cache # # get the lock or result from cache[tag] w_res = space.finditem(w_cache, w_tag) @@ -606,6 +626,7 @@ w_res = space.finditem(w_cache, w_tag) if w_res is None or isinstance(w_res, W_InitOnceLock): w_res = space.call_function(w_func) + self.jit_init_once_cache[w_tag] = w_res space.setitem(w_cache, w_tag, w_res) else: # the real result was put in the dict while we were From noreply at buildbot.pypy.org Tue Nov 24 16:50:06 2015 From: noreply at buildbot.pypy.org (arigo) Date: Tue, 24 Nov 2015 22:50:06 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151124215006.7BF651C052B@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: Changeset: r80915:30a4accaa4d9 Date: 2015-11-24 22:49 +0100 http://bitbucket.org/pypy/pypy/changeset/30a4accaa4d9/ Log: merge heads diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -17,11 +17,12 @@ """ from __future__ import division -import numbers as _numbers import time as _time import math as _math import struct as _struct +_SENTINEL = object() + def _cmp(x, y): return 0 if x == y else 1 if x > y else -1 @@ -32,6 +33,8 @@ MAXYEAR = 9999 _MINYEARFMT = 1900 +_MAX_DELTA_DAYS = 999999999 + # Utility functions, adapted from Python's Demo/classes/Dates.py, which # also assumes the current Gregorian calendar indefinitely extended in # both directions. Difference: Dates.py calls January 1 of year 0 day @@ -96,6 +99,15 @@ # pasting together 25 4-year cycles. assert _DI100Y == 25 * _DI4Y - 1 +_US_PER_US = 1 +_US_PER_MS = 1000 +_US_PER_SECOND = 1000000 +_US_PER_MINUTE = 60000000 +_SECONDS_PER_DAY = 24 * 3600 +_US_PER_HOUR = 3600000000 +_US_PER_DAY = 86400000000 +_US_PER_WEEK = 604800000000 + def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." @@ -417,6 +429,24 @@ self.hour, self.minute, self.second = hour, minute, second self.microsecond = microsecond +def _accum(tag, sofar, num, factor, leftover): + if isinstance(num, (int, long)): + prod = num * factor + rsum = sofar + prod + return rsum, leftover + if isinstance(num, float): + fracpart, intpart = _math.modf(num) + prod = int(intpart) * factor + rsum = sofar + prod + if fracpart == 0.0: + return rsum, leftover + assert isinstance(factor, (int, long)) + fracpart, intpart = _math.modf(factor * fracpart) + rsum += int(intpart) + return rsum, leftover + fracpart + raise TypeError("unsupported type for timedelta %s component: %s" % + (tag, type(num))) + class timedelta(object): """Represent the difference between two datetime objects. @@ -436,100 +466,35 @@ """ __slots__ = '_days', '_seconds', '_microseconds', '_hashcode' - def __new__(cls, days=0, seconds=0, microseconds=0, - milliseconds=0, minutes=0, hours=0, weeks=0): - # Doing this efficiently and accurately in C is going to be difficult - # and error-prone, due to ubiquitous overflow possibilities, and that - # C double doesn't have enough bits of precision to represent - # microseconds over 10K years faithfully. The code here tries to make - # explicit where go-fast assumptions can be relied on, in order to - # guide the C implementation; it's way more convoluted than speed- - # ignoring auto-overflow-to-long idiomatic Python could be. + def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL, + milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL): + x = 0 + leftover = 0.0 + if microseconds is not _SENTINEL: + x, leftover = _accum("microseconds", x, microseconds, _US_PER_US, leftover) + if milliseconds is not _SENTINEL: + x, leftover = _accum("milliseconds", x, milliseconds, _US_PER_MS, leftover) + if seconds is not _SENTINEL: + x, leftover = _accum("seconds", x, seconds, _US_PER_SECOND, leftover) + if minutes is not _SENTINEL: + x, leftover = _accum("minutes", x, minutes, _US_PER_MINUTE, leftover) + if hours is not _SENTINEL: + x, leftover = _accum("hours", x, hours, _US_PER_HOUR, leftover) + if days is not _SENTINEL: + x, leftover = _accum("days", x, days, _US_PER_DAY, leftover) + if weeks is not _SENTINEL: + x, leftover = _accum("weeks", x, weeks, _US_PER_WEEK, leftover) + if leftover != 0.0: + x += _round(leftover) + return cls._from_microseconds(x) - # XXX Check that all inputs are ints, longs or floats. + @classmethod + def _from_microseconds(cls, us): + s, us = divmod(us, _US_PER_SECOND) + d, s = divmod(s, _SECONDS_PER_DAY) - # Final values, all integer. - # s and us fit in 32-bit signed ints; d isn't bounded. - d = s = us = 0 - - # Normalize everything to days, seconds, microseconds. - days += weeks*7 - seconds += minutes*60 + hours*3600 - microseconds += milliseconds*1000 - - # Get rid of all fractions, and normalize s and us. - # Take a deep breath . - if isinstance(days, float): - dayfrac, days = _math.modf(days) - daysecondsfrac, daysecondswhole = _math.modf(dayfrac * (24.*3600.)) - assert daysecondswhole == int(daysecondswhole) # can't overflow - s = int(daysecondswhole) - assert days == int(days) - d = int(days) - else: - daysecondsfrac = 0.0 - d = days - assert isinstance(daysecondsfrac, float) - assert abs(daysecondsfrac) <= 1.0 - assert isinstance(d, _numbers.Integral) - assert abs(s) <= 24 * 3600 - # days isn't referenced again before redefinition - - if isinstance(seconds, float): - secondsfrac, seconds = _math.modf(seconds) - assert seconds == int(seconds) - seconds = int(seconds) - secondsfrac += daysecondsfrac - assert abs(secondsfrac) <= 2.0 - else: - secondsfrac = daysecondsfrac - # daysecondsfrac isn't referenced again - assert isinstance(secondsfrac, float) - assert abs(secondsfrac) <= 2.0 - - assert isinstance(seconds, _numbers.Integral) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) # can't overflow - assert isinstance(s, _numbers.Integral) - assert abs(s) <= 2 * 24 * 3600 - # seconds isn't referenced again before redefinition - - usdouble = secondsfrac * 1e6 - assert abs(usdouble) < 2.1e6 # exact value not critical - # secondsfrac isn't referenced again - - if isinstance(microseconds, float): - microseconds = _round(microseconds + usdouble) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = int(microseconds) - else: - microseconds = int(microseconds) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = _round(microseconds + usdouble) - assert isinstance(s, _numbers.Integral) - assert isinstance(microseconds, _numbers.Integral) - assert abs(s) <= 3 * 24 * 3600 - assert abs(microseconds) < 3.1e6 - - # Just a little bit of carrying possible for microseconds and seconds. - seconds, us = divmod(microseconds, 1000000) - s += seconds - days, s = divmod(s, 24*3600) - d += days - - assert isinstance(d, _numbers.Integral) - assert isinstance(s, _numbers.Integral) and 0 <= s < 24*3600 - assert isinstance(us, _numbers.Integral) and 0 <= us < 1000000 - - if abs(d) > 999999999: - raise OverflowError("timedelta # of days is too large: %d" % d) + if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS: + raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS)) self = object.__new__(cls) self._days = d @@ -538,6 +503,10 @@ self._hashcode = -1 return self + def _to_microseconds(self): + return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND + + self._microseconds) + def __repr__(self): module = "datetime." if self.__class__ is timedelta else "" if self._microseconds: @@ -565,8 +534,7 @@ def total_seconds(self): """Total seconds in the duration.""" - return ((self.days * 86400 + self.seconds) * 10**6 + - self.microseconds) / 10**6 + return self._to_microseconds() / 10**6 # Read-only field accessors @property @@ -626,25 +594,18 @@ return self def __mul__(self, other): - if isinstance(other, (int, long)): - # for CPython compatibility, we cannot use - # our __class__ here, but need a real timedelta - return timedelta(self._days * other, - self._seconds * other, - self._microseconds * other) - return NotImplemented + if not isinstance(other, (int, long)): + return NotImplemented + usec = self._to_microseconds() + return timedelta._from_microseconds(usec * other) __rmul__ = __mul__ - def _to_microseconds(self): - return ((self._days * (24*3600) + self._seconds) * 1000000 + - self._microseconds) - def __div__(self, other): if not isinstance(other, (int, long)): return NotImplemented usec = self._to_microseconds() - return timedelta(0, 0, usec // other) + return timedelta._from_microseconds(usec // other) __floordiv__ = __div__ @@ -708,9 +669,8 @@ def __reduce__(self): return (self.__class__, self._getstate()) -timedelta.min = timedelta(-999999999) -timedelta.max = timedelta(days=999999999, hours=23, minutes=59, seconds=59, - microseconds=999999) +timedelta.min = timedelta(-_MAX_DELTA_DAYS) +timedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1) timedelta.resolution = timedelta(microseconds=1) class date(object): @@ -1508,18 +1468,24 @@ A timezone info object may be passed in as well. """ + _check_tzinfo_arg(tz) + converter = _time.localtime if tz is None else _time.gmtime + self = cls._from_timestamp(converter, timestamp, tz) + if tz is not None: + self = tz.fromutc(self) + return self - _check_tzinfo_arg(tz) + @classmethod + def utcfromtimestamp(cls, t): + "Construct a UTC datetime from a POSIX timestamp (like time.time())." + return cls._from_timestamp(_time.gmtime, t, None) - converter = _time.localtime if tz is None else _time.gmtime - - if isinstance(timestamp, _numbers.Integral): - us = 0 - else: - t_full = timestamp - timestamp = int(_math.floor(timestamp)) - frac = t_full - timestamp - us = _round(frac * 1e6) + @classmethod + def _from_timestamp(cls, converter, timestamp, tzinfo): + t_full = timestamp + timestamp = int(_math.floor(timestamp)) + frac = t_full - timestamp + us = _round(frac * 1e6) # If timestamp is less than one microsecond smaller than a # full second, us can be rounded up to 1000000. In this case, @@ -1530,32 +1496,7 @@ us = 0 y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp) ss = min(ss, 59) # clamp out leap seconds if the platform has them - result = cls(y, m, d, hh, mm, ss, us, tz) - if tz is not None: - result = tz.fromutc(result) - return result - - @classmethod - def utcfromtimestamp(cls, t): - "Construct a UTC datetime from a POSIX timestamp (like time.time())." - if isinstance(t, _numbers.Integral): - us = 0 - else: - t_full = t - t = int(_math.floor(t)) - frac = t_full - t - us = _round(frac * 1e6) - - # If timestamp is less than one microsecond smaller than a - # full second, us can be rounded up to 1000000. In this case, - # roll over to seconds, otherwise, ValueError is raised - # by the constructor. - if us == 1000000: - t += 1 - us = 0 - y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t) - ss = min(ss, 59) # clamp out leap seconds if the platform has them - return cls(y, m, d, hh, mm, ss, us) + return cls(y, m, d, hh, mm, ss, us, tzinfo) @classmethod def now(cls, tz=None): diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -309,6 +309,10 @@ assert td_div_int_newint == td_div_newint_newint assert td_div_newint_int == td_div_newint_newint + def test_return_types(self): + td = datetime.timedelta(5) + assert type(td.total_seconds()) is float + class TestDatetimeHost(BaseTestDatetime): def setup_class(cls): From noreply at buildbot.pypy.org Tue Nov 24 17:30:26 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 23:30:26 +0100 (CET) Subject: [pypy-commit] pypy default: more optimizations for timedelta Message-ID: <20151124223026.6251D1C11B3@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80916:3944e79025c8 Date: 2015-11-24 16:36 -0500 http://bitbucket.org/pypy/pypy/changeset/3944e79025c8/ Log: more optimizations for timedelta diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -447,6 +447,12 @@ raise TypeError("unsupported type for timedelta %s component: %s" % (tag, type(num))) +def _normalize_pair(hi, lo, factor): + if lo < 0 or lo >= factor: + inc, lo = divmod(lo, factor) + hi += inc + return hi, lo + class timedelta(object): """Represent the difference between two datetime objects. @@ -492,6 +498,13 @@ def _from_microseconds(cls, us): s, us = divmod(us, _US_PER_SECOND) d, s = divmod(s, _SECONDS_PER_DAY) + return cls._create(d, s, us, False) + + @classmethod + def _create(cls, d, s, us, normalize): + if normalize: + s, us = _normalize_pair(s, us, 1000000) + d, s = _normalize_pair(d, s, 24*3600) if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS: raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS)) @@ -556,9 +569,10 @@ if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days + other._days, - self._seconds + other._seconds, - self._microseconds + other._microseconds) + return timedelta._create(self._days + other._days, + self._seconds + other._seconds, + self._microseconds + other._microseconds, + True) return NotImplemented __radd__ = __add__ @@ -567,9 +581,10 @@ if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days - other._days, - self._seconds - other._seconds, - self._microseconds - other._microseconds) + return timedelta._create(self._days - other._days, + self._seconds - other._seconds, + self._microseconds - other._microseconds, + True) return NotImplemented def __rsub__(self, other): @@ -580,12 +595,18 @@ def __neg__(self): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(-self._days, - -self._seconds, - -self._microseconds) + return timedelta._create(-self._days, + -self._seconds, + -self._microseconds, + True) def __pos__(self): - return self + # for CPython compatibility, we cannot use + # our __class__ here, but need a real timedelta + return timedelta._create(self._days, + self._seconds, + self._microseconds, + False) def __abs__(self): if self._days < 0: @@ -932,11 +953,11 @@ def __sub__(self, other): """Subtract two dates, or a date and a timedelta.""" if isinstance(other, timedelta): - return self + timedelta(-other.days) + return self + timedelta._create(-other.days, 0, 0, False) if isinstance(other, date): days1 = self.toordinal() days2 = other.toordinal() - return timedelta(days1 - days2) + return timedelta._create(days1 - days2, 0, 0, False) return NotImplemented def weekday(self): @@ -1303,7 +1324,7 @@ offset = self._tzinfo.utcoffset(None) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1341,7 +1362,7 @@ offset = self._tzinfo.dst(None) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1674,7 +1695,7 @@ offset = self._tzinfo.utcoffset(self) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1712,7 +1733,7 @@ offset = self._tzinfo.dst(self) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1829,13 +1850,12 @@ return self + -other return NotImplemented - days1 = self.toordinal() - days2 = other.toordinal() - secs1 = self._second + self._minute * 60 + self._hour * 3600 - secs2 = other._second + other._minute * 60 + other._hour * 3600 - base = timedelta(days1 - days2, - secs1 - secs2, - self._microsecond - other._microsecond) + delta_d = self.toordinal() - other.toordinal() + delta_s = (self._hour - other._hour) * 3600 + \ + (self._minute - other._minute) * 60 + \ + (self._second - other._second) + delta_us = self._microsecond - other._microsecond + base = timedelta._create(delta_d, delta_s, delta_us, True) if self._tzinfo is other._tzinfo: return base myoff = self._utcoffset() diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -312,6 +312,8 @@ def test_return_types(self): td = datetime.timedelta(5) assert type(td.total_seconds()) is float + class sub(datetime.timedelta): pass + assert type(+sub()) is datetime.timedelta class TestDatetimeHost(BaseTestDatetime): From noreply at buildbot.pypy.org Tue Nov 24 17:30:28 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Tue, 24 Nov 2015 23:30:28 +0100 (CET) Subject: [pypy-commit] pypy default: merge heads Message-ID: <20151124223028.8A2CE1C11B3@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80917:37057ce12bc9 Date: 2015-11-24 17:30 -0500 http://bitbucket.org/pypy/pypy/changeset/37057ce12bc9/ Log: merge heads diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -72,6 +72,7 @@ self._cdefsources = [] self._included_ffis = [] self._windows_unicode = None + self._init_once_cache = {} if hasattr(backend, 'set_ffi'): backend.set_ffi(self) for name in backend.__dict__: @@ -598,6 +599,30 @@ return recompile(self, module_name, source, tmpdir=tmpdir, source_extension=source_extension, **kwds) + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + def _load_backend_lib(backend, name, flags): if name is None: diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -1,5 +1,6 @@ -/* See doc/misc/parse_c_type.rst in the source of CFFI for more information */ +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ typedef void *_cffi_opcode_t; diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -49,6 +49,8 @@ ACCEPT_CDATA = ACCEPT_CDATA w_gc_wref_remove = None + w_init_once_cache = None + jit_init_once_cache = None @jit.dont_look_inside def __init__(self, space, src_ctx): @@ -585,6 +587,59 @@ return w_result + def descr_init_once(self, w_func, w_tag): + """XXX document me""" + # + # first, a fast-path for the JIT which only works if the very + # same w_tag object is passed; then it turns into no code at all + try: + return self._init_once_elidable(w_tag) + except KeyError: + return self._init_once_slowpath(w_func, w_tag) + + @jit.elidable + def _init_once_elidable(self, w_tag): + jit_cache = self.jit_init_once_cache + if jit_cache is not None: + return jit_cache[w_tag] + else: + raise KeyError + + @jit.dont_look_inside + def _init_once_slowpath(self, w_func, w_tag): + space = self.space + w_cache = self.w_init_once_cache + if w_cache is None: + w_cache = self.space.newdict() + jit_cache = {} + self.w_init_once_cache = w_cache + self.jit_init_once_cache = jit_cache + # + # get the lock or result from cache[tag] + w_res = space.finditem(w_cache, w_tag) + if w_res is None: + w_res = W_InitOnceLock(space) + w_res = space.call_method(w_cache, 'setdefault', w_tag, w_res) + if not isinstance(w_res, W_InitOnceLock): + return w_res + with w_res.lock: + w_res = space.finditem(w_cache, w_tag) + if w_res is None or isinstance(w_res, W_InitOnceLock): + w_res = space.call_function(w_func) + self.jit_init_once_cache[w_tag] = w_res + space.setitem(w_cache, w_tag, w_res) + else: + # the real result was put in the dict while we were + # waiting for lock.__enter__() above + pass + return w_res + + +class W_InitOnceLock(W_Root): + def __init__(self, space): + self.lock = space.allocate_lock() + + @jit.dont_look_inside def make_plain_ffi_object(space, w_ffitype=None): if w_ffitype is None: @@ -641,6 +696,7 @@ from_handle = interp2app(W_FFIObject.descr_from_handle), gc = interp2app(W_FFIObject.descr_gc), getctype = interp2app(W_FFIObject.descr_getctype), + init_once = interp2app(W_FFIObject.descr_init_once), integer_const = interp2app(W_FFIObject.descr_integer_const), memmove = interp2app(W_FFIObject.descr_memmove), new = interp2app(W_FFIObject.descr_new), diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -447,3 +447,19 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + + def test_init_once(self): + import _cffi_backend as _cffi1_backend + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1810,3 +1810,35 @@ assert lib.EE1 == 0 assert lib.EE2 == 0 assert lib.EE3 == 1 + + def test_init_once(self): + def do_init(): + seen.append(1) + return 42 + ffi = FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + + def test_init_once_multithread(self): + import thread, time + def do_init(): + seen.append('init!') + time.sleep(1) + seen.append('init done') + return 7 + ffi = FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py @@ -487,7 +487,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -194,6 +194,11 @@ yp = ffi.new_handle([6, 4, 2]) assert ffi.from_handle(yp) == [6, 4, 2] +def test_handle_unique(): + ffi = _cffi1_backend.FFI() + assert ffi.new_handle(None) is not ffi.new_handle(None) + assert ffi.new_handle(None) != ffi.new_handle(None) + def test_ffi_cast(): ffi = _cffi1_backend.FFI() assert ffi.cast("int(*)(int)", 0) == ffi.NULL @@ -416,3 +421,37 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + +def test_init_once(): + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + +def test_init_once_multithread(): + import thread, time + def do_init(): + print 'init!' + seen.append('init!') + time.sleep(1) + seen.append('init done') + print 'init done' + return 7 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] From noreply at buildbot.pypy.org Tue Nov 24 18:55:18 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 00:55:18 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: re-enable cpyext and micronumpy. The failure due to micronumpy seems to be random Message-ID: <20151124235518.937511C203A@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80918:7f3a328c275d Date: 2015-11-25 00:55 +0100 http://bitbucket.org/pypy/pypy/changeset/7f3a328c275d/ Log: re-enable cpyext and micronumpy. The failure due to micronumpy seems to be random diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -39,9 +39,6 @@ "_csv", "cppyy", "_pypyjson" ]) -working_modules.remove('micronumpy') # XXX temporary -working_modules.remove('cpyext') - if ((sys.platform.startswith('linux') or sys.platform == 'darwin') and os.uname()[4] == 'x86_64' and sys.maxint > 2**32): # it's not enough that we get x86_64 @@ -335,8 +332,6 @@ def enable_allworkingmodules(config): - config.objspace.usemodules.cpyext = False # XXX - modules = working_modules.copy() if config.translation.sandbox: modules = default_modules @@ -346,7 +341,6 @@ config.objspace.usemodules.suggest(**dict.fromkeys(modules, True)) - def enable_translationmodules(config): modules = translation_modules modules = [name for name in modules if name not in essential_modules] From noreply at buildbot.pypy.org Tue Nov 24 18:57:01 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 00:57:01 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: hg merge default Message-ID: <20151124235701.6ACBD1C20C0@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80919:246229cd7f49 Date: 2015-11-25 00:57 +0100 http://bitbucket.org/pypy/pypy/changeset/246229cd7f49/ Log: hg merge default diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -72,6 +72,7 @@ self._cdefsources = [] self._included_ffis = [] self._windows_unicode = None + self._init_once_cache = {} if hasattr(backend, 'set_ffi'): backend.set_ffi(self) for name in backend.__dict__: @@ -598,6 +599,30 @@ return recompile(self, module_name, source, tmpdir=tmpdir, source_extension=source_extension, **kwds) + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + def _load_backend_lib(backend, name, flags): if name is None: diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -1,5 +1,6 @@ -/* See doc/misc/parse_c_type.rst in the source of CFFI for more information */ +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ typedef void *_cffi_opcode_t; diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -17,11 +17,12 @@ """ from __future__ import division -import numbers as _numbers import time as _time import math as _math import struct as _struct +_SENTINEL = object() + def _cmp(x, y): return 0 if x == y else 1 if x > y else -1 @@ -32,6 +33,8 @@ MAXYEAR = 9999 _MINYEARFMT = 1900 +_MAX_DELTA_DAYS = 999999999 + # Utility functions, adapted from Python's Demo/classes/Dates.py, which # also assumes the current Gregorian calendar indefinitely extended in # both directions. Difference: Dates.py calls January 1 of year 0 day @@ -96,6 +99,15 @@ # pasting together 25 4-year cycles. assert _DI100Y == 25 * _DI4Y - 1 +_US_PER_US = 1 +_US_PER_MS = 1000 +_US_PER_SECOND = 1000000 +_US_PER_MINUTE = 60000000 +_SECONDS_PER_DAY = 24 * 3600 +_US_PER_HOUR = 3600000000 +_US_PER_DAY = 86400000000 +_US_PER_WEEK = 604800000000 + def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." @@ -417,6 +429,30 @@ self.hour, self.minute, self.second = hour, minute, second self.microsecond = microsecond +def _accum(tag, sofar, num, factor, leftover): + if isinstance(num, (int, long)): + prod = num * factor + rsum = sofar + prod + return rsum, leftover + if isinstance(num, float): + fracpart, intpart = _math.modf(num) + prod = int(intpart) * factor + rsum = sofar + prod + if fracpart == 0.0: + return rsum, leftover + assert isinstance(factor, (int, long)) + fracpart, intpart = _math.modf(factor * fracpart) + rsum += int(intpart) + return rsum, leftover + fracpart + raise TypeError("unsupported type for timedelta %s component: %s" % + (tag, type(num))) + +def _normalize_pair(hi, lo, factor): + if lo < 0 or lo >= factor: + inc, lo = divmod(lo, factor) + hi += inc + return hi, lo + class timedelta(object): """Represent the difference between two datetime objects. @@ -436,100 +472,42 @@ """ __slots__ = '_days', '_seconds', '_microseconds', '_hashcode' - def __new__(cls, days=0, seconds=0, microseconds=0, - milliseconds=0, minutes=0, hours=0, weeks=0): - # Doing this efficiently and accurately in C is going to be difficult - # and error-prone, due to ubiquitous overflow possibilities, and that - # C double doesn't have enough bits of precision to represent - # microseconds over 10K years faithfully. The code here tries to make - # explicit where go-fast assumptions can be relied on, in order to - # guide the C implementation; it's way more convoluted than speed- - # ignoring auto-overflow-to-long idiomatic Python could be. + def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL, + milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL): + x = 0 + leftover = 0.0 + if microseconds is not _SENTINEL: + x, leftover = _accum("microseconds", x, microseconds, _US_PER_US, leftover) + if milliseconds is not _SENTINEL: + x, leftover = _accum("milliseconds", x, milliseconds, _US_PER_MS, leftover) + if seconds is not _SENTINEL: + x, leftover = _accum("seconds", x, seconds, _US_PER_SECOND, leftover) + if minutes is not _SENTINEL: + x, leftover = _accum("minutes", x, minutes, _US_PER_MINUTE, leftover) + if hours is not _SENTINEL: + x, leftover = _accum("hours", x, hours, _US_PER_HOUR, leftover) + if days is not _SENTINEL: + x, leftover = _accum("days", x, days, _US_PER_DAY, leftover) + if weeks is not _SENTINEL: + x, leftover = _accum("weeks", x, weeks, _US_PER_WEEK, leftover) + if leftover != 0.0: + x += _round(leftover) + return cls._from_microseconds(x) - # XXX Check that all inputs are ints, longs or floats. + @classmethod + def _from_microseconds(cls, us): + s, us = divmod(us, _US_PER_SECOND) + d, s = divmod(s, _SECONDS_PER_DAY) + return cls._create(d, s, us, False) - # Final values, all integer. - # s and us fit in 32-bit signed ints; d isn't bounded. - d = s = us = 0 + @classmethod + def _create(cls, d, s, us, normalize): + if normalize: + s, us = _normalize_pair(s, us, 1000000) + d, s = _normalize_pair(d, s, 24*3600) - # Normalize everything to days, seconds, microseconds. - days += weeks*7 - seconds += minutes*60 + hours*3600 - microseconds += milliseconds*1000 - - # Get rid of all fractions, and normalize s and us. - # Take a deep breath . - if isinstance(days, float): - dayfrac, days = _math.modf(days) - daysecondsfrac, daysecondswhole = _math.modf(dayfrac * (24.*3600.)) - assert daysecondswhole == int(daysecondswhole) # can't overflow - s = int(daysecondswhole) - assert days == int(days) - d = int(days) - else: - daysecondsfrac = 0.0 - d = days - assert isinstance(daysecondsfrac, float) - assert abs(daysecondsfrac) <= 1.0 - assert isinstance(d, _numbers.Integral) - assert abs(s) <= 24 * 3600 - # days isn't referenced again before redefinition - - if isinstance(seconds, float): - secondsfrac, seconds = _math.modf(seconds) - assert seconds == int(seconds) - seconds = int(seconds) - secondsfrac += daysecondsfrac - assert abs(secondsfrac) <= 2.0 - else: - secondsfrac = daysecondsfrac - # daysecondsfrac isn't referenced again - assert isinstance(secondsfrac, float) - assert abs(secondsfrac) <= 2.0 - - assert isinstance(seconds, _numbers.Integral) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) # can't overflow - assert isinstance(s, _numbers.Integral) - assert abs(s) <= 2 * 24 * 3600 - # seconds isn't referenced again before redefinition - - usdouble = secondsfrac * 1e6 - assert abs(usdouble) < 2.1e6 # exact value not critical - # secondsfrac isn't referenced again - - if isinstance(microseconds, float): - microseconds = _round(microseconds + usdouble) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = int(microseconds) - else: - microseconds = int(microseconds) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = _round(microseconds + usdouble) - assert isinstance(s, _numbers.Integral) - assert isinstance(microseconds, _numbers.Integral) - assert abs(s) <= 3 * 24 * 3600 - assert abs(microseconds) < 3.1e6 - - # Just a little bit of carrying possible for microseconds and seconds. - seconds, us = divmod(microseconds, 1000000) - s += seconds - days, s = divmod(s, 24*3600) - d += days - - assert isinstance(d, _numbers.Integral) - assert isinstance(s, _numbers.Integral) and 0 <= s < 24*3600 - assert isinstance(us, _numbers.Integral) and 0 <= us < 1000000 - - if abs(d) > 999999999: - raise OverflowError("timedelta # of days is too large: %d" % d) + if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS: + raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS)) self = object.__new__(cls) self._days = d @@ -538,6 +516,10 @@ self._hashcode = -1 return self + def _to_microseconds(self): + return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND + + self._microseconds) + def __repr__(self): module = "datetime." if self.__class__ is timedelta else "" if self._microseconds: @@ -565,8 +547,7 @@ def total_seconds(self): """Total seconds in the duration.""" - return ((self.days * 86400 + self.seconds) * 10**6 + - self.microseconds) / 10**6 + return self._to_microseconds() / 10**6 # Read-only field accessors @property @@ -588,9 +569,10 @@ if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days + other._days, - self._seconds + other._seconds, - self._microseconds + other._microseconds) + return timedelta._create(self._days + other._days, + self._seconds + other._seconds, + self._microseconds + other._microseconds, + True) return NotImplemented __radd__ = __add__ @@ -599,9 +581,10 @@ if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days - other._days, - self._seconds - other._seconds, - self._microseconds - other._microseconds) + return timedelta._create(self._days - other._days, + self._seconds - other._seconds, + self._microseconds - other._microseconds, + True) return NotImplemented def __rsub__(self, other): @@ -612,12 +595,18 @@ def __neg__(self): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(-self._days, - -self._seconds, - -self._microseconds) + return timedelta._create(-self._days, + -self._seconds, + -self._microseconds, + True) def __pos__(self): - return self + # for CPython compatibility, we cannot use + # our __class__ here, but need a real timedelta + return timedelta._create(self._days, + self._seconds, + self._microseconds, + False) def __abs__(self): if self._days < 0: @@ -626,25 +615,18 @@ return self def __mul__(self, other): - if isinstance(other, (int, long)): - # for CPython compatibility, we cannot use - # our __class__ here, but need a real timedelta - return timedelta(self._days * other, - self._seconds * other, - self._microseconds * other) - return NotImplemented + if not isinstance(other, (int, long)): + return NotImplemented + usec = self._to_microseconds() + return timedelta._from_microseconds(usec * other) __rmul__ = __mul__ - def _to_microseconds(self): - return ((self._days * (24*3600) + self._seconds) * 1000000 + - self._microseconds) - def __div__(self, other): if not isinstance(other, (int, long)): return NotImplemented usec = self._to_microseconds() - return timedelta(0, 0, usec // other) + return timedelta._from_microseconds(usec // other) __floordiv__ = __div__ @@ -708,9 +690,8 @@ def __reduce__(self): return (self.__class__, self._getstate()) -timedelta.min = timedelta(-999999999) -timedelta.max = timedelta(days=999999999, hours=23, minutes=59, seconds=59, - microseconds=999999) +timedelta.min = timedelta(-_MAX_DELTA_DAYS) +timedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1) timedelta.resolution = timedelta(microseconds=1) class date(object): @@ -972,11 +953,11 @@ def __sub__(self, other): """Subtract two dates, or a date and a timedelta.""" if isinstance(other, timedelta): - return self + timedelta(-other.days) + return self + timedelta._create(-other.days, 0, 0, False) if isinstance(other, date): days1 = self.toordinal() days2 = other.toordinal() - return timedelta(days1 - days2) + return timedelta._create(days1 - days2, 0, 0, False) return NotImplemented def weekday(self): @@ -1343,7 +1324,7 @@ offset = self._tzinfo.utcoffset(None) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1381,7 +1362,7 @@ offset = self._tzinfo.dst(None) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1508,18 +1489,24 @@ A timezone info object may be passed in as well. """ + _check_tzinfo_arg(tz) + converter = _time.localtime if tz is None else _time.gmtime + self = cls._from_timestamp(converter, timestamp, tz) + if tz is not None: + self = tz.fromutc(self) + return self - _check_tzinfo_arg(tz) + @classmethod + def utcfromtimestamp(cls, t): + "Construct a UTC datetime from a POSIX timestamp (like time.time())." + return cls._from_timestamp(_time.gmtime, t, None) - converter = _time.localtime if tz is None else _time.gmtime - - if isinstance(timestamp, _numbers.Integral): - us = 0 - else: - t_full = timestamp - timestamp = int(_math.floor(timestamp)) - frac = t_full - timestamp - us = _round(frac * 1e6) + @classmethod + def _from_timestamp(cls, converter, timestamp, tzinfo): + t_full = timestamp + timestamp = int(_math.floor(timestamp)) + frac = t_full - timestamp + us = _round(frac * 1e6) # If timestamp is less than one microsecond smaller than a # full second, us can be rounded up to 1000000. In this case, @@ -1530,32 +1517,7 @@ us = 0 y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp) ss = min(ss, 59) # clamp out leap seconds if the platform has them - result = cls(y, m, d, hh, mm, ss, us, tz) - if tz is not None: - result = tz.fromutc(result) - return result - - @classmethod - def utcfromtimestamp(cls, t): - "Construct a UTC datetime from a POSIX timestamp (like time.time())." - if isinstance(t, _numbers.Integral): - us = 0 - else: - t_full = t - t = int(_math.floor(t)) - frac = t_full - t - us = _round(frac * 1e6) - - # If timestamp is less than one microsecond smaller than a - # full second, us can be rounded up to 1000000. In this case, - # roll over to seconds, otherwise, ValueError is raised - # by the constructor. - if us == 1000000: - t += 1 - us = 0 - y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t) - ss = min(ss, 59) # clamp out leap seconds if the platform has them - return cls(y, m, d, hh, mm, ss, us) + return cls(y, m, d, hh, mm, ss, us, tzinfo) @classmethod def now(cls, tz=None): @@ -1733,7 +1695,7 @@ offset = self._tzinfo.utcoffset(self) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1771,7 +1733,7 @@ offset = self._tzinfo.dst(self) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1888,13 +1850,12 @@ return self + -other return NotImplemented - days1 = self.toordinal() - days2 = other.toordinal() - secs1 = self._second + self._minute * 60 + self._hour * 3600 - secs2 = other._second + other._minute * 60 + other._hour * 3600 - base = timedelta(days1 - days2, - secs1 - secs2, - self._microsecond - other._microsecond) + delta_d = self.toordinal() - other.toordinal() + delta_s = (self._hour - other._hour) * 3600 + \ + (self._minute - other._minute) * 60 + \ + (self._second - other._second) + delta_us = self._microsecond - other._microsecond + base = timedelta._create(delta_d, delta_s, delta_us, True) if self._tzinfo is other._tzinfo: return base myoff = self._utcoffset() diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -49,6 +49,8 @@ ACCEPT_CDATA = ACCEPT_CDATA w_gc_wref_remove = None + w_init_once_cache = None + jit_init_once_cache = None @jit.dont_look_inside def __init__(self, space, src_ctx): @@ -585,6 +587,59 @@ return w_result + def descr_init_once(self, w_func, w_tag): + """XXX document me""" + # + # first, a fast-path for the JIT which only works if the very + # same w_tag object is passed; then it turns into no code at all + try: + return self._init_once_elidable(w_tag) + except KeyError: + return self._init_once_slowpath(w_func, w_tag) + + @jit.elidable + def _init_once_elidable(self, w_tag): + jit_cache = self.jit_init_once_cache + if jit_cache is not None: + return jit_cache[w_tag] + else: + raise KeyError + + @jit.dont_look_inside + def _init_once_slowpath(self, w_func, w_tag): + space = self.space + w_cache = self.w_init_once_cache + if w_cache is None: + w_cache = self.space.newdict() + jit_cache = {} + self.w_init_once_cache = w_cache + self.jit_init_once_cache = jit_cache + # + # get the lock or result from cache[tag] + w_res = space.finditem(w_cache, w_tag) + if w_res is None: + w_res = W_InitOnceLock(space) + w_res = space.call_method(w_cache, 'setdefault', w_tag, w_res) + if not isinstance(w_res, W_InitOnceLock): + return w_res + with w_res.lock: + w_res = space.finditem(w_cache, w_tag) + if w_res is None or isinstance(w_res, W_InitOnceLock): + w_res = space.call_function(w_func) + self.jit_init_once_cache[w_tag] = w_res + space.setitem(w_cache, w_tag, w_res) + else: + # the real result was put in the dict while we were + # waiting for lock.__enter__() above + pass + return w_res + + +class W_InitOnceLock(W_Root): + def __init__(self, space): + self.lock = space.allocate_lock() + + @jit.dont_look_inside def make_plain_ffi_object(space, w_ffitype=None): if w_ffitype is None: @@ -641,6 +696,7 @@ from_handle = interp2app(W_FFIObject.descr_from_handle), gc = interp2app(W_FFIObject.descr_gc), getctype = interp2app(W_FFIObject.descr_getctype), + init_once = interp2app(W_FFIObject.descr_init_once), integer_const = interp2app(W_FFIObject.descr_integer_const), memmove = interp2app(W_FFIObject.descr_memmove), new = interp2app(W_FFIObject.descr_new), diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -447,3 +447,19 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + + def test_init_once(self): + import _cffi_backend as _cffi1_backend + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -8,6 +8,7 @@ from pypy.interpreter.error import OperationError from rpython.rlib.objectmodel import specialize, instantiate from rpython.rlib.nonconst import NonConstant +from rpython.rlib.rarithmetic import base_int from pypy.module.micronumpy import boxes, ufuncs from pypy.module.micronumpy.arrayops import where from pypy.module.micronumpy.ndarray import W_NDimArray @@ -178,7 +179,7 @@ return BoolObject(obj) elif isinstance(obj, int): return IntObject(obj) - elif isinstance(obj, long): + elif isinstance(obj, base_int): return LongObject(obj) elif isinstance(obj, W_Root): return obj @@ -196,31 +197,31 @@ return self.float(f) def le(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_le(self, w_obj2) def lt(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_lt(self, w_obj2) def ge(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_ge(self, w_obj2) def add(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_add(self, w_obj2) def sub(self, w_obj1, w_obj2): return self.wrap(1) def mul(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_mul(self, w_obj2) def pow(self, w_obj1, w_obj2, _): @@ -836,7 +837,7 @@ elif self.name == 'reshape': w_arg = self.args[1] assert isinstance(w_arg, ArrayConstant) - order = -1 + order = -1 w_res = arr.reshape(interp.space, w_arg.wrap(interp.space), order) else: assert False diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1810,3 +1810,35 @@ assert lib.EE1 == 0 assert lib.EE2 == 0 assert lib.EE3 == 1 + + def test_init_once(self): + def do_init(): + seen.append(1) + return 42 + ffi = FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + + def test_init_once_multithread(self): + import thread, time + def do_init(): + seen.append('init!') + time.sleep(1) + seen.append('init done') + return 7 + ffi = FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py @@ -487,7 +487,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -194,6 +194,11 @@ yp = ffi.new_handle([6, 4, 2]) assert ffi.from_handle(yp) == [6, 4, 2] +def test_handle_unique(): + ffi = _cffi1_backend.FFI() + assert ffi.new_handle(None) is not ffi.new_handle(None) + assert ffi.new_handle(None) != ffi.new_handle(None) + def test_ffi_cast(): ffi = _cffi1_backend.FFI() assert ffi.cast("int(*)(int)", 0) == ffi.NULL @@ -416,3 +421,37 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + +def test_init_once(): + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + +def test_init_once_multithread(): + import thread, time + def do_init(): + print 'init!' + seen.append('init!') + time.sleep(1) + seen.append('init done') + print 'init done' + return 7 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -309,6 +309,12 @@ assert td_div_int_newint == td_div_newint_newint assert td_div_newint_int == td_div_newint_newint + def test_return_types(self): + td = datetime.timedelta(5) + assert type(td.total_seconds()) is float + class sub(datetime.timedelta): pass + assert type(+sub()) is datetime.timedelta + class TestDatetimeHost(BaseTestDatetime): def setup_class(cls): From noreply at buildbot.pypy.org Tue Nov 24 19:17:30 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Wed, 25 Nov 2015 01:17:30 +0100 (CET) Subject: [pypy-commit] pypy default: optimize datetime - timedelta Message-ID: <20151125001730.158841C21FB@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80920:629f1bffad53 Date: 2015-11-24 18:39 -0500 http://bitbucket.org/pypy/pypy/changeset/629f1bffad53/ Log: optimize datetime - timedelta diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -1824,22 +1824,24 @@ return -1 return diff and 1 or 0 + def _add_timedelta(self, other, factor): + t = _tmxxx(self._year, + self._month, + self._day + other.days * factor, + self._hour, + self._minute, + self._second + other.seconds * factor, + self._microsecond + other.microseconds * factor) + self._checkOverflow(t.year) + return datetime(t.year, t.month, t.day, + t.hour, t.minute, t.second, + t.microsecond, tzinfo=self._tzinfo) + def __add__(self, other): "Add a datetime and a timedelta." if not isinstance(other, timedelta): return NotImplemented - t = _tmxxx(self._year, - self._month, - self._day + other.days, - self._hour, - self._minute, - self._second + other.seconds, - self._microsecond + other.microseconds) - self._checkOverflow(t.year) - result = datetime(t.year, t.month, t.day, - t.hour, t.minute, t.second, - t.microsecond, tzinfo=self._tzinfo) - return result + return self._add_timedelta(other, 1) __radd__ = __add__ @@ -1847,7 +1849,7 @@ "Subtract two datetimes, or a datetime and a timedelta." if not isinstance(other, datetime): if isinstance(other, timedelta): - return self + -other + return self._add_timedelta(other, -1) return NotImplemented delta_d = self.toordinal() - other.toordinal() From noreply at buildbot.pypy.org Tue Nov 24 19:17:32 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Wed, 25 Nov 2015 01:17:32 +0100 (CET) Subject: [pypy-commit] pypy default: unused Message-ID: <20151125001732.370CB1C21FB@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80921:17f53b18797e Date: 2015-11-24 18:43 -0500 http://bitbucket.org/pypy/pypy/changeset/17f53b18797e/ Log: unused diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -575,8 +575,6 @@ True) return NotImplemented - __radd__ = __add__ - def __sub__(self, other): if isinstance(other, timedelta): # for CPython compatibility, we cannot use @@ -587,11 +585,6 @@ True) return NotImplemented - def __rsub__(self, other): - if isinstance(other, timedelta): - return -self + other - return NotImplemented - def __neg__(self): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta From noreply at buildbot.pypy.org Tue Nov 24 19:23:12 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Wed, 25 Nov 2015 01:23:12 +0100 (CET) Subject: [pypy-commit] pypy default: cleanup Message-ID: <20151125002312.59D771C2242@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80922:3aa83b0f7f8c Date: 2015-11-24 19:23 -0500 http://bitbucket.org/pypy/pypy/changeset/3aa83b0f7f8c/ Log: cleanup diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -429,6 +429,10 @@ self.hour, self.minute, self.second = hour, minute, second self.microsecond = microsecond + def _check_error(self): + if not MINYEAR <= self.year <= MAXYEAR: + raise OverflowError("date value out of range") + def _accum(tag, sofar, num, factor, leftover): if isinstance(num, (int, long)): prod = num * factor @@ -925,20 +929,14 @@ # Computations - def _checkOverflow(self, year): - if not MINYEAR <= year <= MAXYEAR: - raise OverflowError("date +/-: result year %d not in %d..%d" % - (year, MINYEAR, MAXYEAR)) - def __add__(self, other): "Add a date to a timedelta." if isinstance(other, timedelta): t = _tmxxx(self._year, - self._month, - self._day + other.days) - self._checkOverflow(t.year) - result = date(t.year, t.month, t.day) - return result + self._month, + self._day + other.days) + t._check_error() + return date(t.year, t.month, t.day) return NotImplemented __radd__ = __add__ @@ -1825,7 +1823,7 @@ self._minute, self._second + other.seconds * factor, self._microsecond + other.microseconds * factor) - self._checkOverflow(t.year) + t._check_error() return datetime(t.year, t.month, t.day, t.hour, t.minute, t.second, t.microsecond, tzinfo=self._tzinfo) From noreply at buildbot.pypy.org Tue Nov 24 19:26:33 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Wed, 25 Nov 2015 01:26:33 +0100 (CET) Subject: [pypy-commit] pypy default: clarify _tmxxx error handling Message-ID: <20151125002633.1B47F1C2264@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80923:f31561a340fe Date: 2015-11-24 19:26 -0500 http://bitbucket.org/pypy/pypy/changeset/f31561a340fe/ Log: clarify _tmxxx error handling diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -373,7 +373,7 @@ ordinal = None def __init__(self, year, month, day, hour=0, minute=0, second=0, - microsecond=0): + microsecond=0, ignore_overflow=False): # Normalize all the inputs, and store the normalized values. if not 0 <= microsecond <= 999999: carry, microsecond = divmod(microsecond, 1000000) @@ -425,14 +425,13 @@ self.ordinal = _ymd2ord(year, month, 1) + (day - 1) year, month, day = _ord2ymd(self.ordinal) + if not ignore_overflow and not MINYEAR <= year <= MAXYEAR: + raise OverflowError("date value out of range") + self.year, self.month, self.day = year, month, day self.hour, self.minute, self.second = hour, minute, second self.microsecond = microsecond - def _check_error(self): - if not MINYEAR <= self.year <= MAXYEAR: - raise OverflowError("date value out of range") - def _accum(tag, sofar, num, factor, leftover): if isinstance(num, (int, long)): prod = num * factor @@ -935,7 +934,6 @@ t = _tmxxx(self._year, self._month, self._day + other.days) - t._check_error() return date(t.year, t.month, t.day) return NotImplemented @@ -1550,7 +1548,7 @@ hh, mm, ss = self.hour, self.minute, self.second offset = self._utcoffset() if offset: # neither None nor 0 - tm = _tmxxx(y, m, d, hh, mm - offset) + tm = _tmxxx(y, m, d, hh, mm - offset, ignore_overflow=True) y, m, d = tm.year, tm.month, tm.day hh, mm = tm.hour, tm.minute return _build_struct_time(y, m, d, hh, mm, ss, 0) @@ -1823,7 +1821,6 @@ self._minute, self._second + other.seconds * factor, self._microsecond + other.microseconds * factor) - t._check_error() return datetime(t.year, t.month, t.day, t.hour, t.minute, t.second, t.microsecond, tzinfo=self._tzinfo) From noreply at buildbot.pypy.org Tue Nov 24 21:04:38 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Wed, 25 Nov 2015 03:04:38 +0100 (CET) Subject: [pypy-commit] pypy default: replace datetime _tmxxx with normalizing functions Message-ID: <20151125020438.7C4901C2239@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80924:f6b21456bb6a Date: 2015-11-24 21:03 -0500 http://bitbucket.org/pypy/pypy/changeset/f6b21456bb6a/ Log: replace datetime _tmxxx with normalizing functions diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -359,78 +359,61 @@ raise TypeError("can't compare '%s' to '%s'" % ( type(x).__name__, type(y).__name__)) -# This is a start at a struct tm workalike. Goals: -# -# + Works the same way across platforms. -# + Handles all the fields datetime needs handled, without 1970-2038 glitches. -# -# Note: I suspect it's best if this flavor of tm does *not* try to -# second-guess timezones or DST. Instead fold whatever adjustments you want -# into the minutes argument (and the constructor will normalize). +def _normalize_pair(hi, lo, factor): + if not 0 <= lo <= factor-1: + inc, lo = divmod(lo, factor) + hi += inc + return hi, lo -class _tmxxx: +def _normalize_datetime(y, m, d, hh, mm, ss, us, ignore_overflow=False): + # Normalize all the inputs, and store the normalized values. + ss, us = _normalize_pair(ss, us, 1000000) + mm, ss = _normalize_pair(mm, ss, 60) + hh, mm = _normalize_pair(hh, mm, 60) + d, hh = _normalize_pair(d, hh, 24) + y, m, d = _normalize_date(y, m, d, ignore_overflow) + return y, m, d, hh, mm, ss, us - ordinal = None +def _normalize_date(year, month, day, ignore_overflow=False): + # That was easy. Now it gets muddy: the proper range for day + # can't be determined without knowing the correct month and year, + # but if day is, e.g., plus or minus a million, the current month + # and year values make no sense (and may also be out of bounds + # themselves). + # Saying 12 months == 1 year should be non-controversial. + if not 1 <= month <= 12: + year, month = _normalize_pair(year, month-1, 12) + month += 1 + assert 1 <= month <= 12 - def __init__(self, year, month, day, hour=0, minute=0, second=0, - microsecond=0, ignore_overflow=False): - # Normalize all the inputs, and store the normalized values. - if not 0 <= microsecond <= 999999: - carry, microsecond = divmod(microsecond, 1000000) - second += carry - if not 0 <= second <= 59: - carry, second = divmod(second, 60) - minute += carry - if not 0 <= minute <= 59: - carry, minute = divmod(minute, 60) - hour += carry - if not 0 <= hour <= 23: - carry, hour = divmod(hour, 24) - day += carry + # Now only day can be out of bounds (year may also be out of bounds + # for a datetime object, but we don't care about that here). + # If day is out of bounds, what to do is arguable, but at least the + # method here is principled and explainable. + dim = _days_in_month(year, month) + if not 1 <= day <= dim: + # Move day-1 days from the first of the month. First try to + # get off cheap if we're only one day out of range (adjustments + # for timezone alone can't be worse than that). + if day == 0: # move back a day + month -= 1 + if month > 0: + day = _days_in_month(year, month) + else: + year, month, day = year-1, 12, 31 + elif day == dim + 1: # move forward a day + month += 1 + day = 1 + if month > 12: + month = 1 + year += 1 + else: + ordinal = _ymd2ord(year, month, 1) + (day - 1) + year, month, day = _ord2ymd(ordinal) - # That was easy. Now it gets muddy: the proper range for day - # can't be determined without knowing the correct month and year, - # but if day is, e.g., plus or minus a million, the current month - # and year values make no sense (and may also be out of bounds - # themselves). - # Saying 12 months == 1 year should be non-controversial. - if not 1 <= month <= 12: - carry, month = divmod(month-1, 12) - year += carry - month += 1 - assert 1 <= month <= 12 - - # Now only day can be out of bounds (year may also be out of bounds - # for a datetime object, but we don't care about that here). - # If day is out of bounds, what to do is arguable, but at least the - # method here is principled and explainable. - dim = _days_in_month(year, month) - if not 1 <= day <= dim: - # Move day-1 days from the first of the month. First try to - # get off cheap if we're only one day out of range (adjustments - # for timezone alone can't be worse than that). - if day == 0: # move back a day - month -= 1 - if month > 0: - day = _days_in_month(year, month) - else: - year, month, day = year-1, 12, 31 - elif day == dim + 1: # move forward a day - month += 1 - day = 1 - if month > 12: - month = 1 - year += 1 - else: - self.ordinal = _ymd2ord(year, month, 1) + (day - 1) - year, month, day = _ord2ymd(self.ordinal) - - if not ignore_overflow and not MINYEAR <= year <= MAXYEAR: - raise OverflowError("date value out of range") - - self.year, self.month, self.day = year, month, day - self.hour, self.minute, self.second = hour, minute, second - self.microsecond = microsecond + if not ignore_overflow and not MINYEAR <= year <= MAXYEAR: + raise OverflowError("date value out of range") + return year, month, day def _accum(tag, sofar, num, factor, leftover): if isinstance(num, (int, long)): @@ -450,12 +433,6 @@ raise TypeError("unsupported type for timedelta %s component: %s" % (tag, type(num))) -def _normalize_pair(hi, lo, factor): - if lo < 0 or lo >= factor: - inc, lo = divmod(lo, factor) - hi += inc - return hi, lo - class timedelta(object): """Represent the difference between two datetime objects. @@ -931,10 +908,10 @@ def __add__(self, other): "Add a date to a timedelta." if isinstance(other, timedelta): - t = _tmxxx(self._year, - self._month, - self._day + other.days) - return date(t.year, t.month, t.day) + year, month, day = _normalize_date(self._year, + self._month, + self._day + other.days) + return date(year, month, day) return NotImplemented __radd__ = __add__ @@ -1548,9 +1525,9 @@ hh, mm, ss = self.hour, self.minute, self.second offset = self._utcoffset() if offset: # neither None nor 0 - tm = _tmxxx(y, m, d, hh, mm - offset, ignore_overflow=True) - y, m, d = tm.year, tm.month, tm.day - hh, mm = tm.hour, tm.minute + mm -= offset + y, m, d, hh, mm, ss, _ = _normalize_datetime( + y, m, d, hh, mm, ss, 0, ignore_overflow=True) return _build_struct_time(y, m, d, hh, mm, ss, 0) def date(self): @@ -1814,16 +1791,15 @@ return diff and 1 or 0 def _add_timedelta(self, other, factor): - t = _tmxxx(self._year, - self._month, - self._day + other.days * factor, - self._hour, - self._minute, - self._second + other.seconds * factor, - self._microsecond + other.microseconds * factor) - return datetime(t.year, t.month, t.day, - t.hour, t.minute, t.second, - t.microsecond, tzinfo=self._tzinfo) + y, m, d, hh, mm, ss, us = _normalize_datetime( + self._year, + self._month, + self._day + other.days * factor, + self._hour, + self._minute, + self._second + other.seconds * factor, + self._microsecond + other.microseconds * factor) + return datetime(y, m, d, hh, mm, ss, us, tzinfo=self._tzinfo) def __add__(self, other): "Add a datetime and a timedelta." From noreply at buildbot.pypy.org Tue Nov 24 21:04:40 2015 From: noreply at buildbot.pypy.org (bdkearns) Date: Wed, 25 Nov 2015 03:04:40 +0100 (CET) Subject: [pypy-commit] pypy default: simplify date +- timedelta Message-ID: <20151125020440.89F3E1C2239@cobra.cs.uni-duesseldorf.de> Author: Brian Kearns Branch: Changeset: r80925:11243828bb74 Date: 2015-11-24 20:44 -0500 http://bitbucket.org/pypy/pypy/changeset/11243828bb74/ Log: simplify date +- timedelta diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -905,25 +905,29 @@ # Computations + def _add_timedelta(self, other, factor): + y, m, d = _normalize_date( + self._year, + self._month, + self._day + other.days * factor) + return date(y, m, d) + def __add__(self, other): "Add a date to a timedelta." if isinstance(other, timedelta): - year, month, day = _normalize_date(self._year, - self._month, - self._day + other.days) - return date(year, month, day) + return self._add_timedelta(other, 1) return NotImplemented __radd__ = __add__ def __sub__(self, other): """Subtract two dates, or a date and a timedelta.""" - if isinstance(other, timedelta): - return self + timedelta._create(-other.days, 0, 0, False) if isinstance(other, date): days1 = self.toordinal() days2 = other.toordinal() return timedelta._create(days1 - days2, 0, 0, False) + if isinstance(other, timedelta): + return self._add_timedelta(other, -1) return NotImplemented def weekday(self): From noreply at buildbot.pypy.org Wed Nov 25 02:53:38 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 08:53:38 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: write the snapshots in a better order. complicates code, but will probably be beneficial Message-ID: <20151125075338.9D3951C0400@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80926:2a006fba78d9 Date: 2015-11-25 09:54 +0200 http://bitbucket.org/pypy/pypy/changeset/2a006fba78d9/ Log: write the snapshots in a better order. complicates code, but will probably be beneficial diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -202,19 +202,31 @@ TAGBOX = 2 TAGVIRTUAL = 3 -UNASSIGNED = tag(-1 << 13, TAGBOX) -UNASSIGNEDVIRTUAL = tag(-1 << 13, TAGVIRTUAL) -NULLREF = tag(0, TAGCONST) -UNINITIALIZED = tag(1, TAGCONST) # used for uninitialized string characters -TAG_CONST_OFFSET = 2 +UNASSIGNED = tag(-1, TAGBOX) +UNASSIGNEDVIRTUAL = tag(-1, TAGVIRTUAL) +NULLREF = tag(-1, TAGCONST) +UNINITIALIZED = tag(2, TAGCONST) # used for uninitialized string characters +TAG_CONST_OFFSET = 0 class NumberingState(object): - def __init__(self): + def __init__(self, snapshot_list): self.liveboxes = {} - self.current = [] + self.current = [None] * self.count_boxes(snapshot_list) + self.position = len(self.current) self.n = 0 self.v = 0 + def count_boxes(self, lst): + c = 0 + for snapshot in lst: + c += len(snapshot.boxes) + c += 2 * (len(lst) - 1) + return c + + def append(self, item): + self.current[self.position] = item + self.position += 1 + class ResumeDataLoopMemo(object): def __init__(self, metainterp_sd): @@ -273,6 +285,7 @@ v = state.v liveboxes = state.liveboxes length = len(boxes) + state.position -= length for i in range(length): box = boxes[i] box = optimizer.get_box_replacement(box) @@ -296,9 +309,10 @@ tagged = tag(n, TAGBOX) n += 1 liveboxes[box] = tagged - state.current.append(tagged) + state.append(tagged) state.n = n state.v = v + state.position -= length # def _get_prev_snapshot(self, snapshot): # cur_snapshot = snapshot @@ -313,26 +327,28 @@ def number(self, optimizer, snapshot, frameinfo): # flatten the list - cur = snapshot - snapshot_list = [] + vref_snapshot = snapshot + cur = snapshot.prev + snapshot_list = [vref_snapshot] framestack_list = [] while cur: - if cur is not snapshot: - framestack_list.append(frameinfo) - frameinfo = frameinfo.prev + framestack_list.append(frameinfo) + frameinfo = frameinfo.prev snapshot_list.append(cur) cur = cur.prev - snapshot_list.reverse() - framestack_list.reverse() - state = NumberingState() + state = NumberingState(snapshot_list) - for i in range(len(snapshot_list)): + # we want to number snapshots starting from the back, but ending + # with a forward list + for i in range(len(snapshot_list) - 1, -1, -1): self._number_boxes(snapshot_list[i].boxes, optimizer, state) if i != 0: frameinfo = framestack_list[i - 1] jitcode_pos, pc = unpack_uint(frameinfo.packed_jitcode_pc) - state.current.append(rffi.cast(rffi.USHORT, jitcode_pos)) - state.current.append(rffi.cast(rffi.USHORT, pc)) + state.position -= 2 + state.append(rffi.cast(rffi.USHORT, jitcode_pos)) + state.append(rffi.cast(rffi.USHORT, pc)) + state.position -= 2 numb = resumecode.create_numbering(state.current, lltype.nullptr(resumecode.NUMBERING), 0) @@ -1090,6 +1106,7 @@ def rebuild_from_resumedata(metainterp, storage, deadframe, virtualizable_info, greenfield_info): + xxx resumereader = ResumeDataBoxReader(storage, deadframe, metainterp) boxes = resumereader.consume_vref_and_vable_boxes(virtualizable_info, greenfield_info) @@ -1480,6 +1497,7 @@ load_value_of_type._annspecialcase_ = 'specialize:arg(1)' def consume_vref_and_vable(self, vrefinfo, vinfo, ginfo): + xxx numb = self.cur_numb self.cur_numb = numb.prev if self.resume_after_guard_not_forced != 2: diff --git a/rpython/jit/metainterp/resumecode.py b/rpython/jit/metainterp/resumecode.py --- a/rpython/jit/metainterp/resumecode.py +++ b/rpython/jit/metainterp/resumecode.py @@ -15,49 +15,78 @@ NUMBERING = lltype.GcStruct('Numbering', ('prev', NUMBERINGP), ('prev_index', rffi.USHORT), - ('code', lltype.Array(rffi.UCHAR))) + ('code', lltype.Array(rffi.SHORT))) NUMBERINGP.TO.become(NUMBERING) NULL_NUMBER = lltype.nullptr(NUMBERING) def create_numbering(lst, prev, prev_index): - count = 0 - for item in lst: - if item > 127: - count += 1 - count += 1 - numb = lltype.malloc(NUMBERING, count) - numb.prev = prev - numb.prev_index = rffi.cast(rffi.USHORT, prev_index) - index = 0 - for item in lst: - assert item >= 0 - if item <= 128: - numb.code[index] = rffi.cast(rffi.UCHAR, item) - index += 1 - else: - assert (item >> 8) <= 127 - numb.code[index] = rffi.cast(rffi.UCHAR, (item >> 8) | 0x80) - numb.code[index + 1] = rffi.cast(rffi.UCHAR, item & 0xff) - index += 2 - return numb + numb = lltype.malloc(NUMBERING, len(lst)) + for i in range(len(lst)): + numb.code[i] = rffi.cast(rffi.SHORT, lst[i]) + numb.prev = prev + numb.prev_index = rffi.cast(rffi.USHORT, prev_index) + return numb + +def _create_numbering(lst, prev, prev_index): + count = 0 + for item in lst: + if item < 0: + if item < -63: + count += 1 + if item > 127: + count += 1 + count += 1 + numb = lltype.malloc(NUMBERING, count) + numb.prev = prev + numb.prev_index = rffi.cast(rffi.USHORT, prev_index) + index = 0 + for item in lst: + if 0 <= item <= 128: + numb.code[index] = rffi.cast(rffi.UCHAR, item) + index += 1 + else: + assert (item >> 8) <= 63 + if item < 0: + item = -item + if item <= 63: + numb.code[index] = rffi.cast(rffi.UCHAR, item | 0x40) + index += 1 + else: + numb.code[index] = rffi.cast(rffi.UCHAR, (item >> 8) | 0x80 | 0x40) + numb.code[index + 1] = rffi.cast(rffi.UCHAR, item & 0xff) + index += 2 + else: + numb.code[index] = rffi.cast(rffi.UCHAR, (item >> 8) | 0x80) + numb.code[index + 1] = rffi.cast(rffi.UCHAR, item & 0xff) + index += 2 + return numb def copy_from_list_to_numb(lst, numb, index): - i = 0 - while i < len(lst): - numb.code[i + index] = lst[i] - i += 1 + i = 0 + while i < len(lst): + numb.code[i + index] = lst[i] + i += 1 def numb_next_item(numb, index): - one = rffi.cast(lltype.Signed, numb.code[index]) - if one & 0x80: - two = rffi.cast(lltype.Signed, numb.code[index + 1]) - return ((one & 0x7f) << 8) | two, index + 2 - return one, index + 1 + return rffi.cast(lltype.Signed, numb.code[index]), index + 1 + +def _numb_next_item(numb, index): + one = rffi.cast(lltype.Signed, numb.code[index]) + if one & 0x40: + if one & 0x80: + two = rffi.cast(lltype.Signed, numb.code[index + 1]) + return -(((one & ~(0x80 | 0x40)) << 8) | two), index + 2 + else: + return -(one & (~0x40)), index + 1 + if one & 0x80: + two = rffi.cast(lltype.Signed, numb.code[index + 1]) + return ((one & 0x7f) << 8) | two, index + 2 + return one, index + 1 def unpack_numbering(numb): - l = [] - i = 0 - while i < len(numb.code): - next, i = numb_next_item(numb, i) - l.append(next) - return l + l = [] + i = 0 + while i < len(numb.code): + next, i = numb_next_item(numb, i) + l.append(next) + return l diff --git a/rpython/jit/metainterp/test/test_resume.py b/rpython/jit/metainterp/test/test_resume.py --- a/rpython/jit/metainterp/test/test_resume.py +++ b/rpython/jit/metainterp/test/test_resume.py @@ -336,7 +336,7 @@ def test_simple_read_tagged_ints(): storage = Storage() storage.rd_consts = [] - numb = Numbering(None, [tag(100, TAGINT)]) + numb = Numbering([tag(100, TAGINT)]) storage.rd_numb = numb # cpu = MyCPU([]) @@ -552,17 +552,6 @@ assert jitcode_pos == 42 assert pc == 3 -def test_Numbering_create(): - l = [rffi.r_short(1), rffi.r_short(2)] - numb = Numbering(None, l) - assert not numb.prev - assert list(numb.nums) == l - - l1 = [rffi.r_short(3)] - numb1 = Numbering(numb, l1) - assert numb1.prev == numb - assert list(numb1.nums) == l1 - def test_capture_resumedata(): b1, b2, b3 = [InputArgInt(), InputArgRef(), InputArgInt()] c1, c2, c3 = [ConstInt(1), ConstInt(2), ConstInt(3)] @@ -869,7 +858,7 @@ tagged = memo.getconst(const) index, tagbits = untag(tagged) assert tagbits == TAGCONST - assert memo.consts[index] is const + assert memo.consts[index - TAG_CONST_OFFSET] is const tagged = memo.getconst(ConstInt(50000)) index2, tagbits = untag(tagged) assert tagbits == TAGCONST @@ -887,7 +876,7 @@ tagged = memo.getconst(const) index, tagbits = untag(tagged) assert tagbits == TAGCONST - assert memo.consts[index] is const + assert memo.consts[index - TAG_CONST_OFFSET] is const tagged = memo.getconst(cpu.ts.ConstRef(demo55o)) index2, tagbits = untag(tagged) assert tagbits == TAGCONST @@ -905,7 +894,7 @@ tagged = memo.getconst(const) index, tagbits = untag(tagged) assert tagbits == TAGCONST - assert memo.consts[index] is const + assert memo.consts[index - TAG_CONST_OFFSET] is const def test_ResumeDataLoopMemo_number(): b1, b2, b3, b4, b5 = [InputArgInt(), InputArgInt(), InputArgInt(), @@ -929,8 +918,8 @@ b3: tag(2, TAGBOX)} base = [tag(0, TAGBOX), tag(1, TAGINT), tag(1, TAGBOX), tag(0, TAGBOX), tag(2, TAGINT)] - assert unpack_numbering(numb) == base + [ - tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), tag(1, TAGINT), 0, 0] + assert unpack_numbering(numb) == [ + tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), tag(1, TAGINT), 0, 0] + base numb2, liveboxes2, v = memo.number(FakeOptimizer(), snap2, frameinfo) assert v == 0 @@ -938,8 +927,8 @@ assert liveboxes2 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b3: tag(2, TAGBOX)} assert liveboxes2 is not liveboxes - assert unpack_numbering(numb2) == base + [ - tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), tag(3, TAGINT), 0, 0] + assert unpack_numbering(numb2) == [ + tag(3, TAGINT), tag(2, TAGBOX), tag(0, TAGBOX), tag(3, TAGINT), 0, 0] + base assert numb2.prev == numb.prev env3 = [c3, b3, b1, c3] @@ -958,8 +947,8 @@ assert v == 0 assert liveboxes3 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX)} - assert unpack_numbering(numb3) == base + [tag(3, TAGINT), tag(4, TAGINT), tag(0, TAGBOX), - tag(3, TAGINT), 0, 0] + assert unpack_numbering(numb3) == [tag(3, TAGINT), tag(4, TAGINT), tag(0, TAGBOX), + tag(3, TAGINT), 0, 0] + base # virtual env4 = [c3, b4, b1, c3] @@ -971,8 +960,8 @@ assert liveboxes4 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b4: tag(0, TAGVIRTUAL)} - assert unpack_numbering(numb4) == base + [tag(3, TAGINT), tag(0, TAGVIRTUAL), - tag(0, TAGBOX), tag(3, TAGINT), 0, 0] + assert unpack_numbering(numb4) == [tag(3, TAGINT), tag(0, TAGVIRTUAL), + tag(0, TAGBOX), tag(3, TAGINT), 0, 0] + base env5 = [b1, b4, b5] snap5 = Snapshot(snap4, env5) @@ -985,8 +974,8 @@ assert liveboxes5 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX), b4: tag(0, TAGVIRTUAL), b5: tag(1, TAGVIRTUAL)} - assert unpack_numbering(numb5) == unpack_numbering(numb4) + [tag(0, TAGBOX), tag(0, TAGVIRTUAL), - tag(1, TAGVIRTUAL), 2, 1] + assert unpack_numbering(numb5) == [tag(0, TAGBOX), tag(0, TAGVIRTUAL), + tag(1, TAGVIRTUAL), 2, 1] + unpack_numbering(numb4) def test_ResumeDataLoopMemo_number_boxes(): memo = ResumeDataLoopMemo(FakeMetaInterpStaticData()) @@ -1087,9 +1076,10 @@ assert storage.rd_snapshot is None cpu = MyCPU([]) reader = ResumeDataDirectReader(MyMetaInterp(cpu), storage, "deadframe") + _next_section(reader, sys.maxint, 1, sys.maxint, 2**16) + _next_section(reader, 2, 3) + reader.cur_index += 2 # framestack _next_section(reader, sys.maxint, 2**16, -65) - _next_section(reader, 2, 3) - _next_section(reader, sys.maxint, 1, sys.maxint, 2**16) def test_virtual_adder_memo_const_sharing(): @@ -1125,8 +1115,8 @@ return True class MyInfo: @staticmethod - def enumerate_vars(callback_i, callback_r, callback_f, _): - for index, tagged in enumerate(self.cur_numb.nums): + def enumerate_vars(callback_i, callback_r, callback_f, _, index): + for tagged in self.cur_numb.nums: _, tag = untag(tagged) if tag == TAGVIRTUAL: kind = REF @@ -1134,11 +1124,11 @@ kind = Whatever() box = self.decode_box(tagged, kind) if box.type == INT: - callback_i(index, index) + index = callback_i(index, index) elif box.type == REF: - callback_r(index, index) + index = callback_r(index, index) elif box.type == FLOAT: - callback_f(index, index) + index = callback_f(index, index) else: assert 0 self._prepare_next_section(MyInfo()) diff --git a/rpython/jit/metainterp/test/test_resumecode.py b/rpython/jit/metainterp/test/test_resumecode.py --- a/rpython/jit/metainterp/test/test_resumecode.py +++ b/rpython/jit/metainterp/test/test_resumecode.py @@ -1,18 +1,16 @@ -from rpython.jit.metainterp.resumecode import NUMBERING +from rpython.jit.metainterp.resumecode import NUMBERING, NULL_NUMBER from rpython.jit.metainterp.resumecode import create_numbering,\ - unpack_numbering, copy_from_list_to_numb + unpack_numbering, copy_from_list_to_numb from rpython.rtyper.lltypesystem import lltype def test_pack_unpack(): - examples = [ - [1, 2, 3, 4, 257, 10000, 13, 15], - [1, 2, 3, 4], - range(1, 10, 2), - [13000, 12000, 10000, 256, 255, 254, 257] - ] - for l in examples: - lst = create_numbering(l) - n = lltype.malloc(NUMBERING, len(lst)) - copy_from_list_to_numb(lst, n, 0) - assert unpack_numbering(n) == l + examples = [ + [1, 2, 3, 4, 257, 10000, 13, 15], + [1, 2, 3, 4], + range(1, 10, 2), + [13000, 12000, 10000, 256, 255, 254, 257, -3, -1000] + ] + for l in examples: + n = create_numbering(l, NULL_NUMBER, 0) + assert unpack_numbering(n) == l From noreply at buildbot.pypy.org Wed Nov 25 02:58:32 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 08:58:32 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: pass test_resume except fake reader Message-ID: <20151125075832.6D6551C0400@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80927:5be44a5fc0d3 Date: 2015-11-25 09:58 +0200 http://bitbucket.org/pypy/pypy/changeset/5be44a5fc0d3/ Log: pass test_resume except fake reader diff --git a/rpython/jit/metainterp/test/test_resume.py b/rpython/jit/metainterp/test/test_resume.py --- a/rpython/jit/metainterp/test/test_resume.py +++ b/rpython/jit/metainterp/test/test_resume.py @@ -1076,11 +1076,11 @@ assert storage.rd_snapshot is None cpu = MyCPU([]) reader = ResumeDataDirectReader(MyMetaInterp(cpu), storage, "deadframe") - _next_section(reader, sys.maxint, 1, sys.maxint, 2**16) + _next_section(reader, sys.maxint, 2**16, -65) + reader.cur_index += 2 # framestack _next_section(reader, 2, 3) reader.cur_index += 2 # framestack - _next_section(reader, sys.maxint, 2**16, -65) - + _next_section(reader, sys.maxint, 1, sys.maxint, 2**16) def test_virtual_adder_memo_const_sharing(): b1s, b2s, b3s = [ConstInt(sys.maxint), ConstInt(2**16), ConstInt(-65)] From noreply at buildbot.pypy.org Wed Nov 25 03:35:56 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 09:35:56 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: hg merge stmgc-c8 Message-ID: <20151125083556.80DA11C089E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80928:96251506a7b2 Date: 2015-11-25 09:17 +0100 http://bitbucket.org/pypy/pypy/changeset/96251506a7b2/ Log: hg merge stmgc-c8 diff too long, truncating to 2000 out of 105631 lines diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ .hg .svn +# VIM +*.swp +*.swo + *.pyc *.pyo *~ +__pycache__/ bin/pypy-c include/*.h @@ -22,4 +27,6 @@ pypy/translator/goal/pypy-c pypy/translator/goal/target*-c release/ +!pypy/tool/release/ rpython/_cache/ +__pycache__/ diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0 f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1 +850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -56,14 +56,15 @@ Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen + Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen Lukas Diekmann Sven Hager Anders Lehmann + Remi Meier Aurelien Campeas - Remi Meier Niklaus Haldimann Camillo Bruni Laura Creighton @@ -87,7 +88,6 @@ Ludovic Aubry Jacob Hallen Jason Creighton - Richard Plangger Alex Martelli Michal Bendowski stian @@ -200,9 +200,12 @@ Alex Perry Vincent Legoll Alan McIntyre + Spenser Bauman Alexander Sedov Attila Gobi Christopher Pope + Devin Jeanpierre + Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg @@ -234,6 +237,7 @@ Lutz Paelike Lucio Torre Lars Wassermann + Philipp Rustemeuer Henrik Vendelbo Dan Buch Miguel de Val Borro @@ -244,6 +248,7 @@ Martin Blais Lene Wagner Tomo Cocoa + Kim Jin Su Toni Mattis Lucas Stadler Julian Berman @@ -253,6 +258,7 @@ Anna Katrina Dominguez William Leslie Bobby Impollonia + Faye Zhao timo at eistee.fritz.box Andrew Thompson Yusei Tahara @@ -283,6 +289,7 @@ shoma hosaka Daniel Neuhäuser Ben Mather + Niclas Olofsson halgari Boglarka Vezer Chris Pressey @@ -309,13 +316,16 @@ Stefan Marr jiaaro Mads Kiilerich + Richard Lancaster opassembler.py Antony Lee + Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky + Zearin soareschen Kurt Griffiths Mike Bayer @@ -327,6 +337,7 @@ Anna Ravencroft Andrey Churin Dan Crosta + Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz @@ -430,7 +441,7 @@ gdbm module, provided in the file lib_pypy/gdbm.py, is redistributed under the terms of the GPL license as well. -License for 'pypy/module/_vmprof/src' +License for 'rpython/rlib/rvmprof/src' -------------------------------------- The code is based on gperftools. You may see a copy of the License for it at diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py --- a/dotviewer/graphclient.py +++ b/dotviewer/graphclient.py @@ -127,16 +127,8 @@ return spawn_graphserver_handler((host, port)) def spawn_local_handler(): - if hasattr(sys, 'pypy_objspaceclass'): - # if 'python' is actually PyPy, e.g. in a virtualenv, then - # try hard to find a real CPython - try: - python = subprocess.check_output( - 'env -i $SHELL -l -c "which python"', shell=True).strip() - except subprocess.CalledProcessError: - # did not work, fall back to 'python' - python = 'python' - else: + python = os.getenv('PYPY_PYGAME_PYTHON') + if not python: python = sys.executable args = [python, '-u', GRAPHSERVER, '--stdio'] p = subprocess.Popen(args, diff --git a/lib-python/conftest.py b/lib-python/conftest.py --- a/lib-python/conftest.py +++ b/lib-python/conftest.py @@ -158,7 +158,7 @@ RegrTest('test_codecs.py', core=True, usemodules='_multibytecodec'), RegrTest('test_codeop.py', core=True), RegrTest('test_coding.py', core=True), - RegrTest('test_coercion.py', core=True), + RegrTest('test_coercion.py', core=True, usemodules='struct'), RegrTest('test_collections.py', usemodules='binascii struct'), RegrTest('test_colorsys.py'), RegrTest('test_commands.py'), @@ -303,7 +303,7 @@ RegrTest('test_memoryio.py'), RegrTest('test_memoryview.py'), RegrTest('test_md5.py'), - RegrTest('test_mhlib.py'), + RegrTest('test_mhlib.py', usemodules='binascii struct'), RegrTest('test_mimetools.py'), RegrTest('test_mimetypes.py'), RegrTest('test_MimeWriter.py', core=False, usemodules='binascii'), diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py --- a/lib_pypy/_curses.py +++ b/lib_pypy/_curses.py @@ -1026,16 +1026,22 @@ def tigetflag(capname): _ensure_initialised_setupterm() + if isinstance(capname, unicode): + capname = capname.encode('ascii') return lib.tigetflag(capname) def tigetnum(capname): _ensure_initialised_setupterm() + if isinstance(capname, unicode): + capname = capname.encode('ascii') return lib.tigetnum(capname) def tigetstr(capname): _ensure_initialised_setupterm() + if isinstance(capname, unicode): + capname = capname.encode('ascii') val = lib.tigetstr(capname) if int(ffi.cast("intptr_t", val)) in (0, -1): return None diff --git a/lib_pypy/_tkinter/tklib_build.py b/lib_pypy/_tkinter/tklib_build.py --- a/lib_pypy/_tkinter/tklib_build.py +++ b/lib_pypy/_tkinter/tklib_build.py @@ -212,8 +212,8 @@ #include #endif -char *get_tk_version() { return TK_VERSION; } -char *get_tcl_version() { return TCL_VERSION; } +char *get_tk_version(void) { return TK_VERSION; } +char *get_tcl_version(void) { return TCL_VERSION; } """ % globals(), include_dirs=incdirs, libraries=linklibs, diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.3.0 +Version: 1.3.1 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py --- a/lib_pypy/cffi/__init__.py +++ b/lib_pypy/cffi/__init__.py @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.3.0" -__version_info__ = (1, 3, 0) +__version__ = "1.3.1" +__version_info__ = (1, 3, 1) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/lib_pypy/cffi/_pycparser/__init__.py b/lib_pypy/cffi/_pycparser/__init__.py --- a/lib_pypy/cffi/_pycparser/__init__.py +++ b/lib_pypy/cffi/_pycparser/__init__.py @@ -4,11 +4,11 @@ # This package file exports some convenience functions for # interacting with pycparser # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- __all__ = ['c_lexer', 'c_parser', 'c_ast'] -__version__ = '2.10' +__version__ = '2.14' from subprocess import Popen, PIPE from .c_parser import CParser @@ -91,4 +91,3 @@ if parser is None: parser = CParser() return parser.parse(text, filename) - diff --git a/lib_pypy/cffi/_pycparser/_ast_gen.py b/lib_pypy/cffi/_pycparser/_ast_gen.py --- a/lib_pypy/cffi/_pycparser/_ast_gen.py +++ b/lib_pypy/cffi/_pycparser/_ast_gen.py @@ -1,13 +1,13 @@ #----------------------------------------------------------------- # _ast_gen.py # -# Generates the AST Node classes from a specification given in -# a .yaml file +# Generates the AST Node classes from a specification given in +# a configuration file # # The design of this module was inspired by astgen.py from the # Python 2.5 code-base. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- import pprint @@ -20,7 +20,7 @@ file. """ self.cfg_filename = cfg_filename - self.node_cfg = [NodeCfg(name, contents) + self.node_cfg = [NodeCfg(name, contents) for (name, contents) in self.parse_cfgfile(cfg_filename)] def generate(self, file=None): @@ -28,11 +28,11 @@ """ src = Template(_PROLOGUE_COMMENT).substitute( cfg_filename=self.cfg_filename) - + src += _PROLOGUE_CODE for node_cfg in self.node_cfg: src += node_cfg.generate_source() + '\n\n' - + file.write(src) def parse_cfgfile(self, filename): @@ -57,10 +57,10 @@ class NodeCfg(object): - """ Node configuration. + """ Node configuration. name: node name - contents: a list of contents - attributes and child nodes + contents: a list of contents - attributes and child nodes See comment at the top of the configuration file for details. """ def __init__(self, name, contents): @@ -73,7 +73,7 @@ for entry in contents: clean_entry = entry.rstrip('*') self.all_entries.append(clean_entry) - + if entry.endswith('**'): self.seq_child.append(clean_entry) elif entry.endswith('*'): @@ -86,26 +86,30 @@ src += '\n' + self._gen_children() src += '\n' + self._gen_attr_names() return src - + def _gen_init(self): src = "class %s(Node):\n" % self.name if self.all_entries: args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' - + + src += " __slots__ = (%s)\n" % slots src += " def __init__%s:\n" % arglist - + for name in self.all_entries + ['coord']: src += " self.%s = %s\n" % (name, name) - + return src def _gen_children(self): src = ' def children(self):\n' - + if self.all_entries: src += ' nodelist = []\n' @@ -114,21 +118,21 @@ ' if self.%(child)s is not None:' + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( dict(child=child)) - + for seq_child in self.seq_child: src += ( ' for i, child in enumerate(self.%(child)s or []):\n' ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( dict(child=seq_child)) - + src += ' return tuple(nodelist)\n' else: src += ' return ()\n' - - return src + + return src def _gen_attr_names(self): - src = " attr_names = (" + ''.join("%r," % nm for nm in self.attr) + ')' + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' return src @@ -136,7 +140,7 @@ r'''#----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# $cfg_filename +# $cfg_filename # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -146,7 +150,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -157,6 +161,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -167,21 +172,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -216,47 +221,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): diff --git a/lib_pypy/cffi/_pycparser/_build_tables.py b/lib_pypy/cffi/_pycparser/_build_tables.py --- a/lib_pypy/cffi/_pycparser/_build_tables.py +++ b/lib_pypy/cffi/_pycparser/_build_tables.py @@ -6,12 +6,11 @@ # Also generates AST code from the configuration file. # Should be called from the pycparser directory. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- # Generate c_ast.py -# from _ast_gen import ASTCodeGenerator ast_gen = ASTCodeGenerator('_c_ast.cfg') ast_gen.generate(open('c_ast.py', 'w')) diff --git a/lib_pypy/cffi/_pycparser/_c_ast.cfg b/lib_pypy/cffi/_pycparser/_c_ast.cfg --- a/lib_pypy/cffi/_pycparser/_c_ast.cfg +++ b/lib_pypy/cffi/_pycparser/_c_ast.cfg @@ -1,188 +1,189 @@ -#----------------------------------------------------------------- -# pycparser: _c_ast_gen.cfg -# -# Defines the AST Node classes used in pycparser. -# -# Each entry is a Node sub-class name, listing the attributes -# and child nodes of the class: -# * - a child node -# ** - a sequence of child nodes -# - an attribute -# -# Copyright (C) 2008-2012, Eli Bendersky -# License: BSD -#----------------------------------------------------------------- - -ArrayDecl: [type*, dim*] - -ArrayRef: [name*, subscript*] - -# op: =, +=, /= etc. -# -Assignment: [op, lvalue*, rvalue*] - -BinaryOp: [op, left*, right*] - -Break: [] - -Case: [expr*, stmts**] - -Cast: [to_type*, expr*] - -# Compound statement in C99 is a list of block items (declarations or -# statements). -# -Compound: [block_items**] - -# Compound literal (anonymous aggregate) for C99. -# (type-name) {initializer_list} -# type: the typename -# init: InitList for the initializer list -# -CompoundLiteral: [type*, init*] - -# type: int, char, float, etc. see CLexer for constant token types -# -Constant: [type, value] - -Continue: [] - -# name: the variable being declared -# quals: list of qualifiers (const, volatile) -# funcspec: list function specifiers (i.e. inline in C99) -# storage: list of storage specifiers (extern, register, etc.) -# type: declaration type (probably nested with all the modifiers) -# init: initialization value, or None -# bitsize: bit field size, or None -# -Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] - -DeclList: [decls**] - -Default: [stmts**] - -DoWhile: [cond*, stmt*] - -# Represents the ellipsis (...) parameter in a function -# declaration -# -EllipsisParam: [] - -# An empty statement (a semicolon ';' on its own) -# -EmptyStatement: [] - -# Enumeration type specifier -# name: an optional ID -# values: an EnumeratorList -# -Enum: [name, values*] - -# A name/value pair for enumeration values -# -Enumerator: [name, value*] - -# A list of enumerators -# -EnumeratorList: [enumerators**] - -# A list of expressions separated by the comma operator. -# -ExprList: [exprs**] - -# This is the top of the AST, representing a single C file (a -# translation unit in K&R jargon). It contains a list of -# "external-declaration"s, which is either declarations (Decl), -# Typedef or function definitions (FuncDef). -# -FileAST: [ext**] - -# for (init; cond; next) stmt -# -For: [init*, cond*, next*, stmt*] - -# name: Id -# args: ExprList -# -FuncCall: [name*, args*] - -# type (args) -# -FuncDecl: [args*, type*] - -# Function definition: a declarator for the function name and -# a body, which is a compound statement. -# There's an optional list of parameter declarations for old -# K&R-style definitions -# -FuncDef: [decl*, param_decls**, body*] - -Goto: [name] - -ID: [name] - -# Holder for types that are a simple identifier (e.g. the built -# ins void, char etc. and typedef-defined types) -# -IdentifierType: [names] - -If: [cond*, iftrue*, iffalse*] - -# An initialization list used for compound literals. -# -InitList: [exprs**] - -Label: [name, stmt*] - -# A named initializer for C99. -# The name of a NamedInitializer is a sequence of Nodes, because -# names can be hierarchical and contain constant expressions. -# -NamedInitializer: [name**, expr*] - -# a list of comma separated function parameter declarations -# -ParamList: [params**] - -PtrDecl: [quals, type*] - -Return: [expr*] - -# name: struct tag name -# decls: declaration of members -# -Struct: [name, decls**] - -# type: . or -> -# name.field or name->field -# -StructRef: [name*, type, field*] - -Switch: [cond*, stmt*] - -# cond ? iftrue : iffalse -# -TernaryOp: [cond*, iftrue*, iffalse*] - -# A base type declaration -# -TypeDecl: [declname, quals, type*] - -# A typedef declaration. -# Very similar to Decl, but without some attributes -# -Typedef: [name, quals, storage, type*] - -Typename: [quals, type*] - -UnaryOp: [op, expr*] - -# name: union tag name -# decls: declaration of members -# -Union: [name, decls**] - -While: [cond*, stmt*] - - - +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Copyright (C) 2008-2015, Eli Bendersky +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, etc. see CLexer for constant token types +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] diff --git a/lib_pypy/cffi/_pycparser/ast_transforms.py b/lib_pypy/cffi/_pycparser/ast_transforms.py --- a/lib_pypy/cffi/_pycparser/ast_transforms.py +++ b/lib_pypy/cffi/_pycparser/ast_transforms.py @@ -3,7 +3,7 @@ # # Some utilities used by the parser to create a friendlier AST. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ @@ -84,7 +84,7 @@ _extract_nested_case(child, new_compound.block_items) last_case = new_compound.block_items[-1] else: - # Other statements are added as childrent to the last case, if it + # Other statements are added as children to the last case, if it # exists. if last_case is None: new_compound.block_items.append(child) diff --git a/lib_pypy/cffi/_pycparser/c_ast.py b/lib_pypy/cffi/_pycparser/c_ast.py --- a/lib_pypy/cffi/_pycparser/c_ast.py +++ b/lib_pypy/cffi/_pycparser/c_ast.py @@ -1,7 +1,7 @@ #----------------------------------------------------------------- # ** ATTENTION ** # This code was automatically generated from the file: -# _c_ast.cfg +# _c_ast.cfg # # Do not modify it directly. Modify the configuration file and # run the generator again. @@ -11,7 +11,7 @@ # # AST Node classes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #----------------------------------------------------------------- @@ -20,6 +20,7 @@ class Node(object): + __slots__ = () """ Abstract base class for AST nodes. """ def children(self): @@ -30,21 +31,21 @@ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): """ Pretty print the Node and all its attributes and children (recursively) to a buffer. - - buf: + + buf: Open IO buffer into which the Node is printed. - - offset: - Initial offset (amount of leading spaces) - + + offset: + Initial offset (amount of leading spaces) + attrnames: True if you want to see the attribute names in name=value pairs. False to only see the values. - + nodenames: - True if you want to see the actual node names + True if you want to see the actual node names within their parents. - + showcoord: Do you want the coordinates of each Node to be displayed. @@ -79,47 +80,47 @@ class NodeVisitor(object): - """ A base NodeVisitor class for visiting c_ast nodes. + """ A base NodeVisitor class for visiting c_ast nodes. Subclass it and define your own visit_XXX methods, where - XXX is the class name you want to visit with these + XXX is the class name you want to visit with these methods. - + For example: - + class ConstantVisitor(NodeVisitor): def __init__(self): self.values = [] - + def visit_Constant(self, node): self.values.append(node.value) - Creates a list of values of all the constant nodes + Creates a list of values of all the constant nodes encountered below the given node. To use it: - + cv = ConstantVisitor() cv.visit(node) - + Notes: - - * generic_visit() will be called for AST nodes for which - no visit_XXX method was defined. - * The children of nodes for which a visit_XXX was + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was defined will not be visited - if you need this, call - generic_visit() on the node. + generic_visit() on the node. You can use: NodeVisitor.generic_visit(self, node) * Modeled after Python's own AST visiting facilities (the ast module of Python 3.0) """ def visit(self, node): - """ Visit a node. + """ Visit a node. """ method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) - + def generic_visit(self, node): - """ Called if no explicit visitor function exists for a + """ Called if no explicit visitor function exists for a node. Implements preorder visiting of the node. """ for c_name, c in node.children(): @@ -127,9 +128,11 @@ class ArrayDecl(Node): - def __init__(self, type, dim, coord=None): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): self.type = type self.dim = dim + self.dim_quals = dim_quals self.coord = coord def children(self): @@ -138,9 +141,10 @@ if self.dim is not None: nodelist.append(("dim", self.dim)) return tuple(nodelist) - attr_names = () + attr_names = ('dim_quals', ) class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') def __init__(self, name, subscript, coord=None): self.name = name self.subscript = subscript @@ -155,6 +159,7 @@ attr_names = () class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') def __init__(self, op, lvalue, rvalue, coord=None): self.op = op self.lvalue = lvalue @@ -167,9 +172,10 @@ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') def __init__(self, op, left, right, coord=None): self.op = op self.left = left @@ -182,9 +188,10 @@ if self.right is not None: nodelist.append(("right", self.right)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Break(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -194,6 +201,7 @@ attr_names = () class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') def __init__(self, expr, stmts, coord=None): self.expr = expr self.stmts = stmts @@ -209,6 +217,7 @@ attr_names = () class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') def __init__(self, to_type, expr, coord=None): self.to_type = to_type self.expr = expr @@ -223,6 +232,7 @@ attr_names = () class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') def __init__(self, block_items, coord=None): self.block_items = block_items self.coord = coord @@ -236,6 +246,7 @@ attr_names = () class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') def __init__(self, type, init, coord=None): self.type = type self.init = init @@ -250,6 +261,7 @@ attr_names = () class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') def __init__(self, type, value, coord=None): self.type = type self.value = value @@ -259,9 +271,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('type','value',) + attr_names = ('type', 'value', ) class Continue(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -271,6 +284,7 @@ attr_names = () class Decl(Node): + __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None): self.name = name self.quals = quals @@ -288,9 +302,10 @@ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) return tuple(nodelist) - attr_names = ('name','quals','storage','funcspec',) + attr_names = ('name', 'quals', 'storage', 'funcspec', ) class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') def __init__(self, decls, coord=None): self.decls = decls self.coord = coord @@ -304,6 +319,7 @@ attr_names = () class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') def __init__(self, stmts, coord=None): self.stmts = stmts self.coord = coord @@ -317,6 +333,7 @@ attr_names = () class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -331,6 +348,7 @@ attr_names = () class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -340,6 +358,7 @@ attr_names = () class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') def __init__(self, coord=None): self.coord = coord @@ -349,6 +368,7 @@ attr_names = () class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') def __init__(self, name, values, coord=None): self.name = name self.values = values @@ -359,9 +379,10 @@ if self.values is not None: nodelist.append(("values", self.values)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') def __init__(self, name, value, coord=None): self.name = name self.value = value @@ -372,9 +393,10 @@ if self.value is not None: nodelist.append(("value", self.value)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') def __init__(self, enumerators, coord=None): self.enumerators = enumerators self.coord = coord @@ -388,6 +410,7 @@ attr_names = () class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -401,6 +424,7 @@ attr_names = () class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') def __init__(self, ext, coord=None): self.ext = ext self.coord = coord @@ -414,6 +438,7 @@ attr_names = () class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') def __init__(self, init, cond, next, stmt, coord=None): self.init = init self.cond = cond @@ -432,6 +457,7 @@ attr_names = () class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') def __init__(self, name, args, coord=None): self.name = name self.args = args @@ -446,6 +472,7 @@ attr_names = () class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') def __init__(self, args, type, coord=None): self.args = args self.type = type @@ -460,6 +487,7 @@ attr_names = () class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') def __init__(self, decl, param_decls, body, coord=None): self.decl = decl self.param_decls = param_decls @@ -477,6 +505,7 @@ attr_names = () class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -485,9 +514,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') def __init__(self, name, coord=None): self.name = name self.coord = coord @@ -496,9 +526,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') def __init__(self, names, coord=None): self.names = names self.coord = coord @@ -507,9 +538,10 @@ nodelist = [] return tuple(nodelist) - attr_names = ('names',) + attr_names = ('names', ) class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -526,6 +558,7 @@ attr_names = () class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') def __init__(self, exprs, coord=None): self.exprs = exprs self.coord = coord @@ -539,6 +572,7 @@ attr_names = () class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') def __init__(self, name, stmt, coord=None): self.name = name self.stmt = stmt @@ -549,9 +583,10 @@ if self.stmt is not None: nodelist.append(("stmt", self.stmt)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') def __init__(self, name, expr, coord=None): self.name = name self.expr = expr @@ -567,6 +602,7 @@ attr_names = () class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') def __init__(self, params, coord=None): self.params = params self.coord = coord @@ -580,6 +616,7 @@ attr_names = () class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') def __init__(self, quals, type, coord=None): self.quals = quals self.type = type @@ -590,9 +627,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('quals', ) class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') def __init__(self, expr, coord=None): self.expr = expr self.coord = coord @@ -605,6 +643,7 @@ attr_names = () class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -616,9 +655,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') def __init__(self, name, type, field, coord=None): self.name = name self.type = type @@ -631,9 +671,10 @@ if self.field is not None: nodelist.append(("field", self.field)) return tuple(nodelist) - attr_names = ('type',) + attr_names = ('type', ) class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt @@ -648,6 +689,7 @@ attr_names = () class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') def __init__(self, cond, iftrue, iffalse, coord=None): self.cond = cond self.iftrue = iftrue @@ -664,6 +706,7 @@ attr_names = () class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__') def __init__(self, declname, quals, type, coord=None): self.declname = declname self.quals = quals @@ -675,9 +718,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('declname','quals',) + attr_names = ('declname', 'quals', ) class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') def __init__(self, name, quals, storage, type, coord=None): self.name = name self.quals = quals @@ -690,10 +734,12 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('name','quals','storage',) + attr_names = ('name', 'quals', 'storage', ) class Typename(Node): - def __init__(self, quals, type, coord=None): + __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, type, coord=None): + self.name = name self.quals = quals self.type = type self.coord = coord @@ -703,9 +749,10 @@ if self.type is not None: nodelist.append(("type", self.type)) return tuple(nodelist) - attr_names = ('quals',) + attr_names = ('name', 'quals', ) class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') def __init__(self, op, expr, coord=None): self.op = op self.expr = expr @@ -716,9 +763,10 @@ if self.expr is not None: nodelist.append(("expr", self.expr)) return tuple(nodelist) - attr_names = ('op',) + attr_names = ('op', ) class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') def __init__(self, name, decls, coord=None): self.name = name self.decls = decls @@ -730,9 +778,10 @@ nodelist.append(("decls[%d]" % i, child)) return tuple(nodelist) - attr_names = ('name',) + attr_names = ('name', ) class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') def __init__(self, cond, stmt, coord=None): self.cond = cond self.stmt = stmt diff --git a/lib_pypy/cffi/_pycparser/c_generator.py b/lib_pypy/cffi/_pycparser/c_generator.py --- a/lib_pypy/cffi/_pycparser/c_generator.py +++ b/lib_pypy/cffi/_pycparser/c_generator.py @@ -3,7 +3,7 @@ # # C code generator from pycparser AST nodes. # -# Copyright (C) 2008-2012, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ from . import c_ast @@ -15,8 +15,6 @@ generic_visit. """ def __init__(self): - self.output = '' - # Statements start with indentation of self.indent_level spaces, using # the _make_indent method # @@ -34,7 +32,7 @@ if node is None: return '' else: - return ''.join(self.visit(c) for c in node.children()) + return ''.join(self.visit(c) for c_name, c in node.children()) def visit_Constant(self, n): return n.value @@ -83,19 +81,22 @@ def visit_IdentifierType(self, n): return ' '.join(n.names) + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + def visit_Decl(self, n, no_type=False): # no_type is used when a Decl is part of a DeclList, where the type is - # explicitly only for the first delaration in a list. + # explicitly only for the first declaration in a list. # s = n.name if no_type else self._generate_decl(n) if n.bitsize: s += ' : ' + self.visit(n.bitsize) if n.init: - if isinstance(n.init, c_ast.InitList): - s += ' = {' + self.visit(n.init) + '}' - elif isinstance(n.init, c_ast.ExprList): - s += ' = (' + self.visit(n.init) + ')' - else: - s += ' = ' + self.visit(n.init) + s += ' = ' + self._visit_expr(n.init) return s def visit_DeclList(self, n): @@ -118,21 +119,13 @@ def visit_ExprList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_InitList(self, n): visited_subexprs = [] for expr in n.exprs: - if isinstance(expr, c_ast.ExprList): - visited_subexprs.append('(' + self.visit(expr) + ')') - elif isinstance(expr, c_ast.InitList): - visited_subexprs.append('{' + self.visit(expr) + '}') - else: - visited_subexprs.append(self.visit(expr)) + visited_subexprs.append(self._visit_expr(expr)) return ', '.join(visited_subexprs) def visit_Enum(self, n): @@ -195,9 +188,9 @@ return 'continue;' def visit_TernaryOp(self, n): - s = self.visit(n.cond) + ' ? ' - s += self.visit(n.iftrue) + ' : ' - s += self.visit(n.iffalse) + s = self._visit_expr(n.cond) + ' ? ' + s += self._visit_expr(n.iftrue) + ' : ' + s += self._visit_expr(n.iffalse) return s def visit_If(self, n): @@ -281,6 +274,9 @@ s += ' = ' + self.visit(n.expr) return s + def visit_FuncDecl(self, n): + return self._generate_type(n) + def _generate_struct_union(self, n, name): """ Generates code for structs and unions. name should be either 'struct' or union. @@ -384,7 +380,7 @@ """ Visits 'n' and returns its string representation, parenthesized if the condition function applied to the node returns True. """ - s = self.visit(n) + s = self._visit_expr(n) if condition(n): return '(' + s + ')' else: @@ -401,5 +397,3 @@ """ return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef, c_ast.StructRef, c_ast.FuncCall)) - - diff --git a/lib_pypy/cffi/_pycparser/c_lexer.py b/lib_pypy/cffi/_pycparser/c_lexer.py --- a/lib_pypy/cffi/_pycparser/c_lexer.py +++ b/lib_pypy/cffi/_pycparser/c_lexer.py @@ -3,7 +3,7 @@ # # CLexer class: lexer for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -102,7 +102,8 @@ keywords = ( '_BOOL', '_COMPLEX', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', - 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', @@ -129,7 +130,7 @@ 'TYPEID', # constants - 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'FLOAT_CONST', 'HEX_FLOAT_CONST', 'CHAR_CONST', 'WCHAR_CONST', @@ -183,12 +184,15 @@ hex_prefix = '0[xX]' hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' # integer constants (K&R2: A.2.5.1) integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' octal_constant = '0[0-7]*'+integer_suffix_opt hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt bad_octal_constant = '0[0-7]*[89]' @@ -302,7 +306,7 @@ r'pragma' pass - t_pppragma_ignore = ' \t<>.-{}();+-*/$%@&^~!?:,0123456789' + t_pppragma_ignore = ' \t<>.-{}();=+-*/$%@&^~!?:,0123456789' @TOKEN(string_literal) def t_pppragma_STR(self, t): pass @@ -419,6 +423,10 @@ def t_INT_CONST_HEX(self, t): return t + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + @TOKEN(bad_octal_constant) def t_BAD_CONST_OCT(self, t): msg = "Invalid octal constant" diff --git a/lib_pypy/cffi/_pycparser/c_parser.py b/lib_pypy/cffi/_pycparser/c_parser.py --- a/lib_pypy/cffi/_pycparser/c_parser.py +++ b/lib_pypy/cffi/_pycparser/c_parser.py @@ -3,7 +3,7 @@ # # CParser class: Parser and AST builder for the C language # -# Copyright (C) 2008-2013, Eli Bendersky +# Copyright (C) 2008-2015, Eli Bendersky # License: BSD #------------------------------------------------------------------------------ import re @@ -23,7 +23,8 @@ lextab='cffi._pycparser.lextab', yacc_optimize=True, yacctab='cffi._pycparser.yacctab', - yacc_debug=False): + yacc_debug=False, + taboutputdir=''): """ Create a new CParser. Some arguments for controlling the debug/optimization @@ -64,6 +65,10 @@ yacc_debug: Generate a parser.out file that explains how yacc built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. """ self.clex = CLexer( error_func=self._lex_error_func, @@ -73,7 +78,8 @@ self.clex.build( optimize=lex_optimize, - lextab=lextab) + lextab=lextab, + outputdir=taboutputdir) self.tokens = self.clex.tokens rules_with_opt = [ @@ -85,6 +91,7 @@ 'expression', 'identifier_list', 'init_declarator_list', + 'initializer_list', 'parameter_type_list', 'specifier_qualifier_list', 'block_item_list', @@ -100,7 +107,8 @@ start='translation_unit_or_empty', debug=yacc_debug, optimize=yacc_optimize, - tabmodule=yacctab) + tabmodule=yacctab, + outputdir=taboutputdir) # Stack of scopes for keeping track of symbols. _scope_stack[-1] is # the current (topmost) scope. Each scope is a dictionary that @@ -211,13 +219,11 @@ # The basic declaration here is 'int c', and the pointer and # the array are the modifiers. # - # Basic declarations are represented by TypeDecl (from module - # c_ast) and the modifiers are FuncDecl, PtrDecl and - # ArrayDecl. + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. # - # The standard states that whenever a new modifier is parsed, - # it should be added to the end of the list of modifiers. For - # example: + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: # # K&R2 A.8.6.2: Array Declarators # @@ -236,7 +242,6 @@ # useful for pointers, that can come as a chain from the rule # p_pointer. In this case, the whole modifier list is spliced # into the new location. - # def _type_modify_decl(self, decl, modifier): """ Tacks a type modifier on a declarator, and returns the modified declarator. @@ -983,28 +988,52 @@ p[0] = p[2] def p_direct_declarator_3(self, p): - """ direct_declarator : direct_declarator LBRACKET assignment_expression_opt RBRACKET + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 arr = c_ast.ArrayDecl( type=None, - dim=p[3], + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_declarator_4(self, p): + """ direct_declarator : direct_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) # Special for VLAs # - def p_direct_declarator_4(self, p): - """ direct_declarator : direct_declarator LBRACKET TIMES RBRACKET + def p_direct_declarator_5(self, p): + """ direct_declarator : direct_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET """ arr = c_ast.ArrayDecl( type=None, - dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim=c_ast.ID(p[4], self._coord(p.lineno(4))), + dim_quals=p[3] if p[3] != None else [], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) - def p_direct_declarator_5(self, p): + def p_direct_declarator_6(self, p): """ direct_declarator : direct_declarator LPAREN parameter_type_list RPAREN | direct_declarator LPAREN identifier_list_opt RPAREN """ @@ -1037,11 +1066,30 @@ | TIMES type_qualifier_list_opt pointer """ coord = self._coord(p.lineno(1)) - - p[0] = c_ast.PtrDecl( - quals=p[2] or [], - type=p[3] if len(p) > 3 else None, - coord=coord) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type def p_type_qualifier_list(self, p): """ type_qualifier_list : type_qualifier @@ -1101,6 +1149,7 @@ # else: decl = c_ast.Typename( + name='', quals=spec['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1125,10 +1174,13 @@ p[0] = p[1] def p_initializer_2(self, p): - """ initializer : brace_open initializer_list brace_close + """ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close """ - p[0] = p[2] + if p[2] is None: + p[0] = c_ast.InitList([], self._coord(p.lineno(1))) + else: + p[0] = p[2] def p_initializer_list(self, p): """ initializer_list : designation_opt initializer @@ -1172,6 +1224,7 @@ #~ print '==========' typename = c_ast.Typename( + name='', quals=p[1]['qual'], type=p[2] or c_ast.TypeDecl(None, None, None), coord=self._coord(p.lineno(2))) @@ -1211,6 +1264,7 @@ arr = c_ast.ArrayDecl( type=None, dim=p[3], + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1221,6 +1275,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=p[2], + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_4(self, p): @@ -1229,6 +1284,7 @@ arr = c_ast.ArrayDecl( type=None, dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=p[1].coord) p[0] = self._type_modify_decl(decl=p[1], modifier=arr) @@ -1239,6 +1295,7 @@ p[0] = c_ast.ArrayDecl( type=c_ast.TypeDecl(None, None, None), dim=c_ast.ID(p[3], self._coord(p.lineno(3))), + dim_quals=[], coord=self._coord(p.lineno(1))) def p_direct_abstract_declarator_6(self, p): @@ -1322,7 +1379,8 @@ def p_iteration_statement_4(self, p): """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement """ - p[0] = c_ast.For(c_ast.DeclList(p[3]), p[4], p[6], p[8], self._coord(p.lineno(1))) + p[0] = c_ast.For(c_ast.DeclList(p[3], self._coord(p.lineno(1))), + p[4], p[6], p[8], self._coord(p.lineno(1))) def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ @@ -1525,6 +1583,14 @@ """ primary_expression : LPAREN expression RPAREN """ p[0] = p[2] + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA identifier RPAREN + """ + coord = self._coord(p.lineno(1)) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + def p_argument_expression_list(self, p): """ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression @@ -1543,6 +1609,7 @@ """ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX + | INT_CONST_BIN """ p[0] = c_ast.Constant( 'int', p[1], self._coord(p.lineno(1))) @@ -1585,7 +1652,7 @@ p[0] = c_ast.Constant( 'string', p[1], self._coord(p.lineno(1))) else: - p[1].value = p[1].value.rstrip[:-1] + p[2][1:] + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] p[0] = p[1] def p_brace_open(self, p): diff --git a/lib_pypy/cffi/_pycparser/lextab.py b/lib_pypy/cffi/_pycparser/lextab.py --- a/lib_pypy/cffi/_pycparser/lextab.py +++ b/lib_pypy/cffi/_pycparser/lextab.py @@ -1,9 +1,9 @@ # pycparser.lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' -_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} +_lextokens = {'VOID': 1, 'LBRACKET': 1, 'WCHAR_CONST': 1, 'FLOAT_CONST': 1, 'MINUS': 1, 'RPAREN': 1, 'LONG': 1, 'PLUS': 1, 'ELLIPSIS': 1, 'GT': 1, 'GOTO': 1, 'ENUM': 1, 'PERIOD': 1, 'GE': 1, 'INT_CONST_DEC': 1, 'ARROW': 1, 'HEX_FLOAT_CONST': 1, 'DOUBLE': 1, 'MINUSEQUAL': 1, 'INT_CONST_OCT': 1, 'TIMESEQUAL': 1, 'OR': 1, 'SHORT': 1, 'RETURN': 1, 'RSHIFTEQUAL': 1, 'RESTRICT': 1, 'STATIC': 1, 'SIZEOF': 1, 'UNSIGNED': 1, 'UNION': 1, 'COLON': 1, 'WSTRING_LITERAL': 1, 'DIVIDE': 1, 'FOR': 1, 'PLUSPLUS': 1, 'EQUALS': 1, 'ELSE': 1, 'INLINE': 1, 'EQ': 1, 'AND': 1, 'TYPEID': 1, 'LBRACE': 1, 'PPHASH': 1, 'INT': 1, 'SIGNED': 1, 'CONTINUE': 1, 'NOT': 1, 'OREQUAL': 1, 'MOD': 1, 'RSHIFT': 1, 'DEFAULT': 1, 'CHAR': 1, 'WHILE': 1, 'DIVEQUAL': 1, 'EXTERN': 1, 'CASE': 1, 'LAND': 1, 'REGISTER': 1, 'MODEQUAL': 1, 'NE': 1, 'SWITCH': 1, 'INT_CONST_HEX': 1, '_COMPLEX': 1, 'PLUSEQUAL': 1, 'STRUCT': 1, 'CONDOP': 1, 'BREAK': 1, 'VOLATILE': 1, 'ANDEQUAL': 1, 'INT_CONST_BIN': 1, 'DO': 1, 'LNOT': 1, 'CONST': 1, 'LOR': 1, 'CHAR_CONST': 1, 'LSHIFT': 1, 'RBRACE': 1, '_BOOL': 1, 'LE': 1, 'SEMI': 1, 'LT': 1, 'COMMA': 1, 'OFFSETOF': 1, 'TYPEDEF': 1, 'XOR': 1, 'AUTO': 1, 'TIMES': 1, 'LPAREN': 1, 'MINUSMINUS': 1, 'ID': 1, 'IF': 1, 'STRING_LITERAL': 1, 'FLOAT': 1, 'XOREQUAL': 1, 'LSHIFTEQUAL': 1, 'RBRACKET': 1} _lexreflags = 0 From noreply at buildbot.pypy.org Wed Nov 25 03:35:58 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 09:35:58 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: Test (and fix in the untranslated emulation) for hashtable iteration Message-ID: <20151125083558.9FF801C089E@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8 Changeset: r80929:cd51c596c3f9 Date: 2015-11-25 09:36 +0100 http://bitbucket.org/pypy/pypy/changeset/cd51c596c3f9/ Log: Test (and fix in the untranslated emulation) for hashtable iteration diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -432,7 +432,10 @@ self.iterator = iterator def next(self): - return next(self.iterator) + while 1: + entry = next(self.iterator) + if entry._obj: + return entry # ____________________________________________________________ diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py --- a/rpython/translator/stm/test/test_ztranslated.py +++ b/rpython/translator/stm/test/test_ztranslated.py @@ -769,3 +769,33 @@ t, cbuilder = self.compile(main) data = cbuilder.cmdexec('') assert 'ok!\n' in data + + def test_hashtable(self): + # minimal test + FOO = lltype.GcStruct('FOO') + + def main(argv): + h = rstm.create_hashtable() + assert h.list()[1] == 0 + foo = lltype.malloc(FOO) + h.set(123, lltype.cast_opaque_ptr(llmemory.GCREF, foo)) + assert h.list()[1] == 1 + assert h.get(123) == lltype.cast_opaque_ptr(llmemory.GCREF, foo) + assert h.get(234) == lltype.nullptr(llmemory.GCREF.TO) + hiter = h.iterentries() + entry = hiter.next() + try: + hiter.next() + except StopIteration: + pass + else: + print "hiter.next() should return only once here" + assert 0 + assert entry.index == 123 + print "ok!" + return 0 + + main([]) + t, cbuilder = self.compile(main) + data = cbuilder.cmdexec('') + assert 'ok!\n' in data From noreply at buildbot.pypy.org Wed Nov 25 03:43:36 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 09:43:36 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151125084336.1BC711C0337@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r661:20b4afc45b94 Date: 2015-11-25 09:44 +0100 http://bitbucket.org/pypy/pypy.org/changeset/20b4afc45b94/ Log: update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -15,7 +15,7 @@ - $61393 of $105000 (58.5%) + $61398 of $105000 (58.5%)
    @@ -23,7 +23,7 @@
  • From noreply at buildbot.pypy.org Wed Nov 25 03:45:19 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 09:45:19 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: whack enough to start passing first blackhole resume Message-ID: <20151125084519.9F2611C0337@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80930:9661ee702ee2 Date: 2015-11-25 10:45 +0200 http://bitbucket.org/pypy/pypy/changeset/9661ee702ee2/ Log: whack enough to start passing first blackhole resume diff --git a/rpython/jit/codewriter/jitcode.py b/rpython/jit/codewriter/jitcode.py --- a/rpython/jit/codewriter/jitcode.py +++ b/rpython/jit/codewriter/jitcode.py @@ -141,18 +141,14 @@ def get_register_index_f(self, index): return ord(self.live_f[index]) - def enumerate_vars(self, callback_i, callback_r, callback_f, spec): - xxx - index = 0 + def enumerate_vars(self, callback_i, callback_r, callback_f, spec, index): for i in range(self.get_register_count_i()): - callback_i(index, self.get_register_index_i(i)) - index += 1 + index = callback_i(index, self.get_register_index_i(i)) for i in range(self.get_register_count_r()): - callback_r(index, self.get_register_index_r(i)) - index += 1 + index = callback_r(index, self.get_register_index_r(i)) for i in range(self.get_register_count_f()): - callback_f(index, self.get_register_index_f(i)) - index += 1 + index = callback_f(index, self.get_register_index_f(i)) + return index enumerate_vars._annspecialcase_ = 'specialize:arg(4)' _liveness_cache = {} diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -211,7 +211,7 @@ class NumberingState(object): def __init__(self, snapshot_list): self.liveboxes = {} - self.current = [None] * self.count_boxes(snapshot_list) + self.current = [rffi.cast(rffi.SHORT, 0)] * self.count_boxes(snapshot_list) self.position = len(self.current) self.n = 0 self.v = 0 @@ -285,7 +285,6 @@ v = state.v liveboxes = state.liveboxes length = len(boxes) - state.position -= length for i in range(length): box = boxes[i] box = optimizer.get_box_replacement(box) @@ -312,7 +311,7 @@ state.append(tagged) state.n = n state.v = v - state.position -= length + state.position -= length + 2 # def _get_prev_snapshot(self, snapshot): # cur_snapshot = snapshot @@ -341,17 +340,17 @@ # we want to number snapshots starting from the back, but ending # with a forward list for i in range(len(snapshot_list) - 1, -1, -1): - self._number_boxes(snapshot_list[i].boxes, optimizer, state) + state.position -= len(snapshot_list[i].boxes) if i != 0: frameinfo = framestack_list[i - 1] jitcode_pos, pc = unpack_uint(frameinfo.packed_jitcode_pc) state.position -= 2 state.append(rffi.cast(rffi.USHORT, jitcode_pos)) state.append(rffi.cast(rffi.USHORT, pc)) - state.position -= 2 + self._number_boxes(snapshot_list[i].boxes, optimizer, state) numb = resumecode.create_numbering(state.current, - lltype.nullptr(resumecode.NUMBERING), 0) + lltype.nullptr(resumecode.NUMBERING), 0, len(vref_snapshot.boxes)) return numb, state.liveboxes, state.v @@ -1003,6 +1002,16 @@ self._prepare_virtuals(storage.rd_virtuals) self._prepare_pendingfields(storage.rd_pendingfields) + def read_jitcode_pos_pc(self): + jitcode_pos, self.cur_index = resumecode.numb_next_item(self.numb, + self.cur_index) + pc, self.cur_index = resumecode.numb_next_item(self.numb, + self.cur_index) + return jitcode_pos, pc + + def done_reading(self): + return self.cur_index >= len(self.numb.code) + def getvirtual_ptr(self, index): # Returns the index'th virtual, building it lazily if needed. # Note that this may be called recursively; that's why the @@ -1388,33 +1397,26 @@ rstack._stack_criticalcode_stop() # # First get a chain of blackhole interpreters whose length is given - # by the depth of rd_frame_info_list. The first one we get must be + # by the positions in the numbering. The first one we get must be # the bottom one, i.e. the last one in the chain, in order to make # the comment in BlackholeInterpreter.setposition() valid. - nextbh = None - numbering = storage.rd_numb.prev + prevbh = None + firstbh = None + curbh = None while True: curbh = blackholeinterpbuilder.acquire_interp() - curbh.nextblackholeinterp = nextbh - nextbh = curbh - numbering = numbering.prev - if not numbering: - break - firstbh = nextbh - # - # Now fill the blackhole interpreters with resume data. - curbh = firstbh - xxxx - numbering = storage.rd_numb.prev - while True: - jitcode_pos, pc = unpack_uint(numbering.packed_jitcode_pc) + if prevbh is not None: + prevbh.nextblackholeinterp = curbh + else: + firstbh = curbh + prevbh = curbh + jitcode_pos, pc = resumereader.read_jitcode_pos_pc() jitcode = jitcodes[jitcode_pos] curbh.setposition(jitcode, pc) resumereader.consume_one_section(curbh) - curbh = curbh.nextblackholeinterp - numbering = numbering.prev - if not numbering: + if resumereader.done_reading(): break + curbh.nextblackholeinterp = None return firstbh def force_from_resumedata(metainterp_sd, storage, deadframe, vinfo, ginfo): @@ -1457,7 +1459,7 @@ info = blackholeinterp.get_current_position_info() self._prepare_next_section(info) - def consume_virtualref_info(self, vrefinfo, numb, end): + def consume_virtualref_info(self, vrefinfo, end): # we have to decode a list of references containing pairs # [..., virtual, vref, ...] stopping at 'end' if vrefinfo is None: @@ -1470,12 +1472,15 @@ # For each pair, we store the virtual inside the vref. vrefinfo.continue_tracing(vref, virtual) - def consume_vable_info(self, vinfo, numb): + def consume_vable_info(self, vinfo): # we have to ignore the initial part of 'nums' (containing vrefs), # find the virtualizable from nums[-1], load all other values # from the CPU stack, and copy them into the virtualizable + numb = self.numb + first_snapshot_size = rffi.cast(lltype.Signed, numb.first_snapshot_size) if vinfo is None: - return len(numb.nums) + return first_snapshot_size + xxx index = len(numb.nums) - 1 virtualizable = self.decode_ref(numb.nums[index]) # just reset the token, we'll force it later @@ -1497,14 +1502,11 @@ load_value_of_type._annspecialcase_ = 'specialize:arg(1)' def consume_vref_and_vable(self, vrefinfo, vinfo, ginfo): - xxx - numb = self.cur_numb - self.cur_numb = numb.prev if self.resume_after_guard_not_forced != 2: - end_vref = self.consume_vable_info(vinfo, numb) + end_vref = self.consume_vable_info(vinfo) if ginfo is not None: end_vref -= 1 - self.consume_virtualref_info(vrefinfo, numb, end_vref) + self.consume_virtualref_info(vrefinfo, end_vref) def allocate_with_vtable(self, descr=None): from rpython.jit.metainterp.executor import exec_new_with_vtable diff --git a/rpython/jit/metainterp/resumecode.py b/rpython/jit/metainterp/resumecode.py --- a/rpython/jit/metainterp/resumecode.py +++ b/rpython/jit/metainterp/resumecode.py @@ -15,19 +15,21 @@ NUMBERING = lltype.GcStruct('Numbering', ('prev', NUMBERINGP), ('prev_index', rffi.USHORT), + ('first_snapshot_size', rffi.USHORT), # ugh, ugly ('code', lltype.Array(rffi.SHORT))) NUMBERINGP.TO.become(NUMBERING) NULL_NUMBER = lltype.nullptr(NUMBERING) -def create_numbering(lst, prev, prev_index): +def create_numbering(lst, prev, prev_index, first_snapshot_size): numb = lltype.malloc(NUMBERING, len(lst)) for i in range(len(lst)): numb.code[i] = rffi.cast(rffi.SHORT, lst[i]) numb.prev = prev numb.prev_index = rffi.cast(rffi.USHORT, prev_index) + numb.first_snapshot_size = rffi.cast(rffi.USHORT, first_snapshot_size) return numb -def _create_numbering(lst, prev, prev_index): +def _create_numbering(lst, prev, prev_index, first_snapshot_size): count = 0 for item in lst: if item < 0: @@ -39,6 +41,7 @@ numb = lltype.malloc(NUMBERING, count) numb.prev = prev numb.prev_index = rffi.cast(rffi.USHORT, prev_index) + numb.first_snapshot_size = rffi.cast(rffi.USHORT, first_snapshot_size) index = 0 for item in lst: if 0 <= item <= 128: diff --git a/rpython/jit/metainterp/test/test_resume.py b/rpython/jit/metainterp/test/test_resume.py --- a/rpython/jit/metainterp/test/test_resume.py +++ b/rpython/jit/metainterp/test/test_resume.py @@ -279,7 +279,7 @@ def Numbering(nums): - numb = create_numbering(nums, NULL_NUMBER, 0) + numb = create_numbering(nums, NULL_NUMBER, 0, 0) return numb def tagconst(i): @@ -947,8 +947,9 @@ assert v == 0 assert liveboxes3 == {b1: tag(0, TAGBOX), b2: tag(1, TAGBOX)} - assert unpack_numbering(numb3) == [tag(3, TAGINT), tag(4, TAGINT), tag(0, TAGBOX), - tag(3, TAGINT), 0, 0] + base + assert unpack_numbering(numb3) == [tag(3, TAGINT), tag(4, TAGINT), + tag(0, TAGBOX), + tag(3, TAGINT), 0, 0] + base # virtual env4 = [c3, b4, b1, c3] From noreply at buildbot.pypy.org Wed Nov 25 04:48:10 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 10:48:10 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: push push push Message-ID: <20151125094810.ACB841C146D@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80931:184e3ab9ec43 Date: 2015-11-25 11:48 +0200 http://bitbucket.org/pypy/pypy/changeset/184e3ab9ec43/ Log: push push push diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -1115,22 +1115,17 @@ def rebuild_from_resumedata(metainterp, storage, deadframe, virtualizable_info, greenfield_info): - xxx resumereader = ResumeDataBoxReader(storage, deadframe, metainterp) boxes = resumereader.consume_vref_and_vable_boxes(virtualizable_info, greenfield_info) virtualizable_boxes, virtualref_boxes = boxes - frameinfo = storage.rd_numb.prev - while True: - jitcode_pos, pc = unpack_uint(frameinfo.packed_jitcode_pc) + while not resumereader.done_reading(): + jitcode_pos, pc = resumereader.read_jitcode_pos_pc() jitcode = metainterp.staticdata.jitcodes[jitcode_pos] f = metainterp.newframe(jitcode) f.setup_resume_at_op(pc) resumereader.consume_boxes(f.get_current_position_info(), f.registers_i, f.registers_r, f.registers_f) - frameinfo = frameinfo.prev - if not frameinfo: - break metainterp.framestack.reverse() return resumereader.liveboxes, virtualizable_boxes, virtualref_boxes @@ -1162,27 +1157,28 @@ virtualizable = vinfo.unwrap_virtualizable_box(virtualizablebox) return vinfo.load_list_of_boxes(virtualizable, self, numb) - def consume_virtualref_boxes(self, numb, end): + def consume_virtualref_boxes(self, end): # Returns a list of boxes, assumed to be all BoxPtrs. # We leave up to the caller to call vrefinfo.continue_tracing(). assert (end & 1) == 0 return [self.decode_ref(numb.nums[i]) for i in range(end)] def consume_vref_and_vable_boxes(self, vinfo, ginfo): - xxxx - numb = self.cur_numb - self.cur_numb = numb.prev + first_snapshot_size = rffi.cast(lltype.Signed, + self.numb.first_snapshot_size) if vinfo is not None: - virtualizable_boxes = self.consume_virtualizable_boxes(vinfo, numb) + virtualizable_boxes = self.consume_virtualizable_boxes(vinfo) + xxxx end = len(numb.nums) - len(virtualizable_boxes) elif ginfo is not None: + xxx index = len(numb.nums) - 1 virtualizable_boxes = [self.decode_ref(numb.nums[index])] end = len(numb.nums) - 1 else: virtualizable_boxes = None - end = len(numb.nums) - virtualref_boxes = self.consume_virtualref_boxes(numb, end) + end = first_snapshot_size + virtualref_boxes = self.consume_virtualref_boxes(end) return virtualizable_boxes, virtualref_boxes def allocate_with_vtable(self, descr=None): @@ -1403,7 +1399,7 @@ prevbh = None firstbh = None curbh = None - while True: + while not resumereader.done_reading(): curbh = blackholeinterpbuilder.acquire_interp() if prevbh is not None: prevbh.nextblackholeinterp = curbh @@ -1414,8 +1410,6 @@ jitcode = jitcodes[jitcode_pos] curbh.setposition(jitcode, pc) resumereader.consume_one_section(curbh) - if resumereader.done_reading(): - break curbh.nextblackholeinterp = None return firstbh @@ -1467,8 +1461,12 @@ return assert (end & 1) == 0 for i in range(0, end, 2): - virtual = self.decode_ref(numb.nums[i]) - vref = self.decode_ref(numb.nums[i + 1]) + virtual_item, self.cur_index = resumecode.numb_next_item( + self.numb, self.cur_index) + vref_item, self.cur_index = resumecode.numb_next_item( + self.numb, self.cur_index) + virtual = self.decode_ref(virtual_item) + vref = self.decode_ref(vref_item) # For each pair, we store the virtual inside the vref. vrefinfo.continue_tracing(vref, virtual) From noreply at buildbot.pypy.org Wed Nov 25 04:55:21 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 10:55:21 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: fix virtualrefs Message-ID: <20151125095521.D951B1C146D@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80932:5c758bb1b755 Date: 2015-11-25 11:55 +0200 http://bitbucket.org/pypy/pypy/changeset/5c758bb1b755/ Log: fix virtualrefs diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -1161,7 +1161,12 @@ # Returns a list of boxes, assumed to be all BoxPtrs. # We leave up to the caller to call vrefinfo.continue_tracing(). assert (end & 1) == 0 - return [self.decode_ref(numb.nums[i]) for i in range(end)] + lst = [] + for i in range(end): + item, self.cur_index = resumecode.numb_next_item(self.numb, + self.cur_index) + lst.append(self.decode_ref(item)) + return lst def consume_vref_and_vable_boxes(self, vinfo, ginfo): first_snapshot_size = rffi.cast(lltype.Signed, @@ -1179,6 +1184,7 @@ virtualizable_boxes = None end = first_snapshot_size virtualref_boxes = self.consume_virtualref_boxes(end) + self.cur_index = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) return virtualizable_boxes, virtualref_boxes def allocate_with_vtable(self, descr=None): @@ -1505,6 +1511,7 @@ if ginfo is not None: end_vref -= 1 self.consume_virtualref_info(vrefinfo, end_vref) + self.cur_index = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) def allocate_with_vtable(self, descr=None): from rpython.jit.metainterp.executor import exec_new_with_vtable From noreply at buildbot.pypy.org Wed Nov 25 05:08:19 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 11:08:19 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: fix for greenfield Message-ID: <20151125100819.7D9621C1478@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80933:48c73e2ab93e Date: 2015-11-25 12:08 +0200 http://bitbucket.org/pypy/pypy/changeset/48c73e2ab93e/ Log: fix for greenfield diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -1171,19 +1171,18 @@ def consume_vref_and_vable_boxes(self, vinfo, ginfo): first_snapshot_size = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) + end = first_snapshot_size & (~1) # if it's odd, it's -1 + virtualref_boxes = self.consume_virtualref_boxes(end) if vinfo is not None: virtualizable_boxes = self.consume_virtualizable_boxes(vinfo) xxxx end = len(numb.nums) - len(virtualizable_boxes) elif ginfo is not None: - xxx - index = len(numb.nums) - 1 - virtualizable_boxes = [self.decode_ref(numb.nums[index])] - end = len(numb.nums) - 1 + item, self.cur_index = resumecode.numb_next_item(self.numb, + self.cur_index) + virtualizable_boxes = [self.decode_ref(item)] else: virtualizable_boxes = None - end = first_snapshot_size - virtualref_boxes = self.consume_virtualref_boxes(end) self.cur_index = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) return virtualizable_boxes, virtualref_boxes From noreply at buildbot.pypy.org Wed Nov 25 05:22:18 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 11:22:18 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: partial backout of 89a3ecaf0b2d, we no longer need to compare field offsets before translation Message-ID: <20151125102218.E5AD01C02FB@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80934:909baa7fdb8e Date: 2015-11-25 11:09 +0100 http://bitbucket.org/pypy/pypy/changeset/909baa7fdb8e/ Log: partial backout of 89a3ecaf0b2d, we no longer need to compare field offsets before translation diff --git a/rpython/rtyper/lltypesystem/llmemory.py b/rpython/rtyper/lltypesystem/llmemory.py --- a/rpython/rtyper/lltypesystem/llmemory.py +++ b/rpython/rtyper/lltypesystem/llmemory.py @@ -214,20 +214,6 @@ dst = cast_adr_to_ptr(dstadr, PTR) _reccopy(src, dst) - def force_as_int(self): - """ - NOT_RPYTHON - Return the actual offset as an integer. - """ - if self.TYPE._arrayfld: - obj = lltype.malloc(self.TYPE, 0) - else: - obj = lltype.malloc(self.TYPE) - baseadr = cast_ptr_to_adr(obj) - interioradr = baseadr + self - return cast_adr_to_int(interioradr, 'forced') - cast_adr_to_int(baseadr, 'forced') - - class CompositeOffset(AddressOffset): diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py --- a/rpython/rtyper/lltypesystem/opimpl.py +++ b/rpython/rtyper/lltypesystem/opimpl.py @@ -103,13 +103,6 @@ def op_int_eq(x, y): - # so far we support only == and only for FieldOffset. In theory, we could - # generalize support for direct comparisons of AddressOffsets - if isinstance(x, llmemory.FieldOffset): - x = x.force_as_int() - if isinstance(y, llmemory.FieldOffset): - y = y.force_as_int() - # if not isinstance(x, (int, long)): from rpython.rtyper.lltypesystem import llgroup assert isinstance(x, llgroup.CombinedSymbolic), ( From noreply at buildbot.pypy.org Wed Nov 25 05:22:22 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 11:22:22 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: pro-actively fix test_whatsnews Message-ID: <20151125102222.8E6FB1C02FB@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80935:4dfc49434925 Date: 2015-11-25 11:19 +0100 http://bitbucket.org/pypy/pypy/changeset/4dfc49434925/ Log: pro-actively fix test_whatsnews diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -22,3 +22,10 @@ Fix issue #2193. ``isinstance(..., int)`` => ``isinstance(..., numbers.Integral)`` to allow for alternate ``int``-like implementations (e.g., ``future.types.newint``) + +.. branch: faster-rstruct + +Improve the performace of struct.unpack, which now directly reads inside the +string buffer and directly casts the bytes to the appropriate type, when +allowed. Unpacking of floats and doubles is about 15 times faster now, while +for integer types it's up to ~50% faster for 64bit integers. From noreply at buildbot.pypy.org Wed Nov 25 05:22:28 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 11:22:28 +0100 (CET) Subject: [pypy-commit] pypy faster-rstruct: close merged branch Message-ID: <20151125102228.A050E1C02FB@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: faster-rstruct Changeset: r80936:ac9b475d8326 Date: 2015-11-25 11:20 +0100 http://bitbucket.org/pypy/pypy/changeset/ac9b475d8326/ Log: close merged branch From noreply at buildbot.pypy.org Wed Nov 25 05:22:36 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 11:22:36 +0100 (CET) Subject: [pypy-commit] pypy default: Merge the faster-rstruct branch, which improves the performace of Message-ID: <20151125102236.C2C401C02FB@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: Changeset: r80937:cdc2cea532d1 Date: 2015-11-25 11:22 +0100 http://bitbucket.org/pypy/pypy/changeset/cdc2cea532d1/ Log: Merge the faster-rstruct branch, which improves the performace of struct.unpack, which now directly reads inside the string buffer and directly casts the bytes to the appropriate type, when allowed. Unpacking of floats and doubles is about 15 times faster now, while for integer types it's up to ~50% faster for 64bit integers. This is done by the introduction of the more general rlib.str_storage.str_storage_getitem, which allows to read arbitrary types from the internal buffer of RPython strings. Right now this is done by casting the internal array, but eventually we should switch to use llop.gc_load, once it's implemented :) diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -22,3 +22,10 @@ Fix issue #2193. ``isinstance(..., int)`` => ``isinstance(..., numbers.Integral)`` to allow for alternate ``int``-like implementations (e.g., ``future.types.newint``) + +.. branch: faster-rstruct + +Improve the performace of struct.unpack, which now directly reads inside the +string buffer and directly casts the bytes to the appropriate type, when +allowed. Unpacking of floats and doubles is about 15 times faster now, while +for integer types it's up to ~50% faster for 64bit integers. diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py --- a/pypy/module/pypyjit/test_pypy_c/test_struct.py +++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py @@ -19,7 +19,8 @@ import struct i = 1 while i < n: - x = struct.unpack("i", struct.pack("i", i))[0] # ID: struct + buf = struct.pack("i", i) # ID: pack + x = struct.unpack("i", buf)[0] # ID: unpack i += x / i return i @@ -29,7 +30,7 @@ loop, = log.loops_by_filename(self.filepath) # This could, of course stand some improvement, to remove all these # arithmatic ops, but we've removed all the core overhead. - assert loop.match_by_id("struct", """ + assert loop.match_by_id("pack", """ guard_not_invalidated(descr=...) # struct.pack %s @@ -40,17 +41,22 @@ i17 = int_and(i16, 255) i19 = int_rshift(i16, 8) i20 = int_and(i19, 255) + """ % extra) + # the newstr and the strsetitems are because the string is forced, + # which is in turn because the optimizer doesn't know how to handle a + # getarrayitem_gc_i on a virtual string. It could be improved, but it + # is also true that in real life cases struct.unpack is called on + # strings which come from the outside, so it's a minor issue. + assert loop.match_by_id("unpack", """ # struct.unpack - i22 = int_lshift(i14, 8) - i23 = int_or(i11, i22) - i25 = int_lshift(i17, 16) - i26 = int_or(i23, i25) - i28 = int_ge(i20, 128) - guard_false(i28, descr=...) - i30 = int_lshift(i20, 24) - i31 = int_or(i26, i30) - """ % extra) + p88 = newstr(4) + strsetitem(p88, 0, i11) + strsetitem(p88, 1, i14) + strsetitem(p88, 2, i17) + strsetitem(p88, 3, i20) + i91 = getarrayitem_gc_i(p88, 0, descr=) + """) def test_struct_object(self): def main(n): @@ -58,7 +64,8 @@ s = struct.Struct("i") i = 1 while i < n: - x = s.unpack(s.pack(i))[0] # ID: struct + buf = s.pack(i) # ID: pack + x = s.unpack(buf)[0] # ID: unpack i += x / i return i @@ -66,7 +73,7 @@ assert log.result == main(1000) loop, = log.loops_by_filename(self.filepath) - assert loop.match_by_id('struct', """ + assert loop.match_by_id('pack', """ guard_not_invalidated(descr=...) # struct.pack %s @@ -77,14 +84,14 @@ i17 = int_and(i16, 255) i19 = int_rshift(i16, 8) i20 = int_and(i19, 255) + """ % extra) + assert loop.match_by_id('unpack', """ # struct.unpack - i22 = int_lshift(i14, 8) - i23 = int_or(i11, i22) - i25 = int_lshift(i17, 16) - i26 = int_or(i23, i25) - i28 = int_ge(i20, 128) - guard_false(i28, descr=...) - i30 = int_lshift(i20, 24) - i31 = int_or(i26, i30) - """ % extra) + p88 = newstr(4) + strsetitem(p88, 0, i11) + strsetitem(p88, 1, i14) + strsetitem(p88, 2, i17) + strsetitem(p88, 3, i20) + i91 = getarrayitem_gc_i(p88, 0, descr=) + """) diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py --- a/pypy/module/struct/formatiterator.py +++ b/pypy/module/struct/formatiterator.py @@ -149,3 +149,13 @@ @specialize.argtype(1) def appendobj(self, value): self.result_w.append(self.space.wrap(value)) + + def get_pos(self): + return self.pos + + def get_buffer_as_string_maybe(self): + string, pos = self.buf.as_str_and_offset_maybe() + return string, pos+self.pos + + def skip(self, size): + self.read(size) # XXX, could avoid taking the slice diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py --- a/pypy/module/struct/test/test_struct.py +++ b/pypy/module/struct/test/test_struct.py @@ -462,3 +462,29 @@ assert self.struct.unpack_from("ii", b, 2) == (17, 42) b[:sz] = self.struct.pack("ii", 18, 43) assert self.struct.unpack_from("ii", b) == (18, 43) + + +class AppTestFastPath(object): + spaceconfig = dict(usemodules=['struct', '__pypy__']) + + def setup_class(cls): + from rpython.rlib.rstruct import standardfmttable + standardfmttable.ALLOW_SLOWPATH = False + # + cls.w_struct = cls.space.appexec([], """(): + import struct + return struct + """) + cls.w_bytebuffer = cls.space.appexec([], """(): + import __pypy__ + return __pypy__.bytebuffer + """) + + def teardown_class(cls): + from rpython.rlib.rstruct import standardfmttable + standardfmttable.ALLOW_SLOWPATH = True + + def test_unpack_from(self): + buf = self.struct.pack("iii", 0, 42, 43) + offset = self.struct.calcsize("i") + assert self.struct.unpack_from("ii", buf, offset) == (42, 43) diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -638,9 +638,18 @@ return array.getlength() def bh_getarrayitem_gc(self, a, index, descr): - a = support.cast_arg(lltype.Ptr(descr.A), a) + assert index >= 0 + if descr.A is descr.OUTERA: + a = support.cast_arg(lltype.Ptr(descr.A), a) + else: + # we use rffi.cast instead of support.cast_arg because the types + # might not be "compatible" enough from the lltype point of + # view. In particular, this happens when we use + # str_storage_getitem, in which an rpy_string is casted to + # rpy_string_as_Signed (or similar) + a = rffi.cast(lltype.Ptr(descr.OUTERA), a) + a = getattr(a, descr.OUTERA._arrayfld) array = a._obj - assert index >= 0 return support.cast_result(descr.A.OF, array.getitem(index)) bh_getarrayitem_gc_pure_i = bh_getarrayitem_gc diff --git a/rpython/jit/backend/x86/test/test_strstorage.py b/rpython/jit/backend/x86/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/backend/x86/test/test_strstorage.py @@ -0,0 +1,8 @@ +from rpython.jit.backend.x86.test.test_basic import Jit386Mixin +from rpython.jit.metainterp.test.test_strstorage import TestStrStorage as _TestStrStorage + + +class TestStrStorage(Jit386Mixin, _TestStrStorage): + # for the individual tests see + # ====> ../../../metainterp/test/test_strstorage.py + pass diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -1008,12 +1008,11 @@ return SpaceOperation('getarrayitem_gc_i', [op.args[0], v_index, bytearraydescr], op.result) - else: + elif op.result.concretetype is lltype.Void: + return + elif isinstance(op.args[0].concretetype.TO, lltype.GcArray): + # special-case 1: GcArray of Struct v_inst, v_index, c_field = op.args - if op.result.concretetype is lltype.Void: - return - # only GcArray of Struct supported - assert isinstance(v_inst.concretetype.TO, lltype.GcArray) STRUCT = v_inst.concretetype.TO.OF assert isinstance(STRUCT, lltype.Struct) descr = self.cpu.interiorfielddescrof(v_inst.concretetype.TO, @@ -1022,6 +1021,20 @@ kind = getkind(op.result.concretetype)[0] return SpaceOperation('getinteriorfield_gc_%s' % kind, args, op.result) + elif isinstance(op.args[0].concretetype.TO, lltype.GcStruct): + # special-case 2: GcStruct with Array field + v_inst, c_field, v_index = op.args + STRUCT = v_inst.concretetype.TO + ARRAY = getattr(STRUCT, c_field.value) + assert isinstance(ARRAY, lltype.Array) + arraydescr = self.cpu.arraydescrof(STRUCT) + kind = getkind(op.result.concretetype)[0] + assert kind in ('i', 'f') + return SpaceOperation('getarrayitem_gc_%s' % kind, + [op.args[0], v_index, arraydescr], + op.result) + else: + assert False, 'not supported' def rewrite_op_setinteriorfield(self, op): assert len(op.args) == 4 @@ -1130,10 +1143,13 @@ def rewrite_op_force_cast(self, op): v_arg = op.args[0] v_result = op.result - assert not self._is_gc(v_arg) - if v_arg.concretetype == v_result.concretetype: return + elif self._is_gc(v_arg) and self._is_gc(v_result): + # cast from GC to GC is always fine + return + else: + assert not self._is_gc(v_arg) float_arg = v_arg.concretetype in [lltype.Float, lltype.SingleFloat] float_res = v_result.concretetype in [lltype.Float, lltype.SingleFloat] diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -535,10 +535,13 @@ cf.do_setfield(self, op) def optimize_GETARRAYITEM_GC_I(self, op): + # When using str_storage_getitem we op.getarg(0) is a string, NOT an + # array. In that case, we cannot cache the getarrayitem as if it were + # an array, obviously arrayinfo = self.ensure_ptr_info_arg0(op) indexb = self.getintbound(op.getarg(1)) cf = None - if indexb.is_constant(): + if indexb.is_constant() and not arrayinfo.is_vstring(): index = indexb.getint() arrayinfo.getlenbound(None).make_gt_const(index) # use the cache on (arraydescr, index), which is a constant @@ -555,7 +558,7 @@ self.make_nonnull(op.getarg(0)) self.emit_operation(op) # the remember the result of reading the array item - if cf is not None: + if cf is not None and not arrayinfo.is_vstring(): arrayinfo.setitem(op.getdescr(), indexb.getint(), self.get_box_replacement(op.getarg(0)), self.get_box_replacement(op), cf, diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py --- a/rpython/jit/metainterp/optimizeopt/info.py +++ b/rpython/jit/metainterp/optimizeopt/info.py @@ -24,6 +24,9 @@ def is_virtual(self): return False + def is_vstring(self): + return False + def is_precise(self): return False diff --git a/rpython/jit/metainterp/optimizeopt/virtualize.py b/rpython/jit/metainterp/optimizeopt/virtualize.py --- a/rpython/jit/metainterp/optimizeopt/virtualize.py +++ b/rpython/jit/metainterp/optimizeopt/virtualize.py @@ -271,8 +271,10 @@ self.emit_operation(op) def optimize_GETARRAYITEM_GC_I(self, op): + # When using str_storage_getitem we op.getarg(0) is a string, NOT an + # array, hence the check. In that case, it will be forced opinfo = self.getptrinfo(op.getarg(0)) - if opinfo and opinfo.is_virtual(): + if opinfo and opinfo.is_virtual() and not opinfo.is_vstring(): indexbox = self.get_constant_box(op.getarg(1)) if indexbox is not None: item = opinfo.getitem(op.getdescr(), indexbox.getint()) diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py b/rpython/jit/metainterp/optimizeopt/vstring.py --- a/rpython/jit/metainterp/optimizeopt/vstring.py +++ b/rpython/jit/metainterp/optimizeopt/vstring.py @@ -62,6 +62,9 @@ self.mode = mode self.length = length + def is_vstring(self): + return True + def getlenbound(self, mode): from rpython.jit.metainterp.optimizeopt import intutils diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -0,0 +1,53 @@ +import py +import sys +import struct +from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rlib.strstorage import str_storage_getitem +from rpython.rlib.test.test_strstorage import BaseStrStorageTest +from rpython.jit.codewriter import longlong +from rpython.jit.metainterp.history import getkind +from rpython.jit.metainterp.test.support import LLJitMixin + +class TestStrStorage(BaseStrStorageTest, LLJitMixin): + + # for the individual tests see + # ====> ../../../rlib/test/test_strstorage.py + + def str_storage_getitem(self, TYPE, buf, offset): + def f(): + return str_storage_getitem(TYPE, buf, offset) + res = self.interp_operations(f, [], supports_singlefloats=True) + # + kind = getkind(TYPE)[0] # 'i' or 'f' + self.check_operations_history({'getarrayitem_gc_%s' % kind: 1, + 'finish': 1}) + # + if TYPE == lltype.SingleFloat: + # interp_operations returns the int version of r_singlefloat, but + # our tests expects to receive an r_singlefloat: let's convert it + # back! + return longlong.int2singlefloat(res) + return res + + def str_storage_supported(self, TYPE): + py.test.skip('this is not a JIT test') + + def test_force_virtual_str_storage(self): + byteorder = sys.byteorder + size = rffi.sizeof(lltype.Signed) + def f(val): + if byteorder == 'little': + x = chr(val) + '\x00'*(size-1) + else: + x = '\x00'*(size-1) + chr(val) + return str_storage_getitem(lltype.Signed, x, 0) + res = self.interp_operations(f, [42], supports_singlefloats=True) + assert res == 42 + self.check_operations_history({ + 'newstr': 1, # str forcing + 'strsetitem': 1, # str forcing + 'call_pure_r': 1, # str forcing (copystrcontent) + 'guard_no_exception': 1, # str forcing + 'getarrayitem_gc_i': 1, # str_storage_getitem + 'finish': 1 + }) diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py --- a/rpython/rlib/buffer.py +++ b/rpython/rlib/buffer.py @@ -22,6 +22,14 @@ # May be overridden. return self.getslice(0, self.getlength(), 1, self.getlength()) + def as_str_and_offset_maybe(self): + """ + If the buffer is backed by a string, return a pair (string, offset), where + offset is the offset inside the string where the buffer start. + Else, return (None, 0). + """ + return None, 0 + def getitem(self, index): "Returns the index'th character in the buffer." raise NotImplementedError # Must be overriden. No bounds checks. @@ -66,6 +74,9 @@ def as_str(self): return self.value + def as_str_and_offset_maybe(self): + return self.value, 0 + def getitem(self, index): return self.value[index] @@ -99,6 +110,12 @@ else: return 0 + def as_str_and_offset_maybe(self): + string, offset = self.buffer.as_str_and_offset_maybe() + if string is not None: + return string, offset+self.offset + return None, 0 + def getitem(self, index): return self.buffer.getitem(self.offset + index) diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py --- a/rpython/rlib/rstruct/nativefmttable.py +++ b/rpython/rlib/rstruct/nativefmttable.py @@ -8,15 +8,15 @@ from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_singlefloat, widen from rpython.rlib.rstruct import standardfmttable as std +from rpython.rlib.rstruct.standardfmttable import native_is_bigendian from rpython.rlib.rstruct.error import StructError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.strstorage import str_storage_getitem from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.tool import rffi_platform from rpython.translator.tool.cbuild import ExternalCompilationInfo -native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) - native_fmttable = { 'x': std.standard_fmttable['x'], 'c': std.standard_fmttable['c'], @@ -27,9 +27,6 @@ # ____________________________________________________________ -double_buf = lltype.malloc(rffi.DOUBLEP.TO, 1, flavor='raw', immortal=True) -float_buf = lltype.malloc(rffi.FLOATP.TO, 1, flavor='raw', immortal=True) - range_8_unroll = unrolling_iterable(list(reversed(range(8)))) range_4_unroll = unrolling_iterable(list(reversed(range(4)))) @@ -45,14 +42,6 @@ fmtiter.result.append(chr(value & 0xff)) value >>= 8 - at specialize.argtype(0) -def unpack_double(fmtiter): - input = fmtiter.read(sizeof_double) - p = rffi.cast(rffi.CCHARP, double_buf) - for i in range(sizeof_double): - p[i] = input[i] - doubleval = double_buf[0] - fmtiter.appendobj(doubleval) def pack_float(fmtiter): doubleval = fmtiter.accept_float_arg() @@ -68,16 +57,6 @@ fmtiter.result.append(chr(value & 0xff)) value >>= 8 - at specialize.argtype(0) -def unpack_float(fmtiter): - input = fmtiter.read(sizeof_float) - p = rffi.cast(rffi.CCHARP, float_buf) - for i in range(sizeof_float): - p[i] = input[i] - floatval = float_buf[0] - doubleval = float(floatval) - fmtiter.appendobj(doubleval) - # ____________________________________________________________ # # Use rffi_platform to get the native sizes and alignments from the C compiler @@ -134,10 +113,10 @@ if fmtchar == 'f': pack = pack_float - unpack = unpack_float + unpack = std.unpack_float elif fmtchar == 'd': pack = pack_double - unpack = unpack_double + unpack = std.unpack_double elif fmtchar == '?': pack = std.pack_bool unpack = std.unpack_bool diff --git a/rpython/rlib/rstruct/runpack.py b/rpython/rlib/rstruct/runpack.py --- a/rpython/rlib/rstruct/runpack.py +++ b/rpython/rlib/rstruct/runpack.py @@ -38,6 +38,12 @@ def appendobj(self, value): self.value = value + + def get_buffer_as_string_maybe(self): + return self.mr.input, self.mr.inputpos + + def skip(self, size): + self.read(size) # XXX, could avoid taking the slice ReaderForPos.__name__ = 'ReaderForPos%d' % pos return ReaderForPos @@ -88,13 +94,6 @@ exec source.compile() in miniglobals self.unpack = miniglobals['unpack'] # override not-rpython version - def unpack(self, s): - # NOT_RPYTHON - res = unpack(self.fmt, s) - if len(res) == 1: - return res[0] - return res - def _freeze_(self): assert self.formats self._create_unpacking_func() @@ -103,6 +102,7 @@ def create_unpacker(unpack_str): fmtiter = FrozenUnpackIterator(unpack_str) fmtiter.interpret(unpack_str) + assert fmtiter._freeze_() return fmtiter create_unpacker._annspecialcase_ = 'specialize:memo' diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py --- a/rpython/rlib/rstruct/standardfmttable.py +++ b/rpython/rlib/rstruct/standardfmttable.py @@ -12,7 +12,12 @@ from rpython.rlib.rstruct import ieee from rpython.rlib.rstruct.error import StructError, StructOverflowError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported +from rpython.rlib import rarithmetic +from rpython.rtyper.lltypesystem import rffi +native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) +native_is_ieee754 = float.__getformat__('double').startswith('IEEE') def pack_pad(fmtiter, count): fmtiter.result.append_multiple_char('\x00', count) @@ -126,6 +131,24 @@ # ____________________________________________________________ +USE_FASTPATH = True # set to False by some tests +ALLOW_SLOWPATH = True # set to False by some tests + +class CannotUnpack(Exception): + pass + + at specialize.memo() +def unpack_fastpath(TYPE): + @specialize.argtype(0) + def do_unpack_fastpath(fmtiter): + size = rffi.sizeof(TYPE) + strbuf, pos = fmtiter.get_buffer_as_string_maybe() + if strbuf is None or pos % size != 0 or not USE_FASTPATH: + raise CannotUnpack + fmtiter.skip(size) + return str_storage_getitem(TYPE, strbuf, pos) + return do_unpack_fastpath + @specialize.argtype(0) def unpack_pad(fmtiter, count): fmtiter.read(count) @@ -153,15 +176,54 @@ end = count fmtiter.appendobj(data[1:end]) -def make_float_unpacker(size): +def make_ieee_unpacker(TYPE): @specialize.argtype(0) - def unpacker(fmtiter): - data = fmtiter.read(size) - fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian)) - return unpacker + def unpack_ieee(fmtiter): + size = rffi.sizeof(TYPE) + if fmtiter.bigendian != native_is_bigendian or not native_is_ieee754: + # fallback to the very slow unpacking code in ieee.py + data = fmtiter.read(size) + fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian)) + return + if not str_storage_supported(TYPE): + # this happens e.g. on win32 and ARM32: we cannot read the string + # content as an array of doubles because it's not properly + # aligned. But we can read a longlong and convert to float + assert TYPE == rffi.DOUBLE + assert rffi.sizeof(TYPE) == 8 + return unpack_longlong2float(fmtiter) + try: + # fast path + val = unpack_fastpath(TYPE)(fmtiter) + except CannotUnpack: + # slow path, take the slice + input = fmtiter.read(size) + val = str_storage_getitem(TYPE, input, 0) + fmtiter.appendobj(float(val)) + return unpack_ieee + + at specialize.argtype(0) +def unpack_longlong2float(fmtiter): + from rpython.rlib.rstruct.runpack import runpack + from rpython.rlib.longlong2float import longlong2float + s = fmtiter.read(8) + llval = runpack('q', s) # this is a bit recursive, I know + doubleval = longlong2float(llval) + fmtiter.appendobj(doubleval) + + +unpack_double = make_ieee_unpacker(rffi.DOUBLE) +unpack_float = make_ieee_unpacker(rffi.FLOAT) # ____________________________________________________________ +def get_rffi_int_type(size, signed): + for TYPE in rffi.platform.numbertype_to_rclass: + if (rffi.sizeof(TYPE) == size and + rarithmetic.is_signed_integer_type(TYPE) == signed): + return TYPE + raise KeyError("Cannot find an int type size=%d, signed=%d" % (size, signed)) + def make_int_unpacker(size, signed, _memo={}): try: return _memo[size, signed] @@ -180,9 +242,30 @@ else: inttype = r_ulonglong unroll_range_size = unrolling_iterable(range(size)) + TYPE = get_rffi_int_type(size, signed) + + @specialize.argtype(0) + def unpack_int_fastpath_maybe(fmtiter): + if fmtiter.bigendian != native_is_bigendian or not str_storage_supported(TYPE): + return False + try: + intvalue = unpack_fastpath(TYPE)(fmtiter) + except CannotUnpack: + return False + if not signed and size < native_int_size: + intvalue = rarithmetic.intmask(intvalue) + intvalue = inttype(intvalue) + fmtiter.appendobj(intvalue) + return True @specialize.argtype(0) def unpack_int(fmtiter): + if unpack_int_fastpath_maybe(fmtiter): + return + # slow path + if not ALLOW_SLOWPATH: + # we enter here only on some tests + raise ValueError("fastpath not taken :(") intvalue = inttype(0) s = fmtiter.read(size) idx = 0 @@ -217,9 +300,9 @@ 'p':{ 'size' : 1, 'pack' : pack_pascal, 'unpack' : unpack_pascal, 'needcount' : True }, 'f':{ 'size' : 4, 'pack' : make_float_packer(4), - 'unpack' : make_float_unpacker(4)}, + 'unpack' : unpack_float}, 'd':{ 'size' : 8, 'pack' : make_float_packer(8), - 'unpack' : make_float_unpacker(8)}, + 'unpack' : unpack_double}, '?':{ 'size' : 1, 'pack' : pack_bool, 'unpack' : unpack_bool}, } diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py --- a/rpython/rlib/rstruct/test/test_runpack.py +++ b/rpython/rlib/rstruct/test/test_runpack.py @@ -1,5 +1,6 @@ from rpython.rtyper.test.tool import BaseRtypingTest from rpython.rlib.rstruct.runpack import runpack +from rpython.rlib.rstruct import standardfmttable from rpython.rlib.rarithmetic import LONG_BIT import struct @@ -37,3 +38,63 @@ return runpack(">d", "testtest") assert fn() == struct.unpack(">d", "testtest")[0] assert self.interpret(fn, []) == struct.unpack(">d", "testtest")[0] + + def test_native_floats(self): + """ + Check the 'd' and 'f' format characters on native packing. + """ + d_data = struct.pack("df", 12.34, 12.34) + def fn(): + d, f = runpack("@df", d_data) + return d, f + # + # direct test + d, f = fn() + assert d == 12.34 # no precision lost + assert f != 12.34 # precision lost + assert abs(f - 12.34) < 1E-6 + # + # translated test + res = self.interpret(fn, []) + d = res.item0 + f = res.item1 # convert from r_singlefloat + assert d == 12.34 # no precision lost + assert f != 12.34 # precision lost + assert abs(f - 12.34) < 1E-6 + + def test_unpack_standard_little(self): + def unpack(fmt, data): + def fn(): + return runpack(fmt, data) + return self.interpret(fn, []) + # + assert unpack("i", 'ABCD') == 0x41424344 + assert unpack(">i", '\xff\xff\xff\xfd') == -3 + assert unpack(">i", '\x80\x00\x00\x00') == -2147483648 + assert unpack(">I", '\x81BCD') == 0x81424344 + assert unpack(">q", 'ABCDEFGH') == 0x4142434445464748 + assert unpack(">q", '\xbeMLKJIHH') == -0x41B2B3B4B5B6B7B8 + assert unpack(">Q", '\x81BCDEFGH') == 0x8142434445464748 + + +class TestNoFastPath(TestRStruct): + + def setup_method(self, meth): + standardfmttable.USE_FASTPATH = False + + def teardown_method(self, meth): + standardfmttable.USE_FASTPATH = True diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/rlib/strstorage.py @@ -0,0 +1,62 @@ +# Support for str_storage: i.e., reading primitive types out of RPython string +# +# There are various possible ways to implement it, however not all of them are +# easily supported by the JIT: +# +# 1. use _get_raw_str_buf and cast the chars buffer to RAW_STORAGE_PTR: this +# works well without the JIT, but the cast to RAW_STORAGE_PTR needs to +# happen inside a short "no GC" section (like the one in +# rstr.py:copy_string_contents), which has no chance to work during +# tracing +# +# 2. use llop.raw_load: despite the name, llop.raw_load DOES support reading +# from GC pointers. However: +# +# a. we would like to use a CompositeOffset as the offset (using the +# same logic as in rstr.py:_get_raw_str_buf), but this is not (yet) +# supported before translation: it works only if you pass an actual +# integer +# +# b. raw_load from a GC pointer is not (yet) supported by the +# JIT. There are plans to introduce a gc_load operation: when it +# will be there, we could fix the issue above and actually use it to +# implement str_storage_getitem +# +# 3. the actual solution: cast rpy_string to a GcStruct which has the very +# same layout, with the only difference that its 'chars' field is no +# longer an Array(Char) but e.e. an Array(Signed). Then, we just need to +# read the appropriate index into the array + +from rpython.rtyper.lltypesystem import lltype, rffi, llmemory +from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf +from rpython.rtyper.annlowlevel import llstr +from rpython.rlib.objectmodel import specialize, we_are_translated + + at specialize.memo() +def _rpy_string_as_type(TP): + # sanity check that STR is actually what we think it is + assert STR._flds == { + 'hash': lltype.Signed, + 'chars': lltype.Array(lltype.Char, hints={'immutable': True}) + } + STR_AS_TP = lltype.GcStruct('rpy_string_as_%s' % TP, + ('hash', lltype.Signed), + ('chars', lltype.Array(TP, hints={'immutable': True}))) + return STR_AS_TP + + at specialize.arg(0) +def str_storage_supported(TP): + # on some architectures (e.g. win32 and arm32) an array of longlongs needs + # to be aligned at 8 bytes boundaries, so we cannot safely cast from STR + # to STR_AS_TP. In that case, we str_storage_getitem is simply not + # supported + return rffi.sizeof(TP) <= rffi.sizeof(lltype.Signed) + + at specialize.ll() +def str_storage_getitem(TP, s, index): + assert str_storage_supported(TP) # sanity check + STR_AS_TP = _rpy_string_as_type(TP) + lls = llstr(s) + str_as_tp = rffi.cast(lltype.Ptr(STR_AS_TP), lls) + index = index / rffi.sizeof(TP) + return str_as_tp.chars[index] diff --git a/rpython/rlib/test/test_buffer.py b/rpython/rlib/test/test_buffer.py --- a/rpython/rlib/test/test_buffer.py +++ b/rpython/rlib/test/test_buffer.py @@ -32,3 +32,16 @@ a = RPythonAnnotator() s = a.build_types(func, [int]) assert s == SomeInteger(nonneg=True) + + +def test_as_str_and_offset_maybe(): + buf = StringBuffer('hello world') + assert buf.as_str_and_offset_maybe() == ('hello world', 0) + # + sbuf = SubBuffer(buf, 6, 5) + assert sbuf.getslice(0, 5, 1, 5) == 'world' + assert sbuf.as_str_and_offset_maybe() == ('hello world', 6) + # + ssbuf = SubBuffer(sbuf, 3, 2) + assert ssbuf.getslice(0, 2, 1, 2) == 'ld' + assert ssbuf.as_str_and_offset_maybe() == ('hello world', 9) diff --git a/rpython/rlib/test/test_rawstorage.py b/rpython/rlib/test/test_rawstorage.py --- a/rpython/rlib/test/test_rawstorage.py +++ b/rpython/rlib/test/test_rawstorage.py @@ -32,7 +32,6 @@ assert res == 3.14 free_raw_storage(r) - class TestRawStorage(BaseRtypingTest): def test_storage_int(self): diff --git a/rpython/rlib/test/test_strstorage.py b/rpython/rlib/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/rlib/test/test_strstorage.py @@ -0,0 +1,71 @@ +import py +import sys +import struct +from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported +from rpython.rlib.rarithmetic import r_singlefloat +from rpython.rtyper.test.tool import BaseRtypingTest + +IS_32BIT = (sys.maxint == 2147483647) + +class BaseStrStorageTest: + + def test_str_getitem_supported(self): + if IS_32BIT: + expected = False + else: + expected = True + # + assert self.str_storage_supported(rffi.LONGLONG) == expected + assert self.str_storage_supported(rffi.DOUBLE) == expected + + def test_signed(self): + buf = struct.pack('@ll', 42, 43) + size = struct.calcsize('@l') + assert self.str_storage_getitem(lltype.Signed, buf, 0) == 42 + assert self.str_storage_getitem(lltype.Signed, buf, size) == 43 + + def test_short(self): + buf = struct.pack('@hh', 42, 43) + size = struct.calcsize('@h') + x = self.str_storage_getitem(rffi.SHORT, buf, 0) + assert int(x) == 42 + x = self.str_storage_getitem(rffi.SHORT, buf, size) + assert int(x) == 43 + + def test_float(self): + if not str_storage_supported(lltype.Float): + py.test.skip('str_storage_getitem(lltype.Float) not supported on this machine') + buf = struct.pack('@dd', 12.3, 45.6) + size = struct.calcsize('@d') + assert self.str_storage_getitem(lltype.Float, buf, 0) == 12.3 + assert self.str_storage_getitem(lltype.Float, buf, size) == 45.6 + + def test_singlefloat(self): + buf = struct.pack('@ff', 12.3, 45.6) + size = struct.calcsize('@f') + x = self.str_storage_getitem(lltype.SingleFloat, buf, 0) + assert x == r_singlefloat(12.3) + x = self.str_storage_getitem(lltype.SingleFloat, buf, size) + assert x == r_singlefloat(45.6) + + +class TestDirect(BaseStrStorageTest): + + def str_storage_supported(self, TYPE): + return str_storage_supported(TYPE) + + def str_storage_getitem(self, TYPE, buf, offset): + return str_storage_getitem(TYPE, buf, offset) + +class TestRTyping(BaseStrStorageTest, BaseRtypingTest): + + def str_storage_supported(self, TYPE): + def fn(): + return str_storage_supported(TYPE) + return self.interpret(fn, []) + + def str_storage_getitem(self, TYPE, buf, offset): + def fn(offset): + return str_storage_getitem(TYPE, buf, offset) + return self.interpret(fn, [offset]) diff --git a/rpython/rtyper/lltypesystem/rbytearray.py b/rpython/rtyper/lltypesystem/rbytearray.py --- a/rpython/rtyper/lltypesystem/rbytearray.py +++ b/rpython/rtyper/lltypesystem/rbytearray.py @@ -8,10 +8,10 @@ def mallocbytearray(size): return lltype.malloc(BYTEARRAY, size) -_, _, copy_bytearray_contents = rstr._new_copy_contents_fun(BYTEARRAY, BYTEARRAY, +_, _, _, copy_bytearray_contents = rstr._new_copy_contents_fun(BYTEARRAY, BYTEARRAY, lltype.Char, 'bytearray') -_, _, copy_bytearray_contents_from_str = rstr._new_copy_contents_fun(rstr.STR, +_, _, _, copy_bytearray_contents_from_str = rstr._new_copy_contents_fun(rstr.STR, BYTEARRAY, lltype.Char, 'bytearray_from_str') diff --git a/rpython/rtyper/lltypesystem/rstr.py b/rpython/rtyper/lltypesystem/rstr.py --- a/rpython/rtyper/lltypesystem/rstr.py +++ b/rpython/rtyper/lltypesystem/rstr.py @@ -60,6 +60,13 @@ @signature(types.any(), types.any(), types.int(), returns=types.any()) @specialize.arg(0) def _get_raw_buf(TP, src, ofs): + """ + WARNING: dragons ahead. + Return the address of the internal char* buffer of the low level + string. The return value is valid as long as no GC operation occur, so + you must ensure that it will be used inside a "GC safe" section, for + example by marking your function with @rgc.no_collect + """ assert typeOf(src).TO == TP assert ofs >= 0 return llmemory.cast_ptr_to_adr(src) + _str_ofs(TP, ofs) @@ -129,11 +136,17 @@ copy_raw_to_string = func_with_new_name(copy_raw_to_string, 'copy_raw_to_%s' % name) - return copy_string_to_raw, copy_raw_to_string, copy_string_contents + return _get_raw_buf, copy_string_to_raw, copy_raw_to_string, copy_string_contents -copy_string_to_raw, copy_raw_to_string, copy_string_contents = _new_copy_contents_fun(STR, STR, Char, 'string') -copy_unicode_to_raw, copy_raw_to_unicode, copy_unicode_contents = _new_copy_contents_fun(UNICODE, UNICODE, - UniChar, 'unicode') +(_get_raw_str_buf, + copy_string_to_raw, + copy_raw_to_string, + copy_string_contents) = _new_copy_contents_fun(STR, STR, Char, 'string') + +(_get_raw_unicode_buf, + copy_unicode_to_raw, + copy_raw_to_unicode, + copy_unicode_contents) = _new_copy_contents_fun(UNICODE, UNICODE, UniChar, 'unicode') CONST_STR_CACHE = WeakValueDictionary() CONST_UNICODE_CACHE = WeakValueDictionary() From noreply at buildbot.pypy.org Wed Nov 25 05:46:54 2015 From: noreply at buildbot.pypy.org (antocuni) Date: Wed, 25 Nov 2015 11:46:54 +0100 (CET) Subject: [pypy-commit] pypy default: improve comment, as per fijal's request Message-ID: <20151125104654.A3C4B1C0337@cobra.cs.uni-duesseldorf.de> Author: Antonio Cuni Branch: Changeset: r80938:fdfae75d80b9 Date: 2015-11-25 11:47 +0100 http://bitbucket.org/pypy/pypy/changeset/fdfae75d80b9/ Log: improve comment, as per fijal's request diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -535,9 +535,12 @@ cf.do_setfield(self, op) def optimize_GETARRAYITEM_GC_I(self, op): - # When using str_storage_getitem we op.getarg(0) is a string, NOT an - # array. In that case, we cannot cache the getarrayitem as if it were - # an array, obviously + # When using str_storage_getitem it might happen that op.getarg(0) is + # a virtual string, NOT an array. In that case, we cannot cache the + # getarrayitem as if it were an array, obviously. In theory we could + # improve by writing special code to interpter the buffer of the + # virtual string as if it were an array, but it looks complicate, + # fragile and not worth it. arrayinfo = self.ensure_ptr_info_arg0(op) indexb = self.getintbound(op.getarg(1)) cf = None From noreply at buildbot.pypy.org Wed Nov 25 07:46:09 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 13:46:09 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify: partly renamed getarrayitem_gc to gc_load, reenabled other ops that will be removed (that was a too big "big bang" approach) Message-ID: <20151125124609.32AF81C0337@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify Changeset: r80939:80594aadbcd0 Date: 2015-11-25 13:46 +0100 http://bitbucket.org/pypy/pypy/changeset/80594aadbcd0/ Log: partly renamed getarrayitem_gc to gc_load, reenabled other ops that will be removed (that was a too big "big bang" approach) diff too long, truncating to 2000 out of 2536 lines diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -72,6 +72,7 @@ self._cdefsources = [] self._included_ffis = [] self._windows_unicode = None + self._init_once_cache = {} if hasattr(backend, 'set_ffi'): backend.set_ffi(self) for name in backend.__dict__: @@ -598,6 +599,30 @@ return recompile(self, module_name, source, tmpdir=tmpdir, source_extension=source_extension, **kwds) + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + def _load_backend_lib(backend, name, flags): if name is None: diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -1,5 +1,6 @@ -/* See doc/misc/parse_c_type.rst in the source of CFFI for more information */ +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ typedef void *_cffi_opcode_t; diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -21,6 +21,8 @@ import math as _math import struct as _struct +_SENTINEL = object() + def _cmp(x, y): return 0 if x == y else 1 if x > y else -1 @@ -31,6 +33,8 @@ MAXYEAR = 9999 _MINYEARFMT = 1900 +_MAX_DELTA_DAYS = 999999999 + # Utility functions, adapted from Python's Demo/classes/Dates.py, which # also assumes the current Gregorian calendar indefinitely extended in # both directions. Difference: Dates.py calls January 1 of year 0 day @@ -95,6 +99,15 @@ # pasting together 25 4-year cycles. assert _DI100Y == 25 * _DI4Y - 1 +_US_PER_US = 1 +_US_PER_MS = 1000 +_US_PER_SECOND = 1000000 +_US_PER_MINUTE = 60000000 +_SECONDS_PER_DAY = 24 * 3600 +_US_PER_HOUR = 3600000000 +_US_PER_DAY = 86400000000 +_US_PER_WEEK = 604800000000 + def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." @@ -271,15 +284,17 @@ def _check_int_field(value): if isinstance(value, int): - return value + return int(value) if not isinstance(value, float): try: value = value.__int__() except AttributeError: pass else: - if isinstance(value, (int, long)): - return value + if isinstance(value, int): + return int(value) + elif isinstance(value, long): + return int(long(value)) raise TypeError('__int__ method should return an integer') raise TypeError('an integer is required') raise TypeError('integer argument expected, got float') @@ -344,75 +359,79 @@ raise TypeError("can't compare '%s' to '%s'" % ( type(x).__name__, type(y).__name__)) -# This is a start at a struct tm workalike. Goals: -# -# + Works the same way across platforms. -# + Handles all the fields datetime needs handled, without 1970-2038 glitches. -# -# Note: I suspect it's best if this flavor of tm does *not* try to -# second-guess timezones or DST. Instead fold whatever adjustments you want -# into the minutes argument (and the constructor will normalize). +def _normalize_pair(hi, lo, factor): + if not 0 <= lo <= factor-1: + inc, lo = divmod(lo, factor) + hi += inc + return hi, lo -class _tmxxx: +def _normalize_datetime(y, m, d, hh, mm, ss, us, ignore_overflow=False): + # Normalize all the inputs, and store the normalized values. + ss, us = _normalize_pair(ss, us, 1000000) + mm, ss = _normalize_pair(mm, ss, 60) + hh, mm = _normalize_pair(hh, mm, 60) + d, hh = _normalize_pair(d, hh, 24) + y, m, d = _normalize_date(y, m, d, ignore_overflow) + return y, m, d, hh, mm, ss, us - ordinal = None +def _normalize_date(year, month, day, ignore_overflow=False): + # That was easy. Now it gets muddy: the proper range for day + # can't be determined without knowing the correct month and year, + # but if day is, e.g., plus or minus a million, the current month + # and year values make no sense (and may also be out of bounds + # themselves). + # Saying 12 months == 1 year should be non-controversial. + if not 1 <= month <= 12: + year, month = _normalize_pair(year, month-1, 12) + month += 1 + assert 1 <= month <= 12 - def __init__(self, year, month, day, hour=0, minute=0, second=0, - microsecond=0): - # Normalize all the inputs, and store the normalized values. - if not 0 <= microsecond <= 999999: - carry, microsecond = divmod(microsecond, 1000000) - second += carry - if not 0 <= second <= 59: - carry, second = divmod(second, 60) - minute += carry - if not 0 <= minute <= 59: - carry, minute = divmod(minute, 60) - hour += carry - if not 0 <= hour <= 23: - carry, hour = divmod(hour, 24) - day += carry + # Now only day can be out of bounds (year may also be out of bounds + # for a datetime object, but we don't care about that here). + # If day is out of bounds, what to do is arguable, but at least the + # method here is principled and explainable. + dim = _days_in_month(year, month) + if not 1 <= day <= dim: + # Move day-1 days from the first of the month. First try to + # get off cheap if we're only one day out of range (adjustments + # for timezone alone can't be worse than that). + if day == 0: # move back a day + month -= 1 + if month > 0: + day = _days_in_month(year, month) + else: + year, month, day = year-1, 12, 31 + elif day == dim + 1: # move forward a day + month += 1 + day = 1 + if month > 12: + month = 1 + year += 1 + else: + ordinal = _ymd2ord(year, month, 1) + (day - 1) + year, month, day = _ord2ymd(ordinal) - # That was easy. Now it gets muddy: the proper range for day - # can't be determined without knowing the correct month and year, - # but if day is, e.g., plus or minus a million, the current month - # and year values make no sense (and may also be out of bounds - # themselves). - # Saying 12 months == 1 year should be non-controversial. - if not 1 <= month <= 12: - carry, month = divmod(month-1, 12) - year += carry - month += 1 - assert 1 <= month <= 12 + if not ignore_overflow and not MINYEAR <= year <= MAXYEAR: + raise OverflowError("date value out of range") + return year, month, day - # Now only day can be out of bounds (year may also be out of bounds - # for a datetime object, but we don't care about that here). - # If day is out of bounds, what to do is arguable, but at least the - # method here is principled and explainable. - dim = _days_in_month(year, month) - if not 1 <= day <= dim: - # Move day-1 days from the first of the month. First try to - # get off cheap if we're only one day out of range (adjustments - # for timezone alone can't be worse than that). - if day == 0: # move back a day - month -= 1 - if month > 0: - day = _days_in_month(year, month) - else: - year, month, day = year-1, 12, 31 - elif day == dim + 1: # move forward a day - month += 1 - day = 1 - if month > 12: - month = 1 - year += 1 - else: - self.ordinal = _ymd2ord(year, month, 1) + (day - 1) - year, month, day = _ord2ymd(self.ordinal) - - self.year, self.month, self.day = year, month, day - self.hour, self.minute, self.second = hour, minute, second - self.microsecond = microsecond +def _accum(tag, sofar, num, factor, leftover): + if isinstance(num, (int, long)): + prod = num * factor + rsum = sofar + prod + return rsum, leftover + if isinstance(num, float): + fracpart, intpart = _math.modf(num) + prod = int(intpart) * factor + rsum = sofar + prod + if fracpart == 0.0: + return rsum, leftover + assert isinstance(factor, (int, long)) + fracpart, intpart = _math.modf(factor * fracpart) + rsum += int(intpart) + return rsum, leftover + fracpart + raise TypeError("unsupported type for timedelta %s component: %s" % + (tag, type(num))) class timedelta(object): """Represent the difference between two datetime objects. @@ -433,100 +452,42 @@ """ __slots__ = '_days', '_seconds', '_microseconds', '_hashcode' - def __new__(cls, days=0, seconds=0, microseconds=0, - milliseconds=0, minutes=0, hours=0, weeks=0): - # Doing this efficiently and accurately in C is going to be difficult - # and error-prone, due to ubiquitous overflow possibilities, and that - # C double doesn't have enough bits of precision to represent - # microseconds over 10K years faithfully. The code here tries to make - # explicit where go-fast assumptions can be relied on, in order to - # guide the C implementation; it's way more convoluted than speed- - # ignoring auto-overflow-to-long idiomatic Python could be. + def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL, + milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL): + x = 0 + leftover = 0.0 + if microseconds is not _SENTINEL: + x, leftover = _accum("microseconds", x, microseconds, _US_PER_US, leftover) + if milliseconds is not _SENTINEL: + x, leftover = _accum("milliseconds", x, milliseconds, _US_PER_MS, leftover) + if seconds is not _SENTINEL: + x, leftover = _accum("seconds", x, seconds, _US_PER_SECOND, leftover) + if minutes is not _SENTINEL: + x, leftover = _accum("minutes", x, minutes, _US_PER_MINUTE, leftover) + if hours is not _SENTINEL: + x, leftover = _accum("hours", x, hours, _US_PER_HOUR, leftover) + if days is not _SENTINEL: + x, leftover = _accum("days", x, days, _US_PER_DAY, leftover) + if weeks is not _SENTINEL: + x, leftover = _accum("weeks", x, weeks, _US_PER_WEEK, leftover) + if leftover != 0.0: + x += _round(leftover) + return cls._from_microseconds(x) - # XXX Check that all inputs are ints, longs or floats. + @classmethod + def _from_microseconds(cls, us): + s, us = divmod(us, _US_PER_SECOND) + d, s = divmod(s, _SECONDS_PER_DAY) + return cls._create(d, s, us, False) - # Final values, all integer. - # s and us fit in 32-bit signed ints; d isn't bounded. - d = s = us = 0 + @classmethod + def _create(cls, d, s, us, normalize): + if normalize: + s, us = _normalize_pair(s, us, 1000000) + d, s = _normalize_pair(d, s, 24*3600) - # Normalize everything to days, seconds, microseconds. - days += weeks*7 - seconds += minutes*60 + hours*3600 - microseconds += milliseconds*1000 - - # Get rid of all fractions, and normalize s and us. - # Take a deep breath . - if isinstance(days, float): - dayfrac, days = _math.modf(days) - daysecondsfrac, daysecondswhole = _math.modf(dayfrac * (24.*3600.)) - assert daysecondswhole == int(daysecondswhole) # can't overflow - s = int(daysecondswhole) - assert days == int(days) - d = int(days) - else: - daysecondsfrac = 0.0 - d = days - assert isinstance(daysecondsfrac, float) - assert abs(daysecondsfrac) <= 1.0 - assert isinstance(d, (int, long)) - assert abs(s) <= 24 * 3600 - # days isn't referenced again before redefinition - - if isinstance(seconds, float): - secondsfrac, seconds = _math.modf(seconds) - assert seconds == int(seconds) - seconds = int(seconds) - secondsfrac += daysecondsfrac - assert abs(secondsfrac) <= 2.0 - else: - secondsfrac = daysecondsfrac - # daysecondsfrac isn't referenced again - assert isinstance(secondsfrac, float) - assert abs(secondsfrac) <= 2.0 - - assert isinstance(seconds, (int, long)) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) # can't overflow - assert isinstance(s, int) - assert abs(s) <= 2 * 24 * 3600 - # seconds isn't referenced again before redefinition - - usdouble = secondsfrac * 1e6 - assert abs(usdouble) < 2.1e6 # exact value not critical - # secondsfrac isn't referenced again - - if isinstance(microseconds, float): - microseconds = _round(microseconds + usdouble) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = int(microseconds) - else: - microseconds = int(microseconds) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = _round(microseconds + usdouble) - assert isinstance(s, int) - assert isinstance(microseconds, int) - assert abs(s) <= 3 * 24 * 3600 - assert abs(microseconds) < 3.1e6 - - # Just a little bit of carrying possible for microseconds and seconds. - seconds, us = divmod(microseconds, 1000000) - s += seconds - days, s = divmod(s, 24*3600) - d += days - - assert isinstance(d, (int, long)) - assert isinstance(s, int) and 0 <= s < 24*3600 - assert isinstance(us, int) and 0 <= us < 1000000 - - if abs(d) > 999999999: - raise OverflowError("timedelta # of days is too large: %d" % d) + if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS: + raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS)) self = object.__new__(cls) self._days = d @@ -535,6 +496,10 @@ self._hashcode = -1 return self + def _to_microseconds(self): + return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND + + self._microseconds) + def __repr__(self): module = "datetime." if self.__class__ is timedelta else "" if self._microseconds: @@ -562,8 +527,7 @@ def total_seconds(self): """Total seconds in the duration.""" - return ((self.days * 86400 + self.seconds) * 10**6 + - self.microseconds) / 10**6 + return self._to_microseconds() / 10**6 # Read-only field accessors @property @@ -585,36 +549,37 @@ if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days + other._days, - self._seconds + other._seconds, - self._microseconds + other._microseconds) + return timedelta._create(self._days + other._days, + self._seconds + other._seconds, + self._microseconds + other._microseconds, + True) return NotImplemented - __radd__ = __add__ - def __sub__(self, other): if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days - other._days, - self._seconds - other._seconds, - self._microseconds - other._microseconds) - return NotImplemented - - def __rsub__(self, other): - if isinstance(other, timedelta): - return -self + other + return timedelta._create(self._days - other._days, + self._seconds - other._seconds, + self._microseconds - other._microseconds, + True) return NotImplemented def __neg__(self): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(-self._days, - -self._seconds, - -self._microseconds) + return timedelta._create(-self._days, + -self._seconds, + -self._microseconds, + True) def __pos__(self): - return self + # for CPython compatibility, we cannot use + # our __class__ here, but need a real timedelta + return timedelta._create(self._days, + self._seconds, + self._microseconds, + False) def __abs__(self): if self._days < 0: @@ -623,25 +588,18 @@ return self def __mul__(self, other): - if isinstance(other, (int, long)): - # for CPython compatibility, we cannot use - # our __class__ here, but need a real timedelta - return timedelta(self._days * other, - self._seconds * other, - self._microseconds * other) - return NotImplemented + if not isinstance(other, (int, long)): + return NotImplemented + usec = self._to_microseconds() + return timedelta._from_microseconds(usec * other) __rmul__ = __mul__ - def _to_microseconds(self): - return ((self._days * (24*3600) + self._seconds) * 1000000 + - self._microseconds) - def __div__(self, other): if not isinstance(other, (int, long)): return NotImplemented usec = self._to_microseconds() - return timedelta(0, 0, usec // other) + return timedelta._from_microseconds(usec // other) __floordiv__ = __div__ @@ -705,9 +663,8 @@ def __reduce__(self): return (self.__class__, self._getstate()) -timedelta.min = timedelta(-999999999) -timedelta.max = timedelta(days=999999999, hours=23, minutes=59, seconds=59, - microseconds=999999) +timedelta.min = timedelta(-_MAX_DELTA_DAYS) +timedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1) timedelta.resolution = timedelta(microseconds=1) class date(object): @@ -948,32 +905,29 @@ # Computations - def _checkOverflow(self, year): - if not MINYEAR <= year <= MAXYEAR: - raise OverflowError("date +/-: result year %d not in %d..%d" % - (year, MINYEAR, MAXYEAR)) + def _add_timedelta(self, other, factor): + y, m, d = _normalize_date( + self._year, + self._month, + self._day + other.days * factor) + return date(y, m, d) def __add__(self, other): "Add a date to a timedelta." if isinstance(other, timedelta): - t = _tmxxx(self._year, - self._month, - self._day + other.days) - self._checkOverflow(t.year) - result = date(t.year, t.month, t.day) - return result + return self._add_timedelta(other, 1) return NotImplemented __radd__ = __add__ def __sub__(self, other): """Subtract two dates, or a date and a timedelta.""" - if isinstance(other, timedelta): - return self + timedelta(-other.days) if isinstance(other, date): days1 = self.toordinal() days2 = other.toordinal() - return timedelta(days1 - days2) + return timedelta._create(days1 - days2, 0, 0, False) + if isinstance(other, timedelta): + return self._add_timedelta(other, -1) return NotImplemented def weekday(self): @@ -1340,7 +1294,7 @@ offset = self._tzinfo.utcoffset(None) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1378,7 +1332,7 @@ offset = self._tzinfo.dst(None) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1505,18 +1459,24 @@ A timezone info object may be passed in as well. """ + _check_tzinfo_arg(tz) + converter = _time.localtime if tz is None else _time.gmtime + self = cls._from_timestamp(converter, timestamp, tz) + if tz is not None: + self = tz.fromutc(self) + return self - _check_tzinfo_arg(tz) + @classmethod + def utcfromtimestamp(cls, t): + "Construct a UTC datetime from a POSIX timestamp (like time.time())." + return cls._from_timestamp(_time.gmtime, t, None) - converter = _time.localtime if tz is None else _time.gmtime - - if isinstance(timestamp, int): - us = 0 - else: - t_full = timestamp - timestamp = int(_math.floor(timestamp)) - frac = t_full - timestamp - us = _round(frac * 1e6) + @classmethod + def _from_timestamp(cls, converter, timestamp, tzinfo): + t_full = timestamp + timestamp = int(_math.floor(timestamp)) + frac = t_full - timestamp + us = _round(frac * 1e6) # If timestamp is less than one microsecond smaller than a # full second, us can be rounded up to 1000000. In this case, @@ -1527,32 +1487,7 @@ us = 0 y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp) ss = min(ss, 59) # clamp out leap seconds if the platform has them - result = cls(y, m, d, hh, mm, ss, us, tz) - if tz is not None: - result = tz.fromutc(result) - return result - - @classmethod - def utcfromtimestamp(cls, t): - "Construct a UTC datetime from a POSIX timestamp (like time.time())." - if isinstance(t, int): - us = 0 - else: - t_full = t - t = int(_math.floor(t)) - frac = t_full - t - us = _round(frac * 1e6) - - # If timestamp is less than one microsecond smaller than a - # full second, us can be rounded up to 1000000. In this case, - # roll over to seconds, otherwise, ValueError is raised - # by the constructor. - if us == 1000000: - t += 1 - us = 0 - y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t) - ss = min(ss, 59) # clamp out leap seconds if the platform has them - return cls(y, m, d, hh, mm, ss, us) + return cls(y, m, d, hh, mm, ss, us, tzinfo) @classmethod def now(cls, tz=None): @@ -1594,9 +1529,9 @@ hh, mm, ss = self.hour, self.minute, self.second offset = self._utcoffset() if offset: # neither None nor 0 - tm = _tmxxx(y, m, d, hh, mm - offset) - y, m, d = tm.year, tm.month, tm.day - hh, mm = tm.hour, tm.minute + mm -= offset + y, m, d, hh, mm, ss, _ = _normalize_datetime( + y, m, d, hh, mm, ss, 0, ignore_overflow=True) return _build_struct_time(y, m, d, hh, mm, ss, 0) def date(self): @@ -1730,7 +1665,7 @@ offset = self._tzinfo.utcoffset(self) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1768,7 +1703,7 @@ offset = self._tzinfo.dst(self) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1859,22 +1794,22 @@ return -1 return diff and 1 or 0 + def _add_timedelta(self, other, factor): + y, m, d, hh, mm, ss, us = _normalize_datetime( + self._year, + self._month, + self._day + other.days * factor, + self._hour, + self._minute, + self._second + other.seconds * factor, + self._microsecond + other.microseconds * factor) + return datetime(y, m, d, hh, mm, ss, us, tzinfo=self._tzinfo) + def __add__(self, other): "Add a datetime and a timedelta." if not isinstance(other, timedelta): return NotImplemented - t = _tmxxx(self._year, - self._month, - self._day + other.days, - self._hour, - self._minute, - self._second + other.seconds, - self._microsecond + other.microseconds) - self._checkOverflow(t.year) - result = datetime(t.year, t.month, t.day, - t.hour, t.minute, t.second, - t.microsecond, tzinfo=self._tzinfo) - return result + return self._add_timedelta(other, 1) __radd__ = __add__ @@ -1882,16 +1817,15 @@ "Subtract two datetimes, or a datetime and a timedelta." if not isinstance(other, datetime): if isinstance(other, timedelta): - return self + -other + return self._add_timedelta(other, -1) return NotImplemented - days1 = self.toordinal() - days2 = other.toordinal() - secs1 = self._second + self._minute * 60 + self._hour * 3600 - secs2 = other._second + other._minute * 60 + other._hour * 3600 - base = timedelta(days1 - days2, - secs1 - secs2, - self._microsecond - other._microsecond) + delta_d = self.toordinal() - other.toordinal() + delta_s = (self._hour - other._hour) * 3600 + \ + (self._minute - other._minute) * 60 + \ + (self._second - other._second) + delta_us = self._microsecond - other._microsecond + base = timedelta._create(delta_d, delta_s, delta_us, True) if self._tzinfo is other._tzinfo: return base myoff = self._utcoffset() diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -15,4 +15,17 @@ Fix the cpyext tests on OSX by linking with -flat_namespace .. branch: anntype + Refactor and improve exception analysis in the annotator. + +.. branch: posita/2193-datetime-timedelta-integrals + +Fix issue #2193. ``isinstance(..., int)`` => ``isinstance(..., numbers.Integral)`` +to allow for alternate ``int``-like implementations (e.g., ``future.types.newint``) + +.. branch: faster-rstruct + +Improve the performace of struct.unpack, which now directly reads inside the +string buffer and directly casts the bytes to the appropriate type, when +allowed. Unpacking of floats and doubles is about 15 times faster now, while +for integer types it's up to ~50% faster for 64bit integers. diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -49,6 +49,8 @@ ACCEPT_CDATA = ACCEPT_CDATA w_gc_wref_remove = None + w_init_once_cache = None + jit_init_once_cache = None @jit.dont_look_inside def __init__(self, space, src_ctx): @@ -585,6 +587,59 @@ return w_result + def descr_init_once(self, w_func, w_tag): + """XXX document me""" + # + # first, a fast-path for the JIT which only works if the very + # same w_tag object is passed; then it turns into no code at all + try: + return self._init_once_elidable(w_tag) + except KeyError: + return self._init_once_slowpath(w_func, w_tag) + + @jit.elidable + def _init_once_elidable(self, w_tag): + jit_cache = self.jit_init_once_cache + if jit_cache is not None: + return jit_cache[w_tag] + else: + raise KeyError + + @jit.dont_look_inside + def _init_once_slowpath(self, w_func, w_tag): + space = self.space + w_cache = self.w_init_once_cache + if w_cache is None: + w_cache = self.space.newdict() + jit_cache = {} + self.w_init_once_cache = w_cache + self.jit_init_once_cache = jit_cache + # + # get the lock or result from cache[tag] + w_res = space.finditem(w_cache, w_tag) + if w_res is None: + w_res = W_InitOnceLock(space) + w_res = space.call_method(w_cache, 'setdefault', w_tag, w_res) + if not isinstance(w_res, W_InitOnceLock): + return w_res + with w_res.lock: + w_res = space.finditem(w_cache, w_tag) + if w_res is None or isinstance(w_res, W_InitOnceLock): + w_res = space.call_function(w_func) + self.jit_init_once_cache[w_tag] = w_res + space.setitem(w_cache, w_tag, w_res) + else: + # the real result was put in the dict while we were + # waiting for lock.__enter__() above + pass + return w_res + + +class W_InitOnceLock(W_Root): + def __init__(self, space): + self.lock = space.allocate_lock() + + @jit.dont_look_inside def make_plain_ffi_object(space, w_ffitype=None): if w_ffitype is None: @@ -641,6 +696,7 @@ from_handle = interp2app(W_FFIObject.descr_from_handle), gc = interp2app(W_FFIObject.descr_gc), getctype = interp2app(W_FFIObject.descr_getctype), + init_once = interp2app(W_FFIObject.descr_init_once), integer_const = interp2app(W_FFIObject.descr_integer_const), memmove = interp2app(W_FFIObject.descr_memmove), new = interp2app(W_FFIObject.descr_new), diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -447,3 +447,19 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + + def test_init_once(self): + import _cffi_backend as _cffi1_backend + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -8,6 +8,7 @@ from pypy.interpreter.error import OperationError from rpython.rlib.objectmodel import specialize, instantiate from rpython.rlib.nonconst import NonConstant +from rpython.rlib.rarithmetic import base_int from pypy.module.micronumpy import boxes, ufuncs from pypy.module.micronumpy.arrayops import where from pypy.module.micronumpy.ndarray import W_NDimArray @@ -178,7 +179,7 @@ return BoolObject(obj) elif isinstance(obj, int): return IntObject(obj) - elif isinstance(obj, long): + elif isinstance(obj, base_int): return LongObject(obj) elif isinstance(obj, W_Root): return obj @@ -196,31 +197,31 @@ return self.float(f) def le(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_le(self, w_obj2) def lt(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_lt(self, w_obj2) def ge(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_ge(self, w_obj2) def add(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_add(self, w_obj2) def sub(self, w_obj1, w_obj2): return self.wrap(1) def mul(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_mul(self, w_obj2) def pow(self, w_obj1, w_obj2, _): @@ -836,7 +837,7 @@ elif self.name == 'reshape': w_arg = self.args[1] assert isinstance(w_arg, ArrayConstant) - order = -1 + order = -1 w_res = arr.reshape(interp.space, w_arg.wrap(interp.space), order) else: assert False diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py --- a/pypy/module/pypyjit/test_pypy_c/test_struct.py +++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py @@ -19,7 +19,8 @@ import struct i = 1 while i < n: - x = struct.unpack("i", struct.pack("i", i))[0] # ID: struct + buf = struct.pack("i", i) # ID: pack + x = struct.unpack("i", buf)[0] # ID: unpack i += x / i return i @@ -29,7 +30,7 @@ loop, = log.loops_by_filename(self.filepath) # This could, of course stand some improvement, to remove all these # arithmatic ops, but we've removed all the core overhead. - assert loop.match_by_id("struct", """ + assert loop.match_by_id("pack", """ guard_not_invalidated(descr=...) # struct.pack %s @@ -40,17 +41,22 @@ i17 = int_and(i16, 255) i19 = int_rshift(i16, 8) i20 = int_and(i19, 255) + """ % extra) + # the newstr and the strsetitems are because the string is forced, + # which is in turn because the optimizer doesn't know how to handle a + # getarrayitem_gc_i on a virtual string. It could be improved, but it + # is also true that in real life cases struct.unpack is called on + # strings which come from the outside, so it's a minor issue. + assert loop.match_by_id("unpack", """ # struct.unpack - i22 = int_lshift(i14, 8) - i23 = int_or(i11, i22) - i25 = int_lshift(i17, 16) - i26 = int_or(i23, i25) - i28 = int_ge(i20, 128) - guard_false(i28, descr=...) - i30 = int_lshift(i20, 24) - i31 = int_or(i26, i30) - """ % extra) + p88 = newstr(4) + strsetitem(p88, 0, i11) + strsetitem(p88, 1, i14) + strsetitem(p88, 2, i17) + strsetitem(p88, 3, i20) + i91 = getarrayitem_gc_i(p88, 0, descr=) + """) def test_struct_object(self): def main(n): @@ -58,7 +64,8 @@ s = struct.Struct("i") i = 1 while i < n: - x = s.unpack(s.pack(i))[0] # ID: struct + buf = s.pack(i) # ID: pack + x = s.unpack(buf)[0] # ID: unpack i += x / i return i @@ -66,7 +73,7 @@ assert log.result == main(1000) loop, = log.loops_by_filename(self.filepath) - assert loop.match_by_id('struct', """ + assert loop.match_by_id('pack', """ guard_not_invalidated(descr=...) # struct.pack %s @@ -77,14 +84,14 @@ i17 = int_and(i16, 255) i19 = int_rshift(i16, 8) i20 = int_and(i19, 255) + """ % extra) + assert loop.match_by_id('unpack', """ # struct.unpack - i22 = int_lshift(i14, 8) - i23 = int_or(i11, i22) - i25 = int_lshift(i17, 16) - i26 = int_or(i23, i25) - i28 = int_ge(i20, 128) - guard_false(i28, descr=...) - i30 = int_lshift(i20, 24) - i31 = int_or(i26, i30) - """ % extra) + p88 = newstr(4) + strsetitem(p88, 0, i11) + strsetitem(p88, 1, i14) + strsetitem(p88, 2, i17) + strsetitem(p88, 3, i20) + i91 = getarrayitem_gc_i(p88, 0, descr=) + """) diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py --- a/pypy/module/struct/formatiterator.py +++ b/pypy/module/struct/formatiterator.py @@ -149,3 +149,13 @@ @specialize.argtype(1) def appendobj(self, value): self.result_w.append(self.space.wrap(value)) + + def get_pos(self): + return self.pos + + def get_buffer_as_string_maybe(self): + string, pos = self.buf.as_str_and_offset_maybe() + return string, pos+self.pos + + def skip(self, size): + self.read(size) # XXX, could avoid taking the slice diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py --- a/pypy/module/struct/test/test_struct.py +++ b/pypy/module/struct/test/test_struct.py @@ -462,3 +462,29 @@ assert self.struct.unpack_from("ii", b, 2) == (17, 42) b[:sz] = self.struct.pack("ii", 18, 43) assert self.struct.unpack_from("ii", b) == (18, 43) + + +class AppTestFastPath(object): + spaceconfig = dict(usemodules=['struct', '__pypy__']) + + def setup_class(cls): + from rpython.rlib.rstruct import standardfmttable + standardfmttable.ALLOW_SLOWPATH = False + # + cls.w_struct = cls.space.appexec([], """(): + import struct + return struct + """) + cls.w_bytebuffer = cls.space.appexec([], """(): + import __pypy__ + return __pypy__.bytebuffer + """) + + def teardown_class(cls): + from rpython.rlib.rstruct import standardfmttable + standardfmttable.ALLOW_SLOWPATH = True + + def test_unpack_from(self): + buf = self.struct.pack("iii", 0, 42, 43) + offset = self.struct.calcsize("i") + assert self.struct.unpack_from("ii", buf, offset) == (42, 43) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1810,3 +1810,35 @@ assert lib.EE1 == 0 assert lib.EE2 == 0 assert lib.EE3 == 1 + + def test_init_once(self): + def do_init(): + seen.append(1) + return 42 + ffi = FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + + def test_init_once_multithread(self): + import thread, time + def do_init(): + seen.append('init!') + time.sleep(1) + seen.append('init done') + return 7 + ffi = FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py @@ -487,7 +487,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -194,6 +194,11 @@ yp = ffi.new_handle([6, 4, 2]) assert ffi.from_handle(yp) == [6, 4, 2] +def test_handle_unique(): + ffi = _cffi1_backend.FFI() + assert ffi.new_handle(None) is not ffi.new_handle(None) + assert ffi.new_handle(None) != ffi.new_handle(None) + def test_ffi_cast(): ffi = _cffi1_backend.FFI() assert ffi.cast("int(*)(int)", 0) == ffi.NULL @@ -416,3 +421,37 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + +def test_init_once(): + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + +def test_init_once_multithread(): + import thread, time + def do_init(): + print 'init!' + seen.append('init!') + time.sleep(1) + seen.append('init done') + print 'init done' + return 7 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -170,14 +170,23 @@ self.value = value def __int__(self): return self.value + class SubInt(int): pass + class SubLong(long): pass + dt10 = datetime.datetime(10, 10, 10, 10, 10, 10, 10) for xx in [10L, decimal.Decimal(10), decimal.Decimal('10.9'), Number(10), - Number(10L)]: - assert datetime.datetime(10, 10, 10, 10, 10, 10, 10) == \ - datetime.datetime(xx, xx, xx, xx, xx, xx, xx) + Number(10L), + SubInt(10), + SubLong(10), + Number(SubInt(10)), + Number(SubLong(10))]: + dtxx = datetime.datetime(xx, xx, xx, xx, xx, xx, xx) + assert dt10 == dtxx + assert type(dtxx.month) is int + assert type(dtxx.second) is int with py.test.raises(TypeError) as e: datetime.datetime(10, 10, '10') @@ -242,6 +251,70 @@ naive == aware assert str(e.value) == "can't compare offset-naive and offset-aware times" + def test_future_types_newint(self): + try: + from future.types.newint import newint + except ImportError: + py.test.skip('requires future') + + dt_from_ints = datetime.datetime(2015, 12, 31, 12, 34, 56) + dt_from_newints = datetime.datetime(newint(2015), newint(12), newint(31), newint(12), newint(34), newint(56)) + dt_from_mixed = datetime.datetime(2015, newint(12), 31, newint(12), 34, newint(56)) + assert dt_from_ints == dt_from_newints + assert dt_from_newints == dt_from_mixed + assert dt_from_mixed == dt_from_ints + + d_from_int = datetime.date.fromtimestamp(1431216000) + d_from_newint = datetime.date.fromtimestamp(newint(1431216000)) + assert d_from_int == d_from_newint + + dt_from_int = datetime.datetime.fromtimestamp(1431216000) + dt_from_newint = datetime.datetime.fromtimestamp(newint(1431216000)) + assert dt_from_int == dt_from_newint + + dtu_from_int = datetime.datetime.utcfromtimestamp(1431216000) + dtu_from_newint = datetime.datetime.utcfromtimestamp(newint(1431216000)) + assert dtu_from_int == dtu_from_newint + + td_from_int = datetime.timedelta(16565) + tds_from_int = datetime.timedelta(seconds=1431216000) + td_from_newint = datetime.timedelta(newint(16565)) + tds_from_newint = datetime.timedelta(seconds=newint(1431216000)) + assert td_from_int == tds_from_int + assert td_from_int == td_from_newint + assert td_from_int == tds_from_newint + assert tds_from_int == td_from_newint + assert tds_from_int == tds_from_newint + assert td_from_newint == tds_from_newint + + td_mul_int_int = td_from_int * 2 + td_mul_int_newint = td_from_int * newint(2) + td_mul_newint_int = td_from_newint * 2 + td_mul_newint_newint = td_from_newint * newint(2) + assert td_mul_int_int == td_mul_int_newint + assert td_mul_int_int == td_mul_newint_int + assert td_mul_int_int == td_mul_newint_newint + assert td_mul_int_newint == td_mul_newint_int + assert td_mul_int_newint == td_mul_newint_newint + assert td_mul_newint_int == td_mul_newint_newint + + td_div_int_int = td_from_int / 3600 + td_div_int_newint = td_from_int / newint(3600) + td_div_newint_int = td_from_newint / 3600 + td_div_newint_newint = td_from_newint / newint(3600) + assert td_div_int_int == td_div_int_newint + assert td_div_int_int == td_div_newint_int + assert td_div_int_int == td_div_newint_newint + assert td_div_int_newint == td_div_newint_int + assert td_div_int_newint == td_div_newint_newint + assert td_div_newint_int == td_div_newint_newint + + def test_return_types(self): + td = datetime.timedelta(5) + assert type(td.total_seconds()) is float + class sub(datetime.timedelta): pass + assert type(+sub()) is datetime.timedelta + class TestDatetimeHost(BaseTestDatetime): def setup_class(cls): diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -638,9 +638,18 @@ return array.getlength() def bh_getarrayitem_gc(self, a, index, descr): - a = support.cast_arg(lltype.Ptr(descr.A), a) + assert index >= 0 + if descr.A is descr.OUTERA: + a = support.cast_arg(lltype.Ptr(descr.A), a) + else: + # we use rffi.cast instead of support.cast_arg because the types + # might not be "compatible" enough from the lltype point of + # view. In particular, this happens when we use + # str_storage_getitem, in which an rpy_string is casted to + # rpy_string_as_Signed (or similar) + a = rffi.cast(lltype.Ptr(descr.OUTERA), a) + a = getattr(a, descr.OUTERA._arrayfld) array = a._obj - assert index >= 0 return support.cast_result(descr.A.OF, array.getitem(index)) bh_getarrayitem_gc_pure_i = bh_getarrayitem_gc diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -570,20 +570,20 @@ return self.read_int_at_mem(array, ofs, WORD, 1) @specialize.argtype(1) - def bh_getarrayitem_gc_i(self, gcref, itemindex, arraydescr): + def bh_gc_load_i(self, gcref, itemindex, arraydescr): ofs, size, sign = self.unpack_arraydescr_size(arraydescr) return self.read_int_at_mem(gcref, ofs + itemindex * size, size, sign) - - def bh_getarrayitem_gc_r(self, gcref, itemindex, arraydescr): - ofs = self.unpack_arraydescr(arraydescr) - return self.read_ref_at_mem(gcref, itemindex * WORD + ofs) - @specialize.argtype(1) - def bh_getarrayitem_gc_f(self, gcref, itemindex, arraydescr): - ofs = self.unpack_arraydescr(arraydescr) - fsize = rffi.sizeof(longlong.FLOATSTORAGE) - return self.read_float_at_mem(gcref, itemindex * fsize + ofs) + def bh_gc_load_r(self, gcref, itemindex, arraydescr): + ofs, size, sign = self.unpack_arraydescr_size(arraydescr) + return self.read_ref_at_mem(gcref, ofs + itemindex * size, size, + sign) + @specialize.argtype(1) + def bh_gc_load_f(self, gcref, itemindex, arraydescr): + ofs, size, sign = self.unpack_arraydescr_size(arraydescr) + return self.read_float_at_mem(gcref, ofs + itemindex * size, size, + sign) @specialize.argtype(1) def bh_setarrayitem_gc_i(self, gcref, itemindex, newvalue, arraydescr): diff --git a/rpython/jit/backend/x86/test/test_strstorage.py b/rpython/jit/backend/x86/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/backend/x86/test/test_strstorage.py @@ -0,0 +1,8 @@ +from rpython.jit.backend.x86.test.test_basic import Jit386Mixin +from rpython.jit.metainterp.test.test_strstorage import TestStrStorage as _TestStrStorage + + +class TestStrStorage(Jit386Mixin, _TestStrStorage): + # for the individual tests see + # ====> ../../../metainterp/test/test_strstorage.py + pass diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -1003,15 +1003,14 @@ elif optype == lltype.Ptr(rbytearray.BYTEARRAY): bytearraydescr = self.cpu.arraydescrof(rbytearray.BYTEARRAY) v_index = op.args[2] - return SpaceOperation('getarrayitem_gc_i', + return SpaceOperation('gc_load_i', [op.args[0], v_index, bytearraydescr], op.result) - else: + elif op.result.concretetype is lltype.Void: + return + elif isinstance(op.args[0].concretetype.TO, lltype.GcArray): + # special-case 1: GcArray of Struct v_inst, v_index, c_field = op.args - if op.result.concretetype is lltype.Void: - return - # only GcArray of Struct supported - assert isinstance(v_inst.concretetype.TO, lltype.GcArray) STRUCT = v_inst.concretetype.TO.OF assert isinstance(STRUCT, lltype.Struct) descr = self.cpu.interiorfielddescrof(v_inst.concretetype.TO, @@ -1020,6 +1019,20 @@ kind = getkind(op.result.concretetype)[0] return SpaceOperation('getinteriorfield_gc_%s' % kind, args, op.result) + elif isinstance(op.args[0].concretetype.TO, lltype.GcStruct): + # special-case 2: GcStruct with Array field + v_inst, c_field, v_index = op.args + STRUCT = v_inst.concretetype.TO + ARRAY = getattr(STRUCT, c_field.value) + assert isinstance(ARRAY, lltype.Array) + arraydescr = self.cpu.arraydescrof(STRUCT) + kind = getkind(op.result.concretetype)[0] + assert kind in ('i', 'f') + return SpaceOperation('gc_load_%s' % kind, + [op.args[0], v_index, arraydescr], + op.result) + else: + assert False, 'not supported' def rewrite_op_setinteriorfield(self, op): assert len(op.args) == 4 @@ -1128,10 +1141,13 @@ def rewrite_op_force_cast(self, op): v_arg = op.args[0] v_result = op.result - assert not self._is_gc(v_arg) - if v_arg.concretetype == v_result.concretetype: return + elif self._is_gc(v_arg) and self._is_gc(v_result): + # cast from GC to GC is always fine + return + else: + assert not self._is_gc(v_arg) float_arg = v_arg.concretetype in [lltype.Float, lltype.SingleFloat] float_res = v_result.concretetype in [lltype.Float, lltype.SingleFloat] diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py --- a/rpython/jit/metainterp/blackhole.py +++ b/rpython/jit/metainterp/blackhole.py @@ -1112,15 +1112,15 @@ @arguments("cpu", "r", "i", "d", "d", returns="i") def bhimpl_getlistitem_gc_i(cpu, lst, index, itemsdescr, arraydescr): items = cpu.bh_getfield_gc_r(lst, itemsdescr) - return cpu.bh_getarrayitem_gc_i(items, index, arraydescr) + return cpu.bh_gc_load_i(items, index, arraydescr) @arguments("cpu", "r", "i", "d", "d", returns="r") def bhimpl_getlistitem_gc_r(cpu, lst, index, itemsdescr, arraydescr): items = cpu.bh_getfield_gc_r(lst, itemsdescr) - return cpu.bh_getarrayitem_gc_r(items, index, arraydescr) + return cpu.bh_gc_load_r(items, index, arraydescr) @arguments("cpu", "r", "i", "d", "d", returns="f") def bhimpl_getlistitem_gc_f(cpu, lst, index, itemsdescr, arraydescr): items = cpu.bh_getfield_gc_r(lst, itemsdescr) - return cpu.bh_getarrayitem_gc_f(items, index, arraydescr) + return cpu.bh_gc_load_f(items, index, arraydescr) @arguments("cpu", "r", "i", "i", "d", "d") def bhimpl_setlistitem_gc_i(cpu, lst, index, nval, itemsdescr, arraydescr): @@ -1246,18 +1246,28 @@ return cpu.bh_new_array_clear(length, arraydescr) @arguments("cpu", "r", "i", "d", returns="i") - def bhimpl_getarrayitem_gc_i(cpu, array, index, arraydescr): - return cpu.bh_getarrayitem_gc_i(array, index, arraydescr) + def bhimpl_gc_load_i(cpu, array, index, arraydescr): + return cpu.bh_gc_load_i(array, index, arraydescr) + @arguments("cpu", "r", "i", "d", returns="i") + def bhimpl_gc_load_r(cpu, array, index, arraydescr): + return cpu.bh_gc_load_r(array, index, arraydescr) + @arguments("cpu", "r", "i", "d", returns="i") + def bhimpl_gc_load_f(cpu, array, index, arraydescr): + return cpu.bh_gc_load_f(array, index, arraydescr) + + @arguments("cpu", "r", "i", "d", returns="i") + def bhimpl_gc_load_i(cpu, array, index, arraydescr): + return cpu.bh_gc_load_i(array, index, arraydescr) @arguments("cpu", "r", "i", "d", returns="r") - def bhimpl_getarrayitem_gc_r(cpu, array, index, arraydescr): - return cpu.bh_getarrayitem_gc_r(array, index, arraydescr) + def bhimpl_gc_load_r(cpu, array, index, arraydescr): + return cpu.bh_gc_load_r(array, index, arraydescr) @arguments("cpu", "r", "i", "d", returns="f") - def bhimpl_getarrayitem_gc_f(cpu, array, index, arraydescr): - return cpu.bh_getarrayitem_gc_f(array, index, arraydescr) + def bhimpl_gc_load_f(cpu, array, index, arraydescr): + return cpu.bh_gc_load_f(array, index, arraydescr) - bhimpl_getarrayitem_gc_i_pure = bhimpl_getarrayitem_gc_i - bhimpl_getarrayitem_gc_r_pure = bhimpl_getarrayitem_gc_r - bhimpl_getarrayitem_gc_f_pure = bhimpl_getarrayitem_gc_f + bhimpl_getarrayitem_gc_i_pure = bhimpl_gc_load_i + bhimpl_getarrayitem_gc_r_pure = bhimpl_gc_load_r + bhimpl_getarrayitem_gc_f_pure = bhimpl_gc_load_f @arguments("cpu", "i", "i", "d", returns="i") def bhimpl_getarrayitem_raw_i(cpu, array, index, arraydescr): @@ -1293,17 +1303,17 @@ def bhimpl_getarrayitem_vable_i(cpu, vable, index, fielddescr, arraydescr): fielddescr.get_vinfo().clear_vable_token(vable) array = cpu.bh_getfield_gc_r(vable, fielddescr) - return cpu.bh_getarrayitem_gc_i(array, index, arraydescr) + return cpu.bh_gc_load_i(array, index, arraydescr) @arguments("cpu", "r", "i", "d", "d", returns="r") def bhimpl_getarrayitem_vable_r(cpu, vable, index, fielddescr, arraydescr): fielddescr.get_vinfo().clear_vable_token(vable) array = cpu.bh_getfield_gc_r(vable, fielddescr) - return cpu.bh_getarrayitem_gc_r(array, index, arraydescr) + return cpu.bh_gc_load_r(array, index, arraydescr) @arguments("cpu", "r", "i", "d", "d", returns="f") def bhimpl_getarrayitem_vable_f(cpu, vable, index, fielddescr, arraydescr): fielddescr.get_vinfo().clear_vable_token(vable) array = cpu.bh_getfield_gc_r(vable, fielddescr) - return cpu.bh_getarrayitem_gc_f(array, index, arraydescr) + return cpu.bh_gc_load_f(array, index, arraydescr) @arguments("cpu", "r", "i", "i", "d", "d") def bhimpl_setarrayitem_vable_i(cpu, vable, index, newval, fdescr, adescr): diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -101,20 +101,20 @@ if condbox.getint(): do_call_n(cpu, metainterp, argboxes[1:], descr) -def do_getarrayitem_gc_i(cpu, _, arraybox, indexbox, arraydescr): +def do_gc_load_i(cpu, _, arraybox, indexbox, arraydescr): array = arraybox.getref_base() index = indexbox.getint() - return cpu.bh_getarrayitem_gc_i(array, index, arraydescr) + return cpu.bh_gc_load_i(array, index, arraydescr) -def do_getarrayitem_gc_r(cpu, _, arraybox, indexbox, arraydescr): +def do_gc_load_r(cpu, _, arraybox, indexbox, arraydescr): array = arraybox.getref_base() index = indexbox.getint() - return cpu.bh_getarrayitem_gc_r(array, index, arraydescr) + return cpu.bh_gc_load_r(array, index, arraydescr) -def do_getarrayitem_gc_f(cpu, _, arraybox, indexbox, arraydescr): +def do_gc_load_f(cpu, _, arraybox, indexbox, arraydescr): array = arraybox.getref_base() index = indexbox.getint() - return cpu.bh_getarrayitem_gc_f(array, index, arraydescr) + return cpu.bh_gc_load_f(array, index, arraydescr) def do_getarrayitem_raw_i(cpu, _, arraybox, indexbox, arraydescr): array = arraybox.getint() diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -534,11 +534,17 @@ cf = self.field_cache(op.getdescr()) cf.do_setfield(self, op) - def optimize_GETARRAYITEM_GC_I(self, op): + def optimize_GC_LOAD_I(self, op): + # When using str_storage_getitem it might happen that op.getarg(0) is + # a virtual string, NOT an array. In that case, we cannot cache the + # getarrayitem as if it were an array, obviously. In theory we could + # improve by writing special code to interpter the buffer of the + # virtual string as if it were an array, but it looks complicate, + # fragile and not worth it. arrayinfo = self.ensure_ptr_info_arg0(op) indexb = self.getintbound(op.getarg(1)) cf = None - if indexb.is_constant(): + if indexb.is_constant() and not arrayinfo.is_vstring(): index = indexb.getint() arrayinfo.getlenbound(None).make_gt_const(index) # use the cache on (arraydescr, index), which is a constant @@ -555,13 +561,13 @@ self.make_nonnull(op.getarg(0)) self.emit_operation(op) # the remember the result of reading the array item - if cf is not None: + if cf is not None and not arrayinfo.is_vstring(): arrayinfo.setitem(op.getdescr(), indexb.getint(), self.get_box_replacement(op.getarg(0)), self.get_box_replacement(op), cf, self) - optimize_GETARRAYITEM_GC_R = optimize_GETARRAYITEM_GC_I - optimize_GETARRAYITEM_GC_F = optimize_GETARRAYITEM_GC_I + optimize_GC_LOAD_R = optimize_GC_LOAD_I + optimize_GC_LOAD_F = optimize_GC_LOAD_I def optimize_GETARRAYITEM_GC_PURE_I(self, op): arrayinfo = self.ensure_ptr_info_arg0(op) diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py --- a/rpython/jit/metainterp/optimizeopt/info.py +++ b/rpython/jit/metainterp/optimizeopt/info.py @@ -24,6 +24,9 @@ def is_virtual(self): return False + def is_vstring(self): + return False + def is_precise(self): return False diff --git a/rpython/jit/metainterp/optimizeopt/intbounds.py b/rpython/jit/metainterp/optimizeopt/intbounds.py --- a/rpython/jit/metainterp/optimizeopt/intbounds.py +++ b/rpython/jit/metainterp/optimizeopt/intbounds.py @@ -464,9 +464,10 @@ intbound.make_le(IntUpperBound(descr.get_item_integer_max())) optimize_GETARRAYITEM_RAW_F = optimize_GETARRAYITEM_RAW_I - optimize_GETARRAYITEM_GC_I = optimize_GETARRAYITEM_RAW_I - optimize_GETARRAYITEM_GC_F = optimize_GETARRAYITEM_RAW_I - optimize_GETARRAYITEM_GC_R = optimize_GETARRAYITEM_RAW_I + + optimize_GC_LOAD_I = optimize_GETARRAYITEM_RAW_I + optimize_GC_LOAD_F = optimize_GETARRAYITEM_RAW_I + optimize_GC_LOAD_R = optimize_GETARRAYITEM_RAW_I def optimize_UNICODEGETITEM(self, op): self.emit_operation(op) diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -314,9 +314,16 @@ args, virtuals = target_virtual_state.make_inputargs_and_virtuals( args, self.optimizer) short_preamble = target_token.short_preamble - extra = self.inline_short_preamble(args + virtuals, args, - short_preamble, self.optimizer.patchguardop, - target_token, label_op) + try: + extra = self.inline_short_preamble(args + virtuals, args, + short_preamble, self.optimizer.patchguardop, + target_token, label_op) + except KeyError: + # SHOULD NOT OCCUR BUT DOES: WHY?? issue #2185 + self.optimizer.metainterp_sd.logger_ops.log_short_preamble([], + short_preamble, {}) + raise + self.send_extra_operation(jump_op.copy_and_change(rop.JUMP, args=args + extra, descr=target_token)) diff --git a/rpython/jit/metainterp/optimizeopt/virtualize.py b/rpython/jit/metainterp/optimizeopt/virtualize.py --- a/rpython/jit/metainterp/optimizeopt/virtualize.py +++ b/rpython/jit/metainterp/optimizeopt/virtualize.py @@ -270,9 +270,11 @@ self.make_nonnull(op.getarg(0)) self.emit_operation(op) - def optimize_GETARRAYITEM_GC_I(self, op): + def optimize_GC_LOAD_I(self, op): + # When using str_storage_getitem we op.getarg(0) is a string, NOT an + # array, hence the check. In that case, it will be forced opinfo = self.getptrinfo(op.getarg(0)) - if opinfo and opinfo.is_virtual(): + if opinfo and opinfo.is_virtual() and not opinfo.is_vstring(): indexbox = self.get_constant_box(op.getarg(1)) if indexbox is not None: item = opinfo.getitem(op.getdescr(), indexbox.getint()) @@ -283,14 +285,15 @@ return self.make_nonnull(op.getarg(0)) self.emit_operation(op) - optimize_GETARRAYITEM_GC_R = optimize_GETARRAYITEM_GC_I - optimize_GETARRAYITEM_GC_F = optimize_GETARRAYITEM_GC_I + optimize_GC_LOAD_R = optimize_GC_LOAD_I + optimize_GC_LOAD_F = optimize_GC_LOAD_I + _optimize_GETARRAYITEM_GC_I = optimize_GC_LOAD_I # TODO # note: the following line does not mean that the two operations are # completely equivalent, because GETARRAYITEM_GC_PURE is_always_pure(). - optimize_GETARRAYITEM_GC_PURE_I = optimize_GETARRAYITEM_GC_I - optimize_GETARRAYITEM_GC_PURE_R = optimize_GETARRAYITEM_GC_I - optimize_GETARRAYITEM_GC_PURE_F = optimize_GETARRAYITEM_GC_I + optimize_GETARRAYITEM_GC_PURE_I = _optimize_GETARRAYITEM_GC_I + optimize_GETARRAYITEM_GC_PURE_R = _optimize_GETARRAYITEM_GC_I + optimize_GETARRAYITEM_GC_PURE_F = _optimize_GETARRAYITEM_GC_I def optimize_SETARRAYITEM_GC(self, op): opinfo = self.getptrinfo(op.getarg(0)) diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py b/rpython/jit/metainterp/optimizeopt/vstring.py --- a/rpython/jit/metainterp/optimizeopt/vstring.py +++ b/rpython/jit/metainterp/optimizeopt/vstring.py @@ -62,6 +62,9 @@ self.mode = mode self.length = length + def is_vstring(self): + return True + def getlenbound(self, mode): from rpython.jit.metainterp.optimizeopt import intutils diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -475,18 +475,18 @@ return resop @arguments("box", "box", "descr") - def opimpl_getarrayitem_gc_i(self, arraybox, indexbox, arraydescr): - return self._do_getarrayitem_gc_any(rop.GETARRAYITEM_GC_I, arraybox, + def opimpl_gc_load_i(self, arraybox, indexbox, arraydescr): + return self._do_getarrayitem_gc_any(rop.GC_LOAD_I, arraybox, indexbox, arraydescr) @arguments("box", "box", "descr") - def opimpl_getarrayitem_gc_r(self, arraybox, indexbox, arraydescr): - return self._do_getarrayitem_gc_any(rop.GETARRAYITEM_GC_R, arraybox, + def opimpl_gc_load_r(self, arraybox, indexbox, arraydescr): + return self._do_getarrayitem_gc_any(rop.GC_LOAD_R, arraybox, indexbox, arraydescr) @arguments("box", "box", "descr") - def opimpl_getarrayitem_gc_f(self, arraybox, indexbox, arraydescr): - return self._do_getarrayitem_gc_any(rop.GETARRAYITEM_GC_F, arraybox, + def opimpl_gc_load_f(self, arraybox, indexbox, arraydescr): + return self._do_getarrayitem_gc_any(rop.GC_LOAD_F, arraybox, indexbox, arraydescr) @arguments("box", "box", "descr") @@ -614,17 +614,17 @@ def opimpl_getlistitem_gc_i(self, listbox, indexbox, itemsdescr, arraydescr): arraybox = self.opimpl_getfield_gc_r(listbox, itemsdescr) - return self.opimpl_getarrayitem_gc_i(arraybox, indexbox, arraydescr) + return self.opimpl_gc_load_i(arraybox, indexbox, arraydescr) @arguments("box", "box", "descr", "descr") def opimpl_getlistitem_gc_r(self, listbox, indexbox, itemsdescr, arraydescr): arraybox = self.opimpl_getfield_gc_r(listbox, itemsdescr) - return self.opimpl_getarrayitem_gc_r(arraybox, indexbox, arraydescr) + return self.opimpl_gc_load_r(arraybox, indexbox, arraydescr) @arguments("box", "box", "descr", "descr") def opimpl_getlistitem_gc_f(self, listbox, indexbox, itemsdescr, arraydescr): arraybox = self.opimpl_getfield_gc_r(listbox, itemsdescr) - return self.opimpl_getarrayitem_gc_f(arraybox, indexbox, arraydescr) + return self.opimpl_gc_load_f(arraybox, indexbox, arraydescr) @arguments("box", "box", "box", "descr", "descr") def _opimpl_setlistitem_gc_any(self, listbox, indexbox, valuebox, @@ -956,11 +956,11 @@ if self._nonstandard_virtualizable(pc, box, fdescr): arraybox = self.opimpl_getfield_gc_r(box, fdescr) if adescr.is_array_of_pointers(): - return self.opimpl_getarrayitem_gc_r(arraybox, indexbox, adescr) + return self.opimpl_gc_load_r(arraybox, indexbox, adescr) elif adescr.is_array_of_floats(): - return self.opimpl_getarrayitem_gc_f(arraybox, indexbox, adescr) + return self.opimpl_gc_load_f(arraybox, indexbox, adescr) else: - return self.opimpl_getarrayitem_gc_i(arraybox, indexbox, adescr) + return self.opimpl_gc_load_i(arraybox, indexbox, adescr) self.metainterp.check_synchronized_virtualizable() index = self._get_arrayitem_vable_index(pc, fdescr, indexbox) return self.metainterp.virtualizable_boxes[index] diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -396,8 +396,8 @@ rop.GETFIELD_GC_PURE_R, rop.GETFIELD_GC_PURE_F) def is_getarrayitem(self): - return self.opnum in (rop.GETARRAYITEM_GC_I, rop.GETARRAYITEM_GC_F, - rop.GETARRAYITEM_GC_R, rop.GETARRAYITEM_GC_PURE_I, + return self.opnum in (rop.GC_LOAD_I, rop.GC_LOAD_F, + rop.GC_LOAD_R, rop.GETARRAYITEM_GC_PURE_I, rop.GETARRAYITEM_GC_PURE_F, rop.GETARRAYITEM_GC_PURE_R) @@ -1087,34 +1087,35 @@ 'INSTANCE_PTR_NE/2b/i', 'NURSERY_PTR_INCREMENT/2/r', # - # DEL 'ARRAYLEN_GC/1d/i', - # DEL 'STRLEN/1/i', + 'ARRAYLEN_GC/1d/i', + 'STRLEN/1/i', 'STRGETITEM/2/i', 'GETFIELD_GC_PURE/1d/rfi', - # DEL 'GETARRAYITEM_GC_PURE/2d/rfi', + 'GETARRAYITEM_GC_PURE/2d/rfi', #'GETFIELD_RAW_PURE/1d/rfi', these two operations not useful and #'GETARRAYITEM_RAW_PURE/2d/fi', dangerous when unrolling speculatively - # DEL 'UNICODELEN/1/i', - # DEL 'UNICODEGETITEM/2/i', + 'UNICODELEN/1/i', + 'UNICODEGETITEM/2/i', # '_ALWAYS_PURE_LAST', # ----- end of always_pure operations ----- + 'GC_LOAD/2d/irf', + # NEW 'GC_LOAD_INDEXED/2d/rfi', + '_RAW_LOAD_FIRST', - #'GETARRAYITEM_GC/2d/rfi', - #'VEC_GETARRAYITEM_GC/2d/fi', - #'GETARRAYITEM_RAW/2d/fi', - #'VEC_GETARRAYITEM_RAW/2d/fi', - 'RAW_LOAD/2d/rfi', - 'RAW_LOAD_INDEXED/2d/rfi', - 'VEC_RAW_LOAD/2d/rfi', + # DEL 'GETARRAYITEM_GC/2d/rfi', + 'VEC_GETARRAYITEM_GC/2d/fi', + 'GETARRAYITEM_RAW/2d/fi', + 'VEC_GETARRAYITEM_RAW/2d/fi', + 'RAW_LOAD/2d/fi', + # NEW 'RAW_LOAD_INDEXED/2d/rfi', + 'VEC_RAW_LOAD/2d/fi', '_RAW_LOAD_LAST', - 'GC_LOAD/2d/rfi', - 'GC_LOAD_INDEXED/2d/rfi', - # DEL 'GETINTERIORFIELD_GC/2d/rfi', - # DEL 'GETFIELD_GC/1d/rfi', - # DEL 'GETFIELD_RAW/1d/rfi', + 'GETINTERIORFIELD_GC/2d/rfi', + 'GETFIELD_GC/1d/rfi', + 'GETFIELD_RAW/1d/rfi', '_MALLOC_FIRST', 'NEW/0d/r', #-> GcStruct, gcptrs inside are zeroed (not the rest) 'NEW_WITH_VTABLE/0d/r',#-> GcStruct with vtable, gcptrs inside are zeroed @@ -1129,30 +1130,31 @@ # must be forced, however we need to execute it anyway '_NOSIDEEFFECT_LAST', # ----- end of no_side_effect operations ----- + # NEW 'GC_STORE/3d/n', + # NEW 'GC_STORE_INDEXED/3d/n', + 'INCREMENT_DEBUG_COUNTER/1/n', '_RAW_STORE_FIRST', - # DEL 'SETARRAYITEM_GC/3d/n', - # DEL 'VEC_SETARRAYITEM_GC/3d/n', - # DEL 'SETARRAYITEM_RAW/3d/n', - # DEL 'VEC_SETARRAYITEM_RAW/3d/n', + 'SETARRAYITEM_GC/3d/n', + 'VEC_SETARRAYITEM_GC/3d/n', + 'SETARRAYITEM_RAW/3d/n', + 'VEC_SETARRAYITEM_RAW/3d/n', 'RAW_STORE/3d/n', - 'RAW_STORE_INDEXED/3d/n', + #'RAW_STORE_INDEXED/3d/n', 'VEC_RAW_STORE/3d/n', '_RAW_STORE_LAST', - 'GC_STORE/3d/n', - 'GC_STORE_INDEXED/3d/n', - # DEL 'SETINTERIORFIELD_GC/3d/n', - # DEL 'SETINTERIORFIELD_RAW/3d/n', # right now, only used by tests - # DEL 'SETFIELD_GC/2d/n', + 'SETINTERIORFIELD_GC/3d/n', + 'SETINTERIORFIELD_RAW/3d/n', # right now, only used by tests + 'SETFIELD_GC/2d/n', 'ZERO_PTR_FIELD/2/n', # only emitted by the rewrite, clears a pointer field # at a given constant offset, no descr 'ZERO_ARRAY/3d/n', # only emitted by the rewrite, clears (part of) an array # [arraygcptr, firstindex, length], descr=ArrayDescr - # DEL 'SETFIELD_RAW/2d/n', - # DEL 'STRSETITEM/3/n', - # DEL 'UNICODESETITEM/3/n', + 'SETFIELD_RAW/2d/n', + 'STRSETITEM/3/n', + 'UNICODESETITEM/3/n', 'COND_CALL_GC_WB/1d/n', # [objptr] (for the write barrier) 'COND_CALL_GC_WB_ARRAY/2d/n', # [objptr, arrayindex] (write barr. for array) '_JIT_DEBUG_FIRST', @@ -1375,17 +1377,17 @@ rop.RAW_LOAD_I: rop.VEC_RAW_LOAD_I, rop.RAW_LOAD_F: rop.VEC_RAW_LOAD_F, rop.GC_LOAD_I: rop.VEC_RAW_LOAD_I, - rop.GC_LOAD_F: rop.VEC_RAW_LOAD_F, + #rop.GC_LOAD_F: rop.VEC_RAW_LOAD_F, #rop.GETARRAYITEM_RAW_I: rop.VEC_GETARRAYITEM_RAW_I, #rop.GETARRAYITEM_RAW_F: rop.VEC_GETARRAYITEM_RAW_F, - #rop.GETARRAYITEM_GC_I: rop.VEC_GETARRAYITEM_GC_I, - #rop.GETARRAYITEM_GC_F: rop.VEC_GETARRAYITEM_GC_F, + #rop.GC_LOAD_I: rop.VEC_GC_LOAD_I, + #rop.GC_LOAD_F: rop.VEC_GC_LOAD_F, # note that there is no _PURE operation for vector operations. # reason: currently we do not care if it is pure or not! - #rop.GETARRAYITEM_GC_PURE_I: rop.VEC_GETARRAYITEM_GC_I, - #rop.GETARRAYITEM_GC_PURE_F: rop.VEC_GETARRAYITEM_GC_F, + #rop.GETARRAYITEM_GC_PURE_I: rop.VEC_GC_LOAD_I, + #rop.GETARRAYITEM_GC_PURE_F: rop.VEC_GC_LOAD_F, rop.RAW_STORE: rop.VEC_RAW_STORE, - rop.GC_STORE: rop.VEC_RAW_STORE, # TODO + #rop.GC_STORE: rop.VEC_RAW_STORE, # TODO #rop.SETARRAYITEM_RAW: rop.VEC_SETARRAYITEM_RAW, #rop.SETARRAYITEM_GC: rop.VEC_SETARRAYITEM_GC, @@ -1550,10 +1552,10 @@ @staticmethod def getarrayitem_for_descr(descr): if descr.is_array_of_pointers(): - return rop.GETARRAYITEM_GC_R + return rop.GC_LOAD_R elif descr.is_array_of_floats(): - return rop.GETARRAYITEM_GC_F - return rop.GETARRAYITEM_GC_I + return rop.GC_LOAD_F + return rop.GC_LOAD_I @staticmethod def same_as_for_type(tp): diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -0,0 +1,53 @@ +import py +import sys +import struct +from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rlib.strstorage import str_storage_getitem +from rpython.rlib.test.test_strstorage import BaseStrStorageTest +from rpython.jit.codewriter import longlong +from rpython.jit.metainterp.history import getkind +from rpython.jit.metainterp.test.support import LLJitMixin + +class TestStrStorage(BaseStrStorageTest, LLJitMixin): + + # for the individual tests see + # ====> ../../../rlib/test/test_strstorage.py + + def str_storage_getitem(self, TYPE, buf, offset): + def f(): + return str_storage_getitem(TYPE, buf, offset) + res = self.interp_operations(f, [], supports_singlefloats=True) + # + kind = getkind(TYPE)[0] # 'i' or 'f' + self.check_operations_history({'getarrayitem_gc_%s' % kind: 1, + 'finish': 1}) + # + if TYPE == lltype.SingleFloat: + # interp_operations returns the int version of r_singlefloat, but + # our tests expects to receive an r_singlefloat: let's convert it + # back! + return longlong.int2singlefloat(res) + return res + + def str_storage_supported(self, TYPE): + py.test.skip('this is not a JIT test') + + def test_force_virtual_str_storage(self): + byteorder = sys.byteorder + size = rffi.sizeof(lltype.Signed) + def f(val): + if byteorder == 'little': + x = chr(val) + '\x00'*(size-1) + else: + x = '\x00'*(size-1) + chr(val) + return str_storage_getitem(lltype.Signed, x, 0) + res = self.interp_operations(f, [42], supports_singlefloats=True) + assert res == 42 + self.check_operations_history({ + 'newstr': 1, # str forcing + 'strsetitem': 1, # str forcing + 'call_pure_r': 1, # str forcing (copystrcontent) + 'guard_no_exception': 1, # str forcing + 'getarrayitem_gc_i': 1, # str_storage_getitem + 'finish': 1 + }) diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py --- a/rpython/rlib/buffer.py +++ b/rpython/rlib/buffer.py @@ -22,6 +22,14 @@ # May be overridden. return self.getslice(0, self.getlength(), 1, self.getlength()) + def as_str_and_offset_maybe(self): + """ + If the buffer is backed by a string, return a pair (string, offset), where + offset is the offset inside the string where the buffer start. + Else, return (None, 0). + """ + return None, 0 + def getitem(self, index): "Returns the index'th character in the buffer." raise NotImplementedError # Must be overriden. No bounds checks. @@ -66,6 +74,9 @@ def as_str(self): return self.value + def as_str_and_offset_maybe(self): + return self.value, 0 + def getitem(self, index): return self.value[index] @@ -99,6 +110,12 @@ else: return 0 + def as_str_and_offset_maybe(self): + string, offset = self.buffer.as_str_and_offset_maybe() + if string is not None: + return string, offset+self.offset + return None, 0 + def getitem(self, index): return self.buffer.getitem(self.offset + index) diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py --- a/rpython/rlib/rstruct/nativefmttable.py +++ b/rpython/rlib/rstruct/nativefmttable.py @@ -8,15 +8,15 @@ from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_singlefloat, widen from rpython.rlib.rstruct import standardfmttable as std +from rpython.rlib.rstruct.standardfmttable import native_is_bigendian from rpython.rlib.rstruct.error import StructError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.strstorage import str_storage_getitem from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.tool import rffi_platform from rpython.translator.tool.cbuild import ExternalCompilationInfo -native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) - native_fmttable = { 'x': std.standard_fmttable['x'], 'c': std.standard_fmttable['c'], @@ -27,9 +27,6 @@ # ____________________________________________________________ From noreply at buildbot.pypy.org Wed Nov 25 07:56:44 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 13:56:44 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify: close branch Message-ID: <20151125125644.4F7F51C0337@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify Changeset: r80940:c081afd4ac18 Date: 2015-11-25 13:56 +0100 http://bitbucket.org/pypy/pypy/changeset/c081afd4ac18/ Log: close branch From noreply at buildbot.pypy.org Wed Nov 25 07:56:46 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 13:56:46 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: successor of memop-simplify Message-ID: <20151125125646.6866A1C0337@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80941:cb29d1aae79a Date: 2015-11-25 13:57 +0100 http://bitbucket.org/pypy/pypy/changeset/cb29d1aae79a/ Log: successor of memop-simplify From noreply at buildbot.pypy.org Wed Nov 25 09:16:35 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 15:16:35 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: added gc_load, gc_load_indexed as resop Message-ID: <20151125141635.DCD681C0400@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80942:397e21b4ff04 Date: 2015-11-25 15:16 +0100 http://bitbucket.org/pypy/pypy/changeset/397e21b4ff04/ Log: added gc_load,gc_load_indexed as resop started the rewrite transformation and added dummies to the x86 backend diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -32,6 +32,11 @@ done_with_this_frame_descr_void = None exit_frame_with_exception_descr_ref = None + # can an ISA instruction handle a constant offset? + load_constant_offset = False + # can an ISA instruction handle a factor to the offset? + load_supported_factors = [1] + vector_extension = False vector_register_size = 0 # in bytes vector_horizontal_operations = False diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -112,6 +112,33 @@ assert not op.get_forwarded() op.set_forwarded(newop) + def handle_getarrayitem(self, op): + itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) + ptr_box, index_box = op.getargs() + + offset = 0 + factor = 1 + # i * f + c + if itemsize in self.cpu.load_supported_factors: + factor = itemsize + else: + index_box = ResOperation(rop.INT_MUL, [index_box, Const(factor)]) + self.emit_op(index_box) + # adjust the constant offset + if self.cpu.load_constant_offset: + offset = ofs + else: + index_box = ResOperation(rop.INT_ADD, [index_box, Const(ofs)]) + self.emit_op(index_box) + if factor == 1 and offset == 0: + newload = ResOperation(OpHelpers.get_gc_load(op.type), + [ptr_box, index_box, Const(itemsize), Const(sign)]) + self.replace_op_with(newload, op) + else: + newload = ResOperation(OpHelpers.get_gc_load_scaled(op.type), + [ptr_box, index_box, Const(factor), Const(offset), Const(sign)]) + self.replace_op_with(newload, op) + def rewrite(self, operations): # we can only remember one malloc since the next malloc can possibly # collect; but we can try to collapse several known-size mallocs into @@ -128,6 +155,10 @@ continue if op is self._changed_op: op = self._changed_op_to + # ---------- GC_LOAD -------------- + if op.is_getarrayitem(): # TODO + self.handle_getarrayitem(op) + pass # ---------- GETFIELD_GC ---------- if op.getopnum() in (rop.GETFIELD_GC_I, rop.GETFIELD_GC_F, rop.GETFIELD_GC_R): diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1481,6 +1481,17 @@ genop_getfield_gc_pure_r = _genop_getfield genop_getfield_gc_pure_f = _genop_getfield + def _genop_gc_load(self, op, arglocs, resloc): + base_loc, ofs_loc, size_loc, sign_loc = arglocs + assert isinstance(ofs, ImmedLoc) + assert isinstance(size_loc, ImmedLoc) + scale = get_scale(size_loc.value) + self.load_from_mem(resloc, ofs_loc, size_loc, sign_loc) + + genop_gc_load_i = _genop_gc_load + genop_gc_load_r = _genop_gc_load + genop_gc_load_f = _genop_gc_load + def _genop_getarrayitem(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, ofs, sign_loc = arglocs assert isinstance(ofs, ImmedLoc) diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1172,6 +1172,22 @@ consider_raw_load_i = _consider_getarrayitem consider_raw_load_f = _consider_getarrayitem + def _consider_gc_load(self, op): + ptr, index, size, sign = op.getarglist() + base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) + ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args) + result_loc = self.force_allocate_reg(op) + if sign.value: + sign_loc = imm1 + else: + sign_loc = imm0 + size_loc = imm(size.value) + self.perform(op, [base_loc, ofs_loc, size_loc, sign_loc], result_loc) + + consider_gc_load_i = _consider_gc_load + consider_gc_load_r = _consider_gc_load + consider_gc_load_f = _consider_gc_load + def _consider_getinteriorfield(self, op): t = unpack_interiorfielddescr(op.getdescr()) ofs, itemsize, fieldsize, sign = imm(t[0]), imm(t[1]), imm(t[2]), t[3] diff --git a/rpython/jit/backend/x86/runner.py b/rpython/jit/backend/x86/runner.py --- a/rpython/jit/backend/x86/runner.py +++ b/rpython/jit/backend/x86/runner.py @@ -24,6 +24,11 @@ with_threads = False frame_reg = regloc.ebp + # can an ISA instruction handle a constant offset? + load_constant_offset = False + # can an ISA instruction handle a factor to the offset? + load_supported_factors = [1] + from rpython.jit.backend.x86.arch import JITFRAME_FIXED_SIZE all_reg_indexes = gpr_reg_mgr_cls.all_reg_indexes gen_regs = gpr_reg_mgr_cls.all_regs diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -397,6 +397,12 @@ rop.VEC_GETARRAYITEM_GC_I, rop.VEC_GETARRAYITEM_GC_F, rop.VEC_SETARRAYITEM_GC, + rop.GC_LOAD_I, + rop.GC_LOAD_R, + rop.GC_LOAD_F, + rop.GC_LOAD_INDEX_I, + rop.GC_LOAD_INDEX_R, + rop.GC_LOAD_INDEX_F, ): # list of opcodes never executed by pyjitpl continue if rop._VEC_PURE_FIRST <= value <= rop._VEC_PURE_LAST: diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1099,6 +1099,9 @@ # '_ALWAYS_PURE_LAST', # ----- end of always_pure operations ----- + 'GC_LOAD/3/rfi', + 'GC_LOAD_INDEX/4/rfi', + '_RAW_LOAD_FIRST', 'GETARRAYITEM_GC/2d/rfi', 'VEC_GETARRAYITEM_GC/2d/fi', @@ -1603,6 +1606,26 @@ opnum == rop.CALL_RELEASE_GIL_N) @staticmethod + def get_gc_load(tp): + if tp == 'i': + return rop.GC_LOAD_I + elif tp == 'f': + return rop.GC_LOAD_F + else: + assert tp == 'r' + return rop.GC_LOAD_R + + @staticmethod + def get_gc_load_scaled(tp): + if tp == 'i': + return rop.GC_LOAD_SCALED_I + elif tp == 'f': + return rop.GC_LOAD_SCALED_F + else: + assert tp == 'r' + return rop.GC_LOAD_SCALED_R + + @staticmethod def inputarg_from_tp(tp): if tp == 'i': return InputArgInt() From noreply at buildbot.pypy.org Wed Nov 25 10:19:22 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 16:19:22 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: added basic transformation tests that check getarrayitem_gc_irf -> gc_load_irf Message-ID: <20151125151922.9DC381C0337@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80943:ddb6d7bd0eca Date: 2015-11-25 16:00 +0100 http://bitbucket.org/pypy/pypy/changeset/ddb6d7bd0eca/ Log: added basic transformation tests that check getarrayitem_gc_irf -> gc_load_irf diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -35,7 +35,7 @@ # can an ISA instruction handle a constant offset? load_constant_offset = False # can an ISA instruction handle a factor to the offset? - load_supported_factors = [1] + load_supported_factors = (1,) vector_extension = False vector_register_size = 0 # in bytes diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -10,6 +10,7 @@ from rpython.jit.backend.llsupport.descr import SizeDescr, ArrayDescr,\ FLAG_POINTER from rpython.jit.metainterp.history import JitCellToken +from rpython.jit.backend.llsupport.descr import (unpack_arraydescr,) FLAG_ARRAY = 0 FLAG_STR = 1 @@ -114,7 +115,7 @@ def handle_getarrayitem(self, op): itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) - ptr_box, index_box = op.getargs() + ptr_box, index_box = op.getarglist() offset = 0 factor = 1 @@ -122,22 +123,25 @@ if itemsize in self.cpu.load_supported_factors: factor = itemsize else: - index_box = ResOperation(rop.INT_MUL, [index_box, Const(factor)]) + index_box = ResOperation(rop.INT_MUL, [index_box, ConstInt(itemsize)]) self.emit_op(index_box) # adjust the constant offset if self.cpu.load_constant_offset: - offset = ofs + offset = 0 else: - index_box = ResOperation(rop.INT_ADD, [index_box, Const(ofs)]) - self.emit_op(index_box) + offset = 0 + pass + # ofs is NOT the offset! + #index_box = ResOperation(rop.INT_ADD, [index_box, ConstInt(ofs)]) + #self.emit_op(index_box) if factor == 1 and offset == 0: newload = ResOperation(OpHelpers.get_gc_load(op.type), - [ptr_box, index_box, Const(itemsize), Const(sign)]) - self.replace_op_with(newload, op) + [ptr_box, index_box, ConstInt(itemsize), ConstInt(sign)]) + self.replace_op_with(op, newload) else: newload = ResOperation(OpHelpers.get_gc_load_scaled(op.type), - [ptr_box, index_box, Const(factor), Const(offset), Const(sign)]) - self.replace_op_with(newload, op) + [ptr_box, index_box, ConstInt(factor), ConstInt(itemsize), ConstInt(sign)]) + self.replace_op_with(op, newload) def rewrite(self, operations): # we can only remember one malloc since the next malloc can possibly diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -1,3 +1,4 @@ +import py from rpython.jit.backend.llsupport.descr import get_size_descr,\ get_field_descr, get_array_descr, ArrayDescr, FieldDescr,\ SizeDescr, get_interiorfield_descr @@ -68,6 +69,11 @@ wbdescr = self.gc_ll_descr.write_barrier_descr WORD = globals()['WORD'] # + F = lltype.GcArray(lltype.Float) + fdescr = get_array_descr(self.gc_ll_descr, F) + SF = lltype.GcArray(lltype.SingleFloat) + sfdescr = get_array_descr(self.gc_ll_descr, SF) + # strdescr = self.gc_ll_descr.str_descr unicodedescr = self.gc_ll_descr.unicode_descr strlendescr = strdescr.lendescr @@ -124,6 +130,9 @@ class BaseFakeCPU(object): JITFRAME_FIXED_SIZE = 0 + load_constant_offset = False + load_supported_factors = (1,) + def __init__(self): self.tracker = FakeTracker() self._cache = {} @@ -1081,3 +1090,23 @@ guard_false(i2) [i5, i0] jump() """) + + @py.test.mark.parametrize('factors,suffix,ops,index,descr,off,factor', [ + [ (1,), 'i', ['i2 = int_mul(i1,8)'], 'i2', 'adescr', 8, 1 ], + [ (1,), 'f', ['i2 = int_mul(i1,8)'], 'i2', 'fdescr', 8, 0 ], + [ (1,), 'i', ['i2 = int_mul(i1,4)'], 'i2', 'sfdescr', 4, 0 ], + [ (1,), 'r', ['i2 = int_mul(i1,8)'], 'i2', 'cdescr', 8, 0 ], + ]) + def test_getarrayitem(self, factors, suffix, ops, index, descr, off, factor): + self.cpu.load_supported_factors = factors + ops = '\n'.join(ops) + self.check_rewrite(""" + [p0,i1] + i2 = getarrayitem_gc_{suffix}(p0,i1,descr={descr}) + jump() + """.format(**locals()), """ + [p0,i1] + {ops} + i3 = gc_load_{suffix}(p0,{index},{off},{factor}) + jump() + """.format(**locals())) diff --git a/rpython/jit/backend/x86/runner.py b/rpython/jit/backend/x86/runner.py --- a/rpython/jit/backend/x86/runner.py +++ b/rpython/jit/backend/x86/runner.py @@ -27,7 +27,7 @@ # can an ISA instruction handle a constant offset? load_constant_offset = False # can an ISA instruction handle a factor to the offset? - load_supported_factors = [1] + load_supported_factors = (1,) from rpython.jit.backend.x86.arch import JITFRAME_FIXED_SIZE all_reg_indexes = gpr_reg_mgr_cls.all_reg_indexes diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1099,8 +1099,8 @@ # '_ALWAYS_PURE_LAST', # ----- end of always_pure operations ----- - 'GC_LOAD/3/rfi', - 'GC_LOAD_INDEX/4/rfi', + 'GC_LOAD/4/rfi', + 'GC_LOAD_INDEX/5/rfi', '_RAW_LOAD_FIRST', 'GETARRAYITEM_GC/2d/rfi', @@ -1616,7 +1616,7 @@ return rop.GC_LOAD_R @staticmethod - def get_gc_load_scaled(tp): + def get_gc_load_caled(tp): if tp == 'i': return rop.GC_LOAD_SCALED_I elif tp == 'f': From noreply at buildbot.pypy.org Wed Nov 25 10:19:24 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 16:19:24 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: two more tests checking different supported cpu factors and the skipped int_mul/int_add and renamed index to indexed Message-ID: <20151125151924.B06321C0400@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80944:4f4e031576c3 Date: 2015-11-25 16:19 +0100 http://bitbucket.org/pypy/pypy/changeset/4f4e031576c3/ Log: two more tests checking different supported cpu factors and the skipped int_mul/int_add and renamed index to indexed diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -134,13 +134,17 @@ # ofs is NOT the offset! #index_box = ResOperation(rop.INT_ADD, [index_box, ConstInt(ofs)]) #self.emit_op(index_box) + + if sign: + itemsize = -itemsize if factor == 1 and offset == 0: newload = ResOperation(OpHelpers.get_gc_load(op.type), - [ptr_box, index_box, ConstInt(itemsize), ConstInt(sign)]) + [ptr_box, index_box, ConstInt(itemsize)]) self.replace_op_with(op, newload) else: - newload = ResOperation(OpHelpers.get_gc_load_scaled(op.type), - [ptr_box, index_box, ConstInt(factor), ConstInt(itemsize), ConstInt(sign)]) + newload = ResOperation(OpHelpers.get_gc_load_indexed(op.type), + [ptr_box, index_box, ConstInt(factor), + ConstInt(offset), ConstInt(itemsize)]) self.replace_op_with(op, newload) def rewrite(self, operations): diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -45,6 +45,21 @@ adescr.tid = 4321 alendescr = adescr.lendescr # + A32 = lltype.GcArray(rffi.INT) + a32descr = get_array_descr(self.gc_ll_descr, A32) + a32descr.tid = 4322 + a32lendescr = a32descr.lendescr + # + A16 = lltype.GcArray(rffi.SHORT) + a16descr = get_array_descr(self.gc_ll_descr, A16) + a16descr.tid = 4323 + a16lendescr = a16descr.lendescr + # + A8 = lltype.GcArray(rffi.CHAR) + a8descr = get_array_descr(self.gc_ll_descr, A8) + a8descr.tid = 4323 + a8lendescr = a8descr.lendescr + # B = lltype.GcArray(lltype.Char) bdescr = get_array_descr(self.gc_ll_descr, B) bdescr.tid = 8765 @@ -1091,22 +1106,28 @@ jump() """) - @py.test.mark.parametrize('factors,suffix,ops,index,descr,off,factor', [ - [ (1,), 'i', ['i2 = int_mul(i1,8)'], 'i2', 'adescr', 8, 1 ], - [ (1,), 'f', ['i2 = int_mul(i1,8)'], 'i2', 'fdescr', 8, 0 ], - [ (1,), 'i', ['i2 = int_mul(i1,4)'], 'i2', 'sfdescr', 4, 0 ], - [ (1,), 'r', ['i2 = int_mul(i1,8)'], 'i2', 'cdescr', 8, 0 ], + @py.test.mark.parametrize('factors,suffix,ops,index,descr,params', [ + [ (1,), 'i', ['i2 = int_mul(i1,8)'], 'i2', 'adescr', (-8,) ], + [ (1,), 'f', ['i2 = int_mul(i1,8)'], 'i2', 'fdescr', (8,) ], + [ (1,), 'i', ['i2 = int_mul(i1,4)'], 'i2', 'sfdescr', (4,) ], + [ (1,), 'r', ['i2 = int_mul(i1,8)'], 'i2', 'cdescr', (8,) ], + [ (1,2), 'indexed_i', [''], 'i1', 'a16descr', (2, 0, -2) ], + [ (1,2), 'i', ['i2 = int_mul(i1,4)'], 'i2', 'a32descr', (-4,) ], ]) - def test_getarrayitem(self, factors, suffix, ops, index, descr, off, factor): + def test_getarrayitem(self, factors, suffix, ops, index, descr, params): self.cpu.load_supported_factors = factors ops = '\n'.join(ops) + params = ','.join([str(i) for i in params]) + getarray_suffix = suffix + if suffix.startswith('indexed_'): + getarray_suffix = suffix[-1:] self.check_rewrite(""" [p0,i1] - i2 = getarrayitem_gc_{suffix}(p0,i1,descr={descr}) + i2 = getarrayitem_gc_{getarray_suffix}(p0,i1,descr={descr}) jump() """.format(**locals()), """ [p0,i1] {ops} - i3 = gc_load_{suffix}(p0,{index},{off},{factor}) + i3 = gc_load_{suffix}(p0,{index},{params}) jump() """.format(**locals())) diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -400,9 +400,9 @@ rop.GC_LOAD_I, rop.GC_LOAD_R, rop.GC_LOAD_F, - rop.GC_LOAD_INDEX_I, - rop.GC_LOAD_INDEX_R, - rop.GC_LOAD_INDEX_F, + rop.GC_LOAD_INDEXED_I, + rop.GC_LOAD_INDEXED_R, + rop.GC_LOAD_INDEXED_F, ): # list of opcodes never executed by pyjitpl continue if rop._VEC_PURE_FIRST <= value <= rop._VEC_PURE_LAST: diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1099,8 +1099,8 @@ # '_ALWAYS_PURE_LAST', # ----- end of always_pure operations ----- - 'GC_LOAD/4/rfi', - 'GC_LOAD_INDEX/5/rfi', + 'GC_LOAD/3/rfi', + 'GC_LOAD_INDEXED/4/rfi', '_RAW_LOAD_FIRST', 'GETARRAYITEM_GC/2d/rfi', @@ -1616,14 +1616,14 @@ return rop.GC_LOAD_R @staticmethod - def get_gc_load_caled(tp): + def get_gc_load_indexed(tp): if tp == 'i': - return rop.GC_LOAD_SCALED_I + return rop.GC_LOAD_INDEXED_I elif tp == 'f': - return rop.GC_LOAD_SCALED_F + return rop.GC_LOAD_INDEXED_F else: assert tp == 'r' - return rop.GC_LOAD_SCALED_R + return rop.GC_LOAD_INDEXED_R @staticmethod def inputarg_from_tp(tp): From noreply at buildbot.pypy.org Wed Nov 25 10:25:41 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Wed, 25 Nov 2015 16:25:41 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: what if the descr is unsigned? added test cases to check the correct rewrite step Message-ID: <20151125152541.E942E1C0400@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80945:b702a96ea1be Date: 2015-11-25 16:25 +0100 http://bitbucket.org/pypy/pypy/changeset/b702a96ea1be/ Log: what if the descr is unsigned? added test cases to check the correct rewrite step diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -53,12 +53,26 @@ A16 = lltype.GcArray(rffi.SHORT) a16descr = get_array_descr(self.gc_ll_descr, A16) a16descr.tid = 4323 - a16lendescr = a16descr.lendescr # - A8 = lltype.GcArray(rffi.CHAR) + A8 = lltype.GcArray(rffi.SIGNEDCHAR) a8descr = get_array_descr(self.gc_ll_descr, A8) a8descr.tid = 4323 - a8lendescr = a8descr.lendescr + # + UA = lltype.GcArray(rffi.ULONG) + uadescr = get_array_descr(self.gc_ll_descr, UA) + uadescr.tid = 4324 + # + UA32 = lltype.GcArray(rffi.UINT) + ua32descr = get_array_descr(self.gc_ll_descr, UA32) + ua32descr.tid = 4325 + # + UA16 = lltype.GcArray(rffi.USHORT) + ua16descr = get_array_descr(self.gc_ll_descr, UA16) + ua16descr.tid = 4326 + # + UA8 = lltype.GcArray(rffi.UCHAR) + ua8descr = get_array_descr(self.gc_ll_descr, UA8) + ua8descr.tid = 4327 # B = lltype.GcArray(lltype.Char) bdescr = get_array_descr(self.gc_ll_descr, B) @@ -1113,6 +1127,15 @@ [ (1,), 'r', ['i2 = int_mul(i1,8)'], 'i2', 'cdescr', (8,) ], [ (1,2), 'indexed_i', [''], 'i1', 'a16descr', (2, 0, -2) ], [ (1,2), 'i', ['i2 = int_mul(i1,4)'], 'i2', 'a32descr', (-4,) ], + [ (1,2,4), 'indexed_i', [''], 'i1', 'a32descr', (4,0,-4) ], + [ (1,2,4,8), 'indexed_i', [''], 'i1', 'adescr', (8,0,-8) ], + [ (1,2,4,8), 'i', [''], 'i1', 'a8descr', (-1,) ], + # unsigned + [ (1,2), 'indexed_i', [''], 'i1', 'ua16descr', (2, 0, 2) ], + [ (1,2), 'i', ['i2 = int_mul(i1,4)'], 'i2', 'ua32descr', (4,) ], + [ (1,2,4), 'indexed_i', [''], 'i1', 'ua32descr', (4,0,4) ], + [ (1,2,4,8), 'indexed_i', [''], 'i1', 'uadescr', (8,0,8) ], + [ (1,2,4,8), 'i', [''], 'i1', 'ua8descr', (1,) ], ]) def test_getarrayitem(self, factors, suffix, ops, index, descr, params): self.cpu.load_supported_factors = factors From noreply at buildbot.pypy.org Wed Nov 25 10:37:17 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 16:37:17 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: start working on virtualizables Message-ID: <20151125153717.98D081C06F2@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80946:1d8a732a6a78 Date: 2015-11-25 17:37 +0200 http://bitbucket.org/pypy/pypy/changeset/1d8a732a6a78/ Log: start working on virtualizables diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -1481,14 +1481,15 @@ # from the CPU stack, and copy them into the virtualizable numb = self.numb first_snapshot_size = rffi.cast(lltype.Signed, numb.first_snapshot_size) - if vinfo is None: - return first_snapshot_size - xxx - index = len(numb.nums) - 1 - virtualizable = self.decode_ref(numb.nums[index]) + item, _ = resumecode.numb_next_item(self.numb, + first_snapshot_size - 1) + virtualizable = self.decode_ref(item) + start_index = first_snapshot_size - 1 - vinfo.get_total_size(virtualizable) # just reset the token, we'll force it later vinfo.reset_token_gcref(virtualizable) - return vinfo.write_from_resume_data_partial(virtualizable, self, numb) + vinfo.write_from_resume_data_partial(virtualizable, self, start_index, + numb) + return start_index def load_value_of_type(self, TYPE, tagged): from rpython.jit.metainterp.warmstate import specialize_value @@ -1506,10 +1507,12 @@ def consume_vref_and_vable(self, vrefinfo, vinfo, ginfo): if self.resume_after_guard_not_forced != 2: - end_vref = self.consume_vable_info(vinfo) + end_vref = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) + if vinfo is not None: + end_vref = self.consume_vable_info(vinfo) if ginfo is not None: end_vref -= 1 - self.consume_virtualref_info(vrefinfo, end_vref) + self.consume_virtualref_info(vrefinfo, end_vref) self.cur_index = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) def allocate_with_vtable(self, descr=None): diff --git a/rpython/jit/metainterp/virtualizable.py b/rpython/jit/metainterp/virtualizable.py --- a/rpython/jit/metainterp/virtualizable.py +++ b/rpython/jit/metainterp/virtualizable.py @@ -2,6 +2,7 @@ from rpython.jit.metainterp import history from rpython.jit.metainterp.typesystem import deref, fieldType, arrayItem from rpython.jit.metainterp.warmstate import wrap, unwrap +from rpython.jit.metainterp.resumecode import numb_next_item from rpython.rlib.unroll import unrolling_iterable from rpython.rtyper import rvirtualizable from rpython.rtyper.lltypesystem import lltype, llmemory @@ -116,31 +117,36 @@ i = i + 1 assert len(boxes) == i + 1 - def write_from_resume_data_partial(virtualizable, reader, numb): + def get_total_size(virtualizable): + virtualizable = cast_gcref_to_vtype(virtualizable) + size = 0 + for _, fieldname in unroll_array_fields: + lst = getattr(virtualizable, fieldname) + size += getlength(lst) + for _, fieldname in unroll_static_fields: + size += 1 + return size + + def write_from_resume_data_partial(virtualizable, reader, index, numb): virtualizable = cast_gcref_to_vtype(virtualizable) # Load values from the reader (see resume.py) described by # the list of numbers 'nums', and write them in their proper - # place in the 'virtualizable'. This works from the end of - # the list and returns the index in 'nums' of the start of - # the virtualizable data found, allowing the caller to do - # further processing with the start of the list. - i = len(numb.nums) - 1 - assert i >= 0 - for ARRAYITEMTYPE, fieldname in unroll_array_fields_rev: + # place in the 'virtualizable'. + for FIELDTYPE, fieldname in unroll_static_fields: + item, index = numb_next_item(numb, index) + x = reader.load_value_of_type(FIELDTYPE, item) + setattr(virtualizable, fieldname, x) + for ARRAYITEMTYPE, fieldname in unroll_array_fields: + yyyy lst = getattr(virtualizable, fieldname) - for j in range(getlength(lst) - 1, -1, -1): + for j in range(getlength(lst)): i -= 1 assert i >= 0 x = reader.load_value_of_type(ARRAYITEMTYPE, numb.nums[i]) setarrayitem(lst, j, x) - for FIELDTYPE, fieldname in unroll_static_fields_rev: - i -= 1 - assert i >= 0 - x = reader.load_value_of_type(FIELDTYPE, numb.nums[i]) - setattr(virtualizable, fieldname, x) - return i def load_list_of_boxes(virtualizable, reader, numb): + xxx virtualizable = cast_gcref_to_vtype(virtualizable) # Uses 'virtualizable' only to know the length of the arrays; # does not write anything into it. The returned list is in @@ -217,6 +223,7 @@ self.check_boxes = check_boxes self.get_index_in_array = get_index_in_array self.get_array_length = get_array_length + self.get_total_size = get_total_size def cast_to_vtype(virtualizable): return self.cpu.ts.cast_to_instance_maybe(VTYPEPTR, virtualizable) From noreply at buildbot.pypy.org Wed Nov 25 10:47:25 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 16:47:25 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: start fighting with virtualizables Message-ID: <20151125154725.AD7431C06F2@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80947:f07b8c5974d3 Date: 2015-11-25 17:47 +0200 http://bitbucket.org/pypy/pypy/changeset/f07b8c5974d3/ Log: start fighting with virtualizables diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -1147,15 +1147,19 @@ self.boxes_f = boxes_f self._prepare_next_section(info) - def consume_virtualizable_boxes(self, vinfo, numb): + def consume_virtualizable_boxes(self, vinfo): # we have to ignore the initial part of 'nums' (containing vrefs), # find the virtualizable from nums[-1], and use it to know how many # boxes of which type we have to return. This does not write # anything into the virtualizable. - index = len(numb.nums) - 1 - virtualizablebox = self.decode_ref(numb.nums[index]) + numb = self.numb + first_snapshot_size = rffi.cast(lltype.Signed, numb.first_snapshot_size) + item, _ = resumecode.numb_next_item(numb, first_snapshot_size - 1) + virtualizablebox = self.decode_ref(item) + index = first_snapshot_size - vinfo.get_total_size(virtualizablebox.getref_base()) - 1 virtualizable = vinfo.unwrap_virtualizable_box(virtualizablebox) - return vinfo.load_list_of_boxes(virtualizable, self, numb) + return vinfo.load_list_of_boxes(virtualizable, self, virtualizablebox, + numb, index) def consume_virtualref_boxes(self, end): # Returns a list of boxes, assumed to be all BoxPtrs. @@ -1171,18 +1175,18 @@ def consume_vref_and_vable_boxes(self, vinfo, ginfo): first_snapshot_size = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) - end = first_snapshot_size & (~1) # if it's odd, it's -1 - virtualref_boxes = self.consume_virtualref_boxes(end) if vinfo is not None: virtualizable_boxes = self.consume_virtualizable_boxes(vinfo) - xxxx - end = len(numb.nums) - len(virtualizable_boxes) + end = first_snapshot_size - len(virtualizable_boxes) elif ginfo is not None: item, self.cur_index = resumecode.numb_next_item(self.numb, - self.cur_index) + first_snapshot_size - 1) virtualizable_boxes = [self.decode_ref(item)] + end = first_snapshot_size - 1 else: + end = first_snapshot_size virtualizable_boxes = None + virtualref_boxes = self.consume_virtualref_boxes(end) self.cur_index = rffi.cast(lltype.Signed, self.numb.first_snapshot_size) return virtualizable_boxes, virtualref_boxes diff --git a/rpython/jit/metainterp/virtualizable.py b/rpython/jit/metainterp/virtualizable.py --- a/rpython/jit/metainterp/virtualizable.py +++ b/rpython/jit/metainterp/virtualizable.py @@ -145,29 +145,26 @@ x = reader.load_value_of_type(ARRAYITEMTYPE, numb.nums[i]) setarrayitem(lst, j, x) - def load_list_of_boxes(virtualizable, reader, numb): - xxx + def load_list_of_boxes(virtualizable, reader, vable_box, numb, index): virtualizable = cast_gcref_to_vtype(virtualizable) # Uses 'virtualizable' only to know the length of the arrays; # does not write anything into it. The returned list is in # the format expected of virtualizable_boxes, so it ends in # the virtualizable itself. - i = len(numb.nums) - 1 - assert i >= 0 - boxes = [reader.decode_box_of_type(self.VTYPEPTR, numb.nums[i])] + boxes = [] + for FIELDTYPE, fieldname in unroll_static_fields: + item, index = numb_next_item(numb, index) + box = reader.decode_box_of_type(FIELDTYPE, item) + boxes.append(box) for ARRAYITEMTYPE, fieldname in unroll_array_fields_rev: + xxx lst = getattr(virtualizable, fieldname) for j in range(getlength(lst) - 1, -1, -1): i -= 1 assert i >= 0 box = reader.decode_box_of_type(ARRAYITEMTYPE, numb.nums[i]) boxes.append(box) - for FIELDTYPE, fieldname in unroll_static_fields_rev: - i -= 1 - assert i >= 0 - box = reader.decode_box_of_type(FIELDTYPE, numb.nums[i]) - boxes.append(box) - boxes.reverse() + boxes.append(vable_box) return boxes def check_boxes(virtualizable, boxes): From noreply at buildbot.pypy.org Wed Nov 25 10:55:56 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 25 Nov 2015 16:55:56 +0100 (CET) Subject: [pypy-commit] stmgc default: gcc bug needs -fno-tree-vectorize to translate pypy Message-ID: <20151125155556.EFF0A1C145B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: Changeset: r1972:ce67a5ccd206 Date: 2015-11-25 16:58 +0100 http://bitbucket.org/pypy/stmgc/changeset/ce67a5ccd206/ Log: gcc bug needs -fno-tree-vectorize to translate pypy diff --git a/gcc-seg-gs/README.txt b/gcc-seg-gs/README.txt --- a/gcc-seg-gs/README.txt +++ b/gcc-seg-gs/README.txt @@ -31,8 +31,11 @@ #!/bin/bash BUILD=/..../build # <- insert full path - exec $BUILD/gcc/xgcc -B $BUILD/gcc -fno-ivopts "$@" + exec $BUILD/gcc/xgcc -B $BUILD/gcc -fno-ivopts -fno-tree-vectorize "$@" So far, GCC has a bug in the presence of multiple address spaces, likely in the "ivopts" optimization. It can be worked around by specifying "-fno-ivopts" like above. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66768 + +Another bug in -ftree-vectorize seems to generate unprefixed vector +instructions. From noreply at buildbot.pypy.org Wed Nov 25 10:58:34 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 25 Nov 2015 16:58:34 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: some cleanup and some more tests Message-ID: <20151125155834.B28F71C145B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80948:cb4f5b7f309c Date: 2015-11-25 12:46 +0100 http://bitbucket.org/pypy/pypy/changeset/cb4f5b7f309c/ Log: some cleanup and some more tests diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -106,8 +106,10 @@ writeable = {} # if op.opname == "stm_ignored_start": + assert not self.in_stm_ignored self.in_stm_ignored = True elif op.opname == "stm_ignored_stop": + assert self.in_stm_ignored self.in_stm_ignored = False elif op.opname == "gc_writebarrier": assert not self.in_stm_ignored @@ -115,50 +117,49 @@ elif op.opname == "malloc": rtti = get_rtti(op.args[0].value) if rtti is not None and hasattr(rtti._obj, 'destructor_funcptr'): - # XXX: not sure why that matters, copied from - # find_initializing_stores - continue - writeable[op.result] = True + # objs with finalizers are allocated directly as "old", so + # they need write barriers + assert op not in self.clean_ops + else: + # freshly allocated object + writeable[op.result] = True # elif op.opname in ("cast_pointer", "same_as"): if writeable.get(op.args[0], False): writeable[op.result] = True # elif op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', 'raw_store'): + # generic_set case if op.args[-1].concretetype == lltype.Void: + # always ignore setfields of Void type self.clean_ops.add(op) - continue # ignore setfields of Void type elif not var_needsgc(op.args[0]): + # raw setfields don't need a barrier if (var_needsgc(op.args[-1]) and 'is_excdata' not in op.args[0].concretetype.TO._hints): raise Exception("%s: GC pointer written into a non-GC location" % (op,)) self.clean_ops.add(op) - continue elif self.in_stm_ignored: - # detect if we're inside a 'stm_ignored' block and in - # that case don't call stm_write(). This only works for - # writing non-GC pointers. + # within stm_ignored, don't emit stm_write(). This only works + # for writing non-GC pointers. if var_needsgc(op.args[-1]): raise Exception("in stm_ignored block: write of a gc pointer") self.clean_ops.add(op) - continue - elif self._set_into_gc_array_part(op) is None: - # full write barrier required - if writeable.get(op.args[0], False): - # already writeable, this op is also clean - self.clean_ops.add(op) - elif op in self.clean_ops: - # we changed our opinion in this iteration - self.clean_ops.remove(op) - # always writeable after this op - writeable[op.args[0]] = True - else: + elif self._set_into_gc_array_part(op) is not None: # things that need partial write barriers (card marking) if writeable.get(op.args[0], False): self.clean_ops.add(op) elif op in self.clean_ops: self.clean_ops.remove(op) + else: + # full write barrier possibly required + if writeable.get(op.args[0], False): + self.clean_ops.add(op) + elif op in self.clean_ops: + self.clean_ops.remove(op) + # always writeable after this op + writeable[op.args[0]] = True # # update in_states of all successors updated = set() diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -396,6 +396,141 @@ assert summary(ff)['stm_write'] == 3 +def test_remove_write_barrier_stm4(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + + rS = lltype.Struct('rS') + S = lltype.GcStruct('S') + rA = lltype.Array(lltype.Ptr(rS)) + A = lltype.GcArray(lltype.Ptr(S)) + Ar = lltype.GcArray(lltype.Ptr(rS)) + def f(ra, a, ar, i): + s = lltype.malloc(S) + rs = lltype.malloc(rS, flavor='raw') + ra[0] = rs + ra[1] = rs + a[0] = s + a[1] = s + ar[0] = rs + ar[1] = rs + def g(argv): + n = int(argv[1]) + ra = lltype.malloc(rA, n, flavor='raw') + a = lltype.malloc(A, n) + ar = lltype.malloc(Ar, n) + f(ra, a, ar, n) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 4 + +def test_remove_write_barrier_stm5(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + + class B(object): + def __del__(self): + pass + class A(object): pass + def f(): + b = B() + b.x = 1 # needs WB bc. of finalizer + a = A() + a.x = 1 + def g(argv): + f() + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 1 + +def test_remove_write_barrier_stm6(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + # + rSi = lltype.Struct('rSi', ('i', lltype.Signed)) + rSr = lltype.Struct('rSr', ('s', lltype.Ptr(rSi))) + Si = lltype.GcStruct('Si', ('i', lltype.Signed)) + Ss = lltype.GcStruct('Ss', ('s', lltype.Ptr(Si))) + Sr = lltype.GcStruct('Sr', ('r', lltype.Ptr(rSi))) + def f(rsi, rsr, si, ss, sr): + rsi.i = 0 + rsr.s = rsi + si.i = 0 + ss.s = si + sr.r = rsi + def g(argv): + rsi = lltype.malloc(rSi, flavor='raw') + rsr = lltype.malloc(rSr, flavor='raw') + si = lltype.malloc(Si, flavor='gc') + ss = lltype.malloc(Ss, flavor='gc') + sr = lltype.malloc(Sr, flavor='gc') + f(rsi, rsr, si, ss, sr) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 3 + +def test_remove_write_barrier_stm7(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + # + rSi = lltype.Struct('rSi', ('i', lltype.Signed)) + rSr = lltype.Struct('rSr', ('s', rSi)) + Si = lltype.GcStruct('Si', ('i', lltype.Signed)) + Ss = lltype.GcStruct('Ss', ('s', Si)) + Sr = lltype.GcStruct('Sr', ('r', rSi)) + def f(rsi, rsr, si, ss, sr): + rsi.i = 0 + rsr.s.i = 0 + si.i = 0 + ss.s.i = 0 + sr.r.i = 0 + def g(argv): + rsi = lltype.malloc(rSi, flavor='raw') + rsr = lltype.malloc(rSr, flavor='raw') + si = lltype.malloc(Si, flavor='gc') + ss = lltype.malloc(Ss, flavor='gc') + sr = lltype.malloc(Sr, flavor='gc') + f(rsi, rsr, si, ss, sr) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 3 + def test_write_barrier_collector(): class A(object): pass From noreply at buildbot.pypy.org Wed Nov 25 10:58:36 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 25 Nov 2015 16:58:36 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: handle gc_writebarrier in readbarrier.py Message-ID: <20151125155836.BF7B21C145B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80949:f1555426bff5 Date: 2015-11-25 12:47 +0100 http://bitbucket.org/pypy/pypy/changeset/f1555426bff5/ Log: handle gc_writebarrier in readbarrier.py diff --git a/rpython/translator/stm/readbarrier.py b/rpython/translator/stm/readbarrier.py --- a/rpython/translator/stm/readbarrier.py +++ b/rpython/translator/stm/readbarrier.py @@ -146,7 +146,7 @@ cat_map[op.result] = 'R' # if op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', - 'raw_store'): + 'raw_store', 'gc_writebarrier'): # compare with logic in stmframework.py # ops that need a write barrier also make the var 'R' if (op.args[-1].concretetype is not lltype.Void From noreply at buildbot.pypy.org Wed Nov 25 10:58:38 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 25 Nov 2015 16:58:38 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: add explicit gc_writebarrier to ll_arraycopy Message-ID: <20151125155838.C3B581C145B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80950:4b10dce73f17 Date: 2015-11-25 12:48 +0100 http://bitbucket.org/pypy/pypy/changeset/4b10dce73f17/ Log: add explicit gc_writebarrier to ll_arraycopy Seems like in all cases, the repeated stm_write_cards within the slowpath-loop are unhelpful. Either because the destination is newly allocated or because we write to a significant number of the array elements anyway. diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py --- a/rpython/rlib/rgc.py +++ b/rpython/rlib/rgc.py @@ -53,7 +53,7 @@ """ _pinned_objects.append(obj) return True - + class PinEntry(ExtRegistryEntry): _about_ = pin @@ -296,6 +296,10 @@ slowpath = False if stm_is_enabled(): slowpath = True + # seems to be a good idea to do a *full* write barrier on the + # items array, as this prevents repeated stm_write_card() inside + # the loop below (see logic in stmframework.py). + llop.gc_writebarrier(lltype.Void, dest) # elif _contains_gcptr(TP.OF): # perform a write barrier that copies necessary flags from @@ -864,7 +868,7 @@ pending.extend(get_rpy_referents(gcref)) all_typeids = {} - + def get_typeid(obj): raise Exception("does not work untranslated") From noreply at buildbot.pypy.org Wed Nov 25 10:58:40 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Wed, 25 Nov 2015 16:58:40 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: more cleaning while searching for a bug Message-ID: <20151125155840.CCA1B1C145B@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80951:1ef4c06a3f69 Date: 2015-11-25 17:00 +0100 http://bitbucket.org/pypy/pypy/changeset/1ef4c06a3f69/ Log: more cleaning while searching for a bug the bug, however, seems to be in gcc when vectorizing loops diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -93,6 +93,7 @@ insets = self._in_states # # get input variables and their states: + assert len(insets[block]) == len(block.inputargs) writeable = {} for v, state in zip(block.inputargs, insets[block]): writeable[v] = state @@ -125,8 +126,7 @@ writeable[op.result] = True # elif op.opname in ("cast_pointer", "same_as"): - if writeable.get(op.args[0], False): - writeable[op.result] = True + writeable[op.result] = writeable.get(op.args[0], False) # elif op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', 'raw_store'): # generic_set case @@ -134,7 +134,7 @@ # always ignore setfields of Void type self.clean_ops.add(op) elif not var_needsgc(op.args[0]): - # raw setfields don't need a barrier + # setfields on raw don't need a barrier if (var_needsgc(op.args[-1]) and 'is_excdata' not in op.args[0].concretetype.TO._hints): raise Exception("%s: GC pointer written into a non-GC location" @@ -146,37 +146,34 @@ if var_needsgc(op.args[-1]): raise Exception("in stm_ignored block: write of a gc pointer") self.clean_ops.add(op) - elif self._set_into_gc_array_part(op) is not None: - # things that need partial write barriers (card marking) + else: + # we need a (partial) write barrier if arg0 is not writeable if writeable.get(op.args[0], False): self.clean_ops.add(op) elif op in self.clean_ops: self.clean_ops.remove(op) - else: - # full write barrier possibly required - if writeable.get(op.args[0], False): - self.clean_ops.add(op) - elif op in self.clean_ops: - self.clean_ops.remove(op) - # always writeable after this op - writeable[op.args[0]] = True + # + if self._set_into_gc_array_part(op) is None: + # this will do a full write barrier, not card marking + # arg0 is always writeable afterwards + writeable[op.args[0]] = True # # update in_states of all successors - updated = set() + to_do = set() for link in block.exits: succ = link.target outset = [writeable.get(v, False) for v in link.args] if succ in insets: - to_merge = [insets[succ], outset] - new = self._merge_out_states(to_merge) - if new != insets[succ]: - updated.add(succ) + old = insets[succ] + new = self._merge_out_states([old, outset]) + if new != old: + to_do.add(succ) insets[succ] = new else: # block not processed yet insets[succ] = outset - updated.add(succ) - return updated + to_do.add(succ) + return to_do def collect(self): @@ -187,8 +184,7 @@ graph = self.graph # # initialize blocks - self._in_states = {} - self._in_states[graph.startblock] = [False] * len(graph.startblock.inputargs) + self._in_states = {graph.startblock: [False] * len(graph.startblock.inputargs)} # # fixpoint iteration # XXX: reverse postorder traversal diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -618,6 +618,34 @@ print "\n".join(map(str,wbc.clean_ops)) assert len(wbc.clean_ops) == 11 +def test_write_barrier_collector_stm_inevitable_interaction(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + # + rS = lltype.Struct('rS', ('i', lltype.Signed)) + S = lltype.GcStruct('S', ('i', lltype.Signed)) + def f(): + rs = lltype.malloc(rS, flavor='raw') + s = lltype.malloc(S, flavor='gc') + rs.i = 5 # become_inevitable setfield on 'raw' + s.i = 6 # become_inevitable canmalloc -> needs WB + def g(argv): + f() + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 1 + + + def test_write_barrier_collector_loops(): class A(object): pass From noreply at buildbot.pypy.org Wed Nov 25 11:03:34 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 17:03:34 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: fix virtualizables Message-ID: <20151125160334.5B1DD1C146D@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80952:2767cebe8bf3 Date: 2015-11-25 18:03 +0200 http://bitbucket.org/pypy/pypy/changeset/2767cebe8bf3/ Log: fix virtualizables diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -497,8 +497,8 @@ assert snapshot is not None # is that true? # count stack depth frame_info_list = self.snapshot_storage.rd_frame_info_list - stack_depth = 1 - while frame_info_list.prev is not None: + stack_depth = 0 + while frame_info_list is not None: frame_info_list = frame_info_list.prev stack_depth += 1 storage.rd_stack_depth = stack_depth diff --git a/rpython/jit/metainterp/virtualizable.py b/rpython/jit/metainterp/virtualizable.py --- a/rpython/jit/metainterp/virtualizable.py +++ b/rpython/jit/metainterp/virtualizable.py @@ -137,12 +137,10 @@ x = reader.load_value_of_type(FIELDTYPE, item) setattr(virtualizable, fieldname, x) for ARRAYITEMTYPE, fieldname in unroll_array_fields: - yyyy lst = getattr(virtualizable, fieldname) for j in range(getlength(lst)): - i -= 1 - assert i >= 0 - x = reader.load_value_of_type(ARRAYITEMTYPE, numb.nums[i]) + item, index = numb_next_item(numb, index) + x = reader.load_value_of_type(ARRAYITEMTYPE, item) setarrayitem(lst, j, x) def load_list_of_boxes(virtualizable, reader, vable_box, numb, index): @@ -156,13 +154,11 @@ item, index = numb_next_item(numb, index) box = reader.decode_box_of_type(FIELDTYPE, item) boxes.append(box) - for ARRAYITEMTYPE, fieldname in unroll_array_fields_rev: - xxx + for ARRAYITEMTYPE, fieldname in unroll_array_fields: lst = getattr(virtualizable, fieldname) - for j in range(getlength(lst) - 1, -1, -1): - i -= 1 - assert i >= 0 - box = reader.decode_box_of_type(ARRAYITEMTYPE, numb.nums[i]) + for j in range(getlength(lst)): + item, index = numb_next_item(numb, index) + box = reader.decode_box_of_type(ARRAYITEMTYPE, item) boxes.append(box) boxes.append(vable_box) return boxes From noreply at buildbot.pypy.org Wed Nov 25 11:08:06 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 17:08:06 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: hg merge stmgc-c8 Message-ID: <20151125160806.C13AF1C146D@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80953:ce27f469cac1 Date: 2015-11-25 09:36 +0100 http://bitbucket.org/pypy/pypy/changeset/ce27f469cac1/ Log: hg merge stmgc-c8 diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -432,7 +432,10 @@ self.iterator = iterator def next(self): - return next(self.iterator) + while 1: + entry = next(self.iterator) + if entry._obj: + return entry # ____________________________________________________________ diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py --- a/rpython/translator/stm/test/test_ztranslated.py +++ b/rpython/translator/stm/test/test_ztranslated.py @@ -769,3 +769,33 @@ t, cbuilder = self.compile(main) data = cbuilder.cmdexec('') assert 'ok!\n' in data + + def test_hashtable(self): + # minimal test + FOO = lltype.GcStruct('FOO') + + def main(argv): + h = rstm.create_hashtable() + assert h.list()[1] == 0 + foo = lltype.malloc(FOO) + h.set(123, lltype.cast_opaque_ptr(llmemory.GCREF, foo)) + assert h.list()[1] == 1 + assert h.get(123) == lltype.cast_opaque_ptr(llmemory.GCREF, foo) + assert h.get(234) == lltype.nullptr(llmemory.GCREF.TO) + hiter = h.iterentries() + entry = hiter.next() + try: + hiter.next() + except StopIteration: + pass + else: + print "hiter.next() should return only once here" + assert 0 + assert entry.index == 123 + print "ok!" + return 0 + + main([]) + t, cbuilder = self.compile(main) + data = cbuilder.cmdexec('') + assert 'ok!\n' in data From noreply at buildbot.pypy.org Wed Nov 25 11:08:08 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 17:08:08 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: in-progress, still crashing Message-ID: <20151125160808.F28D21C146D@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80954:d06bd49db189 Date: 2015-11-25 17:08 +0100 http://bitbucket.org/pypy/pypy/changeset/d06bd49db189/ Log: in-progress, still crashing diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -293,7 +293,10 @@ hiter.prev = entrypp return entrypp[0] -_HASHTABLE_OBJ = lltype.GcStruct('HASHTABLE_OBJ', +class GcStmHashtable(lltype.GcStruct): + pass + +_HASHTABLE_OBJ = GcStmHashtable('HASHTABLE_OBJ', ('ll_raw_hashtable', _STM_HASHTABLE_P), hints={'immutable': True}, rtti=True, @@ -357,11 +360,12 @@ NULL_GCREF = lltype.nullptr(llmemory.GCREF.TO) class HashtableForTest(object): + _TYPE = lltype.Ptr(_HASHTABLE_OBJ) def __init__(self): self._content = {} # dict {integer: Entry(obj=GCREF)} def _cleanup_(self): - raise Exception("cannot translate a prebuilt rstm.Hashtable object") + raise Exception("this class should be special-cased") def get(self, key): assert type(key) is int @@ -386,15 +390,18 @@ except KeyError: pass + def _live_items(self): + return [self.lookup(key) for key, v in self._content.items() + if v.object != NULL_GCREF] + def len(self): - items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] - return len(items) + return len(self._live_items()) def len_estimate(self): return len(self._content) def list(self): - items = [self.lookup(key) for key, v in self._content.items() if v.object != NULL_GCREF] + items = self._live_items() count = len(items) for i in range(3): items.append("additional garbage for testing") @@ -418,6 +425,9 @@ self.index = r_uint(key) self._obj = NULL_GCREF + def _cleanup_(self): + raise Exception("cannot translate EntryObjectForTest") + def _getobj(self): return self._obj def _setobj(self, nvalue): @@ -431,12 +441,22 @@ self.hashtable = hashtable self.iterator = iterator + def _cleanup_(self): + raise Exception("cannot translate IterEntriesForTest") + def next(self): while 1: entry = next(self.iterator) if entry._obj: return entry +class _Entry(ExtRegistryEntry): + _type_ = HashtableForTest + + def compute_annotation(self): + from rpython.translator.stm import hashtable + return hashtable.compute_annotation(self.bookkeeper, self.instance) + # ____________________________________________________________ _STM_QUEUE_P = rffi.COpaquePtr('stm_queue_t') diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py --- a/rpython/translator/c/genc.py +++ b/rpython/translator/c/genc.py @@ -865,6 +865,7 @@ def gen_stm_prebuilt(f, database): from rpython.translator.c.primitive import name_signed + from rpython.translator.stm.hashtable import gen_prebuilt_hashtables # print >> f, '#include "common_header.h"' print >> f, '#include "structdef.h"' @@ -894,6 +895,7 @@ print >> f, '\t%d,' % (i,) print >> f, '\t-1' print >> f, '};' + gen_prebuilt_hashtables(f, database) print >> f print >> f, '#include "preimpl.h"' print >> f, '#include "src/rtyper.h"' diff --git a/rpython/translator/stm/hashtable.py b/rpython/translator/stm/hashtable.py new file mode 100644 --- /dev/null +++ b/rpython/translator/stm/hashtable.py @@ -0,0 +1,76 @@ +from rpython.rlib import rstm +from rpython.rtyper.lltypesystem import lltype +from rpython.rtyper.llannotation import lltype_to_annotation +from rpython.translator.c.node import ContainerNodeFactory, StructNode + + +def compute_annotation(bookkeeper, hashtable): + if not hasattr(hashtable, '_obj'): + h = lltype.malloc(rstm._HASHTABLE_OBJ, zero=True) + hashtable._obj = h._obj + translator = bookkeeper.annotator.translator + try: + prebuilt_hashtables = translator._prebuilt_hashtables + except AttributeError: + prebuilt_hashtables = translator._prebuilt_hashtables = {} + prebuilt_hashtables[h._obj] = hashtable + # + for entry in hashtable._content.values(): + if entry._obj: + bookkeeper.immutablevalue(entry._obj) + bookkeeper.immutablevalue(lltype.nullptr(rstm._STM_HASHTABLE_ENTRY)) + # + return lltype_to_annotation(lltype.Ptr(rstm._HASHTABLE_OBJ)) + + +def gen_prebuilt_hashtables(f, database): + nodes = [node for node in database.globalcontainers() + if isinstance(node, StmHashtableNode)] + print >> f + print >> f, '#define STM_PREBUILT_HASHTABLES %d' % len(nodes) + if len(nodes) == 0: + return + type_id = database.gctransformer.get_type_id(rstm._STM_HASHTABLE_ENTRY) + expr_type_id = database.get(type_id) + print >> f, '#define STM_HASHTABLE_ENTRY_TYPEID %s' % (expr_type_id,) + print >> f + print >> f, 'struct _hashtable_descr_s {' + print >> f, '\tUnsigned key;' + print >> f, '\trpygcchar_t *value;' + print >> f, '};' + print >> f, 'static struct _hashtable_descr_s hashtable_descs[] = {' + for node in nodes: + assert node.globalgcnum >= 0 + items = node.get_hashtable_content() + items.sort(key=lambda entry: entry.index) + print >> f, '\t{ %d, (rpygcchar_t *)%d },' % (node.globalgcnum, + len(items)) + for entry in items: + expr = database.get(entry.object, static=True) + print >> f, '\t{ %d, %s },' % (entry.index, expr) + print >> f + print >> f, '};' + + +class StmHashtableNode(StructNode): + nodekind = 'stmhashtable' + + def __init__(self, db, T, obj): + StructNode.__init__(self, db, T, obj) + # hack to force this type to exist + T = rstm._STM_HASHTABLE_ENTRY + container = lltype.malloc(T, zero=True)._as_obj() + db.gctransformer.consider_constant(T, container) + + def get_hashtable_content(self): + h = self.db.translator._prebuilt_hashtables[self.obj] + return h._live_items() + + def basename(self): + return 'stmhashtable' + + def enum_dependencies(self): + for entry in self.get_hashtable_content(): + yield entry.object + +ContainerNodeFactory[rstm.GcStmHashtable] = StmHashtableNode diff --git a/rpython/translator/stm/src_stm/extracode.h b/rpython/translator/stm/src_stm/extracode.h --- a/rpython/translator/stm/src_stm/extracode.h +++ b/rpython/translator/stm/src_stm/extracode.h @@ -37,6 +37,34 @@ stmcb_light_finalizer = &_stm_call_finalizer; } +void pypy_stm_setup_prebuilt_hashtables(void) +{ +#if STM_PREBUILT_HASHTABLES > 0 + struct _hashtable_descr_s *hdesc = hashtable_descs; + int i; + long count; + pypy_HASHTABLE_OBJ0_t *htobj; + stm_hashtable_t *ht; + + stm_hashtable_entry_userdata = STM_HASHTABLE_ENTRY_TYPEID; + for (i = 0; i < STM_PREBUILT_HASHTABLES; i++) { + /* Every hashtable is one header hdesc entry followed by N hdescs. + The header abuses 'key' as an index inside rpy_prebuilt and + 'value' as the number of entries that follow. */ + htobj = (pypy_HASHTABLE_OBJ0_t *)rpy_prebuilt[hdesc->key]; + htobj->ha_ll_raw_hashtable = ht = stm_hashtable_create(); + count = (long)hdesc->value; + hdesc++; + while (count > 0) { + stm_hashtable_write((object_t *)htobj, ht, hdesc->key, + (object_t *)hdesc->value, &stm_thread_local); + hdesc++; + count--; + } + } +#endif +} + void pypy_stm_register_thread_local(void) { stm_register_thread_local(&stm_thread_local); diff --git a/rpython/translator/stm/src_stm/stmgcintf.c b/rpython/translator/stm/src_stm/stmgcintf.c --- a/rpython/translator/stm/src_stm/stmgcintf.c +++ b/rpython/translator/stm/src_stm/stmgcintf.c @@ -62,6 +62,8 @@ stm_enter_transactional_zone(&stm_thread_local); stm_become_inevitable(&stm_thread_local, "start-up"); stm_rewind_jmp_leaveframe(&stm_thread_local, &rjbuf); + + pypy_stm_setup_prebuilt_hashtables(); } void pypy_stm_set_transaction_length(double fraction) diff --git a/rpython/translator/stm/src_stm/stmgcintf.h b/rpython/translator/stm/src_stm/stmgcintf.h --- a/rpython/translator/stm/src_stm/stmgcintf.h +++ b/rpython/translator/stm/src_stm/stmgcintf.h @@ -10,6 +10,7 @@ void pypy_stm_setup(void); void pypy_stm_teardown(void); void pypy_stm_setup_prebuilt(void); /* generated into stm_prebuilt.c */ +void pypy_stm_setup_prebuilt_hashtables(void); /* " " " */ void pypy_stm_register_thread_local(void); /* generated into stm_prebuilt.c */ void pypy_stm_unregister_thread_local(void); /* generated into stm_prebuilt.c */ diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py --- a/rpython/translator/stm/test/test_ztranslated.py +++ b/rpython/translator/stm/test/test_ztranslated.py @@ -799,3 +799,34 @@ t, cbuilder = self.compile(main) data = cbuilder.cmdexec('') assert 'ok!\n' in data + + def test_hashtable_prebuilt(self): + FOO = lltype.GcStruct('FOO') + h = rstm.create_hashtable() + foo = lltype.malloc(FOO) + h.set(123, lltype.cast_opaque_ptr(llmemory.GCREF, foo)) + h.set(345, lltype.cast_opaque_ptr(llmemory.GCREF, lltype.malloc(FOO))) + + def main(argv): + assert h.list()[1] == 2 + assert h.get(123) == lltype.cast_opaque_ptr(llmemory.GCREF, foo) + assert h.get(234) == lltype.nullptr(llmemory.GCREF.TO) + assert h.get(345) != lltype.nullptr(llmemory.GCREF.TO) + hiter = h.iterentries() + entry1 = hiter.next() + entry2 = hiter.next() + try: + hiter.next() + except StopIteration: + pass + else: + print "hiter.next() should return only twice here" + assert 0 + assert ((entry1.index == 123 and entry2.index == 345) or + (entry1.index == 345 and entry2.index == 123)) + print "ok!" + return 0 + + t, cbuilder = self.compile(main) + data = cbuilder.cmdexec('') + assert 'ok!\n' in data From noreply at buildbot.pypy.org Wed Nov 25 11:17:31 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 17:17:31 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: hg merge stmgc-c8 Message-ID: <20151125161731.892701C02FB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80956:e884e0b2b29f Date: 2015-11-25 17:18 +0100 http://bitbucket.org/pypy/pypy/changeset/e884e0b2b29f/ Log: hg merge stmgc-c8 diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -93,6 +93,7 @@ insets = self._in_states # # get input variables and their states: + assert len(insets[block]) == len(block.inputargs) writeable = {} for v, state in zip(block.inputargs, insets[block]): writeable[v] = state @@ -106,8 +107,10 @@ writeable = {} # if op.opname == "stm_ignored_start": + assert not self.in_stm_ignored self.in_stm_ignored = True elif op.opname == "stm_ignored_stop": + assert self.in_stm_ignored self.in_stm_ignored = False elif op.opname == "gc_writebarrier": assert not self.in_stm_ignored @@ -115,67 +118,62 @@ elif op.opname == "malloc": rtti = get_rtti(op.args[0].value) if rtti is not None and hasattr(rtti._obj, 'destructor_funcptr'): - # XXX: not sure why that matters, copied from - # find_initializing_stores - continue - writeable[op.result] = True + # objs with finalizers are allocated directly as "old", so + # they need write barriers + assert op not in self.clean_ops + else: + # freshly allocated object + writeable[op.result] = True # elif op.opname in ("cast_pointer", "same_as"): - if writeable.get(op.args[0], False): - writeable[op.result] = True + writeable[op.result] = writeable.get(op.args[0], False) # elif op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', 'raw_store'): + # generic_set case if op.args[-1].concretetype == lltype.Void: + # always ignore setfields of Void type self.clean_ops.add(op) - continue # ignore setfields of Void type elif not var_needsgc(op.args[0]): + # setfields on raw don't need a barrier if (var_needsgc(op.args[-1]) and 'is_excdata' not in op.args[0].concretetype.TO._hints): raise Exception("%s: GC pointer written into a non-GC location" % (op,)) self.clean_ops.add(op) - continue elif self.in_stm_ignored: - # detect if we're inside a 'stm_ignored' block and in - # that case don't call stm_write(). This only works for - # writing non-GC pointers. + # within stm_ignored, don't emit stm_write(). This only works + # for writing non-GC pointers. if var_needsgc(op.args[-1]): raise Exception("in stm_ignored block: write of a gc pointer") self.clean_ops.add(op) - continue - elif self._set_into_gc_array_part(op) is None: - # full write barrier required - if writeable.get(op.args[0], False): - # already writeable, this op is also clean - self.clean_ops.add(op) - elif op in self.clean_ops: - # we changed our opinion in this iteration - self.clean_ops.remove(op) - # always writeable after this op - writeable[op.args[0]] = True else: - # things that need partial write barriers (card marking) + # we need a (partial) write barrier if arg0 is not writeable if writeable.get(op.args[0], False): self.clean_ops.add(op) elif op in self.clean_ops: self.clean_ops.remove(op) + # + if self._set_into_gc_array_part(op) is None: + # this will do a full write barrier, not card marking + # arg0 is always writeable afterwards + writeable[op.args[0]] = True # # update in_states of all successors - updated = set() + to_do = set() for link in block.exits: succ = link.target outset = [writeable.get(v, False) for v in link.args] if succ in insets: - to_merge = [insets[succ], outset] - new = self._merge_out_states(to_merge) - if new != insets[succ]: - updated.add(succ) + old = insets[succ] + new = self._merge_out_states([old, outset]) + if new != old: + to_do.add(succ) insets[succ] = new else: # block not processed yet insets[succ] = outset - updated.add(succ) - return updated + to_do.add(succ) + return to_do def collect(self): @@ -186,8 +184,7 @@ graph = self.graph # # initialize blocks - self._in_states = {} - self._in_states[graph.startblock] = [False] * len(graph.startblock.inputargs) + self._in_states = {graph.startblock: [False] * len(graph.startblock.inputargs)} # # fixpoint iteration # XXX: reverse postorder traversal diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py --- a/rpython/memory/gctransform/test/test_framework.py +++ b/rpython/memory/gctransform/test/test_framework.py @@ -396,6 +396,141 @@ assert summary(ff)['stm_write'] == 3 +def test_remove_write_barrier_stm4(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + + rS = lltype.Struct('rS') + S = lltype.GcStruct('S') + rA = lltype.Array(lltype.Ptr(rS)) + A = lltype.GcArray(lltype.Ptr(S)) + Ar = lltype.GcArray(lltype.Ptr(rS)) + def f(ra, a, ar, i): + s = lltype.malloc(S) + rs = lltype.malloc(rS, flavor='raw') + ra[0] = rs + ra[1] = rs + a[0] = s + a[1] = s + ar[0] = rs + ar[1] = rs + def g(argv): + n = int(argv[1]) + ra = lltype.malloc(rA, n, flavor='raw') + a = lltype.malloc(A, n) + ar = lltype.malloc(Ar, n) + f(ra, a, ar, n) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 4 + +def test_remove_write_barrier_stm5(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + + class B(object): + def __del__(self): + pass + class A(object): pass + def f(): + b = B() + b.x = 1 # needs WB bc. of finalizer + a = A() + a.x = 1 + def g(argv): + f() + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 1 + +def test_remove_write_barrier_stm6(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + # + rSi = lltype.Struct('rSi', ('i', lltype.Signed)) + rSr = lltype.Struct('rSr', ('s', lltype.Ptr(rSi))) + Si = lltype.GcStruct('Si', ('i', lltype.Signed)) + Ss = lltype.GcStruct('Ss', ('s', lltype.Ptr(Si))) + Sr = lltype.GcStruct('Sr', ('r', lltype.Ptr(rSi))) + def f(rsi, rsr, si, ss, sr): + rsi.i = 0 + rsr.s = rsi + si.i = 0 + ss.s = si + sr.r = rsi + def g(argv): + rsi = lltype.malloc(rSi, flavor='raw') + rsr = lltype.malloc(rSr, flavor='raw') + si = lltype.malloc(Si, flavor='gc') + ss = lltype.malloc(Ss, flavor='gc') + sr = lltype.malloc(Sr, flavor='gc') + f(rsi, rsr, si, ss, sr) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 3 + +def test_remove_write_barrier_stm7(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + # + rSi = lltype.Struct('rSi', ('i', lltype.Signed)) + rSr = lltype.Struct('rSr', ('s', rSi)) + Si = lltype.GcStruct('Si', ('i', lltype.Signed)) + Ss = lltype.GcStruct('Ss', ('s', Si)) + Sr = lltype.GcStruct('Sr', ('r', rSi)) + def f(rsi, rsr, si, ss, sr): + rsi.i = 0 + rsr.s.i = 0 + si.i = 0 + ss.s.i = 0 + sr.r.i = 0 + def g(argv): + rsi = lltype.malloc(rSi, flavor='raw') + rsr = lltype.malloc(rSr, flavor='raw') + si = lltype.malloc(Si, flavor='gc') + ss = lltype.malloc(Ss, flavor='gc') + sr = lltype.malloc(Sr, flavor='gc') + f(rsi, rsr, si, ss, sr) + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 3 + def test_write_barrier_collector(): class A(object): pass @@ -483,6 +618,34 @@ print "\n".join(map(str,wbc.clean_ops)) assert len(wbc.clean_ops) == 11 +def test_write_barrier_collector_stm_inevitable_interaction(): + from rpython.translator.c.genc import CStandaloneBuilder + from rpython.flowspace.model import summary + # + rS = lltype.Struct('rS', ('i', lltype.Signed)) + S = lltype.GcStruct('S', ('i', lltype.Signed)) + def f(): + rs = lltype.malloc(rS, flavor='raw') + s = lltype.malloc(S, flavor='gc') + rs.i = 5 # become_inevitable setfield on 'raw' + s.i = 6 # become_inevitable canmalloc -> needs WB + def g(argv): + f() + return 0 + t = rtype(g, [s_list_of_strings]) + t.config.translation.stm = True + gcpolicy = StmFrameworkGcPolicy + t.config.translation.gc = "stmgc" + cbuild = CStandaloneBuilder(t, g, t.config, + gcpolicy=gcpolicy) + db = cbuild.generate_graphs_for_llinterp() + + ff = graphof(t, f) + #ff.show() + assert summary(ff)['stm_write'] == 1 + + + def test_write_barrier_collector_loops(): class A(object): pass diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py --- a/rpython/rlib/rgc.py +++ b/rpython/rlib/rgc.py @@ -53,7 +53,7 @@ """ _pinned_objects.append(obj) return True - + class PinEntry(ExtRegistryEntry): _about_ = pin @@ -296,6 +296,10 @@ slowpath = False if stm_is_enabled(): slowpath = True + # seems to be a good idea to do a *full* write barrier on the + # items array, as this prevents repeated stm_write_card() inside + # the loop below (see logic in stmframework.py). + llop.gc_writebarrier(lltype.Void, dest) # elif _contains_gcptr(TP.OF): # perform a write barrier that copies necessary flags from @@ -864,7 +868,7 @@ pending.extend(get_rpy_referents(gcref)) all_typeids = {} - + def get_typeid(obj): raise Exception("does not work untranslated") diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -416,8 +416,10 @@ arg1 = funcgen.expr(op.args[1]) arg2 = funcgen.expr(op.args[2]) result = funcgen.expr(op.result) - return ('%s = stm_hashtable_iter_next(%s, %s, %s);' % - (result, arg0, arg1, arg2)) + typename = cdecl(funcgen.lltypename(op.result), '') + return ('%s = (%s)stm_hashtable_iter_next((object_t *)%s, %s,' + ' (stm_hashtable_entry_t **)%s);' % + (result, typename, arg0, arg1, arg2)) def stm_hashtable_iter_tracefn(funcgen, op): arg0 = funcgen.expr(op.args[0]) diff --git a/rpython/translator/stm/readbarrier.py b/rpython/translator/stm/readbarrier.py --- a/rpython/translator/stm/readbarrier.py +++ b/rpython/translator/stm/readbarrier.py @@ -146,7 +146,7 @@ cat_map[op.result] = 'R' # if op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', - 'raw_store'): + 'raw_store', 'gc_writebarrier'): # compare with logic in stmframework.py # ops that need a write barrier also make the var 'R' if (op.args[-1].concretetype is not lltype.Void From noreply at buildbot.pypy.org Wed Nov 25 11:17:35 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 17:17:35 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: Silence warnings Message-ID: <20151125161735.949551C02FB@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8 Changeset: r80955:02458c8cacb2 Date: 2015-11-25 17:16 +0100 http://bitbucket.org/pypy/pypy/changeset/02458c8cacb2/ Log: Silence warnings diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py --- a/rpython/translator/stm/funcgen.py +++ b/rpython/translator/stm/funcgen.py @@ -416,8 +416,10 @@ arg1 = funcgen.expr(op.args[1]) arg2 = funcgen.expr(op.args[2]) result = funcgen.expr(op.result) - return ('%s = stm_hashtable_iter_next(%s, %s, %s);' % - (result, arg0, arg1, arg2)) + typename = cdecl(funcgen.lltypename(op.result), '') + return ('%s = (%s)stm_hashtable_iter_next((object_t *)%s, %s,' + ' (stm_hashtable_entry_t **)%s);' % + (result, typename, arg0, arg1, arg2)) def stm_hashtable_iter_tracefn(funcgen, op): arg0 = funcgen.expr(op.args[0]) From noreply at buildbot.pypy.org Wed Nov 25 11:30:58 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 25 Nov 2015 17:30:58 +0100 (CET) Subject: [pypy-commit] pypy default: clean up test_objectmodel.py Message-ID: <20151125163058.ACAD61C0337@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80957:b4515dee6ebf Date: 2015-11-25 16:31 +0000 http://bitbucket.org/pypy/pypy/changeset/b4515dee6ebf/ Log: clean up test_objectmodel.py diff --git a/rpython/rlib/test/test_objectmodel.py b/rpython/rlib/test/test_objectmodel.py --- a/rpython/rlib/test/test_objectmodel.py +++ b/rpython/rlib/test/test_objectmodel.py @@ -1,8 +1,12 @@ from collections import OrderedDict import py -from rpython.rlib.objectmodel import * -from rpython.rlib import types -from rpython.annotator import model +from rpython.rlib.objectmodel import ( + r_dict, UnboxedValue, Symbolic, compute_hash, compute_identity_hash, + compute_unique_id, current_object_addr_as_int, we_are_translated, + prepare_dict_update, reversed_dict, specialize, enforceargs, newlist_hint, + resizelist_hint, is_annotation_constant, always_inline, + iterkeys_with_hash, iteritems_with_hash, contains_with_hash, + setitem_with_hash, getitem_with_hash, delitem_with_hash, import_from_mixin) from rpython.translator.translator import TranslationContext, graphof from rpython.rtyper.test.tool import BaseRtypingTest from rpython.rtyper.test.test_llinterp import interpret @@ -72,9 +76,9 @@ rdic = r_dict(operator.eq, hash) rdic['x'] = rdic assert str(rdic) == "r_dict({'x': r_dict({...})})" - assert repr(rdic)== "r_dict({'x': r_dict({...})})" + assert repr(rdic) == "r_dict({'x': r_dict({...})})" -def test_r_dict(): +def func_r_dict(): # NB. this test function is also annotated/rtyped by the next tests d = r_dict(strange_key_eq, strange_key_hash) return play_with_r_dict(d) @@ -82,10 +86,11 @@ class Strange: def key_eq(strange, key1, key2): return key1[0] == key2[0] # only the 1st character is relevant + def key_hash(strange, key): return ord(key[0]) -def test_r_dict_bm(): +def func_r_dict_bm(): # NB. this test function is also annotated by the next tests strange = Strange() d = r_dict(strange.key_eq, strange.key_hash) @@ -94,7 +99,7 @@ def test_annotate_r_dict(): t = TranslationContext() a = t.buildannotator() - a.build_types(test_r_dict, []) + a.build_types(func_r_dict, []) #t.view() graph = graphof(t, strange_key_eq) assert a.binding(graph.getargs()[0]).knowntype == str @@ -105,7 +110,7 @@ def test_annotate_r_dict_bm(): t = TranslationContext() a = t.buildannotator() - a.build_types(test_r_dict_bm, []) + a.build_types(func_r_dict_bm, []) #t.view() strange_key_eq = Strange.key_eq.im_func strange_key_hash = Strange.key_hash.im_func @@ -124,6 +129,7 @@ def test_unboxed_value(): class Base(object): __slots__ = () + class C(Base, UnboxedValue): __slots__ = 'smallint' @@ -196,7 +202,7 @@ class TestObjectModel(BaseRtypingTest): def test_we_are_translated(self): - assert we_are_translated() == False + assert we_are_translated() is False def fn(): return we_are_translated() @@ -204,11 +210,11 @@ assert res is True def test_rtype_r_dict(self): - res = self.interpret(test_r_dict, []) + res = self.interpret(func_r_dict, []) assert res is True def test_rtype_r_dict_bm(self): - res = self.interpret(test_r_dict_bm, []) + res = self.interpret(func_r_dict_bm, []) assert res is True def test_rtype_constant_r_dicts(self): @@ -290,24 +296,27 @@ def test_access_in_try(self): h = lambda x: 1 - eq = lambda x,y: x==y + eq = lambda x, y: x == y + def f(d): try: return d[2] except ZeroDivisionError: return 42 return -1 + def g(n): d = r_dict(eq, h) d[1] = n - d[2] = 2*n + d[2] = 2 * n return f(d) + res = self.interpret(g, [3]) assert res == 6 def test_access_in_try_set(self): h = lambda x: 1 - eq = lambda x,y: x==y + eq = lambda x, y: x == y def f(d): try: d[2] = 77 @@ -339,7 +348,7 @@ assert res == 42 # "did not crash" def test_reversed_dict(self): - d1 = {2:3, 4:5, 6:7} + d1 = {2: 3, 4: 5, 6: 7} def g(): n1 = 0 for key in d1: @@ -358,7 +367,7 @@ pass def f(i): assert compute_hash(i) == compute_hash(42) - assert compute_hash(i+1.0) == compute_hash(43.0) + assert compute_hash(i + 1.0) == compute_hash(43.0) assert compute_hash("Hello" + str(i)) == compute_hash("Hello42") if i == 42: p = None @@ -373,13 +382,11 @@ assert compute_hash(INFINITY) == 314159 assert compute_hash(-INFINITY) == -271828 assert compute_hash(NAN) == 0 - return i*2 + return i * 2 res = self.interpret(f, [42]) assert res == 84 def test_isconstant(self): - from rpython.rlib.objectmodel import is_annotation_constant, specialize - @specialize.arg_or_var(0) def f(arg): if is_annotation_constant(arg): @@ -396,7 +403,7 @@ def f(): x = [1] y = ['b'] - objectmodel.keepalive_until_here(x,y) + objectmodel.keepalive_until_here(x, y) return 1 res = self.interpret(f, []) @@ -410,8 +417,8 @@ def f(i): assert compute_hash(None) == 0 assert compute_hash(i) == h_42 - assert compute_hash(i+1.0) == h_43_dot_0 - assert compute_hash((i+3)/6.0) == h_7_dot_5 + assert compute_hash(i + 1.0) == h_43_dot_0 + assert compute_hash((i + 3) / 6.0) == h_7_dot_5 assert compute_hash("Hello" + str(i)) == h_Hello42 if i == 42: p = None @@ -420,14 +427,14 @@ assert compute_hash(p) == h_None assert compute_hash(("world", None, i, 7.5)) == h_tuple assert compute_hash(q) == h_q - return i*2 - h_42 = compute_hash(42) + return i * 2 + h_42 = compute_hash(42) h_43_dot_0 = compute_hash(43.0) - h_7_dot_5 = compute_hash(7.5) - h_Hello42 = compute_hash("Hello42") - h_None = compute_hash(None) - h_tuple = compute_hash(("world", None, 42, 7.5)) - h_q = compute_hash(q) + h_7_dot_5 = compute_hash(7.5) + h_Hello42 = compute_hash("Hello42") + h_None = compute_hash(None) + h_tuple = compute_hash(("world", None, 42, 7.5)) + h_q = compute_hash(q) res = self.interpret(f, [42]) assert res == 84 @@ -466,18 +473,18 @@ @always_inline def f(a, b, c): return a, b, c - assert f._always_inline_ == True + assert f._always_inline_ is True def test_enforceargs_defaults(): @enforceargs(int, int) def f(a, b=40): - return a+b + return a + b assert f(2) == 42 def test_enforceargs_keywords(): @enforceargs(b=int) def f(a, b, c): - return a+b + return a + b assert f._annenforceargs_ == (None, int, None) def test_enforceargs_int_float_promotion(): @@ -511,7 +518,7 @@ def f(a, b, c): return a, b, c assert f._annenforceargs_ == (int, str, None) - assert f(1, 2, 3) == (1, 2, 3) # no typecheck + assert f(1, 2, 3) == (1, 2, 3) # no typecheck def test_enforceargs_translates(): from rpython.rtyper.lltypesystem import lltype @@ -539,39 +546,36 @@ def test_newlist(): - from rpython.annotator.model import SomeInteger def f(z): x = newlist_hint(sizehint=38) if z < 0: x.append(1) return len(x) - graph = getgraph(f, [SomeInteger()]) + graph = getgraph(f, [int]) for llop in graph.startblock.operations: if llop.opname == 'malloc_varsize': break assert llop.args[2].value == 38 def test_newlist_nonconst(): - from rpython.annotator.model import SomeInteger def f(z): x = newlist_hint(sizehint=z) return len(x) - graph = getgraph(f, [SomeInteger()]) + graph = getgraph(f, [int]) for llop in graph.startblock.operations: if llop.opname == 'malloc_varsize': break assert llop.args[2] is graph.startblock.inputargs[0] def test_resizelist_hint(): - from rpython.annotator.model import SomeInteger def f(z): x = [] resizelist_hint(x, 39) return len(x) - graph = getgraph(f, [SomeInteger()]) + graph = getgraph(f, [int]) for _, op in graph.iterblockops(): if op.opname == 'direct_call': break @@ -591,7 +595,7 @@ def test_iterkeys_with_hash(): def f(i): - d = {i+.0: 5, i+.5: 6} + d = {i + .0: 5, i + .5: 6} total = 0 for k, h in iterkeys_with_hash(d): total += k * h @@ -605,7 +609,7 @@ def test_iteritems_with_hash(): def f(i): - d = {i+.0: 5, i+.5: 6} + d = {i + .0: 5, i + .5: 6} total = 0 for k, v, h in iteritems_with_hash(d): total += k * h * v @@ -619,9 +623,9 @@ def test_contains_with_hash(): def f(i): - d = {i+.5: 5} - assert contains_with_hash(d, i+.5, compute_hash(i+.5)) - assert not contains_with_hash(d, i+.3, compute_hash(i+.3)) + d = {i + .5: 5} + assert contains_with_hash(d, i + .5, compute_hash(i + .5)) + assert not contains_with_hash(d, i + .3, compute_hash(i + .3)) return 0 f(29) @@ -630,9 +634,9 @@ def test_setitem_with_hash(): def f(i): d = {} - setitem_with_hash(d, i+.5, compute_hash(i+.5), 42) - setitem_with_hash(d, i+.6, compute_hash(i+.6), -612) - return d[i+.5] + setitem_with_hash(d, i + .5, compute_hash(i + .5), 42) + setitem_with_hash(d, i + .6, compute_hash(i + .6), -612) + return d[i + .5] assert f(29) == 42 res = interpret(f, [27]) @@ -640,8 +644,8 @@ def test_getitem_with_hash(): def f(i): - d = {i+.5: 42, i+.6: -612} - return getitem_with_hash(d, i+.5, compute_hash(i+.5)) + d = {i + .5: 42, i + .6: -612} + return getitem_with_hash(d, i + .5, compute_hash(i + .5)) assert f(29) == 42 res = interpret(f, [27]) @@ -649,10 +653,10 @@ def test_delitem_with_hash(): def f(i): - d = {i+.5: 42, i+.6: -612} - delitem_with_hash(d, i+.5, compute_hash(i+.5)) + d = {i + .5: 42, i + .6: -612} + delitem_with_hash(d, i + .5, compute_hash(i + .5)) try: - delitem_with_hash(d, i+.5, compute_hash(i+.5)) + delitem_with_hash(d, i + .5, compute_hash(i + .5)) except KeyError: pass else: @@ -682,39 +686,51 @@ def test_import_from_mixin(): class M: # old-style - def f(self): pass + def f(self): + pass class A: # old-style import_from_mixin(M) assert A.f.im_func is not M.f.im_func class M(object): - def f(self): pass + def f(self): + pass class A: # old-style import_from_mixin(M) assert A.f.im_func is not M.f.im_func class M: # old-style - def f(self): pass + def f(self): + pass class A(object): import_from_mixin(M) assert A.f.im_func is not M.f.im_func class M(object): - def f(self): pass + def f(self): + pass class A(object): import_from_mixin(M) assert A.f.im_func is not M.f.im_func class MBase(object): - a = 42; b = 43; c = 1000 - def f(self): return "hi" - def g(self): return self.c - 1 + a = 42 + b = 43 + c = 1000 + def f(self): + return "hi" + def g(self): + return self.c - 1 + class M(MBase): a = 84 - def f(self): return "there" + def f(self): + return "there" + class A(object): import_from_mixin(M) c = 88 + assert A.f.im_func is not M.f.im_func assert A.f.im_func is not MBase.f.im_func assert A.g.im_func is not MBase.g.im_func @@ -776,7 +792,6 @@ assert B._immutable_fields_ == ['b', 'a'] assert A._immutable_fields_ == ['a'] - class B(object): import_from_mixin(A) @@ -785,7 +800,6 @@ class C(A): _immutable_fields_ = ['c'] - class B(object): import_from_mixin(C) @@ -797,9 +811,9 @@ assert B._immutable_fields_ == ['b', 'c', 'a'] - class B(object): _immutable_fields_ = ['b'] + class BA(B): import_from_mixin(C) From noreply at buildbot.pypy.org Wed Nov 25 11:39:10 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 17:39:10 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: Fix test_hashtable_prebuilt Message-ID: <20151125163910.6C4681C06F2@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80958:f619f9fa3317 Date: 2015-11-25 17:39 +0100 http://bitbucket.org/pypy/pypy/changeset/f619f9fa3317/ Log: Fix test_hashtable_prebuilt diff --git a/rpython/translator/stm/hashtable.py b/rpython/translator/stm/hashtable.py --- a/rpython/translator/stm/hashtable.py +++ b/rpython/translator/stm/hashtable.py @@ -36,19 +36,19 @@ print >> f print >> f, 'struct _hashtable_descr_s {' print >> f, '\tUnsigned key;' - print >> f, '\trpygcchar_t *value;' - print >> f, '};' + print >> f, '\tint globalnum;' + print >> f, '} __attribute__((packed));' print >> f, 'static struct _hashtable_descr_s hashtable_descs[] = {' for node in nodes: assert node.globalgcnum >= 0 items = node.get_hashtable_content() items.sort(key=lambda entry: entry.index) - print >> f, '\t{ %d, (rpygcchar_t *)%d },' % (node.globalgcnum, - len(items)) + print >> f, '\t{ %d, %d },' % (len(items), node.globalgcnum) for entry in items: - expr = database.get(entry.object, static=True) - print >> f, '\t{ %d, %s },' % (entry.index, expr) - print >> f + itemcontainer = entry.object._obj.container + itemnode = database.getcontainernode(itemcontainer) + assert itemnode.globalgcnum >= 0 + print >> f, '\t\t{ %dL, %d },' % (entry.index, itemnode.globalgcnum) print >> f, '};' diff --git a/rpython/translator/stm/src_stm/extracode.h b/rpython/translator/stm/src_stm/extracode.h --- a/rpython/translator/stm/src_stm/extracode.h +++ b/rpython/translator/stm/src_stm/extracode.h @@ -42,22 +42,26 @@ #if STM_PREBUILT_HASHTABLES > 0 struct _hashtable_descr_s *hdesc = hashtable_descs; int i; - long count; + Unsigned count; pypy_HASHTABLE_OBJ0_t *htobj; stm_hashtable_t *ht; stm_hashtable_entry_userdata = STM_HASHTABLE_ENTRY_TYPEID; for (i = 0; i < STM_PREBUILT_HASHTABLES; i++) { - /* Every hashtable is one header hdesc entry followed by N hdescs. - The header abuses 'key' as an index inside rpy_prebuilt and - 'value' as the number of entries that follow. */ - htobj = (pypy_HASHTABLE_OBJ0_t *)rpy_prebuilt[hdesc->key]; - htobj->ha_ll_raw_hashtable = ht = stm_hashtable_create(); - count = (long)hdesc->value; + /* Every hashtable is one header hdesc entry followed by N + hdescs. The header abuses 'key' as the number of entries + that follow, and its 'globalnum' is the rpy_prebuilt index + of the hashtable itself. */ + ht = stm_hashtable_create(); + htobj = (pypy_HASHTABLE_OBJ0_t *)rpy_prebuilt[hdesc->globalnum]; + stm_write((object_t *)htobj); + htobj->ha_ll_raw_hashtable = ht; + count = hdesc->key; hdesc++; while (count > 0) { stm_hashtable_write((object_t *)htobj, ht, hdesc->key, - (object_t *)hdesc->value, &stm_thread_local); + rpy_prebuilt[hdesc->globalnum], + &stm_thread_local); hdesc++; count--; } From noreply at buildbot.pypy.org Wed Nov 25 11:40:10 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 25 Nov 2015 17:40:10 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Use ClassDescs instead of ClassDefs in our_issubclass() Message-ID: <20151125164010.F2D7D1C06F2@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80959:6ebeeb9aabc6 Date: 2015-11-25 15:22 +0000 http://bitbucket.org/pypy/pypy/changeset/6ebeeb9aabc6/ Log: Use ClassDescs instead of ClassDefs in our_issubclass() diff --git a/rpython/annotator/classdesc.py b/rpython/annotator/classdesc.py --- a/rpython/annotator/classdesc.py +++ b/rpython/annotator/classdesc.py @@ -258,8 +258,8 @@ yield self self = self.basedef - def issubclass(self, otherclsdef): - return otherclsdef in self.parentdefs + def issubclass(self, other): + return self.classdesc.issubclass(other.classdesc) def getallsubdefs(self): pending = [self] @@ -722,6 +722,9 @@ return True return False + def issubclass(self, other): + return issubclass(self.pyobj, other.pyobj) + def lookup(self, name): cdesc = self while name not in cdesc.classdict: diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py --- a/rpython/annotator/model.py +++ b/rpython/annotator/model.py @@ -436,7 +436,7 @@ def __init__(self, classdef, can_be_None=False, flags={}): self.classdef = classdef - self.knowntype = classdef or object + self.knowntype = classdef.classdesc if classdef else None self.can_be_None = can_be_None self.flags = flags diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -19,7 +19,7 @@ from rpython.annotator.binaryop import _clone ## XXX where to put this? from rpython.annotator.binaryop import _dict_can_only_throw_keyerror from rpython.annotator.binaryop import _dict_can_only_throw_nothing -from rpython.annotator.classdesc import ClassDef +from rpython.annotator.classdesc import ClassDesc from rpython.annotator.model import AnnotatorError from rpython.annotator.argument import simple_args, complex_args @@ -38,27 +38,27 @@ return True def classify(cls): from rpython.rlib.rarithmetic import base_int - if isinstance(cls, ClassDef): - return 'def' + if isinstance(cls, ClassDesc): + return 'desc' if cls.__module__ == '__builtin__' or issubclass(cls, base_int): return 'builtin' else: return 'cls' kind1 = classify(cls1) kind2 = classify(cls2) - if kind1 != 'def' and kind2 != 'def': + if kind1 != 'desc' and kind2 != 'desc': return issubclass(cls1, cls2) - if kind1 == 'builtin' and kind2 == 'def': + if kind1 == 'builtin' and kind2 == 'desc': return False - elif kind1 == 'def' and kind2 == 'builtin': + elif kind1 == 'desc' and kind2 == 'builtin': return issubclass(object, cls2) else: - def toclassdef(kind, cls): - if kind != 'def': - return bk.getuniqueclassdef(cls) + def toclassdesc(kind, cls): + if kind != 'desc': + return bk.getdesc(cls) else: return cls - return toclassdef(kind1, cls1).issubclass(toclassdef(kind2, cls2)) + return toclassdesc(kind1, cls1).issubclass(toclassdesc(kind2, cls2)) def s_isinstance(annotator, s_obj, s_type, variables): diff --git a/rpython/rlib/test/test_objectmodel.py b/rpython/rlib/test/test_objectmodel.py --- a/rpython/rlib/test/test_objectmodel.py +++ b/rpython/rlib/test/test_objectmodel.py @@ -113,11 +113,11 @@ Strange_def = a.bookkeeper.getuniqueclassdef(Strange) graph = graphof(t, strange_key_eq) - assert a.binding(graph.getargs()[0]).knowntype == Strange_def + assert a.binding(graph.getargs()[0]).classdef == Strange_def assert a.binding(graph.getargs()[1]).knowntype == str assert a.binding(graph.getargs()[2]).knowntype == str graph = graphof(t, strange_key_hash) - assert a.binding(graph.getargs()[0]).knowntype == Strange_def + assert a.binding(graph.getargs()[0]).classdef == Strange_def assert a.binding(graph.getargs()[1]).knowntype == str diff --git a/rpython/rtyper/test/test_llannotation.py b/rpython/rtyper/test/test_llannotation.py --- a/rpython/rtyper/test/test_llannotation.py +++ b/rpython/rtyper/test/test_llannotation.py @@ -15,6 +15,7 @@ def __init__(self, cls=C): self.cls = cls self.name = cls.__name__ + self.classdesc = cls def test_ll_to_annotation(): s_z = ll_to_annotation(lltype.Signed._defl()) diff --git a/rpython/rtyper/test/test_nongc.py b/rpython/rtyper/test/test_nongc.py --- a/rpython/rtyper/test/test_nongc.py +++ b/rpython/rtyper/test/test_nongc.py @@ -40,7 +40,7 @@ #does not raise: s = a.build_types(f, []) Adef = a.bookkeeper.getuniqueclassdef(A) - assert s.knowntype == Adef + assert s.classdef == Adef rtyper = RPythonTyper(a) rtyper.specialize() assert (Adef, 'raw') in rtyper.instance_reprs @@ -59,7 +59,7 @@ s = a.build_types(f, []) Adef = a.bookkeeper.getuniqueclassdef(A) Bdef = a.bookkeeper.getuniqueclassdef(B) - assert s.knowntype == Bdef + assert s.classdef == Bdef rtyper = RPythonTyper(a) rtyper.specialize() assert (Adef, 'raw') in rtyper.instance_reprs From noreply at buildbot.pypy.org Wed Nov 25 11:40:13 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 25 Nov 2015 17:40:13 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Create BuiltinTypeDesc and simplify our_issubclass() Message-ID: <20151125164013.17B411C06F2@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80960:bea678d5d487 Date: 2015-11-25 16:39 +0000 http://bitbucket.org/pypy/pypy/changeset/bea678d5d487/ Log: Create BuiltinTypeDesc and simplify our_issubclass() diff --git a/rpython/annotator/classdesc.py b/rpython/annotator/classdesc.py --- a/rpython/annotator/classdesc.py +++ b/rpython/annotator/classdesc.py @@ -471,6 +471,19 @@ def is_mixin(cls): return cls.__dict__.get('_mixin_', False) +def is_primitive_type(cls): + from rpython.rlib.rarithmetic import base_int + return cls.__module__ == '__builtin__' or issubclass(cls, base_int) + + +class BuiltinTypeDesc(object): + """Represents a primitive or builtin type object""" + def __init__(self, cls): + self.pyobj = cls + + def issubclass(self, other): + return issubclass(self.pyobj, other.pyobj) + class ClassDesc(Desc): knowntype = type diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -19,7 +19,7 @@ from rpython.annotator.binaryop import _clone ## XXX where to put this? from rpython.annotator.binaryop import _dict_can_only_throw_keyerror from rpython.annotator.binaryop import _dict_can_only_throw_nothing -from rpython.annotator.classdesc import ClassDesc +from rpython.annotator.classdesc import ClassDesc, is_primitive_type, BuiltinTypeDesc from rpython.annotator.model import AnnotatorError from rpython.annotator.argument import simple_args, complex_args @@ -34,31 +34,14 @@ def our_issubclass(bk, cls1, cls2): - if cls2 is object: - return True - def classify(cls): - from rpython.rlib.rarithmetic import base_int + def toclassdesc(cls): if isinstance(cls, ClassDesc): - return 'desc' - if cls.__module__ == '__builtin__' or issubclass(cls, base_int): - return 'builtin' + return cls + elif is_primitive_type(cls): + return BuiltinTypeDesc(cls) else: - return 'cls' - kind1 = classify(cls1) - kind2 = classify(cls2) - if kind1 != 'desc' and kind2 != 'desc': - return issubclass(cls1, cls2) - if kind1 == 'builtin' and kind2 == 'desc': - return False - elif kind1 == 'desc' and kind2 == 'builtin': - return issubclass(object, cls2) - else: - def toclassdesc(kind, cls): - if kind != 'desc': - return bk.getdesc(cls) - else: - return cls - return toclassdesc(kind1, cls1).issubclass(toclassdesc(kind2, cls2)) + return bk.getdesc(cls) + return toclassdesc(cls1).issubclass(toclassdesc(cls2)) def s_isinstance(annotator, s_obj, s_type, variables): From noreply at buildbot.pypy.org Wed Nov 25 11:40:15 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 25 Nov 2015 17:40:15 +0100 (CET) Subject: [pypy-commit] pypy anntype2: hg merge default Message-ID: <20151125164015.6CD071C06F2@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80961:3b7960428100 Date: 2015-11-25 16:40 +0000 http://bitbucket.org/pypy/pypy/changeset/3b7960428100/ Log: hg merge default diff too long, truncating to 2000 out of 2617 lines diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py --- a/lib_pypy/cffi/api.py +++ b/lib_pypy/cffi/api.py @@ -72,6 +72,7 @@ self._cdefsources = [] self._included_ffis = [] self._windows_unicode = None + self._init_once_cache = {} if hasattr(backend, 'set_ffi'): backend.set_ffi(self) for name in backend.__dict__: @@ -598,6 +599,30 @@ return recompile(self, module_name, source, tmpdir=tmpdir, source_extension=source_extension, **kwds) + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + def _load_backend_lib(backend, name, flags): if name is None: diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h --- a/lib_pypy/cffi/parse_c_type.h +++ b/lib_pypy/cffi/parse_c_type.h @@ -1,5 +1,6 @@ -/* See doc/misc/parse_c_type.rst in the source of CFFI for more information */ +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ typedef void *_cffi_opcode_t; diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -21,6 +21,8 @@ import math as _math import struct as _struct +_SENTINEL = object() + def _cmp(x, y): return 0 if x == y else 1 if x > y else -1 @@ -31,6 +33,8 @@ MAXYEAR = 9999 _MINYEARFMT = 1900 +_MAX_DELTA_DAYS = 999999999 + # Utility functions, adapted from Python's Demo/classes/Dates.py, which # also assumes the current Gregorian calendar indefinitely extended in # both directions. Difference: Dates.py calls January 1 of year 0 day @@ -95,6 +99,15 @@ # pasting together 25 4-year cycles. assert _DI100Y == 25 * _DI4Y - 1 +_US_PER_US = 1 +_US_PER_MS = 1000 +_US_PER_SECOND = 1000000 +_US_PER_MINUTE = 60000000 +_SECONDS_PER_DAY = 24 * 3600 +_US_PER_HOUR = 3600000000 +_US_PER_DAY = 86400000000 +_US_PER_WEEK = 604800000000 + def _ord2ymd(n): "ordinal -> (year, month, day), considering 01-Jan-0001 as day 1." @@ -271,15 +284,17 @@ def _check_int_field(value): if isinstance(value, int): - return value + return int(value) if not isinstance(value, float): try: value = value.__int__() except AttributeError: pass else: - if isinstance(value, (int, long)): - return value + if isinstance(value, int): + return int(value) + elif isinstance(value, long): + return int(long(value)) raise TypeError('__int__ method should return an integer') raise TypeError('an integer is required') raise TypeError('integer argument expected, got float') @@ -344,75 +359,79 @@ raise TypeError("can't compare '%s' to '%s'" % ( type(x).__name__, type(y).__name__)) -# This is a start at a struct tm workalike. Goals: -# -# + Works the same way across platforms. -# + Handles all the fields datetime needs handled, without 1970-2038 glitches. -# -# Note: I suspect it's best if this flavor of tm does *not* try to -# second-guess timezones or DST. Instead fold whatever adjustments you want -# into the minutes argument (and the constructor will normalize). +def _normalize_pair(hi, lo, factor): + if not 0 <= lo <= factor-1: + inc, lo = divmod(lo, factor) + hi += inc + return hi, lo -class _tmxxx: +def _normalize_datetime(y, m, d, hh, mm, ss, us, ignore_overflow=False): + # Normalize all the inputs, and store the normalized values. + ss, us = _normalize_pair(ss, us, 1000000) + mm, ss = _normalize_pair(mm, ss, 60) + hh, mm = _normalize_pair(hh, mm, 60) + d, hh = _normalize_pair(d, hh, 24) + y, m, d = _normalize_date(y, m, d, ignore_overflow) + return y, m, d, hh, mm, ss, us - ordinal = None +def _normalize_date(year, month, day, ignore_overflow=False): + # That was easy. Now it gets muddy: the proper range for day + # can't be determined without knowing the correct month and year, + # but if day is, e.g., plus or minus a million, the current month + # and year values make no sense (and may also be out of bounds + # themselves). + # Saying 12 months == 1 year should be non-controversial. + if not 1 <= month <= 12: + year, month = _normalize_pair(year, month-1, 12) + month += 1 + assert 1 <= month <= 12 - def __init__(self, year, month, day, hour=0, minute=0, second=0, - microsecond=0): - # Normalize all the inputs, and store the normalized values. - if not 0 <= microsecond <= 999999: - carry, microsecond = divmod(microsecond, 1000000) - second += carry - if not 0 <= second <= 59: - carry, second = divmod(second, 60) - minute += carry - if not 0 <= minute <= 59: - carry, minute = divmod(minute, 60) - hour += carry - if not 0 <= hour <= 23: - carry, hour = divmod(hour, 24) - day += carry + # Now only day can be out of bounds (year may also be out of bounds + # for a datetime object, but we don't care about that here). + # If day is out of bounds, what to do is arguable, but at least the + # method here is principled and explainable. + dim = _days_in_month(year, month) + if not 1 <= day <= dim: + # Move day-1 days from the first of the month. First try to + # get off cheap if we're only one day out of range (adjustments + # for timezone alone can't be worse than that). + if day == 0: # move back a day + month -= 1 + if month > 0: + day = _days_in_month(year, month) + else: + year, month, day = year-1, 12, 31 + elif day == dim + 1: # move forward a day + month += 1 + day = 1 + if month > 12: + month = 1 + year += 1 + else: + ordinal = _ymd2ord(year, month, 1) + (day - 1) + year, month, day = _ord2ymd(ordinal) - # That was easy. Now it gets muddy: the proper range for day - # can't be determined without knowing the correct month and year, - # but if day is, e.g., plus or minus a million, the current month - # and year values make no sense (and may also be out of bounds - # themselves). - # Saying 12 months == 1 year should be non-controversial. - if not 1 <= month <= 12: - carry, month = divmod(month-1, 12) - year += carry - month += 1 - assert 1 <= month <= 12 + if not ignore_overflow and not MINYEAR <= year <= MAXYEAR: + raise OverflowError("date value out of range") + return year, month, day - # Now only day can be out of bounds (year may also be out of bounds - # for a datetime object, but we don't care about that here). - # If day is out of bounds, what to do is arguable, but at least the - # method here is principled and explainable. - dim = _days_in_month(year, month) - if not 1 <= day <= dim: - # Move day-1 days from the first of the month. First try to - # get off cheap if we're only one day out of range (adjustments - # for timezone alone can't be worse than that). - if day == 0: # move back a day - month -= 1 - if month > 0: - day = _days_in_month(year, month) - else: - year, month, day = year-1, 12, 31 - elif day == dim + 1: # move forward a day - month += 1 - day = 1 - if month > 12: - month = 1 - year += 1 - else: - self.ordinal = _ymd2ord(year, month, 1) + (day - 1) - year, month, day = _ord2ymd(self.ordinal) - - self.year, self.month, self.day = year, month, day - self.hour, self.minute, self.second = hour, minute, second - self.microsecond = microsecond +def _accum(tag, sofar, num, factor, leftover): + if isinstance(num, (int, long)): + prod = num * factor + rsum = sofar + prod + return rsum, leftover + if isinstance(num, float): + fracpart, intpart = _math.modf(num) + prod = int(intpart) * factor + rsum = sofar + prod + if fracpart == 0.0: + return rsum, leftover + assert isinstance(factor, (int, long)) + fracpart, intpart = _math.modf(factor * fracpart) + rsum += int(intpart) + return rsum, leftover + fracpart + raise TypeError("unsupported type for timedelta %s component: %s" % + (tag, type(num))) class timedelta(object): """Represent the difference between two datetime objects. @@ -433,100 +452,42 @@ """ __slots__ = '_days', '_seconds', '_microseconds', '_hashcode' - def __new__(cls, days=0, seconds=0, microseconds=0, - milliseconds=0, minutes=0, hours=0, weeks=0): - # Doing this efficiently and accurately in C is going to be difficult - # and error-prone, due to ubiquitous overflow possibilities, and that - # C double doesn't have enough bits of precision to represent - # microseconds over 10K years faithfully. The code here tries to make - # explicit where go-fast assumptions can be relied on, in order to - # guide the C implementation; it's way more convoluted than speed- - # ignoring auto-overflow-to-long idiomatic Python could be. + def __new__(cls, days=_SENTINEL, seconds=_SENTINEL, microseconds=_SENTINEL, + milliseconds=_SENTINEL, minutes=_SENTINEL, hours=_SENTINEL, weeks=_SENTINEL): + x = 0 + leftover = 0.0 + if microseconds is not _SENTINEL: + x, leftover = _accum("microseconds", x, microseconds, _US_PER_US, leftover) + if milliseconds is not _SENTINEL: + x, leftover = _accum("milliseconds", x, milliseconds, _US_PER_MS, leftover) + if seconds is not _SENTINEL: + x, leftover = _accum("seconds", x, seconds, _US_PER_SECOND, leftover) + if minutes is not _SENTINEL: + x, leftover = _accum("minutes", x, minutes, _US_PER_MINUTE, leftover) + if hours is not _SENTINEL: + x, leftover = _accum("hours", x, hours, _US_PER_HOUR, leftover) + if days is not _SENTINEL: + x, leftover = _accum("days", x, days, _US_PER_DAY, leftover) + if weeks is not _SENTINEL: + x, leftover = _accum("weeks", x, weeks, _US_PER_WEEK, leftover) + if leftover != 0.0: + x += _round(leftover) + return cls._from_microseconds(x) - # XXX Check that all inputs are ints, longs or floats. + @classmethod + def _from_microseconds(cls, us): + s, us = divmod(us, _US_PER_SECOND) + d, s = divmod(s, _SECONDS_PER_DAY) + return cls._create(d, s, us, False) - # Final values, all integer. - # s and us fit in 32-bit signed ints; d isn't bounded. - d = s = us = 0 + @classmethod + def _create(cls, d, s, us, normalize): + if normalize: + s, us = _normalize_pair(s, us, 1000000) + d, s = _normalize_pair(d, s, 24*3600) - # Normalize everything to days, seconds, microseconds. - days += weeks*7 - seconds += minutes*60 + hours*3600 - microseconds += milliseconds*1000 - - # Get rid of all fractions, and normalize s and us. - # Take a deep breath . - if isinstance(days, float): - dayfrac, days = _math.modf(days) - daysecondsfrac, daysecondswhole = _math.modf(dayfrac * (24.*3600.)) - assert daysecondswhole == int(daysecondswhole) # can't overflow - s = int(daysecondswhole) - assert days == int(days) - d = int(days) - else: - daysecondsfrac = 0.0 - d = days - assert isinstance(daysecondsfrac, float) - assert abs(daysecondsfrac) <= 1.0 - assert isinstance(d, (int, long)) - assert abs(s) <= 24 * 3600 - # days isn't referenced again before redefinition - - if isinstance(seconds, float): - secondsfrac, seconds = _math.modf(seconds) - assert seconds == int(seconds) - seconds = int(seconds) - secondsfrac += daysecondsfrac - assert abs(secondsfrac) <= 2.0 - else: - secondsfrac = daysecondsfrac - # daysecondsfrac isn't referenced again - assert isinstance(secondsfrac, float) - assert abs(secondsfrac) <= 2.0 - - assert isinstance(seconds, (int, long)) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) # can't overflow - assert isinstance(s, int) - assert abs(s) <= 2 * 24 * 3600 - # seconds isn't referenced again before redefinition - - usdouble = secondsfrac * 1e6 - assert abs(usdouble) < 2.1e6 # exact value not critical - # secondsfrac isn't referenced again - - if isinstance(microseconds, float): - microseconds = _round(microseconds + usdouble) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = int(microseconds) - else: - microseconds = int(microseconds) - seconds, microseconds = divmod(microseconds, 1000000) - days, seconds = divmod(seconds, 24*3600) - d += days - s += int(seconds) - microseconds = _round(microseconds + usdouble) - assert isinstance(s, int) - assert isinstance(microseconds, int) - assert abs(s) <= 3 * 24 * 3600 - assert abs(microseconds) < 3.1e6 - - # Just a little bit of carrying possible for microseconds and seconds. - seconds, us = divmod(microseconds, 1000000) - s += seconds - days, s = divmod(s, 24*3600) - d += days - - assert isinstance(d, (int, long)) - assert isinstance(s, int) and 0 <= s < 24*3600 - assert isinstance(us, int) and 0 <= us < 1000000 - - if abs(d) > 999999999: - raise OverflowError("timedelta # of days is too large: %d" % d) + if not -_MAX_DELTA_DAYS <= d <= _MAX_DELTA_DAYS: + raise OverflowError("days=%d; must have magnitude <= %d" % (d, _MAX_DELTA_DAYS)) self = object.__new__(cls) self._days = d @@ -535,6 +496,10 @@ self._hashcode = -1 return self + def _to_microseconds(self): + return ((self._days * _SECONDS_PER_DAY + self._seconds) * _US_PER_SECOND + + self._microseconds) + def __repr__(self): module = "datetime." if self.__class__ is timedelta else "" if self._microseconds: @@ -562,8 +527,7 @@ def total_seconds(self): """Total seconds in the duration.""" - return ((self.days * 86400 + self.seconds) * 10**6 + - self.microseconds) / 10**6 + return self._to_microseconds() / 10**6 # Read-only field accessors @property @@ -585,36 +549,37 @@ if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days + other._days, - self._seconds + other._seconds, - self._microseconds + other._microseconds) + return timedelta._create(self._days + other._days, + self._seconds + other._seconds, + self._microseconds + other._microseconds, + True) return NotImplemented - __radd__ = __add__ - def __sub__(self, other): if isinstance(other, timedelta): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(self._days - other._days, - self._seconds - other._seconds, - self._microseconds - other._microseconds) - return NotImplemented - - def __rsub__(self, other): - if isinstance(other, timedelta): - return -self + other + return timedelta._create(self._days - other._days, + self._seconds - other._seconds, + self._microseconds - other._microseconds, + True) return NotImplemented def __neg__(self): # for CPython compatibility, we cannot use # our __class__ here, but need a real timedelta - return timedelta(-self._days, - -self._seconds, - -self._microseconds) + return timedelta._create(-self._days, + -self._seconds, + -self._microseconds, + True) def __pos__(self): - return self + # for CPython compatibility, we cannot use + # our __class__ here, but need a real timedelta + return timedelta._create(self._days, + self._seconds, + self._microseconds, + False) def __abs__(self): if self._days < 0: @@ -623,25 +588,18 @@ return self def __mul__(self, other): - if isinstance(other, (int, long)): - # for CPython compatibility, we cannot use - # our __class__ here, but need a real timedelta - return timedelta(self._days * other, - self._seconds * other, - self._microseconds * other) - return NotImplemented + if not isinstance(other, (int, long)): + return NotImplemented + usec = self._to_microseconds() + return timedelta._from_microseconds(usec * other) __rmul__ = __mul__ - def _to_microseconds(self): - return ((self._days * (24*3600) + self._seconds) * 1000000 + - self._microseconds) - def __div__(self, other): if not isinstance(other, (int, long)): return NotImplemented usec = self._to_microseconds() - return timedelta(0, 0, usec // other) + return timedelta._from_microseconds(usec // other) __floordiv__ = __div__ @@ -705,9 +663,8 @@ def __reduce__(self): return (self.__class__, self._getstate()) -timedelta.min = timedelta(-999999999) -timedelta.max = timedelta(days=999999999, hours=23, minutes=59, seconds=59, - microseconds=999999) +timedelta.min = timedelta(-_MAX_DELTA_DAYS) +timedelta.max = timedelta(_MAX_DELTA_DAYS, 24*3600-1, 1000000-1) timedelta.resolution = timedelta(microseconds=1) class date(object): @@ -948,32 +905,29 @@ # Computations - def _checkOverflow(self, year): - if not MINYEAR <= year <= MAXYEAR: - raise OverflowError("date +/-: result year %d not in %d..%d" % - (year, MINYEAR, MAXYEAR)) + def _add_timedelta(self, other, factor): + y, m, d = _normalize_date( + self._year, + self._month, + self._day + other.days * factor) + return date(y, m, d) def __add__(self, other): "Add a date to a timedelta." if isinstance(other, timedelta): - t = _tmxxx(self._year, - self._month, - self._day + other.days) - self._checkOverflow(t.year) - result = date(t.year, t.month, t.day) - return result + return self._add_timedelta(other, 1) return NotImplemented __radd__ = __add__ def __sub__(self, other): """Subtract two dates, or a date and a timedelta.""" - if isinstance(other, timedelta): - return self + timedelta(-other.days) if isinstance(other, date): days1 = self.toordinal() days2 = other.toordinal() - return timedelta(days1 - days2) + return timedelta._create(days1 - days2, 0, 0, False) + if isinstance(other, timedelta): + return self._add_timedelta(other, -1) return NotImplemented def weekday(self): @@ -1340,7 +1294,7 @@ offset = self._tzinfo.utcoffset(None) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1378,7 +1332,7 @@ offset = self._tzinfo.dst(None) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1505,18 +1459,24 @@ A timezone info object may be passed in as well. """ + _check_tzinfo_arg(tz) + converter = _time.localtime if tz is None else _time.gmtime + self = cls._from_timestamp(converter, timestamp, tz) + if tz is not None: + self = tz.fromutc(self) + return self - _check_tzinfo_arg(tz) + @classmethod + def utcfromtimestamp(cls, t): + "Construct a UTC datetime from a POSIX timestamp (like time.time())." + return cls._from_timestamp(_time.gmtime, t, None) - converter = _time.localtime if tz is None else _time.gmtime - - if isinstance(timestamp, int): - us = 0 - else: - t_full = timestamp - timestamp = int(_math.floor(timestamp)) - frac = t_full - timestamp - us = _round(frac * 1e6) + @classmethod + def _from_timestamp(cls, converter, timestamp, tzinfo): + t_full = timestamp + timestamp = int(_math.floor(timestamp)) + frac = t_full - timestamp + us = _round(frac * 1e6) # If timestamp is less than one microsecond smaller than a # full second, us can be rounded up to 1000000. In this case, @@ -1527,32 +1487,7 @@ us = 0 y, m, d, hh, mm, ss, weekday, jday, dst = converter(timestamp) ss = min(ss, 59) # clamp out leap seconds if the platform has them - result = cls(y, m, d, hh, mm, ss, us, tz) - if tz is not None: - result = tz.fromutc(result) - return result - - @classmethod - def utcfromtimestamp(cls, t): - "Construct a UTC datetime from a POSIX timestamp (like time.time())." - if isinstance(t, int): - us = 0 - else: - t_full = t - t = int(_math.floor(t)) - frac = t_full - t - us = _round(frac * 1e6) - - # If timestamp is less than one microsecond smaller than a - # full second, us can be rounded up to 1000000. In this case, - # roll over to seconds, otherwise, ValueError is raised - # by the constructor. - if us == 1000000: - t += 1 - us = 0 - y, m, d, hh, mm, ss, weekday, jday, dst = _time.gmtime(t) - ss = min(ss, 59) # clamp out leap seconds if the platform has them - return cls(y, m, d, hh, mm, ss, us) + return cls(y, m, d, hh, mm, ss, us, tzinfo) @classmethod def now(cls, tz=None): @@ -1594,9 +1529,9 @@ hh, mm, ss = self.hour, self.minute, self.second offset = self._utcoffset() if offset: # neither None nor 0 - tm = _tmxxx(y, m, d, hh, mm - offset) - y, m, d = tm.year, tm.month, tm.day - hh, mm = tm.hour, tm.minute + mm -= offset + y, m, d, hh, mm, ss, _ = _normalize_datetime( + y, m, d, hh, mm, ss, 0, ignore_overflow=True) return _build_struct_time(y, m, d, hh, mm, ss, 0) def date(self): @@ -1730,7 +1665,7 @@ offset = self._tzinfo.utcoffset(self) offset = _check_utc_offset("utcoffset", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1768,7 +1703,7 @@ offset = self._tzinfo.dst(self) offset = _check_utc_offset("dst", offset) if offset is not None: - offset = timedelta(minutes=offset) + offset = timedelta._create(0, offset * 60, 0, True) return offset # Return an integer (or None) instead of a timedelta (or None). @@ -1859,22 +1794,22 @@ return -1 return diff and 1 or 0 + def _add_timedelta(self, other, factor): + y, m, d, hh, mm, ss, us = _normalize_datetime( + self._year, + self._month, + self._day + other.days * factor, + self._hour, + self._minute, + self._second + other.seconds * factor, + self._microsecond + other.microseconds * factor) + return datetime(y, m, d, hh, mm, ss, us, tzinfo=self._tzinfo) + def __add__(self, other): "Add a datetime and a timedelta." if not isinstance(other, timedelta): return NotImplemented - t = _tmxxx(self._year, - self._month, - self._day + other.days, - self._hour, - self._minute, - self._second + other.seconds, - self._microsecond + other.microseconds) - self._checkOverflow(t.year) - result = datetime(t.year, t.month, t.day, - t.hour, t.minute, t.second, - t.microsecond, tzinfo=self._tzinfo) - return result + return self._add_timedelta(other, 1) __radd__ = __add__ @@ -1882,16 +1817,15 @@ "Subtract two datetimes, or a datetime and a timedelta." if not isinstance(other, datetime): if isinstance(other, timedelta): - return self + -other + return self._add_timedelta(other, -1) return NotImplemented - days1 = self.toordinal() - days2 = other.toordinal() - secs1 = self._second + self._minute * 60 + self._hour * 3600 - secs2 = other._second + other._minute * 60 + other._hour * 3600 - base = timedelta(days1 - days2, - secs1 - secs2, - self._microsecond - other._microsecond) + delta_d = self.toordinal() - other.toordinal() + delta_s = (self._hour - other._hour) * 3600 + \ + (self._minute - other._minute) * 60 + \ + (self._second - other._second) + delta_us = self._microsecond - other._microsecond + base = timedelta._create(delta_d, delta_s, delta_us, True) if self._tzinfo is other._tzinfo: return base myoff = self._utcoffset() diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -15,4 +15,17 @@ Fix the cpyext tests on OSX by linking with -flat_namespace .. branch: anntype + Refactor and improve exception analysis in the annotator. + +.. branch: posita/2193-datetime-timedelta-integrals + +Fix issue #2193. ``isinstance(..., int)`` => ``isinstance(..., numbers.Integral)`` +to allow for alternate ``int``-like implementations (e.g., ``future.types.newint``) + +.. branch: faster-rstruct + +Improve the performace of struct.unpack, which now directly reads inside the +string buffer and directly casts the bytes to the appropriate type, when +allowed. Unpacking of floats and doubles is about 15 times faster now, while +for integer types it's up to ~50% faster for 64bit integers. diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py --- a/pypy/module/_cffi_backend/ffi_obj.py +++ b/pypy/module/_cffi_backend/ffi_obj.py @@ -49,6 +49,8 @@ ACCEPT_CDATA = ACCEPT_CDATA w_gc_wref_remove = None + w_init_once_cache = None + jit_init_once_cache = None @jit.dont_look_inside def __init__(self, space, src_ctx): @@ -585,6 +587,59 @@ return w_result + def descr_init_once(self, w_func, w_tag): + """XXX document me""" + # + # first, a fast-path for the JIT which only works if the very + # same w_tag object is passed; then it turns into no code at all + try: + return self._init_once_elidable(w_tag) + except KeyError: + return self._init_once_slowpath(w_func, w_tag) + + @jit.elidable + def _init_once_elidable(self, w_tag): + jit_cache = self.jit_init_once_cache + if jit_cache is not None: + return jit_cache[w_tag] + else: + raise KeyError + + @jit.dont_look_inside + def _init_once_slowpath(self, w_func, w_tag): + space = self.space + w_cache = self.w_init_once_cache + if w_cache is None: + w_cache = self.space.newdict() + jit_cache = {} + self.w_init_once_cache = w_cache + self.jit_init_once_cache = jit_cache + # + # get the lock or result from cache[tag] + w_res = space.finditem(w_cache, w_tag) + if w_res is None: + w_res = W_InitOnceLock(space) + w_res = space.call_method(w_cache, 'setdefault', w_tag, w_res) + if not isinstance(w_res, W_InitOnceLock): + return w_res + with w_res.lock: + w_res = space.finditem(w_cache, w_tag) + if w_res is None or isinstance(w_res, W_InitOnceLock): + w_res = space.call_function(w_func) + self.jit_init_once_cache[w_tag] = w_res + space.setitem(w_cache, w_tag, w_res) + else: + # the real result was put in the dict while we were + # waiting for lock.__enter__() above + pass + return w_res + + +class W_InitOnceLock(W_Root): + def __init__(self, space): + self.lock = space.allocate_lock() + + @jit.dont_look_inside def make_plain_ffi_object(space, w_ffitype=None): if w_ffitype is None: @@ -641,6 +696,7 @@ from_handle = interp2app(W_FFIObject.descr_from_handle), gc = interp2app(W_FFIObject.descr_gc), getctype = interp2app(W_FFIObject.descr_getctype), + init_once = interp2app(W_FFIObject.descr_init_once), integer_const = interp2app(W_FFIObject.descr_integer_const), memmove = interp2app(W_FFIObject.descr_memmove), new = interp2app(W_FFIObject.descr_new), diff --git a/pypy/module/_cffi_backend/test/test_ffi_obj.py b/pypy/module/_cffi_backend/test/test_ffi_obj.py --- a/pypy/module/_cffi_backend/test/test_ffi_obj.py +++ b/pypy/module/_cffi_backend/test/test_ffi_obj.py @@ -447,3 +447,19 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + + def test_init_once(self): + import _cffi_backend as _cffi1_backend + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py --- a/pypy/module/micronumpy/compile.py +++ b/pypy/module/micronumpy/compile.py @@ -8,6 +8,7 @@ from pypy.interpreter.error import OperationError from rpython.rlib.objectmodel import specialize, instantiate from rpython.rlib.nonconst import NonConstant +from rpython.rlib.rarithmetic import base_int from pypy.module.micronumpy import boxes, ufuncs from pypy.module.micronumpy.arrayops import where from pypy.module.micronumpy.ndarray import W_NDimArray @@ -178,7 +179,7 @@ return BoolObject(obj) elif isinstance(obj, int): return IntObject(obj) - elif isinstance(obj, long): + elif isinstance(obj, base_int): return LongObject(obj) elif isinstance(obj, W_Root): return obj @@ -196,31 +197,31 @@ return self.float(f) def le(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_le(self, w_obj2) def lt(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_lt(self, w_obj2) def ge(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_ge(self, w_obj2) def add(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_add(self, w_obj2) def sub(self, w_obj1, w_obj2): return self.wrap(1) def mul(self, w_obj1, w_obj2): - assert isinstance(w_obj1, boxes.W_GenericBox) - assert isinstance(w_obj2, boxes.W_GenericBox) + assert isinstance(w_obj1, boxes.W_GenericBox) + assert isinstance(w_obj2, boxes.W_GenericBox) return w_obj1.descr_mul(self, w_obj2) def pow(self, w_obj1, w_obj2, _): @@ -836,7 +837,7 @@ elif self.name == 'reshape': w_arg = self.args[1] assert isinstance(w_arg, ArrayConstant) - order = -1 + order = -1 w_res = arr.reshape(interp.space, w_arg.wrap(interp.space), order) else: assert False diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py --- a/pypy/module/micronumpy/descriptor.py +++ b/pypy/module/micronumpy/descriptor.py @@ -816,8 +816,8 @@ def _usefields(space, w_dict, align): # Only for testing, a shortened version of the real _usefields allfields = [] - for fname in w_dict.iterkeys().iterator: - obj = _get_list_or_none(space, w_dict, fname) + for fname_w in space.unpackiterable(w_dict): + obj = _get_list_or_none(space, w_dict, space.str_w(fname_w)) num = space.int_w(obj[1]) if align: alignment = 0 @@ -828,8 +828,8 @@ title = space.wrap(obj[2]) else: title = space.w_None - allfields.append((space.wrap(fname), format, num, title)) - allfields.sort(key=lambda x: x[2]) + allfields.append((fname_w, format, num, title)) + #allfields.sort(key=lambda x: x[2]) names = [space.newtuple([x[0], x[3]]) for x in allfields] formats = [x[1] for x in allfields] offsets = [x[2] for x in allfields] @@ -853,12 +853,14 @@ aligned_w = _get_val_or_none(space, w_dict, 'aligned') itemsize_w = _get_val_or_none(space, w_dict, 'itemsize') if names_w is None or formats_w is None: - if we_are_translated(): + try: return get_appbridge_cache(space).call_method(space, 'numpy.core._internal', '_usefields', Arguments(space, [w_dict, space.wrap(alignment >= 0)])) - else: - return _usefields(space, w_dict, alignment >= 0) + except OperationError as e: + if e.match(space, space.w_ImportError): + return _usefields(space, w_dict, alignment >= 0) + raise n = len(names_w) if (n != len(formats_w) or (offsets_w is not None and n != len(offsets_w)) or @@ -898,16 +900,17 @@ def dtype_from_spec(space, w_spec, alignment): - if we_are_translated(): + w_lst = w_spec + try: w_lst = get_appbridge_cache(space).call_method(space, 'numpy.core._internal', '_commastring', Arguments(space, [w_spec])) - else: + except OperationError as e: + if not e.match(space, space.w_ImportError): + raise # handle only simple cases for testing if space.isinstance_w(w_spec, space.w_str): spec = [s.strip() for s in space.str_w(w_spec).split(',')] w_lst = space.newlist([space.wrap(s) for s in spec]) - elif space.isinstance_w(w_spec, space.w_list): - w_lst = w_spec if not space.isinstance_w(w_lst, space.w_list) or space.len_w(w_lst) < 1: raise oefmt(space.w_RuntimeError, "_commastring is not returning a list with len >= 1") diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py --- a/pypy/module/pypyjit/test_pypy_c/test_struct.py +++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py @@ -19,7 +19,8 @@ import struct i = 1 while i < n: - x = struct.unpack("i", struct.pack("i", i))[0] # ID: struct + buf = struct.pack("i", i) # ID: pack + x = struct.unpack("i", buf)[0] # ID: unpack i += x / i return i @@ -29,7 +30,7 @@ loop, = log.loops_by_filename(self.filepath) # This could, of course stand some improvement, to remove all these # arithmatic ops, but we've removed all the core overhead. - assert loop.match_by_id("struct", """ + assert loop.match_by_id("pack", """ guard_not_invalidated(descr=...) # struct.pack %s @@ -40,17 +41,22 @@ i17 = int_and(i16, 255) i19 = int_rshift(i16, 8) i20 = int_and(i19, 255) + """ % extra) + # the newstr and the strsetitems are because the string is forced, + # which is in turn because the optimizer doesn't know how to handle a + # getarrayitem_gc_i on a virtual string. It could be improved, but it + # is also true that in real life cases struct.unpack is called on + # strings which come from the outside, so it's a minor issue. + assert loop.match_by_id("unpack", """ # struct.unpack - i22 = int_lshift(i14, 8) - i23 = int_or(i11, i22) - i25 = int_lshift(i17, 16) - i26 = int_or(i23, i25) - i28 = int_ge(i20, 128) - guard_false(i28, descr=...) - i30 = int_lshift(i20, 24) - i31 = int_or(i26, i30) - """ % extra) + p88 = newstr(4) + strsetitem(p88, 0, i11) + strsetitem(p88, 1, i14) + strsetitem(p88, 2, i17) + strsetitem(p88, 3, i20) + i91 = getarrayitem_gc_i(p88, 0, descr=) + """) def test_struct_object(self): def main(n): @@ -58,7 +64,8 @@ s = struct.Struct("i") i = 1 while i < n: - x = s.unpack(s.pack(i))[0] # ID: struct + buf = s.pack(i) # ID: pack + x = s.unpack(buf)[0] # ID: unpack i += x / i return i @@ -66,7 +73,7 @@ assert log.result == main(1000) loop, = log.loops_by_filename(self.filepath) - assert loop.match_by_id('struct', """ + assert loop.match_by_id('pack', """ guard_not_invalidated(descr=...) # struct.pack %s @@ -77,14 +84,14 @@ i17 = int_and(i16, 255) i19 = int_rshift(i16, 8) i20 = int_and(i19, 255) + """ % extra) + assert loop.match_by_id('unpack', """ # struct.unpack - i22 = int_lshift(i14, 8) - i23 = int_or(i11, i22) - i25 = int_lshift(i17, 16) - i26 = int_or(i23, i25) - i28 = int_ge(i20, 128) - guard_false(i28, descr=...) - i30 = int_lshift(i20, 24) - i31 = int_or(i26, i30) - """ % extra) + p88 = newstr(4) + strsetitem(p88, 0, i11) + strsetitem(p88, 1, i14) + strsetitem(p88, 2, i17) + strsetitem(p88, 3, i20) + i91 = getarrayitem_gc_i(p88, 0, descr=) + """) diff --git a/pypy/module/struct/formatiterator.py b/pypy/module/struct/formatiterator.py --- a/pypy/module/struct/formatiterator.py +++ b/pypy/module/struct/formatiterator.py @@ -149,3 +149,13 @@ @specialize.argtype(1) def appendobj(self, value): self.result_w.append(self.space.wrap(value)) + + def get_pos(self): + return self.pos + + def get_buffer_as_string_maybe(self): + string, pos = self.buf.as_str_and_offset_maybe() + return string, pos+self.pos + + def skip(self, size): + self.read(size) # XXX, could avoid taking the slice diff --git a/pypy/module/struct/test/test_struct.py b/pypy/module/struct/test/test_struct.py --- a/pypy/module/struct/test/test_struct.py +++ b/pypy/module/struct/test/test_struct.py @@ -462,3 +462,29 @@ assert self.struct.unpack_from("ii", b, 2) == (17, 42) b[:sz] = self.struct.pack("ii", 18, 43) assert self.struct.unpack_from("ii", b) == (18, 43) + + +class AppTestFastPath(object): + spaceconfig = dict(usemodules=['struct', '__pypy__']) + + def setup_class(cls): + from rpython.rlib.rstruct import standardfmttable + standardfmttable.ALLOW_SLOWPATH = False + # + cls.w_struct = cls.space.appexec([], """(): + import struct + return struct + """) + cls.w_bytebuffer = cls.space.appexec([], """(): + import __pypy__ + return __pypy__.bytebuffer + """) + + def teardown_class(cls): + from rpython.rlib.rstruct import standardfmttable + standardfmttable.ALLOW_SLOWPATH = True + + def test_unpack_from(self): + buf = self.struct.pack("iii", 0, 42, 43) + offset = self.struct.calcsize("i") + assert self.struct.unpack_from("ii", buf, offset) == (42, 43) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1810,3 +1810,35 @@ assert lib.EE1 == 0 assert lib.EE2 == 0 assert lib.EE3 == 1 + + def test_init_once(self): + def do_init(): + seen.append(1) + return 42 + ffi = FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + + def test_init_once_multithread(self): + import thread, time + def do_init(): + seen.append('init!') + time.sleep(1) + seen.append('init done') + return 7 + ffi = FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py @@ -487,7 +487,7 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("double __stdcall sin(double x);") # stdcall ignored m = ffi.dlopen(lib_m) - if (sys.platform == 'win32' and sys.maxint < 2**32 and + if (sys.platform == 'win32' and sys.maxsize < 2**32 and self.Backend is not CTypesBackend): assert "double(__stdcall *)(double)" in str(ffi.typeof(m.sin)) else: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py @@ -194,6 +194,11 @@ yp = ffi.new_handle([6, 4, 2]) assert ffi.from_handle(yp) == [6, 4, 2] +def test_handle_unique(): + ffi = _cffi1_backend.FFI() + assert ffi.new_handle(None) is not ffi.new_handle(None) + assert ffi.new_handle(None) != ffi.new_handle(None) + def test_ffi_cast(): ffi = _cffi1_backend.FFI() assert ffi.cast("int(*)(int)", 0) == ffi.NULL @@ -416,3 +421,37 @@ assert int(ffi.cast("_Bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("bool", ffi.cast(type, 42))) == 1 assert int(ffi.cast("_Bool", ffi.cast(type, 0))) == 0 + +def test_init_once(): + def do_init(): + seen.append(1) + return 42 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(3): + res = ffi.init_once(do_init, "tag1") + assert res == 42 + assert seen == [1] + for i in range(3): + res = ffi.init_once(do_init, "tag2") + assert res == 42 + assert seen == [1, 1] + +def test_init_once_multithread(): + import thread, time + def do_init(): + print 'init!' + seen.append('init!') + time.sleep(1) + seen.append('init done') + print 'init done' + return 7 + ffi = _cffi1_backend.FFI() + seen = [] + for i in range(6): + def f(): + res = ffi.init_once(do_init, "tag") + seen.append(res) + thread.start_new_thread(f, ()) + time.sleep(1.5) + assert seen == ['init!', 'init done'] + 6 * [7] diff --git a/pypy/module/test_lib_pypy/test_datetime.py b/pypy/module/test_lib_pypy/test_datetime.py --- a/pypy/module/test_lib_pypy/test_datetime.py +++ b/pypy/module/test_lib_pypy/test_datetime.py @@ -170,14 +170,23 @@ self.value = value def __int__(self): return self.value + class SubInt(int): pass + class SubLong(long): pass + dt10 = datetime.datetime(10, 10, 10, 10, 10, 10, 10) for xx in [10L, decimal.Decimal(10), decimal.Decimal('10.9'), Number(10), - Number(10L)]: - assert datetime.datetime(10, 10, 10, 10, 10, 10, 10) == \ - datetime.datetime(xx, xx, xx, xx, xx, xx, xx) + Number(10L), + SubInt(10), + SubLong(10), + Number(SubInt(10)), + Number(SubLong(10))]: + dtxx = datetime.datetime(xx, xx, xx, xx, xx, xx, xx) + assert dt10 == dtxx + assert type(dtxx.month) is int + assert type(dtxx.second) is int with py.test.raises(TypeError) as e: datetime.datetime(10, 10, '10') @@ -242,6 +251,70 @@ naive == aware assert str(e.value) == "can't compare offset-naive and offset-aware times" + def test_future_types_newint(self): + try: + from future.types.newint import newint + except ImportError: + py.test.skip('requires future') + + dt_from_ints = datetime.datetime(2015, 12, 31, 12, 34, 56) + dt_from_newints = datetime.datetime(newint(2015), newint(12), newint(31), newint(12), newint(34), newint(56)) + dt_from_mixed = datetime.datetime(2015, newint(12), 31, newint(12), 34, newint(56)) + assert dt_from_ints == dt_from_newints + assert dt_from_newints == dt_from_mixed + assert dt_from_mixed == dt_from_ints + + d_from_int = datetime.date.fromtimestamp(1431216000) + d_from_newint = datetime.date.fromtimestamp(newint(1431216000)) + assert d_from_int == d_from_newint + + dt_from_int = datetime.datetime.fromtimestamp(1431216000) + dt_from_newint = datetime.datetime.fromtimestamp(newint(1431216000)) + assert dt_from_int == dt_from_newint + + dtu_from_int = datetime.datetime.utcfromtimestamp(1431216000) + dtu_from_newint = datetime.datetime.utcfromtimestamp(newint(1431216000)) + assert dtu_from_int == dtu_from_newint + + td_from_int = datetime.timedelta(16565) + tds_from_int = datetime.timedelta(seconds=1431216000) + td_from_newint = datetime.timedelta(newint(16565)) + tds_from_newint = datetime.timedelta(seconds=newint(1431216000)) + assert td_from_int == tds_from_int + assert td_from_int == td_from_newint + assert td_from_int == tds_from_newint + assert tds_from_int == td_from_newint + assert tds_from_int == tds_from_newint + assert td_from_newint == tds_from_newint + + td_mul_int_int = td_from_int * 2 + td_mul_int_newint = td_from_int * newint(2) + td_mul_newint_int = td_from_newint * 2 + td_mul_newint_newint = td_from_newint * newint(2) + assert td_mul_int_int == td_mul_int_newint + assert td_mul_int_int == td_mul_newint_int + assert td_mul_int_int == td_mul_newint_newint + assert td_mul_int_newint == td_mul_newint_int + assert td_mul_int_newint == td_mul_newint_newint + assert td_mul_newint_int == td_mul_newint_newint + + td_div_int_int = td_from_int / 3600 + td_div_int_newint = td_from_int / newint(3600) + td_div_newint_int = td_from_newint / 3600 + td_div_newint_newint = td_from_newint / newint(3600) + assert td_div_int_int == td_div_int_newint + assert td_div_int_int == td_div_newint_int + assert td_div_int_int == td_div_newint_newint + assert td_div_int_newint == td_div_newint_int + assert td_div_int_newint == td_div_newint_newint + assert td_div_newint_int == td_div_newint_newint + + def test_return_types(self): + td = datetime.timedelta(5) + assert type(td.total_seconds()) is float + class sub(datetime.timedelta): pass + assert type(+sub()) is datetime.timedelta + class TestDatetimeHost(BaseTestDatetime): def setup_class(cls): diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -638,9 +638,18 @@ return array.getlength() def bh_getarrayitem_gc(self, a, index, descr): - a = support.cast_arg(lltype.Ptr(descr.A), a) + assert index >= 0 + if descr.A is descr.OUTERA: + a = support.cast_arg(lltype.Ptr(descr.A), a) + else: + # we use rffi.cast instead of support.cast_arg because the types + # might not be "compatible" enough from the lltype point of + # view. In particular, this happens when we use + # str_storage_getitem, in which an rpy_string is casted to + # rpy_string_as_Signed (or similar) + a = rffi.cast(lltype.Ptr(descr.OUTERA), a) + a = getattr(a, descr.OUTERA._arrayfld) array = a._obj - assert index >= 0 return support.cast_result(descr.A.OF, array.getitem(index)) bh_getarrayitem_gc_pure_i = bh_getarrayitem_gc diff --git a/rpython/jit/backend/x86/test/test_strstorage.py b/rpython/jit/backend/x86/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/backend/x86/test/test_strstorage.py @@ -0,0 +1,8 @@ +from rpython.jit.backend.x86.test.test_basic import Jit386Mixin +from rpython.jit.metainterp.test.test_strstorage import TestStrStorage as _TestStrStorage + + +class TestStrStorage(Jit386Mixin, _TestStrStorage): + # for the individual tests see + # ====> ../../../metainterp/test/test_strstorage.py + pass diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -1008,12 +1008,11 @@ return SpaceOperation('getarrayitem_gc_i', [op.args[0], v_index, bytearraydescr], op.result) - else: + elif op.result.concretetype is lltype.Void: + return + elif isinstance(op.args[0].concretetype.TO, lltype.GcArray): + # special-case 1: GcArray of Struct v_inst, v_index, c_field = op.args - if op.result.concretetype is lltype.Void: - return - # only GcArray of Struct supported - assert isinstance(v_inst.concretetype.TO, lltype.GcArray) STRUCT = v_inst.concretetype.TO.OF assert isinstance(STRUCT, lltype.Struct) descr = self.cpu.interiorfielddescrof(v_inst.concretetype.TO, @@ -1022,6 +1021,20 @@ kind = getkind(op.result.concretetype)[0] return SpaceOperation('getinteriorfield_gc_%s' % kind, args, op.result) + elif isinstance(op.args[0].concretetype.TO, lltype.GcStruct): + # special-case 2: GcStruct with Array field + v_inst, c_field, v_index = op.args + STRUCT = v_inst.concretetype.TO + ARRAY = getattr(STRUCT, c_field.value) + assert isinstance(ARRAY, lltype.Array) + arraydescr = self.cpu.arraydescrof(STRUCT) + kind = getkind(op.result.concretetype)[0] + assert kind in ('i', 'f') + return SpaceOperation('getarrayitem_gc_%s' % kind, + [op.args[0], v_index, arraydescr], + op.result) + else: + assert False, 'not supported' def rewrite_op_setinteriorfield(self, op): assert len(op.args) == 4 @@ -1130,10 +1143,13 @@ def rewrite_op_force_cast(self, op): v_arg = op.args[0] v_result = op.result - assert not self._is_gc(v_arg) - if v_arg.concretetype == v_result.concretetype: return + elif self._is_gc(v_arg) and self._is_gc(v_result): + # cast from GC to GC is always fine + return + else: + assert not self._is_gc(v_arg) float_arg = v_arg.concretetype in [lltype.Float, lltype.SingleFloat] float_res = v_result.concretetype in [lltype.Float, lltype.SingleFloat] diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py --- a/rpython/jit/metainterp/optimizeopt/heap.py +++ b/rpython/jit/metainterp/optimizeopt/heap.py @@ -535,10 +535,16 @@ cf.do_setfield(self, op) def optimize_GETARRAYITEM_GC_I(self, op): + # When using str_storage_getitem it might happen that op.getarg(0) is + # a virtual string, NOT an array. In that case, we cannot cache the + # getarrayitem as if it were an array, obviously. In theory we could + # improve by writing special code to interpter the buffer of the + # virtual string as if it were an array, but it looks complicate, + # fragile and not worth it. arrayinfo = self.ensure_ptr_info_arg0(op) indexb = self.getintbound(op.getarg(1)) cf = None - if indexb.is_constant(): + if indexb.is_constant() and not arrayinfo.is_vstring(): index = indexb.getint() arrayinfo.getlenbound(None).make_gt_const(index) # use the cache on (arraydescr, index), which is a constant @@ -555,7 +561,7 @@ self.make_nonnull(op.getarg(0)) self.emit_operation(op) # the remember the result of reading the array item - if cf is not None: + if cf is not None and not arrayinfo.is_vstring(): arrayinfo.setitem(op.getdescr(), indexb.getint(), self.get_box_replacement(op.getarg(0)), self.get_box_replacement(op), cf, diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py --- a/rpython/jit/metainterp/optimizeopt/info.py +++ b/rpython/jit/metainterp/optimizeopt/info.py @@ -24,6 +24,9 @@ def is_virtual(self): return False + def is_vstring(self): + return False + def is_precise(self): return False diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -314,9 +314,16 @@ args, virtuals = target_virtual_state.make_inputargs_and_virtuals( args, self.optimizer) short_preamble = target_token.short_preamble - extra = self.inline_short_preamble(args + virtuals, args, - short_preamble, self.optimizer.patchguardop, - target_token, label_op) + try: + extra = self.inline_short_preamble(args + virtuals, args, + short_preamble, self.optimizer.patchguardop, + target_token, label_op) + except KeyError: + # SHOULD NOT OCCUR BUT DOES: WHY?? issue #2185 + self.optimizer.metainterp_sd.logger_ops.log_short_preamble([], + short_preamble, {}) + raise + self.send_extra_operation(jump_op.copy_and_change(rop.JUMP, args=args + extra, descr=target_token)) diff --git a/rpython/jit/metainterp/optimizeopt/virtualize.py b/rpython/jit/metainterp/optimizeopt/virtualize.py --- a/rpython/jit/metainterp/optimizeopt/virtualize.py +++ b/rpython/jit/metainterp/optimizeopt/virtualize.py @@ -271,8 +271,10 @@ self.emit_operation(op) def optimize_GETARRAYITEM_GC_I(self, op): + # When using str_storage_getitem we op.getarg(0) is a string, NOT an + # array, hence the check. In that case, it will be forced opinfo = self.getptrinfo(op.getarg(0)) - if opinfo and opinfo.is_virtual(): + if opinfo and opinfo.is_virtual() and not opinfo.is_vstring(): indexbox = self.get_constant_box(op.getarg(1)) if indexbox is not None: item = opinfo.getitem(op.getdescr(), indexbox.getint()) diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py b/rpython/jit/metainterp/optimizeopt/vstring.py --- a/rpython/jit/metainterp/optimizeopt/vstring.py +++ b/rpython/jit/metainterp/optimizeopt/vstring.py @@ -62,6 +62,9 @@ self.mode = mode self.length = length + def is_vstring(self): + return True + def getlenbound(self, mode): from rpython.jit.metainterp.optimizeopt import intutils diff --git a/rpython/jit/metainterp/test/test_strstorage.py b/rpython/jit/metainterp/test/test_strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/jit/metainterp/test/test_strstorage.py @@ -0,0 +1,53 @@ +import py +import sys +import struct +from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rlib.strstorage import str_storage_getitem +from rpython.rlib.test.test_strstorage import BaseStrStorageTest +from rpython.jit.codewriter import longlong +from rpython.jit.metainterp.history import getkind +from rpython.jit.metainterp.test.support import LLJitMixin + +class TestStrStorage(BaseStrStorageTest, LLJitMixin): + + # for the individual tests see + # ====> ../../../rlib/test/test_strstorage.py + + def str_storage_getitem(self, TYPE, buf, offset): + def f(): + return str_storage_getitem(TYPE, buf, offset) + res = self.interp_operations(f, [], supports_singlefloats=True) + # + kind = getkind(TYPE)[0] # 'i' or 'f' + self.check_operations_history({'getarrayitem_gc_%s' % kind: 1, + 'finish': 1}) + # + if TYPE == lltype.SingleFloat: + # interp_operations returns the int version of r_singlefloat, but + # our tests expects to receive an r_singlefloat: let's convert it + # back! + return longlong.int2singlefloat(res) + return res + + def str_storage_supported(self, TYPE): + py.test.skip('this is not a JIT test') + + def test_force_virtual_str_storage(self): + byteorder = sys.byteorder + size = rffi.sizeof(lltype.Signed) + def f(val): + if byteorder == 'little': + x = chr(val) + '\x00'*(size-1) + else: + x = '\x00'*(size-1) + chr(val) + return str_storage_getitem(lltype.Signed, x, 0) + res = self.interp_operations(f, [42], supports_singlefloats=True) + assert res == 42 + self.check_operations_history({ + 'newstr': 1, # str forcing + 'strsetitem': 1, # str forcing + 'call_pure_r': 1, # str forcing (copystrcontent) + 'guard_no_exception': 1, # str forcing + 'getarrayitem_gc_i': 1, # str_storage_getitem + 'finish': 1 + }) diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py --- a/rpython/rlib/buffer.py +++ b/rpython/rlib/buffer.py @@ -22,6 +22,14 @@ # May be overridden. return self.getslice(0, self.getlength(), 1, self.getlength()) + def as_str_and_offset_maybe(self): + """ + If the buffer is backed by a string, return a pair (string, offset), where + offset is the offset inside the string where the buffer start. + Else, return (None, 0). + """ + return None, 0 + def getitem(self, index): "Returns the index'th character in the buffer." raise NotImplementedError # Must be overriden. No bounds checks. @@ -66,6 +74,9 @@ def as_str(self): return self.value + def as_str_and_offset_maybe(self): + return self.value, 0 + def getitem(self, index): return self.value[index] @@ -99,6 +110,12 @@ else: return 0 + def as_str_and_offset_maybe(self): + string, offset = self.buffer.as_str_and_offset_maybe() + if string is not None: + return string, offset+self.offset + return None, 0 + def getitem(self, index): return self.buffer.getitem(self.offset + index) diff --git a/rpython/rlib/rstruct/nativefmttable.py b/rpython/rlib/rstruct/nativefmttable.py --- a/rpython/rlib/rstruct/nativefmttable.py +++ b/rpython/rlib/rstruct/nativefmttable.py @@ -8,15 +8,15 @@ from rpython.rlib.objectmodel import specialize from rpython.rlib.rarithmetic import r_singlefloat, widen from rpython.rlib.rstruct import standardfmttable as std +from rpython.rlib.rstruct.standardfmttable import native_is_bigendian from rpython.rlib.rstruct.error import StructError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.strstorage import str_storage_getitem from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.tool import rffi_platform from rpython.translator.tool.cbuild import ExternalCompilationInfo -native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) - native_fmttable = { 'x': std.standard_fmttable['x'], 'c': std.standard_fmttable['c'], @@ -27,9 +27,6 @@ # ____________________________________________________________ -double_buf = lltype.malloc(rffi.DOUBLEP.TO, 1, flavor='raw', immortal=True) -float_buf = lltype.malloc(rffi.FLOATP.TO, 1, flavor='raw', immortal=True) - range_8_unroll = unrolling_iterable(list(reversed(range(8)))) range_4_unroll = unrolling_iterable(list(reversed(range(4)))) @@ -45,14 +42,6 @@ fmtiter.result.append(chr(value & 0xff)) value >>= 8 - at specialize.argtype(0) -def unpack_double(fmtiter): - input = fmtiter.read(sizeof_double) - p = rffi.cast(rffi.CCHARP, double_buf) - for i in range(sizeof_double): - p[i] = input[i] - doubleval = double_buf[0] - fmtiter.appendobj(doubleval) def pack_float(fmtiter): doubleval = fmtiter.accept_float_arg() @@ -68,16 +57,6 @@ fmtiter.result.append(chr(value & 0xff)) value >>= 8 - at specialize.argtype(0) -def unpack_float(fmtiter): - input = fmtiter.read(sizeof_float) - p = rffi.cast(rffi.CCHARP, float_buf) - for i in range(sizeof_float): - p[i] = input[i] - floatval = float_buf[0] - doubleval = float(floatval) - fmtiter.appendobj(doubleval) - # ____________________________________________________________ # # Use rffi_platform to get the native sizes and alignments from the C compiler @@ -134,10 +113,10 @@ if fmtchar == 'f': pack = pack_float - unpack = unpack_float + unpack = std.unpack_float elif fmtchar == 'd': pack = pack_double - unpack = unpack_double + unpack = std.unpack_double elif fmtchar == '?': pack = std.pack_bool unpack = std.unpack_bool diff --git a/rpython/rlib/rstruct/runpack.py b/rpython/rlib/rstruct/runpack.py --- a/rpython/rlib/rstruct/runpack.py +++ b/rpython/rlib/rstruct/runpack.py @@ -38,6 +38,12 @@ def appendobj(self, value): self.value = value + + def get_buffer_as_string_maybe(self): + return self.mr.input, self.mr.inputpos + + def skip(self, size): + self.read(size) # XXX, could avoid taking the slice ReaderForPos.__name__ = 'ReaderForPos%d' % pos return ReaderForPos @@ -88,13 +94,6 @@ exec source.compile() in miniglobals self.unpack = miniglobals['unpack'] # override not-rpython version - def unpack(self, s): - # NOT_RPYTHON - res = unpack(self.fmt, s) - if len(res) == 1: - return res[0] - return res - def _freeze_(self): assert self.formats self._create_unpacking_func() @@ -103,6 +102,7 @@ def create_unpacker(unpack_str): fmtiter = FrozenUnpackIterator(unpack_str) fmtiter.interpret(unpack_str) + assert fmtiter._freeze_() return fmtiter create_unpacker._annspecialcase_ = 'specialize:memo' diff --git a/rpython/rlib/rstruct/standardfmttable.py b/rpython/rlib/rstruct/standardfmttable.py --- a/rpython/rlib/rstruct/standardfmttable.py +++ b/rpython/rlib/rstruct/standardfmttable.py @@ -12,7 +12,12 @@ from rpython.rlib.rstruct import ieee from rpython.rlib.rstruct.error import StructError, StructOverflowError from rpython.rlib.unroll import unrolling_iterable +from rpython.rlib.strstorage import str_storage_getitem, str_storage_supported +from rpython.rlib import rarithmetic +from rpython.rtyper.lltypesystem import rffi +native_is_bigendian = struct.pack("=i", 1) == struct.pack(">i", 1) +native_is_ieee754 = float.__getformat__('double').startswith('IEEE') def pack_pad(fmtiter, count): fmtiter.result.append_multiple_char('\x00', count) @@ -126,6 +131,24 @@ # ____________________________________________________________ +USE_FASTPATH = True # set to False by some tests +ALLOW_SLOWPATH = True # set to False by some tests + +class CannotUnpack(Exception): + pass + + at specialize.memo() +def unpack_fastpath(TYPE): + @specialize.argtype(0) + def do_unpack_fastpath(fmtiter): + size = rffi.sizeof(TYPE) + strbuf, pos = fmtiter.get_buffer_as_string_maybe() + if strbuf is None or pos % size != 0 or not USE_FASTPATH: + raise CannotUnpack + fmtiter.skip(size) + return str_storage_getitem(TYPE, strbuf, pos) + return do_unpack_fastpath + @specialize.argtype(0) def unpack_pad(fmtiter, count): fmtiter.read(count) @@ -153,15 +176,54 @@ end = count fmtiter.appendobj(data[1:end]) -def make_float_unpacker(size): +def make_ieee_unpacker(TYPE): @specialize.argtype(0) - def unpacker(fmtiter): - data = fmtiter.read(size) - fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian)) - return unpacker + def unpack_ieee(fmtiter): + size = rffi.sizeof(TYPE) + if fmtiter.bigendian != native_is_bigendian or not native_is_ieee754: + # fallback to the very slow unpacking code in ieee.py + data = fmtiter.read(size) + fmtiter.appendobj(ieee.unpack_float(data, fmtiter.bigendian)) + return + if not str_storage_supported(TYPE): + # this happens e.g. on win32 and ARM32: we cannot read the string + # content as an array of doubles because it's not properly + # aligned. But we can read a longlong and convert to float + assert TYPE == rffi.DOUBLE + assert rffi.sizeof(TYPE) == 8 + return unpack_longlong2float(fmtiter) + try: + # fast path + val = unpack_fastpath(TYPE)(fmtiter) + except CannotUnpack: + # slow path, take the slice + input = fmtiter.read(size) + val = str_storage_getitem(TYPE, input, 0) + fmtiter.appendobj(float(val)) + return unpack_ieee + + at specialize.argtype(0) +def unpack_longlong2float(fmtiter): + from rpython.rlib.rstruct.runpack import runpack + from rpython.rlib.longlong2float import longlong2float + s = fmtiter.read(8) + llval = runpack('q', s) # this is a bit recursive, I know + doubleval = longlong2float(llval) + fmtiter.appendobj(doubleval) + + +unpack_double = make_ieee_unpacker(rffi.DOUBLE) +unpack_float = make_ieee_unpacker(rffi.FLOAT) # ____________________________________________________________ +def get_rffi_int_type(size, signed): + for TYPE in rffi.platform.numbertype_to_rclass: + if (rffi.sizeof(TYPE) == size and + rarithmetic.is_signed_integer_type(TYPE) == signed): + return TYPE + raise KeyError("Cannot find an int type size=%d, signed=%d" % (size, signed)) + def make_int_unpacker(size, signed, _memo={}): try: return _memo[size, signed] @@ -180,9 +242,30 @@ else: inttype = r_ulonglong unroll_range_size = unrolling_iterable(range(size)) + TYPE = get_rffi_int_type(size, signed) + + @specialize.argtype(0) + def unpack_int_fastpath_maybe(fmtiter): + if fmtiter.bigendian != native_is_bigendian or not str_storage_supported(TYPE): + return False + try: + intvalue = unpack_fastpath(TYPE)(fmtiter) + except CannotUnpack: + return False + if not signed and size < native_int_size: + intvalue = rarithmetic.intmask(intvalue) + intvalue = inttype(intvalue) + fmtiter.appendobj(intvalue) + return True @specialize.argtype(0) def unpack_int(fmtiter): + if unpack_int_fastpath_maybe(fmtiter): + return + # slow path + if not ALLOW_SLOWPATH: + # we enter here only on some tests + raise ValueError("fastpath not taken :(") intvalue = inttype(0) s = fmtiter.read(size) idx = 0 @@ -217,9 +300,9 @@ 'p':{ 'size' : 1, 'pack' : pack_pascal, 'unpack' : unpack_pascal, 'needcount' : True }, 'f':{ 'size' : 4, 'pack' : make_float_packer(4), - 'unpack' : make_float_unpacker(4)}, + 'unpack' : unpack_float}, 'd':{ 'size' : 8, 'pack' : make_float_packer(8), - 'unpack' : make_float_unpacker(8)}, + 'unpack' : unpack_double}, '?':{ 'size' : 1, 'pack' : pack_bool, 'unpack' : unpack_bool}, } diff --git a/rpython/rlib/rstruct/test/test_runpack.py b/rpython/rlib/rstruct/test/test_runpack.py --- a/rpython/rlib/rstruct/test/test_runpack.py +++ b/rpython/rlib/rstruct/test/test_runpack.py @@ -1,5 +1,6 @@ from rpython.rtyper.test.tool import BaseRtypingTest from rpython.rlib.rstruct.runpack import runpack +from rpython.rlib.rstruct import standardfmttable from rpython.rlib.rarithmetic import LONG_BIT import struct @@ -37,3 +38,63 @@ return runpack(">d", "testtest") assert fn() == struct.unpack(">d", "testtest")[0] assert self.interpret(fn, []) == struct.unpack(">d", "testtest")[0] + + def test_native_floats(self): + """ + Check the 'd' and 'f' format characters on native packing. + """ + d_data = struct.pack("df", 12.34, 12.34) + def fn(): + d, f = runpack("@df", d_data) + return d, f + # + # direct test + d, f = fn() + assert d == 12.34 # no precision lost + assert f != 12.34 # precision lost + assert abs(f - 12.34) < 1E-6 + # + # translated test + res = self.interpret(fn, []) + d = res.item0 + f = res.item1 # convert from r_singlefloat + assert d == 12.34 # no precision lost + assert f != 12.34 # precision lost + assert abs(f - 12.34) < 1E-6 + + def test_unpack_standard_little(self): + def unpack(fmt, data): + def fn(): + return runpack(fmt, data) + return self.interpret(fn, []) + # + assert unpack("i", 'ABCD') == 0x41424344 + assert unpack(">i", '\xff\xff\xff\xfd') == -3 + assert unpack(">i", '\x80\x00\x00\x00') == -2147483648 + assert unpack(">I", '\x81BCD') == 0x81424344 + assert unpack(">q", 'ABCDEFGH') == 0x4142434445464748 + assert unpack(">q", '\xbeMLKJIHH') == -0x41B2B3B4B5B6B7B8 + assert unpack(">Q", '\x81BCDEFGH') == 0x8142434445464748 + + +class TestNoFastPath(TestRStruct): + + def setup_method(self, meth): + standardfmttable.USE_FASTPATH = False + + def teardown_method(self, meth): + standardfmttable.USE_FASTPATH = True diff --git a/rpython/rlib/strstorage.py b/rpython/rlib/strstorage.py new file mode 100644 --- /dev/null +++ b/rpython/rlib/strstorage.py @@ -0,0 +1,62 @@ +# Support for str_storage: i.e., reading primitive types out of RPython string +# +# There are various possible ways to implement it, however not all of them are +# easily supported by the JIT: +# +# 1. use _get_raw_str_buf and cast the chars buffer to RAW_STORAGE_PTR: this +# works well without the JIT, but the cast to RAW_STORAGE_PTR needs to +# happen inside a short "no GC" section (like the one in +# rstr.py:copy_string_contents), which has no chance to work during +# tracing +# +# 2. use llop.raw_load: despite the name, llop.raw_load DOES support reading +# from GC pointers. However: +# +# a. we would like to use a CompositeOffset as the offset (using the +# same logic as in rstr.py:_get_raw_str_buf), but this is not (yet) +# supported before translation: it works only if you pass an actual +# integer +# +# b. raw_load from a GC pointer is not (yet) supported by the +# JIT. There are plans to introduce a gc_load operation: when it +# will be there, we could fix the issue above and actually use it to +# implement str_storage_getitem +# +# 3. the actual solution: cast rpy_string to a GcStruct which has the very +# same layout, with the only difference that its 'chars' field is no +# longer an Array(Char) but e.e. an Array(Signed). Then, we just need to +# read the appropriate index into the array + +from rpython.rtyper.lltypesystem import lltype, rffi, llmemory +from rpython.rtyper.lltypesystem.rstr import STR, _get_raw_str_buf +from rpython.rtyper.annlowlevel import llstr +from rpython.rlib.objectmodel import specialize, we_are_translated + + at specialize.memo() +def _rpy_string_as_type(TP): From noreply at buildbot.pypy.org Wed Nov 25 11:54:19 2015 From: noreply at buildbot.pypy.org (arigo) Date: Wed, 25 Nov 2015 17:54:19 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: fix the hack with another more official-looking hack Message-ID: <20151125165419.A5C831C146D@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80962:29cd05d512d4 Date: 2015-11-25 17:54 +0100 http://bitbucket.org/pypy/pypy/changeset/29cd05d512d4/ Log: fix the hack with another more official-looking hack diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -320,7 +320,9 @@ from rpython.memory.gctransform.stmframework import get_visit_function visit_fn = get_visit_function(callback, arg) addr = obj + llmemory.offsetof(_HASHTABLE_OBJ, 'll_raw_hashtable') - llop.stm_hashtable_tracefn(lltype.Void, obj, addr.address[0], visit_fn) + ht = addr.address[0] + if ht: + llop.stm_hashtable_tracefn(lltype.Void, obj, ht, visit_fn) lambda_hashtable_trace = lambda: _ll_hashtable_trace def _ll_hashtable_finalizer(h): diff --git a/rpython/translator/stm/hashtable.py b/rpython/translator/stm/hashtable.py --- a/rpython/translator/stm/hashtable.py +++ b/rpython/translator/stm/hashtable.py @@ -18,7 +18,12 @@ for entry in hashtable._content.values(): if entry._obj: bookkeeper.immutablevalue(entry._obj) - bookkeeper.immutablevalue(lltype.nullptr(rstm._STM_HASHTABLE_ENTRY)) + # + # When we have a prebuilt hashtable but no calls to create_hashtable() + # in the final RPython program, the translation state is incomplete. + # Fix it by emulating a call to create_hashtable(). + s_create_hashtable = bookkeeper.immutablevalue(rstm.create_hashtable) + bookkeeper.emulate_pbc_call("create_hashtable", s_create_hashtable, []) # return lltype_to_annotation(lltype.Ptr(rstm._HASHTABLE_OBJ)) From noreply at buildbot.pypy.org Wed Nov 25 13:07:22 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 25 Nov 2015 19:07:22 +0100 (CET) Subject: [pypy-commit] pypy anntype2: fix translation Message-ID: <20151125180722.A3B851C145B@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80963:4189109d7b5d Date: 2015-11-25 18:07 +0000 http://bitbucket.org/pypy/pypy/changeset/4189109d7b5d/ Log: fix translation diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -2,7 +2,7 @@ from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant from rpython.annotator import specialize -from rpython.annotator.classdesc import InstanceSource, ClassDef +from rpython.annotator.classdesc import InstanceSource, ClassDesc @@ -21,10 +21,10 @@ def specialize__wrap(self, funcdesc, args_s): from pypy.interpreter.baseobjspace import W_Root - W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root) + W_Root_desc = funcdesc.bookkeeper.getdesc(W_Root) typ = args_s[1].knowntype - if isinstance(typ, ClassDef): - assert typ.issubclass(W_Root_def) + if isinstance(typ, ClassDesc): + assert typ.issubclass(W_Root_desc) typ = W_Root else: assert not issubclass(typ, W_Root) From noreply at buildbot.pypy.org Wed Nov 25 13:33:49 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Wed, 25 Nov 2015 19:33:49 +0100 (CET) Subject: [pypy-commit] pypy wrap-specialisation: Just use @specialize.argtype on space.wrap(), instead of having a complicated special case Message-ID: <20151125183349.8E7431C0337@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: wrap-specialisation Changeset: r80964:f577010b0f69 Date: 2015-11-25 18:33 +0000 http://bitbucket.org/pypy/pypy/changeset/f577010b0f69/ Log: Just use @specialize.argtype on space.wrap(), instead of having a complicated special case diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -130,6 +130,7 @@ def wrapbytes(self, x): return wrapstr(self, x) + @specialize.argtype(1) def wrap(self, x): "Wraps the Python value 'x' into one of the wrapper classes." # You might notice that this function is rather conspicuously @@ -172,7 +173,6 @@ else: return W_LongObject.fromrarith_int(x) return self._wrap_not_rpython(x) - wrap._annspecialcase_ = "specialize:wrap" def _wrap_not_rpython(self, x): "NOT_RPYTHON" diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -1,9 +1,7 @@ # overrides for annotation specific to PyPy codebase from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant -from rpython.annotator import specialize -from rpython.annotator.classdesc import InstanceSource, ClassDef - +from rpython.annotator.classdesc import InstanceSource def isidentifier(s): @@ -19,37 +17,6 @@ self.lookups_where = {} self.pypytypes = {} - def specialize__wrap(self, funcdesc, args_s): - from pypy.interpreter.baseobjspace import W_Root - W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root) - typ = args_s[1].knowntype - if isinstance(typ, ClassDef): - assert typ.issubclass(W_Root_def) - typ = W_Root - else: - assert not issubclass(typ, W_Root) - assert typ != tuple, "space.wrap(tuple) forbidden; use newtuple()" - assert typ != list, "space.wrap(list) forbidden; use newlist()" - assert typ != dict, "space.wrap(dict) forbidden; use newdict()" - assert typ != object, "degenerated space.wrap(object)" - if args_s[0].is_constant() and args_s[1].is_constant(): - if typ in (str, bool, int, float): - space = args_s[0].const - x = args_s[1].const - - def fold(): - if typ is str and isidentifier(x): - return space.new_interned_str(x) - else: - return space.wrap(x) - builder = specialize.make_constgraphbuilder(2, factory=fold, - srcmodule='') - return funcdesc.cachedgraph((typ, x), builder=builder) - if typ is str: - if args_s[1].can_be_None: - typ = (None, str) - return funcdesc.cachedgraph(typ) - def consider_lookup(self, bookkeeper, attr): assert attr not in self.lookups from pypy.objspace.std import typeobject From noreply at buildbot.pypy.org Wed Nov 25 13:48:40 2015 From: noreply at buildbot.pypy.org (fijal) Date: Wed, 25 Nov 2015 19:48:40 +0100 (CET) Subject: [pypy-commit] pypy compress-numbering: fixes + rpython fixes Message-ID: <20151125184840.898B81C02FB@cobra.cs.uni-duesseldorf.de> Author: fijal Branch: compress-numbering Changeset: r80965:46f0e27c4700 Date: 2015-11-25 20:49 +0200 http://bitbucket.org/pypy/pypy/changeset/46f0e27c4700/ Log: fixes + rpython fixes diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py --- a/rpython/jit/metainterp/compile.py +++ b/rpython/jit/metainterp/compile.py @@ -15,8 +15,9 @@ TargetToken, AbstractFailDescr, ConstInt) from rpython.jit.metainterp import history, jitexc from rpython.jit.metainterp.optimize import InvalidLoop -from rpython.jit.metainterp.resume import (NUMBERING, PENDINGFIELDSP, +from rpython.jit.metainterp.resume import (PENDINGFIELDSP, ResumeDataDirectReader, AccumInfo) +from rpython.jit.metainterp.resumecode import NUMBERING from rpython.jit.codewriter import heaptracker, longlong @@ -842,12 +843,11 @@ class ResumeGuardDescr(AbstractResumeGuardDescr): _attrs_ = ('rd_numb', 'rd_count', 'rd_consts', 'rd_virtuals', - 'rd_pendingfields', 'rd_stackdepth', 'status') + 'rd_pendingfields', 'status') rd_numb = lltype.nullptr(NUMBERING) rd_count = 0 rd_consts = None rd_virtuals = None - rd_stackdepth = 0 rd_pendingfields = lltype.nullptr(PENDINGFIELDSP.TO) def copy_all_attributes_from(self, other): @@ -858,7 +858,6 @@ self.rd_consts = other.rd_consts self.rd_pendingfields = other.rd_pendingfields self.rd_virtuals = other.rd_virtuals - self.rd_stackdepth = other.rd_stackdepth self.rd_numb = other.rd_numb # we don't copy status if other.rd_vector_info: diff --git a/rpython/jit/metainterp/resume.py b/rpython/jit/metainterp/resume.py --- a/rpython/jit/metainterp/resume.py +++ b/rpython/jit/metainterp/resume.py @@ -144,23 +144,6 @@ snapshot_storage.rd_frame_info_list = None snapshot_storage.rd_snapshot = Snapshot(None, boxes) -# -# The following is equivalent to the RPython-level declaration: -# -# class Numbering: __slots__ = ['prev', 'nums'] -# -# except that it is more compact in translated programs, because the -# array 'nums' is inlined in the single NUMBERING object. This is -# important because this is often the biggest single consumer of memory -# in a pypy-c-jit. -# -NUMBERINGP = lltype.Ptr(lltype.GcForwardReference()) -NUMBERING = lltype.GcStruct('Numbering', - ('prev', NUMBERINGP), - ('packed_jitcode_pc', lltype.Signed), - ('nums', lltype.Array(rffi.SHORT))) -NUMBERINGP.TO.become(NUMBERING) - PENDINGFIELDSTRUCT = lltype.Struct('PendingField', ('lldescr', OBJECTPTR), ('num', rffi.SHORT), @@ -345,8 +328,8 @@ frameinfo = framestack_list[i - 1] jitcode_pos, pc = unpack_uint(frameinfo.packed_jitcode_pc) state.position -= 2 - state.append(rffi.cast(rffi.USHORT, jitcode_pos)) - state.append(rffi.cast(rffi.USHORT, pc)) + state.append(rffi.cast(rffi.SHORT, jitcode_pos)) + state.append(rffi.cast(rffi.SHORT, pc)) self._number_boxes(snapshot_list[i].boxes, optimizer, state) numb = resumecode.create_numbering(state.current, @@ -496,12 +479,6 @@ snapshot = self.snapshot_storage.rd_snapshot assert snapshot is not None # is that true? # count stack depth - frame_info_list = self.snapshot_storage.rd_frame_info_list - stack_depth = 0 - while frame_info_list is not None: - frame_info_list = frame_info_list.prev - stack_depth += 1 - storage.rd_stack_depth = stack_depth numb, liveboxes_from_env, v = self.memo.number(optimizer, snapshot, self.snapshot_storage.rd_frame_info_list) self.liveboxes_from_env = liveboxes_from_env From noreply at buildbot.pypy.org Wed Nov 25 18:13:48 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 26 Nov 2015 00:13:48 +0100 (CET) Subject: [pypy-commit] pypy wrap-specialisation: fix tests Message-ID: <20151125231348.F390B1C02FB@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: wrap-specialisation Changeset: r80966:7c1d95ad2408 Date: 2015-11-25 23:13 +0000 http://bitbucket.org/pypy/pypy/changeset/7c1d95ad2408/ Log: fix tests diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -66,6 +66,7 @@ guard_not_invalidated(descr=...) p10 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i5, descr=) guard_no_exception(descr=...) + guard_nonnull(p10, descr=...) i12 = call_i(ConstClass(ll_strhash), p10, descr=) p13 = new(descr=...) p15 = new_array_clear(16, descr=) diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -135,6 +135,7 @@ guard_no_exception(descr=...) p95 = call_r(..., descr=) # ll_build guard_no_exception(descr=...) + guard_nonnull(p95, descr=...) i96 = strlen(p95) i97 = int_add_ovf(i71, i96) guard_no_overflow(descr=...) @@ -250,6 +251,7 @@ guard_not_invalidated(descr=...) p80 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i47, descr=) guard_no_exception(descr=...) + guard_nonnull(p80, descr=...) p53 = call_r(ConstClass(fast_str_decode_ascii), p80, descr=) guard_no_exception(descr=...) guard_nonnull(p53, descr=...) From noreply at buildbot.pypy.org Wed Nov 25 18:13:51 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 26 Nov 2015 00:13:51 +0100 (CET) Subject: [pypy-commit] pypy wrap-specialisation: rm unused function Message-ID: <20151125231351.0C0731C02FB@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: wrap-specialisation Changeset: r80967:e3cc7c3a5dcc Date: 2015-11-25 23:14 +0000 http://bitbucket.org/pypy/pypy/changeset/e3cc7c3a5dcc/ Log: rm unused function diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -4,13 +4,6 @@ from rpython.annotator.classdesc import InstanceSource -def isidentifier(s): - if not s: - return False - s = s.replace('_', 'x') - return s[0].isalpha() and s.isalnum() - - class PyPyAnnotatorPolicy(AnnotatorPolicy): def __init__(self): self.lookups = {} From noreply at buildbot.pypy.org Wed Nov 25 18:17:41 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 26 Nov 2015 00:17:41 +0100 (CET) Subject: [pypy-commit] pypy wrap-specialisation: close branch before merging Message-ID: <20151125231741.1BF6A1C02FB@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: wrap-specialisation Changeset: r80968:8f48911e17f8 Date: 2015-11-25 23:16 +0000 http://bitbucket.org/pypy/pypy/changeset/8f48911e17f8/ Log: close branch before merging From noreply at buildbot.pypy.org Wed Nov 25 18:17:43 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 26 Nov 2015 00:17:43 +0100 (CET) Subject: [pypy-commit] pypy default: Merge branch 'wrap-specialisation' Message-ID: <20151125231743.5C0811C02FB@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80969:3537a011647d Date: 2015-11-25 23:16 +0000 http://bitbucket.org/pypy/pypy/changeset/3537a011647d/ Log: Merge branch 'wrap-specialisation' diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -66,6 +66,7 @@ guard_not_invalidated(descr=...) p10 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i5, descr=) guard_no_exception(descr=...) + guard_nonnull(p10, descr=...) i12 = call_i(ConstClass(ll_strhash), p10, descr=) p13 = new(descr=...) p15 = new_array_clear(16, descr=) diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -135,6 +135,7 @@ guard_no_exception(descr=...) p95 = call_r(..., descr=) # ll_build guard_no_exception(descr=...) + guard_nonnull(p95, descr=...) i96 = strlen(p95) i97 = int_add_ovf(i71, i96) guard_no_overflow(descr=...) @@ -250,6 +251,7 @@ guard_not_invalidated(descr=...) p80 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i47, descr=) guard_no_exception(descr=...) + guard_nonnull(p80, descr=...) p53 = call_r(ConstClass(fast_str_decode_ascii), p80, descr=) guard_no_exception(descr=...) guard_nonnull(p53, descr=...) diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -130,6 +130,7 @@ def wrapbytes(self, x): return wrapstr(self, x) + @specialize.argtype(1) def wrap(self, x): "Wraps the Python value 'x' into one of the wrapper classes." # You might notice that this function is rather conspicuously @@ -172,7 +173,6 @@ else: return W_LongObject.fromrarith_int(x) return self._wrap_not_rpython(x) - wrap._annspecialcase_ = "specialize:wrap" def _wrap_not_rpython(self, x): "NOT_RPYTHON" diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -1,16 +1,7 @@ # overrides for annotation specific to PyPy codebase from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant -from rpython.annotator import specialize -from rpython.annotator.classdesc import InstanceSource, ClassDef - - - -def isidentifier(s): - if not s: - return False - s = s.replace('_', 'x') - return s[0].isalpha() and s.isalnum() +from rpython.annotator.classdesc import InstanceSource class PyPyAnnotatorPolicy(AnnotatorPolicy): @@ -19,37 +10,6 @@ self.lookups_where = {} self.pypytypes = {} - def specialize__wrap(self, funcdesc, args_s): - from pypy.interpreter.baseobjspace import W_Root - W_Root_def = funcdesc.bookkeeper.getuniqueclassdef(W_Root) - typ = args_s[1].knowntype - if isinstance(typ, ClassDef): - assert typ.issubclass(W_Root_def) - typ = W_Root - else: - assert not issubclass(typ, W_Root) - assert typ != tuple, "space.wrap(tuple) forbidden; use newtuple()" - assert typ != list, "space.wrap(list) forbidden; use newlist()" - assert typ != dict, "space.wrap(dict) forbidden; use newdict()" - assert typ != object, "degenerated space.wrap(object)" - if args_s[0].is_constant() and args_s[1].is_constant(): - if typ in (str, bool, int, float): - space = args_s[0].const - x = args_s[1].const - - def fold(): - if typ is str and isidentifier(x): - return space.new_interned_str(x) - else: - return space.wrap(x) - builder = specialize.make_constgraphbuilder(2, factory=fold, - srcmodule='') - return funcdesc.cachedgraph((typ, x), builder=builder) - if typ is str: - if args_s[1].can_be_None: - typ = (None, str) - return funcdesc.cachedgraph(typ) - def consider_lookup(self, bookkeeper, attr): assert attr not in self.lookups from pypy.objspace.std import typeobject From noreply at buildbot.pypy.org Wed Nov 25 18:17:45 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Thu, 26 Nov 2015 00:17:45 +0100 (CET) Subject: [pypy-commit] pypy default: document branch Message-ID: <20151125231745.6CF921C02FB@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: Changeset: r80970:d47749740488 Date: 2015-11-25 23:18 +0000 http://bitbucket.org/pypy/pypy/changeset/d47749740488/ Log: document branch diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -29,3 +29,7 @@ string buffer and directly casts the bytes to the appropriate type, when allowed. Unpacking of floats and doubles is about 15 times faster now, while for integer types it's up to ~50% faster for 64bit integers. + +.. branch: wrap-specialisation + +Remove unnecessary special handling of space.wrap(). From noreply at buildbot.pypy.org Thu Nov 26 04:52:35 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 26 Nov 2015 10:52:35 +0100 (CET) Subject: [pypy-commit] pypy.org extradoc: update the values Message-ID: <20151126095235.671611C0337@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: extradoc Changeset: r662:55806f9d8ab6 Date: 2015-11-26 10:53 +0100 http://bitbucket.org/pypy/pypy.org/changeset/55806f9d8ab6/ Log: update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -15,7 +15,7 @@ - $61398 of $105000 (58.5%) + $61412 of $105000 (58.5%)
    @@ -23,7 +23,7 @@
  • From noreply at buildbot.pypy.org Thu Nov 26 07:16:33 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 26 Nov 2015 13:16:33 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: added tests for raw_load_i/f transformation to gc_load_i/f Message-ID: <20151126121633.BB5991C0337@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80971:14b59b151355 Date: 2015-11-26 13:17 +0100 http://bitbucket.org/pypy/pypy/changeset/14b59b151355/ Log: added tests for raw_load_i/f transformation to gc_load_i/f diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -117,6 +117,8 @@ itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) ptr_box, index_box = op.getarglist() + assert itemsize <= ofs + offset = 0 factor = 1 # i * f + c @@ -147,6 +149,16 @@ ConstInt(offset), ConstInt(itemsize)]) self.replace_op_with(op, newload) + def handle_rawload(self, op): + itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) + ptr_box, index_box = op.getarglist() + + if sign: + itemsize = -itemsize + newload = ResOperation(OpHelpers.get_gc_load(op.type), + [ptr_box, index_box, ConstInt(itemsize)]) + self.replace_op_with(op, newload) + def rewrite(self, operations): # we can only remember one malloc since the next malloc can possibly # collect; but we can try to collapse several known-size mallocs into @@ -164,9 +176,13 @@ if op is self._changed_op: op = self._changed_op_to # ---------- GC_LOAD -------------- - if op.is_getarrayitem(): # TODO + if op.is_getarrayitem() or op.getopnum() in ( + rop.GETARRAYITEM_RAW_I, + rop.GETARRAYITEM_RAW_F): self.handle_getarrayitem(op) - pass + if op.getopnum() in (rop.RAW_LOAD_I, rop.RAW_LOAD_F): + self.handle_rawload(op) + # TODO # ---------- GETFIELD_GC ---------- if op.getopnum() in (rop.GETFIELD_GC_I, rop.GETFIELD_GC_F, rop.GETFIELD_GC_R): diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -1154,3 +1154,22 @@ i3 = gc_load_{suffix}(p0,{index},{params}) jump() """.format(**locals())) + + @py.test.mark.parametrize('fromto', [ + 'raw_load_i(p0,i1,descr=adescr) -> gc_load_i(p0,i1,-8)', + 'raw_load_f(p0,i1,descr=fdescr) -> gc_load_f(p0,i1,8)', + 'raw_load_i(p0,i1,descr=sfdescr) -> gc_load_i(p0,i1,4)', + ]) + def test_raw_load_rewrite(self, fromto): + for factor in [(1,), (1,2,4,8), (1,2,4), (1,4)]: + self.cpu.load_supported_factors = factor + f, t = fromto.split(' -> ') + self.check_rewrite(""" + [p0,i1] + i2 = {f} + jump() + """.format(**locals()), """ + [p0,i1] + i2 = {t} + jump() + """.format(**locals())) diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1483,9 +1483,7 @@ def _genop_gc_load(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, sign_loc = arglocs - assert isinstance(ofs, ImmedLoc) assert isinstance(size_loc, ImmedLoc) - scale = get_scale(size_loc.value) self.load_from_mem(resloc, ofs_loc, size_loc, sign_loc) genop_gc_load_i = _genop_gc_load diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1173,15 +1173,16 @@ consider_raw_load_f = _consider_getarrayitem def _consider_gc_load(self, op): - ptr, index, size, sign = op.getarglist() + args = op.getarglist() base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args) result_loc = self.force_allocate_reg(op) - if sign.value: + size = op.getarg(2).value + size_loc = imm(abs(size)) + if size < 0: sign_loc = imm1 else: sign_loc = imm0 - size_loc = imm(size.value) self.perform(op, [base_loc, ofs_loc, size_loc, sign_loc], result_loc) consider_gc_load_i = _consider_gc_load diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -401,6 +401,10 @@ rop.GETARRAYITEM_GC_PURE_F, rop.GETARRAYITEM_GC_PURE_R) + def is_rawarrayitem(self): + return self.opnum in (rop.GETARRAYITEM_RAW_I, rop.GETARRAYITEM_RAW_F, + rop.GETARRAYITEM_RAW_R, rop.GETARRAYITEM_GC_PURE_I,) + def is_real_call(self): opnum = self.opnum return (opnum == rop.CALL_I or From noreply at buildbot.pypy.org Thu Nov 26 07:55:35 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 26 Nov 2015 13:55:35 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: raw_load_test passed with gc_load on x86 Message-ID: <20151126125535.7DD621C11DD@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80972:629e7e112a13 Date: 2015-11-26 13:55 +0100 http://bitbucket.org/pypy/pypy/changeset/629e7e112a13/ Log: raw_load_test passed with gc_load on x86 diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1484,7 +1484,8 @@ def _genop_gc_load(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, sign_loc = arglocs assert isinstance(size_loc, ImmedLoc) - self.load_from_mem(resloc, ofs_loc, size_loc, sign_loc) + src_addr = addr_add(base_loc, ofs_loc, 0, 0) + self.load_from_mem(resloc, src_addr, size_loc, sign_loc) genop_gc_load_i = _genop_gc_load genop_gc_load_r = _genop_gc_load From noreply at buildbot.pypy.org Thu Nov 26 09:07:51 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 26 Nov 2015 15:07:51 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: added gc_load_indexed scaled to the assembler Message-ID: <20151126140751.D62251C2287@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80973:b3214e1778f7 Date: 2015-11-26 14:36 +0100 http://bitbucket.org/pypy/pypy/changeset/b3214e1778f7/ Log: added gc_load_indexed scaled to the assembler diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -116,47 +116,36 @@ def handle_getarrayitem(self, op): itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) ptr_box, index_box = op.getarglist() - - assert itemsize <= ofs - - offset = 0 - factor = 1 - # i * f + c - if itemsize in self.cpu.load_supported_factors: - factor = itemsize - else: - index_box = ResOperation(rop.INT_MUL, [index_box, ConstInt(itemsize)]) - self.emit_op(index_box) - # adjust the constant offset - if self.cpu.load_constant_offset: - offset = 0 - else: - offset = 0 - pass - # ofs is NOT the offset! - #index_box = ResOperation(rop.INT_ADD, [index_box, ConstInt(ofs)]) - #self.emit_op(index_box) - - if sign: - itemsize = -itemsize - if factor == 1 and offset == 0: - newload = ResOperation(OpHelpers.get_gc_load(op.type), - [ptr_box, index_box, ConstInt(itemsize)]) - self.replace_op_with(op, newload) - else: - newload = ResOperation(OpHelpers.get_gc_load_indexed(op.type), - [ptr_box, index_box, ConstInt(factor), - ConstInt(offset), ConstInt(itemsize)]) - self.replace_op_with(op, newload) + self.emit_gc_load_or_indexed(op, ptr_box, index_box, itemsize, itemsize, ofs, sign) def handle_rawload(self, op): itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) ptr_box, index_box = op.getarglist() + self.emit_gc_load_or_indexed(op, ptr_box, index_box, itemsize, 1, ofs, sign) + def emit_gc_load_or_indexed(self, op, ptr_box, index_box, itemsize, factor, offset, sign): + # factor + if factor != 1 and factor not in self.cpu.load_supported_factors: + index_box = ResOperation(rop.INT_MUL, [index_box, ConstInt(factor)]) + self.emit_op(index_box) + factor = 0 + # adjust the constant offset + if offset != 0 and not self.cpu.load_constant_offset: + index_box = ResOperation(rop.INT_ADD, [index_box, ConstInt(offset)]) + self.emit_op(index_box) + offset = 0 + # if sign: + # encode signed into the itemsize value itemsize = -itemsize - newload = ResOperation(OpHelpers.get_gc_load(op.type), - [ptr_box, index_box, ConstInt(itemsize)]) + # + if factor == 1 and offset == 0: + args = [ptr_box, index_box, ConstInt(itemsize)] + newload = ResOperation(OpHelpers.get_gc_load(op.type), args) + else: + args = [ptr_box, index_box, ConstInt(factor), + ConstInt(offset), ConstInt(itemsize)] + newload = ResOperation(OpHelpers.get_gc_load_indexed(op.type), args) self.replace_op_with(op, newload) def rewrite(self, operations): diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1491,6 +1491,17 @@ genop_gc_load_r = _genop_gc_load genop_gc_load_f = _genop_gc_load + def _genop_gc_load_indexed(self, op, arglocs, resloc): + base_loc, ofs_loc, scale_loc, offset_loc, size_loc, sign_loc = arglocs + assert isinstance(size_loc, ImmedLoc) + scale = get_scale(size_loc.value) + src_addr = addr_add(base_loc, ofs_loc, offset_loc.value, scale) + self.load_from_mem(resloc, src_addr, size_loc, sign_loc) + + genop_gc_load_indexed_i = _genop_gc_load_indexed + genop_gc_load_indexed_r = _genop_gc_load_indexed + genop_gc_load_indexed_f = _genop_gc_load_indexed + def _genop_getarrayitem(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, ofs, sign_loc = arglocs assert isinstance(ofs, ImmedLoc) diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1183,12 +1183,35 @@ sign_loc = imm1 else: sign_loc = imm0 + print("GC_LOAD execute", base_loc, "+", ofs_loc, "scale", scale, "offset", offset) self.perform(op, [base_loc, ofs_loc, size_loc, sign_loc], result_loc) consider_gc_load_i = _consider_gc_load consider_gc_load_r = _consider_gc_load consider_gc_load_f = _consider_gc_load + def _consider_gc_load_indexed(self, op): + args = op.getarglist() + base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) + ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args) + result_loc = self.force_allocate_reg(op) + scale = op.getarg(2).value + offset = op.getarg(3).value + size = op.getarg(4).value + size_loc = imm(abs(size)) + print("GC_LOAD_INDEXED execute", base_loc, "+", ofs_loc, "scale", scale, "offset", offset) + if size < 0: + sign_loc = imm1 + else: + sign_loc = imm0 + locs = [base_loc, ofs_loc, imm(scale), imm(offset), size_loc, sign_loc] + self.perform(op, locs, result_loc) + + consider_gc_load_indexed_i = _consider_gc_load_indexed + consider_gc_load_indexed_r = _consider_gc_load_indexed + consider_gc_load_indexed_f = _consider_gc_load_indexed + + def _consider_getinteriorfield(self, op): t = unpack_interiorfielddescr(op.getdescr()) ofs, itemsize, fieldsize, sign = imm(t[0]), imm(t[1]), imm(t[2]), t[3] diff --git a/rpython/jit/backend/x86/runner.py b/rpython/jit/backend/x86/runner.py --- a/rpython/jit/backend/x86/runner.py +++ b/rpython/jit/backend/x86/runner.py @@ -25,9 +25,9 @@ frame_reg = regloc.ebp # can an ISA instruction handle a constant offset? - load_constant_offset = False + load_constant_offset = True # can an ISA instruction handle a factor to the offset? - load_supported_factors = (1,) + load_supported_factors = (1,2,4,8) from rpython.jit.backend.x86.arch import JITFRAME_FIXED_SIZE all_reg_indexes = gpr_reg_mgr_cls.all_reg_indexes diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -1103,8 +1103,18 @@ # '_ALWAYS_PURE_LAST', # ----- end of always_pure operations ----- + # parameters GC_LOAD + # 1: pointer to complex object + # 2: integer describing the offset + # 3: constant integer. byte size of datatype to load (negative if it is signed) 'GC_LOAD/3/rfi', - 'GC_LOAD_INDEXED/4/rfi', + # parameters GC_LOAD_INDEXED + # 1: pointer to complex object + # 2: integer describing the offset + # 3: constant integer scale factor + # 4: constant integer offset + # 5: constant integer. byte size of datatype to load (negative if it is signed) + 'GC_LOAD_INDEXED/5/rfi', '_RAW_LOAD_FIRST', 'GETARRAYITEM_GC/2d/rfi', From noreply at buildbot.pypy.org Thu Nov 26 09:07:54 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Thu, 26 Nov 2015 15:07:54 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: added gc_store/gc_store_indexed as operation, started migration of setarrayitem in the backend to the new operations (also added the rewrite logic) Message-ID: <20151126140754.00AA81C2288@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80974:2b979e24b5a8 Date: 2015-11-26 15:07 +0100 http://bitbucket.org/pypy/pypy/changeset/2b979e24b5a8/ Log: added gc_store/gc_store_indexed as operation, started migration of setarrayitem in the backend to the new operations (also added the rewrite logic) diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -113,6 +113,24 @@ assert not op.get_forwarded() op.set_forwarded(newop) + def handle_setarrayitem(self, op): + itemsize, ofs, _ = unpack_arraydescr(op.getdescr()) + args = op.getarglist() + base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) + if itemsize == 1: + need_lower_byte = True + else: + need_lower_byte = False + value_loc = self.make_sure_var_in_reg(op.getarg(2), args, + need_lower_byte=need_lower_byte) + ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args) + self.perform_discard(op, [base_loc, ofs_loc, value_loc, + imm(itemsize), imm(ofs)]) + + def emit_gc_store_or_indexed(self, op, ptr_box, index_box, itemsize, factor, offset, sign): + self._emit_mul_add_if_factor_offset_not_supported(factor, offset) + # + def handle_getarrayitem(self, op): itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) ptr_box, index_box = op.getarglist() @@ -123,7 +141,7 @@ ptr_box, index_box = op.getarglist() self.emit_gc_load_or_indexed(op, ptr_box, index_box, itemsize, 1, ofs, sign) - def emit_gc_load_or_indexed(self, op, ptr_box, index_box, itemsize, factor, offset, sign): + def _emit_mul_add_if_factor_offset_not_supported(self, factor, offset): # factor if factor != 1 and factor not in self.cpu.load_supported_factors: index_box = ResOperation(rop.INT_MUL, [index_box, ConstInt(factor)]) @@ -134,6 +152,9 @@ index_box = ResOperation(rop.INT_ADD, [index_box, ConstInt(offset)]) self.emit_op(index_box) offset = 0 + + def emit_gc_load_or_indexed(self, op, ptr_box, index_box, itemsize, factor, offset, sign): + self._emit_mul_add_if_factor_offset_not_supported(factor, offset) # if sign: # encode signed into the itemsize value @@ -165,10 +186,14 @@ if op is self._changed_op: op = self._changed_op_to # ---------- GC_LOAD -------------- - if op.is_getarrayitem() or op.getopnum() in ( - rop.GETARRAYITEM_RAW_I, - rop.GETARRAYITEM_RAW_F): + if op.is_getarrayitem() or \ + op.getopnum() in (rop.GETARRAYITEM_RAW_I, + rop.GETARRAYITEM_RAW_F, + rop.GETARRAYITEM_RAW_R): self.handle_getarrayitem(op) + if op.getopnum() in (rop.SETARRAYITEM_GC, rop.SETARRAYITEM_RAW, + rop.RAW_STORE_I, rop.RAW_STORE_F): + self.handle_setarrayitem(op) if op.getopnum() in (rop.RAW_LOAD_I, rop.RAW_LOAD_F): self.handle_rawload(op) # TODO diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1502,31 +1502,6 @@ genop_gc_load_indexed_r = _genop_gc_load_indexed genop_gc_load_indexed_f = _genop_gc_load_indexed - def _genop_getarrayitem(self, op, arglocs, resloc): - base_loc, ofs_loc, size_loc, ofs, sign_loc = arglocs - assert isinstance(ofs, ImmedLoc) - assert isinstance(size_loc, ImmedLoc) - scale = get_scale(size_loc.value) - src_addr = addr_add(base_loc, ofs_loc, ofs.value, scale) - self.load_from_mem(resloc, src_addr, size_loc, sign_loc) - - genop_getarrayitem_gc_i = _genop_getarrayitem - genop_getarrayitem_gc_r = _genop_getarrayitem - genop_getarrayitem_gc_f = _genop_getarrayitem - genop_getarrayitem_gc_pure_i = _genop_getarrayitem - genop_getarrayitem_gc_pure_r = _genop_getarrayitem - genop_getarrayitem_gc_pure_f = _genop_getarrayitem - genop_getarrayitem_raw_i = _genop_getarrayitem - genop_getarrayitem_raw_f = _genop_getarrayitem - - def _genop_raw_load(self, op, arglocs, resloc): - base_loc, ofs_loc, size_loc, ofs, sign_loc = arglocs - assert isinstance(ofs, ImmedLoc) - src_addr = addr_add(base_loc, ofs_loc, ofs.value, 0) - self.load_from_mem(resloc, src_addr, size_loc, sign_loc) - genop_raw_load_i = _genop_raw_load - genop_raw_load_f = _genop_raw_load - def _imul_const_scaled(self, mc, targetreg, sourcereg, itemsize): """Produce one operation to do roughly targetreg = sourcereg * itemsize diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1105,11 +1105,12 @@ consider_unicodesetitem = consider_strsetitem - def consider_setarrayitem_gc(self, op): + def consider_gc_store(self, op): itemsize, ofs, _ = unpack_arraydescr(op.getdescr()) args = op.getarglist() base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) - if itemsize == 1: + itemsize = abs(size) + if size < 0: need_lower_byte = True else: need_lower_byte = False @@ -1183,7 +1184,6 @@ sign_loc = imm1 else: sign_loc = imm0 - print("GC_LOAD execute", base_loc, "+", ofs_loc, "scale", scale, "offset", offset) self.perform(op, [base_loc, ofs_loc, size_loc, sign_loc], result_loc) consider_gc_load_i = _consider_gc_load @@ -1199,7 +1199,6 @@ offset = op.getarg(3).value size = op.getarg(4).value size_loc = imm(abs(size)) - print("GC_LOAD_INDEXED execute", base_loc, "+", ofs_loc, "scale", scale, "offset", offset) if size < 0: sign_loc = imm1 else: diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -401,10 +401,6 @@ rop.GETARRAYITEM_GC_PURE_F, rop.GETARRAYITEM_GC_PURE_R) - def is_rawarrayitem(self): - return self.opnum in (rop.GETARRAYITEM_RAW_I, rop.GETARRAYITEM_RAW_F, - rop.GETARRAYITEM_RAW_R, rop.GETARRAYITEM_GC_PURE_I,) - def is_real_call(self): opnum = self.opnum return (opnum == rop.CALL_I or @@ -1142,6 +1138,10 @@ # must be forced, however we need to execute it anyway '_NOSIDEEFFECT_LAST', # ----- end of no_side_effect operations ----- + # same paramters as GC_LOAD, but one additional for the value to store + 'GC_STORE/5d/n', + 'GC_STORE_INDEXED/6d/n', + 'INCREMENT_DEBUG_COUNTER/1/n', '_RAW_STORE_FIRST', 'SETARRAYITEM_GC/3d/n', From noreply at buildbot.pypy.org Thu Nov 26 10:26:37 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 26 Nov 2015 16:26:37 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: wip: implement generic forward data flow analysis Message-ID: <20151126152637.9EF581C0400@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80975:3df49e2a17bd Date: 2015-11-26 12:44 +0100 http://bitbucket.org/pypy/pypy/changeset/3df49e2a17bd/ Log: wip: implement generic forward data flow analysis First requires some uses to determine if it is generic and convenient enough diff --git a/rpython/translator/backendopt/dataflow.py b/rpython/translator/backendopt/dataflow.py new file mode 100644 --- /dev/null +++ b/rpython/translator/backendopt/dataflow.py @@ -0,0 +1,88 @@ +from rpython.flowspace.model import mkentrymap + + + +class AbstractDataFlowAnalysis(object): + + def transfer_function(self, block, in_state): + """Returns a new out_state after flowing the 'in_state' + through 'block'""" + raise NotImplementedError("abstract base class") + + def entry_state(self, block): + """Returns the initial state for the 'block' with which + the analysis starts. + Forward: start block + Backwards: return block""" + raise NotImplementedError("abstract base class") + + def initialize_block(self, block): + """Return the (default) in_state, out_state for 'block' + used to initialize all blocks before starting the analysis""" + raise NotImplementedError("abstract base class") + + def join_operation(self, preds_outs, inputargs, pred_out_args): + """Joins all preds_outs to generate a new in_state for the + current block. + 'inputargs' is the list of input arguments to the block; + 'pred_out_args' is a list of lists of arguments given to + the link by a certain predecessor. + """ + raise NotImplementedError("abstract base class") + + def calculate(self, graph, entrymap=None): + """Run the analysis on 'graph' and return the in and + out states as two {block:state} dicts""" + raise NotImplementedError("abstract base class") + + + + + +class AbstractForwardDataFlowAnalysis(AbstractDataFlowAnalysis): + + def _update_successor_blocks(self, block, out_state, entrymap, + in_states, out_states): + if out_states[block] == out_state: + return set() + out_states[block] = out_state + # + # update all successors + to_do = set() + for link in block.exits: + succ = link.target + # collect all out_states of predecessors: + preds_outs = [] + inputargs = succ.inputargs + preds_out_args = [[] for _ in inputargs] + for link in entrymap[succ]: + preds_outs.append(out_states[link.prevblock]) + for i in range(len(inputargs)): + preds_out_args[i].append(link.args[i]) + block_in = self.join_operation(preds_outs, inputargs, preds_out_args) + if block_in != in_states[succ]: + # in_state changed + to_do.add(succ) + in_states[succ] = block_in + return to_do + + + def calculate(self, graph, entrymap=None): + if entrymap is None: + entrymap = mkentrymap(graph) + in_states = {} + out_states = {} + # + for block in graph.iterblocks(): + in_states[block], out_states[block] = self.initialize_block(block) + in_states[graph.startblock] = self.entry_state(graph.startblock) + # + # iterate: + pending = {graph.startblock,} + while pending: + block = pending.pop() + block_out = self.transfer_function(block, in_states[block]) + pending |= self._update_successor_blocks( + block, block_out, entrymap, in_states, out_states) + # + return in_states, out_states diff --git a/rpython/translator/backendopt/test/test_dataflow.py b/rpython/translator/backendopt/test/test_dataflow.py new file mode 100644 --- /dev/null +++ b/rpython/translator/backendopt/test/test_dataflow.py @@ -0,0 +1,65 @@ +import random +from rpython.tool.algo.unionfind import UnionFind +from rpython.translator.backendopt.dataflow import AbstractForwardDataFlowAnalysis + + + +from rpython.translator.translator import TranslationContext, graphof + + +class SimpleForwardAnalysis(AbstractForwardDataFlowAnalysis): + def __init__(self): + self.seen = set() + + def transfer_function(self, block, in_state): + self.seen.add(block) + return in_state + + def entry_state(self, block): + return True + + def initialize_block(self, block): + return False, False + + def join_operation(self, preds_outs, inputargs, pred_out_args): + return any(preds_outs) + + +def test_simple_forward_flow(): + def f(x): + if x < 0: + if x == -1: + return x+1 + else: + return x+2 + else: + if x == 1: + return x-1 + else: + return x-2 + t = TranslationContext() + g = t.buildflowgraph(f) + sfa = SimpleForwardAnalysis() + ins, outs = sfa.calculate(g) + assert len(sfa.seen) == 8 + assert ins[g.startblock] == sfa.entry_state(None) + assert outs[g.returnblock] == sfa.entry_state(None) + +def test_loopy_forward_flow(): + def f(x): + if x < 0: + while x: + pass + return x + else: + while x: + if x-1: + return x + t = TranslationContext() + g = t.buildflowgraph(f) + sfa = SimpleForwardAnalysis() + ins, outs = sfa.calculate(g) + g.show() + assert len(sfa.seen) == 5 + assert ins[g.startblock] == sfa.entry_state(None) + assert outs[g.returnblock] == sfa.entry_state(None) From noreply at buildbot.pypy.org Thu Nov 26 10:26:39 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 26 Nov 2015 16:26:39 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: do less work for updating in_states Message-ID: <20151126152639.C60B31C11DD@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80976:a82a851ede45 Date: 2015-11-26 15:03 +0100 http://bitbucket.org/pypy/pypy/changeset/a82a851ede45/ Log: do less work for updating in_states diff --git a/rpython/translator/backendopt/dataflow.py b/rpython/translator/backendopt/dataflow.py --- a/rpython/translator/backendopt/dataflow.py +++ b/rpython/translator/backendopt/dataflow.py @@ -18,7 +18,7 @@ def initialize_block(self, block): """Return the (default) in_state, out_state for 'block' - used to initialize all blocks before starting the analysis""" + used to initialize all blocks before starting the analysis.""" raise NotImplementedError("abstract base class") def join_operation(self, preds_outs, inputargs, pred_out_args): @@ -47,24 +47,30 @@ return set() out_states[block] = out_state # - # update all successors - to_do = set() - for link in block.exits: - succ = link.target - # collect all out_states of predecessors: - preds_outs = [] - inputargs = succ.inputargs - preds_out_args = [[] for _ in inputargs] - for link in entrymap[succ]: - preds_outs.append(out_states[link.prevblock]) - for i in range(len(inputargs)): - preds_out_args[i].append(link.args[i]) - block_in = self.join_operation(preds_outs, inputargs, preds_out_args) - if block_in != in_states[succ]: - # in_state changed - to_do.add(succ) - in_states[succ] = block_in - return to_do + # add all successors + return {link.target for link in block.exits} + + def _update_in_state_of(self, block, entrymap, in_states, out_states): + # collect all out_states of predecessors: + preds_outs = [] + inputargs = block.inputargs + preds_out_args = [[] for _ in inputargs] + for link in entrymap[block]: + pred = link.prevblock + if pred is None: + # block == startblock + return True + preds_outs.append(out_states[pred]) + for i in range(len(inputargs)): + preds_out_args[i].append(link.args[i]) + # join predecessor out_states for updated in_state: + block_in = self.join_operation(preds_outs, inputargs, preds_out_args) + if block_in != in_states[block]: + # in_state changed + in_states[block] = block_in + return True + return False + def calculate(self, graph, entrymap=None): @@ -81,8 +87,10 @@ pending = {graph.startblock,} while pending: block = pending.pop() - block_out = self.transfer_function(block, in_states[block]) - pending |= self._update_successor_blocks( - block, block_out, entrymap, in_states, out_states) + if self._update_in_state_of(block, entrymap, in_states, out_states): + block_out = self.transfer_function(block, in_states[block]) + if block_out != out_states[block]: + out_states[block] = block_out + pending |= {link.target for link in block.exits} # return in_states, out_states diff --git a/rpython/translator/backendopt/test/test_dataflow.py b/rpython/translator/backendopt/test/test_dataflow.py --- a/rpython/translator/backendopt/test/test_dataflow.py +++ b/rpython/translator/backendopt/test/test_dataflow.py @@ -59,7 +59,6 @@ g = t.buildflowgraph(f) sfa = SimpleForwardAnalysis() ins, outs = sfa.calculate(g) - g.show() assert len(sfa.seen) == 5 assert ins[g.startblock] == sfa.entry_state(None) assert outs[g.returnblock] == sfa.entry_state(None) From noreply at buildbot.pypy.org Thu Nov 26 10:26:41 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Thu, 26 Nov 2015 16:26:41 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: fixes to dataflow.py and use in gctransform.framework Message-ID: <20151126152641.DE5701C12CA@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80977:fce7bdeba033 Date: 2015-11-26 16:19 +0100 http://bitbucket.org/pypy/pypy/changeset/fce7bdeba033/ Log: fixes to dataflow.py and use in gctransform.framework diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -13,6 +13,7 @@ from rpython.memory.gctypelayout import ll_weakref_deref, WEAKREF, WEAKREFPTR from rpython.tool.sourcetools import func_with_new_name from rpython.translator.backendopt import graphanalyze +from rpython.translator.backendopt.dataflow import AbstractForwardDataFlowAnalysis from rpython.translator.backendopt.finalizer import FinalizerAnalyzer from rpython.translator.backendopt.support import var_needsgc import types @@ -53,7 +54,8 @@ LL_OPERATIONS[op.opname].canmallocgc) -class WriteBarrierCollector(object): + +class WriteBarrierCollector(AbstractForwardDataFlowAnalysis): """ This class implements a forward data flow analysis to find all set/write-operations in the graph that do *not* require a @@ -65,18 +67,38 @@ self.graph = graph self.collect_analyzer = collect_analyzer self.clean_ops = set() - self._in_states = {} # block->state of each inputarg - self._out_states = {} # block->writable dict self.in_stm_ignored = False - def _merge_out_states(self, out_states): - assert out_states - # True: writeable or fresh, otherwise False - result = [True] * len(out_states[0]) - for outset in out_states: - for i, state in enumerate(outset): - result[i] = result[i] and state - return result + def entry_state(self, block): + assert block is self.graph.startblock + return {} # no variable writeable + + def initialize_block(self, block): + # the initial out_state of a block is that + # all variables are "writable". This is the + # "neutral element" for the join_operation + out_state = set() + for link in block.exits: + for arg in link.args: + out_state.add(arg) + # + # in_state will be newly calculated in forward analysis + return out_state + + def join_operation(self, preds_outs, inputargs, pred_out_args): + # collect the (renamed) variables / inputargs that are + # writeable coming from all predecessors. + result = set(inputargs) + for i, iarg in enumerate(inputargs): + # for input arg, go through all predecessor out_sets + # and see if the renamed arg was writable there: + for pidx, pouts in enumerate(preds_outs): + name_in_pred = pred_out_args[i][pidx] + if name_in_pred not in pouts: + # was not writable in pred[pidx] + result.remove(iarg) + break + return frozenset(result) def _set_into_gc_array_part(self, op): if op.opname == 'setarrayitem': @@ -87,24 +109,19 @@ return v return None - def _flow_through_block(self, block): - # get all out_state of predecessors and recalculate - # the in_state of our block (except for startblock) - insets = self._in_states - # - # get input variables and their states: - assert len(insets[block]) == len(block.inputargs) - writeable = {} - for v, state in zip(block.inputargs, insets[block]): - writeable[v] = state + def transfer_function(self, block, in_state): + # the set of variables that are writable at the + # start of 'block': + writeable = set(in_state) # # flow through block and inspect operations that # need a write barrier, and those that create new # objects - for i, op in enumerate(block.operations): + print writeable, block.operations + for op in block.operations: if self.collect_analyzer.analyze(op): # incl. malloc, obviously # clear all writeable status - writeable = {} + writeable = set() # if op.opname == "stm_ignored_start": assert not self.in_stm_ignored @@ -114,7 +131,7 @@ self.in_stm_ignored = False elif op.opname == "gc_writebarrier": assert not self.in_stm_ignored - writeable[op.args[0]] = True + writeable.add(op.args[0]) elif op.opname == "malloc": rtti = get_rtti(op.args[0].value) if rtti is not None and hasattr(rtti._obj, 'destructor_funcptr'): @@ -123,10 +140,11 @@ assert op not in self.clean_ops else: # freshly allocated object - writeable[op.result] = True + writeable.add(op.result) # elif op.opname in ("cast_pointer", "same_as"): - writeable[op.result] = writeable.get(op.args[0], False) + if op.args[0] in writeable: + writeable.add(op.result) # elif op.opname in ('setfield', 'setarrayitem', 'setinteriorfield', 'raw_store'): # generic_set case @@ -148,7 +166,7 @@ self.clean_ops.add(op) else: # we need a (partial) write barrier if arg0 is not writeable - if writeable.get(op.args[0], False): + if op.args[0] in writeable: self.clean_ops.add(op) elif op in self.clean_ops: self.clean_ops.remove(op) @@ -156,42 +174,16 @@ if self._set_into_gc_array_part(op) is None: # this will do a full write barrier, not card marking # arg0 is always writeable afterwards - writeable[op.args[0]] = True + writeable.add(op.args[0]) # - # update in_states of all successors - to_do = set() - for link in block.exits: - succ = link.target - outset = [writeable.get(v, False) for v in link.args] - if succ in insets: - old = insets[succ] - new = self._merge_out_states([old, outset]) - if new != old: - to_do.add(succ) - insets[succ] = new - else: - # block not processed yet - insets[succ] = outset - to_do.add(succ) - return to_do + return frozenset(writeable) def collect(self): assert not self.clean_ops assert not self.in_stm_ignored - # we implement a forward-flow analysis that determines the - # operations that do NOT need a write barrier - graph = self.graph - # - # initialize blocks - self._in_states = {graph.startblock: [False] * len(graph.startblock.inputargs)} - # - # fixpoint iteration - # XXX: reverse postorder traversal - pending = {graph.startblock,} - while pending: - block = pending.pop() - pending |= self._flow_through_block(block) + self.calculate(self.graph) + diff --git a/rpython/translator/backendopt/dataflow.py b/rpython/translator/backendopt/dataflow.py --- a/rpython/translator/backendopt/dataflow.py +++ b/rpython/translator/backendopt/dataflow.py @@ -1,5 +1,5 @@ from rpython.flowspace.model import mkentrymap - +import collections class AbstractDataFlowAnalysis(object): @@ -17,16 +17,16 @@ raise NotImplementedError("abstract base class") def initialize_block(self, block): - """Return the (default) in_state, out_state for 'block' - used to initialize all blocks before starting the analysis.""" + """Return the (default) out_state for 'block' used to + initialize all blocks before starting the analysis.""" raise NotImplementedError("abstract base class") def join_operation(self, preds_outs, inputargs, pred_out_args): """Joins all preds_outs to generate a new in_state for the current block. - 'inputargs' is the list of input arguments to the block; + 'inputargs' is the list of input arguments to the block 'pred_out_args' is a list of lists of arguments given to - the link by a certain predecessor. + the link by a certain predecessor - one list per inputarg. """ raise NotImplementedError("abstract base class") @@ -59,13 +59,15 @@ pred = link.prevblock if pred is None: # block == startblock + in_states[block] = self.entry_state(block) return True preds_outs.append(out_states[pred]) for i in range(len(inputargs)): preds_out_args[i].append(link.args[i]) # join predecessor out_states for updated in_state: block_in = self.join_operation(preds_outs, inputargs, preds_out_args) - if block_in != in_states[block]: + # + if block not in in_states or block_in != in_states[block]: # in_state changed in_states[block] = block_in return True @@ -79,18 +81,24 @@ in_states = {} out_states = {} # - for block in graph.iterblocks(): - in_states[block], out_states[block] = self.initialize_block(block) - in_states[graph.startblock] = self.entry_state(graph.startblock) + blocks = set(graph.iterblocks()) + for block in blocks: + out_states[block] = self.initialize_block(block) + # # iterate: - pending = {graph.startblock,} + # todo: ordered set? reverse post-order? + blocks.remove(graph.startblock) + pending = collections.deque(blocks) + pending.append(graph.startblock) while pending: block = pending.pop() if self._update_in_state_of(block, entrymap, in_states, out_states): block_out = self.transfer_function(block, in_states[block]) if block_out != out_states[block]: out_states[block] = block_out - pending |= {link.target for link in block.exits} + for link in block.exits: + if link.target not in pending: + pending.appendleft(link.target) # return in_states, out_states diff --git a/rpython/translator/backendopt/test/test_dataflow.py b/rpython/translator/backendopt/test/test_dataflow.py --- a/rpython/translator/backendopt/test/test_dataflow.py +++ b/rpython/translator/backendopt/test/test_dataflow.py @@ -2,7 +2,7 @@ from rpython.tool.algo.unionfind import UnionFind from rpython.translator.backendopt.dataflow import AbstractForwardDataFlowAnalysis - +import pytest from rpython.translator.translator import TranslationContext, graphof @@ -19,13 +19,31 @@ return True def initialize_block(self, block): - return False, False + return False def join_operation(self, preds_outs, inputargs, pred_out_args): return any(preds_outs) +class NotSimpleForwardAnalysis(AbstractForwardDataFlowAnalysis): + def __init__(self): + self.seen = set() -def test_simple_forward_flow(): + def transfer_function(self, block, in_state): + self.seen.add(block) + return in_state + + def entry_state(self, block): + return False + + def initialize_block(self, block): + return True + + def join_operation(self, preds_outs, inputargs, pred_out_args): + return all(preds_outs) + + + at pytest.mark.parametrize("flow", [SimpleForwardAnalysis, NotSimpleForwardAnalysis]) +def test_simple_forward_flow(flow): def f(x): if x < 0: if x == -1: @@ -39,13 +57,14 @@ return x-2 t = TranslationContext() g = t.buildflowgraph(f) - sfa = SimpleForwardAnalysis() + sfa = flow() ins, outs = sfa.calculate(g) assert len(sfa.seen) == 8 assert ins[g.startblock] == sfa.entry_state(None) assert outs[g.returnblock] == sfa.entry_state(None) -def test_loopy_forward_flow(): + at pytest.mark.parametrize("flow", [SimpleForwardAnalysis, NotSimpleForwardAnalysis]) +def test_loopy_forward_flow(flow): def f(x): if x < 0: while x: @@ -57,7 +76,7 @@ return x t = TranslationContext() g = t.buildflowgraph(f) - sfa = SimpleForwardAnalysis() + sfa = flow() ins, outs = sfa.calculate(g) assert len(sfa.seen) == 5 assert ins[g.startblock] == sfa.entry_state(None) From noreply at buildbot.pypy.org Thu Nov 26 11:32:11 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 26 Nov 2015 17:32:11 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: Change cast_instance_to_gcref() to erase()/unerase(), which is better for the purpose Message-ID: <20151126163211.698DD1C12CA@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80978:de0731edb16f Date: 2015-11-26 16:33 +0000 http://bitbucket.org/pypy/pypy/changeset/de0731edb16f/ Log: Change cast_instance_to_gcref() to erase()/unerase(), which is better for the purpose diff --git a/pypy/module/pypystm/hashtable.py b/pypy/module/pypystm/hashtable.py --- a/pypy/module/pypystm/hashtable.py +++ b/pypy/module/pypystm/hashtable.py @@ -7,10 +7,10 @@ from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault -from rpython.rlib import rstm +from rpython.rlib import rstm, rerased from rpython.rlib.rarithmetic import intmask -from rpython.rtyper.annlowlevel import cast_gcref_to_instance -from rpython.rtyper.annlowlevel import cast_instance_to_gcref + +erase, unerase = rerased.new_erasing_pair("stmdictitem") class W_Hashtable(W_Root): @@ -23,11 +23,11 @@ gcref = self.h.get(key) if not gcref: space.raise_key_error(space.wrap(key)) - return cast_gcref_to_instance(W_Root, gcref) + return unerase(gcref) @unwrap_spec(key=int) def setitem_w(self, key, w_value): - self.h.set(key, cast_instance_to_gcref(w_value)) + self.h.set(key, erase(w_value)) @unwrap_spec(key=int) def delitem_w(self, space, key): @@ -46,16 +46,16 @@ gcref = self.h.get(key) if not gcref: return w_default - return cast_gcref_to_instance(W_Root, gcref) + return unerase(gcref) @unwrap_spec(key=int, w_default=WrappedDefault(None)) def setdefault_w(self, space, key, w_default): entry = self.h.lookup(key) gcref = entry.object if not gcref: - self.h.writeobj(entry, cast_instance_to_gcref(w_default)) + self.h.writeobj(entry, erase(w_default)) return w_default - return cast_gcref_to_instance(W_Root, gcref) + return unerase(gcref) def len_w(self, space): return space.wrap(self.h.len()) @@ -67,7 +67,7 @@ def values_w(self, space): array, count = self.h.list() - lst_w = [cast_gcref_to_instance(W_Root, array[i].object) + lst_w = [unerase(array[i].object) for i in range(count)] return space.newlist(lst_w) @@ -75,7 +75,7 @@ array, count = self.h.list() lst_w = [space.newtuple([ space.wrap(intmask(array[i].index)), - cast_gcref_to_instance(W_Root, array[i].object)]) + unerase(array[i].object)]) for i in range(count)] return space.newlist(lst_w) @@ -120,13 +120,13 @@ class W_HashtableIterValues(W_BaseHashtableIter): def get_final_value(self, space, entry): - return cast_gcref_to_instance(W_Root, entry.object) + return unerase(entry.object) class W_HashtableIterItems(W_BaseHashtableIter): def get_final_value(self, space, entry): return space.newtuple([ space.wrap(intmask(entry.index)), - cast_gcref_to_instance(W_Root, entry.object)]) + unerase(entry.object)]) def W_Hashtable___new__(space, w_subtype): diff --git a/pypy/module/pypystm/queue.py b/pypy/module/pypystm/queue.py --- a/pypy/module/pypystm/queue.py +++ b/pypy/module/pypystm/queue.py @@ -8,9 +8,9 @@ from pypy.interpreter.error import OperationError, oefmt from pypy.module.thread.error import wrap_thread_error -from rpython.rlib import rstm -from rpython.rtyper.annlowlevel import cast_gcref_to_instance -from rpython.rtyper.annlowlevel import cast_instance_to_gcref +from rpython.rlib import rstm, rerased + +erase, unerase = rerased.new_erasing_pair("stmdictitem") class Cache: @@ -27,7 +27,7 @@ """Put an item into the queue. This queue does not support a maximum size. """ - self.q.put(cast_instance_to_gcref(w_item)) + self.q.put(erase(w_item)) @unwrap_spec(block=int) def get_w(self, space, block=1, w_timeout=None): @@ -54,7 +54,7 @@ if not gcref: raise OperationError(space.fromcache(Cache).w_Empty, space.w_None) - return cast_gcref_to_instance(W_Root, gcref) + return unerase(gcref) def task_done_w(self, space): """Indicate that a formerly enqueued task is complete. diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -7,15 +7,15 @@ from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault -from rpython.rlib import rstm, jit, rgc +from rpython.rlib import rstm, jit, rgc, rerased from rpython.rlib.objectmodel import specialize, we_are_translated -from rpython.rtyper.annlowlevel import cast_gcref_to_instance -from rpython.rtyper.annlowlevel import cast_instance_to_gcref from rpython.rtyper.lltypesystem import lltype, llmemory ARRAY = lltype.GcArray(llmemory.GCREF) PARRAY = lltype.Ptr(ARRAY) +erase, unerase = rerased.new_erasing_pair("stmdictitem") + # XXX: should have identity-dict strategy def really_find_equal_item(space, h, w_key): @@ -57,7 +57,7 @@ def _find_equal_item(space, array, w_key): # result by this function is based on 'array'. If the entry # changes, the result is stale. - w_item = cast_gcref_to_instance(W_Root, array[0]) + w_item = unerase(array[0]) if space.eq_w(w_key, w_item): return 0 if len(array) > 2: @@ -70,7 +70,7 @@ i = 2 limit = len(array) # fixed size while True: - w_item = cast_gcref_to_instance(W_Root, array[i]) + w_item = unerase(array[i]) if space.eq_w(w_key, w_item): return i i += 2 @@ -89,7 +89,7 @@ if i < 0: # or not array return None # found - w_value = cast_gcref_to_instance(W_Root, array[i + 1]) + w_value = unerase(array[i + 1]) L = len(array) - 2 if L == 0: narray = lltype.nullptr(ARRAY) @@ -107,7 +107,7 @@ def getitem(space, h, w_key): entry, array, i = really_find_equal_item(space, h, w_key) if array and i >= 0: - return cast_gcref_to_instance(W_Root, array[i + 1]) + return unerase(array[i + 1]) space.raise_key_error(w_key) def setitem(space, h, w_key, w_value): @@ -115,7 +115,7 @@ if array: if i >= 0: # already there, update the value - array[i + 1] = cast_instance_to_gcref(w_value) + array[i + 1] = erase(w_value) return L = len(array) narray = lltype.malloc(ARRAY, L + 2) @@ -123,8 +123,8 @@ else: narray = lltype.malloc(ARRAY, 2) L = 0 - narray[L] = cast_instance_to_gcref(w_key) - narray[L + 1] = cast_instance_to_gcref(w_value) + narray[L] = erase(w_key) + narray[L + 1] = erase(w_value) h.writeobj(entry, lltype.cast_opaque_ptr(llmemory.GCREF, narray)) def delitem(space, h, w_key): @@ -156,7 +156,7 @@ def get_w(self, space, w_key, w_default): entry, array, i = really_find_equal_item(space, self.h, w_key) if array and i >= 0: - return cast_gcref_to_instance(W_Root, array[i + 1]) + return unerase(array[i + 1]) return w_default def pop_w(self, space, w_key, w_default=None): @@ -174,15 +174,15 @@ if array: if i >= 0: # already there, return the existing value - return cast_gcref_to_instance(W_Root, array[i + 1]) + return unerase(array[i + 1]) L = len(array) narray = lltype.malloc(ARRAY, L + 2) ll_arraycopy(array, narray, 0, 0, L) else: narray = lltype.malloc(ARRAY, 2) L = 0 - narray[L] = cast_instance_to_gcref(w_key) - narray[L + 1] = cast_instance_to_gcref(w_default) + narray[L] = erase(w_key) + narray[L + 1] = erase(w_default) self.h.writeobj(entry, lltype.cast_opaque_ptr(llmemory.GCREF, narray)) return w_default @@ -205,7 +205,7 @@ j = offset limit = len(subarray) while j < limit: - w_item = cast_gcref_to_instance(W_Root, subarray[j]) + w_item = unerase(subarray[j]) result_list_w.append(w_item) j += 2 return result_list_w @@ -219,8 +219,8 @@ j = 0 limit = len(subarray) while j < limit: - w_key = cast_gcref_to_instance(W_Root, subarray[j]) - w_value = cast_gcref_to_instance(W_Root, subarray[j + 1]) + w_key = unerase(subarray[j]) + w_value = unerase(subarray[j + 1]) result_list_w.append(space.newtuple([w_key, w_value])) j += 2 return result_list_w @@ -289,17 +289,17 @@ class W_STMDictIterKeys(W_BaseSTMDictIter): def get_final_value(self, space, array, index): - return cast_gcref_to_instance(W_Root, array[index]) + return unerase(array[index]) class W_STMDictIterValues(W_BaseSTMDictIter): def get_final_value(self, space, array, index): - return cast_gcref_to_instance(W_Root, array[index + 1]) + return unerase(array[index + 1]) class W_STMDictIterItems(W_BaseSTMDictIter): def get_final_value(self, space, array, index): return space.newtuple([ - cast_gcref_to_instance(W_Root, array[index]), - cast_gcref_to_instance(W_Root, array[index + 1])]) + unerase(array[index]), + unerase(array[index + 1])]) def W_STMDict___new__(space, w_subtype): diff --git a/pypy/module/pypystm/stmset.py b/pypy/module/pypystm/stmset.py --- a/pypy/module/pypystm/stmset.py +++ b/pypy/module/pypystm/stmset.py @@ -7,16 +7,16 @@ from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app -from rpython.rlib import rstm, jit +from rpython.rlib import rstm, jit, rerased from rpython.rlib.rgc import ll_arraycopy from rpython.rlib.objectmodel import specialize -from rpython.rtyper.annlowlevel import cast_gcref_to_instance -from rpython.rtyper.annlowlevel import cast_instance_to_gcref from rpython.rtyper.lltypesystem import lltype, llmemory ARRAY = lltype.GcArray(llmemory.GCREF) PARRAY = lltype.Ptr(ARRAY) +erase, unerase = rerased.new_erasing_pair("stmdictitem") + # XXX: should have identity-dict strategy def really_find_equal_item(space, h, w_key): @@ -58,7 +58,7 @@ def _find_equal_item(space, array, w_key): # result by this function is based on 'array'. If the entry # changes, the result is stale. - w_item = cast_gcref_to_instance(W_Root, array[0]) + w_item = unerase(array[0]) if space.eq_w(w_key, w_item): return 0 if len(array) > 1: @@ -71,7 +71,7 @@ i = 1 limit = len(array) while True: - w_item = cast_gcref_to_instance(W_Root, array[i]) + w_item = unerase(array[i]) if space.eq_w(w_key, w_item): return i i += 1 @@ -102,7 +102,7 @@ narray = lltype.malloc(ARRAY, 1) L = 0 - narray[L] = cast_instance_to_gcref(w_key) + narray[L] = erase(w_key) self.h.writeobj(entry, lltype.cast_opaque_ptr(llmemory.GCREF, narray)) def try_remove(self, space, w_key): @@ -143,7 +143,7 @@ subarray = lltype.cast_opaque_ptr(PARRAY, array[i].object) assert subarray for j in range(len(subarray)): - w_item = cast_gcref_to_instance(W_Root, subarray[j]) + w_item = unerase(subarray[j]) result_list_w.append(w_item) return result_list_w @@ -188,7 +188,7 @@ self.next_from_same_hash = index + 1 self.next_array = array # - return cast_gcref_to_instance(W_Root, array[index]) + return unerase(array[index]) def _cleanup_(self): raise Exception("seeing a prebuilt %r object" % ( diff --git a/rpython/rlib/rerased.py b/rpython/rlib/rerased.py --- a/rpython/rlib/rerased.py +++ b/rpython/rlib/rerased.py @@ -128,6 +128,7 @@ # ---------- implementation-specific ---------- class Erased(object): + _TYPE = llmemory.GCREF def __init__(self, x, identity): self._x = x self._identity = identity diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -394,7 +394,7 @@ def _live_items(self): return [self.lookup(key) for key, v in self._content.items() - if v.object != NULL_GCREF] + if v.object] def len(self): return len(self._live_items()) From noreply at buildbot.pypy.org Thu Nov 26 11:32:13 2015 From: noreply at buildbot.pypy.org (arigo) Date: Thu, 26 Nov 2015 17:32:13 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: Yay, seems to have unblocked the situation for objspace/std/stmdict. Message-ID: <20151126163213.7F02A1C12CA@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80979:357192d019e3 Date: 2015-11-26 16:36 +0000 http://bitbucket.org/pypy/pypy/changeset/357192d019e3/ Log: Yay, seems to have unblocked the situation for objspace/std/stmdict. diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -131,6 +131,15 @@ if pop_from_entry(h, space, w_key) is None: space.raise_key_error(w_key) +def get_length(space, h): + array, count = h.list() + total_length_times_two = 0 + for i in range(count): + subarray = lltype.cast_opaque_ptr(PARRAY, array[i].object) + assert subarray + total_length_times_two += len(subarray) + return total_length_times_two >> 1 + class W_STMDict(W_Root): @@ -187,15 +196,6 @@ return w_default - def get_length(self): - array, count = self.h.list() - total_length_times_two = 0 - for i in range(count): - subarray = lltype.cast_opaque_ptr(PARRAY, array[i].object) - assert subarray - total_length_times_two += len(subarray) - return total_length_times_two >> 1 - def get_keys_values_w(self, offset): array, count = self.h.list() result_list_w = [] @@ -226,7 +226,7 @@ return result_list_w def len_w(self, space): - return space.wrap(self.get_length()) + return space.wrap(get_length(space, self.h)) def keys_w(self, space): return space.newlist(self.get_keys_values_w(offset=0)) diff --git a/pypy/objspace/std/stmdict.py b/pypy/objspace/std/stmdict.py --- a/pypy/objspace/std/stmdict.py +++ b/pypy/objspace/std/stmdict.py @@ -12,6 +12,10 @@ def get_empty_storage(self): return self.erase(stmdict.create()) + def length(self, w_dict): + h = self.unerase(w_dict.dstorage) + return stmdict.get_length(self.space, h) + def setitem(self, w_dict, w_key, w_value): h = self.unerase(w_dict.dstorage) stmdict.setitem(self.space, h, w_key, w_value) From noreply at buildbot.pypy.org Thu Nov 26 18:55:12 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 27 Nov 2015 00:55:12 +0100 (CET) Subject: [pypy-commit] pypy cpyext-ext: extend cpyext with more functions from cpython Message-ID: <20151126235512.811A51C12CA@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: cpyext-ext Changeset: r80980:30c0c05118de Date: 2015-11-26 23:57 +0200 http://bitbucket.org/pypy/pypy/changeset/30c0c05118de/ Log: extend cpyext with more functions from cpython From noreply at buildbot.pypy.org Thu Nov 26 18:55:14 2015 From: noreply at buildbot.pypy.org (mattip) Date: Fri, 27 Nov 2015 00:55:14 +0100 (CET) Subject: [pypy-commit] pypy cpyext-ext: define/modify for upstream compatibity PyMem_Malloc, PyStringObject, _Py_HashDouble Message-ID: <20151126235514.B669B1C12CA@cobra.cs.uni-duesseldorf.de> Author: mattip Branch: cpyext-ext Changeset: r80981:c114f7d51108 Date: 2015-11-27 01:55 +0200 http://bitbucket.org/pypy/pypy/changeset/c114f7d51108/ Log: define/modify for upstream compatibity PyMem_Malloc, PyStringObject, _Py_HashDouble diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -1056,6 +1056,7 @@ source_dir / "pythread.c", source_dir / "ndarrayobject.c", source_dir / "missing.c", + source_dir / "pymem.c", ], separate_module_sources=separate_module_sources, compile_extra=compile_extra, diff --git a/pypy/module/cpyext/include/pymem.h b/pypy/module/cpyext/include/pymem.h --- a/pypy/module/cpyext/include/pymem.h +++ b/pypy/module/cpyext/include/pymem.h @@ -5,7 +5,7 @@ #define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1) #define PyMem_FREE free -#define PyMem_Malloc PyMem_MALLOC +void * PyMem_Malloc(size_t); #define PyMem_Free PyMem_FREE #define PyMem_Realloc PyMem_REALLOC diff --git a/pypy/module/cpyext/include/pyport.h b/pypy/module/cpyext/include/pyport.h --- a/pypy/module/cpyext/include/pyport.h +++ b/pypy/module/cpyext/include/pyport.h @@ -64,6 +64,14 @@ # error "Python needs a typedef for Py_uintptr_t in pyport.h." #endif /* HAVE_UINTPTR_T */ +/* Py_hash_t is the same size as a pointer. */ +#define SIZEOF_PY_HASH_T SIZEOF_SIZE_T +typedef Py_ssize_t Py_hash_t; +/* Py_uhash_t is the unsigned equivalent needed to calculate numeric hash. */ +#define SIZEOF_PY_UHASH_T SIZEOF_SIZE_T +typedef size_t Py_uhash_t; + + /******************************* * stat() and fstat() fiddling * *******************************/ diff --git a/pypy/module/cpyext/include/stringobject.h b/pypy/module/cpyext/include/stringobject.h --- a/pypy/module/cpyext/include/stringobject.h +++ b/pypy/module/cpyext/include/stringobject.h @@ -7,15 +7,59 @@ extern "C" { #endif +#include + +/* +Type PyStringObject represents a character string. An extra zero byte is +reserved at the end to ensure it is zero-terminated, but a size is +present so strings with null bytes in them can be represented. This +is an immutable object type. + +There are functions to create new string objects, to test +an object for string-ness, and to get the +string value. The latter function returns a null pointer +if the object is not of the proper type. +There is a variant that takes an explicit size as well as a +variant that assumes a zero-terminated string. Note that none of the +functions should be applied to nil objects. +*/ + +/* Caching the hash (ob_shash) saves recalculation of a string's hash value. + Interning strings (ob_sstate) tries to ensure that only one string + object with a given value exists, so equality tests can be one pointer + comparison. This is generally restricted to strings that "look like" + Python identifiers, although the intern() builtin can be used to force + interning of any string. + Together, these sped cpython up by up to 20%, and since they are part of the + "public" interface PyPy must reimpliment them. */ + + #define PyString_GET_SIZE(op) PyString_Size(op) #define PyString_AS_STRING(op) PyString_AsString(op) typedef struct { PyObject_HEAD - char* buffer; + long ob_shash; + int ob_sstate; + char * buffer; Py_ssize_t size; + + /* Invariants: + * ob_sval contains space for 'ob_size+1' elements. + * ob_sval[ob_size] == 0. + * ob_shash is the hash of the string or -1 if not computed yet. + * ob_sstate != 0 iff the string object is in stringobject.c's + * 'interned' dictionary; in this case the two references + * from 'interned' to this object are *not counted* in ob_refcnt. + */ + } PyStringObject; +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 +#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) + PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char *format, va_list vargs); PyAPI_FUNC(PyObject *) PyString_FromFormat(const char *format, ...); diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py --- a/pypy/module/cpyext/object.py +++ b/pypy/module/cpyext/object.py @@ -387,6 +387,11 @@ This is the equivalent of the Python expression hash(o).""" return space.int_w(space.hash(w_obj)) + at cpython_api([rffi.LONG], rffi.DOUBLE, error=-1) +def _Py_HashDouble(space, w_obj): + raise OperationError(space.w_NotImplementedError, + space.wrap("_Py_HashDouble not implemented yet")) + @cpython_api([PyObject], lltype.Signed, error=-1) def PyObject_HashNotImplemented(space, o): """Set a TypeError indicating that type(o) is not hashable and return -1. diff --git a/pypy/module/cpyext/stringobject.py b/pypy/module/cpyext/stringobject.py --- a/pypy/module/cpyext/stringobject.py +++ b/pypy/module/cpyext/stringobject.py @@ -53,7 +53,8 @@ PyStringObjectStruct = lltype.ForwardReference() PyStringObject = lltype.Ptr(PyStringObjectStruct) PyStringObjectFields = PyObjectFields + \ - (("buffer", rffi.CCHARP), ("size", Py_ssize_t)) + (("ob_shash", rffi.LONG), ("ob_sstate", rffi.INT), + ("buffer", rffi.CCHARP), ("size", Py_ssize_t)) cpython_struct("PyStringObject", PyStringObjectFields, PyStringObjectStruct) @bootstrap_function @@ -81,6 +82,7 @@ py_str.c_size = length py_str.c_buffer = lltype.malloc(rffi.CCHARP.TO, buflen, flavor='raw', zero=True) + py_str.c_ob_sstate = 0 # SSTATE_NOT_INTERNED return py_str def string_attach(space, py_obj, w_obj): diff --git a/pypy/module/cpyext/test/test_object.py b/pypy/module/cpyext/test/test_object.py --- a/pypy/module/cpyext/test/test_object.py +++ b/pypy/module/cpyext/test/test_object.py @@ -173,6 +173,9 @@ api.PyErr_Occurred() is space.w_TypeError) api.PyErr_Clear() + def test_hash_double(self, space, api): + assert False + def test_type(self, space, api): assert api.PyObject_Type(space.wrap(72)) is space.w_int diff --git a/pypy/module/cpyext/test/test_stringobject.py b/pypy/module/cpyext/test/test_stringobject.py --- a/pypy/module/cpyext/test/test_stringobject.py +++ b/pypy/module/cpyext/test/test_stringobject.py @@ -189,6 +189,10 @@ # This does not test much, but at least the refcounts are checked. assert module.test_intern_inplace('s') == 's' + def test_hash_and_state(self): + # XXX write tests for ob_shash and ob_sstate + assert False + class TestString(BaseApiTest): def test_string_resize(self, space, api): py_str = new_empty_str(space, 10) From noreply at buildbot.pypy.org Thu Nov 26 20:38:56 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 27 Nov 2015 02:38:56 +0100 (CET) Subject: [pypy-commit] pypy anntype2: hg merge default Message-ID: <20151127013856.C33F91C11DD@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80982:d2b5d5173cc6 Date: 2015-11-25 23:20 +0000 http://bitbucket.org/pypy/pypy/changeset/d2b5d5173cc6/ Log: hg merge default diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -29,3 +29,7 @@ string buffer and directly casts the bytes to the appropriate type, when allowed. Unpacking of floats and doubles is about 15 times faster now, while for integer types it's up to ~50% faster for 64bit integers. + +.. branch: wrap-specialisation + +Remove unnecessary special handling of space.wrap(). diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py --- a/pypy/module/pypyjit/test_pypy_c/test_containers.py +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -66,6 +66,7 @@ guard_not_invalidated(descr=...) p10 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i5, descr=) guard_no_exception(descr=...) + guard_nonnull(p10, descr=...) i12 = call_i(ConstClass(ll_strhash), p10, descr=) p13 = new(descr=...) p15 = new_array_clear(16, descr=) diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -135,6 +135,7 @@ guard_no_exception(descr=...) p95 = call_r(..., descr=) # ll_build guard_no_exception(descr=...) + guard_nonnull(p95, descr=...) i96 = strlen(p95) i97 = int_add_ovf(i71, i96) guard_no_overflow(descr=...) @@ -250,6 +251,7 @@ guard_not_invalidated(descr=...) p80 = call_r(ConstClass(ll_str__IntegerR_SignedConst_Signed), i47, descr=) guard_no_exception(descr=...) + guard_nonnull(p80, descr=...) p53 = call_r(ConstClass(fast_str_decode_ascii), p80, descr=) guard_no_exception(descr=...) guard_nonnull(p53, descr=...) diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -130,6 +130,7 @@ def wrapbytes(self, x): return wrapstr(self, x) + @specialize.argtype(1) def wrap(self, x): "Wraps the Python value 'x' into one of the wrapper classes." # You might notice that this function is rather conspicuously @@ -172,7 +173,6 @@ else: return W_LongObject.fromrarith_int(x) return self._wrap_not_rpython(x) - wrap._annspecialcase_ = "specialize:wrap" def _wrap_not_rpython(self, x): "NOT_RPYTHON" diff --git a/pypy/tool/ann_override.py b/pypy/tool/ann_override.py --- a/pypy/tool/ann_override.py +++ b/pypy/tool/ann_override.py @@ -1,16 +1,7 @@ # overrides for annotation specific to PyPy codebase from rpython.annotator.policy import AnnotatorPolicy from rpython.flowspace.model import Constant -from rpython.annotator import specialize -from rpython.annotator.classdesc import InstanceSource, ClassDesc - - - -def isidentifier(s): - if not s: - return False - s = s.replace('_', 'x') - return s[0].isalpha() and s.isalnum() +from rpython.annotator.classdesc import InstanceSource class PyPyAnnotatorPolicy(AnnotatorPolicy): @@ -19,37 +10,6 @@ self.lookups_where = {} self.pypytypes = {} - def specialize__wrap(self, funcdesc, args_s): - from pypy.interpreter.baseobjspace import W_Root - W_Root_desc = funcdesc.bookkeeper.getdesc(W_Root) - typ = args_s[1].knowntype - if isinstance(typ, ClassDesc): - assert typ.issubclass(W_Root_desc) - typ = W_Root - else: - assert not issubclass(typ, W_Root) - assert typ != tuple, "space.wrap(tuple) forbidden; use newtuple()" - assert typ != list, "space.wrap(list) forbidden; use newlist()" - assert typ != dict, "space.wrap(dict) forbidden; use newdict()" - assert typ != object, "degenerated space.wrap(object)" - if args_s[0].is_constant() and args_s[1].is_constant(): - if typ in (str, bool, int, float): - space = args_s[0].const - x = args_s[1].const - - def fold(): - if typ is str and isidentifier(x): - return space.new_interned_str(x) - else: - return space.wrap(x) - builder = specialize.make_constgraphbuilder(2, factory=fold, - srcmodule='') - return funcdesc.cachedgraph((typ, x), builder=builder) - if typ is str: - if args_s[1].can_be_None: - typ = (None, str) - return funcdesc.cachedgraph(typ) - def consider_lookup(self, bookkeeper, attr): assert attr not in self.lookups from pypy.objspace.std import typeobject From noreply at buildbot.pypy.org Thu Nov 26 20:38:58 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 27 Nov 2015 02:38:58 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Add a failing test that explains sporadic translation failures since merging branch 'anntype' Message-ID: <20151127013858.D34881C11DD@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r80983:74f08fa08092 Date: 2015-11-27 01:39 +0000 http://bitbucket.org/pypy/pypy/changeset/74f08fa08092/ Log: Add a failing test that explains sporadic translation failures since merging branch 'anntype' diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py --- a/rpython/annotator/test/test_model.py +++ b/rpython/annotator/test/test_model.py @@ -1,8 +1,11 @@ import pytest +from rpython.flowspace.model import Variable +from rpython.flowspace.operation import op +from rpython.translator.translator import TranslationContext from rpython.annotator.model import * +from rpython.annotator.annrpython import BlockedInference from rpython.annotator.listdef import ListDef -from rpython.translator.translator import TranslationContext from rpython.annotator import unaryop, binaryop # for side-effects @pytest.fixture() @@ -151,3 +154,35 @@ s_exc1 = bk.new_exception([ValueError]) s_exc2 = bk.new_exception([IndexError]) unionof(s_exc1, s_exc2) == unionof(s_exc2, s_exc1) + +def contains_s(s_a, s_b): + if s_b is None: + return True + elif s_a is None: + return False + else: + return s_a.contains(s_b) + +def test_generalize_getitem(annotator): + bk = annotator.bookkeeper + v_dict, v_key = Variable(), Variable() + v_key.annotation = SomeInteger() + v_dict.annotation = s_None + hlop = op.getitem(v_dict, v_key) + try: + annotator.consider_op(hlop) + except BlockedInference: + # BlockedInference only stops annotation along the normal path, + # but not along the exceptional one. + pass + v_result = hlop.result + s_result = v_result.annotation + s_result_exc = annotator.get_exception(hlop) + with bk.at_position(None): + annotator.setbinding(v_dict, bk.newdict()) + try: + annotator.consider_op(hlop) + except BlockedInference: + pass + assert contains_s(v_result.annotation, s_result) + assert contains_s(annotator.get_exception(hlop), s_result_exc) From noreply at buildbot.pypy.org Fri Nov 27 03:17:33 2015 From: noreply at buildbot.pypy.org (arigo) Date: Fri, 27 Nov 2015 09:17:33 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8-dictstrategy: test_popitem passes Message-ID: <20151127081733.81AAB1C0400@cobra.cs.uni-duesseldorf.de> Author: Armin Rigo Branch: stmgc-c8-dictstrategy Changeset: r80985:64e305bf4c25 Date: 2015-11-27 08:22 +0000 http://bitbucket.org/pypy/pypy/changeset/64e305bf4c25/ Log: test_popitem passes diff --git a/pypy/module/pypystm/stmdict.py b/pypy/module/pypystm/stmdict.py --- a/pypy/module/pypystm/stmdict.py +++ b/pypy/module/pypystm/stmdict.py @@ -7,7 +7,7 @@ from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault -from rpython.rlib import rstm, jit, rgc, rerased +from rpython.rlib import rstm, jit, rgc, rerased, objectmodel from rpython.rlib.objectmodel import specialize, we_are_translated from rpython.rtyper.lltypesystem import lltype, llmemory @@ -17,6 +17,12 @@ erase, unerase = rerased.new_erasing_pair("stmdictitem") +def compares_by_identity(space, w_key): + try: + return space.type(w_key).compares_by_identity() + except AttributeError: + return False # for non-translated tests + # XXX: should have identity-dict strategy def really_find_equal_item(space, h, w_key): hkey = space.hash_w(w_key) @@ -24,7 +30,7 @@ array = lltype.cast_opaque_ptr(PARRAY, entry.object) if not array: return (entry, array, -1) - if space.type(w_key).compares_by_identity(): + if compares_by_identity(space, w_key): # fastpath return (entry, array, _find_equal_item(space, array, w_key)) # slowpath @@ -32,7 +38,7 @@ @jit.dont_look_inside def _really_find_equal_item_loop(space, h, w_key, entry, array, hkey): - assert not space.type(w_key).compares_by_identity() # assume it stays that way + assert not compares_by_identity(space, w_key) # assume it stays that way while True: assert array i = _find_equal_item(space, array, w_key) @@ -238,22 +244,50 @@ return space.newlist(self.get_items_w(space)) def iterkeys_w(self, space): - return W_STMDictIterKeys(self.h) + return W_STMDictIterKeys(space, self.h) def itervalues_w(self, space): - return W_STMDictIterValues(self.h) + return W_STMDictIterValues(space, self.h) def iteritems_w(self, space): - return W_STMDictIterItems(self.h) + return W_STMDictIterItems(space, self.h) -class W_BaseSTMDictIter(W_Root): +class BaseSTMDictIter: _immutable_fields_ = ["hiter"] next_from_same_hash = 0 - def __init__(self, hobj): + def __init__(self, space, hobj): + self.space = space self.hiter = hobj.iterentries() + def next(self): + if self.next_from_same_hash == 0: # common case + try: + entry = self.hiter.next() + except StopIteration: + space = self.space + raise OperationError(space.w_StopIteration, space.w_None) + index = 0 + array = lltype.cast_opaque_ptr(PARRAY, entry.object) + hash = entry.index + else: + index = self.next_from_same_hash + array = self.next_array + hash = self.next_hash + self.next_from_same_hash = 0 + self.next_array = lltype.nullptr(ARRAY) + # + if len(array) > index + 2: # uncommon case + self.next_from_same_hash = index + 2 + self.next_array = array + self.next_hash = hash + # + return self.get_final_value(hash, array, index) + +class W_BaseSTMDictIter(W_Root): + objectmodel.import_from_mixin(BaseSTMDictIter) + def descr_iter(self, space): return self @@ -264,40 +298,23 @@ return space.wrap(self.hiter.hashtable.len_estimate()) def descr_next(self, space): - if self.next_from_same_hash == 0: # common case - try: - entry = self.hiter.next() - except StopIteration: - raise OperationError(space.w_StopIteration, space.w_None) - index = 0 - array = lltype.cast_opaque_ptr(PARRAY, entry.object) - else: - index = self.next_from_same_hash - array = self.next_array - self.next_from_same_hash = 0 - self.next_array = lltype.nullptr(ARRAY) - # - if len(array) > index + 2: # uncommon case - self.next_from_same_hash = index + 2 - self.next_array = array - # - return self.get_final_value(space, array, index) + return self.next() def _cleanup_(self): raise Exception("seeing a prebuilt %r object" % ( self.__class__,)) class W_STMDictIterKeys(W_BaseSTMDictIter): - def get_final_value(self, space, array, index): + def get_final_value(self, hash, array, index): return unerase(array[index]) class W_STMDictIterValues(W_BaseSTMDictIter): - def get_final_value(self, space, array, index): + def get_final_value(self, hash, array, index): return unerase(array[index + 1]) class W_STMDictIterItems(W_BaseSTMDictIter): - def get_final_value(self, space, array, index): - return space.newtuple([ + def get_final_value(self, hash, array, index): + return self.space.newtuple([ unerase(array[index]), unerase(array[index + 1])]) diff --git a/pypy/objspace/std/stmdict.py b/pypy/objspace/std/stmdict.py --- a/pypy/objspace/std/stmdict.py +++ b/pypy/objspace/std/stmdict.py @@ -1,4 +1,4 @@ -from rpython.rlib import rerased +from rpython.rlib import rerased, objectmodel from pypy.objspace.std.dictmultiobject import (DictStrategy, create_iterator_classes) from pypy.module.pypystm import stmdict @@ -16,6 +16,36 @@ h = self.unerase(w_dict.dstorage) return stmdict.get_length(self.space, h) + def getitem(self, w_dict, w_key): + h = self.unerase(w_dict.dstorage) + return stmdict.getitem(self.space, h, w_key) + def setitem(self, w_dict, w_key, w_value): h = self.unerase(w_dict.dstorage) stmdict.setitem(self.space, h, w_key, w_value) + + def delitem(self, w_dict, w_key): + h = self.unerase(w_dict.dstorage) + stmdict.delitem(self.space, h, w_key) + + def getiteritems_with_hash(self, w_dict): + h = self.unerase(w_dict.dstorage) + return StmDictItemsWithHash(self.space, h) + + +class StmDictItemsWithHash(object): + objectmodel.import_from_mixin(stmdict.BaseSTMDictIter) + + def __iter__(self): + return self + + def get_final_value(self, hash, array, index): + w_key = stmdict.unerase(array[index]) + w_value = stmdict.unerase(array[index + 1]) + return (w_key, w_value, hash) + + def _cleanup_(self): + raise Exception("seeing a prebuilt %r object" % ( + self.__class__,)) + +create_iterator_classes(StmDictStrategy) From noreply at buildbot.pypy.org Fri Nov 27 06:25:49 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Fri, 27 Nov 2015 12:25:49 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: added a view more test cases for raw_store Message-ID: <20151127112549.3C4E31C143D@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80994:6c1e5acac108 Date: 2015-11-27 12:25 +0100 http://bitbucket.org/pypy/pypy/changeset/6c1e5acac108/ Log: added a view more test cases for raw_store diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -102,6 +102,8 @@ fdescr = get_array_descr(self.gc_ll_descr, F) SF = lltype.GcArray(lltype.SingleFloat) sfdescr = get_array_descr(self.gc_ll_descr, SF) + RAW_SF = lltype.Array(lltype.SingleFloat) + raw_sfdescr = get_array_descr(self.gc_ll_descr, RAW_SF) # strdescr = self.gc_ll_descr.str_descr unicodedescr = self.gc_ll_descr.unicode_descr @@ -1134,11 +1136,14 @@ [True, None, 'i3 = raw_load_i(p0,i1,descr=adescr)->gc_load_indexed_i(p0,i1,1,8,-8)'], [True, None, 'i3 = raw_load_f(p0,i1,descr=fdescr)->gc_load_indexed_f(p0,i1,1,8,8)'], [True, None, 'i3 = raw_load_i(p0,i1,descr=sfdescr)->gc_load_indexed_i(p0,i1,1,8,4)'], + [True, (1,2,4,8), 'i3 = raw_store(p0,i1,i2,descr=raw_sfdescr)->gc_store_indexed(p0,i1,i2,4,8,4)'], + [False, (1,), 'i3 = raw_store(p0,i1,i2,descr=raw_sfdescr)' '->' + 'i4 = int_mul(i1,4);i5 = int_add(i4,8);gc_store(p0,i5,i2,4)'], ]) def test_gc_load_store_transform(self, support_offset, factors, fromto): self.cpu.load_constant_offset = support_offset all_supported_sizes = [factors] - if not all_supported_sizes: + if not factors: all_supported_sizes = [(1,), (1,2,), (4,), (1,2,4,8)] for factors in all_supported_sizes: self.cpu.load_supported_factors = factors From noreply at buildbot.pypy.org Fri Nov 27 06:32:37 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 27 Nov 2015 12:32:37 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: add tests for current and future features Message-ID: <20151127113237.AB3B81C143D@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80995:5db87b548f92 Date: 2015-11-27 11:24 +0100 http://bitbucket.org/pypy/pypy/changeset/5db87b548f92/ Log: add tests for current and future features diff --git a/rpython/translator/stm/test/test_inevitable.py b/rpython/translator/stm/test/test_inevitable.py --- a/rpython/translator/stm/test/test_inevitable.py +++ b/rpython/translator/stm/test/test_inevitable.py @@ -401,6 +401,21 @@ res = self.interpret_inevitable(f1, [1]) assert res == ['getfield'] + def test_partially_redundant_inev3(self): + X = lltype.Struct('X', ('foo', lltype.Signed)) + x1 = lltype.malloc(X, immortal=True) + x1.foo = 42 + + def f1(i): + r = 0 + if i: + r += x1.foo + r += x1.foo + return r + + res = self.interpret_inevitable(f1, [1]) + assert res == ['getfield', 'getfield'] + def test_with_break_inev(self): X = lltype.Struct('X', ('foo', lltype.Signed)) x1 = lltype.malloc(X, immortal=True) @@ -425,8 +440,8 @@ def f1(i): x1 = lltype.malloc(X, flavor='raw') - x1.foo = 42 - r = x1.foo + x1.foo = 42 # ok + r = x1.foo # ok lltype.free(x1, flavor='raw') return r @@ -434,20 +449,56 @@ assert res == [] - def test_for_unknown_raw(self): + def test_for_local_raw_with_break(self): + py.test.skip("not yet") + X = lltype.Struct('X', ('foo', lltype.Signed)) + import time + def f1(i): + x1 = lltype.malloc(X, flavor='raw') + x1.foo = 42 # ok + time.sleep(0) # gil rel + r = x1.foo # inev + x1.foo = 8 # ok + if i: + lltype.free(x1, flavor='raw') + return r + + res = self.interpret_inevitable(f1, [1]) + assert res == ['getfield',] + + def test_for_local_raw_no_free(self): py.test.skip("not yet") X = lltype.Struct('X', ('foo', lltype.Signed)) def f1(i): x1 = lltype.malloc(X, flavor='raw') - x1.foo = 42 - r = x1.foo + x1.foo = 42 # ok + r = x1.foo # ok if i: lltype.free(x1, flavor='raw') return r res = self.interpret_inevitable(f1, [1]) - assert res == ['setfield', 'getfield'] + assert res == [] + + + def test_for_unknown_raw(self): + py.test.skip("not yet") + X = lltype.Struct('X', ('foo', lltype.Signed)) + + def g(r): + r.foo = 28 # inev bc. unknown + def f1(i): + x1 = lltype.malloc(X, flavor='raw') + x1.foo = 42 # ok + if i: + g(x1) # no break + r = x1.foo # ok + lltype.free(x1, flavor='raw') + return r + + res = self.interpret_inevitable(f1, [1]) + assert res == ['setfield'] def test_local_raw_in_same_transaction(self): From noreply at buildbot.pypy.org Fri Nov 27 06:32:39 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 27 Nov 2015 12:32:39 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: fix horrible performance Message-ID: <20151127113239.CC61F1C143D@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80996:44379f7fa2ab Date: 2015-11-27 12:21 +0100 http://bitbucket.org/pypy/pypy/changeset/44379f7fa2ab/ Log: fix horrible performance diff --git a/rpython/translator/stm/inevitable.py b/rpython/translator/stm/inevitable.py --- a/rpython/translator/stm/inevitable.py +++ b/rpython/translator/stm/inevitable.py @@ -206,8 +206,10 @@ else: assert op not in self.turn_inevitable_ops # - if self.break_analyzer.analyze(op): - # possible TX break in op + # check breaking ops here to be safe (e.g. if there + # was an op that turns inevitable, but also breaks) + if inevitable and self.break_analyzer.analyze(op): + # only check if inev, otherwise performance is horrible inevitable = False # return inevitable From noreply at buildbot.pypy.org Fri Nov 27 06:55:09 2015 From: noreply at buildbot.pypy.org (Raemi) Date: Fri, 27 Nov 2015 12:55:09 +0100 (CET) Subject: [pypy-commit] pypy stmgc-c8: do optimal evaluation order for forward flow analysis Message-ID: <20151127115509.9A9C21C143D@cobra.cs.uni-duesseldorf.de> Author: Remi Meier Branch: stmgc-c8 Changeset: r80997:c4bb2166366b Date: 2015-11-27 12:56 +0100 http://bitbucket.org/pypy/pypy/changeset/c4bb2166366b/ Log: do optimal evaluation order for forward flow analysis diff --git a/rpython/translator/backendopt/dataflow.py b/rpython/translator/backendopt/dataflow.py --- a/rpython/translator/backendopt/dataflow.py +++ b/rpython/translator/backendopt/dataflow.py @@ -36,7 +36,17 @@ raise NotImplementedError("abstract base class") - +def postorder_block_list(graph): + visited = set() + blocks = [] + def dfs_recurse(block): + visited.add(block) + for link in block.exits: + if link.target not in visited: + dfs_recurse(link.target) + blocks.append(block) + dfs_recurse(graph.startblock) + return blocks class AbstractForwardDataFlowAnalysis(AbstractDataFlowAnalysis): @@ -86,18 +96,16 @@ # # iterate: - # todo: ordered set? reverse post-order? - blocks.remove(graph.startblock) - pending = collections.deque(blocks) - pending.append(graph.startblock) + # todo: ordered set? + pending = collections.deque(reversed(postorder_block_list(graph))) while pending: - block = pending.pop() + block = pending.popleft() if self._update_in_state_of(block, entrymap, in_states, out_states): block_out = self.transfer_function(block, in_states[block]) if block_out != out_states[block]: out_states[block] = block_out for link in block.exits: if link.target not in pending: - pending.appendleft(link.target) + pending.append(link.target) # return in_states, out_states diff --git a/rpython/translator/backendopt/test/test_dataflow.py b/rpython/translator/backendopt/test/test_dataflow.py --- a/rpython/translator/backendopt/test/test_dataflow.py +++ b/rpython/translator/backendopt/test/test_dataflow.py @@ -1,6 +1,7 @@ import random from rpython.tool.algo.unionfind import UnionFind -from rpython.translator.backendopt.dataflow import AbstractForwardDataFlowAnalysis +from rpython.translator.backendopt.dataflow import ( + AbstractForwardDataFlowAnalysis, postorder_block_list) import pytest @@ -85,3 +86,42 @@ assert len(sfa.seen) == 5 assert ins[g.startblock] == sfa.entry_state(None) assert outs[g.returnblock] == sfa.entry_state(None) + + +def test_postorder_block_list(): + def f(x): + pass + t = TranslationContext() + g = t.buildflowgraph(f) + pobl = postorder_block_list(g) + assert len(set(pobl)) == 2 # start & return + + def f2(x): + if x: + x=x+1 + else: + x=x+2 + return x + t = TranslationContext() + g = t.buildflowgraph(f2) + pobl = postorder_block_list(g) + assert len(pobl[0].exits) == 0 + assert len(pobl[1].exits) == 1 + assert len(pobl[2].exits) == 1 + assert len(pobl[3].exits) == 2 + assert len(set(pobl)) == 4 + + +def test_postorder_block_list2(): + def f(x): + if x < 0: + while x: + pass + return x + else: + while x: + if x-1: + return x + t = TranslationContext() + g = t.buildflowgraph(f) + assert len(set(postorder_block_list(g))) == 5 From noreply at buildbot.pypy.org Fri Nov 27 07:30:20 2015 From: noreply at buildbot.pypy.org (plan_rich) Date: Fri, 27 Nov 2015 13:30:20 +0100 (CET) Subject: [pypy-commit] pypy memop-simplify2: raw_store got the wrong scaling factor passed in rewrite Message-ID: <20151127123020.D6A041C0400@cobra.cs.uni-duesseldorf.de> Author: Richard Plangger Branch: memop-simplify2 Changeset: r80998:92f1f9606cd7 Date: 2015-11-27 13:28 +0100 http://bitbucket.org/pypy/pypy/changeset/92f1f9606cd7/ Log: raw_store got the wrong scaling factor passed in rewrite diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -184,11 +184,19 @@ op.getopnum() in (rop.GETARRAYITEM_RAW_I, rop.GETARRAYITEM_RAW_F): self.handle_getarrayitem(op) - if op.getopnum() in (rop.SETARRAYITEM_GC, rop.SETARRAYITEM_RAW, - rop.RAW_STORE): + if op.getopnum() in (rop.SETARRAYITEM_GC, rop.SETARRAYITEM_RAW): self.handle_setarrayitem(op) + if op.getopnum() == rop.RAW_STORE: + itemsize, ofs, _ = unpack_arraydescr(op.getdescr()) + ptr_box = op.getarg(0) + index_box = op.getarg(1) + value_box = op.getarg(2) + self.emit_gc_store_or_indexed(op, ptr_box, index_box, value_box, itemsize, 1, ofs) if op.getopnum() in (rop.RAW_LOAD_I, rop.RAW_LOAD_F): - self.handle_rawload(op) + itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) + ptr_box = op.getarg(0) + index_box = op.getarg(1) + self.emit_gc_load_or_indexed(op, ptr_box, index_box, itemsize, 1, ofs, sign) def rewrite(self, operations): # we can only remember one malloc since the next malloc can possibly diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -1136,9 +1136,9 @@ [True, None, 'i3 = raw_load_i(p0,i1,descr=adescr)->gc_load_indexed_i(p0,i1,1,8,-8)'], [True, None, 'i3 = raw_load_f(p0,i1,descr=fdescr)->gc_load_indexed_f(p0,i1,1,8,8)'], [True, None, 'i3 = raw_load_i(p0,i1,descr=sfdescr)->gc_load_indexed_i(p0,i1,1,8,4)'], - [True, (1,2,4,8), 'i3 = raw_store(p0,i1,i2,descr=raw_sfdescr)->gc_store_indexed(p0,i1,i2,4,8,4)'], + [True, (1,2,4,8), 'i3 = raw_store(p0,i1,i2,descr=raw_sfdescr)->gc_store_indexed(p0,i1,i2,1,8,4)'], [False, (1,), 'i3 = raw_store(p0,i1,i2,descr=raw_sfdescr)' '->' - 'i4 = int_mul(i1,4);i5 = int_add(i4,8);gc_store(p0,i5,i2,4)'], + 'i5 = int_add(i1,8);gc_store(p0,i5,i2,4)'], ]) def test_gc_load_store_transform(self, support_offset, factors, fromto): self.cpu.load_constant_offset = support_offset diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1484,7 +1484,7 @@ def _genop_gc_load(self, op, arglocs, resloc): base_loc, ofs_loc, size_loc, sign_loc = arglocs assert isinstance(size_loc, ImmedLoc) - rc_addr = addr_add(base_loc, ofs_loc, 0, 0) + src_addr = addr_add(base_loc, ofs_loc, 0, 0) self.load_from_mem(resloc, src_addr, size_loc, sign_loc) genop_gc_load_i = _genop_gc_load @@ -1585,7 +1585,7 @@ genop_discard_setinteriorfield_raw = genop_discard_setinteriorfield_gc def genop_discard_gc_store(self, op, arglocs): - base_loc, ofs_loc, size_loc = arglocs + base_loc, ofs_loc, value_loc, size_loc = arglocs assert isinstance(size_loc, ImmedLoc) scale = get_scale(size_loc.value) dest_addr = AddressLoc(base_loc, ofs_loc, 0, 0) diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -921,8 +921,8 @@ args = op.getarglist() N = len(args) # we force all arguments in a reg (unless they are Consts), - # because it will be needed anyway by the following setfield_gc - # or setarrayitem_gc. It avoids loading it twice from the memory. + # because it will be needed anyway by the following gc_load + # It avoids loading it twice from the memory. arglocs = [self.rm.make_sure_var_in_reg(op.getarg(i), args) for i in range(N)] self.perform_discard(op, arglocs) @@ -1163,30 +1163,6 @@ base_loc = self.loc(op.getarg(0)) self.perform_discard(op, [base_loc]) - def _consider_getarrayitem(self, op): - itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) - args = op.getarglist() - base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) - ofs_loc = self.rm.make_sure_var_in_reg(op.getarg(1), args) - result_loc = self.force_allocate_reg(op) - if sign: - sign_loc = imm1 - else: - sign_loc = imm0 - self.perform(op, [base_loc, ofs_loc, imm(itemsize), imm(ofs), - sign_loc], result_loc) - - consider_getarrayitem_gc_i = _consider_getarrayitem - consider_getarrayitem_gc_r = _consider_getarrayitem - consider_getarrayitem_gc_f = _consider_getarrayitem - consider_getarrayitem_raw_i = _consider_getarrayitem - consider_getarrayitem_raw_f = _consider_getarrayitem - consider_getarrayitem_gc_pure_i = _consider_getarrayitem - consider_getarrayitem_gc_pure_r = _consider_getarrayitem - consider_getarrayitem_gc_pure_f = _consider_getarrayitem - consider_raw_load_i = _consider_getarrayitem - consider_raw_load_f = _consider_getarrayitem - def _consider_gc_load(self, op): args = op.getarglist() base_loc = self.rm.make_sure_var_in_reg(op.getarg(0), args) From noreply at buildbot.pypy.org Fri Nov 27 08:57:37 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 27 Nov 2015 14:57:37 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Clean up and add another test Message-ID: <20151127135737.C3FAC1C0400@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r81000:6671b4b7d9b6 Date: 2015-11-27 03:56 +0000 http://bitbucket.org/pypy/pypy/changeset/6671b4b7d9b6/ Log: Clean up and add another test diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py --- a/rpython/annotator/test/test_model.py +++ b/rpython/annotator/test/test_model.py @@ -163,26 +163,36 @@ else: return s_a.contains(s_b) -def test_generalize_getitem(annotator): +def annotate_op(ann, hlop, args_s): + for v_arg, s_arg in zip(hlop.args, args_s): + ann.setbinding(v_arg, s_arg) + with ann.bookkeeper.at_position(None): + try: + ann.consider_op(hlop) + except BlockedInference: + # BlockedInference only stops annotation along the normal path, + # but not along the exceptional one. + pass + return hlop.result.annotation, ann.get_exception(hlop) + +def test_generalize_getitem_dict(annotator): bk = annotator.bookkeeper - v_dict, v_key = Variable(), Variable() - v_key.annotation = SomeInteger() - v_dict.annotation = s_None - hlop = op.getitem(v_dict, v_key) - try: - annotator.consider_op(hlop) - except BlockedInference: - # BlockedInference only stops annotation along the normal path, - # but not along the exceptional one. - pass - v_result = hlop.result - s_result = v_result.annotation - s_result_exc = annotator.get_exception(hlop) + hlop = op.getitem(Variable(), Variable()) + s_int = SomeInteger() with bk.at_position(None): - annotator.setbinding(v_dict, bk.newdict()) - try: - annotator.consider_op(hlop) - except BlockedInference: - pass - assert contains_s(v_result.annotation, s_result) - assert contains_s(annotator.get_exception(hlop), s_result_exc) + s_empty_dict = bk.newdict() + s_value, s_exc = annotate_op(annotator, hlop, [s_None, s_int]) + s_value2, s_exc2 = annotate_op(annotator, hlop, [s_empty_dict, s_int]) + assert contains_s(s_value2, s_value) + assert contains_s(s_exc2, s_exc) + +def test_generalize_getitem_list(annotator): + bk = annotator.bookkeeper + hlop = op.getitem(Variable(), Variable()) + s_int = SomeInteger() + with bk.at_position(None): + s_empty_list = bk.newlist() + s_value, s_exc = annotate_op(annotator, hlop, [s_None, s_int]) + s_value2, s_exc2 = annotate_op(annotator, hlop, [s_empty_list, s_int]) + assert contains_s(s_value2, s_value) + assert contains_s(s_exc2, s_exc) From noreply at buildbot.pypy.org Fri Nov 27 08:57:39 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 27 Nov 2015 14:57:39 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Fix issue with generalizing None[i] to container[i] Message-ID: <20151127135739.E07751C0400@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r81001:eeb513e3c5a1 Date: 2015-11-27 13:57 +0000 http://bitbucket.org/pypy/pypy/changeset/eeb513e3c5a1/ Log: Fix issue with generalizing None[i] to container[i] diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py --- a/rpython/annotator/binaryop.py +++ b/rpython/annotator/binaryop.py @@ -782,6 +782,7 @@ class __extend__(pairtype(SomeNone, SomeObject)): def getitem((none, o)): return s_ImpossibleValue + getitem.can_only_throw = [] def setitem((none, o), s_value): return None From noreply at buildbot.pypy.org Fri Nov 27 08:57:41 2015 From: noreply at buildbot.pypy.org (rlamy) Date: Fri, 27 Nov 2015 14:57:41 +0100 (CET) Subject: [pypy-commit] pypy anntype2: Add more tests Message-ID: <20151127135741.EC14D1C0400@cobra.cs.uni-duesseldorf.de> Author: Ronan Lamy Branch: anntype2 Changeset: r81002:c097d2bd6fdf Date: 2015-11-27 13:57 +0000 http://bitbucket.org/pypy/pypy/changeset/c097d2bd6fdf/ Log: Add more tests diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py --- a/rpython/annotator/test/test_model.py +++ b/rpython/annotator/test/test_model.py @@ -196,3 +196,21 @@ s_value2, s_exc2 = annotate_op(annotator, hlop, [s_empty_list, s_int]) assert contains_s(s_value2, s_value) assert contains_s(s_exc2, s_exc) + +def test_generalize_getitem_string(annotator): + hlop = op.getitem(Variable(), Variable()) + s_int = SomeInteger() + s_str = SomeString(can_be_None=True) + s_value, s_exc = annotate_op(annotator, hlop, [s_None, s_int]) + s_value2, s_exc2 = annotate_op(annotator, hlop, [s_str, s_int]) + assert contains_s(s_value2, s_value) + assert contains_s(s_exc2, s_exc) + +def test_generalize_string_concat(annotator): + hlop = op.add(Variable(), Variable()) + s_str = SomeString(can_be_None=True) + s_value, s_exc = annotate_op(annotator, hlop, [s_None, s_str]) + s_value2, s_exc2 = annotate_op(annotator, hlop, [s_str, s_str]) + assert contains_s(s_value2, s_value) + assert contains_s(s_exc2, s_exc) +