diff --git a/profile.sh b/profile.sh new file mode 100644 index 00000000..3b0187fc --- /dev/null +++ b/profile.sh @@ -0,0 +1,7 @@ +g++ -o pocketpy src/main.cpp --std=c++17 -pg -O1 -fno-rtti + +./pocketpy benchmarks/simple.py + +gprof pocketpy gmon.out > gprof.txt + +rm gmon.out \ No newline at end of file diff --git a/src/codeobject.h b/src/codeobject.h index 6f30c038..3cad23a4 100644 --- a/src/codeobject.h +++ b/src/codeobject.h @@ -109,7 +109,7 @@ struct CodeObject { /************************************************/ }; -static thread_local i64 kFrameGlobalId = 0; +static THREAD_LOCAL i64 kFrameGlobalId = 0; struct Frame { std::vector _data; diff --git a/src/common.h b/src/common.h index 90e916df..b7eda17b 100644 --- a/src/common.h +++ b/src/common.h @@ -56,4 +56,7 @@ template void* tid() { static volatile int8_t _x; return (void*)(&_x); -} \ No newline at end of file +} + +//#define THREAD_LOCAL thread_local +#define THREAD_LOCAL \ No newline at end of file diff --git a/src/obj.h b/src/obj.h index 6b83d0a7..703b1277 100644 --- a/src/obj.h +++ b/src/obj.h @@ -149,7 +149,7 @@ namespace pkpy { }; constexpr int kMemObjSize = sizeof(int) + sizeof(Py_); - static thread_local MemBlock _mem_pool(512); + static THREAD_LOCAL MemBlock _mem_pool(512); template<> struct SpAllocator { diff --git a/src/safestl.h b/src/safestl.h index 66b4a780..23bc1fde 100644 --- a/src/safestl.h +++ b/src/safestl.h @@ -39,7 +39,7 @@ typedef emhash8::HashMap NameDict; namespace pkpy { const int kMaxPoolSize = 10; - static thread_local std::vector* _args_pool = new std::vector[kMaxPoolSize]; + static THREAD_LOCAL std::vector* _args_pool = new std::vector[kMaxPoolSize]; class Args { PyVar* _args;