1 Star 0 Fork 86

Jpy555/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
generator.cpp 1.17 KB
Copy Edit Raw Blame History
hinus authored 2018-10-10 10:27 +08:00 . Summary: generator
#include "runtime/generator.hpp"
#include "runtime/functionObject.hpp"
#include "runtime/frameObject.hpp"
#include "runtime/interpreter.hpp"
#include "code/codeObject.hpp"
#include "object/hiDict.hpp"
#include "object/hiList.hpp"
#include "memory/oopClosure.hpp"
GeneratorKlass* GeneratorKlass::instance = NULL;
GeneratorKlass::GeneratorKlass() {
}
GeneratorKlass* GeneratorKlass::get_instance() {
if (instance == NULL)
instance = new GeneratorKlass();
return instance;
}
HiObject* GeneratorKlass::iter(HiObject* obj) {
return obj;
}
HiObject* GeneratorKlass::next(HiObject* obj) {
assert(obj->klass() == (Klass*) this);
Generator* g = (Generator*) obj;
return Interpreter::get_instance()->eval_generator(g);
}
size_t GeneratorKlass::size() {
return sizeof(Generator);
}
void GeneratorKlass::oops_do(OopClosure* f, HiObject* obj) {
Generator* g = (Generator*)obj;
assert(g->klass() == (Klass*)this);
if (g->frame())
g->frame()->oops_do(f);
}
Generator::Generator(FunctionObject* func, ArrayList<HiObject*>* args, int arg_cnt) {
_frame = new FrameObject(func, args, arg_cnt);
set_klass(GeneratorKlass::get_instance());
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/jpy555/pythonvm.git
git@gitee.com:jpy555/pythonvm.git
jpy555
pythonvm
pythonvm
master

Search