-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_object.h
65 lines (51 loc) · 2.01 KB
/
basic_object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <thread>
#include <memory>
#include "ast_etc.h"
#include "statement.h"
#include "type.h"
#include "expression.h"
#include "common.h"
#include <condition_variable>
class Flame;
class FunctionObject;
class ClosureObject{
public:
shared_ptr<FunctionObject> FunctionRef;
shared_ptr<Flame> ParentFlame;
ClosureObject(shared_ptr<FunctionObject> fref,shared_ptr<Flame> parentflame):FunctionRef(fref),ParentFlame(parentflame){};
};
class ContinuationObject{
public:
vector<pair<int,vector<VMValue> > > Snapshot;
shared_ptr<Flame> StartFlame;
ContinuationObject(vector<pair<int,vector<VMValue> > > snapshot,shared_ptr<Flame> startflame):Snapshot(snapshot),StartFlame(startflame){};
};
class ChannelObject{
public:
queue<VMValue> SentValues;
queue<pair<shared_ptr<condition_variable>,bool*> > Receivers;
queue<pair<shared_ptr<condition_variable>,bool*> > Senders;
queue<bool> Sender_ProduceValue;
mutex mtx;
int Capacity;
ChannelObject(int capacity){this->Capacity=capacity;};
};
class DataObject{
public:
string OriginalType;
shared_ptr<map<string,VMValue> > MemberMap;
DataObject(string original,shared_ptr<map<string,VMValue> > membermap):OriginalType(original),MemberMap(membermap){}
};
class FunctionObject{
public:
string Name;
bool isBuiltin;
shared_ptr<TypeAST> TypeInfo;
shared_ptr<vector<pair<string,shared_ptr<TypeAST> > > > Args;
shared_ptr<vector<pair<string,shared_ptr<TypeAST> > > > LocalVariables;
shared_ptr<vector<label_or_immediate> > bytecode_labels;
FunctionObject(string name,shared_ptr<TypeAST> type,bool isbuiltin,shared_ptr<vector<pair<string,shared_ptr<TypeAST> > > > args,shared_ptr<vector<pair<string,shared_ptr<TypeAST> > > > localvars,shared_ptr<vector<label_or_immediate> > bc)
:Name(name),TypeInfo(type),isBuiltin(isbuiltin),Args(args),LocalVariables(localvars),bytecode_labels(bc){}
FunctionObject(string name,shared_ptr<TypeAST> type,bool isbuiltin,shared_ptr<vector<pair<string,shared_ptr<TypeAST> > > > args):Name(name),TypeInfo(type),isBuiltin(isbuiltin),Args(args){}
};