Commit 4da376b5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

make format

parent 8a3a1792
...@@ -214,12 +214,13 @@ threading::PerThreadSet<root_stack_t> root_stack_set; ...@@ -214,12 +214,13 @@ threading::PerThreadSet<root_stack_t> root_stack_set;
void gatherInterpreterRoots(GCVisitor* visitor) { void gatherInterpreterRoots(GCVisitor* visitor) {
root_stack_set.forEachValue(std::function<void(root_stack_t*, GCVisitor*)>([](root_stack_t* v, GCVisitor* visitor) { root_stack_set.forEachValue(std::function<void(root_stack_t*, GCVisitor*)>([](root_stack_t* v, GCVisitor* visitor) {
for (const SymMap* sym_map : *v) { for (const SymMap* sym_map : *v) {
for (const auto& p2 : *sym_map) { for (const auto& p2 : *sym_map) {
visitor->visitPotential(p2.second.o); visitor->visitPotential(p2.second.o);
} }
} }
}), visitor); }),
visitor);
} }
class UnregisterHelper { class UnregisterHelper {
......
...@@ -56,7 +56,6 @@ public: ...@@ -56,7 +56,6 @@ public:
void log(int count = 1) { Stats::log(id, count); } void log(int count = 1) { Stats::log(id, count); }
}; };
} }
#endif #endif
...@@ -123,16 +123,11 @@ public: ...@@ -123,16 +123,11 @@ public:
namespace impl { namespace impl {
// From http://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer // From http://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer
template<int ...> template <int...> struct seq {};
struct seq { };
template<int N, int ...S> template <int N, int... S> struct gens : gens<N - 1, N - 1, S...> {};
struct gens : gens<N-1, N-1, S...> { };
template<int ...S> template <int... S> struct gens<0, S...> { typedef seq<S...> type; };
struct gens<0, S...> {
typedef seq<S...> type;
};
} }
template <typename T, typename... CtorArgs> class PerThreadSet { template <typename T, typename... CtorArgs> class PerThreadSet {
...@@ -141,7 +136,7 @@ private: ...@@ -141,7 +136,7 @@ private:
PthreadFastMutex lock; PthreadFastMutex lock;
struct Storage { struct Storage {
PerThreadSet<T, CtorArgs...> *self; PerThreadSet<T, CtorArgs...>* self;
T val; T val;
}; };
...@@ -163,9 +158,8 @@ private: ...@@ -163,9 +158,8 @@ private:
delete s; delete s;
} }
template <int ...S> template <int... S> Storage* make(impl::seq<S...>) {
Storage* make(impl::seq<S...>) { return new Storage{ .self = this, .val = T(std::get<S>(ctor_args)...) };
return new Storage {.self=this, .val=T(std::get<S>(ctor_args)...) };
} }
public: public:
...@@ -181,8 +175,7 @@ public: ...@@ -181,8 +175,7 @@ public:
} }
} }
template <typename... Arguments> template <typename... Arguments> void forEachValue(std::function<void(T*, Arguments...)> f, Arguments... args) {
void forEachValue(std::function<void(T*, Arguments...)> f, Arguments... args) {
LOCK_REGION(&lock); LOCK_REGION(&lock);
for (auto& p : map) { for (auto& p : map) {
......
...@@ -160,13 +160,13 @@ void runCollection() { ...@@ -160,13 +160,13 @@ void runCollection() {
if (VERBOSITY("gc") >= 2) if (VERBOSITY("gc") >= 2)
printf("Collection #%d\n", ++ncollections); printf("Collection #%d\n", ++ncollections);
//Timer _t2("promoting", /*min_usec=*/10000); // Timer _t2("promoting", /*min_usec=*/10000);
threading::GLPromoteRegion _lock; threading::GLPromoteRegion _lock;
//long promote_us = _t2.end(); // long promote_us = _t2.end();
//static thread_local StatPerThreadCounter sc_promoting_us("gc_promoting_us"); // static thread_local StatPerThreadCounter sc_promoting_us("gc_promoting_us");
//sc_promoting_us.log(promote_us); // sc_promoting_us.log(promote_us);
Timer _t("collecting", /*min_usec=*/10000); Timer _t("collecting", /*min_usec=*/10000);
......
...@@ -90,9 +90,7 @@ private: ...@@ -90,9 +90,7 @@ private:
Heap* heap; Heap* heap;
Block* cache_heads[NUM_BUCKETS]; Block* cache_heads[NUM_BUCKETS];
ThreadBlockCache(Heap* heap) : heap(heap) { ThreadBlockCache(Heap* heap) : heap(heap) { memset(cache_heads, 0, sizeof(cache_heads)); }
memset(cache_heads, 0, sizeof(cache_heads));
}
~ThreadBlockCache(); ~ThreadBlockCache();
}; };
friend class ThreadBlockCache; friend class ThreadBlockCache;
...@@ -100,8 +98,7 @@ private: ...@@ -100,8 +98,7 @@ private:
threading::PerThreadSet<ThreadBlockCache, Heap*> thread_caches; threading::PerThreadSet<ThreadBlockCache, Heap*> thread_caches;
public: public:
Heap() : thread_caches(this) { Heap() : thread_caches(this) {}
}
void* realloc(void* ptr, size_t bytes); void* realloc(void* ptr, size_t bytes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment