[pypy-commit] pypy gc_no_cleanup_nursery: remove _clear() from gc functions and operations and passed test_gc_transform
wenzhuman
noreply at buildbot.pypy.org
Thu Jun 26 22:06:12 CEST 2014
Author: wenzhuman <manwenzhu at gmail.com>
Branch: gc_no_cleanup_nursery
Changeset: r72247:9f27ec7bf56e
Date: 2014-06-26 16:03 -0400
http://bitbucket.org/pypy/pypy/changeset/9f27ec7bf56e/
Log: remove _clear() from gc functions and operations and passed
test_gc_transform
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
@@ -410,7 +410,7 @@
if self.DEBUG:
self._random_usage_of_xmm_registers()
type_id = rffi.cast(llgroup.HALFWORD, 0) # missing here
- return llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
+ return llop1.do_malloc_fixedsize(llmemory.GCREF,
type_id, size,
False, False, False)
@@ -423,7 +423,7 @@
assert num_elem >= 0, 'num_elem should be >= 0'
type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
check_typeid(type_id)
- return llop1.do_malloc_varsize_clear(
+ return llop1.do_malloc_varsize(
llmemory.GCREF,
type_id, num_elem, self.standard_array_basesize, itemsize,
self.standard_array_length_ofs)
@@ -437,7 +437,7 @@
occur e.g. with arrays of floats on Win32."""
type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
check_typeid(type_id)
- return llop1.do_malloc_varsize_clear(
+ return llop1.do_malloc_varsize(
llmemory.GCREF,
type_id, num_elem, basesize, itemsize, lengthofs)
self.generate_function('malloc_array_nonstandard',
@@ -455,7 +455,7 @@
def malloc_str(length):
type_id = llop.extract_ushort(llgroup.HALFWORD, str_type_id)
- return llop1.do_malloc_varsize_clear(
+ return llop1.do_malloc_varsize(
llmemory.GCREF,
type_id, length, str_basesize, str_itemsize,
str_ofs_length)
@@ -464,7 +464,7 @@
def malloc_unicode(length):
type_id = llop.extract_ushort(llgroup.HALFWORD, unicode_type_id)
- return llop1.do_malloc_varsize_clear(
+ return llop1.do_malloc_varsize(
llmemory.GCREF,
type_id, length, unicode_basesize, unicode_itemsize,
unicode_ofs_length)
@@ -479,7 +479,7 @@
self._random_usage_of_xmm_registers()
type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
check_typeid(type_id)
- return llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
+ return llop1.do_malloc_fixedsize(llmemory.GCREF,
type_id, size,
False, False, False)
self.generate_function('malloc_big_fixedsize', malloc_big_fixedsize,
@@ -490,7 +490,7 @@
llop1 = self.llop1
type_id = llop.extract_ushort(llgroup.HALFWORD, sizedescr.tid)
check_typeid(type_id)
- return llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
+ return llop1.do_malloc_fixedsize(llmemory.GCREF,
type_id, sizedescr.size,
False, False, False)
@@ -499,7 +499,7 @@
llop1 = self.llop1
type_id = llop.extract_ushort(llgroup.HALFWORD, arraydescr.tid)
check_typeid(type_id)
- return llop1.do_malloc_varsize_clear(llmemory.GCREF,
+ return llop1.do_malloc_varsize(llmemory.GCREF,
type_id, num_elem,
arraydescr.basesize,
arraydescr.itemsize,
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -520,7 +520,7 @@
debug_stop("gc-debug")
- def malloc_fixedsize_clear(self, typeid, size,
+ def malloc_fixedsize(self, typeid, size,
needs_finalizer=False,
is_finalizer_light=False,
contains_weakptr=False):
@@ -572,7 +572,7 @@
return llmemory.cast_adr_to_ptr(obj, llmemory.GCREF)
- def malloc_varsize_clear(self, typeid, length, size, itemsize,
+ def malloc_varsize(self, typeid, length, size, itemsize,
offset_to_length):
size_gc_header = self.gcheaderbuilder.size_gc_header
nonvarsize = size_gc_header + size
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
@@ -273,16 +273,17 @@
s_gcref = SomePtr(llmemory.GCREF)
gcdata = self.gcdata
translator = self.translator
+ if hasattr(GCClass, 'malloc_fixedsize_clear'):
+ malloc_fixedsize_clear_meth = GCClass.malloc_fixedsize_clear.im_func
+ self.malloc_fixedsize_clear_ptr = getfn(
+ malloc_fixedsize_clear_meth,
+ [s_gc, s_typeid16,
+ annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeBool(),
+ annmodel.SomeBool(),
+ annmodel.SomeBool()], s_gcref,
+ inline = False)
- malloc_fixedsize_clear_meth = GCClass.malloc_fixedsize_clear.im_func
- self.malloc_fixedsize_clear_ptr = getfn(
- malloc_fixedsize_clear_meth,
- [s_gc, s_typeid16,
- annmodel.SomeInteger(nonneg=True),
- annmodel.SomeBool(),
- annmodel.SomeBool(),
- annmodel.SomeBool()], s_gcref,
- inline = False)
if hasattr(GCClass, 'malloc_fixedsize'):
malloc_fixedsize_meth = GCClass.malloc_fixedsize.im_func
self.malloc_fixedsize_ptr = getfn(
@@ -296,10 +297,16 @@
else:
malloc_fixedsize_meth = None
self.malloc_fixedsize_ptr = self.malloc_fixedsize_clear_ptr
- self.malloc_varsize_clear_ptr = getfn(
- GCClass.malloc_varsize_clear.im_func,
- [s_gc, s_typeid16]
- + [annmodel.SomeInteger(nonneg=True) for i in range(4)], s_gcref)
+ if hasattr(GCClass, 'malloc_varsize'):
+ self.malloc_varsize_ptr = getfn(
+ GCClass.malloc_varsize.im_func,
+ [s_gc, s_typeid16]
+ + [annmodel.SomeInteger(nonneg=True) for i in range(4)], s_gcref)
+ else:
+ self.malloc_varsize_ptr = getfn(
+ GCClass.malloc_varsize_clear.im_func,
+ [s_gc, s_typeid16]
+ + [annmodel.SomeInteger(nonneg=True) for i in range(4)], s_gcref)
self.collect_ptr = getfn(GCClass.collect.im_func,
[s_gc, annmodel.SomeInteger()], annmodel.s_None)
self.can_move_ptr = getfn(GCClass.can_move.im_func,
@@ -358,24 +365,28 @@
# in some GCs we can also inline the common case of
# malloc_varsize(typeid, length, (3 constant sizes), True, False)
+ self.malloc_varsize_fast_ptr = None
if getattr(GCClass, 'inline_simple_malloc_varsize', False):
# make a copy of this function so that it gets annotated
# independently and the constants are folded inside
- malloc_varsize_clear_fast = func_with_new_name(
- GCClass.malloc_varsize_clear.im_func,
- "malloc_varsize_clear_fast")
+ if hasattr(GCClass, 'malloc_varsize'):
+ malloc_varsize_fast = func_with_new_name(
+ GCClass.malloc_varsize.im_func,
+ "malloc_varsize_fast")
+ elif hasattr(GCClass, 'malloc_varsize_clear'):
+ malloc_varsize_fast = func_with_new_name(
+ GCClass.malloc_varsize_clear.im_func,
+ "malloc_varsize_clear_fast")
s_False = annmodel.SomeBool()
s_False.const = False
- self.malloc_varsize_clear_fast_ptr = getfn(
- malloc_varsize_clear_fast,
+ self.malloc_varsize_fast_ptr = getfn(
+ malloc_varsize_fast,
[s_gc, s_typeid16,
- annmodel.SomeInteger(nonneg=True),
- annmodel.SomeInteger(nonneg=True),
- annmodel.SomeInteger(nonneg=True),
- annmodel.SomeInteger(nonneg=True)], s_gcref,
+ annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True),
+ annmodel.SomeInteger(nonneg=True)], s_gcref,
inline = True)
- else:
- self.malloc_varsize_clear_fast_ptr = None
if getattr(GCClass, 'malloc_varsize_nonmovable', False):
malloc_nonmovable = func_with_new_name(
@@ -654,14 +665,15 @@
has_light_finalizer)
if not op.opname.endswith('_varsize') and not flags.get('varsize'):
- #malloc_ptr = self.malloc_fixedsize_ptr
zero = flags.get('zero', False)
if (self.malloc_fast_ptr is not None and
not c_has_finalizer.value and
(self.malloc_fast_is_clearing or not zero)):
malloc_ptr = self.malloc_fast_ptr
- elif zero:
- malloc_ptr = self.malloc_fixedsize_clear_ptr
+
+ #elif zero:
+ #malloc_ptr = self.malloc_fixedsize_clear_ptr
+
else:
malloc_ptr = self.malloc_fixedsize_ptr
args = [self.c_const_gc, c_type_id, c_size,
@@ -681,10 +693,10 @@
malloc_ptr = self.malloc_varsize_nonmovable_ptr
args = [self.c_const_gc, c_type_id, v_length]
else:
- if self.malloc_varsize_clear_fast_ptr is not None:
- malloc_ptr = self.malloc_varsize_clear_fast_ptr
+ if self.malloc_varsize_fast_ptr is not None:
+ malloc_ptr = self.malloc_varsize_fast_ptr
else:
- malloc_ptr = self.malloc_varsize_clear_ptr
+ malloc_ptr = self.malloc_varsize_ptr
args = [self.c_const_gc, c_type_id, v_length, c_size,
c_varitemsize, c_ofstolength]
livevars = self.push_roots(hop)
@@ -830,28 +842,28 @@
hop.genop("direct_call",
[self.root_walker.gc_start_fresh_new_state_ptr])
- def gct_do_malloc_fixedsize_clear(self, hop):
+ def gct_do_malloc_fixedsize(self, hop):
# used by the JIT (see rpython.jit.backend.llsupport.gc)
op = hop.spaceop
[v_typeid, v_size,
v_has_finalizer, v_has_light_finalizer, v_contains_weakptr] = op.args
livevars = self.push_roots(hop)
hop.genop("direct_call",
- [self.malloc_fixedsize_clear_ptr, self.c_const_gc,
+ [self.malloc_fixedsize_ptr, self.c_const_gc,
v_typeid, v_size,
v_has_finalizer, v_has_light_finalizer,
v_contains_weakptr],
resultvar=op.result)
self.pop_roots(hop, livevars)
- def gct_do_malloc_varsize_clear(self, hop):
+ def gct_do_malloc_varsize(self, hop):
# used by the JIT (see rpython.jit.backend.llsupport.gc)
op = hop.spaceop
[v_typeid, v_length, v_size, v_itemsize,
v_offset_to_length] = op.args
livevars = self.push_roots(hop)
hop.genop("direct_call",
- [self.malloc_varsize_clear_ptr, self.c_const_gc,
+ [self.malloc_varsize_ptr, self.c_const_gc,
v_typeid, v_length, v_size, v_itemsize,
v_offset_to_length],
resultvar=op.result)
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
@@ -450,8 +450,8 @@
'jit_conditional_call': LLOp(),
'get_exception_addr': LLOp(),
'get_exc_value_addr': LLOp(),
- 'do_malloc_fixedsize_clear':LLOp(canmallocgc=True),
- 'do_malloc_varsize_clear': LLOp(canmallocgc=True),
+ 'do_malloc_fixedsize':LLOp(canmallocgc=True),
+ 'do_malloc_varsize': LLOp(canmallocgc=True),
'get_write_barrier_failing_case': LLOp(sideeffects=False),
'get_write_barrier_from_array_failing_case': LLOp(sideeffects=False),
'gc_get_type_info_group': LLOp(sideeffects=False),
More information about the pypy-commit
mailing list