• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//arkcompiler/runtime_core/static_core/ark_config.gni")
15import("//build/ohos.gni")
16import("$ark_root/plugins/plugins.gni")
17import("$ark_root/verification/verification.gni")
18
19runtime_yaml = [ "runtime.yaml" ]
20if (enable_irtoc) {
21  runtime_yaml += [ "$ark_root/irtoc/intrinsics.yaml" ]
22}
23runtime_yaml += plugin_runtime_yamls
24
25config("arkruntime_public_config") {
26  include_dirs = [
27    "$ark_root/runtime",
28    get_label_info(
29        "$ark_root/cross_values:cross_values_getters_generate(${default_toolchain})",
30        "target_gen_dir"),
31    "$target_gen_dir",
32    "$target_gen_dir/generated",
33    "$target_gen_dir/include",
34  ]
35
36  include_dirs += platform_include_dirs
37
38  configs = [
39    "$ark_root/libpandabase:arkbase_public_config",
40    "$ark_root/libpandafile:arkfile_public_config",
41    "$ark_root/verification/gen:verification_public_config",
42    "$ark_root/compiler:arkcompiler_public_config",
43  ]
44  configs += plugin_runtime_configs
45}
46
47config("arkruntime_config") {
48  include_dirs = [
49    "$ark_root/compiler",
50    "$ark_root/dprof/libdprof",
51  ]
52
53  cflags_cc = [
54    "-Wno-invalid-offsetof",
55    "-Wno-unused-parameter",
56  ]
57
58  if (current_cpu == "arm64") {
59    asmflags = [ "-march=armv8-a+crc" ]
60  }
61
62  configs = [
63    "//build/config/compiler:optimize_speed",
64    "//build/config/compiler:no_exceptions",
65    "//build/config/compiler:no_rtti",
66  ]
67}
68
69group("arkruntime_header_deps") {
70  deps = [
71    ":arkruntime_gen_entrypoints_entrypoints_gen_S",
72    ":arkruntime_gen_entrypoints_entrypoints_gen_h",
73    ":arkruntime_gen_intrinsics_intrinsics_enum_h",
74    ":arkruntime_gen_intrinsics_intrinsics_gen_h",
75    ":arkruntime_gen_intrinsics_intrinsics_h",
76    ":arkruntime_gen_intrinsics_unimplemented_intrinsics-inl_cpp",
77    ":arkruntime_gen_intrinsics_yaml",
78    ":intrinsics_inl_h",
79    ":isa_gen_libarkruntime_interpreter-inl_gen_h",
80    ":isa_gen_libarkruntime_isa_constants_gen_h",
81    ":language_config_gen_inc",
82    ":libarkruntime_options_gen_h",
83    ":libarkruntime_shorty_values_h",
84    ":plugin_clear_profile_h",
85    ":plugin_destroy_profile_h",
86    ":plugin_dump_profile_h",
87    ":plugin_find_method_in_profile_h",
88    ":plugin_profiling_includes_disasm_h",
89    ":plugin_profiling_includes_h",
90    ":plugin_read_profile_h",
91    ":plugins_asm_defines_def",
92    ":plugins_defines_h",
93    ":plugins_entrypoints_gen_h",
94    ":plugins_inc",
95    ":plugins_interpreters_inl_h",
96    ":profiling_gen_profiling_gen_h",
97    ":substitute_icu_path",
98    "$ark_root/libpandabase:base_options_h",
99    "$ark_root/verification/gen:isa_gen_verification_gen_abs_int_inl_gen_h",
100    "$ark_root/verification/gen:isa_gen_verification_gen_cflow_iterate_inl_gen_h",
101    "$ark_root/verification/gen:isa_gen_verification_gen_handle_gen_h",
102    "$ark_root/verification/gen:isa_gen_verification_gen_job_fill_gen_h",
103    "$ark_root/verification/gen:verification_abs_int_inl_compat_checks_h",
104    "$ark_root/verification/gen:verification_gen_plugins_gen_inc",
105    "$ark_root/verification/gen:verification_verifier_messages_data_cpp",
106    "$ark_root/verification/gen:verification_verifier_messages_h",
107  ]
108  if (enable_irtoc) {
109    deps += [ ":isa_gen_libarkruntime_irtoc_interpreter_utils_h" ]
110  }
111
112  deps += plugin_arkruntime_header_plugin_deps
113}
114
115ohos_source_set("libarkruntime_set_static") {
116  sources = [
117    "arch/asm_support.cpp",
118    "assert_gc_scope.cpp",
119    "bridge/bridge.cpp",
120    "cframe.cpp",
121    "cha.cpp",
122    "class.cpp",
123    "class_helper.cpp",
124    "class_initializer.cpp",
125    "class_linker.cpp",
126    "class_linker_extension.cpp",
127    "compiler.cpp",
128    "compiler_task_manager_worker.cpp",
129    "compiler_thread_pool_worker.cpp",
130    "coretypes/array.cpp",
131    "coretypes/string.cpp",
132    "coroutines/coroutine.cpp",
133    "coroutines/coroutine_events.cpp",
134    "coroutines/coroutine_manager.cpp",
135    "coroutines/coroutine_stats.cpp",
136    "coroutines/stackful_coroutine.cpp",
137    "coroutines/stackful_coroutine_manager.cpp",
138    "coroutines/stackful_coroutine_worker.cpp",
139    "coroutines/threaded_coroutine.cpp",
140    "coroutines/threaded_coroutine_manager.cpp",
141    "default_debugger_agent.cpp",
142    "deoptimization.cpp",
143    "entrypoints/entrypoints.cpp",
144    "exceptions.cpp",
145    "fibers/fiber_context.cpp",
146    "field.cpp",
147    "file_manager.cpp",
148    "gc_task.cpp",
149    "global_object_lock.cpp",
150    "handle_scope.cpp",
151    "hotreload/hotreload.cpp",
152    "imtable_builder.cpp",
153    "init_icu.cpp",
154    "interpreter/interpreter.cpp",
155    "interpreter/runtime_interface.cpp",
156    "intrinsics.cpp",
157    "language_context.cpp",
158    "loadable_agent.cpp",
159    "lock_order_graph.cpp",
160    "locks.cpp",
161    "mark_word.cpp",
162    "mem/allocator.cpp",
163    "mem/gc/bitmap.cpp",
164    "mem/gc/card_table.cpp",
165    "mem/gc/epsilon-g1/epsilon-g1.cpp",
166    "mem/gc/epsilon/epsilon.cpp",
167    "mem/gc/epsilon/epsilon_barrier.cpp",
168    "mem/gc/g1/g1-allocator.cpp",
169    "mem/gc/g1/g1-gc.cpp",
170    "mem/gc/g1/g1-helpers.cpp",
171    "mem/gc/g1/g1_analytics.cpp",
172    "mem/gc/g1/g1_pause_tracker.cpp",
173    "mem/gc/g1/hot_cards.cpp",
174    "mem/gc/g1/ref_updater.cpp",
175    "mem/gc/g1/update_remset_task_queue.cpp",
176    "mem/gc/g1/update_remset_thread.cpp",
177    "mem/gc/g1/update_remset_worker.cpp",
178    "mem/gc/gc-hung/gc_hung.cpp",
179    "mem/gc/gc.cpp",
180    "mem/gc/gc_adaptive_stack.cpp",
181    "mem/gc/gc_barrier_set.cpp",
182    "mem/gc/gc_queue.cpp",
183    "mem/gc/gc_root.cpp",
184    "mem/gc/gc_root_type.cpp",
185    "mem/gc/gc_scope.cpp",
186    "mem/gc/gc_scoped_phase.cpp",
187    "mem/gc/gc_settings.cpp",
188    "mem/gc/gc_stats.cpp",
189    "mem/gc/gc_trigger.cpp",
190    "mem/gc/gen-gc/gen-gc.cpp",
191    "mem/gc/generational-gc-base.cpp",
192    "mem/gc/heap-space-misc/crossing_map.cpp",
193    "mem/gc/heap-space-misc/crossing_map_singleton.cpp",
194    "mem/gc/lang/gc_lang.cpp",
195    "mem/gc/stw-gc/stw-gc.cpp",
196    "mem/gc/workers/gc_worker.cpp",
197    "mem/gc/workers/gc_workers_task_pool.cpp",
198    "mem/gc/workers/gc_workers_task_queue.cpp",
199    "mem/gc/workers/gc_workers_thread_pool.cpp",
200    "mem/heap_manager.cpp",
201    "mem/heap_space.cpp",
202    "mem/heap_verifier.cpp",
203    "mem/internal_allocator.cpp",
204    "mem/mem_stats.cpp",
205    "mem/mem_stats_additional_info.cpp",
206    "mem/mem_stats_default.cpp",
207    "mem/memory_manager.cpp",
208    "mem/object_helpers.cpp",
209    "mem/panda_string.cpp",
210    "mem/refstorage/global_object_storage.cpp",
211    "mem/refstorage/ref_block.cpp",
212    "mem/refstorage/reference_storage.cpp",
213    "mem/region_space.cpp",
214    "mem/rendezvous.cpp",
215    "mem/runslots.cpp",
216    "mem/tlab.cpp",
217    "method.cpp",
218    "methodtrace/trace.cpp",
219    "monitor.cpp",
220    "monitor_object_lock.cpp",
221    "monitor_pool.cpp",
222    "mt_thread_manager.cpp",
223    "object_accessor.cpp",
224    "object_header.cpp",
225    "osr.cpp",
226    "panda_vm.cpp",
227    "plugins.cpp",
228    "profilesaver/profile_dump_info.cpp",
229    "profilesaver/profile_saver.cpp",
230    "regexp/ecmascript/mem/dyn_chunk.cpp",
231    "regexp/ecmascript/regexp_executor.cpp",
232    "regexp/ecmascript/regexp_opcode.cpp",
233    "regexp/ecmascript/regexp_parser.cpp",
234    "relayout_profiler.cpp",
235    "runtime.cpp",
236    "runtime_controller.cpp",
237    "runtime_helpers.cpp",
238    "stack_walker.cpp",
239    "string_table.cpp",
240    "thread.cpp",
241    "time_utils.cpp",
242    "timing.cpp",
243    "tooling/debug_inf.cpp",
244    "tooling/debugger.cpp",
245    "tooling/default_inspector_extension.cpp",
246    "tooling/pt_thread.cpp",
247    "tooling/sampler/lock_free_queue.cpp",
248    "tooling/sampler/sample_writer.cpp",
249    "tooling/sampler/sampling_profiler.cpp",
250    "tooling/sampler/stack_walker_base.cpp",
251    "tooling/sampler/thread_communicator.cpp",
252    "tooling/tools.cpp",
253    "vtable_builder_base.cpp",
254  ]
255
256  if (!is_mingw) {
257    sources += [
258      "dprofiler/dprofiler.cpp",
259      "signal_handler.cpp",
260    ]
261  }
262
263  if (enable_irtoc) {
264    sources += [ "$ark_root_gen_dir/generated/irtoc_lib.o" ]
265    if (is_llvm_interpreter || is_llvm_fastpath) {
266      sources += [ "$ark_root_gen_dir/generated/irtoc_llvm_lib.o" ]
267    }
268  }
269  if (current_cpu == "arm") {
270    sources += [
271      "arch/arm/interpreter_support.S",
272      "arch/arm/osr_arm.S",
273      "bridge/arch/arm/compiled_code_to_interpreter_bridge_arm.S",
274      "bridge/arch/arm/compiled_code_to_interpreter_bridge_dyn_arm.S",
275      "bridge/arch/arm/compiled_code_to_runtime_bridge_arm.S",
276      "bridge/arch/arm/deoptimization_arm.S",
277      "bridge/arch/arm/expand_compiled_code_args_dyn_arm.S",
278      "bridge/arch/arm/interpreter_to_compiled_code_bridge_arm.S",
279      "bridge/arch/arm/interpreter_to_compiled_code_bridge_dyn_arm.S",
280      "fibers/arch/arm/get.S",
281      "fibers/arch/arm/switch.S",
282      "fibers/arch/arm/update.S",
283    ]
284    #TODO add arm32 abi hard
285  } else if (current_cpu == "arm64") {
286    sources += [
287      "arch/aarch64/interpreter_support.S",
288      "arch/aarch64/osr_aarch64.S",
289      "bridge/arch/aarch64/compiled_code_to_interpreter_bridge_aarch64.S",
290      "bridge/arch/aarch64/compiled_code_to_interpreter_bridge_dyn_aarch64.S",
291      "bridge/arch/aarch64/compiled_code_to_runtime_bridge_aarch64.S",
292      "bridge/arch/aarch64/deoptimization_aarch64.S",
293      "bridge/arch/aarch64/expand_compiled_code_args_dyn_aarch64.S",
294      "bridge/arch/aarch64/interpreter_to_compiled_code_bridge_aarch64.S",
295      "bridge/arch/aarch64/interpreter_to_compiled_code_bridge_dyn_aarch64.S",
296      "fibers/arch/aarch64/get.S",
297      "fibers/arch/aarch64/switch.S",
298      "fibers/arch/aarch64/update.S",
299    ]
300  } else if (current_cpu == "x86") {
301    sources += [
302      "arch/x86/interpreter_support.S",
303      "arch/x86/osr_x86.S",
304      "bridge/arch/x86/compiled_code_to_interpreter_bridge_x86.S",
305      "bridge/arch/x86/deoptimization_x86.S",
306      "bridge/arch/x86/interpreter_to_compiled_code_bridge_x86.S",
307    ]
308  } else if (current_cpu == "amd64" || current_cpu == "x64" ||
309             current_cpu == "x86_64") {
310    sources += [
311      "arch/amd64/common_amd64.S",
312      "arch/amd64/interpreter_support.S",
313      "arch/amd64/osr_amd64.S",
314      "bridge/arch/amd64/compiled_code_to_interpreter_bridge_amd64.S",
315      "bridge/arch/amd64/compiled_code_to_interpreter_bridge_dyn_amd64.S",
316      "bridge/arch/amd64/compiled_code_to_runtime_bridge_amd64.S",
317      "bridge/arch/amd64/deoptimization_amd64.S",
318      "bridge/arch/amd64/expand_compiled_code_args_dyn_amd64.S",
319      "bridge/arch/amd64/interpreter_to_compiled_code_bridge_amd64.S",
320      "bridge/arch/amd64/interpreter_to_compiled_code_bridge_dyn_amd64.S",
321      "fibers/arch/amd64/get.S",
322      "fibers/arch/amd64/switch.S",
323      "fibers/arch/amd64/update.S",
324    ]
325  }
326
327  if (is_mob) {
328    sources += [
329      "$ark_root/platforms/mobile/runtime/thread.cpp",
330      "$ark_root/platforms/mobile/runtime/verify_app_install.cpp",
331    ]
332  } else {
333    sources += [
334      "$ark_root/platforms/common/runtime/thread.cpp",
335      "$ark_root/platforms/common/runtime/verify_app_install.cpp",
336    ]
337  }
338
339  core_vm_sources = [
340    "core/core_class_linker_extension.cpp",
341    "core/core_language_context.cpp",
342    "core/core_vm.cpp",
343  ]
344
345  sources += core_vm_sources
346  sources += verifier_sources + plugin_verifier_sources
347  sources += plugin_runtime_sources
348
349  public_configs = [
350    "$ark_root/assembler:arkassembler_public_config",
351    "$ark_root:ark_config",
352    "$ark_root/libpandabase:arkbase_public_config",
353    "$ark_root/libpandafile:arkfile_public_config",
354    "$ark_root/compiler:arkcompiler_public_config",
355    "$ark_root/verification/gen:verification_public_config",
356    ":arkruntime_public_config",
357    ":arkruntime_config",
358    "$ark_root/runtime/asm_defines:asmdefines_public_config",
359  ]
360
361  deps = [
362    ":arkruntime_header_deps",
363    ":arkruntime_interpreter_impl",
364    "$ark_root/compiler:libarkcompiler_intrinsics_gen_inl_entrypoints_bridge_asm_macro_inl",
365    "$ark_root/compiler:libarkcompiler_intrinsics_gen_inl_intrinsics_enum_inl",
366    "$ark_root/compiler:libarktscompiler",
367    "$ark_root/compiler/aot:libarkaotmanager",
368    "$ark_root/cross_values:cross_values_getters_generate(${default_toolchain})",
369    "$ark_root/libpandabase:libarktsbase",
370    "$ark_root/libpandafile:libarkfile_type_gen_h",
371    "$ark_root/libpandafile:libarktsfile",
372    "$ark_root/libziparchive:libarktsziparchive",
373    "$ark_root/runtime/asm_defines:asm_defines_generator",
374  ]
375
376  external_deps = [
377    "napi:ace_napi",
378    icui18n_dep,
379    icuuc_dep,
380    sdk_libc_secshared_dep,
381  ]
382
383  deps += plugin_runtime_deps
384  deps += plugin_arkruntime_stdlib_plugin_deps
385
386  if (!is_mingw) {
387    deps += [ "$ark_root/dprof:libdprof" ]
388  }
389
390  if (enable_irtoc) {
391    deps += [ "$ark_root/irtoc:irtoc_generate" ]
392  }
393
394  if (current_cpu == "arm") {
395    deps += [
396      ":bridge_dispatch_arm",
397      ":bridge_dispatch_dyn_arm",
398    ]
399  } else if (current_cpu == "arm64") {
400    deps += [
401      ":bridge_dispatch_aarch64",
402      ":bridge_dispatch_dyn_aarch64",
403    ]
404  } else if (current_cpu == "amd64" || current_cpu == "x64" ||
405             current_cpu == "x86_64") {
406    deps += [
407      ":bridge_dispatch_amd64",
408      ":bridge_dispatch_dyn_amd64",
409    ]
410  }
411  if (is_ohos && is_standard_system) {
412    defines = [ "PANDA_USE_OHOS_LOG" ]
413  }
414
415  if (is_ohos && is_standard_system) {
416    external_deps += [ "hilog:libhilog" ]
417  }
418  part_name = ark_part_name
419  subsystem_name = ark_subsystem_name
420}
421
422ohos_static_library("libarkruntime_static") {
423  deps = [ ":libarkruntime_set_static" ]
424  output_extension = "a"
425  part_name = ark_part_name
426  subsystem_name = "$ark_subsystem_name"
427}
428
429ohos_shared_library("libarkruntime") {
430  deps = [ ":libarkruntime_set_static" ]
431
432  if (current_cpu == "amd64" || current_cpu == "x64" ||
433      current_cpu == "x86_64") {
434    ldflags = [ "-latomic" ]
435  }
436
437  output_extension = "so"
438  part_name = ark_part_name
439  subsystem_name = "$ark_subsystem_name"
440}
441
442config("arkruntime_interpreter_impl_config") {
443  include_dirs = [
444    "$ark_root/compiler",
445    "$ark_root/libpandabase",
446    "$ark_root/libpandafile",
447    "$ark_root/runtime",
448    "$ark_root/dprof/libdprof",
449    get_label_info(
450        "$ark_root/cross_values:cross_values_getters_generate(${default_toolchain})",
451        "target_gen_dir"),
452    "$target_gen_dir",
453    "$target_gen_dir/generated",
454    "$target_gen_dir/include",
455  ]
456
457  include_dirs += platform_include_dirs
458
459  configs = plugin_runtime_interpreter_impl_configs
460
461  cflags_cc = [
462    "-Wno-invalid-offsetof",
463    "-Wno-unused-parameter",
464  ]
465  defines = []
466
467  if (ark_enable_global_register_variables) {
468    if (current_cpu == "arm64") {
469      cflags_cc += [
470        "-ffixed-x20",
471        "-ffixed-x21",
472        "-ffixed-x22",
473        "-ffixed-x23",
474        "-ffixed-x24",
475        "-ffixed-x25",
476        "-ffixed-x28",
477      ]
478      defines += [ "FFIXED_REGISTERS" ]
479    }
480  }
481}
482
483ohos_source_set("arkruntime_interpreter_impl_static") {
484  sources = [ "interpreter/interpreter_impl.cpp" ]
485
486  public_configs = [
487    "$ark_root:ark_config",
488    "$ark_root/libpandabase:arkbase_public_config",
489    "$ark_root/libpandafile:arkfile_public_config",
490    "$ark_root/runtime:arkruntime_public_config",
491    "$ark_root/compiler:arkcompiler_public_config",
492    "$ark_root/verification/gen:verification_public_config",
493    ":arkruntime_interpreter_impl_config",
494  ]
495
496  deps = [
497    ":arkruntime_header_deps",
498    "$ark_root/cross_values:cross_values_getters_generate(${default_toolchain})",
499    "$ark_root/libpandabase:libarktsbase",
500    "$ark_root/libpandafile:libarktsfile",
501  ]
502
503  external_deps = [ sdk_libc_secshared_dep ]
504
505  deps += plugin_arkruntime_stdlib_plugin_deps
506
507  part_name = ark_part_name
508  subsystem_name = "$ark_subsystem_name"
509}
510
511# panda_set_lib_32bit_property not used in android
512ohos_static_library("arkruntime_interpreter_impl") {
513  deps = [ ":arkruntime_interpreter_impl_static" ]
514  part_name = ark_part_name
515  subsystem_name = ark_subsystem_name
516}
517
518template("gen_intrinsics_yaml") {
519  assert(defined(invoker.data_files), "data_files required!")
520  assert(defined(invoker.output_file), "output_file required!")
521
522  data_files = string_join(",", rebase_path(invoker.data_files, root_build_dir))
523  template_file = "templates/intrinsics.yaml.erb"
524  requires = string_join(",",
525                         [
526                           rebase_path("templates/runtime.rb", root_build_dir),
527                           rebase_path("$ark_root/libpandabase/utils.rb",
528                                       root_build_dir),
529                         ])
530
531  action("$target_name") {
532    script = "$ark_root/runtime/templates/gen_intrinsics_data.rb"
533
534    # rerun action when data file or template file update
535    inputs = [ template_file ]
536    inputs += invoker.data_files
537
538    outputs = [ invoker.output_file ]
539    args = [
540      rebase_path("templates/runtime.rb", root_build_dir),
541      "-d",
542      data_files,
543      "-t",
544      rebase_path(template_file, root_build_dir),
545      "-o",
546      rebase_path(outputs[0]),
547      "-r",
548      requires,
549    ]
550  }
551}
552
553gen_intrinsics_yaml("arkruntime_gen_intrinsics_yaml") {
554  data_files = runtime_yaml
555  output_file = "$target_gen_dir/intrinsics.yaml"
556}
557
558gen_include_dir = "$target_gen_dir/include"
559
560ark_isa_gen("profiling_gen") {
561  template_files = [ "profiling_gen.h.erb" ]
562  sources = "profiling"
563  destination = "$target_gen_dir/runtime/include"
564}
565
566config("profiling_gen_public_config") {
567  include_dirs =
568      [ get_label_info(":profiling_gen_profiling_gen_h", "target_gen_dir") ]
569}
570
571ark_isa_gen("isa_gen_libarkruntime") {
572  template_files = [
573    "interpreter-inl_gen.h.erb",
574    "isa_constants_gen.h.erb",
575  ]
576  if (enable_irtoc) {
577    template_files += [ "irtoc_interpreter_utils.h.erb" ]
578  }
579  sources = "interpreter/templates"
580  destination = gen_include_dir
581}
582
583isa = ark_isa_yaml
584isa_api = "$ark_root/isa/isapi.rb"
585bridge_dispatch_template = "templates/bridge_dispatch.S.erb"
586bridge_dispatch_dyn_template = "templates/bridge_dispatch_dyn.S.erb"
587bridge_archs = [
588  "aarch64",
589  "arm",
590  "armhf",
591  "amd64",
592  "x86",
593]
594foreach(arch, bridge_archs) {
595  ark_gen_file("bridge_dispatch_${arch}") {
596    data = [ isa ]
597    template_file = bridge_dispatch_template
598    output_file = "$gen_include_dir/bridge_dispatch_${arch}.S"
599    api = [ isa_api ]
600    requires = [
601      "templates/bridge_helpers_${arch}.rb",
602      "templates/bridge_helpers_common.rb",
603      "templates/bridge_helpers_static.rb",
604    ]
605    extra_dependencies = [ "$ark_root/isa:isa_combine" ]
606  }
607
608  ark_gen_file("bridge_dispatch_dyn_${arch}") {
609    data = [ isa ]
610    template_file = bridge_dispatch_dyn_template
611    output_file = "$gen_include_dir/bridge_dispatch_dyn_${arch}.S"
612    api = [ isa_api ]
613    requires = [
614      "templates/bridge_helpers_dynamic.rb",
615      "templates/bridge_helpers_common.rb",
616      "templates/bridge_helpers_${arch}.rb",
617    ]
618    extra_dependencies = [ "$ark_root/isa:isa_combine" ]
619  }
620}
621
622ark_gen("arkruntime_gen_entrypoints") {
623  data = [ "$target_gen_dir/entrypoints.yaml" ]
624  template_files = [
625    "entrypoints_gen.h.erb",
626    "entrypoints_gen.S.erb",
627    "entrypoints_compiler.inl.erb",
628  ]
629  api = [ "entrypoints/entrypoints.rb" ]
630  requires = [ "$ark_root/templates/common.rb" ]
631  sources = "entrypoints"
632  destination = "$target_gen_dir/generated"
633  extra_dependencies = [ "$ark_root:concat_entrypoints_yamls" ]
634}
635
636# Substitute ICU path
637action("substitute_icu_path") {
638  script = "templates/substitute_icu_path.rb"
639  outputs = [ "$target_gen_dir/init_icu_gen.cpp" ]
640  args = [
641    rebase_path("templates/init_icu_gen.cpp.erb"),
642    rebase_path("$target_gen_dir/init_icu_gen.cpp"),
643    rebase_path(ark_third_party_root),
644  ]
645}
646
647ark_gen("arkruntime_gen_entrypoints_compiler_checksum") {
648  data = [ "entrypoints/entrypoints.yaml" ]
649  template_files = [ "entrypoints_compiler_checksum.inl.erb" ]
650  api = [ "entrypoints/entrypoints.rb" ]
651  sources = "entrypoints"
652  destination = "$target_gen_dir/generated"
653  extra_dependencies =
654      [ "$ark_root/cross_values:cross_values_generate(${default_toolchain})" ]
655  extra_argv = [ rebase_path(
656          get_label_info(
657              "$ark_root/cross_values:cross_values_generate(${default_toolchain})",
658              "target_gen_dir"),
659          root_build_dir) ]
660}
661
662ark_gen("arkruntime_gen_intrinsics") {
663  data = [ "$target_gen_dir/intrinsics.yaml" ]
664  template_files = [
665    "intrinsics_gen.h.erb",
666    "intrinsics.h.erb",
667    "intrinsics_enum.h.erb",
668    "unimplemented_intrinsics-inl.cpp.erb",
669  ]
670  api = [ "templates/intrinsics.rb" ]
671  requires = [ "$ark_root/libpandabase/utils.rb" ]
672  sources = "templates"
673  destination = "$target_gen_dir"
674  extra_dependencies = [ ":arkruntime_gen_intrinsics_yaml" ]
675}
676
677ark_gen_file("libarkruntime_options_gen_h") {
678  template_file = "../templates/options/options.h.erb"
679  data = [ "$target_gen_dir/../runtime_options.yaml" ]
680  api = [ "../templates/common.rb" ]
681  output_file = "$target_gen_dir/generated/runtime_options_gen.h"
682  extra_dependencies = [ "$ark_root:merge_runtime_options_yamls" ]
683}
684
685ark_gen_file("libarkruntime_shorty_values_h") {
686  template_file = "templates/shorty_values.h.erb"
687  data = [ "../libpandafile/types.yaml" ]
688  api = [ "../libpandafile/types.rb" ]
689  output_file = "$target_gen_dir/generated/shorty_values.h"
690}
691
692ark_gen_file("plugins_inc") {
693  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
694  template_file = "templates/plugins.inc.erb"
695  data = [ ark_plugin_options_yaml ]
696  api = [ "$ark_root/templates/plugin_options.rb" ]
697  output_file = "$target_gen_dir/plugins.inc"
698}
699
700ark_gen_file("plugins_entrypoints_gen_h") {
701  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
702  template_file = "entrypoints/plugins_entrypoints_gen.h.erb"
703  data = [ ark_plugin_options_yaml ]
704  api = [ "$ark_root/templates/plugin_options.rb" ]
705  output_file = "$target_gen_dir/plugins_entrypoints_gen.h"
706}
707
708ark_gen_file("plugins_interpreters_inl_h") {
709  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
710  template_file = "templates/plugins_interpreters-inl.h.erb"
711  data = [ ark_plugin_options_yaml ]
712  api = [ "$ark_root/templates/plugin_options.rb" ]
713  output_file = "$target_gen_dir/plugins_interpreters-inl.h"
714}
715
716ark_gen_file("language_config_gen_inc") {
717  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
718  template_file = "templates/language_config_gen.inc.erb"
719  data = [ ark_plugin_options_yaml ]
720  api = [ "$ark_root/templates/plugin_options.rb" ]
721  output_file = "$target_gen_dir/language_config_gen.inc"
722}
723
724ark_gen_file("intrinsics_inl_h") {
725  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
726  template_file = "templates/intrinsics.inl.h.erb"
727  data = [ ark_plugin_options_yaml ]
728  api = [ "$ark_root/templates/plugin_options.rb" ]
729  output_file = "$target_gen_dir/intrinsics.inl.h"
730}
731
732ark_gen_file("plugins_defines_h") {
733  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
734  template_file = "templates/plugins_defines.h.erb"
735  data = [ ark_plugin_options_yaml ]
736  api = [ "$ark_root/templates/plugin_options.rb" ]
737  output_file = "$target_gen_dir/plugins_defines.h"
738}
739
740ark_gen_file("plugins_asm_defines_def") {
741  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
742  template_file = "templates/plugins_asm_defines.def.erb"
743  data = [ ark_plugin_options_yaml ]
744  api = [ "$ark_root/templates/plugin_options.rb" ]
745  output_file = "$target_gen_dir/plugins_asm_defines.def"
746}
747
748generated_file("plugin_read_profile_h") {
749  outputs = [ "$target_gen_dir/profiling/generated/read_profile.h" ]
750  contents = plugin_read_profile_paths
751  output_conversion = "list lines"
752}
753generated_file("plugin_clear_profile_h") {
754  outputs = [ "$target_gen_dir/profiling/generated/clear_profile.h" ]
755  contents = plugin_clear_profile_paths
756  output_conversion = "list lines"
757}
758generated_file("plugin_destroy_profile_h") {
759  outputs = [ "$target_gen_dir/profiling/generated/destroy_profile.h" ]
760  contents = plugin_destroy_profile_paths
761  output_conversion = "list lines"
762}
763generated_file("plugin_dump_profile_h") {
764  outputs = [ "$target_gen_dir/profiling/generated/dump_profile.h" ]
765  contents = plugin_dump_profile_paths
766  output_conversion = "list lines"
767}
768generated_file("plugin_find_method_in_profile_h") {
769  outputs = [ "$target_gen_dir/profiling/generated/find_method_in_profile.h" ]
770  contents = plugin_find_method_in_profile_paths
771  output_conversion = "list lines"
772}
773generated_file("plugin_profiling_includes_disasm_h") {
774  outputs =
775      [ "$target_gen_dir/profiling/generated/profiling_includes_disasm.h" ]
776  contents = plugin_profiling_includes_disasm_paths
777  output_conversion = "list lines"
778}
779generated_file("plugin_profiling_includes_h") {
780  outputs = [ "$target_gen_dir/profiling/generated/profiling_includes.h" ]
781  contents = plugin_profiling_includes_paths
782  output_conversion = "list lines"
783}
784generated_file("get_profiling_any_type_h") {
785  outputs = [ "$target_gen_dir/profiling/generated/get_profiling_any_type.h" ]
786  contents = plugin_get_profiling_any_type_paths
787  output_conversion = "list lines"
788}
789