Commit Graph
946 Commits
Author SHA1 Message Date
Matt Godbolt 6400235a18 Drop dependency on fs-extra (we removed it a while back) 2025-04-19 13:56:20 -05:00
Tim HuttandMatt Godbolt 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
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
Ofek 36715c9369 Support opt remarks for rustc-nightly (#7561)
Closes #7525.
2025-04-12 11:29:38 +03:00
Mats Jun Larsen 1e4f0cbb49 Revert noThisInStatic Biome rule for argument-parsers.ts (#7529) 2025-03-29 15:33:40 +01:00
Steve 948382018e .NET: Add multiple architectures support for NativeAOT (#7496)
Depends on https://github.com/compiler-explorer/dotnet-builder/pull/25
2025-03-27 13:52:41 -05:00
Matt Godbolt 90aee8f04d Implement a no-op parser for handling rust 2025-03-27 12:15:39 -05:00
Nicole LeGare 73196b9441 Turns out getOutputFilename was necessary 2025-03-18 13:46:24 -07:00
Nicole LeGare d0c91b07f8 Remove unnecessary function overrides 2025-03-18 13:46:24 -07:00
Nicole LeGare e74adc5c28 Remove unnecessary comment 2025-03-18 13:46:24 -07:00
Nicole LeGare 800a015c49 Invoke main c2rust binary instead of c2rust-transpile
This gives us the correct version string, rather than getting the version for just the c2rust-transpile binary.
2025-03-18 13:46:24 -07:00
Nicole LeGare 8f56587bae Add support for c2rust as a C compiler 2025-03-18 13:46:24 -07: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
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 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 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 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
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
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
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
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
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
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
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
Mats Jun Larsen 5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00: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
Matt Godbolt cd29f86d24 Prevent exception if compiler didn't generate (#7334)
Stops sentry errors, gives a slightly less awful error to the user.
Closes #1814

Tested locally.
2025-01-29 15:06:43 -06:00
Waqar Ahmed 54ea096e1a odin: require main function (#7314)
In optimized build, odin inlines the world and even ends up inlining the
user visible `main` function into the entry point main. The result is
empty asm output which is confusing. Thus, @require main so that the
compiler doesn't inline user visible main function

 #7210
2025-01-29 10:41:03 -06:00
kevinjeon-g 44920dd00d Fix .smali class regex in Dex2OatCompiler (#7319) 2025-01-29 09:36:11 +00:00
Matt Godbolt e452db56fc Special casing for msp430 (#7317)
- Make a special msp430 handler that breaks lines on `{` to fix the
weird inlining behaviour unique to msp430 output.

Closes #295
2025-01-28 10:00:04 -06:00
Filippo Barbari a53090ec92 Added check for clang-offload-bundler for Intel OneAPI >= 2024.0.0 (#7278)
Fixes #7277.
2025-01-24 11:22:03 -06:00
kevinjeon-g e4fc6cb001 Fix dex2oat on Android Kotlin (#7292)
The Kotlin compilation step results in an added 'final' in the D8 .smali
output, which we weren't accounting for. This change updates the class
name regex for .smali files to collect only the 'L<class>;' string.

This change also fixes dex2oat for Android Java in cases where 'final'
is applied to classes.
2025-01-24 17:36:23 +09:00
Andrea Tomasi ee4ab8bb5b View Elixir jitted assembly (#7282)
Hi, this PR adds a way to view the assembly code of Elixir code.

This continue the work from #6081 and #6104
2025-01-19 11:34:32 +09:00
Matt Godbolt 8ef76dd5bf Support execution and binary output in ispc (#7273)
- ispc doesn't link, so interpose running `gcc` or similar to output the final binary
- works around some naming issues in ispc

Ckoses #3937
2025-01-16 14:06:35 -06:00
narpfel 3e36414a34 [rust] switch to -C debuginfo=2 (#7266)
This is mainly for `pahole`, which requires type information that is
only present with `-C debuginfo=2`:
https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo

CE originally passed `-g` to `rustc` (which is an alias for `-C
debuginfo=2`), but this was changed in
c4411ff2a1 to `-C debuginfo=1` to work
around https://github.com/rust-lang/rust/issues/11906. However, this
workaround never actually removed frame pointers, so switching back to
`-C debuginfo=2` should not affect codegen for very old `rustc`
versions. See also #79.
2025-01-13 20:44:11 +09:00
Ofek a101e2d9f2 Fix MSVC's handling of /link options, fix and modernize some docs (#7260)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2025-01-11 18:16:04 +02:00
kevinjeon-g fd6a07d233 Add source<>disassembly highlighting for dex2oat (#7248)
oatdump, the dex2oat dump tool, doesn't output any information that can
be used to associate disassembly with source lines. However, dex2oat's
output optimization CFG (classes.cfg) does contain a final disassembly
stage that retains dex_pc.

Lines of disassembly from oatdump can be associated with lines of
disassembly in classes.cfg, and through the dex_pcs there, be mapped
back to the D8 .smali output, which does contain source line
information.
2025-01-08 11:17:17 -06:00
Waqar Ahmed e0e2420482 Improve odin codegen processing (#7228)
- Builtin runtime functions __$startup_runtime, __$cleanup_runtime, __$*
are now filtered out
- Label matching regex is fixed for odin, see OdinAsmParser class. This
ensures we filter out all labels that don't belong to the current file
- Slightly improved editor support, auto bracket closing and commenting
via keyboard shortcuts works now
- procedures within the file are automatically @require as requested by
GingerBill (odin lang creator).

There still are a lot of unused labels with data definitions that dont
get filtered out.

#7210
2025-01-06 15:49:15 -06:00