1 Star 0 Fork 86

Wu526/pythonvm

forked from hinus/pythonvm 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
handles.cpp 869 Bytes
一键复制 编辑 原始数据 按行查看 历史
hinus 提交于 2018-10-10 10:27 +08:00 . Summary: generator
#include "util/handles.hpp"
#include "memory/oopClosure.hpp"
#include <stdio.h>
HandleMark* HandleMark::instance = NULL;
HandleMark::HandleMark() {
_head = 0x0;
}
HandleMark* HandleMark::get_instance() {
if (!instance)
instance = new HandleMark();
return instance;
}
void HandleMark::oops_do(OopClosure* f) {
Handle* cur = _head;
while (cur) {
cur->oops_do(f);
cur = cur->_next;
}
}
Handle::Handle(HiObject* t) {
_value = t;
_next = HandleMark::get_instance()->head();
HandleMark::get_instance()->set_head(this);
}
Handle::~Handle() {
_value = 0x0;
HandleMark::get_instance()->set_head(_next);
_next = 0x0;
}
HiObject* Handle::operator ->() {
return _value;
}
void Handle::oops_do(OopClosure* f) {
f->do_oop(&_value);
}
HiObject* Handle::resolve() {
return _value;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/wu526/pythonvm.git
git@gitee.com:wu526/pythonvm.git
wu526
pythonvm
pythonvm
master

搜索帮助