On 30/03/2012 11:03, Paolo Bonzini wrote:
Il 30/03/2012 10:53, Gwenaël Casaccio ha scritto:
Hi,
Here is a patch that allocate large objects on the fixed space,
it improves the gc compact steps by making them fixed.
You also made them young in a patch that was reverted a while ago
(commit c51f7d2, do not automatically tenure large objects). Can this
be reapplied with the grey pages fix?
I think I would apply that patch as a first step, as I've said on irc
the fixed
objects in the new generation are scanned twice, first time
during the grey page scanning and after during the cheney
scan. And they are only freed during the sweep steps.
But as you've correctly said they are not scanned if they are byte objects.
A solution is to avoid - only when scavenge - to visit the fixed objects
but to tag them; after the untaged one are added in a queue and free
at the end of the scavenge. But step by step the gc is a complex
and fragile piece of code!
The patch is tested with the following code (from Ladislav Marek thanks :-)
and make check:
set := WeakSet new.
set2 := WeakSet new.
1 to: 80000 do: [ :i |
obj := Object new.
set add: obj.
set2 add: obj.
obj := nil.
].
I've also changed the basicFixedNew and basicFixedNewWith
primitives. They allocate directly objects on the fixed space
unlike the old implementation that allocate them and move them
in the fixed space.
This should be a separate patch. I think indirect function calls hurt
on a fast path.
Thanks
Paolo
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
diff --git a/libgst/oop.c b/libgst/oop.c
index ea52d4e..860cfd3 100644
--- a/libgst/oop.c
+++ b/libgst/oop.c
@@ -765,7 +765,7 @@ _gst_alloc_obj (size_t size,
newAllocPtr = _gst_mem.eden.allocPtr + BYTES_TO_SIZE (size);
if UNCOMMON (size >= _gst_mem.big_object_threshold)
- return _gst_alloc_old_obj (size, p_oop);
+ return _gst_alloc_fixed_obj (size, p_oop);
if UNCOMMON (newAllocPtr >= _gst_mem.eden.maxPtr)
{
@@ -782,25 +782,25 @@ _gst_alloc_obj (size_t size,
}
gst_object
-_gst_alloc_old_obj (size_t size,
+_gst_alloc_fixed_obj (size_t size,
OOP *p_oop)
{
gst_object p_instance;
size = ROUNDED_BYTES (size);
- /* If the object is big enough, we put it directly in oldspace. */
- p_instance = (gst_object) _gst_mem_alloc (_gst_mem.old, size);
+ /* If the object is big enough, we put it directly in fixedspace. */
+ p_instance = (gst_object) _gst_mem_alloc (_gst_mem.fixed, size);
if COMMON (p_instance)
goto ok;
_gst_global_gc (size);
- p_instance = (gst_object) _gst_mem_alloc (_gst_mem.old, size);
+ p_instance = (gst_object) _gst_mem_alloc (_gst_mem.fixed, size);
if COMMON (p_instance)
goto ok;
_gst_compact (0);
- p_instance = (gst_object) _gst_mem_alloc (_gst_mem.old, size);
+ p_instance = (gst_object) _gst_mem_alloc (_gst_mem.fixed, size);
if UNCOMMON (!p_instance)
{
/* !!! do something more reasonable in the future */
@@ -809,7 +809,7 @@ _gst_alloc_old_obj (size_t size,
}
ok:
- *p_oop = alloc_oop (p_instance, F_OLD);
+ *p_oop = alloc_oop (p_instance, F_FIXED | F_OLD);
p_instance->objSize = FROM_INT (BYTES_TO_SIZE (size));
return p_instance;
}
diff --git a/libgst/oop.h b/libgst/oop.h
index c20dfc3..f732d87 100644
--- a/libgst/oop.h
+++ b/libgst/oop.h
@@ -415,8 +415,8 @@ extern gst_object _gst_alloc_obj (size_t size,
OOP *p_oop)
ATTRIBUTE_HIDDEN;
-/* The same, but for an oldspace object */
-extern gst_object _gst_alloc_old_obj (size_t size,
+/* The same, but for an fixedspace object */
+extern gst_object _gst_alloc_fixed_obj (size_t size,
OOP *p_oop)
ATTRIBUTE_HIDDEN;
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk