Commit eb4e7951 authored by Marius Wachtler's avatar Marius Wachtler

add documentation for TrackingVRegPtr and delete BST_FunctionDef and BST_ClassDef nodes

parent 1138c9b3
......@@ -36,6 +36,12 @@
//#define VERBOSITY(x) 2
namespace pyston {
// This class helps keeping track of the memory locations of vregs inside the bytecode by storing them as offsets from
// the start of the bytecode if the address is inside the bytecode otherwise it is just stored as a regular pointer.
// We can't directly keep track of the locations with normal pointers because during bytecode emission the memory
// location grows several times which will move around the memory location.
// TODO: all vreg locations should be inside the bytecode but currently we still emit a few references to outside vregs
// for the BST_ClassDef and BST_FunctionDef nodes. We should try to remove them.
class TrackingVRegPtr {
private:
union {
......
......@@ -30,6 +30,7 @@
#include "codegen/ast_interpreter.h"
#include "codegen/entry.h"
#include "codegen/unwinding.h"
#include "core/bst.h"
#include "core/options.h"
#include "core/stats.h"
#include "core/types.h"
......@@ -4054,6 +4055,8 @@ void CodeConstants::dealloc() const {
owned_refs.clear();
for (auto&& e : funcs_and_classes) {
Py_DECREF(e.second);
assert(e.first->type() == BST_TYPE::FunctionDef || e.first->type() == BST_TYPE::ClassDef);
delete[] e.first;
}
funcs_and_classes.clear();
}
......
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