-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add webassembly language #6429
Add webassembly language #6429
Changes from all commits
10343ec
adc54f8
e2b3257
d6cc183
5e40c0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
compilers=&wasmtime | ||
objdumper=llvm-objdump | ||
objdumperType=llvm | ||
binaryHideFuncRe=^.*::(:?native_to_wasm_trampoline|wasm_to_native_trampoline|array_to_wasm_trampoline).*$ | ||
|
||
group.wasmtime.compilers=wasmtime2001 | ||
group.wasmtime.compilerType=wasmtime | ||
group.wasmtime.options=-Ddebug-info=y -Ccache=n | ||
group.wasmtime.supportsBinary=true | ||
group.wasmtime.supportsBinaryObject=true | ||
group.wasmtime.versionFlag=--version | ||
group.wasmtime.isSemVer=true | ||
group.wasmtime.baseName=Wasmtime | ||
|
||
compiler.wasmtime2001.exe=/opt/compiler-explorer/wasmtime-20.0.1/wasmtime | ||
compiler.wasmtime2001.semver=20.0.1 | ||
|
||
################################# | ||
################################# | ||
# Installed libs (See c++.amazon.properties for a scheme of libs group) | ||
libs= |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Default settings for Wasm | ||
compilers=&wasmtimelocal | ||
objdumper=llvm-objdump | ||
objdumperType=llvm | ||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's start with this and work on it later if needed. |
||
binaryHideFuncRe=^.*::(:?native_to_wasm_trampoline|wasm_to_native_trampoline|array_to_wasm_trampoline).*$ | ||
|
||
group.wasmtimelocal.compilers=wasmtimedefault | ||
group.wasmtimelocal.compilerType=wasmtime | ||
group.wasmtimelocal.options=-Ddebug-info=y -Ccache=n | ||
group.wasmtimelocal.supportsBinary=true | ||
group.wasmtimelocal.supportsBinaryObject=true | ||
group.wasmtimelocal.versionFlag=--version | ||
|
||
compiler.wasmtimedefault.exe=/opt/compiler-explorer/wasmtime-20.0.1/wasmtime | ||
compiler.wasmtimedefault.name=Wasmtime default | ||
|
||
################################# | ||
################################# | ||
# Installed libs (See c++.amazon.properties for a scheme of libs group) | ||
libs= |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(module | ||
(func $square (param i32) (result i32) | ||
local.get 0 | ||
local.get 0 | ||
i32.mul | ||
) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) 2024, Compiler Explorer Authors | ||
// All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// | ||
// * Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
|
||
import path from 'path'; | ||
|
||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js'; | ||
import {BaseCompiler} from '../base-compiler.js'; | ||
|
||
import {WasmtimeParser} from './argument-parsers.js'; | ||
|
||
export class WasmtimeCompiler extends BaseCompiler { | ||
static get key() { | ||
return 'wasmtime'; | ||
} | ||
|
||
override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string, userOptions?: string[]) { | ||
filters.binary = true; | ||
return ['-o', this.filename(outputFilename)]; | ||
} | ||
|
||
override orderArguments( | ||
options: string[], | ||
inputFilename: string, | ||
libIncludes: string[], | ||
libOptions: string[], | ||
libPaths: string[], | ||
libLinks: string[], | ||
userOptions: string[], | ||
staticLibLinks: string[], | ||
): string[] { | ||
return ['compile', inputFilename] | ||
.concat(options) | ||
.concat(libIncludes, libOptions, libPaths, libLinks, userOptions, staticLibLinks); | ||
} | ||
|
||
override getOutputFilename(dirPath: string, outputFilebase: string): string { | ||
return path.join(dirPath, `${outputFilebase}.cwasm`); | ||
} | ||
|
||
override getArgumentParser() { | ||
return WasmtimeParser; | ||
} | ||
|
||
override getSharedLibraryPathsAsArguments() { | ||
// Wasmtime does not have an equivalent to -Wl,-rpath in its driver, return | ||
// an empty list. | ||
return []; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed this path 馃憤