2340 Commits
Author SHA1 Message Date
Mosè GiordanoandValentin Churavy 8ad1419368 [julia] Add LLVM IrView (#6285)
Julia is based on LLVM like other toolchains supported by Compiler
Explorer, and it can emit LLVM IR, but at the moment we only expose it
via the flag `--format=llvm` to the compiler wrapper.

With this PR we add a proper LLVM IR viewer, like the other LLVM-based
toolchains. We add a new option for the wrapper to emit the entire LLVM
module, which has the benefit of being parsable by Compiler Explorer, so
that we can automatically filter out debug information and metadata
annotations.

Preview (from
https://github.com/compiler-explorer/compiler-explorer/issues/4597#issuecomment-2018956112):


![image](https://github.com/compiler-explorer/compiler-explorer/assets/765740/7c2f80b4-9c92-4761-9f6e-393d0ad26935)

We removed the custom `<[source code line] [number of output lines]
[function name] [method types]>` line in the output of the `code_*`
functions, together with the custom ASM parsing, because they invalidate
the output (it isn't valid ASM nor LLVM), and create more problems than
they solve.

This PR was prepared in collaboration with @vchuravy.

This should eventually address #4597, once inlined LLVM functions are
handled by the IR parser in Compiler Explorer, I think @vchuravy can
comment more on that issue.

---------

Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
2024-04-01 22:08:35 -05:00
narpfel f5efd390fa Optionally show disambiguating hashes in demangled Rust identifiers (#6265)
Demangled Rust identifiers under the `legacy` name mangling scheme rely
on a hash to disambiguate items with the same name, such as different
monomorphisations of the same function or different closures’
`call_once` methods.

In the `v0` mangling scheme, this is no longer a problem. However,
configuring the demangler to show hashes in `legacy` names will include
crate-id hashes in `v0` names, which are [mostly
unneeded](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html#appendix-a---suggested-demangling).

This PR introduces a new checkbox *Options...* → *Verbose demangling*
that lets the user select if they want to include disambiguating hashes
in demangled identifiers.

This checkbox is only shown for compilers that support verbose
demangling, and deactivated when the *Demangle identifiers* checkbox is
unchecked.

Resolves #1754.
Resolves #6255.
2024-04-01 21:58:42 -05:00
Matt Godbolt 042e2b1c02 Handle the case where clang had no buildenvsetup. Closes #6303 (#6305) 2024-03-30 15:01:19 -05:00
Patrick Quist 02f6646a89 socket bugfix for some situations 2024-03-30 00:49:55 +01:00
Oleksandr Zarudnyi 384f5f334a Integrate zksolc (#4398) 2024-03-29 23:06:33 +01:00
partouf 2f0fbf85bc fix filter 2024-03-29 15:40:31 +01:00
Patrick Quist e96b125518 Add MadPascal (#6286) 2024-03-29 02:17:52 +01:00
Ofek 3b19d5cd94 Filter linker switches to avoid bogus warnings (#6297)
Fixes #6271
2024-03-28 21:54:54 +02:00
Ofek f664558add For clang cross-compiles with libc++, explicitly add `-I../include/x86_64… (#6277) 2024-03-25 23:31:42 +01:00
Mosè Giordano 9fe1d359ec [julia] Do not modify in-place options in runCompiler (#6281) 2024-03-25 12:02:56 +01:00
Ofek 5bcc3bf74f Refuse to run llvm-mca with "Compile to binary object" (#6276)
Fixes #5735
2024-03-23 23:00:30 +02:00
standstaff 45ef23c940 chore: remove repetitive words (#6247)
<!-- 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!
-->

Signed-off-by: standstaff <zhengxingru@yeah.net>
2024-03-16 09:22:15 +02:00
Ofek 0cdfa06d2f Allow overriding clang demangler from properties (#6228)
Specifically bpf uses group.bpf.demangler (gcc demangler)

This fix continues #6114.
2024-03-16 09:15:57 +02:00
Kait Lam 44aa5769c8 Revert "builtin.ts: treat EXAMPLES_PATH as relative to app root." (#6246)
Reverts compiler-explorer/compiler-explorer#6237.

This PR broke the recommended `make run` workflow. When using `make
run`, the dist folder does not contain the needed resources.
2024-03-14 08:05:36 -05:00
Kait Lam 51da64cefb builtin.ts: treat EXAMPLES_PATH as relative to app root. (#6237)
I feel this is the least surprising behaviour most of the time. This
will help when packaging and distributing the application.

It may also make sense to base this at rootDir, but examples/ sits
outside etc/ at the moment and I didn't want to disturb that too much.

Thanks!
2024-03-10 17:44:35 -05:00
Ofek 8dd09d1c1f Replace the deprecated substr with substring (#6236)
Just some minor homekeeping.
2024-03-10 10:04:29 +02:00
Matt Godbolt fd3dd917f5 Vitest (#6219)
Port to vitest. Port everything to typescript. Remove chai, mocha and
chai-as-promised. Adds some docs.
2024-03-08 22:25:09 -06:00
narpfel 10c6074073 Add digit separators to long numbers in numeric tooltip (#6221)
Long numbers are sometimes hard to read in the numeric tooltip. To
improve readability, this PR adds language-specific digit separators to
the numeric tooltip.

Decimal numbers are grouped into chunks of three digits while
hexadecimal numbers are grouped into chunks of length four.

The digit separator is language-specific and chosen so that the number
is a valid token in the source language.

[Examples](https://godbolt.org/z/s86cMbjeK):
* for C++, hovering the number `8583909746840200552` shows this tooltip:
`8'583'909'746'840'200'552 = 0x7720'2C6F'6C6C'6568 =
6.5188685003648344e+265`
* for Python, hovering the number `-12345678` shows this tooltip:
`-123_456_789 = 0xFFFF_FFFF_F8A4_32EB = -2.66427945e+34f`

For languages that don’t have a `digitSeparator` set, the tooltip is not
changed.
2024-03-05 20:11:39 -06:00
Matt Godbolt b658e25f6f Support colour background for think-cell (#6223) 2024-03-05 20:11:28 -06:00
Marc Auberer b11264c208 [Spice] Also apply abort-after-dump option to assembly output (#6203) 2024-03-02 14:09:41 +01:00
Patrick Quist 2f0ff5aeb1 fix llvm-cov (#6211) 2024-03-02 14:08:39 +01:00
Marc Poulhiès 52bd0644e1 fix pythran wrt ldpath (#6202)
refs #6079

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-02-28 19:54:31 +01:00
Marc Poulhiès 8e6c90d137 pythran: initial support (#6197)
Pythran is a python to c++ transpiler.
Our supports both the C++ and the full link to a share library (a python
module).

See https://pypi.org/project/pythran/ for more information.

fixes #6079

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-02-28 16:38:03 +01:00
Ofek 02d2194004 Specify llvm-cxxfilt as the demangler for clang *groups* (#6114)
This does contain a single `.default.properties` file, but it already
contained an `/opt/compiler-explorer` reference.

@partouf maybe that would solve the mangling issue for clang-17 + libc++
?
2024-02-27 21:50:31 +02:00
Marc Poulhiès 5ebd04f90e Change getCompilerResultLanguageId prototype (#6148) 2024-02-24 19:21:23 +01:00
Patrick Quist 05e5de6fbc Fix json that is forwarded to remote when in noscript (#6182) 2024-02-24 19:05:34 +01:00
Marc Auberer 1e72627cb7 [Spice] Abort compilation after dump (#6170) 2024-02-20 14:56:19 +01:00
kevinjeon-g e5313c77f9 Update D8 versions (up to 8.2.42) (#6138)
This change adds recent D8 versions (8.1.72, 8.2.33, 8.2.42). Properties
for D8 have been reformatted to use groups in order to avoid duplication
of java/kotlin references.
2024-02-19 17:56:47 -06:00
David Spickett 4e272f73c0 flang: Use -masm to enable Intel syntax (#6145)
Since
https://github.com/llvm/llvm-project/commit/9ca1a1575a337931d0e49859f83a0d5b70916abd,
flang supports the use of `-masm` without having to use `-mllvm`. flang
converts this into `-mllvm...` so the result is the same.

The check still looks for `-mllvm`, as this is the best way to tell
flang and flang-to-external-fc apart. As `-masm` doesn't appear in the
--help output of flang.
2024-02-19 17:48:40 -06:00
Marc Auberer 9fa88d50d5 [Spice] Add std dir to default exec options (#6146) 2024-02-15 12:37:20 +01:00
Patrick Quist 9c5a6d3d95 Clang time trace support in execution pane (#6139) 2024-02-14 19:09:31 +01:00
David Spickett 282637dd0f flang: Enable the Intel asm syntax option (#6128)
flang-new doesn't support `-masm=intel` (though it seems likely it
eventually will), so this uses `-mllvm ...` to achieve the same thing.

flang-to-external-fc is a wrapper script that will be removed once
flang-new becomes flang, so it is not being updated and won't support
-masm or -mllvm ever.

(and you'll get the same output by choosing a gfortran compiler, since
that's what the script uses for codegen)
2024-02-12 21:53:13 -06:00
Marc Auberer c8f0409c25 Accept tail calls for llvm.dbg filters (#6129)
This adds support for filtering tail calls to `llvm.dbg.*` intrinsics
using the regex-based filter mechanism.
Previously, normal calls were filtered out, but tail calls are not
caught by the regex so they remained in the output.
Example with the previous state: https://play.spicelang.com/z/MGGn98
2024-02-12 21:52:45 -06:00
Marc Auberer 54dda76f22 New language: Spice (#6105)
Add support for the Spice programming language.

Spice (`spicelang`) is a simple, AOT compiled, LLVM-based systems
language with focus on practicality and performance.

**Key features of Spice**
- simplicity - see what you get aproach with batteries included
- performance: As Spice uses LLVM as its primary backbone, it competes
with the performance of other LLVM-based compilers
- enhanced safety: Spice implements an enhanced safety mechanism, which
includes builtin heap type with auto-free and more
- cross-compile support: Currently x86_64, AArch64 and wasm32 are
supported cross-compilation targets, but more to come
- Pretty good C and C++ interop

**Links**
- Source code: https://github.com/spicelang/spice
- Website: https://spicelang.com
- Playground (own CE instance): https://play.spicelang.com
- Infra PR: https://github.com/compiler-explorer/infra/pull/1229

**Things this PR addresses**
- General support for Spice
- Three code examples
- Spice mode (Syntax highlighting)
- Opt pipeline support
- LLVM mca and osaca support
2024-02-12 21:50:33 -06:00
Andrea TomasiandMatt Godbolt 4d39fdddb8 View Erlang jitted assembly (#6104)
Hi, this PR adds a way to view the assemply code of Erlang code.

Since OTP 24 inside the Erlang VM there is a jitter that runs while we
load the code.

The standard way to dump the asm code is to pass an option during the
startup. The main issue is that this triggers the dump of all the
modules we are loading (and it is slow).
To avoid this I'm using some instrinsics of OTP 26 but at least we dump
only what we need.

(I'm planning to add it to `infra` and then to awmason

Some references:
-
https://www.erlang.org/blog/otp-26-highlights/#improvements-in-the-erlang-compiler-and-jit
-
https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_bif_info.c#L5255

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2024-02-12 21:49:03 -06:00
partouf b699a65984 fix 2024-02-10 13:40:10 +01:00
partouf 967e1dcf7d fix inputfilename to be correct for postprocess and move cleanup to the end 2024-02-10 13:36:19 +01:00
Ofek Shilon d8fba38400 Fix #6091: Add consideration for negative prefix matches 2024-02-10 09:22:42 +02:00
Patrick Quist 4605ebfb4b Add Fortran library support (#5533) 2024-02-09 23:31:05 +01:00
Cassandra Beckley 4006b0a941 [SPIR-V parser] Filter OpMemberName as directive (#6106)
Filter `OpMemberName` as directive, to be consistent with `OpName`.
2024-02-09 18:45:33 +01:00
Ofek Shilon 04fe14445f Fixes for two llvm-cfg glitches caught by Sentry 2024-02-09 17:58:55 +02:00
kevinjeon-g 3953a3b09c Update dex2oat version string (#6096)
<!-- 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-02-05 21:27:59 -06:00
Andrea Tomasi 1cacc9ce79 Add Elixir language support (#6081)
Hi, I am adding support for the Elixir language
(https://github.com/compiler-explorer/compiler-explorer/issues/3947)
I have done this so far. It is not perfect but at least is something I
can work with.
 
In Elixir you can write several modules in the same file, so I show the
different compile utins as a list.

It works locally but I don't know how to add the Elixir language to
[infra](https://github.com/compiler-explorer/infra/)

Some notes:
- I think Elixir's macro system may be a potential security issue
because I can run code during compilation.
- The decompiled code contains a reference to the file path on the
system machine.


![elixir_compiler](https://github.com/compiler-explorer/compiler-explorer/assets/11353602/59e46c98-646d-4275-9c03-e4097a4977ef)
2024-02-05 20:54:01 -06:00
Matt Godbolt 7ba2635029 Check for non-string values in exec's env (#6087)
- warns
- fixes the case I found
2024-02-04 17:53:48 -06:00
Patrick Quist 68efdcbd97 transform paths given through options.ldPath (#6086) 2024-02-04 16:51:46 -06:00
Matt Godbolt 01b7992ada Fix nsjail environment variables that need mapping to destination paths (#6084)
Maps env vars just like we map everything else, to catch all cases where
"app dir" is an input to jailed processes, the jailed process only sees
the "right" path (`/app/something`).

Tested locally and fixes the dot net "read only `/nosym`" thing while
keeping the `/nosym` behaviour etc
2024-02-04 13:53:50 -06:00
Matt Godbolt c26a2924fc Add more typings (#6082) 2024-02-04 13:33:19 -06:00
Ofek Shilon 31dd08be80 Capture more info on Sentry makeLlvmEdges reports 2024-02-04 21:11:35 +02:00
David Spickett 238aecd870 flang: Enable llvm-ir viewer for flang-new (#6046)
flang supports the -emit-llvm option but the difference from clang is
that while clang allows `-Xclang -emit-llvm`, flang does not allow
`-Xflang -emit-llvm`. Instead we need to use `-emit-llvm` alone.

This is a deliberate choice by the flang driver to make sure the user
isn't asking the compiler to do 2 things at once. In this case assemble
and emit llvm IR.

The way compiler explorer calls clang, the IR ends up not in the `-o`
file path but in a file named after the input file but with the
extension `.ll`. For flang we will get the IR in the file specified by
`-o`.

To handle this I've copied code from ISPCCompiler which does the same
thing. We could dedupe this, but I'm not sure whether it's worth it
while we have only 2 compilers doing this.

(clang supports `clang ... -emit-llvm` as well, so perhaps the flang
style could become the majority mode eventually)

Final note, flang-to-external-fc could support this with changes but
users are better off just using flang-new, the result is the same (as
flang-to-external-fc doesn't advertise -emit-llvm, it won't be
selectable anyway).
2024-02-03 22:27:29 +02:00
kevinjeon-g 71b2065c8c Override getVersion() for dex2oat (#6076)
<!-- 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-02-03 22:21:53 +02:00