void MemoryManager::sweep() { assert(!sweeping()); if (debug) checkHeap(); if (debug) traceHeap(); m_sweeping = true; SCOPE_EXIT { m_sweeping = false; }; DEBUG_ONLY size_t num_sweepables = 0, num_natives = 0; // iterate until both sweep lists are empty. Entries can be added or // removed from either list during sweeping. do { while (!m_sweepables.empty()) { num_sweepables++; auto obj = m_sweepables.next(); obj->unregister(); obj->sweep(); } while (!m_natives.empty()) { num_natives++; assert(m_natives.back()->sweep_index == m_natives.size() - 1); auto node = m_natives.back(); m_natives.pop_back(); auto obj = Native::obj(node); auto ndi = obj->getVMClass()->getNativeDataInfo(); ndi->sweep(obj); // trash the native data but leave the header and object parsable assert(memset(node+1, kSmartFreeFill, node->obj_offset - sizeof(*node))); } } while (!m_sweepables.empty()); TRACE(1, "sweep: sweepable %lu native %lu\n", num_sweepables, num_natives); if (debug) checkHeap(); }
int main() { vec v1(1, 1), v2(0, 2); cout << "vec1(1,1) cross vec2(0,2): " << cross(v1, v2) << endl << endl; node p0(0, 0), p1(0, 1), p2(1, 2), p3(2, 1), p4(2, 0), p5(1, 0), p6(1, 1); node s[7]; s[0] = p4, s[1] = p3, s[2] = p2, s[3] = p1, s[4] = p0, s[5] = p5, s[6] = p6; segment l0(p0, p3), l1(p5, p6), l2(p6, p4), l3(p1, p2); test_segment(l0, l1); test_segment(l1, l2); test_segment(l0, l3); segment ll[4]; ll[0] = l0, ll[1] = l1, ll[2] = l2, ll[3] = l3; for(int i = 0; i < 4; ++ i) { ll[i].s_lt.n_idx = i; ll[i].s_rt.n_idx = i; ll[i].s_lt.n_lt = 1; ll[i].s_rt.n_lt = 0; } cout << "sweeping:" << endl; for(int i = 0; i < 4; ++ i) ll[i].s_print(); if(sweeping(ll, 4)) cout << "yes" << endl; else cout << "no" << endl; return(0); }
void MemoryManager::sweep() { assert(!sweeping()); m_sweeping = true; SCOPE_EXIT { m_sweeping = false; }; Sweepable::SweepAll(); Native::sweepNativeData(); }
void MainWindow::on_sweepingButton_released() { DialogSweeping sweeping(this); if(sweeping.exec()) ui->glwidget->sweep( sweeping.getX(), sweeping.getY(), sweeping.getZ() ); ui->glwidget->updateGL(); }
void MemoryManager::sweep() { assert(!sweeping()); m_sweeping = true; SCOPE_EXIT { m_sweeping = false; }; UNUSED auto sweepable = Sweepable::SweepAll(); UNUSED auto native = m_natives.size(); Native::sweepNativeData(m_natives); TRACE(1, "sweep: sweepable %u native %lu\n", sweepable, native); }
void MemoryManager::sweep() { assert(!sweeping()); if (debug) checkHeap(); m_sweeping = true; SCOPE_EXIT { m_sweeping = false; }; DEBUG_ONLY auto sweepable = Sweepable::SweepAll(); DEBUG_ONLY auto native = m_natives.size(); Native::sweepNativeData(m_natives); TRACE(1, "sweep: sweepable %u native %lu\n", sweepable, native); }
void MemoryManager::sweep() { // running a gc-cycle at end of request exposes bugs, but otherwise is // somewhat pointless since we're about to free the heap en-masse. if (debug) collect("before MM::sweep"); assert(!sweeping()); m_sweeping = true; DEBUG_ONLY size_t num_sweepables = 0, num_natives = 0; // iterate until both sweep lists are empty. Entries can be added or // removed from either list during sweeping. do { while (!m_sweepables.empty()) { num_sweepables++; auto obj = m_sweepables.next(); obj->unregister(); obj->sweep(); } while (!m_natives.empty()) { num_natives++; assert(m_natives.back()->sweep_index == m_natives.size() - 1); auto node = m_natives.back(); m_natives.pop_back(); auto obj = Native::obj(node); auto ndi = obj->getVMClass()->getNativeDataInfo(); ndi->sweep(obj); // trash the native data but leave the header and object parsable assert(memset(node+1, kSmallFreeFill, node->obj_offset - sizeof(*node))); } } while (!m_sweepables.empty()); DEBUG_ONLY auto napcs = m_apc_arrays.size(); FTRACE(1, "sweep: sweepable {} native {} apc array {}\n", num_sweepables, num_natives, napcs); // decref apc arrays referenced by this request. This must happen here // (instead of in resetAllocator), because the sweep routine may use // g_context. while (!m_apc_arrays.empty()) { auto a = m_apc_arrays.back(); m_apc_arrays.pop_back(); a->sweep(); if (debug) a->m_sweep_index = kInvalidSweepIndex; } if (debug) checkHeap("after MM::sweep"); }
void MemoryManager::sweep() { assert(!sweeping()); if (debug) checkHeap(); collect(); m_sweeping = true; SCOPE_EXIT { m_sweeping = false; }; DEBUG_ONLY size_t num_sweepables = 0, num_natives = 0; // iterate until both sweep lists are empty. Entries can be added or // removed from either list during sweeping. do { while (!m_sweepables.empty()) { num_sweepables++; auto obj = m_sweepables.next(); obj->unregister(); obj->sweep(); } while (!m_natives.empty()) { num_natives++; assert(m_natives.back()->sweep_index == m_natives.size() - 1); auto node = m_natives.back(); m_natives.pop_back(); auto obj = Native::obj(node); auto ndi = obj->getVMClass()->getNativeDataInfo(); ndi->sweep(obj); // trash the native data but leave the header and object parsable assert(memset(node+1, kSmallFreeFill, node->obj_offset - sizeof(*node))); } } while (!m_sweepables.empty()); DEBUG_ONLY auto napcs = m_apc_arrays.size(); FTRACE(1, "sweep: sweepable {} native {} apc array {}\n", num_sweepables, num_natives, napcs); if (debug) checkHeap(); // decref apc arrays referenced by this request. This must happen here // (instead of in resetAllocator), because the sweep routine may use // g_context. while (!m_apc_arrays.empty()) { auto a = m_apc_arrays.back(); m_apc_arrays.pop_back(); a->sweep(); } }
static void sweeping (int w) { for (int ll = 0; ll < w; ++ll) { Word llwire = wires[ll]; linputs[w] = ll; if (w+1 == nwires) for (int rr = 0; rr <= ll; ++rr) { if ((mask & compute (llwire, wires[rr])) == target_output) { found = 1; rinputs[w] = rr; print_circuit (); } } else for (int rr = 0; rr <= ll; ++rr) { wires[w] = compute (llwire, wires[rr]); rinputs[w] = rr; sweeping (w + 1); } } }
static void find_circuits (int max_gates) { mask = (1u << (1u << ninputs)) - 1u; tabulate_inputs (); printf ("Trying 0 gates...\n"); if (target_output == 0 || target_output == mask) { printf ("%c = %d\n", vname (ninputs), target_output & 1); return; } for (int w = 0; w < ninputs; ++w) if (target_output == wires[w]) { printf ("%c = %c\n", vname (ninputs), vname (w)); return; } for (int ngates = 1; ngates <= max_gates; ++ngates) { printf ("Trying %d gates...\n", ngates); nwires = ninputs + ngates; assert (nwires <= 26); // vnames must be letters if (sweeping (ninputs), found) return; } }