Author: David Schneider <[email protected]>
Branch: disable_merge_different_int_types
Changeset: r49689:f66f9c00f119
Date: 2011-11-23 15:25 +0100
http://bitbucket.org/pypy/pypy/changeset/f66f9c00f119/
Log: (arigo, bivab): more fixes
diff --git a/pypy/annotation/model.py b/pypy/annotation/model.py
--- a/pypy/annotation/model.py
+++ b/pypy/annotation/model.py
@@ -591,13 +591,11 @@
immutable = True
def __init__(self, method):
self.method = method
-
-NUMBER = object()
+
annotation_to_ll_map = [
(SomeSingleFloat(), lltype.SingleFloat),
(s_None, lltype.Void), # also matches SomeImpossibleValue()
(s_Bool, lltype.Bool),
- (SomeInteger(knowntype=r_ulonglong), NUMBER),
(SomeFloat(), lltype.Float),
(SomeLongFloat(), lltype.LongFloat),
(SomeChar(), lltype.Char),
@@ -623,10 +621,11 @@
return lltype.Ptr(p.PARENTTYPE)
if isinstance(s_val, SomePtr):
return s_val.ll_ptrtype
+ if type(s_val) is SomeInteger:
+ return lltype.build_number(None, s_val.knowntype)
+
for witness, T in annotation_to_ll_map:
if witness.contains(s_val):
- if T is NUMBER:
- return lltype.build_number(None, s_val.knowntype)
return T
if info is None:
info = ''
@@ -635,7 +634,7 @@
raise ValueError("%sshould return a low-level type,\ngot instead %r" % (
info, s_val))
-ll_to_annotation_map = dict([(ll, ann) for ann, ll in annotation_to_ll_map if
ll is not NUMBER])
+ll_to_annotation_map = dict([(ll, ann) for ann, ll in annotation_to_ll_map])
def lltype_to_annotation(T):
try:
diff --git a/pypy/rpython/memory/gc/minimark.py
b/pypy/rpython/memory/gc/minimark.py
--- a/pypy/rpython/memory/gc/minimark.py
+++ b/pypy/rpython/memory/gc/minimark.py
@@ -711,7 +711,7 @@
#
# Record the newly allocated object and its full malloced size.
# The object is young or old depending on the argument.
- self.rawmalloced_total_size += allocsize
+ self.rawmalloced_total_size += r_uint(allocsize)
if can_make_young:
if not self.young_rawmalloced_objects:
self.young_rawmalloced_objects = self.AddressDict()
@@ -886,8 +886,8 @@
#return (num_bits + (LONG_BIT - 1)) >> LONG_BIT_SHIFT
# --- Optimized version:
return intmask(
- ((r_uint(length) + ((LONG_BIT << self.card_page_shift) - 1)) >>
- (self.card_page_shift + LONG_BIT_SHIFT)))
+ ((r_uint(length) + r_uint((LONG_BIT << self.card_page_shift) - 1)) >>
+ (self.card_page_shift + LONG_BIT_SHIFT)))
def card_marking_bytes_for_length(self, length):
# --- Unoptimized version:
@@ -895,7 +895,7 @@
#return (num_bits + 7) >> 3
# --- Optimized version:
return intmask(
- ((r_uint(length) + ((8 << self.card_page_shift) - 1)) >>
+ ((r_uint(length) + r_uint((8 << self.card_page_shift) - 1)) >>
(self.card_page_shift + 3)))
def debug_check_consistency(self):
@@ -1523,7 +1523,7 @@
llarena.arena_reserve(arena, totalsize)
#
size_gc_header = self.gcheaderbuilder.size_gc_header
- self.rawmalloced_total_size += raw_malloc_usage(totalsize)
+ self.rawmalloced_total_size += r_uint(raw_malloc_usage(totalsize))
self.old_rawmalloced_objects.append(arena + size_gc_header)
return arena
@@ -1689,7 +1689,7 @@
allocsize += extra_words * WORD
#
llarena.arena_free(arena)
- self.rawmalloced_total_size -= allocsize
+ self.rawmalloced_total_size -= r_uint(allocsize)
def free_unvisited_rawmalloc_objects(self):
list = self.old_rawmalloced_objects
diff --git a/pypy/rpython/memory/gc/minimarkpage.py
b/pypy/rpython/memory/gc/minimarkpage.py
--- a/pypy/rpython/memory/gc/minimarkpage.py
+++ b/pypy/rpython/memory/gc/minimarkpage.py
@@ -149,7 +149,7 @@
ll_assert(nsize > 0, "malloc: size is null or negative")
ll_assert(nsize <= self.small_request_threshold,"malloc: size too big")
ll_assert((nsize & (WORD-1)) == 0, "malloc: size is not aligned")
- self.total_memory_used += nsize
+ self.total_memory_used += r_uint(nsize)
#
# Get the page to use from the size
size_class = nsize >> WORD_POWER_2
@@ -474,7 +474,7 @@
obj += block_size
#
# Update the global total size of objects.
- self.total_memory_used += surviving * block_size
+ self.total_memory_used += r_uint(surviving * block_size)
#
# Return the number of surviving objects.
return surviving
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit