Skip to content

Conversation

@renovate
Copy link

@renovate renovate bot commented Dec 10, 2024

This PR contains the following updates:

Package Type Update Change
lockFileMaintenance All locks refreshed
clap dependencies patch 4.5.20 -> 4.5.23
clap_complete dependencies patch 4.5.37 -> 4.5.38
libc dependencies patch 0.2.167 -> 0.2.168
serde_json dependencies patch 1.0.132 -> 1.0.133

🔧 This Pull Request updates lock files to use the latest dependency versions.


Release Notes

clap-rs/clap (clap)

v4.5.23

Compare Source

Fixes
  • (parser) When check allow_negative_numbers, allow E again

v4.5.22

Compare Source

Fixes
  • (assert) Catch bugs with arguments requiring themself

v4.5.21

Compare Source

Fixes
  • (parser) Ensure defaults are filled in on error with ignore_errors(true)
rust-lang/libc (libc)

v0.2.168

Compare Source

Added
Deprecated
  • FreeBSD: Deprecate the CAP_UNUSED* and CAP_ALL* constants (#​4183)
Fixed
  • Make the Debug implementation for unions opaque (#​4176)
Other
  • Allow the unpredictable_function_pointer_comparisons lint where needed #​4177
  • CI: Upload artifacts created by libc-test #​4180
  • CI: Use workflow commands to group output by target #​4179
  • CI: add caching #​4183
serde-rs/json (serde_json)

v1.0.133

Compare Source

  • Implement From<[T; N]> for serde_json::Value (#​1215)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title Lock file maintenance bootstrap Cargo.lock Lock file maintenance bootstrap Cargo.lock - autoclosed Dec 10, 2024
@renovate renovate bot closed this Dec 10, 2024
@renovate renovate bot deleted the renovatebot/bootstrap-cargo branch December 10, 2024 18:37
Kobzol added a commit that referenced this pull request Jan 8, 2025
Kobzol pushed a commit that referenced this pull request Sep 15, 2025
match clang's `va_arg` assembly on arm targets

tracking issue: rust-lang#44930

For this example

```rust
#![feature(c_variadic)]

#[unsafe(no_mangle)]
unsafe extern "C" fn variadic(a: f64, mut args: ...) -> f64 {
    let b = args.arg::<f64>();
    let c = args.arg::<f64>();

    a + b + c
}
```

We currently generate (via llvm):

```asm
variadic:
    sub     sp, sp, #12
    stmib   sp, {r2, r3}
    vmov    d0, r0, r1
    add     r0, sp, #4
    vldr    d1, [sp, #4]
    add     r0, r0, #15
    bic     r0, r0, #7
    vadd.f64        d0, d0, d1
    add     r1, r0, #8
    str     r1, [sp]
    vldr    d1, [r0]
    vadd.f64        d0, d0, d1
    vmov    r0, r1, d0
    add     sp, sp, #12
    bx      lr
```

LLVM is not doing a good job. In fact, it's well-known that LLVM's implementation of `va_arg` is kind of bad, and we implement it ourselves (based on clang) for many targets already. For arm,  our own `emit_ptr_va_arg` saves 3 instructions.

Next, it turns out it's important for LLVM to explicitly start and end the lifetime of the `va_list`. In rust-lang#146059 I already end the lifetime, but when looking at this again, I noticed that it is important to also start it, see https://godbolt.org/z/EGqvKTTsK: failing to explicitly start the lifetime uses an extra register.

So, the combination of `emit_ptr_va_arg` with starting/ending the lifetime makes rustc emit exactly the instructions that clang generates::

```asm
variadic:
    sub     sp, sp, #12
    stmib   sp, {r2, r3}
    vmov    d16, r0, r1
    vldr    d17, [sp, #4]
    vadd.f64        d16, d16, d17
    vldr    d17, [sp, #12]
    vadd.f64        d16, d16, d17
    vmov    r0, r1, d16
    add     sp, sp, #12
    bx      lr
```

The arguments to `emit_ptr_va_arg` are based on [the clang implementation](https://github.com/llvm/llvm-project/blob/03dc2a41f3d9a500e47b513de5c5008c06860d65/clang/lib/CodeGen/Targets/ARM.cpp#L798-L844).

r? ``@workingjubilee`` (I can re-roll if your queue is too full, but you do seem like the right person here)

try-job: armhf-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants