# Xo 0.21 release notes


## Introduction

Xo 0.21 builds Intel Mac programs with Xo's own backend and no C
toolchain, makes native binaries smaller, brings `dbg` to every backend,
adds Int word methods and lookup commands for agents, and makes TLS and
HTTP cheaper.

## Changes to the language

- `dbg(expr)` works on every backend and in `--no-gc` builds, and
  `--release` strips it
  ([decision 0265](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0265-debug-print-pure.md)).
- Int's word operations are methods that compile to inline operations:
  `wrapping_shl`, `shr_logical`, `rotate_right`, `rotate_right32`,
  `swap_bytes`, `mul_hi_unsigned`, `lt_unsigned` and `le_unsigned`, next
  to the existing `wrapping_add`, `wrapping_sub` and `wrapping_mul`
  ([decision 0260](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0260-named-wrapping-unsigned-ops.md)).

## Tools

- Lookups for agents: `xo def`, `xo refs`, `xo type`, `xo doc` and
  `xo symbols`
  ([decision 0261](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0261-agent-commands.md)).
- Miscompile triage: `XO_PASSES` turns optional optimization passes off
  by name, and `xo dev bisect-pass` finds the first pass whose build
  behaves differently. Property tests reduce a failing case
  automatically.
- `xo test --std-module` runs a standard library module's own tests
  ([decision 0262](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0262-std-private-tests.md)).
- `XO_POISON_FRAMES` for finding reads of stale stack memory.
- Test programs no longer outlive their tests: each runs in its own
  process group.
- `xo vet` warns about large copies with `XO0530`
  ([decision 0263](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0263-copy-lint.md)).

## Compiler

- Native builds drop every function nothing calls. `hello` is 26.5%
  smaller, and the JSON, HTTP and TLS servers 13.5 to 16.7% smaller on
  an Apple silicon Mac, smaller than LLVM's builds. `xo` itself went
  from 57 MB to 42 MB.
- Tuple folding after inlining: HTTP/2 11.5% and TLS 8.9% fewer
  instructions per request.
- Fixes to range analysis, including a crash on an empty interval.

## Standard library

- Bytes from outside the program that are not valid UTF-8 become a valid
  `Str` at every boundary
  ([decision 0259](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0259-external-bytes-to-str.md)).
- TLS handshakes are 13.9% cheaper on arm64 and 22% on x86-64; HTTP/2
  is 11.6% cheaper, and more from moving reference counted payloads.
  P-256 and X25519 are faster.

## Ports

- Intel Macs: Xo's own x86-64 backend now targets `darwin/amd64`, with
  its own Mach-O assembler (objects byte identical to clang's) and
  linker. All 193 test programs pass on an Intel Mac with no C
  toolchain
  ([decision 0254](https://github.com/xo-lang/xo/blob/main/knowledgebase/decisions/0254-amd64-backend.md)).
- Windows: Xo's own calls on Windows will use the System V convention,
  decided for the coming windows/amd64 port.

