Skip to content

Commit a879ffb

Browse files
authored
Add bldd case to Op::parse_opcode() (#6957)
## Description The `bldd` opcode was not covered in the `Op::parse_opcode()` which resulted in `Unknown opcode: "bldd"` error. The remaining part of the `bldd` opcode integration chain is already implemented in #6254. ## Checklist - [x] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
1 parent f871a48 commit a879ffb

File tree

16 files changed

+45
-29
lines changed

16 files changed

+45
-29
lines changed

sway-core/src/asm_lang/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ impl Op {
596596
let (r1, r2, r3, i0) = three_regs_imm_06(handler, args, immediate, whole_op_span)?;
597597
VirtualOp::LDC(r1, r2, r3, i0)
598598
}
599+
"bldd" => {
600+
let (r1, r2, r3, r4) = four_regs(handler, args, immediate, whole_op_span)?;
601+
VirtualOp::BLDD(r1, r2, r3, r4)
602+
}
599603
"log" => {
600604
let (r1, r2, r3, r4) = four_regs(handler, args, immediate, whole_op_span)?;
601605
VirtualOp::LOG(r1, r2, r3, r4)

test/src/e2e_vm_tests/test_programs/should_pass/ecall/ecall_basic/Forc.lock

-8
This file was deleted.

test/src/e2e_vm_tests/test_programs/should_pass/ecall/ecall_basic/test.toml

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[package]]
2+
name = "bldd"
3+
source = "member"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[project]
2+
authors = ["Fuel Labs <contact@fuel.sh>"]
3+
license = "Apache-2.0"
4+
name = "bldd"
5+
entry = "main.sw"
6+
implicit-std = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
library;
2+
3+
// Intentionally not using `b256::zero()` to avoid dependency to `core`.
4+
const B256_ZERO: b256 = 0x0000000000000000000000000000000000000000000000000000000000000000;
5+
6+
pub fn main() {
7+
asm(r1: B256_ZERO, r2: B256_ZERO, r3: 42u64, r4: 21u64) {
8+
bldd r1 r2 r3 r4;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
category = "compile"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[package]]
2+
name = "ecall"
3+
source = "member"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[project]
2+
authors = ["Fuel Labs <contact@fuel.sh>"]
3+
license = "Apache-2.0"
4+
name = "ecall"
5+
entry = "main.sw"
6+
implicit-std = false

test/src/e2e_vm_tests/test_programs/should_pass/ecall/ecall_basic/src/main.sw test/src/e2e_vm_tests/test_programs/should_pass/language/asm/instructions/ecall/src/main.sw

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
script;
1+
library;
22

3-
fn main() {
3+
pub fn main() {
44
asm(r1: 1u64, r2: 2u32, r3: 3u32, r4: 4u32) {
55
ecal r1 r2 r3 r4;
66
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
category = "compile"
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
[[package]]
2-
name = "asm_wqxx_instructions"
3-
source = "member"
4-
dependencies = ["std"]
5-
61
[[package]]
72
name = "core"
8-
source = "path+from-root-DEA77F133437397D"
3+
source = "path+from-root-6CA79EAC12B0D10A"
94

105
[[package]]
116
name = "std"
12-
source = "path+from-root-DEA77F133437397D"
7+
source = "path+from-root-6CA79EAC12B0D10A"
138
dependencies = ["core"]
9+
10+
[[package]]
11+
name = "wqxx"
12+
source = "member"
13+
dependencies = ["std"]
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[project]
2-
name = "ecall_basic"
32
authors = ["Fuel Labs <contact@fuel.sh>"]
43
entry = "main.sw"
5-
implicit-std = false
64
license = "Apache-2.0"
5+
name = "wqxx"
76

87
[dependencies]
9-
core = { path = "../../../../../../../sway-lib-core" }
8+
std = { path = "../../../../../../reduced_std_libs/sway-lib-std-assert" }

test/src/e2e_vm_tests/test_programs/should_pass/language/asm_wqxx_instructions/Forc.toml

-8
This file was deleted.

0 commit comments

Comments
 (0)