Commit Graph

2661 Commits

Author SHA1 Message Date
Partouf
08236ed1c9 add support for cmake-cache 2025-06-10 02:59:36 +02:00
Christoffer Lerno
112d000ad2 Fix C3 0.6.8 (#7786) 2025-06-09 18:09:01 -05:00
timo
bd80d171de Add raku language and rakudo compiler (#7784)
This relies on https://github.com/compiler-explorer/infra/pull/1658 to
put rakudo release versions in the right spot.


![image](https://github.com/user-attachments/assets/30ba7c2b-389a-4d3f-895b-c13da5b5f072)

There are more things that can be added, such as opcode tooltips,
suggested options for `--target=parse`, `--target=ast`,
`--target=optimize`, and probably other things I haven't thought of yet.
But this pull request should be a good starting point, and fine to merge
without waiting for further features.
2025-06-09 12:39:53 -05:00
Matt Godbolt
f8974b4f5f Fix Rust hexadecimal literal syntax highlighting with underscores (#7766)
## Summary
- Fixes syntax highlighting issue where Rust hex literals with
underscores after hex letters (like `0x01_02_0a_0b`) would lose
highlighting after the underscore
- Created custom Rust language mode (`rustp`) that patches Monaco's
built-in tokenizer
- Filed upstream issue with Monaco Editor:
https://github.com/microsoft/monaco-editor/issues/4917

## Test plan
- [x] Verified fix works locally with test cases like `0x01_02_0a_0b`,
`0xFF_AA_BB_CC`, etc.
- [x] Confirmed all existing tests pass
- [x] Checked that TypeScript compilation and linting pass

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-06 16:21:27 -05:00
Rob Parolin
157662eb31 [mojo-lang] Fixing LLVM IR panel due to calling the mojo compiler with incorrect args. (#7716)
This PR fixes the LLVM IR output for the Mojo compiler integration,
ensuring the LLVM IR panel works correctly and no longer shows "Internal
error; unable to open output path" errors.
2025-05-30 07:48:28 -05:00
narpfel
20bae12039 Add Miri tool for Rust (#7718)
Resolves
https://github.com/compiler-explorer/compiler-explorer/issues/2563.

`misc-builder` PR:
https://github.com/compiler-explorer/misc-builder/pull/112
`compiler-workflows` PR:
https://github.com/compiler-explorer/compiler-workflows/pull/36
`infra` PR: https://github.com/compiler-explorer/infra/pull/1631

Screenshot:

![miri-tool](https://github.com/user-attachments/assets/d866bb42-a242-445b-be52-6fd0b3c877bb)
2025-05-30 07:17:01 -05:00
Patrick Quist
abe7d9c836 fixes for windows execution (#7740) 2025-05-30 04:53:20 +02:00
Partouf
2e0549b3fb more fixes 2025-05-28 15:21:02 +02:00
Partouf
d16d717220 hotfix windows 2025-05-28 14:49:51 +02:00
Partouf
de3e34bda8 windows hotfix 2025-05-28 14:00:09 +02:00
Patrick Quist
2e76639163 Windows library support (#7554)
Huray
2025-05-28 10:50:26 +02:00
Matt Godbolt
d27d59fc1e Add DynamoDB support for Google URL shortener (#7724)
## Summary
- Add DynamoDB support to Google URL shortener to check in preference to goo.gl itself (which will be going away)
- Update ShortLinkResolver to accept AWS properties and use DynamoDB table `goo-gl-links`
- First check DynamoDB for fragment lookup before falling back to Google URL shortener (for now)
- Refactor resolve method to use async/await instead of raw promises for better readability
- Add awsProps to ServerDependencies and pass through component hierarchy
- Configure googleLinksDynamoTable property in AWS config files (defaults to empty)

## Implementation Details
- When `googleLinksDynamoTable` property is configured, `ShortLinkResolver` creates a DynamoDB client
- DynamoDB table uses `fragment` as the key and stores `expanded_url`
- Maintains backwards compatibility by falling back to Google URL (for now) shortener if DynamoDB is not configured or lookup fails
- Google URL shortener fallback will be removed in August 2025 when the service shuts down

## Test plan
- [x] All existing tests pass
- [x] TypeScript compilation succeeds
- [x] Linting passes
- [x] Updated tests to accommodate new awsProps parameter
- [x] Verify fallback to Google URL shortener when DynamoDB not
configured
- [x] Manual testing

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-26 16:24:04 -05:00
Spencer Fricke
c2a02c7d8f Update Khronos Logos (#7726) 2025-05-25 16:12:33 +00:00
Patrick Quist
7f393e6763 Refactor objdump execution to use BaseObjdumper class (#7715) 2025-05-25 17:21:01 +02:00
Patrick Quist
6fb3ab38e7 Add Game Boy emulator support using WasmBoy (#7717) 2025-05-24 18:43:41 +02:00
narpfel
91a2d58aa2 Make 2024 the default edition for Rust >= 1.85 (#7649)
Resolves #7472.
2025-05-23 03:01:26 +02:00
Matt Godbolt
8106ccdad9 Fix static URL double slash issue in CDN asset paths (#7709)
## Summary
Fix production CDN loading issues where URLs like
`https://static.ce-cdn.net//vendor.v57...css` (double slash) were being
generated when the `staticUrl` config has a trailing slash.

## Root Cause
PR #7681 refactored static asset handling and replaced
`urljoin(staticRoot, path)` with `${staticRoot}/${path}` string
interpolation, losing URL normalization that `urljoin` provides.

## Changes
- Replace string interpolation with `urljoin()` in
`createDefaultPugRequireHandler()`
- Add comprehensive tests covering all trailing slash scenarios
- Maintain full backward compatibility with existing configurations

## Test plan
- [x] All existing tests pass
- [x] Added 4 new test cases for static URL handling with various slash
scenarios
- [x] Verified TypeScript compilation and linting
- [x] Tested production CDN scenario where
`staticUrl=https://static.ce-cdn.net/`

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-21 17:27:06 -05:00
Matt Godbolt
a5903c0867 Fix issues introduced in #7681 (#7707)
- healthcheck got accidentally unwired
- CSP was accidentially "done" (was a TODO)
2025-05-21 16:20:51 -05:00
Rob Parolin
a0b48fb7e0 Add Mojo compiler (#7692)
This PR adds support for the Mojo programming language.

Explicitly tested viewing the generated assembly, LLVM IR, and running
the generated executable.
2025-05-21 13:53:05 -05:00
Matt Godbolt
f94ff8332a Refactor: Split app.ts into smaller modules (#7681)
## Summary
This PR significantly improves maintainability by breaking up the 880+ line monolithic app.ts file into smaller, focused modules with proper testing. The code is now organized into dedicated modules under the lib/app/ directory, making the codebase more maintainable and testable.

## Key changes
- Extract functionality into modules under lib/app/ directory:
  - Command-line handling (cli.ts)
  - Configuration loading (config.ts)
  - Web server setup and middleware (server.ts)
  - Core application initialization (main.ts)
  - URL handlers, routing, rendering, and controllers
- Add comprehensive unit tests for all new modules
- Make compilationQueue non-optional in the compilation environment
- Improve separation of concerns with dedicated interfaces
- Ensure backward compatibility with existing functionality
- Maintain cross-platform compatibility (Windows/Linux)

## Benefits
- Improved code organization and modularity
- Enhanced testability with proper unit tests
- Better separation of concerns
- Reduced complexity in individual files
- Easier maintenance and future development

This refactoring is a significant step toward a more maintainable codebase while preserving all existing functionality.
2025-05-20 17:53:24 -05:00
Patrick Quist
ac4642283c fix pascal execution (#7695)
Fixes #7224
2025-05-20 13:19:31 +02:00
Patrick Quist
447737db5b add ld info to CompilationInfo for tools (#7697)
Fixes #7306
2025-05-20 13:15:27 +02:00
Patrick Quist
bd9e2d4cbc fix remote libraries listing backend and frontend (#7688) 2025-05-16 16:53:40 +02:00
Partouf
ca5e088d1f skip stdver matching 2025-05-13 21:58:58 +02:00
narpfel
703b13ae01 Fix Rust edition argument parser (#7652)
* For `nightly` Rust (and 1.88+), the output format of `--help` was
changed in https://github.com/rust-lang/rust/pull/140152.
This PR changes the parser to parse the new format, so that edition
overrides are selectable for `nightly` Rust. Note the `<>`:
  ```
          --edition <2015|2018|2021|2024|future>
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
                          stable edition is 2024.
  ```
* Rust <= 1.34 (and >= 1.31) support the 2018 edition, but the help
message only includes `--edition` in verbose mode.
2025-05-12 12:54:48 -05:00
Abhilash Majumder
4649b3dd0e Add PTX as a separate module from assembler (#7615) 2025-05-12 12:51:03 -05:00
Matt Godbolt
54c942ba76 Replace nopt with commander.js for argument parsing (#7673)
- Replace nopt with commander.js for better command-line argument parsing
- Add automatic help generation with detailed descriptions
- Maintain backward compatibility with existing arguments
- Remove unused nopt dependency from package.json

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-12 12:49:28 -05:00
Matt Godbolt
59aceae9c4 Simplify and extract types (#7680)
- prevents anything importing from `app.js`
- generally tidies up and removes unused stuff
- makes typing a bit more correct
2025-05-12 10:28:51 -05:00
Matt Godbolt
eaa083edc3 Simplify noscript handling, and add types (#7677) 2025-05-12 08:32:21 -05:00
narpfel
1150078f7d Treat opt output as LLVM IR (#7670)
Resolves #7669.

`processAsm` didn’t recognise that `opt` generates LLVM IR, so it
invoked the generic `AsmParser` instead.
2025-05-11 23:38:31 -05:00
Matt Godbolt
2f892583ba Remove global handler_config variable (#7675)
The global handler_config was being used to allow compilers to find
other compilers. This change replaces that global with a proper method
on the CompilationEnvironment class, allowing compilers to find other
compilers through the environment instead of using a global variable.

🤖 PR description generated with [Claude Code](https://claude.ai/code) -
code by @mattgodbolt though :)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:47:58 -05:00
Matt Godbolt
ad5bec7626 Remove top-level global for base directory (#7674)
This PR removes the top-level global variable for the base directory and replaces it with a module-level variable managed through a setter function. Key changes include removing the global declaration in lib/global.ts, introducing a local ce_base_directory variable and setBaseDirectory function in lib/assert.ts, and updating app.ts to use the new setter.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:28:04 -05:00
Matt Godbolt
9a7e0d4ed8 Fix up import order 2025-05-11 16:15:21 -05:00
Rucadi
aa5c02fa70 Add Nix Language (#6198) 2025-05-11 16:07:40 -05:00
partouf
50d044407b fixes for running CE on osx 2025-05-08 16:52:32 +02:00
Patrick Quist
b7a35dedf6 Fix loading projects from zip file (#7639) 2025-05-07 19:32:18 +02:00
Anton Baliasnikov
e5c982e7d9 Add solx, new Solidity LLVM-based compiler (#7633) 2025-05-05 13:05:17 +02:00
Matt Godbolt
04bcf21900 Bump to latest sentry; preload etc (#7617)
New node sentry prefers some node.js "preload" nonsense. I use this
"hack" to avoid having to make a lock-step change to the runner: tested
locally and then deployed to staging and tested there with both
server-side and client-side errors.
2025-04-26 13:36:11 -05:00
Detjon Mataj
c79e41f77a Remove dependency on request and replace it with node's builtin fetch (#6800)
resolves #5289
2025-04-25 21:24:07 -05:00
Patrick Quist
afdea17163 fix sway std path and build command (#7597) 2025-04-23 15:53:49 +02:00
Matt Godbolt
c3ca289a05 Specifically allow OPTIONS for browser preflight CORS checks. (#7596)
Google AI suggested too (independently, I did this first then searched
and got:

---

1. Using Middleware
A middleware function can intercept OPTIONS requests and set the
appropriate CORS headers.

```js
app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
  res.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
  if (req.method === 'OPTIONS') {
    res.sendStatus(200);
  } else {
    next();
  }
});
```
---

Tested locally with curl on GET, OPTIONS, and POST and correctly lets
OPTIONS return an empty CORS block, etc. And the site works too :)

---------

Co-authored-by: Mats Jun Larsen <mats@jun.codes>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-22 21:29:04 -05:00
narpfel
355d49ec63 [c2rust]: allow passing arguments to clang (#7583)
To pass arguments to `clang` (such as `-std=...`), `--` must be used to
separate these arguments from the arguments to `c2rust`:

```console
$ ./c2rust-transpile --help
transpile 0.20.0
[...]
USAGE:
    c2rust-transpile [OPTIONS] [COMPILE_COMMANDS]... [-- <EXTRA_CLANG_ARGS>...]
```

However, when doing this, the input file must be passed *before* the
`--`. Also, when libraries are enabled, the include and link flags must
be passed to `clang` (but duplicate `--` are not allowed).

Example for passing command line arguments:
https://godbolt.org/z/eqfa3T7WY
Example for activating a library: https://godbolt.org/z/srh55Y1hY
2025-04-22 13:55:17 -05:00
Andy Soffer
45af54f180 Make the Bronto Refactor Tool available for C++ compilations (#7555)
"Bronto Refactor" is a tool that reads annotations in C++ source code
and generates edits based on those annotations. For CE specifically, it
outputs a copy of the primary file with the modifications applied.
Documentation can be found
[here](https://github.com/brontosource/bronto/blob/main/include/bronto/bronto.hpp)
and will also be made available at http://brontosource.dev in a nicer
format before this PR is merged.

I've attached a screenshot which hopefully conveys the idea.

One question I have is about how to actually deliver the tool. It is not
publicly available, but we do want folks to be able to play around with
it. We're happy to have you build it from source or we can deliver a
prebuilt binary, whatever is preferable.

This is my first time contributing here. I think I've got everything set
up appropriately (including sibling PR
https://github.com/compiler-explorer/infra/pull/1569 to the infra
repository) but please let me know if I'm missing anything.


<img width="1723" alt="BrontoRefactorToolScreenshot"
src="https://github.com/user-attachments/assets/cd605358-b7f2-49e8-9845-b6f3056fa4ef"
/>
2025-04-22 13:48:57 -05:00
Patrick Quist
ad6b2e6731 Execution fixes (when using architectures that cant run) (#7588) 2025-04-22 19:31:09 +02:00
Matt Godbolt
20048616da Migrate to express 5 (#7572)
Main changes:
- type checker cares about the return value (`void`) of handlers, so no
more `return res.send("...")` as that returns `express` type.
- regexes on slugs no longer supported, but we weren't really using them
in any meaningful way. The two places that had to be updated:
- `/clientstate/:clientstate64` - now uses a regex directly and tests added (thanks @partouf for spotting #4844)
- `/bits/:bits.html` - was some `\w+` but I believe that's unnecessary
for the same reasons
- actually call the Sentry handler. I don't know if this actually worked
before but the API checks suggest not.
2025-04-19 14:34:41 -05:00
Matt Godbolt
6400235a18 Drop dependency on fs-extra (we removed it a while back) 2025-04-19 13:56:20 -05:00
Ofek
2d74bb24aa Fix #7573: Handle catchswitch, catchret and cleanupret LLVM-IR block terminators (#7574) 2025-04-18 06:39:16 +03:00
Tim Hutt
d1d0883a86 Add support for the Sail language (#7304)
This adds support for the [Sail
language](https://github.com/rems-project/sail) - a DSL for defining
ISAs.

It's not quite ready but I need some help. These are the main remaining
issues:

1. When you "link to binary" it does disassemble the binary properly,
but the syntax highlighting and line numbers are broken.


![image](https://github.com/user-attachments/assets/2f4fe12c-49b4-4b26-9cb0-7e1666a7b3a2)

2. If you try to execute the code without a `function main() -> unit =
...` then it gives this error in the compiler output:

```
Internal Compiler Explorer error: Error: spawn /tmp/compiler-explorer-compiler2025025-31052-c8gern.pf8t/model.c EACCES
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Compiler returned: -1
```

This is weird - it should give a linker with an undefined reference to
`zmain`.

3. Sail compiles to C, and then I added extra steps to compile that to
binary (if you select `Execute the code`), but as you can see I had to
move the binary back over the C file, so in this case `model.c` is
actually an ELF file. It works but that seems very weird. There is a
`getExecutableFilename()` method I could override, but doing that seems
to make it even more confused.

4. I also had to have a fake flag for `binary` because the `filters`
don't seem to get set correctly when passed to `runCompiler()`. E.g.
`buildExecutable()` doesn't pass them at all. Not sure what is going on
there. Seems to work though.

Any help appreciated!

PS: Sail is a cool language. It has lightweight dependent type for
integers and bit vectors, which I haven't demonstrated in the examples
yet, but they're neat.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-04-17 17:22:18 -05:00
narpfel
98c91227fa Fix go-to label with position-independent code (#7522)
Resolves #7521.

With this PR, `@...` suffixes are included in the clickable area for
go-to label.

This also affects PowerPC, where `@...` suffixes are a bit more common
(`@ha` and `@l` will also be marked as clickable).

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-04-17 12:25:28 -05:00
Adrien Bertrand
9e7808b13c Add (e)z80-clang compilers. (#7546)
These clang + LLVM backends are not upstreamed but [a community
effort](https://github.com/CE-Programming/llvm-project/), so it's a bit
customized.

This requires https://github.com/compiler-explorer/infra/pull/1566

_Edit: tested locally, works fine._
2025-04-14 15:17:39 -05:00