This commit is contained in:
Jeehoon Kang
2024-05-08 03:31:34 +00:00
parent c73c81c10e
commit 099672d0b8
17 changed files with 463 additions and 226 deletions

View File

@@ -10,16 +10,17 @@ cache:
variables:
RUST_BACKTRACE: "FULL"
image: "rust:latest"
image: rust:latest
stages:
- install
- test
- deploy
install:
stage: install
script:
- rustup default stable
- rustc --version # triggering installation
check:
stage: test
@@ -35,13 +36,26 @@ check:
debug:
stage: test
before_script:
- apt update && apt install -yy gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user-static
- (echo 'Acquire::http { Proxy "http://10.22.0.2:3142"; }' | tee -a /etc/apt/apt.conf.d/01proxy) && apt update && apt install -yy clang gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user-static
script:
- RUST_MIN_STACK=8388608 cargo test
- RUST_MIN_STACK=8388608 cargo test -- --nocapture
release:
stage: test
before_script:
- apt update && apt install -yy gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user-static
- (echo 'Acquire::http { Proxy "http://10.22.0.2:3142"; }' | tee -a /etc/apt/apt.conf.d/01proxy) && apt update && apt install -yy clang gcc-riscv64-linux-gnu g++-riscv64-linux-gnu qemu-user-static
script:
- RUST_MIN_STACK=8388608 cargo test --release
- RUST_MIN_STACK=8388608 cargo test --release -- --nocapture
pages:
stage: deploy
before_script:
# - apt update && apt install -yy
script:
- cargo doc
- mkdir -p public && cp -r target/doc/* public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH

348
Cargo.lock generated
View File

@@ -2,6 +2,54 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "anstream"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
[[package]]
name = "anstyle-parse"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@@ -14,6 +62,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "cc"
version = "1.0.79"
@@ -28,27 +82,33 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.1.7"
version = "4.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f3061d6db6d8fcbbd4b05e057f2acace52e64e96b498c08c2d7a4e65addd340"
checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272"
dependencies = [
"bitflags",
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"is-terminal",
"once_cell",
"strsim",
"termcolor",
]
[[package]]
name = "clap_derive"
version = "4.1.7"
version = "4.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34d122164198950ba84a918270a3bb3f7ededd25e15f7451673d986f55bd2667"
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
@@ -56,28 +116,31 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.3.2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09"
dependencies = [
"os_str_bytes",
]
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "either"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "errno"
version = "0.2.8"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
"windows-sys",
]
[[package]]
@@ -92,18 +155,15 @@ dependencies = [
[[package]]
name = "fastrand"
version = "1.9.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "getrandom"
version = "0.2.8"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
dependencies = [
"cfg-if",
"libc",
@@ -116,57 +176,17 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "hexf-parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
]
[[package]]
name = "io-lifetimes"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "itertools"
version = "0.10.5"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
dependencies = [
"either",
]
@@ -189,21 +209,21 @@ dependencies = [
[[package]]
name = "lang-c"
version = "0.15.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854c4f48bf55572848e20428f345a0369a1b38c8ac2fb57c1a628b4bc39574e7"
checksum = "720e6492b795d1f6838eb2e51879ec3073be745a20e52c32a241b80b3c8ed998"
[[package]]
name = "libc"
version = "0.2.139"
version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "num-traits"
@@ -214,32 +234,20 @@ dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "ordered-float"
version = "3.4.0"
version = "4.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d84eb1409416d254e4a9c8fa56cc24701755025b458f0fcd8e59e1f5f40c23bf"
checksum = "536900a8093134cf9ccf00a27deb3532421099e958d9dd431135d0c7543ca1e8"
dependencies = [
"num-traits",
]
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "peg"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a07f2cafdc3babeebc087e499118343442b742cc7c31b4d054682cc598508554"
checksum = "400bcab7d219c38abf8bd7cc2054eb9bbbd4312d66f6a5557d572a203f646f61"
dependencies = [
"peg-macros",
"peg-runtime",
@@ -247,9 +255,9 @@ dependencies = [
[[package]]
name = "peg-macros"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a90084dc05cf0428428e3d12399f39faad19b0909f64fb9170c9fdd6d9cd49b"
checksum = "46e61cce859b76d19090f62da50a9fe92bab7c2a5f09e183763559a2ac392c90"
dependencies = [
"peg-runtime",
"proc-macro2",
@@ -258,9 +266,9 @@ dependencies = [
[[package]]
name = "peg-runtime"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa00462b37ead6d11a82c9d568b26682d78e0477dc02d1966c013af80969739"
checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922"
[[package]]
name = "ppv-lite86"
@@ -268,44 +276,20 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.51"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.23"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
@@ -342,22 +326,21 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.2.16"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
name = "rustix"
version = "0.36.5"
version = "0.38.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588"
checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
dependencies = [
"bitflags",
"bitflags 2.4.1",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
@@ -371,9 +354,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.109"
version = "2.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
dependencies = [
"proc-macro2",
"quote",
@@ -382,9 +365,9 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.4.0"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
"cfg-if",
"fastrand",
@@ -393,29 +376,20 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "termcolor"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.38"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.38"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
@@ -424,15 +398,15 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.6"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]]
name = "version_check"
version = "0.9.4"
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "wait-timeout"
@@ -449,42 +423,20 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
@@ -497,42 +449,42 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

View File

@@ -29,13 +29,13 @@ required-features = ["build-bin"]
build-bin = ["clap"]
[dependencies]
clap = { version = "4.1.7", features = ["derive"], optional = true }
thiserror = "1.0.38"
lang-c = "0.15.0"
itertools = "0.10.5"
tempfile = "3.4.0"
ordered-float = "3.4.0"
clap = { version = "4.4.10", features = ["derive"], optional = true }
thiserror = "1.0.50"
lang-c = "0.15.1"
itertools = "0.12.0"
tempfile = "3.8.1"
ordered-float = "4.1.1"
hexf-parse = "0.2.1"
wait-timeout = "0.2.0"
peg = "0.8.1"
peg = "0.8.2"
rand = "0.8.5"

View File

@@ -0,0 +1,18 @@
int main() {
int i = 0;
int c = 0;
while (i < 10) {
i++;
switch (i) {
case (1): {
continue;
break;
}
default: {
break;
}
}
c++;
}
return c;
}

View File

@@ -0,0 +1,49 @@
fun i32 @main () {
init:
bid: b0
allocations:
%l0:i32:i
%l1:i32:c
block b0:
%b0:i0:unit = store 0:i32 %l0:i32*
%b0:i1:unit = store 0:i32 %l1:i32*
j b1()
block b1:
%b1:i0:i32 = load %l0:i32*
%b1:i1:u1 = cmp lt %b1:i0:i32 10:i32
br %b1:i1:u1, b2(), b3()
block b2:
%b2:i0:i32 = load %l0:i32*
%b2:i1:i32 = add %b2:i0:i32 1:i32
%b2:i2:unit = store %b2:i1:i32 %l0:i32*
%b2:i3:i32 = load %l0:i32*
switch %b2:i3:i32 default b7() [
1:i32 b5()
]
block b3:
%b3:i0:i32 = load %l1:i32*
ret %b3:i0:i32
block b4:
%b4:i0:i32 = load %l1:i32*
%b4:i1:i32 = add %b4:i0:i32 1:i32
%b4:i2:unit = store %b4:i1:i32 %l1:i32*
j b1()
block b5:
j b1()
block b6:
j b4()
block b7:
j b4()
block b8:
ret 0:i32
}

View File

@@ -0,0 +1,37 @@
fun i32 @main () {
init:
bid: b0
allocations:
%l0:i32:i
%l1:i32:c
block b0:
%b0:i0:unit = store 0:i32 %l0:i32*
%b0:i1:unit = store 0:i32 %l1:i32*
j b1()
block b1:
%b1:i0:i32 = load %l0:i32*
%b1:i1:u1 = cmp lt %b1:i0:i32 10:i32
br %b1:i1:u1, b2(), b3()
block b2:
%b2:i0:i32 = load %l0:i32*
%b2:i1:i32 = add %b2:i0:i32 1:i32
%b2:i2:unit = store %b2:i1:i32 %l0:i32*
%b2:i3:i32 = load %l0:i32*
switch %b2:i3:i32 default b7() [
1:i32 b1()
]
block b3:
%b3:i0:i32 = load %l1:i32*
ret %b3:i0:i32
block b7:
%b7:i0:i32 = load %l1:i32*
%b7:i1:i32 = add %b7:i0:i32 1:i32
%b7:i2:unit = store %b7:i1:i32 %l1:i32*
j b1()
}

View File

@@ -0,0 +1,39 @@
fun i32 @main () {
init:
bid: b0
allocations:
%l0:i32:i
%l1:i32:c
block b0:
%b0:i0:unit = nop
%b0:i1:unit = nop
j b1(0:i32, 0:i32)
block b1:
%b1:p0:i32:i
%b1:p1:i32:c
%b1:i0:unit = nop
%b1:i1:u1 = cmp lt %b1:p0:i32 10:i32
br %b1:i1:u1, b2(), b3()
block b2:
%b2:i0:unit = nop
%b2:i1:i32 = add %b1:p0:i32 1:i32
%b2:i2:unit = nop
%b2:i3:unit = nop
switch %b2:i1:i32 default b7() [
1:i32 b1(%b2:i1:i32, %b1:p1:i32)
]
block b3:
%b3:i0:unit = nop
ret %b1:p1:i32
block b7:
%b7:i0:unit = nop
%b7:i1:i32 = add %b1:p1:i32 1:i32
%b7:i2:unit = nop
j b1(%b2:i1:i32, %b7:i1:i32)
}

View File

@@ -0,0 +1,29 @@
fun i32 @main () {
init:
bid: b0
allocations:
block b0:
j b1(0:i32, 0:i32)
block b1:
%b1:p0:i32:i
%b1:p1:i32:c
%b1:i0:u1 = cmp lt %b1:p0:i32 10:i32
br %b1:i0:u1, b2(), b3()
block b2:
%b2:i0:i32 = add %b1:p0:i32 1:i32
switch %b2:i0:i32 default b7() [
1:i32 b1(%b2:i0:i32, %b1:p1:i32)
]
block b3:
ret %b1:p1:i32
block b7:
%b7:i0:i32 = add %b1:p1:i32 1:i32
j b1(%b2:i0:i32, %b7:i0:i32)
}

View File

@@ -0,0 +1,29 @@
fun i32 @main () {
init:
bid: b0
allocations:
block b0:
j b1(0:i32, 0:i32)
block b1:
%b1:p0:i32:i
%b1:p1:i32:c
%b1:i0:u1 = cmp lt %b1:p0:i32 10:i32
br %b1:i0:u1, b2(), b3()
block b2:
%b2:i0:i32 = add %b1:p0:i32 1:i32
switch %b2:i0:i32 default b7() [
1:i32 b1(%b2:i0:i32, %b1:p1:i32)
]
block b3:
ret %b1:p1:i32
block b7:
%b7:i0:i32 = add %b1:p1:i32 1:i32
j b1(%b2:i0:i32, %b7:i0:i32)
}

View File

@@ -0,0 +1,29 @@
fun i32 @main () {
init:
bid: b0
allocations:
block b0:
j b1(0:i32, 0:i32)
block b1:
%b1:p0:i32:i
%b1:p1:i32:c
%b1:i0:u1 = cmp lt %b1:p0:i32 10:i32
br %b1:i0:u1, b2(), b3()
block b2:
%b2:i0:i32 = add %b1:p0:i32 1:i32
switch %b2:i0:i32 default b7() [
1:i32 b1(%b2:i0:i32, %b1:p1:i32)
]
block b3:
ret %b1:p1:i32
block b7:
%b7:i0:i32 = add %b1:p1:i32 1:i32
j b1(%b2:i0:i32, %b7:i0:i32)
}

View File

@@ -1 +1 @@
1.67.1
1.78.0

42
scripts/grade-all.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Exit when any command fails.
set -e
# Run lints.
cargo fmt --all -- --check # run `cargo fmt` to auto-correct the code.
cargo clippy # run `cargo clippy --fix` to auto-correct the code.
# Run tests.
# write_c
echo "Run write_c"
RUST_MIN_STACK=33554432 cargo test --release test_examples_write_c -- --nocapture
RUST_MIN_STACK=33554432 python3 tests/fuzz.py --print -n80 --seed 22
# irgen
echo "Run irgen"
RUST_MIN_STACK=33554432 cargo test --release test_examples_irgen -- --nocapture
RUST_MIN_STACK=33554432 python3 tests/fuzz.py --irgen -n80 --seed 22
# simplify_cfg
echo "Run simplify_cfg"
RUST_MIN_STACK=33554432 cargo test --release test_examples_simplify_cfg -- --nocapture
# mem2reg
echo "Run mem2reg"
RUST_MIN_STACK=33554432 cargo test --release test_examples_mem2reg -- --nocapture
# gvn
echo "Run gvn"
RUST_MIN_STACK=33554432 cargo test --release test_examples_gvn -- --nocapture
# deadcode
echo "Run deadcode"
RUST_MIN_STACK=33554432 cargo test --release test_examples_deadcode -- --nocapture
# asmgen
echo "Run asmgen"
RUST_MIN_STACK=33554432 cargo test --release test_examples_asmgen -- --nocapture
echo "All tests successful"

View File

@@ -1064,7 +1064,7 @@ impl Byte {
izip!(fields, offsets).for_each(|(f, o)| {
let result = Self::value_to_bytes(f.deref(), structs);
let size_of_data = f.deref().dtype().size_align_of(structs).unwrap().0;
let _unused = values.splice(*o..(*o + size_of_data), result.into_iter());
let _unused = values.splice(*o..(*o + size_of_data), result);
});
values
@@ -1134,7 +1134,7 @@ impl Memory {
let block = self.inner[bid].as_mut().unwrap();
if 0 <= offset && end <= block.len() {
let _unused = block.splice(offset as usize..end, bytes.into_iter());
let _unused = block.splice(offset as usize..end, bytes);
Ok(())
} else {
Err(())

View File

@@ -57,7 +57,7 @@ impl Translate<TranslationUnit> for Visualizer {
}
}
let inner = vec![subgraphs, edges].concat().join("\n");
let inner = [subgraphs, edges].concat().join("\n");
Ok(format!("digraph G {{\n{inner}\n}}"))
}
@@ -176,7 +176,7 @@ impl Visualizer {
}
// TODO: Add init information (bid_init, allocations)
let inner = vec![subgraphs, vec![label], edges].concat().join("\n");
let inner = [subgraphs, vec![label], edges].concat().join("\n");
Ok(format!("subgraph \"cluster.{name}\" {{\n{inner}\n}}"))
}
@@ -208,7 +208,7 @@ impl Visualizer {
let edges = (0..block.instructions.len())
.map(|iid| self.translate_instruction_node(name, *bid, iid))
.chain([self.translate_block_exit_node(name, *bid)].into_iter())
.chain([self.translate_block_exit_node(name, *bid)])
.collect::<Vec<String>>()
.join(" -> ");
@@ -221,7 +221,7 @@ impl Visualizer {
.block_first_instruction
.insert((name.to_string(), *bid), first_instruction);
let inner = vec![header, nodes, vec![edges]].concat().join("\n");
let inner = [header, nodes, vec![edges]].concat().join("\n");
Ok(format!("subgraph \"cluster.{name}.{bid}\" {{\n{inner}\n}}"))
}

View File

@@ -635,7 +635,7 @@ impl IrgenFunc<'_> {
/// %b0:i1:unit = store %b0:p1:i32 %l1:i32*
/// %b0:i2:unit = store %b0:p2:i32 %l2:i32*
/// ```
///
///
/// In particular, note that it is added to the local allocation list and store them to the
/// initial phinodes.
///

View File

@@ -43,7 +43,6 @@
#![deny(unused_macro_rules)]
#![deny(unused_qualifications)]
#![deny(unused_results)]
#![deny(unused_tuple_struct_fields)]
// Allowed for more flexible variants.
// #![deny(variant_size_differences)]

View File

@@ -76,7 +76,7 @@ const SKIP_TEST: i32 = 102;
pub fn test_write_c(path: &Path) {
// Check if the file has .c extension
assert_eq!(path.extension(), Some(std::ffi::OsStr::new("c")));
let unit = c::Parse::default()
let unit = Parse
.translate(&path)
.unwrap_or_else(|_| panic!("parse failed {}", path.display()));
@@ -86,7 +86,7 @@ pub fn test_write_c(path: &Path) {
write(&unit, &mut temp_file).unwrap();
let new_unit = c::Parse::default()
let new_unit = Parse
.translate(&temp_file_path.as_path())
.expect("parse failed while parsing the output from implemented printer");
drop(temp_file);
@@ -98,7 +98,7 @@ pub fn test_write_c(path: &Path) {
pub fn test_irgen(path: &Path) {
// Check if the file has .c extension
assert_eq!(path.extension(), Some(std::ffi::OsStr::new("c")));
let unit = c::Parse::default()
let unit = Parse
.translate(&path)
.unwrap_or_else(|_| panic!("parse failed {}", path.display()));
@@ -194,12 +194,12 @@ pub fn test_irgen(path: &Path) {
pub fn test_irparse(path: &Path) {
// Check if the file has .c extension
assert_eq!(path.extension(), Some(std::ffi::OsStr::new("c")));
let unit = c::Parse::default()
let unit = Parse
.translate(&path)
.unwrap_or_else(|_| panic!("parse failed {}", path.display()));
// Test parse
let _unused = c::Parse::default()
let _unused = Parse
.translate(&path)
.expect("failed to parse the given program");
@@ -384,7 +384,7 @@ pub fn test_end_to_end(path: &Path) {
assert_eq!(path.extension(), Some(std::ffi::OsStr::new("c")));
// Test parse
let unit = c::Parse::default()
let unit = Parse
.translate(&path)
.unwrap_or_else(|_| panic!("parse failed {}", path.display()));