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