Commit Graph
2600 Commits
Author SHA1 Message Date
Patrick Quist 6b5553d726 Dont change original library versioninfo object (#7517) 2025-03-25 23:09:44 +01:00
kevinjeon-g 3ea4baa363 Correctly handle missing .dex file for R8 (#7498)
R8 will not produce a .dex file if there are no entry points into the
.class file code. This change updates R8/D8 so that a missing .dex file
returns a message to the user in the compiler output window, instead of
logging a warning/error.
2025-03-15 00:31:18 +00:00
Partouf 4a38793943 redirect output of clippy 2025-03-14 17:32:53 +01:00
Partouf 61715be49a fix rust clippy tool 2025-03-14 16:59:27 +01:00
narpfel 6a793ecce0 [rust] don’t use a separate tempdir for clippy (#7497) 2025-03-13 18:37:27 +01:00
narpfel 95979128ac Add clippy for Rust (#7477) 2025-03-12 22:45:15 +01:00
Joshua BattyandMatt Godbolt 8c6ce602d1 Add support for pre-installed Sway std library (#7456)
This PR updates the Sway compiler to use pre-installed std libraries
rather than fetching from GitHub. It:

Dynamically adds the std library path to `Forc.toml` when using
versioned compilers
Sets the `--offline` flag at the group level to prevent network access
Works with the std library package added in compiler-explorer/infra#1539

This resolves the issue where Sway was attempting to fetch libraries
from the internet, which is blocked in the Compiler Explorer
environment. see [this
comment](https://github.com/compiler-explorer/compiler-explorer/pull/7409#issuecomment-2679284531)

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-03-10 12:58:07 -05:00
Marc Auberer bae3b714ee [Spice] Short cli flag -obj was removed (#7467)
The short flag `-obj` was removed from the compiler cli.
The long version (`--dump-object-file`) was already available before and
thus also works for older compiler versions.
2025-02-28 23:48:04 +01:00
Matt Godbolt a66cf13ff5 Improvements to r8/d8 dex stuff (#7460)
- better handling of missing files (doesn't crash)
- better error reporting.
2025-02-26 14:09:24 -06:00
Matt Godbolt 9a3661416a Don't cleanup build dirs until after processAsm (#7459)
- `d8` and `r8`'s `processAsm` looks in the build output folder for
`.smali` and `.cfg` files.
- it used to do this _synchronously_ and so worked (maybe accidentally)
- changes recently made that async, and so some of the time the files
would be cleaned up before it read them (or even during...)
2025-02-26 14:03:43 -06:00
Matt Godbolt a4995a9c1c Move to using async file reads (#7433)
Remove most, if not all, of the synchronous file reads. Hopefully this
will help a little with performance and "event loop lag". Mostly, it's
"try not to use third party packages when builtins now do the work".

Local testing seems OK - but needs a good poke around on staging to
exercise all the paths.
2025-02-26 11:11:12 -06:00
Matt Godbolt 619e4bd2e4 New temp directory tracker (#7452)
Replaces aging `temp` with a simple, bespoke solution. Reduces the
number of deprecated/out-of-date dependencies we pick up.

Closes #7445.
2025-02-26 10:56:26 -06:00
Matt Godbolt 86536fc8bc Port compilers over to using node:fs et al (#7449)
- use utils functions where necessary
- introduce a few asyncs where needed.

Some local testing done (e.g. with sway and clang). Will need testing in
staging for the best outcome.
2025-02-26 10:56:10 -06:00
Ofek 64706f1d53 Fix #7265: Check explicitly for clangir instead of '-emit-cir' support 2025-02-26 02:07:48 +02:00
Ofek e01aa3e691 Various type improvements 2025-02-26 02:07:09 +02:00
Matt Godbolt 5a309652f1 More relatively uncontentious fs changes (#7450)
- use node libraries instead of fs-extra
2025-02-25 15:27:45 -06:00
Matt Godbolt 045e318645 Add some useful fs-extra-replacey utils and tests (#7448) 2025-02-25 15:07:57 -06:00
Matt Godbolt 698f9944cd Use node:fs/promises where possible (#7444)
- Updates a number of uses of `fs-extra` which were only for the
promisified fs calls.
- Makes a few sync calls async.
- Makes a few `read` calls that didn't specify a text mode, but then
parsed as a string...into the equivalent `readFile` call.
2025-02-25 13:26:31 -06:00
Matt Godbolt 669abcb70d February major updates (#7443)
- vitest and all test types etc (test pass). Needed a few minor changes
to match new behaviour of `expect().toMatchSnapshot` (trailing
whitespace is now important)
- `which` - read the changes and spot-checked it. They dropped <v18
- `webpack-cli` - changes don't affect our usage. Checked with a local
`webpack` build and a "prod" run (`make` no dev)
- `enhanced-ms` - checked and updated to use new functionality
- `typescript` - all tests pass, no warnings.

Tested the site locally too.
2025-02-25 13:05:50 -06:00
Matt Godbolt 2cd262ddaa Drop logging of unbuffering to debug 2025-02-25 08:51:33 -06:00
Matt Godbolt 9c90f72129 Tiniest possible step towards type safety for CompilationResult.asm (#7432)
This is a super conservative tweak towards trying to use types for
processAsm, objdump, afterCompilation et al.
2025-02-25 08:37:05 -06:00
Matt Godbolt 792e55f31e Fix format of processAsm (#7431)
I'll update `processAsm` to actually have a proper type and that will
catch this in future.
2025-02-24 12:33:51 -06:00
8557b59055 added initial support for the Coccinelle code transformation system, closes #6999 (#7001)
This fork provides a rudimentary way of using Coccinelle within Compiler
Explorer.
In the left window one can edit either C or C++ code, and within
preprocessor ifdefs, one can write a semantic patch for Coccinelle.
The right window will display the transformed code.

A coccinelle on infra is not yet done.
Any distribution-based coccinelle would do, for the moment.

If you like it, this close #6999 .

---------

Signed-off-by: Michele Martone <michelemartone@users.sourceforge.net>
Co-authored-by: Patrick Quist <partouf@gmail.com>
Co-authored-by: Mats Jun Larsen <mats@jun.codes>
Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-02-24 10:10:35 -06:00
Rupert Tombs afccba613e Quash some warnings in tests (#7415)
- Prevent some warnings in the `test-and-deploy` action; see, for
example, `Run checks` at
https://github.com/compiler-explorer/compiler-explorer/actions/runs/13421609790/job/37495341332:
  - Await a result to avoid:
```text
Promise returned by `expect(actual).toMatchFileSnapshot(expected)` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
    at it.timeout(/home/runner/work/compiler-explorer/compiler-explorer/test/filter-tests.ts:91:50)
```
- Remove duplicated `AVRrc` entries in
`lib/asm-docs/generated/asm-docs-avr.ts`. `AVRrc` is a [reduced core
AVR](https://ww1.microchip.com/downloads/en/DeviceDoc/AVR-InstructionSet-Manual-DS40002198.pdf#page=18),
not an opcode. This avoids a warning beginning `[vite] warning: This
case clause will never be evaluated because it duplicates an earlier
case clause`.
    - Update generator script to also filter `AVRe`.
- Deduplicate `RLDICL` in `lib/asm-docs/generated/asm-docs-power.ts`.
IBM document this instruction both
[here](https://www.ibm.com/docs/en/aix/7.3?topic=is-rldicl-rotate-left-double-word-immediate-then-clear-left-instruction)
and
[here](https://www.ibm.com/docs/en/aix/7.3?topic=is-rldicl-rotate-left-double-word-immediate-then-clear-left-instruction-1).
I choose the neater-looking one, which is also more similar to their
[`RLDICR`](https://www.ibm.com/docs/en/aix/7.3?topic=is-rldicr-rotate-left-double-word-immediate-then-clear-right-instruction)
documentation. This avoids warnings beginning `[vite] warning: This case
clause will never be evaluated because it duplicates an earlier case
clause`.
2025-02-24 10:05:31 -06:00
Joshua BattyandMatt Godbolt b272efdb53 Add sway compiler (#7409)
Should be pretty self explanatory. I've added a corresponding PR to the
infra repo [here](https://github.com/compiler-explorer/infra/pull/1532)

Please let me know if there is anything I've done incorrectly here!
Thanks

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-02-24 09:38:13 -06:00
Matt Godbolt aa03700929 Fix silly bug (whoops) 2025-02-19 11:09:45 -06:00
kevinjeon-g a142ae29b7 Add version info for R8/D8 (#7406)
This fixes the version info button in the compiler window for R8/D8.
Version info is pulled from the version properties file for latest, and
from the filename for named releases.
2025-02-19 10:42:21 -06:00
Rupert TombsandMats Jun Larsen ca1ecbb2e3 Add Numba (#5592)
- Add initial support for Numba compilation: asm, demangling, execution

Numba wraps Python functions in `Dispatcher` objects. Each dispatcher
contains zero or more compiled argument-type-indexed overloads of its
function. We import the user's code as a module, and emit the code from
all overloads of all dispatchers that the module publicly exposes.

Name mangling is odd in Numba. It uses a similar mangling syntax to C++,
but also encodes non-symbol (`r"[^a-z0-9_]"`) characters as `_%02x`.
This encoding yields valid identifier names, so it is not strictly
invertible. Here, I have hard-coded some replacements to decode some
common cases at the cost of possible clashes with ugly user-defined
names.

Screenshot captured via `make dev EXTRA_ARGS="--debug --language numba"`

![generator
example](https://github.com/user-attachments/assets/77b8e53a-3589-4e0d-9589-10c36a026b6f)


## To do

- [x] Answer questions of #5591.
- [x] Acquire a python environment.
- [ ] Automatically run the python test?

Locally, I have installed a virtual environment with python 3.12.3 with

```shell
path/to/python -m venv venv_numba
path/to/venv_numba/bin/python -m pip install numba==0.61.0 scipy>=0.16
```

and configured its use with

```properties
# compiler-explorer/etc/config/numba.local.properties
compilers=&numba
defaultCompiler=numba_0_61_0

group.numba.compilers=numba_0_61_0
group.numba.baseName=Numba

compiler.numba_0_61_0.exe=/path/to/python3.13
compiler.numba_0_61_0.semver=0.61.0
```

I run this python-side test file with

```python
path/to/venv_numba/bin/python -m unittest etc/scripts/test_numba_wrapper.py
```

---------

Co-authored-by: Mats Jun Larsen <mats@jun.codes>
2025-02-19 10:41:42 -06:00
Matt Godbolt de1a892264 Stdbuf fixes and updates for llvm IR (#7412)
- Don't mutate the `args` in-place which exposes the `-o0` of the stdbuf
args to the rest of the code (breaking a bunch of things)
- Check the return code of the LLVM parser dump and error if it's a
problem.

Found looking into #7410 but doesn't fix it
2025-02-19 10:24:54 -06:00
Stephen Heumann 0695a0fe20 Disable external parser for ORCA/C (#7407)
ORCA/C uses its own asm format, and the external parser is not
appropriate for it.
2025-02-18 17:23:17 -06:00
Matt Godbolt 7d4f77d84a Misc fixes for unbuffering (#7404)
- Wrap the executable in `stdbuf` higher up than in `executeDirect`
which means we run `stdbuf` _inside_ the jail instead of outside it when
running. This fixes jail/stdbuf interactions.
- Install `which` types to avoid a `no-ts`
- Ensure `stdbuf` et al is mapped in compilers-and-tools
- As a fly-by also unify the configuration of NVidia devices between
execution and compilation.
2025-02-18 15:17:15 -06:00
Stephen HeumannandMatt Godbolt 5a72fa0659 Add support for ORCA/C (#7368)
[ORCA/C](https://github.com/byteworksinc/ORCA-C) is a C compiler that
natively runs on and targets the Apple IIGS. ORCA/C and the programs it
generates can be run on modern Linux systems by using an emulation tool
called [Golden Gate](https://goldengate.gitlab.io).

This adds support for ORCA/C (run via Golden Gate) in Compiler Explorer.
It uses its own assembly format and objdumper (provided by Golden Gate),
so support for those is added. An extra configuration option was also
added to support execution via an emulator, bypassing the usual check
that executables can run natively. Asm docs for the WDC 65C816 processor
were also added.

ORCA/C and Golden Gate are not Free Software, but their rights holders
have given permission for them to be used on Compiler Explorer. Tarballs
for them can be supplied privately. See infra PR:
compiler-explorer/infra#1521

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-02-18 10:28:10 -06:00
Ofek a457221f7a Fix #7239: Prefix exeutions with stdbuf -o0 (#7378)
Please note this adds the anti-stdout-buffering machinery to all
executions - *including of the compilers themselves*. I think this is a
good thing.

I (hope I) excluded execution on windows. Are there other needed
exceptions?
2025-02-17 00:55:53 +02:00
Niles Salter bbdad0fe8e [Zig] Fix target/arch parsing so assembly docs query the correct ISA (#7363) 2025-02-16 01:18:18 +01:00
Matt Godbolt 9f3d43b271 Add carbon native compiler (#7389)
- Renames existing carbon stuff to carbon-explorer. Will need a quick
infra install and will temporarily (like, for 2m) break things during
deploy.
- Adds carbon binary support
- Supports binary, execute, and binary objects
- Updates the default carbon file as best I can
 
Closes #5402
2025-02-12 13:41:08 -06:00
Matt Godbolt c08c4036c8 Reference 7150 2025-02-12 13:19:51 -06:00
kevinjeon-g 8a0a6e93da Use Java 22 for latest Android compilers (#7388)
This change updates the Java version used for R8/D8/dex2oat latest to
the most recent Java version available to help investigate newer Java
features.
2025-02-12 13:19:13 -06:00
Patrick Quist aae8fdcf7d Waiting for cache when execution of same thing is in progress (#7369) 2025-02-12 18:26:14 +01:00
Mats Jun Larsen 127c12e0bf Re-enable noShadowRestrictedNames Biome rule (#7387)
I'm not very opinionated on this, but I think it makes enough sense to
do
2025-02-13 00:43:55 +09:00
Mats Jun Larsen 943d9fb233 Move noscript compile handler into own controller file (#7371)
Continuation of my previous work on the http endpoints. This leaves the
old noscriptHandler to only serve the HTML pages.
2025-02-10 16:51:50 +00:00
Ofek 74091949e2 executionType/sandBoxType no longer stored per compiler (#7381)
.. as they're uniform execution options


Note the removal of `(compiler as any).executionType = 'nsjail'` from
tests - seems it didn't do anything.

But better test execution in staging, as I'm having trouble using nsjail
locally.
2025-02-08 18:15:03 +02:00
Patrick Quist ea1c667c30 Missing tree filenames short link fix (#7379) 2025-02-08 16:12:40 +01:00
Waqar Ahmed 877aa5551c Zig improvements (#7355)
- Make it easy/possible to run compiler-explorer-zig locally (see first
commit)
- Dont strip debug info, add explicit flag for this (second commit)
- Allow filtering library functions. (it doesn't work super great atm,
but at least some of the hundreds of thousands of lines get filtered
out).
2025-02-08 05:34:19 +00:00
Matt Godbolt 14b4af3cfa Fix up imports 2025-02-06 11:10:34 -06:00
Marc Poulhiès 80c864ffd1 Hardcode that gm2 and ga68 are GCC-dump enabled
Should be autodetected but both drivers are not behaving like gcc
driver.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-02-05 17:23:58 +01:00
narpfel 2e69144b27 Add quickfixes for missing imports and feature flags (#7357) 2025-02-03 04:13:08 +00:00
Mats Jun Larsen 5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Mats Jun Larsen 96e1db8509 Introduce jsonOnly middleware for requiring JSON content type 2025-02-01 02:05:03 +09:00
Marc Poulhiès d6d124307f fix ga68 compiler setup
refs https://github.com/compiler-explorer/compiler-explorer/issues/7258

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-01-31 09:07:00 +01:00
Marc Poulhiès ce11ca3808 Add new language: Algol68 and corresponding GCC frontend (#7346)
refs https://github.com/compiler-explorer/compiler-explorer/issues/7258

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-01-31 08:37:48 +01:00