1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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
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 += "[\"";