mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
[ruby/mmtk] Pass whether GC is moving to rb_mmtk_update_global_tables
https://github.com/ruby/mmtk/commit/002faa8f92
This commit is contained in:
parent
36809a8d0c
commit
01984fa80e
@ -439,16 +439,15 @@ rb_mmtk_update_global_tables_replace_i(VALUE *ptr, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_mmtk_update_global_tables(int table)
|
rb_mmtk_update_global_tables(int table, bool moving)
|
||||||
{
|
{
|
||||||
MMTK_ASSERT(table < RB_GC_VM_WEAK_TABLE_COUNT);
|
MMTK_ASSERT(table < RB_GC_VM_WEAK_TABLE_COUNT);
|
||||||
|
|
||||||
// TODO: set weak_only to true for non-moving GC
|
|
||||||
rb_gc_vm_weak_table_foreach(
|
rb_gc_vm_weak_table_foreach(
|
||||||
rb_mmtk_update_global_tables_i,
|
rb_mmtk_update_global_tables_i,
|
||||||
rb_mmtk_update_global_tables_replace_i,
|
rb_mmtk_update_global_tables_replace_i,
|
||||||
NULL,
|
NULL,
|
||||||
false,
|
!moving,
|
||||||
(enum rb_gc_vm_weak_tables)table
|
(enum rb_gc_vm_weak_tables)table
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ typedef struct MMTk_RubyUpcalls {
|
|||||||
void (*handle_weak_references)(MMTk_ObjectReference object, bool moving);
|
void (*handle_weak_references)(MMTk_ObjectReference object, bool moving);
|
||||||
void (*call_obj_free)(MMTk_ObjectReference object);
|
void (*call_obj_free)(MMTk_ObjectReference object);
|
||||||
size_t (*vm_live_bytes)(void);
|
size_t (*vm_live_bytes)(void);
|
||||||
void (*update_global_tables)(int tbl_idx);
|
void (*update_global_tables)(int tbl_idx, bool moving);
|
||||||
int (*global_tables_count)(void);
|
int (*global_tables_count)(void);
|
||||||
void (*update_finalizer_table)(void);
|
void (*update_finalizer_table)(void);
|
||||||
bool (*special_const_p)(MMTk_ObjectReference object);
|
bool (*special_const_p)(MMTk_ObjectReference object);
|
||||||
|
|||||||
@ -318,7 +318,7 @@ pub struct RubyUpcalls {
|
|||||||
pub handle_weak_references: extern "C" fn(object: ObjectReference, moving: bool),
|
pub handle_weak_references: extern "C" fn(object: ObjectReference, moving: bool),
|
||||||
pub call_obj_free: extern "C" fn(object: ObjectReference),
|
pub call_obj_free: extern "C" fn(object: ObjectReference),
|
||||||
pub vm_live_bytes: extern "C" fn() -> usize,
|
pub vm_live_bytes: extern "C" fn() -> usize,
|
||||||
pub update_global_tables: extern "C" fn(tbl_idx: c_int),
|
pub update_global_tables: extern "C" fn(tbl_idx: c_int, moving: bool),
|
||||||
pub global_tables_count: extern "C" fn() -> c_int,
|
pub global_tables_count: extern "C" fn() -> c_int,
|
||||||
pub update_finalizer_table: extern "C" fn(),
|
pub update_finalizer_table: extern "C" fn(),
|
||||||
pub special_const_p: extern "C" fn(object: ObjectReference) -> bool,
|
pub special_const_p: extern "C" fn(object: ObjectReference) -> bool,
|
||||||
|
|||||||
@ -270,7 +270,10 @@ struct UpdateGlobalTables {
|
|||||||
}
|
}
|
||||||
impl GlobalTableProcessingWork for UpdateGlobalTables {
|
impl GlobalTableProcessingWork for UpdateGlobalTables {
|
||||||
fn process_table(&mut self) {
|
fn process_table(&mut self) {
|
||||||
(crate::upcalls().update_global_tables)(self.idx)
|
(crate::upcalls().update_global_tables)(
|
||||||
|
self.idx,
|
||||||
|
crate::mmtk().get_plan().current_gc_may_move_object(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl GCWork<Ruby> for UpdateGlobalTables {
|
impl GCWork<Ruby> for UpdateGlobalTables {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user