|
@@ -65,6 +65,8 @@ struct CodeObject {
|
|
|
std::vector<CodeBlock> blocks = { CodeBlock{NO_BLOCK, -1} };
|
|
std::vector<CodeBlock> blocks = { CodeBlock{NO_BLOCK, -1} };
|
|
|
emhash8::HashMap<Str, int> labels;
|
|
emhash8::HashMap<Str, int> labels;
|
|
|
|
|
|
|
|
|
|
+ void optimize(VM* vm);
|
|
|
|
|
+
|
|
|
bool add_label(const Str& label){
|
|
bool add_label(const Str& label){
|
|
|
if(labels.contains(label)) return false;
|
|
if(labels.contains(label)) return false;
|
|
|
labels[label] = codes.size();
|
|
labels[label] = codes.size();
|
|
@@ -86,8 +88,6 @@ struct CodeObject {
|
|
|
return consts.size() - 1;
|
|
return consts.size() - 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void optimize(VM* vm);
|
|
|
|
|
-
|
|
|
|
|
/************************************************/
|
|
/************************************************/
|
|
|
int _curr_block_i = 0;
|
|
int _curr_block_i = 0;
|
|
|
bool _rvalue = false;
|
|
bool _rvalue = false;
|