Author: Armin Rigo <[email protected]>
Branch: rpython-hash
Changeset: r89824:d6966f4c0ec7
Date: 2017-01-28 18:03 +0100
http://bitbucket.org/pypy/pypy/changeset/d6966f4c0ec7/
Log: simplify code
diff --git a/rpython/rtyper/rclass.py b/rpython/rtyper/rclass.py
--- a/rpython/rtyper/rclass.py
+++ b/rpython/rtyper/rclass.py
@@ -170,7 +170,6 @@
('subclassrange_max', Signed),
('rtti', Ptr(RuntimeTypeInfo)),
('name', Ptr(rstr.STR)),
- ('hash', Signed),
('instantiate', Ptr(FuncType([], OBJECTPTR))),
hints={'immutable': True}))
# non-gc case
@@ -338,7 +337,6 @@
def fill_vtable_root(self, vtable):
"""Initialize the head of the vtable."""
- vtable.hash = hash(self)
# initialize the 'subclassrange_*' and 'name' fields
if self.classdef is not None:
#vtable.parenttypeptr = self.rbase.getvtable()
diff --git a/rpython/rtyper/rpbc.py b/rpython/rtyper/rpbc.py
--- a/rpython/rtyper/rpbc.py
+++ b/rpython/rtyper/rpbc.py
@@ -16,7 +16,7 @@
from rpython.rtyper.lltypesystem import llmemory
from rpython.rtyper.lltypesystem.lltype import (
typeOf, Void, ForwardReference, Struct, Bool, Char, Ptr, malloc, nullptr,
- Array, Signed, cast_pointer, getfunctionptr)
+ Array, Signed, cast_pointer, getfunctionptr, cast_ptr_to_int)
from rpython.rtyper.rmodel import (Repr, inputconst, CanBeNull, mangle,
warning, impossible_repr)
from rpython.tool.pairtype import pair, pairtype
@@ -1072,10 +1072,7 @@
def ll_cls_hash(cls):
- if not cls:
- return 0
- else:
- return cls.hash
+ return cast_ptr_to_int(cls)
class __extend__(pairtype(ClassesPBCRepr, rclass.ClassRepr)):
def convert_from_to((r_clspbc, r_cls), v, llops):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit