-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler-v2] Showcase fixes for several old issues
- Loading branch information
Showing
11 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
third_party/move/move-compiler-v2/tests/file-format-generator/issue_12404.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v8 | ||
module c0ffee.m { | ||
|
||
|
||
public test(): u64 /* def_idx: 0 */ { | ||
B0: | ||
0: LdU64(2) | ||
1: Call test1(u64): u64 | ||
2: LdU64(5) | ||
3: Call test2(u64): u64 | ||
4: Add | ||
5: Ret | ||
} | ||
test1(Arg0: u64): u64 /* def_idx: 1 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: u64) | ||
1: LdU64(1) | ||
2: Add | ||
3: Ret | ||
} | ||
test2(Arg0: u64): u64 /* def_idx: 2 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: u64) | ||
1: LdU64(2) | ||
2: Add | ||
3: Ret | ||
} | ||
} | ||
============ bytecode verification succeeded ======== |
14 changes: 14 additions & 0 deletions
14
third_party/move/move-compiler-v2/tests/file-format-generator/issue_12404.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Example taken from https://github.com/aptos-labs/aptos-core/issues/12404#issuecomment-2004040746 | ||
module 0xc0ffee::m { | ||
fun test1(x: u64): u64 { | ||
x + 1 | ||
} | ||
|
||
fun test2(x: u64): u64 { | ||
x + 2 | ||
} | ||
|
||
public fun test(): u64 { | ||
test1(2) + test2(5) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
third_party/move/move-compiler-v2/tests/file-format-generator/issue_12404.opt.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v8 | ||
module c0ffee.m { | ||
|
||
|
||
public test(): u64 /* def_idx: 0 */ { | ||
B0: | ||
0: LdU64(2) | ||
1: Call test1(u64): u64 | ||
2: LdU64(5) | ||
3: Call test2(u64): u64 | ||
4: Add | ||
5: Ret | ||
} | ||
test1(Arg0: u64): u64 /* def_idx: 1 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: u64) | ||
1: LdU64(1) | ||
2: Add | ||
3: Ret | ||
} | ||
test2(Arg0: u64): u64 /* def_idx: 2 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: u64) | ||
1: LdU64(2) | ||
2: Add | ||
3: Ret | ||
} | ||
} | ||
============ bytecode verification succeeded ======== |
31 changes: 31 additions & 0 deletions
31
third_party/move/move-compiler-v2/tests/file-format-generator/issue_12540.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v8 | ||
module c0ffee.m { | ||
|
||
|
||
public point_add_assign(Arg0: &mut u64, Arg1: &u64): &mut u64 /* def_idx: 0 */ { | ||
L2: loc0: &mut u64 | ||
B0: | ||
0: CopyLoc[0](Arg0: &mut u64) | ||
1: FreezeRef | ||
2: MoveLoc[1](Arg1: &u64) | ||
3: LdTrue | ||
4: Call point_add_internal(&u64, &u64, bool): u64 | ||
5: MoveLoc[0](Arg0: &mut u64) | ||
6: StLoc[2](loc0: &mut u64) | ||
7: Pop | ||
8: MoveLoc[2](loc0: &mut u64) | ||
9: Ret | ||
} | ||
point_add_internal(Arg0: &u64, Arg1: &u64, Arg2: bool): u64 /* def_idx: 1 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: &u64) | ||
1: ReadRef | ||
2: MoveLoc[1](Arg1: &u64) | ||
3: ReadRef | ||
4: Add | ||
5: Ret | ||
} | ||
} | ||
============ bytecode verification succeeded ======== |
11 changes: 11 additions & 0 deletions
11
third_party/move/move-compiler-v2/tests/file-format-generator/issue_12540.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Code example taken from https://github.com/aptos-labs/aptos-core/issues/12540 | ||
module 0xc0ffee::m { | ||
fun point_add_internal(a: &u64, b: &u64, _in_place: bool): u64 { | ||
*a + *b | ||
} | ||
|
||
public fun point_add_assign(a: &mut u64, b: &u64): &mut u64 { | ||
point_add_internal(a, b, true); | ||
a | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
third_party/move/move-compiler-v2/tests/file-format-generator/issue_12540.opt.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v8 | ||
module c0ffee.m { | ||
|
||
|
||
public point_add_assign(Arg0: &mut u64, Arg1: &u64): &mut u64 /* def_idx: 0 */ { | ||
B0: | ||
0: CopyLoc[0](Arg0: &mut u64) | ||
1: FreezeRef | ||
2: MoveLoc[1](Arg1: &u64) | ||
3: LdTrue | ||
4: Call point_add_internal(&u64, &u64, bool): u64 | ||
5: Pop | ||
6: MoveLoc[0](Arg0: &mut u64) | ||
7: Ret | ||
} | ||
point_add_internal(Arg0: &u64, Arg1: &u64, Arg2: bool): u64 /* def_idx: 1 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: &u64) | ||
1: ReadRef | ||
2: MoveLoc[1](Arg1: &u64) | ||
3: ReadRef | ||
4: Add | ||
5: Ret | ||
} | ||
} | ||
============ bytecode verification succeeded ======== |
30 changes: 30 additions & 0 deletions
30
third_party/move/move-compiler-v2/tests/file-format-generator/issue_14243.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v8 | ||
module c0ffee.m { | ||
|
||
|
||
id_mut<Ty0>(Arg0: &mut Ty0): &mut Ty0 /* def_idx: 0 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: &mut Ty0) | ||
1: Ret | ||
} | ||
t0() /* def_idx: 1 */ { | ||
L0: loc0: u64 | ||
L1: loc1: &mut u64 | ||
B0: | ||
0: LdU64(0) | ||
1: StLoc[0](loc0: u64) | ||
2: MutBorrowLoc[0](loc0: u64) | ||
3: StLoc[1](loc1: &mut u64) | ||
4: CopyLoc[1](loc1: &mut u64) | ||
5: Call id_mut<u64>(&mut u64): &mut u64 | ||
6: ReadRef | ||
7: MoveLoc[1](loc1: &mut u64) | ||
8: ReadRef | ||
9: Pop | ||
10: Pop | ||
11: Ret | ||
} | ||
} | ||
============ bytecode verification succeeded ======== |
13 changes: 13 additions & 0 deletions
13
third_party/move/move-compiler-v2/tests/file-format-generator/issue_14243.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Example taken from https://github.com/aptos-labs/aptos-core/issues/14243 | ||
module 0xc0ffee::m { | ||
fun id_mut<T>(r: &mut T): &mut T { | ||
r | ||
} | ||
|
||
fun t0() { | ||
let x = &mut 0; | ||
let y = id_mut(x); | ||
*y; | ||
*x; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
third_party/move/move-compiler-v2/tests/file-format-generator/issue_14243.opt.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v8 | ||
module c0ffee.m { | ||
|
||
|
||
id_mut<Ty0>(Arg0: &mut Ty0): &mut Ty0 /* def_idx: 0 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: &mut Ty0) | ||
1: Ret | ||
} | ||
t0() /* def_idx: 1 */ { | ||
L0: loc0: u64 | ||
L1: loc1: &mut u64 | ||
B0: | ||
0: LdU64(0) | ||
1: StLoc[0](loc0: u64) | ||
2: MutBorrowLoc[0](loc0: u64) | ||
3: StLoc[1](loc1: &mut u64) | ||
4: CopyLoc[1](loc1: &mut u64) | ||
5: Call id_mut<u64>(&mut u64): &mut u64 | ||
6: ReadRef | ||
7: Pop | ||
8: MoveLoc[1](loc1: &mut u64) | ||
9: ReadRef | ||
10: Pop | ||
11: Ret | ||
} | ||
} | ||
============ bytecode verification succeeded ======== |
14 changes: 14 additions & 0 deletions
14
third_party/move/move-compiler-v2/transactional-tests/tests/misc/issue_11022.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
comparison between v1 and v2 failed: | ||
- processed 2 tasks | ||
- | ||
- task 1 'publish'. lines 11-16: | ||
- Error: bug[ICE12001]: BYTECODE GENERATION FAILED | ||
- ┌─ TEMPFILE1:12:18 | ||
- │ | ||
- 12 │ module 0xc0ffee::dummy2 { | ||
- │ ^^^^^^ IR ERROR: Missing constant definition for CC | ||
- | ||
- | ||
- | ||
+ processed 2 tasks | ||
+ |
16 changes: 16 additions & 0 deletions
16
third_party/move/move-compiler-v2/transactional-tests/tests/misc/issue_11022.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Example taken from https://github.com/aptos-labs/aptos-core/issues/11022 | ||
//# publish | ||
module 0xc0ffee::dummy1 { | ||
const CC: u64 = 1; | ||
|
||
public inline fun expose(): u64 { | ||
CC | ||
} | ||
} | ||
|
||
//# publish | ||
module 0xc0ffee::dummy2 { | ||
public fun main(): u64 { | ||
0xc0ffee::dummy1::expose() | ||
} | ||
} |