gdscript_byte_codegen.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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. bool can_contain_object = true;
  39. Vector<int> bytecode_indices;
  40. StackSlot() = default;
  41. StackSlot(Variant::Type p_type, bool p_can_contain_object) :
  42. type(p_type), can_contain_object(p_can_contain_object) {}
  43. };
  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. HashSet<int> dirty_locals;
  78. Vector<StackSlot> temporaries;
  79. List<int> used_temporaries;
  80. HashSet<int> temporaries_pending_clear;
  81. RBMap<Variant::Type, List<int>> temporaries_pool;
  82. List<GDScriptFunction::StackDebug> stack_debug;
  83. List<RBMap<StringName, int>> block_identifier_stack;
  84. RBMap<StringName, int> block_identifiers;
  85. int max_locals = 0;
  86. int current_line = 0;
  87. int instr_args_max = 0;
  88. #ifdef DEBUG_ENABLED
  89. List<int> temp_stack;
  90. #endif
  91. HashMap<Variant, int, VariantHasher, VariantComparator> constant_map;
  92. RBMap<StringName, int> name_map;
  93. #ifdef TOOLS_ENABLED
  94. Vector<StringName> named_globals;
  95. #endif
  96. RBMap<Variant::ValidatedOperatorEvaluator, int> operator_func_map;
  97. RBMap<Variant::ValidatedSetter, int> setters_map;
  98. RBMap<Variant::ValidatedGetter, int> getters_map;
  99. RBMap<Variant::ValidatedKeyedSetter, int> keyed_setters_map;
  100. RBMap<Variant::ValidatedKeyedGetter, int> keyed_getters_map;
  101. RBMap<Variant::ValidatedIndexedSetter, int> indexed_setters_map;
  102. RBMap<Variant::ValidatedIndexedGetter, int> indexed_getters_map;
  103. RBMap<Variant::ValidatedBuiltInMethod, int> builtin_method_map;
  104. RBMap<Variant::ValidatedConstructor, int> constructors_map;
  105. RBMap<Variant::ValidatedUtilityFunction, int> utilities_map;
  106. RBMap<GDScriptUtilityFunctions::FunctionPtr, int> gds_utilities_map;
  107. RBMap<MethodBind *, int> method_bind_map;
  108. RBMap<GDScriptFunction *, int> lambdas_map;
  109. #ifdef DEBUG_ENABLED
  110. // Keep method and property names for pointer and validated operations.
  111. // Used when disassembling the bytecode.
  112. Vector<String> operator_names;
  113. Vector<String> setter_names;
  114. Vector<String> getter_names;
  115. Vector<String> builtin_methods_names;
  116. Vector<String> constructors_names;
  117. Vector<String> utilities_names;
  118. Vector<String> gds_utilities_names;
  119. void add_debug_name(Vector<String> &vector, int index, const String &name) {
  120. if (index >= vector.size()) {
  121. vector.resize(index + 1);
  122. }
  123. vector.write[index] = name;
  124. }
  125. #endif
  126. // Lists since these can be nested.
  127. List<int> if_jmp_addrs;
  128. List<int> for_jmp_addrs;
  129. List<Address> for_counter_variables;
  130. List<Address> for_container_variables;
  131. List<int> while_jmp_addrs;
  132. List<int> continue_addrs;
  133. // Used to patch jumps with `and` and `or` operators with short-circuit.
  134. List<int> logic_op_jump_pos1;
  135. List<int> logic_op_jump_pos2;
  136. List<Address> ternary_result;
  137. List<int> ternary_jump_fail_pos;
  138. List<int> ternary_jump_skip_pos;
  139. List<List<int>> current_breaks_to_patch;
  140. void add_stack_identifier(const StringName &p_id, int p_stackpos) {
  141. if (locals.size() > max_locals) {
  142. max_locals = locals.size();
  143. }
  144. stack_identifiers[p_id] = p_stackpos;
  145. if (debug_stack) {
  146. block_identifiers[p_id] = p_stackpos;
  147. GDScriptFunction::StackDebug sd;
  148. sd.added = true;
  149. sd.line = current_line;
  150. sd.identifier = p_id;
  151. sd.pos = p_stackpos;
  152. stack_debug.push_back(sd);
  153. }
  154. }
  155. void push_stack_identifiers() {
  156. stack_identifiers_counts.push_back(locals.size());
  157. stack_id_stack.push_back(stack_identifiers);
  158. if (debug_stack) {
  159. RBMap<StringName, int> block_ids(block_identifiers);
  160. block_identifier_stack.push_back(block_ids);
  161. block_identifiers.clear();
  162. }
  163. }
  164. void pop_stack_identifiers() {
  165. int current_locals = stack_identifiers_counts.back()->get();
  166. stack_identifiers_counts.pop_back();
  167. stack_identifiers = stack_id_stack.back()->get();
  168. stack_id_stack.pop_back();
  169. #ifdef DEBUG_ENABLED
  170. if (!used_temporaries.is_empty()) {
  171. ERR_PRINT("Leaving block with non-zero temporary variables: " + itos(used_temporaries.size()));
  172. }
  173. #endif
  174. for (int i = current_locals; i < locals.size(); i++) {
  175. dirty_locals.insert(i + GDScriptFunction::FIXED_ADDRESSES_MAX);
  176. }
  177. locals.resize(current_locals);
  178. if (debug_stack) {
  179. for (const KeyValue<StringName, int> &E : block_identifiers) {
  180. GDScriptFunction::StackDebug sd;
  181. sd.added = false;
  182. sd.identifier = E.key;
  183. sd.line = current_line;
  184. sd.pos = E.value;
  185. stack_debug.push_back(sd);
  186. }
  187. block_identifiers = block_identifier_stack.back()->get();
  188. block_identifier_stack.pop_back();
  189. }
  190. }
  191. int get_name_map_pos(const StringName &p_identifier) {
  192. int ret;
  193. if (!name_map.has(p_identifier)) {
  194. ret = name_map.size();
  195. name_map[p_identifier] = ret;
  196. } else {
  197. ret = name_map[p_identifier];
  198. }
  199. return ret;
  200. }
  201. int get_constant_pos(const Variant &p_constant) {
  202. if (constant_map.has(p_constant)) {
  203. return constant_map[p_constant];
  204. }
  205. int pos = constant_map.size();
  206. constant_map[p_constant] = pos;
  207. return pos;
  208. }
  209. int get_operation_pos(const Variant::ValidatedOperatorEvaluator p_operation) {
  210. if (operator_func_map.has(p_operation)) {
  211. return operator_func_map[p_operation];
  212. }
  213. int pos = operator_func_map.size();
  214. operator_func_map[p_operation] = pos;
  215. return pos;
  216. }
  217. int get_setter_pos(const Variant::ValidatedSetter p_setter) {
  218. if (setters_map.has(p_setter)) {
  219. return setters_map[p_setter];
  220. }
  221. int pos = setters_map.size();
  222. setters_map[p_setter] = pos;
  223. return pos;
  224. }
  225. int get_getter_pos(const Variant::ValidatedGetter p_getter) {
  226. if (getters_map.has(p_getter)) {
  227. return getters_map[p_getter];
  228. }
  229. int pos = getters_map.size();
  230. getters_map[p_getter] = pos;
  231. return pos;
  232. }
  233. int get_keyed_setter_pos(const Variant::ValidatedKeyedSetter p_keyed_setter) {
  234. if (keyed_setters_map.has(p_keyed_setter)) {
  235. return keyed_setters_map[p_keyed_setter];
  236. }
  237. int pos = keyed_setters_map.size();
  238. keyed_setters_map[p_keyed_setter] = pos;
  239. return pos;
  240. }
  241. int get_keyed_getter_pos(const Variant::ValidatedKeyedGetter p_keyed_getter) {
  242. if (keyed_getters_map.has(p_keyed_getter)) {
  243. return keyed_getters_map[p_keyed_getter];
  244. }
  245. int pos = keyed_getters_map.size();
  246. keyed_getters_map[p_keyed_getter] = pos;
  247. return pos;
  248. }
  249. int get_indexed_setter_pos(const Variant::ValidatedIndexedSetter p_indexed_setter) {
  250. if (indexed_setters_map.has(p_indexed_setter)) {
  251. return indexed_setters_map[p_indexed_setter];
  252. }
  253. int pos = indexed_setters_map.size();
  254. indexed_setters_map[p_indexed_setter] = pos;
  255. return pos;
  256. }
  257. int get_indexed_getter_pos(const Variant::ValidatedIndexedGetter p_indexed_getter) {
  258. if (indexed_getters_map.has(p_indexed_getter)) {
  259. return indexed_getters_map[p_indexed_getter];
  260. }
  261. int pos = indexed_getters_map.size();
  262. indexed_getters_map[p_indexed_getter] = pos;
  263. return pos;
  264. }
  265. int get_builtin_method_pos(const Variant::ValidatedBuiltInMethod p_method) {
  266. if (builtin_method_map.has(p_method)) {
  267. return builtin_method_map[p_method];
  268. }
  269. int pos = builtin_method_map.size();
  270. builtin_method_map[p_method] = pos;
  271. return pos;
  272. }
  273. int get_constructor_pos(const Variant::ValidatedConstructor p_constructor) {
  274. if (constructors_map.has(p_constructor)) {
  275. return constructors_map[p_constructor];
  276. }
  277. int pos = constructors_map.size();
  278. constructors_map[p_constructor] = pos;
  279. return pos;
  280. }
  281. int get_utility_pos(const Variant::ValidatedUtilityFunction p_utility) {
  282. if (utilities_map.has(p_utility)) {
  283. return utilities_map[p_utility];
  284. }
  285. int pos = utilities_map.size();
  286. utilities_map[p_utility] = pos;
  287. return pos;
  288. }
  289. int get_gds_utility_pos(const GDScriptUtilityFunctions::FunctionPtr p_gds_utility) {
  290. if (gds_utilities_map.has(p_gds_utility)) {
  291. return gds_utilities_map[p_gds_utility];
  292. }
  293. int pos = gds_utilities_map.size();
  294. gds_utilities_map[p_gds_utility] = pos;
  295. return pos;
  296. }
  297. int get_method_bind_pos(MethodBind *p_method) {
  298. if (method_bind_map.has(p_method)) {
  299. return method_bind_map[p_method];
  300. }
  301. int pos = method_bind_map.size();
  302. method_bind_map[p_method] = pos;
  303. return pos;
  304. }
  305. int get_lambda_function_pos(GDScriptFunction *p_lambda_function) {
  306. if (lambdas_map.has(p_lambda_function)) {
  307. return lambdas_map[p_lambda_function];
  308. }
  309. int pos = lambdas_map.size();
  310. lambdas_map[p_lambda_function] = pos;
  311. return pos;
  312. }
  313. CallTarget get_call_target(const Address &p_target, Variant::Type p_type = Variant::NIL);
  314. int address_of(const Address &p_address) {
  315. switch (p_address.mode) {
  316. case Address::SELF:
  317. return GDScriptFunction::ADDR_SELF;
  318. case Address::CLASS:
  319. return GDScriptFunction::ADDR_CLASS;
  320. case Address::MEMBER:
  321. return p_address.address | (GDScriptFunction::ADDR_TYPE_MEMBER << GDScriptFunction::ADDR_BITS);
  322. case Address::CONSTANT:
  323. return p_address.address | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS);
  324. case Address::LOCAL_VARIABLE:
  325. case Address::FUNCTION_PARAMETER:
  326. return p_address.address | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS);
  327. case Address::TEMPORARY:
  328. temporaries.write[p_address.address].bytecode_indices.push_back(opcodes.size());
  329. return -1;
  330. case Address::NIL:
  331. return GDScriptFunction::ADDR_NIL;
  332. }
  333. return -1; // Unreachable.
  334. }
  335. void append_opcode(GDScriptFunction::Opcode p_code) {
  336. opcodes.push_back(p_code);
  337. }
  338. void append_opcode_and_argcount(GDScriptFunction::Opcode p_code, int p_argument_count) {
  339. opcodes.push_back(p_code);
  340. opcodes.push_back(p_argument_count);
  341. instr_args_max = MAX(instr_args_max, p_argument_count);
  342. }
  343. void append(int p_code) {
  344. opcodes.push_back(p_code);
  345. }
  346. void append(const Address &p_address) {
  347. opcodes.push_back(address_of(p_address));
  348. }
  349. void append(const StringName &p_name) {
  350. opcodes.push_back(get_name_map_pos(p_name));
  351. }
  352. void append(const Variant::ValidatedOperatorEvaluator p_operation) {
  353. opcodes.push_back(get_operation_pos(p_operation));
  354. }
  355. void append(const Variant::ValidatedSetter p_setter) {
  356. opcodes.push_back(get_setter_pos(p_setter));
  357. }
  358. void append(const Variant::ValidatedGetter p_getter) {
  359. opcodes.push_back(get_getter_pos(p_getter));
  360. }
  361. void append(const Variant::ValidatedKeyedSetter p_keyed_setter) {
  362. opcodes.push_back(get_keyed_setter_pos(p_keyed_setter));
  363. }
  364. void append(const Variant::ValidatedKeyedGetter p_keyed_getter) {
  365. opcodes.push_back(get_keyed_getter_pos(p_keyed_getter));
  366. }
  367. void append(const Variant::ValidatedIndexedSetter p_indexed_setter) {
  368. opcodes.push_back(get_indexed_setter_pos(p_indexed_setter));
  369. }
  370. void append(const Variant::ValidatedIndexedGetter p_indexed_getter) {
  371. opcodes.push_back(get_indexed_getter_pos(p_indexed_getter));
  372. }
  373. void append(const Variant::ValidatedBuiltInMethod p_method) {
  374. opcodes.push_back(get_builtin_method_pos(p_method));
  375. }
  376. void append(const Variant::ValidatedConstructor p_constructor) {
  377. opcodes.push_back(get_constructor_pos(p_constructor));
  378. }
  379. void append(const Variant::ValidatedUtilityFunction p_utility) {
  380. opcodes.push_back(get_utility_pos(p_utility));
  381. }
  382. void append(const GDScriptUtilityFunctions::FunctionPtr p_gds_utility) {
  383. opcodes.push_back(get_gds_utility_pos(p_gds_utility));
  384. }
  385. void append(MethodBind *p_method) {
  386. opcodes.push_back(get_method_bind_pos(p_method));
  387. }
  388. void append(GDScriptFunction *p_lambda_function) {
  389. opcodes.push_back(get_lambda_function_pos(p_lambda_function));
  390. }
  391. void patch_jump(int p_address) {
  392. opcodes.write[p_address] = opcodes.size();
  393. }
  394. public:
  395. virtual uint32_t add_parameter(const StringName &p_name, bool p_is_optional, const GDScriptDataType &p_type) override;
  396. virtual uint32_t add_local(const StringName &p_name, const GDScriptDataType &p_type) override;
  397. virtual uint32_t add_local_constant(const StringName &p_name, const Variant &p_constant) override;
  398. virtual uint32_t add_or_get_constant(const Variant &p_constant) override;
  399. virtual uint32_t add_or_get_name(const StringName &p_name) override;
  400. virtual uint32_t add_temporary(const GDScriptDataType &p_type) override;
  401. virtual void pop_temporary() override;
  402. virtual void clear_temporaries() override;
  403. virtual void clear_address(const Address &p_address) override;
  404. virtual bool is_local_dirty(const Address &p_address) const override;
  405. virtual void start_parameters() override;
  406. virtual void end_parameters() override;
  407. virtual void start_block() override;
  408. virtual void end_block() override;
  409. 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;
  410. virtual GDScriptFunction *write_end() override;
  411. #ifdef DEBUG_ENABLED
  412. virtual void set_signature(const String &p_signature) override;
  413. #endif
  414. virtual void set_initial_line(int p_line) override;
  415. virtual void write_type_adjust(const Address &p_target, Variant::Type p_new_type) override;
  416. virtual void write_unary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand) override;
  417. virtual void write_binary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand, const Address &p_right_operand) override;
  418. virtual void write_type_test(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override;
  419. virtual void write_and_left_operand(const Address &p_left_operand) override;
  420. virtual void write_and_right_operand(const Address &p_right_operand) override;
  421. virtual void write_end_and(const Address &p_target) override;
  422. virtual void write_or_left_operand(const Address &p_left_operand) override;
  423. virtual void write_or_right_operand(const Address &p_right_operand) override;
  424. virtual void write_end_or(const Address &p_target) override;
  425. virtual void write_start_ternary(const Address &p_target) override;
  426. virtual void write_ternary_condition(const Address &p_condition) override;
  427. virtual void write_ternary_true_expr(const Address &p_expr) override;
  428. virtual void write_ternary_false_expr(const Address &p_expr) override;
  429. virtual void write_end_ternary() override;
  430. virtual void write_set(const Address &p_target, const Address &p_index, const Address &p_source) override;
  431. virtual void write_get(const Address &p_target, const Address &p_index, const Address &p_source) override;
  432. virtual void write_set_named(const Address &p_target, const StringName &p_name, const Address &p_source) override;
  433. virtual void write_get_named(const Address &p_target, const StringName &p_name, const Address &p_source) override;
  434. virtual void write_set_member(const Address &p_value, const StringName &p_name) override;
  435. virtual void write_get_member(const Address &p_target, const StringName &p_name) override;
  436. virtual void write_set_static_variable(const Address &p_value, const Address &p_class, int p_index) override;
  437. virtual void write_get_static_variable(const Address &p_target, const Address &p_class, int p_index) override;
  438. virtual void write_assign(const Address &p_target, const Address &p_source) override;
  439. virtual void write_assign_with_conversion(const Address &p_target, const Address &p_source) override;
  440. virtual void write_assign_null(const Address &p_target) override;
  441. virtual void write_assign_true(const Address &p_target) override;
  442. virtual void write_assign_false(const Address &p_target) override;
  443. virtual void write_assign_default_parameter(const Address &p_dst, const Address &p_src, bool p_use_conversion) override;
  444. virtual void write_store_global(const Address &p_dst, int p_global_index) override;
  445. virtual void write_store_named_global(const Address &p_dst, const StringName &p_global) override;
  446. virtual void write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override;
  447. virtual void write_call(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  448. virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  449. virtual void write_call_async(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  450. virtual void write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override;
  451. 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);
  452. virtual void write_call_gdscript_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override;
  453. 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;
  454. 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;
  455. virtual void write_call_native_static(const Address &p_target, const StringName &p_class, const StringName &p_method, const Vector<Address> &p_arguments) override;
  456. virtual void write_call_native_static_validated(const Address &p_target, MethodBind *p_method, const Vector<Address> &p_arguments) override;
  457. virtual void write_call_method_bind(const Address &p_target, const Address &p_base, MethodBind *p_method, const Vector<Address> &p_arguments) override;
  458. virtual void write_call_method_bind_validated(const Address &p_target, const Address &p_base, MethodBind *p_method, const Vector<Address> &p_arguments) override;
  459. virtual void write_call_self(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  460. virtual void write_call_self_async(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override;
  461. 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;
  462. virtual void write_lambda(const Address &p_target, GDScriptFunction *p_function, const Vector<Address> &p_captures, bool p_use_self) override;
  463. virtual void write_construct(const Address &p_target, Variant::Type p_type, const Vector<Address> &p_arguments) override;
  464. virtual void write_construct_array(const Address &p_target, const Vector<Address> &p_arguments) override;
  465. virtual void write_construct_typed_array(const Address &p_target, const GDScriptDataType &p_element_type, const Vector<Address> &p_arguments) override;
  466. virtual void write_construct_dictionary(const Address &p_target, const Vector<Address> &p_arguments) override;
  467. virtual void write_construct_typed_dictionary(const Address &p_target, const GDScriptDataType &p_key_type, const GDScriptDataType &p_value_type, const Vector<Address> &p_arguments) override;
  468. virtual void write_await(const Address &p_target, const Address &p_operand) override;
  469. virtual void write_if(const Address &p_condition) override;
  470. virtual void write_else() override;
  471. virtual void write_endif() override;
  472. virtual void write_jump_if_shared(const Address &p_value) override;
  473. virtual void write_end_jump_if_shared() override;
  474. virtual void start_for(const GDScriptDataType &p_iterator_type, const GDScriptDataType &p_list_type) override;
  475. virtual void write_for_assignment(const Address &p_list) override;
  476. virtual void write_for(const Address &p_variable, bool p_use_conversion) override;
  477. virtual void write_endfor() override;
  478. virtual void start_while_condition() override;
  479. virtual void write_while(const Address &p_condition) override;
  480. virtual void write_endwhile() override;
  481. virtual void write_break() override;
  482. virtual void write_continue() override;
  483. virtual void write_breakpoint() override;
  484. virtual void write_newline(int p_line) override;
  485. virtual void write_return(const Address &p_return_value) override;
  486. virtual void write_assert(const Address &p_test, const Address &p_message) override;
  487. virtual ~GDScriptByteCodeGenerator();
  488. };
  489. #endif // GDSCRIPT_BYTE_CODEGEN_H