Skip to content

Commit c96bbaa

Browse files
committed
remove debug code
1 parent 829f4cf commit c96bbaa

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

crates/luars/src/gc/mod.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,13 +1320,7 @@ impl GC {
13201320
LuaValueKind::Table => {
13211321
if let Some(id) = value.as_table_id() {
13221322
if let Some(t) = pool.tables.get(id.0) {
1323-
let is_white = t.header.is_white();
1324-
let is_fixed = t.header.is_fixed();
1325-
eprintln!(
1326-
"[GC] is_value_dead: table {} is_white={} is_fixed={}",
1327-
id.0, is_white, is_fixed
1328-
);
1329-
return !is_fixed && is_white;
1323+
return !t.header.is_fixed() && t.header.is_white();
13301324
}
13311325
}
13321326
false
@@ -1366,7 +1360,6 @@ impl GC {
13661360
// Collect tables with weak mode and their entries to remove
13671361
let mut tables_to_clear: Vec<(u32, Vec<LuaValue>)> = Vec::new();
13681362
let mut total_cleared = 0;
1369-
let mut weak_tables_found = 0;
13701363

13711364
for (id, table) in pool.tables.iter() {
13721365
// Check if this table has a metatable with __mode
@@ -1375,21 +1368,12 @@ impl GC {
13751368
// Look for __mode key in metatable
13761369
let mode = self.get_weak_mode(mt, pool);
13771370
if let Some((weak_keys, weak_values)) = mode {
1378-
weak_tables_found += 1;
13791371
// Collect keys to remove
13801372
let mut keys_to_remove = Vec::new();
13811373
for (key, value) in table.data.iter_all() {
13821374
let key_dead = weak_keys && self.is_value_dead(&key, pool);
13831375
let value_dead = weak_values && self.is_value_dead(&value, pool);
13841376

1385-
// Debug: print value status
1386-
if weak_values {
1387-
eprintln!(
1388-
"[GC] weak table entry: value_dead={}, value={:?}",
1389-
value_dead, value
1390-
);
1391-
}
1392-
13931377
if key_dead || value_dead {
13941378
keys_to_remove.push(key);
13951379
}
@@ -1402,8 +1386,6 @@ impl GC {
14021386
}
14031387
}
14041388

1405-
eprintln!("[GC] found {} weak tables", weak_tables_found);
1406-
14071389
// Now actually remove the entries
14081390
for (table_id, keys) in tables_to_clear {
14091391
if let Some(table) = pool.tables.get_mut(table_id) {

crates/luars/src/lua_vm/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,8 +2130,6 @@ impl LuaVM {
21302130
if self.gc.gc_debt <= 0 {
21312131
return;
21322132
}
2133-
// Debug: print when GC is triggered
2134-
eprintln!("[GC] debt={} triggering GC step", self.gc.gc_debt);
21352133
// Slow path: actual GC work
21362134
self.check_gc_slow();
21372135
}

lua_tests/testes/closure.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ local function f(x)
3131
end
3232

3333
local a = f(10)
34+
print("f(10)")
3435
-- force a GC in this level
3536
local x = {[1] = {}} -- to detect a GC
3637
setmetatable(x, {__mode = 'kv'})
@@ -49,7 +50,7 @@ assert(a[8]() == 10+A)
4950
assert(getmetatable(x).__mode == 'kv')
5051
assert(B.g == 19)
5152

52-
53+
print("B.g == 19")
5354
-- testing equality
5455
a = {}
5556

0 commit comments

Comments
 (0)