2526 Commits
Author SHA1 Message Date
Ofek b97cbb33b9 Fix #7237: account for potential warning/error matches (#7238)
A warning in an old gcc (4.8.1) had a format that was accidentally
caught by the -fopt-info regex. Now accounting for potential
errors/warnings caught accidentally.

I don't like that `processOptOutput` is being called regardless of
whether `backendOptions.produceOptInfo` is set, maybe need to address it
too.
2024-12-22 11:54:29 +02: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
Mats Jun Larsen c256b922f7 Migrate site templates to yaml config (#7189)
Does some winter cleaning on the site-template stuff :)

1. Migrated away from the custom conf format to plain old yaml
2. Made the images and image files match with the name from the yaml
file. (It's not a problem to have spaces in file paths, nor urls so I
don't see why we shouldn't)
3. Updated the relevant documentation

There is a small breakage in the api response for the meta field. It now
returns `{"screenshot_dimensions":{"width":1000,"height":800}}` which I
believe is a lot more useful than
`{"meta.screenshot_dimensions":"1000x800"}`

Besides, I don't believe this endpoint has any third-party consumers
that rely on the metadata since it's a rarely known feature anyways
2024-12-08 00:59:58 +09:00
Mats Larsen 0d7d5dfc43 Remove unused body-parser dependency 2024-12-07 01:50:28 +09:00
Atharva Rai a3c64dc4dc Remove body-parser dependency (#7176)
This PR addresses issue #7158 by removing the body-parser dependency in
favor of express.json() and other built-in middleware functionalities
provided by Express.js.
2024-12-07 01:47:06 +09: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
Steve 77bbd0b6dc Make the argument parsing more robust (#7185)
Instead of skipping the exactly the last option, skip all options after
the input filename.

Otherwise, in some cases there can be options like `-Wl` and etc. being
passed to the compiler and cause build failures.
2024-12-05 08:13:28 -06:00
Mats Jun Larsen 6566759c75 Hotfix static max age header (#7182)
Good catch @mattgodbolt
2024-12-04 08:13:22 -06:00
Spencer Fricke 05f86a38dd Add preliminary Slang support (#7151)
Part of
https://github.com/compiler-explorer/compiler-explorer/issues/2331 and
similar to [my GLSL
change](https://github.com/compiler-explorer/compiler-explorer/pull/6883)

[Slang](https://shader-slang.com/) is a GPU focused shading language
that has been worked on for years. Last week [The Khronos
Group](https://www.khronos.org/news/press/khronos-group-launches-slang-initiative-hosting-open-source-compiler-contributed-by-nvidia)
will now be running the project as open governance. The latest [Vulkan
SDK](https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-3-296-0-for-windows-linux-macos/)
has also added a build of `Slangc` (slang compiler).

This change adds support for Slang (the language) as a front end with
`Slangc` (the compiler) as the only compiler. Slang can be used for
things like GLSL/HLSL, but that is for a future PR.

I am in contacts with people on the Slang development and plan to
support things for Slang as well as the other GPU related shading
languages

--- 

of course, screen shots as well


![image](https://github.com/user-attachments/assets/c9f6460b-b779-4ff5-b0bb-5a7eff543de1)


![image](https://github.com/user-attachments/assets/b2dbdd5a-c031-4110-ab9d-ed76b9881ad8)
2024-12-04 04:45:50 -06:00
kevinjeon-g 6296e9064d Support OpenJDK output for Android Java (#7122)
This change adds OpenJDK as an output compiler for Android Java,
beginning with 11.0.2. This change also updates java.ts to allow for
input libraries, by parsing library paths and passing them into the
javac invocation as '-cp \<path\>:\<path\>:...'.

This is intended to simplify the process of inspecting javac output when
Android Java is already selected so that a user doesn't have to switch
to the Java compiler option. This also allows a user to view javac
output with Android libraries.
2024-12-04 19:11:11 +09:00
Matt Godbolt 2dd0704dc6 Add a sleep util (#7172) 2024-12-02 18:22:14 +01:00
Matt Godbolt 2d09b92b6a Separate filenames for llvm IR in rust (#7171)
Rust compilers output to fixed-named intermediate files. When running a
regular compiler with `--emit-llvm` _and_ an IR view on the same source,
the outputs fight.

This ensures the intermediate files for IR are named differently.

Thanks @bjorn3

Closes #7012
2024-12-02 18:47:28 +02:00
Steve 13eabd6d04 .NET: Fix the redundant options in some cases (#7152)
#7143 accidentally broke the compilation for mono as it would pass an
unnecessary option `--parallalism 1` to `mono`. Missed this in my local
test as the result of mono was cached.
This option is only used by Crossgen2 and NativeAOT.
2024-12-01 02:58:45 -06:00
Mats Jun Larsen 630015c3f3 Remove addStaticHeaders and contentPolicyHeader functions (#7159)
Stops passing these functions around and instead configures the headers
by chaining express handlers
2024-12-01 16:22:41 +09:00
Mats Jun Larsen fba4ba672a De-couple formatter from http server (#7155)
This patch decouples the formatting logic (which is used by the
clang-format feature) from the http API logic.

This is done with the new FormattingService populates the formatters
from the config, and wraps formatter execution. This way, both the http
controller and the clang-format functionality can use it, reducing tight
coupling.
2024-11-30 12:14:11 +09:00
Mats Jun Larsen 09adb2795a Add re-usable middleware functions to http server (#7154)
Just add the headers you want to the handler list :)

It's basically the addStaticHeaders function again, but this time more
composable. End goal is to replace that function and all its uses with
this as I go with the api improvements

This technically also fixes a cors regression from earlier patches
2024-11-30 11:37:57 +09:00
Steve 1e02873328 Remove the restrictions on compiler options (#7143)
Follow up to #7141

As per
https://github.com/compiler-explorer/compiler-explorer/pull/7141#issuecomment-2506116434,
remove the restrictions on compiler options.

cc: @junlarsen
2024-11-28 15:52:14 -06:00
Matt Godbolt 6fa1dede79 Add lfortran and a slightly hacky path to clang (#7149)
Advice sought: I didn't want to plumb through a whole new compiler flag
for `clang` so used a top-level one for `fortran` in the form of a
`ceProp` (which doesn't cascade through all the groups etc). I think
this is _ok_ but ugly and surprising (To me...) and I wonder if we
should actually consider making each compiler's `ceProps` use the same
logic as the logic in the discovery process with parent properties
etc...or not. (cc @partouf in case I've missed something obvious!)
2024-11-28 15:51:51 -06:00
Thirumalai Shaktivel d5ccd7cf20 [feat] Add LFortran as a new fortran compiler (#7119)
Details:
LFortran is a modern open-source (BSD licensed) interactive Fortran
compiler built on top of LLVM. See, https://lfortran.org for more
details.
 There was an interest in the community to add the compiler into the 
 Compiler Explorer: https://github.com/lfortran/lfortran/issues/623. 
 So, this PR adds it.

LFortran is in alpha (the source code compiles to binary and execute. 
 But, users are expected that their code can break). It can emits AST, 
 ASR, LLVM, C, C++, WAT, Julia, Fortran, etc. It has multiple backend
 like LLVM (default), C, C++, x86, WASM, fortran and mlir. 
 For more options run `--help`.

Changes in this PR:
- Add LFortran as a new Fortran compiler.
- `-g` options is enabled by default in `optionsForFilter`. Providing an
option
to disabling it helps other compilers (that doesn't have complete
support for
 debug information) to compile successfully
2024-11-28 10:45:01 -06:00
Mats Jun Larsen 0c51a94d14 Move site-templates loader file (#7146)
File doesn't have anything to do with the http server anymore
2024-11-29 01:18:21 +09:00
Mats Jun Larsen 788e576762 Add controller for healthcheck endpoint (#7145)
Follow up to building separate express routers for each domain. Now
handles the healthcheck in a separate controller
2024-11-29 01:06:50 +09:00
Mats Jun Larsen eb45763ff0 Add correct types to healthcheck endpoints (#7144)
Removes the any types and properly types the option
2024-11-29 00:24:04 +09:00
Mats Jun Larsen b29a0809ad Introduce HttpController interface for http routers (#7142)
By requiring controllers to declare their own routes, we ensure
consistency between tests and the actual server
2024-11-29 00:12:06 +09:00
Mats Jun Larsen 52e27d5a37 Rewrite assembly documentation handler to controller form (#7130)
Follow-up to #7090
2024-11-28 22:39:10 +09:00
Steve f667fb700b Allow passing --help to compilers (#7141)
As per
https://github.com/compiler-explorer/compiler-explorer/issues/6199#issuecomment-2505980377,
allowing passing `--help` to compilers so that users can know what
options and switches are available (though part of them will be filtered
out, but still better than having nothing).
2024-11-28 22:37:39 +09:00
Benjamin MaxwellandMats d5a016471c Support LLVM IR filters for the output of mlir-translate (#6881)
This enables the LLVM IR filters for the output of `mlir-translate`
(with `-mlir-to-llvmir`). The filters are still disabled for `mlir-opt`
(which only outputs MLIR) as there's currently no support for MLIR
filtering.

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

---------

Co-authored-by: Mats <mats@jun.codes>
2024-11-28 22:13:19 +09:00
Mats b09b027201 Add controller for site templates (#7131)
Equivalent of #7130 for site templates
2024-11-28 21:55:39 +09:00
Steve f311fbb3e9 .NET: Set languageId for ILSpy (#7138)
The compile result of ILSpy is C# code, so use `csharp` for
highlighting.
2024-11-28 10:01:33 +09:00
Patrick Quist 4615e7fb88 Don't keep possibleArguments to reduce memory footprint (#7134)
Hotfix to reduce memory footprint
2024-11-27 17:46:20 +01:00
Mats ea29a6e9d6 Separate list and load actions for source API (#7090)
This is the first PR in API consistency with more to come:

1. The source API urls have been properly defined with
`/source/:source/list` and `/source/:source/load/:language/:filename`
- These used to be two API endpoints mushed together into one `handle()`
function. They are now separate
- While it may appear from the tests that this is an API breakage,
there's currently no way to have the source API spit out responses for
stuff like `/source/moose/load/Grunkle`.
2. The frontend code calling the list api now has shared types
3. Code has been migrated to `/lib/handlers/api/source.ts`
- I've moved code here, because I would like to separate the stuff
that's under the API and the stuff that isn't (e.g., healthcheck)
- The source endpoint is currently not under /api, but I believe it
makes sense to move it.
4. GitHub is terrible at showing the diff, but the `browser.ts` file has
been removed, since it's never actually used. Our frontend only calls
`/source/builtin/...` and it never had any entries. Besides, the type
used on the frontend for the locally stored stuff is different...
2024-11-27 13:54:47 +09:00
kevinjeon-g b2b39017c0 Support system properties in the R8/D8 invocation (#7113)
This change supports JVM system property input by reordering user-input
compiler options that begin with '-D' or '-J'. The latter is an R8/D8
convention; the 'J' is stripped before being used.

Other compiler options are assumed to still apply to R8/D8.
2024-11-26 18:45:33 -06:00
chibitanaka 86f439fc92 Add Vyper support (#7088)
Hello! I'm a big fan of Godbolt and use it regularly to test gas
optimizations in Solidity. However, to this day, there is no support for
Vyper, the second most popular language targeting the EVM, related issue
#4165. We at Statemind.io thought that adding Vyper support would
greatly benefit developers and security researchers, so here is our
attempt to get it working :)

This PR **is not ready** for merging, as `vyper.defaults.properties` and
`vyper.amazon.properties` are not yet defined. I have a few questions to
clarify how to integrate it on the public instance and infrastructure
repository:

Because Vyper compiler is basically a python module, I've found success
in testing multiple versions via separate `venv` environments. In my
local tests `vyper.local.properties` was the following:
```INI
compilers=vyper
compilerType=vyper

versionFlag=--version

compiler.vyper.exe=/opt/research/godbolt/venv/bin/vyper
compiler.vyper.isSemVer=true
compiler.vyper.instructionSet=evm
compiler.vyper.options=--optimize none
```

The versions tested are the latest major Vyper release 0.4.0, along with
0.3.10 and earlier 0.3.xx releases.

It appears that there is support for running python in a virtual
environment in the infra repository:

https://github.com/compiler-explorer/infra/blob/main/bin/lib/installable/python.py

However, I've had difficulties getting started with it and would greatly
appreciate any assistance. Thank you!
2024-11-26 16:38:40 -06:00
Steve 2a55dce7fc Add support for .NET 9.0 and ILSpy (#7124)
- Adding support for .NET 9.0
- Adding support for ILSpy
- Make some changes to the compiler name so that the meaning of the
version is more cleared
- Adding missing compilers for existing .NET versions

cc: @mattgodbolt
2024-11-26 13:20:02 -06:00
Ofek 20b8ccaa6f Remove ICompiler, other minor type fixes (#7079) 2024-11-25 18:36:20 +02:00
Cr0a3 636675c476 [FIX] fixed argument passing for ygen (#7120) 2024-11-24 18:42:55 +01:00
Mats Jun 73ee43da66 Handle site template importing asynchronously (#7089)
1. Gives a proper type to the metadata
2. Fixes a typo in `screenshot_dimentions`
3. Removes home-made partition function in favor of underscore
4. Reads file asynchronously (and consequently rest of API is async)
5. Strips the `https://godbolt.org/#` from each entry in the config file

As an added benefit this should also cut some startup time reading this
file before it's used :)
2024-11-15 10:03:12 +09:00
Ofek 717c9173ad Unify OptCodeEntry and LLVMOptInfo (#7077) 2024-11-14 13:05:26 +02:00
Ofek b321566b09 Fix #7096: consider the rust case where an IR label can include '[' (#7098) 2024-11-14 13:01:08 +02:00
Mats Jun 050e135197 Remove unnecessary type assertion (#7081)
Removes an old TODO of mine :)

p-queue conditionally returns `undefined` if throwOnTimeout is not set
to true. We currently operate our own timeout check, so I haven't
changed that.

Setting timeout to undefined should give us the correct type without
affecting behavior.
https://github.com/sindresorhus/p-queue/blob/main/source/index.ts#L253
2024-11-12 21:30:23 +09:00
Partouf 9e8e5620e4 Revert "Small typing fix for UnparsedExecutionParams (#7078)"
This reverts commit 5116285318.
2024-11-11 16:51:43 +01:00
Mats Jun 3f2aaa6c4b Remove void type from eachLine (#7080) 2024-11-10 20:20:21 +01:00