792 Commits

Author SHA1 Message Date
narpfel
8afd059943 Fix linking Rust error messages to source (#8345)
The compiler output pane only links error messages to the source editor
when a filename is given. `parseRustOutput` didn’t parse the filename,
so Rust error messages were never linked.

This PR also simplifies the regex used to parse the `-->
filename:line:column` line in the `rustc` output. As far as I’m aware
(and I checked the history of the corresponding output in the `rustc`
source), the output format will always be `--> filename:line:column` and
not anything else accepted by the previous regex (no parentheses around
the line number, the column is not optional).
2025-12-20 13:54:45 +02:00
nrdmn
4bcd8e2b52 Don't double escape metadata (#8296)
Before this PR, source code in the `<meta name="description">` and
`<meta property="og:description">` tags would be doubly escaped, leading
to html escaped code showing up in link previews. Examples:

Discord:
<img width="465" height="167" alt="discord"
src="https://github.com/user-attachments/assets/d2f867e6-f724-4177-8f1d-17986d13343f"
/>

Akkoma:

![akkoma](https://github.com/user-attachments/assets/22b11c48-1bef-4424-a70a-3948213a8354)


This fixes it by removing one layer of escaping.
2025-12-15 17:50:07 -06:00
Matt Godbolt
d2cc7118aa Minor updates and lint and format fixes (#8327) 2025-12-09 22:16:59 -06:00
Frank Leon Rose
e35662fbb5 Fix Clojure dependencies (#8249) 2025-11-27 17:29:43 +01:00
Patrick Quist
194a6c8df6 Add GOCACHE support for Go compiler with writeable cache directory (#8283) 2025-11-25 00:55:45 +01:00
Cliff Burdick
27a89e86bc Fix braces on PTX parser (#8248)
The PTX emitted can sometimes be of the form:
```
{ code
}
```

Later on if the parser sees that the current and last line were closing
and opening braces, it drops both lines. This prevents any single-line
instructions from showing up. This PR changes the logic to make opcodes
on the same line as opening braces valid, and also adds unit tests for
matching.
2025-11-05 12:06:54 -06:00
Matt Godbolt
65e4f302b7 URL serialization refactoring and Cypress test improvements (#8215)
## Summary
This PR makes URL serialization logic available to Node.js contexts
(like Cypress tests) and replaces a hard-coded 4812-character base64 URL
in tests with programmatically generated state. This builds on the
shared utilities refactoring from #8246.

### Changes

#### 1. Extract URL Serialization to Shared Module
**Problem:** URL serialization code depended on GoldenLayout's
browser-only ConfigMinifier, preventing Cypress spec files from
importing it (they load in Node.js before running in browser).

**Solution:** Created `shared/url-serialization.ts` with a
Node-compatible ConfigMinifier reimplementation.

**Technical Details:**
- Reimplemented GoldenLayout's ConfigMinifier without browser
dependencies
- Moved serialization functions (`serialiseState`, `deserialiseState`,
`risonify`, `unrisonify`) to shared module
- Moved minification functions (`minifyConfig`, `unminifyConfig`) to
shared module
- Updated `static/url.ts` to use shared module instead of GoldenLayout
- Added comprehensive test coverage in `test/url-serialization.ts`

**Files:**
- **New:** `shared/url-serialization.ts` (~279 lines)
- **Modified:** `static/url.ts` (removed ~30 lines, eliminated
GoldenLayout dependency)
- **New:** `test/url-serialization.ts` (~96 lines)

#### 2. Replace Hard-coded Cypress URL with Programmatic State
**Before:** A hard-coded 4812-character base64 URL containing state for
all panes
```typescript
cy.visit('http://localhost:10240/#z:OYLghAFBqd5TB8IAsQGMD2ATApgUWwEsAXTAJwBoiQIAzIgG...');
```

**After:** Programmatically generated state using
`buildKnownGoodState()` function
```typescript
const state = buildKnownGoodState();
const hash = serialiseState(state);
cy.visit(`http://localhost:10240/#${hash}`, {...});
```

**Benefits:**
- Human-readable, maintainable test state
- Programmatic generation from `PANE_DATA_MAP` keys
- Layout optimized with 8 panes per row
- Produces identical compressed URL format
- Much easier to add/modify panes in the future

#### 3. PANE_DATA_MAP Consistency Improvements
Updated `PANE_DATA_MAP` to use component names exactly as registered
with GoldenLayout:

**Key renames:**
- `preprocessor` → `pp`
- `llvmir` → `ir` 
- `pipeline` → `llvmOptPipelineView`
- `mir` → `rustmir`
- `hir` → `rusthir`
- `macro` → `rustmacroexp`
- `core` → `haskellCore`
- `stg` → `haskellStg`
- `cmm` → `haskellCmm`
- `dump` → `gccdump`
- `tree` → `gnatdebugtree`
- `debug` → `gnatdebug`

**Added panes:** `codeEditor`, `compiler`, `conformance`, `output` (were
missing from map)

**Re-enabled tests:**
- `yul` pane test (was commented out, now fixed)
- `clojuremacroexp` pane test (was commented out, now fixed)
- `cfg` pane test (had TODO, now removed)

**Why this matters:** The `buildKnownGoodState()` function uses
`Object.keys(PANE_DATA_MAP)` as the `componentName` property, so keys
must match the actual registered component names for GoldenLayout to
find them.

## Test Plan
- [x] All Cypress tests pass (confirmed by @mattgodbolt)
- [x] TypeScript compilation passes (`npm run ts-check`)
- [x] Linting passes (`npm run lint`)
- [x] URL serialization tests pass (3/3 tests)
- [x] Pre-commit hooks pass
- [x] Related vitest tests pass

## Dependencies
- Builds on #8246 (shared utilities refactoring - already merged)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-04 14:09:01 -06:00
Matt Godbolt
03d20c5fde Move assert.ts and rison.ts to shared/ directory (#8246)
## Summary
Moves `static/assert.ts` and `static/rison.ts` to `shared/` directory to
make them available to both frontend and backend code without browser
dependencies. Updates all import paths across the codebase (~47 files).

## Motivation
This refactoring eliminates browser dependencies in these utilities,
allowing them to be imported by Node.js contexts (like Cypress test
files) without causing module load failures. This is a prerequisite for
upcoming Cypress test improvements.

## Changes
- Move `static/assert.ts` → `shared/assert.ts`
- Move `static/rison.ts` → `shared/rison.ts`  
- Update `biome.json` to allow `hasOwnProperty` in `shared/` directory
- Update all imports across `static/`, `lib/`, and `test/` directories
(47 files changed)

## Benefits
- No functional changes, purely a code reorganization
- Makes these utilities accessible to both frontend and backend without
circular dependencies
- Enables future Cypress improvements that require these utilities in
Node.js context
- All tests pass ✓ (699 tests)

## Test Plan
- [x] TypeScript compilation passes
- [x] Linting passes
- [x] All unit tests pass (699 tests)
- [x] Pre-commit hooks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-04 10:58:11 -06:00
LJ
5a15d893d7 Add support for Yul intermediate view when compiling Solidity (#8219)
## What

Adds support for seeing Yul (Solidity IR) as intermediate output when
compiling Solidity.

This PR also enables that view for the Resolc compiler.

### Main Additions

- [x] Support viewing Yul in a supplementary view
- Solidity compilers can enable this by setting
`this.compiler.supportsYulView = true` in the compiler's constructor
- If custom processing of the Yul output or the Yul output filename is
needed, the compiler can override `processYulOutput()` or
`getYulOutputFilename()`
- [x] Enable the Yul view for Resolc
- [x] Implement a Yul backend option for filtering out debug info from
the output

### Notes

Source mappings are currently not handled for Yul -> Solidity.

## Overall Usage

### Steps

* Choose Solidity as the language
* Choose a Resolc compiler
* View intermediate results:
  * Yul
* (Hide/show debug info by toggling "Hide Debug Info" in the Yul view
filters)

## Screenshots

<img width="1502" height="903" alt="ce-yul-view"
src="https://github.com/user-attachments/assets/ccc897e2-cd8d-4c33-962c-522d60b63134"
/>
2025-11-04 09:00:19 -06:00
Matt Godbolt
9b76c60701 Update vitest to 4.0.1 and fix test mocking for constructor support (#8213)
## Summary
- Updates vitest and @vitest/coverage-v8 from 2.1.8 to 4.0.1
- Fixes test mocks to work with vitest 4.0's constructor support
requirements

## Changes
Vitest 4.0 now supports `vi.fn()` being used as constructors, which
means arrow functions can no longer be used in mock implementations that
will be called as constructors.

### Key refactorings:
- **Class-based mocks in vi.mock()**: Defined mock classes directly in
`vi.mock()` factories instead of using `.mockImplementation()` with
arrow functions
- **Shared mock implementations**: Created shared `vi.fn()` instances
that can be configured per-test, avoiding the need for
`.mockImplementation()`
- **Biome linter compatibility**: The approach avoids
`.mockImplementation()` entirely, preventing biome from converting
`function` keywords back to arrow functions

### Files changed:
- `package.json`, `package-lock.json`: vitest version updates
- `test/app/config-tests.ts`: Refactored CompilerProps mocks with shared
cePropsImpl
- `test/app/main-tests.ts`: Refactored all constructor mocks
(CompilerFinder, FormattingService, CompileHandler, etc.)

## Test plan
- [x] All tests pass with `npm run test-min`
- [x] Linter passes with `npm run lint`  
- [x] Type checking passes with `npm run ts-check`
- [x] Pre-commit hooks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-04 08:55:58 -06:00
Ofek
901b7e1826 Fix for win32 link-binary (#8236)
(+ a rename).
Turns out when 'Link to Binary' was checked, msvc objdumped the obj (not
exe) file. This fixes it.
2025-11-01 12:54:31 +02:00
narpfel
938d0e5d14 Make instruction set parsing compatible with file >= v5.46 (#8226)
The identifier for 32-bit Intel ELF files was changed in `file` v5.46:
45702aaa99.
2025-10-28 18:01:23 +01:00
Matt Godbolt
4080457f2c Minor library updates (#8209)
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-22 11:36:33 -05:00
Frank Leon Rose
b9dc265973 Clojure language support (#8146)
<img width="1405" height="474" alt="Clojure in Compiler Explorer 2"
src="https://github.com/user-attachments/assets/76dfed9b-d0eb-4764-b371-9c6023088a50"
/>

With Macro Expansion:
<img width="1642" height="594" alt="image"
src="https://github.com/user-attachments/assets/8b511af9-3617-426e-868d-5a99e5db5756"
/>

TODO
- [x] Language configuration
- [x] Compile via wrapper
  - Inject namespace if necessary to simplify minimal code sample
  - Parse Unix style command line parameters into compiler bindings
  - Place file in path according to namespace
- [x] Install some versions of Clojure [PR
here](https://github.com/compiler-explorer/infra/pull/1849)
- [x] Macroexpansion view (modeled on Rust macro expansion view)
- [x] Filter out command line options that would break wrapper operation
- [x] ~~Parse `--help` output to a list of options~~ Reverted because
not applicable.
- [x] Short form compiler options
- [x] Support Clojure compiler settings via env var, like
`JAVA_OPTS=-Dclojure.compiler.direct-linking=true
-Dclojure.compiler.elide-meta=[:doc,:file]`

NOT DOING
- [x] ~~Support loading dependencies~~ Non-trivial enhancement. Not
necessary for initial release.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-10-22 09:04:20 -05:00
LJ
066a942cbc Add Resolc 0.4.0 compiler for Solidity and Yul (#8164)
## What

Adds [Revive's Resolc](https://github.com/paritytech/revive) compiler
for compiling Solidity and Yul (Solidity IR) to RISC-V and PolkaVM
assembly.

### Main Additions

- [x] Implement new `ResolcCompiler`
- [x] Implement Yul language definition and config for Monaco
- [x] Add Resolc as a compiler for the Solidity and Yul languages
  - The `ResolcCompiler` handles both kinds of language input 
- [x] Implement initial `PolkaVMAsmParser` (no source mappings)
- [x] Enable viewing LLVM IR in a supplementary view
- [x] Implement a new LLVM IR backend option for toggling between
optimized and unoptimized ll
- Affects non-resolc files ([see
commit](606bab9a59))
  - Disabled by default
- (Enable by setting `this.compiler.supportsIrViewOptToggleOption =
true` in a compiler's constructor)
- The compiler's `getIrOutputFilename()` will receive the LLVM IR
backend options

### CE Infra

Accompanying CE Infra PR:
https://github.com/compiler-explorer/infra/pull/1855

## Overall Usage

### Steps

(See screenshots)

* Choose between two input languages:
  * Solidity
  * Yul (Solidity IR)
* Choose a Resolc compiler
* View assembly:
  * PolkaVM assembly (if enabling "Compile to binary")
  * RISC-V (64 bits) assembly
* View intermediate results:
  * Optimized LLVM IR (if enabling "Show Optimized" in the LLVM IR view)
  * Unoptimized LLVM IR

### Notes

Source mappings currently only exist between:
- Yul and RISC-V
- Yul and LLVM-IR

## Screenshots

<img width="1502" height="903" alt="CE Yul RISC-V LLVM IR"
src="https://github.com/user-attachments/assets/7503b9b5-0f2c-4ddf-9405-669e4bdcd02d"
/>

<img width="1502" height="903" alt="CE Solidity PolkaVM"
src="https://github.com/user-attachments/assets/eeb51c99-3eaa-4dda-b13c-ac7783e66cb8"
/>

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-10-14 13:56:59 -05:00
narpfel
685f68450a Don’t add --crate-type to rust compiler options when explicitly specified by user (#8191)
Resolves #8186.
2025-10-13 14:16:01 -05:00
Ofek
00ee2fc8b0 Initial support for binary/binary-obj in msvc (#8165) 2025-10-06 18:00:53 +03:00
Matt Godbolt
8dc0cb6c94 Major update: (#8158)
- bump pQueue:
https://github.com/sindresorhus/p-queue/releases/tag/v9.0.0
  - throwOnTimeout is removed (and is always `true`)
- 0 is not a valid timeout, so, updated tests to pass a big number (no
normal code path assumes 0)
- happy dom: breaking changes: removed commonjs, new jest; nothing
affects us
2025-10-02 14:05:56 -05:00
Ofek
1268377689 Fix #3491: improve MSVC asm filtering (#8154) 2025-10-02 01:59:18 +03:00
Ofek
5eb5262c64 Various type improvements, mostly in tests (#8144) 2025-09-27 10:17:55 +03:00
Ofek
5a7b0c27a4 Add CFG for MSVC compilers (#8134) 2025-09-25 00:23:36 +03:00
Patrick Quist
102c74c09b fix tool invokations include paths for libraries (#8096) 2025-09-12 15:23:55 -05:00
Matt Godbolt
f824efe73e Library updates and lint fixes (#8099)
* Minor updates only
* Added explicit radix parameter (10) to all Number.parseInt() calls throughout the codebase (new lint rule)
* Updated several @ts-ignore comments to @ts-expect-error for better TypeScript practices (new lint rule)
* Removed unnecessary @ts-ignore comments in some mode files (ditto)
* Used "none return" based arrow functions for some map stuff
* Replaced a `map()` call that didn't return anything to a for() loop
* Fixed up some cypress stuff, noting work for the future
2025-09-12 14:23:49 -05:00
narpfel
63faf792ba Fix jump to label with symbols containing $ (#8051)
For example Rust will mangle `<` to `$LT$`:
https://godbolt.org/z/86n9M6P3f
2025-08-25 21:19:07 -05:00
Ofek
96103f044f Fix #8000: stop forcing dwarf 4 (#8036) 2025-08-16 17:39:09 +03:00
narpfel
5d1d7cf77b Fix demangling for symbols with dots in jump instructions (#8028)
For example Rust on AArch64: https://godbolt.org/z/e3q9Wv7zj
2025-08-14 10:09:02 -05:00
narpfel
68db4ca482 Remove unused method AsmParser.labelFindFor (#8022)
`AsmParser.labelFindFor` was only called in tests.
2025-08-12 08:50:53 -05:00
narpfel
f289b79f1d Don’t filter .set directives that declare merged functions (#8021)
Resolves #2409.
2025-08-11 14:31:44 -05:00
narpfel
82407976d1 Accept multiple dots in symbol names for jump to label (#8018)
Some compilers emit symbol names with multiple dots, e. g. Clang for
static data (like string literals) or GCC for function clones (e. g. due
to interprocedural constant propagation).

Test cases: https://godbolt.org/z/dGbGncnh8,
https://godbolt.org/z/dhrGGqrjo
2025-08-11 14:28:06 -05:00
Matt Godbolt
2ae38a0c3f Make argument parsers instances instead of static classes (#8017)
- Made parsers stateful instances instead of shared static state (for
mllvm options). Fixes #8011 as this is caused by multiple clang-based
compilers being run concurrently and stomping over each others' state.
- passes `Compiler` to the constructor, which removes some param passing
- Added some missing awaits
- Tried to get things less dependent on `examples`, only `go` needs it
- Spotted that `zig` c++ might have issues in discovery
- Fly-by fixed a broken go path in ppc64le_gl122
- removed a redundant override in coccinelle
- made the mojo parser actually use the parser it defined
- canonified tablegen's special method
- 

I changed the zig parser too but as best I can tell it was broken before
(the `1` return value from the command it runs:)

```
ubuntu@ip-172-30-0-164:/infra/.deploy$ /opt/compiler-explorer/zig-0.14.1/zig c++ -mllvm --help-list-hidden /infra/.deploy/examples/c++/default.cpp -S -o /tmp/output.s
...
  --x86-use-vzeroupper                                                       - Minimize AVX to SSE transition penalty
  --xcore-max-threads=<number>                                               - Maximum number of threads (for emulation thread-local storage)
/infra/.deploy/examples/c++/default.cpp:1:1: error: FileNotFound
```
return code 1 (means it's not cached)

---------

Co-authored-by: Partouf <partouf@gmail.com>
2025-08-11 12:14:13 -05:00
Ofek
a85260bc27 Fix #8009: Allow quotes as part of labels (#8015) 2025-08-09 20:21:31 +02:00
Matt Godbolt
c29ad46f3a [Not Live; disabled by default] Add Claude Explain feature for AI-powered assembly explanations (#7749)
Add Claude Explain feature for AI-powered code explanations

This PR introduces Claude Explain, a new feature that provides AI-powered explanations of compiler output directly within Compiler Explorer.

Key features:

Claude Explain functionality:
  - New explain view pane
  - Explains compiler output with full context of source code and compilation output
  - Configurable audience level and explanation type
  - Response caching to improve performance and reduce API calls
  - Usage statistics display showing requests used and token counts

User experience:
  - Consent flow on first use explaining data handling and privacy
  - AI disclaimer banner warning about potential LLM inaccuracies
  - Respects "no-ai" directive in source code for users who don't want AI processing

Privacy and security:
  - Data sent to Anthropic's Claude API as documented in privacy policy
  - No data used for model training
  - Clear consent required before first use
  - Support for opting out via "no-ai" directive

The feature is marked as beta and can be enabled via configuration.

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-05 09:31:48 -05:00
Shawn Zhong
97c6ce61ec Update SASS docs and fix link (#7976)
- Change SASS instruction link from
`https://docs.nvidia.com/cuda/cuda-binary-utilities/index.html#id14` to
`https://docs.nvidia.com/cuda/cuda-binary-utilities/index.html#instruction-set-reference`.
In the former URL, the tag (`#id14`) no longer exists on the webpage.
- Run `etc/scripts/docenizers/docenizer-ptx-sass.py` and add some new
instructions from the website.
2025-07-31 08:21:27 -05:00
Shawn Zhong
f92b6f388a Remove dangling empty braces in PTX (#7960)
After directive filtering, there will be dangling `{}` spanning two
lines. This PR attempts to remove them.

For example, 
```
.section    .debug_abbrev
{
.b8 1
}
.section    .debug_info
{
.b32 70
.b32 .debug_abbrev
}
```

The above assembly used to become the following text after filtering
directive

```
{
}
{
}
```
2025-07-30 10:40:00 -05:00
Shawn Zhong
227595d83e Fix PTX parsing with predicate (#7959)
Recogonize lines with predicate (e.g., `@%p1`, `@!%p1`) as instructions:
- `@%p1 ld.global.v4.b32 { %r9, %r10, %r11, %r12 }, [ %rd3 + 0 ];`
- `@%p2 bra $L__BB0_28;`
- `@!%p2 bra $L__BB0_28;`

| Before | After | 
| --- | --- |
| <img width="580" height="320" alt="image"
src="https://github.com/user-attachments/assets/c3913b09-ce04-44c5-a4c0-fa69805cf1d7"
/> | <img width="566" height="323" alt="image"
src="https://github.com/user-attachments/assets/08308b3d-df00-4cf1-8321-203c374c27c3"
/> |



From
https://docs.nvidia.com/cuda/parallel-thread-execution/#instruction-statements:

> Instructions have an optional guard predicate which controls
conditional execution. The guard predicate follows the optional label
and precedes the opcode, and is written as @p, where p is a predicate
register. The guard predicate may be optionally negated, written as @!p.

Implementation-wise, added `(@!?%\w+\s+)?` to existing default
`hasOpcodeRe` (`/^\s*(%[$.A-Z_a-z][\w$.]*\s*=\s*)?[A-Za-z]/`)
2025-07-30 10:34:59 -05:00
Shawn Zhong
8befc91a79 Add Triton language and compiler (#7919)
Close #5530. Infra:
https://github.com/compiler-explorer/infra/pull/1711. Previous work by
@siboehm at #5531


## Summary

This pull request introduces support for the
[Triton](https://github.com/triton-lang/triton) language, a Python-based
DSL for writing highly efficient GPU kernels.


- [x] **New Language Support**: I've added comprehensive support for the
Triton programming language, allowing users to compile and inspect
Triton kernels within Compiler Explorer. (c.f.,
`lib/compilers/triton.ts`)
- [x] **Python Wrapper for Compilation**: A new Python wrapper script
(`triton_wrapper.py`) has been introduced to manage Triton compilation,
patching its behavior to dump compiled kernels and intermediate
representations without requiring actual execution, and consolidating
the output for Compiler Explorer.
- [x] **Device Assembly View**: Enables viewing of generated device
assembly code (e.g., PTX, AMDGCN) and various intermediate
representations (MLIR, LLVM IR) produced by the Triton compiler.
- [x] **MLIR Parsing**: New parsers (`asm-parser-mlir.ts` and
`mlir-pass-dump-parser.ts`) have been added to correctly interpret and
display MLIR assembly and optimization pass dumps, including source
location information.
- [x] **Multi-Version & Multi-Backend Support**: Painstakingly includes
all 8 versions (from 2.2.0 to 3.3.1) of Triton that supports Python
3.12. Supports both CUDA and HIP backend for Triton 3.

## Screenshots

Source and assembly:
<img width="1354" height="789" alt="image"
src="https://github.com/user-attachments/assets/c29650ff-2073-40e0-a9e6-ff8377094b5e"
/>



Device view for MLIR and LLVM IR: 
<img width="1402" height="670" alt="image"
src="https://github.com/user-attachments/assets/43dd5c68-ca78-41b1-9865-e97ffe3ef73c"
/>

Opt pipeline viewer:
<img width="1408" height="668" alt="image"
src="https://github.com/user-attachments/assets/429eef8c-aaac-4781-aafa-39ef0ffc7241"
/>

Diff of TTIR in Triton 3.3.1 vs 2.3.0:
<img width="1580" height="726" alt="image"
src="https://github.com/user-attachments/assets/a928c893-dd9a-4c3a-a048-14046e56a14c"
/>

CUDA & HIP:
<img width="1596" height="800" alt="image"
src="https://github.com/user-attachments/assets/c18800c3-cfad-4e5e-96de-ba92c9f236ea"
/>

## Implementation Details (and Notes for Reviewers)

- For Device Assembly View, I Implemented `MlirAsmParser` for parsing
MLIR assembly. Technically MLIR is not an assembly language, but there
is no better choice to make the source line map work w/ device view.
- I Implemented `MlirPassDumpParser` for processing MLIR optimization
pass dumps. I tried to subclass `LlvmPassDumpParser`, but they turn out
to be too different to worth doing it.
- `LlvmPassDumpParser` made some assumptions that do not hold true for
MLIR passed. Some effort is put to make sure that the passes are
properly diff-ed, since some passes can run multiple times and also
sometimes pass can be nested (i.e., some number of `before`s followed by
some number of `after`s)
- A lot of effort is put into `patch_triton` to make sure that the we
only compile the kernel without actually running it, and that needs to
work across all the versions we support.

## Steps to Run Locally

1. Clone https://github.com/ShawnZhong/compiler-explorer-infra.git
2. Install Triton to `/opt/compiler-explorer/triton`:
```sh
$ cd compiler-explorer-infra
$ ./bin/ce_install install triton
$ ls /opt/compiler-explorer/triton
# v2.2.0  v2.3.0  v2.3.1  v3.0.0  v3.1.0  v3.2.0  v3.3.0  v3.3.1
```
3. Clone https://github.com/ShawnZhong/compiler-explorer.git and
checkout branch `triton`
4. Run Compiler Explorer
```sh
make EXTRA_ARGS='--language triton' dev
```
5. Enjoy

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-07-30 10:15:28 -05:00
Jacob Panov
c7056b31eb Fix llvm-mca tool preprocessing of debug directives (#7964)
This PR fixes the "unassigned file number" error in llvm-mca when
processing GCC-generated assembly with debug information #6795 .

**Problem**: GCC with `-g` flag generates `.loc` and `.file` debug
directives that cause llvm-mca to fail with "unassigned file number"
errors.

**Solution**: Filter out `.loc` and `.file` directives during assembly
preprocessing, similar to how other problematic directives are already
handled.

**Changes**:
- Add regex filtering for `.loc` and `.file` directives in
`rewriteAsm()`
- Make `rewriteAsm()` method public for testability
- Add comprehensive test coverage for debug directive removal

The fix is minimal, targeted, and follows the existing pattern of
directive filtering.
2025-07-30 10:00:09 -05:00
Matt Godbolt
8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Jacob Panov
534e1428fa Update AVR instruction documentation for 2024 manual (#7947) 2025-07-27 13:53:03 +02:00
Jacob Panov
d9a124fe8d Fix to ensure labels are not mistaken for comments (#7926)
Ensured labels are not mistaken for comments by skipping comment
filtering when the line matches a label definition

Added a regression test verifying that labels starting with “@” remain
visible even when comment filtering is enabled

Fixes #7889 

Tested with 
npm run lint
npm run ts-check
npm run test-min
npm run check-frontend-imports
make check
2025-07-21 12:06:49 +03:00
Ofek
14af70abb2 Fix #6886: Add cfg support for Xtensa ISA (#7933) 2025-07-19 21:01:14 +03:00
Ofek
c2e9d61fe9 Adapt python cfg to python 3.13 (#7906)
Along with improved function names.
2025-07-12 18:39:00 +03:00
Ofek
1b1055d2cb CFG for Python (#7855) 2025-07-01 21:49:20 +03:00
narpfel
6f128e4b97 Add missing awaits in Rust argument parser tests (#7862)
Resolves #7826.
2025-06-29 12:47:52 +00:00
Mats Jun Larsen
d147341663 Serve all static asset files over the CDN (#7795) 2025-06-28 14:01:36 +02:00
Matt Godbolt
577094cf11 Add vitest related to pre-commit with expensive test skipping (#7854)
## Summary
This PR improves the pre-commit hook performance by:
- Using `vitest related` to run only tests affected by changed files
- Adding ability to skip expensive tests (filter tests) during
pre-commit
- Providing a consistent mechanism for skipping expensive tests

## Changes
- Modified `lint-staged.config.mjs` to run `vitest related` with
`SKIP_EXPENSIVE_TESTS=true`
- Updated `test/filter-tests.ts` to use idiomatic `describe.skipIf()`
for conditional test execution
- Changed `test-min` script to use `SKIP_EXPENSIVE_TESTS` environment
variable instead of `--exclude`
- Updated `CLAUDE.md` with documentation about the new test workflow

## Impact
- Pre-commit hooks are now much faster as they:
  - Only run tests related to changed files
  - Skip 688 expensive filter tests
  - Use the same skipping mechanism as `npm run test-min`

## Testing
-  Verified `vitest related` correctly identifies and runs related
tests
-  Confirmed filter tests are skipped when `SKIP_EXPENSIVE_TESTS=true`
-  Tested that full test suite still runs all tests when env var is not
set
-  Pre-commit hooks work correctly with the new setup

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-22 14:34:16 -05:00
Jeremy Rifkin
e0958c8613 Add support for demangling quoted labels (#7846)
This PR updates a dozen regular expressions related to labels and
demangling to allow quoted names which gcc trunk is now emitting:


![image](https://github.com/user-attachments/assets/efc727d1-a056-4544-8196-4276bb14fc02)


Resolves #7729
2025-06-20 17:33:49 -05:00
Patrick Quist
b5e7219baa Add dedicated PTX assembly parser to fix directive filtering (#7839) 2025-06-20 14:46:24 +02:00
Matt Godbolt
c1bee5428a Fix EBADF error in HeaptrackWrapper (#7817)
## Summary
- Fixes EBADF error in HeaptrackWrapper by removing redundant file
descriptor close operation
- The net.Socket takes ownership of the FD and closes it during cleanup,
making manual close unnecessary and dangerous

## Root Cause Analysis
The issue occurred in `lib/runtime-tools/heaptrack-wrapper.ts:133` where
the code attempted to manually close a file descriptor that was already
owned by a `net.Socket`. When creating a socket with `new
net.Socket({fd: fd})`, the socket takes ownership of the file descriptor
and closes it during cleanup operations like `resetAndDestroy()`.

Attempting to close the FD again results in:
1. EBADF errors when the FD hasn't been recycled
2. Potentially closing a different resource if the FD has been recycled
by the OS

## Solution
Removed the manual `oldfs.close(fd)` call since the socket handles FD
cleanup automatically. This prevents both the EBADF error and the more
dangerous scenario of closing recycled file descriptors.

## Verification
Created tests to verify that `net.Socket` takes ownership of file
descriptors:
```javascript
// Test confirms that after socket.destroy(), the FD is no longer valid
const fd = fs.openSync(pipePath, O_RDWR | O_NONBLOCK);
const socket = new net.Socket({ fd: fd, readable: true, writable: true });
socket.destroy();
// fs.fstatSync(fd) throws EBADF - confirming FD was closed by socket
```

## Test Plan
- [x] TypeScript compilation passes
- [x] Minimal test suite passes
- [x] Pre-commit hooks pass
- [x] Created unit test to verify net.Socket FD ownership behavior

Fixes COMPILER-EXPLORER-EA7

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-19 13:54:41 -05:00
Matt Godbolt
23fad10939 Unit testing the frontend (#7829)
This adds some unit tests for the front end.

- configures "frontend tests" as a unit tests in `static/tests`,
removing the old cypress-requiring "unit" tests
- hack enough of a DOM  to get things working
- port motd and id tests
- *adds* a golden layout checks  (see #7807)
- Updates READMEs etc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-19 08:46:57 -05:00