Commit Graph
934 Commits
Author SHA1 Message Date
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
kevinjeon-g 79028a0610 Support kotlinc output for Android Kotlin (#7251)
This change adds kotlinc as an output option for Android Kotlin, and
updates kotlin.ts to allow for input libraries by parsing library paths
and passing them in with '-cp path:path:...'.

This is intended to simplify the process of inspecting kotlinc output
when Android Kotlin is already selected so that a user doesn't have to
switch to the Kotlin compiler option. This also allows a user to view
kotlinc output with Android libraries.

<!-- 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-06 15:46:54 -06:00
kevinjeon-g 5e23a935de Add full oatdump output behind filters (#7233)
This change makes full oatdump output visible behind the "Directives"
filter. This does the same thing as the --full-output flag, but is
more-easily used. The default code snippets have been updated to include
this.
2024-12-20 11:58:18 -06:00
Ofek 97b5735c21 Opt-remarks for gcc (#7230)
![gccoptrem](https://github.com/user-attachments/assets/4662c5d1-3a4e-443b-a989-bc4dc109e90b)
2024-12-20 10:19:33 +02:00
Matt Godbolt e18ada50fa Add support for QNX (#7234)
CC @doodspav
2024-12-19 16:32:13 -06:00
Partouf 64f3ae4636 fix incompatible options 2024-12-16 15:31:45 +01:00
Ofek 50a7f3ebbf Set MSVC default option to /utf-8, remove it if the user specified /source-charset or /execution-charset (#7223) 2024-12-16 13:42:16 +01:00
Steve d37e1f458a .NET: Add cross-arch codegen support for crossgen2 (#7215)
This allows users to inspect the disassembly other than x64.
2024-12-13 04:32:31 -06:00
Spencer Fricke 120e16aa59 Fix error lines for GLSL output (#7207)
glslang outputs its message strangely (and it is not going to change,
otherwise I would have made the changes there)

This will take an ouptut like

```
ERROR: <source>:4: Something bad
WARNING: <source>:5: Something less bad
```

to be

```
<source>:4: Something bad
<source>:5: warning: Something less bad
```

so it appears automatically in the UI


![image](https://github.com/user-attachments/assets/05454b10-abf7-4f81-8f26-17970028f3f8)
2024-12-09 08:06:02 -06:00
Waqar Ahmed d7f92bdb59 Improve odin codegen processing (#7204)
- support library code filter
- disable demangling, its not needed for odin
- support LLVM IR

<!-- 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!
-->
2024-12-09 12:14:40 +09:00
Matt Godbolt 02951a20db Unify types for tool args (#7199)
- Uses strings across the board in the UI part (no functional change
here from before; all state is the same as it was before).
- Sends _arrays_ in the POST, using the same `splitArguments` code as
the backend.
- Backend _still supports_ strings (though doesn't advertise), also
using same `splitArguments`.
- Moves `splitArguments` into common utils, and rephrases to avoid
unnecessary use of underscore and ES2021+ code.

Tested locally:
- with both old and new client code (ran new backend and old webcode to
show sending strings still works)
- with creating and removing tool windows (checked with `ldd` locally)
- with various strings on the client `moo foo "this is bad" #moo` and
even "error" things like `this is "badger` (with a missing close quote).
All works as you'd expect

Happy to break the "move the splitArguments" code into a separate PR if
that'd be easier to review separately.

Fixes #7195
2024-12-07 14:44:42 -06:00
Partouf 3aff85a216 odin fixes 2024-12-06 17:29:16 +01:00
Waqar Ahmed d3ef2de208 Add Odin language (#7186) 2024-12-06 17:28:47 +01:00