Пример #1
0
 def f(n, m):
     a = f1(n, m)
     b = f2(n, m)
     c = f3(n, m)
     d = f4(n, m)
     enable_siphash24()
     return a + len(b) + c + d
Пример #2
0
    def entry_point(argv):
        if withjit:
            from rpython.jit.backend.hlinfo import highleveljitinfo
            highleveljitinfo.sys_executable = argv[0]

        if hashfunc == "siphash24":
            from rpython.rlib import rsiphash
            rsiphash.enable_siphash24()

        #debug("entry point starting")
        #for arg in argv:
        #    debug(" argv -> " + arg)
        if len(argv) > 2 and argv[1] == '--heapsize':
            # Undocumented option, handled at interp-level.
            # It has silently no effect with some GCs.
            # It works in Boehm and in the semispace or generational GCs
            # (but see comments in semispace.py:set_max_heap_size()).
            # At the moment this option exists mainly to support sandboxing.
            from rpython.rlib import rgc
            rgc.set_max_heap_size(int(argv[2]))
            argv = argv[:1] + argv[3:]
        try:
            try:
                space.startup()
                if rlocale.HAVE_LANGINFO:
                    try:
                        rlocale.setlocale(rlocale.LC_CTYPE, '')
                    except rlocale.LocaleError:
                        pass
                w_executable = space.newfilename(argv[0])
                w_argv = space.newlist(
                    [space.newfilename(s) for s in argv[1:]])
                w_exitcode = space.call_function(w_entry_point, w_executable,
                                                 w_argv)
                exitcode = space.int_w(w_exitcode)
                # try to pull it all in
            ##    from pypy.interpreter import main, interactive, error
            ##    con = interactive.PyPyConsole(space)
            ##    con.interact()
            except OperationError as e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " +
                      space.text_w(space.str(e.get_w_value(space))))
                return 1
        finally:
            try:
                # the equivalent of Py_FinalizeEx
                if space.finish() < 0:
                    # Value unlikely to be confused with a non-error exit status
                    # or other special meaning (from cpython/Modules/main.c)
                    exitcode = 120
            except OperationError as e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " +
                      space.text_w(space.str(e.get_w_value(space))))
                return 1
        return exitcode
Пример #3
0
 def fn(n):
     from rpython.rlib import rsiphash
     rsiphash.enable_siphash24()
     #assert str(n) not in prebuilt_d <- this made the test pass,
     #       before the fix which was that iterkeys_with_hash()
     #       didn't do the initial rehashing on its own
     for key, h in objectmodel.iterkeys_with_hash(prebuilt_d):
         print key, h
         assert h == compute_hash(key)
     return 42
Пример #4
0
 def entrypoint(n):
     enable_siphash24()
     g.v1["bar"] = -2
     g.v2[u"bar"] = -2
     if n >= 0:    # get items one by one, because otherwise it may
                   # be the case that one line influences the next
         return str(fetch(n))
     else:
         # ...except in random mode, because we want all results
         # to be computed with the same seed
         return ' '.join([str(fetch(n)) for n in range(9)])
Пример #5
0
 def fn(length):
     if algo == "siphash24":
         from rpython.rlib import rsiphash
         rsiphash.enable_siphash24()
     assert length >= 1
     return str((
         compute_hash(s),
         compute_hash(u),
         compute_hash(v),
         compute_hash(s[0] + s[1:length]),
         compute_hash(u[0] + u[1:length]),
         compute_hash(v[0] + v[1:length]),
     ))
Пример #6
0
    def entry_point(argv):
        if withjit:
            from rpython.jit.backend.hlinfo import highleveljitinfo
            highleveljitinfo.sys_executable = argv[0]

        if hashfunc == "siphash24":
            from rpython.rlib import rsiphash
            rsiphash.enable_siphash24()

        #debug("entry point starting")
        #for arg in argv:
        #    debug(" argv -> " + arg)
        if len(argv) > 2 and argv[1] == '--heapsize':
            # Undocumented option, handled at interp-level.
            # It has silently no effect with some GCs.
            # It works in Boehm and in the semispace or generational GCs
            # (but see comments in semispace.py:set_max_heap_size()).
            # At the moment this option exists mainly to support sandboxing.
            from rpython.rlib import rgc
            rgc.set_max_heap_size(int(argv[2]))
            argv = argv[:1] + argv[3:]
        try:
            try:
                space.startup()
                w_executable = space.newtext(argv[0])
                w_argv = space.newlist([space.newtext(s) for s in argv[1:]])
                w_exitcode = space.call_function(w_entry_point, w_executable,
                                                 w_argv)
                exitcode = space.int_w(w_exitcode)
                # try to pull it all in
            ##    from pypy.interpreter import main, interactive, error
            ##    con = interactive.PyPyConsole(space)
            ##    con.interact()
            except OperationError as e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " +
                      space.text_w(space.str(e.get_w_value(space))))
                return 1
        finally:
            try:
                space.finish()
            except OperationError as e:
                debug("OperationError:")
                debug(" operror-type: " + e.w_type.getname(space))
                debug(" operror-value: " +
                      space.text_w(space.str(e.get_w_value(space))))
                return 1
        return exitcode
Пример #7
0
 def f():
     rsiphash.enable_siphash24()
     i = nonconst.NonConstant(1)
     assert d.get("key%d" % (i,)) is x1
     assert d.get("key%d" % (i+1,)) is x2