GDScript: Add speficic set/get instructions

When the base type is known at compile-time, we can get a direct
function pointer that is faster than the regular set/get paths.
This commit is contained in:
George Marques 2020-11-16 12:59:53 -03:00
parent 1ad5c926dc
commit 5aeb390cd7
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
5 changed files with 476 additions and 13 deletions

View file

@ -167,8 +167,8 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_SET: {
text += "set ";
case OPCODE_SET_KEYED: {
text += "set keyed ";
text += DADDR(1);
text += "[";
text += DADDR(2);
@ -177,8 +177,28 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_GET: {
text += "get ";
case OPCODE_SET_KEYED_VALIDATED: {
text += "set keyed validated ";
text += DADDR(1);
text += "[";
text += DADDR(2);
text += "] = ";
text += DADDR(3);
incr += 5;
} break;
case OPCODE_SET_INDEXED_VALIDATED: {
text += "set indexed validated ";
text += DADDR(1);
text += "[";
text += DADDR(2);
text += "] = ";
text += DADDR(3);
incr += 5;
} break;
case OPCODE_GET_KEYED: {
text += "get keyed ";
text += DADDR(3);
text += " = ";
text += DADDR(1);
@ -188,6 +208,28 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_GET_KEYED_VALIDATED: {
text += "get keyed validated ";
text += DADDR(3);
text += " = ";
text += DADDR(1);
text += "[";
text += DADDR(2);
text += "]";
incr += 5;
} break;
case OPCODE_GET_INDEXED_VALIDATED: {
text += "get indexed validated ";
text += DADDR(3);
text += " = ";
text += DADDR(1);
text += "[";
text += DADDR(2);
text += "]";
incr += 5;
} break;
case OPCODE_SET_NAMED: {
text += "set_named ";
text += DADDR(1);
@ -198,6 +240,16 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_SET_NAMED_VALIDATED: {
text += "set_named validated ";
text += DADDR(1);
text += "[\"";
text += "<unknown name>";
text += "\"] = ";
text += DADDR(2);
incr += 4;
} break;
case OPCODE_GET_NAMED: {
text += "get_named ";
text += DADDR(2);
@ -209,6 +261,17 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
incr += 4;
} break;
case OPCODE_GET_NAMED_VALIDATED: {
text += "get_named validated ";
text += DADDR(2);
text += " = ";
text += DADDR(1);
text += "[\"";
text += "<unknown name>";
text += "\"]";
incr += 4;
} break;
case OPCODE_SET_MEMBER: {
text += "set_member ";
text += "[\"";