File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,10 +69,9 @@ void GC::gc() {
6969#ifdef LOX_GC_DEBUG
7070 std::cerr << " \n\n\n GC: starting mark-and-sweep\n " ;
7171 // list_objects();
72- #endif
73-
7472 size_t nobjs_deleted = 0 ;
7573 size_t nbytes_deleted = 0 ;
74+ #endif
7675
7776 // Propagate grey markings forward.
7877 while (!grey_stack.empty ()) {
@@ -147,10 +146,12 @@ void GC::gc() {
147146 // Delete
148147 size_t bytes = objptr->size ;
149148 bytes_allocated -= bytes;
150- nbytes_deleted += bytes;
151149 delete objptr;
152- nobjs_deleted++;
153150 objptr = next;
151+ #ifdef LOX_GC_DEBUG
152+ nbytes_deleted += bytes;
153+ nobjs_deleted++;
154+ #endif
154155
155156 } else {
156157 // Reachable object. Unmark it.
Original file line number Diff line number Diff line change 1- var a = "b";
2-
3- for (var i = 0; i < 10; i = i + 1) {
4- a = a + "b" + "y";
1+ fun add(a, b) { return a + b; }
2+ fun bench() {
3+ var result = 0;
4+ for (var i = 0; i < 10000000; i = i + 1) {
5+ result = add(result, 1);
6+ }
7+ return result;
58}
6-
7- print a;
9+ print bench();
You can’t perform that action at this time.
0 commit comments