Explorar o código

Update memory.h

Update frame.h

Update frame.h
blueloveTH %!s(int64=2) %!d(string=hai) anos
pai
achega
d4775a7016
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  1. 2 2
      src/frame.h
  2. 1 1
      src/memory.h

+ 2 - 2
src/frame.h

@@ -6,7 +6,7 @@
 
 namespace pkpy{
 
-static THREAD_LOCAL uint64_t kFrameGlobalId = 0;
+static THREAD_LOCAL i64 kFrameGlobalId = 0;
 
 using ValueStack = pod_vector<PyObject*>;
 
@@ -19,7 +19,7 @@ struct Frame {
     PyObject* _module;
     NameDict_ _locals;
     NameDict_ _closure;
-    const uint64_t id;
+    const i64 id;
     std::vector<std::pair<int, ValueStack>> s_try_block;
 
     NameDict& f_locals() noexcept { return _locals!=nullptr ? *_locals : _module->attr(); }

+ 1 - 1
src/memory.h

@@ -223,7 +223,6 @@ struct MemoryPool{
             if(empty()) throw std::runtime_error("Arena::alloc() called on empty arena");
 #endif
             _free_list_size--;
-            if(_free_list_size == 0) dirty = true;
             return _free_list[_free_list_size];
         }
 
@@ -260,6 +259,7 @@ struct MemoryPool{
         void* p = arena->alloc()->data;
         if(arena->empty()){
             _arenas.pop_back();
+            arena->dirty = true;
             _empty_arenas.push_back(arena);
         }
         return p;