OP_ACCESS_CHAIN = 65,
OP_DECORATE = 71,
OP_MEMBER_DECORATE = 72,
+ OP_COPY_OBJECT = 83,
+ OP_PHI = 245,
OP_SELECTION_MERGE = 247,
OP_LABEL = 248,
OP_BRANCH = 249,
{
unsigned word = *(op+i++);
new_code.push_back(word);
- if(!(word&(word>>8)&(word>>16)&(word>>24)&0xFF))
+ // Strings are nul-terminated and nul-padded
+ if(!(word>>24))
break;
}
}
}
}
+ else if(opcode==OP_PHI)
+ {
+ unsigned active_count = 0;
+ unsigned result_id = 0;
+ for(unsigned i=3; i<word_count; i+=2)
+ if(flags[*(op+i+1)])
+ {
+ ++active_count;
+ result_id = *(op+i);
+ }
+
+ if(active_count==1)
+ {
+ new_code.push_back(0x40000 | OP_COPY_OBJECT);
+ new_code.push_back(*(op+1));
+ new_code.push_back(*(op+2));
+ new_code.push_back(result_id);
+ copy = false;
+ }
+ }
}
if(copy)