mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
Update memory.h
Update frame.h Update frame.h
This commit is contained in:
parent
12e07391ee
commit
d4775a7016
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace pkpy{
|
namespace pkpy{
|
||||||
|
|
||||||
static THREAD_LOCAL uint64_t kFrameGlobalId = 0;
|
static THREAD_LOCAL i64 kFrameGlobalId = 0;
|
||||||
|
|
||||||
using ValueStack = pod_vector<PyObject*>;
|
using ValueStack = pod_vector<PyObject*>;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ struct Frame {
|
|||||||
PyObject* _module;
|
PyObject* _module;
|
||||||
NameDict_ _locals;
|
NameDict_ _locals;
|
||||||
NameDict_ _closure;
|
NameDict_ _closure;
|
||||||
const uint64_t id;
|
const i64 id;
|
||||||
std::vector<std::pair<int, ValueStack>> s_try_block;
|
std::vector<std::pair<int, ValueStack>> s_try_block;
|
||||||
|
|
||||||
NameDict& f_locals() noexcept { return _locals!=nullptr ? *_locals : _module->attr(); }
|
NameDict& f_locals() noexcept { return _locals!=nullptr ? *_locals : _module->attr(); }
|
||||||
|
@ -223,7 +223,6 @@ struct MemoryPool{
|
|||||||
if(empty()) throw std::runtime_error("Arena::alloc() called on empty arena");
|
if(empty()) throw std::runtime_error("Arena::alloc() called on empty arena");
|
||||||
#endif
|
#endif
|
||||||
_free_list_size--;
|
_free_list_size--;
|
||||||
if(_free_list_size == 0) dirty = true;
|
|
||||||
return _free_list[_free_list_size];
|
return _free_list[_free_list_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,6 +259,7 @@ struct MemoryPool{
|
|||||||
void* p = arena->alloc()->data;
|
void* p = arena->alloc()->data;
|
||||||
if(arena->empty()){
|
if(arena->empty()){
|
||||||
_arenas.pop_back();
|
_arenas.pop_back();
|
||||||
|
arena->dirty = true;
|
||||||
_empty_arenas.push_back(arena);
|
_empty_arenas.push_back(arena);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user