Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8291752

AArch64: Remove check_emit_size parameter from trampoline_call

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • None
    • b10
    • aarch64

      MacroAssembler::trampoline_call has check_emit_size parameter which enables/disables the functionality to check the size of a generated trampoline call. This functionality must only be during C2 compilation. Using it during C1 compilation can have UB because of the following: Compile::current()->output(). Compile::current is the following:

      static Compile* current() {
          return (Compile*) ciEnv::current()->compiler_data();
      }

      In case of C1 ciEnv::current()->compiler_data() returns C1 Compilation and the cast to C2 Compile is invalid.

      The default value of check_emit_size is true. This leads to confusion for the cases where 'check emit size' has no meaning like C1 or stub generation and check_emit_size is not provided.

      UB is not triggered because in_scratch_emit_size is short-circuited to false by is_c2_compile() if it is C1 and no call of Compile::current()->output() happens.

      We can remove check_emit_size parameter if we move the functionality intended for C2 to C2_MacroAssembler. Compile::current()->output() will always have the defined behavior.

            eastigeevich Evgeny Astigeevich
            eastigeevich Evgeny Astigeevich
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: