gdscript_byte_codegen.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /**************************************************************************/
  2. /* gdscript_byte_codegen.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef GDSCRIPT_BYTE_CODEGEN_H
  31. #define GDSCRIPT_BYTE_CODEGEN_H
  32. #include "gdscript_codegen.h"
  33. #include "gdscript_function.h"
  34. #include "gdscript_utility_functions.h"
  35. class GDScriptByteCodeGenerator : public GDScriptCodeGenerator {
  36. struct StackSlot {
  37. Variant::Type type = Variant::NIL;
  38. Vector<int> bytecode_indices;
  39. StackSlot() = default;
  40. StackSlot(Variant::Type p_type) :
  41. type(p_type) {}
  42. };
  43. const static int RESERVED_STACK = 3; // For self, class, and nil.
  44. struct CallTarget {
  45. Address target;
  46. bool is_new_temporary = false;
  47. GDScriptByteCodeGenerator *codegen = nullptr;
  48. #ifdef DEV_ENABLED
  49. bool cleaned = false;
  50. #endif
  51. void cleanup() {
  52. DEV_ASSERT(!cleaned);
  53. if (is_new_temporary) {
  54. codegen->pop_temporary();
  55. }
  56. #ifdef DEV_ENABLED
  57. cleaned = true;
  58. #endif
  59. }
  60. CallTarget(Address p_target, bool p_is_new_temporary, GDScriptByteCodeGenerator *p_codegen) :
  61. target(p_target),
  62. is_new_temporary(p_is_new_temporary),
  63. codegen(p_codegen) {}
  64. ~CallTarget() { DEV_ASSERT(cleaned); }
  65. CallTarget(const CallTarget &) = delete;
  66. CallTarget &operator=(CallTarget &) = delete;
  67. };
  68. bool ended = false;
  69. GDScriptFunction *function = nullptr;
  70. bool debug_stack = false;
  71. Vector<int> opcodes;
  72. List<RBMap<StringName, int>> stack_id_stack;
  73. RBMap<StringName, int> stack_identifiers;
  74. List<int> stack_identifiers_counts;
  75. RBMap<StringName, int> local_constants;
  76. Vector<StackSlot> locals;
  77. Vector<StackSlot> temporaries;
  78. List<int> used_temporaries;
  79. List<int> temporaries_pending_clear;
  80. RBMap<Variant::Type, List<int>> temporaries_pool;
  81. List<GDScriptFunction::StackDebug> stack_debug;
  82. List<RBMap<StringName, int>> block_identifier_stack;
  83. RBMap<StringName, int> block_identifiers;
  84. int max_locals = 0;
  85. int current_line = 0;
  86. int instr_args_max = 0;
  87. #ifdef DEBUG_ENABLED
  88. List<int> temp_stack;
  89. #endif
  90. HashMap<Variant, int, VariantHasher, VariantComparator> constant_map;
  91. RBMap<StringName, int> name_map;
  92. #ifdef TOOLS_ENABLED
  93. Vector<StringName> named_globals;
  94. #endif
  95. RBMap<Variant::ValidatedOperatorEvaluator, int> operator_func_map;
  96. RBMap<Variant::ValidatedSetter, int> setters_map;
  97. RBMap<Variant::ValidatedGetter, int> getters_map;
  98. RBMap<Variant::ValidatedKeyedSetter, int> keyed_setters_map;
  99. RBMap<Variant::ValidatedKeyedGetter, int> keyed_getters_map;
  100. RBMap<Variant::ValidatedIndexedSetter, int> indexed_setters_map;
  101. RBMap<Variant::ValidatedIndexedGetter, int> indexed_getters_map;
  102. RBMap<Variant::ValidatedBuiltInMethod, int> builtin_method_map;
  103. RBMap<Variant::ValidatedConstructor, int> constructors_map;
  104. RBMap<Variant::ValidatedUtilityFunction, int> utilities_map;
  105. RBMap<GDScriptUtilityFunctions::FunctionPtr, int> gds_utilities_map;
  106. RBMap<MethodBind *, int> method_bind_map;
  107. RBMap<GDScriptFunction *, int> lambdas_map;
  108. #if DEBUG_ENABLED
  109. // Keep method and property names for pointer and validated operations.
  110. // Used when disassembling the bytecode.
  111. Vector<String> operator_names;
  112. Vector<String> setter_names;
  113. Vector<String> getter_names;
  114. Vector<String> builtin_methods_names;
  115. Vector<String> constructors_names;
  116. Vector<String> utilities_names;
  117. Vector<String> gds_utilities_names;
  118. void add_debug_name(Vector<String> &vector, int index, const String &name) {
  119. if (index >= vector.size()) {
  120. vector.resize(index + 1);
  121. }
  122. vector.write[index] = name;
  123. }
  124. #endif
  125. // Lists since these can be nested.
  126. List<int> if_jmp_addrs;
  127. List<int> for_jmp_addrs;
  128. List<Address> for_counter_variables;
  129. List<Address> for_container_variables;
  130. List<int> while_jmp_addrs;
  131. List<int> continue_addrs;
  132. // Used to patch jumps with `and` and `or` operators with short-circuit.
  133. List<int> logic_op_jump_pos1;
  134. List<int> logic_op_jump_pos2;
  135. List<Address> ternary_result;
  136. List<int> ternary_jump_fail_pos;
  137. List<int> ternary_jump_skip_pos;
  138. List<List<int>> current_breaks_to_patch;
  139. void add_stack_identifier(const StringName &p_id, int p_stackpos) {
  140. if (locals.size() > max_locals) {
  141. max_locals = locals.size();
  142. }
  143. stack_identifiers[p_id] = p_stackpos;
  144. if (debug_stack) {
  145. block_identifiers[p_id] = p_stackpos;
  146. GDScriptFunction::StackDebug sd;
  147. sd.added = true;
  148. sd.line = current_line;
  149. sd.identifier = p_id;
  150. sd.pos = p_stackpos;
  151. stack_debug.push_back(sd);
  152. }
  153. }
  154. void push_stack_identifiers() {
  155. stack_identifiers_counts.push_back(locals.size());
  156. stack_id_stack.push_back(stack_identifiers);
  157. if (debug_stack) {
  158. RBMap<StringName, int> block_ids(block_identifiers);
  159. block_identifier_stack.push_back(block_ids);
  160. block_identifiers.clear();
  161. }
  162. }
  163. void pop_stack_identifiers() {
  164. int current_locals = stack_identifiers_counts.back()->get();
  165. stack_identifiers_counts.pop_back();
  166. stack_identifiers = stack_id_stack.back()->get();
  167. stack_id_stack.pop_back();
  168. #ifdef DEBUG_ENABLED
  169. if (!used_temporaries.is_empty()) {
  170. ERR_PRINT("Leaving block with non-zero temporary variables: " + itos(used_temporaries.size()));
  171. }
  172. #endif
  173. locals.resize(current_locals);
  174. if (debug_stack) {
  175. for (const KeyValue<StringName, int> &E : block_identifiers) {
  176. GDScriptFunction::StackDebug sd;
  177. sd.added = false;
  178. sd.identifier = E.key;
  179. sd.line = current_line;
  180. sd.pos = E.value;
  181. stack_debug.push_back(sd);
  182. }
  183. block_identifiers = block_identifier_stack.back()->get();
  184. block_identifier_stack.pop_back();
  185. }
  186. }
  187. int get_name_map_pos(const StringName &p_identifier) {
  188. int ret;
  189. if (!name_map.has(p_identifier)) {
  190. ret = name_map.size();
  191. name_map[p_identifier] = ret;
  192. } else {
  193. ret = name_map[p_identifier];
  194. }
  195. return ret;
  196. }
  197. int get_constant_pos(const Variant &p_constant) {
  198. if (constant_map.has(p_constant)) {
  199. return constant_map[p_constant];
  200. }
  201. int pos = constant_map.size();
  202. constant_map[p_constant] = pos;
  203. return pos;
  204. }
  205. int get_operation_pos(const Variant::ValidatedOperatorEvaluator p_operation) {
  206. if (operator_func_map.has(p_operation)) {
  207. return operator_func_map[p_operation];
  208. }
  209. int pos = operator_func_map.size();
  210. operator_func_map[p_operation] = pos;
  211. return pos;
  212. }
  213. int get_setter_pos(const Variant::ValidatedSetter p_setter) {
  214. if (setters_map.has(p_setter)) {
  215. return setters_map[p_setter];
  216. }
  217. int pos = setters_map.size();
  218. setters_map[p_setter] = pos;
  219. return pos;
  220. }
  221. int get_getter_pos(const Variant::ValidatedGetter p_getter) {
  222. if (getters_map.has(p_getter)) {
  223. return getters_map[p_getter];
  224. }
  225. int pos = getters_map.size();
  226. getters_map[p_getter] = pos;
  227. return pos;
  228. }
  229. int get_keyed_setter_pos(const Variant::ValidatedKeyedSetter p_keyed_setter) {
  230. if (keyed_setters_map.has(p_keyed_setter)) {
  231. return keyed_setters_map[p_keyed_setter];
  232. }
  233. int pos = keyed_setters_map.size();
  234. keyed_setters_map[p_keyed_setter] = pos;
  235. return pos;
  236. }
  237. int get_keyed_getter_pos(const Variant::ValidatedKeyedGetter p_keyed_getter) {
  238. if (keyed_getters_map.has(p_keyed_getter)) {
  239. return keyed_getters_map[p_keyed_getter];
  240. }
  241. int pos = keyed_getters_map.size();
  242. keyed_getters_map[p_keyed_getter] = pos;
  243. return pos;
  244. }
  245. int get_indexed_setter_pos(const Variant::ValidatedIndexedSetter p_indexed_setter) {
  246. if (indexed_setters_map.has(p_indexed_setter)) {
  247. return indexed_setters_map[p_indexed_setter];
  248. }
  249. int pos = indexed_setters_map.size();
  250. indexed_setters_map[p_indexed_setter] = pos;
  251. return pos;
  252. }
  253. int get_indexed_getter_pos(const Variant::ValidatedIndexedGetter p_indexed_getter) {
  254. if (indexed_getters_map.has(p_indexed_getter)) {
  255. return indexed_getters_map[p_indexed_getter];
  256. }
  257. int pos = indexed_getters_map.size();
  258. indexed_getters_map[p_indexed_getter] = pos;
  259. return pos;
  260. }
  261. int get_builtin_method_pos(const Variant::ValidatedBuiltInMethod p_method) {
  262. if (builtin_method_map.has(p_method)) {
  263. return builtin_method_map[p_method];
  264. }
  265. int pos = builtin_method_map.size();
  266. builtin_method_map[p_method] = pos;
  267. return pos;
  268. }
  269. int get_constructor_pos(const Variant::ValidatedConstructor p_constructor) {
  270. if (constructors_map.has(p_constructor)) {
  271. return constructors_map[p_constructor];
  272. }
  273. int pos = constructors_map.size();
  274. constructors_map[p_constructor] = pos;
  275. return pos;
  276. }
  277. int get_utility_pos(const Variant::ValidatedUtilityFunction p_utility) {
  278. if (utilities_map.has(p_utility)) {
  279. return utilities_map[p_utility];
  280. }
  281. int pos = utilities_map.size();
  282. utilities_map[p_utility] = pos;
  283. return pos;
  284. }
  285. int get_gds_utility_pos(const GDScriptUtilityFunctions::FunctionPtr p_gds_utility) {
  286. if (gds_utilities_map.has(p_gds_utility)) {
  287. return gds_utilities_map[p_gds_utility];
  288. }
  289. int pos = gds_utilities_map.size();
  290. gds_utilities_map[p_gds_utility] = pos;
  291. return pos;
  292. }
  293. int get_method_bind_pos(MethodBind *p_method) {
  294. if (method_bind_map.has(p_method)) {
  295. return method_bind_map[p_method];
  296. }
  297. int pos = method_bind_map.size();
  298. method_bind_map[p_method] = pos;
  299. return pos;
  300. }
  301. int get_lambda_function_pos(GDScriptFunction *p_lambda_function) {
  302. if (lambdas_map.has(p_lambda_function)) {
  303. return lambdas_map[p_lambda_function];
  304. }
  305. int pos = lambdas_map.size();
  306. lambdas_map[p_lambda_function] = pos;
  307. return pos;
  308. }
  309. CallTarget get_call_target(const Address &p_target, Variant::Type p_type = Variant::NIL);
  310. int address_of(const Address &p_address) {
  311. switch (p_address.mode) {
  312. case Address::SELF:
  313. return GDScriptFunction::ADDR_SELF;
  314. case Address::CLASS:
  315. return GDScriptFunction::ADDR_CLASS;
  316. case Address::MEMBER:
  317. return p_address.address | (GDScriptFunction::ADDR_TYPE_MEMBER << GDScriptFunction::ADDR_BITS);
  318. case Address::CONSTANT:
  319. return p_address.address | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS);
  320. case Address::LOCAL_VARIABLE:
  321. case Address::FUNCTION_PARAMETER:
  322. return p_address.address | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS);
  323. case Address::TEMPORARY:
  324. temporaries.write[p_address.address].bytecode_indices.push_back(opcodes.size());
  325. return -1;
  326. case Address::NIL:
  327. return GDScriptFunction::ADDR_NIL;
  328. }
  329. return -1; // Unreachable.
  330. }
  331. void append_opcode(GDScriptFunction::Opcode p_code) {
  332. opcodes.push_back(p_code);
  333. }
  334. void append_opcode_and_argcount(GDScriptFunction::Opcode p_code, int p_argument_count) {
  335. opcodes.push_back(p_code);
  336. opcodes.push_back(p_argument_count);
  337. instr_args_max = MAX(instr_args_max, p_argument_count);
  338. }
  339. void append(int p_code) {
  340. opcodes.push_back(p_code);
  341. }
  342. void append(const Address &p_address) {
  343. opcodes.push_back(address_of(p_address));
  344. }
  345. void append(const StringName &p_name) {
  346. opcodes.push_back(get_name_map_pos(p_name));
  347. }
  348. void append(const Variant::ValidatedOperatorEvaluator p_operation) {
  349. opcodes.push_back(get_operation_pos(p_operation));
  350. }
  351. void append(const Variant::ValidatedSetter p_setter) {
  352. opcodes.push_back(get_setter_pos(p_setter));
  353. }
  354. void append(const Variant::ValidatedGetter p_getter) {
  355. opcodes.push_back(get_getter_pos(p_getter));
  356. }
  357. void append(const Variant::ValidatedKeyedSetter p_keyed_setter) {
  358. opcodes.push_back(get_keyed_setter_pos(p_keyed_setter));
  359. }
  360. void append(const Variant::ValidatedKeyedGetter p_keyed_getter) {
  361. opcodes.push_back(get_keyed_getter_pos(p_keyed_getter));
  362. }
  363. void append(const Variant::ValidatedIndexedSetter p_indexed_setter) {
  364. opcodes.push_back(get_indexed_setter_pos(p_indexed_setter));
  365. }
  366. void append(const Variant::ValidatedIndexedGetter p_indexed_getter) {
  367. opcodes.push_back(get_indexed_getter_pos(p_indexed_getter));
  368. }
  369. void append(const Variant::ValidatedBuiltInMethod p_method) {
  370. opcodes.push_back(get_builtin_method_pos(p_method));
  371. }
  372. void append(const Variant::ValidatedConstructor p_constructor) {
  373. opcodes.push_back(get_constructor_pos(p_constructor));
  374. }
  375. void append(const Variant::ValidatedUtilityFunction p_utility) {
  376. opcodes.push_back(get_utility_pos(p_utility));
  377. }
  378. void append(const GDScriptUtilityFunctions::FunctionPtr p_gds_utility) {
  379. opcodes.push_back(get_gds_utility_pos(p_gds_utility));
  380. }
  381. void append(MethodBind *p_method) {
  382. opcodes.push_back(get_method_bind_pos(p_method));
  383. }
  384. void append(GDScriptFunction *p_lambda_function) {
  385. opcodes.push_back(get_lambda_function_pos(p_lambda_function));
  386. }
  387. void patch_jump(int p_address) {
  388. opcodes.write[p_address] = opcodes.size();
  389. }
  390. public:
  391. virtual uint32_t add_parameter(const StringName &p_name, bool p_is_optional, const GDScriptDataType &p_type) override;
  392. virtual uint32_t add_local(const StringName &p_name, const GDScriptDataType &p_type) override;
  393. virtual uint32_t add_local_constant(const StringName &p_name, const Variant &p_constant) override;
  394. virtual uint32_t add_or_get_constant(const Variant &p_constant) override;
  395. virtual uint32_t add_or_get_name(const StringName &p_name) override;
  396. virtual uint32_t add_temporary(const GDScriptDataType &p_type) override;
  397. virtual void pop_temporary() override;
  398. virtual void clean_temporaries() override;
  399. virtual void start_parameters() override;
  400. virtual void end_parameters() override;
  401. virtual void start_block() override;
  402. virtual void end_block() override;
  403. virtual void write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, Variant p_rpc_config, const GDScriptDataType &p_return_type) override;
  404. virtual GDScriptFunction *write_end() override;
  405. #ifdef DEBUG_ENABLED
  406. virtual void set_signature(const String &p_signature) override;
  407. #endif
  408. virtual void set_initial_line(int p_line) override;
  409. virtual void write_type_adjust(const Address &p_target, Variant::Type p_new_type) override;
  410. virtual void write_unary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand) override;
  411. virtual void write_binary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand, const Address &p_right_operand) override;
  412. virtual void write_type_test(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override;
  413. virtual void write_and_left_operand(const Address &p_left_operand) override;
  414. virtual void write_and_right_operand(const Address &p_right_operand) override;
  415. virtual void write_end_and(const Address &p_target) override;
  416. virtual void write_or_left_operand(const Address &p_left_operand) override;
  417. virtual void write_or_right_operand(const Address &p_right_operand) override;
  418. virtual void write_end_or(const Address &p_target) override;
  419. virtual void write_start_ternary(const Address &p_target) override;
  420. virtual void write_ternary_condition(const Address &p_condition) override;
  421. virtual void write_ternary_true_expr(const Address &p_expr) override;
  422. virtual void write_ternary_false_expr(const Address &p_expr) override;
  423. virtual void write_end_ternary() override;
  424. virtual void write_set(const Address &p_target, const Address &p_index, const Address &p_source) override;
  425. virtual void write_get(const Address &p_target, const Address &p_index, const Address &p_source) override;
  426. virtual void write_set_named(const Address &p_target, const StringName &p_name, const Address &p_source) override;
  427. virtual void write_get_named(const Address &p_target, const StringName &p_name, const Address &p_source) override;
  428. virtual void write_set_member(const Address &p_value, const StringName &p_name) override;
  429. virtual void write_get_member(const Address &p_target, const StringName &p_name) override;
  430. virtual void write_set_static_variable(const Address &p_value, const Address &p_class, int p_index) override;
  431. virtual void write_get_static_variable(const Address &p_target, const Address &p_class, int p_index) override;
  432. virtual void write_assign(const Address &p_target, const Address &p_source) override;
  433. virtual void write_assign_with_conversion(const Address &p_target, const Address &p_source) override;
  434. virtual void write_assign_true(const Address &p_target) override;
  435. virtual void write_assign_false(const Address &p_target) override;
  436. virtual void write_assign_default_parameter(const Address &p_dst, const Address &p_src, bool p_use_conversion) override;
  437. virtual void write_store_global(const Address &p_dst, int p_global_index) override;
  438. virtual void write_store_named_global(const Address &p_dst, const StringName &p_global) override;
  439. virtual void write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override;
  440. virtual void write_call(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  441. virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  442. virtual void write_call_async(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  443. virtual void write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override;
  444. void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, bool p_is_static, const Vector<Address> &p_arguments);
  445. virtual void write_call_gdscript_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override;
  446. virtual void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) override;
  447. virtual void write_call_builtin_type_static(const Address &p_target, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) override;
  448. virtual void write_call_native_static(const Address &p_target, const StringName &p_class, const StringName &p_method, const Vector<Address> &p_arguments) override;
  449. virtual void write_call_method_bind(const Address &p_target, const Address &p_base, MethodBind *p_method, const Vector<Address> &p_arguments) override;
  450. virtual void write_call_method_bind_validated(const Address &p_target, const Address &p_base, MethodBind *p_method, const Vector<Address> &p_arguments) override;
  451. virtual void write_call_self(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  452. virtual void write_call_self_async(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  453. virtual void write_call_script_function(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  454. virtual void write_lambda(const Address &p_target, GDScriptFunction *p_function, const Vector<Address> &p_captures, bool p_use_self) override;
  455. virtual void write_construct(const Address &p_target, Variant::Type p_type, const Vector<Address> &p_arguments) override;
  456. virtual void write_construct_array(const Address &p_target, const Vector<Address> &p_arguments) override;
  457. virtual void write_construct_typed_array(const Address &p_target, const GDScriptDataType &p_element_type, const Vector<Address> &p_arguments) override;
  458. virtual void write_construct_dictionary(const Address &p_target, const Vector<Address> &p_arguments) override;
  459. virtual void write_await(const Address &p_target, const Address &p_operand) override;
  460. virtual void write_if(const Address &p_condition) override;
  461. virtual void write_else() override;
  462. virtual void write_endif() override;
  463. virtual void write_jump_if_shared(const Address &p_value) override;
  464. virtual void write_end_jump_if_shared() override;
  465. virtual void start_for(const GDScriptDataType &p_iterator_type, const GDScriptDataType &p_list_type) override;
  466. virtual void write_for_assignment(const Address &p_list) override;
  467. virtual void write_for(const Address &p_variable, bool p_use_conversion) override;
  468. virtual void write_endfor() override;
  469. virtual void start_while_condition() override;
  470. virtual void write_while(const Address &p_condition) override;
  471. virtual void write_endwhile() override;
  472. virtual void write_break() override;
  473. virtual void write_continue() override;
  474. virtual void write_breakpoint() override;
  475. virtual void write_newline(int p_line) override;
  476. virtual void write_return(const Address &p_return_value) override;
  477. virtual void write_assert(const Address &p_test, const Address &p_message) override;
  478. virtual ~GDScriptByteCodeGenerator();
  479. };
  480. #endif // GDSCRIPT_BYTE_CODEGEN_H