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.
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>
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.
- 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.
- 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.
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>
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>
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.
- 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"`

## 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>
[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>
- 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
.. 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.
- 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).
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
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.
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.
<!-- 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!
-->
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.
- 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
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!
-->
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.
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

- 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!
-->
- 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