1 Star 0 Fork 86

bmi269/pythonvm

forked from hinus/pythonvm 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
handles.cpp 869 Bytes
Copy Edit Raw Blame History
hinus authored 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/bmi269/pythonvm.git
git@gitee.com:bmi269/pythonvm.git
bmi269
pythonvm
pythonvm
master

Search