예제 #1
0
파일: test_newgc.py 프로젝트: yuyichao/pypy
 def define_hash_varsized(self):
     S = lltype.GcStruct('S', ('abc', lltype.Signed),
                              ('def', lltype.Array(lltype.Signed)))
     s = lltype.malloc(S, 3, zero=True)
     h_s = lltype.identityhash(s)
     def f():
         return lltype.identityhash(s) - h_s    # != 0 (so far),
                             # because S is a varsized structure.
     return f
예제 #2
0
def hash_whatever(TYPE, x):
    # Hash of lltype object.
    # Only supports strings, unicodes and regular instances,
    # as well as primitives that can meaningfully be cast to Signed.
    if isinstance(TYPE, lltype.Ptr) and TYPE.TO._gckind == 'gc':
        if TYPE.TO is rstr.STR or TYPE.TO is rstr.UNICODE:
            return rstr.LLHelpers.ll_strhash(x)    # assumed not null
        else:
            if x:
                return lltype.identityhash(x)
            else:
                return 0
    else:
        return rffi.cast(lltype.Signed, x)
예제 #3
0
def hash_whatever(TYPE, x):
    # Hash of lltype object.
    # Only supports strings, unicodes and regular instances,
    # as well as primitives that can meaningfully be cast to Signed.
    if isinstance(TYPE, lltype.Ptr) and TYPE.TO._gckind == 'gc':
        if TYPE.TO is rstr.STR or TYPE.TO is rstr.UNICODE:
            return rstr.LLHelpers.ll_strhash(x)    # assumed not null
        else:
            if x:
                return lltype.identityhash(x)
            else:
                return 0
    else:
        return rffi.cast(lltype.Signed, x)
예제 #4
0
 def op_gc_identityhash(self, obj):
     return lltype.identityhash(obj)
예제 #5
0
 def _get_hash_(self):
     if self.value:
         return lltype.identityhash(self.value)
     else:
         return 0
예제 #6
0
파일: typesystem.py 프로젝트: sota/pypy-old
def rd_hash(ref):
    assert ref
    return lltype.identityhash(ref)
예제 #7
0
파일: llinterp.py 프로젝트: pypyjs/pypy
 def op_gc_identityhash(self, obj):
     return lltype.identityhash(obj)
예제 #8
0
 def ll_my_gethash(ptr):
     return identityhash(ptr)  # from lltype
예제 #9
0
파일: support.py 프로젝트: sczfaker/pypy
def _ll_1_gc_identityhash(x):
    return lltype.identityhash(x)
예제 #10
0
def ll_inst_hash(ins):
    if not ins:
        return 0  # for None
    else:
        return lltype.identityhash(ins)
예제 #11
0
파일: history.py 프로젝트: soIu/rpython
 def _get_hash_(self):
     if self.value:
         return lltype.identityhash(self.value)
     else:
         return 0
예제 #12
0
def ll_inst_hash(ins):
    if not ins:
        return 0    # for None
    else:
        return lltype.identityhash(ins)
예제 #13
0
def ll_inst_hash(ins):
    if not ins:
        return 0    # for None
    else:
        from rpython.rtyper.lltypesystem import lltype
        return lltype.identityhash(ins)
예제 #14
0
파일: test_rclass.py 프로젝트: charred/pypy
 def ll_my_gethash(ptr):
     return identityhash(ptr)    # from lltype
예제 #15
0
파일: support.py 프로젝트: Qointum/pypy
def _ll_1_gc_identityhash(x):
    return lltype.identityhash(x)
예제 #16
0
파일: test_newgc.py 프로젝트: yuyichao/pypy
 def f():
     return lltype.identityhash(s) - h_s    # != 0 (so far),