Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler fails while translating Constant::Vector #49

Open
jcivlin opened this issue May 29, 2024 · 0 comments
Open

Compiler fails while translating Constant::Vector #49

jcivlin opened this issue May 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jcivlin
Copy link
Collaborator

jcivlin commented May 29, 2024

In this function fn constant(&self, mc: &sbc::Constant, vec_mty: Option<&mty::Type>) -> llvm::Constant we hit this condition:

                let aval = match elt_mty {
                    _ if elt_mty.is_number() || elt_mty.is_bool() => {
                        let vals = self.rewrap_vec_constant(val_vec);
                        llcx.const_array(&vals, self.module_cx.to_llvm_type(&elt_mty, &[]).unwrap())
                    }
                    Type::Vector(bt) if bt.is_number_u8() => {
                        // This is a Constant::ByteArray element type.
                        assert!(matches!(val_vec[0], Constant::ByteArray(_)));
                        todo!("{:?}", mc);
                    }

To reproduce compile Move provided example:

 /home/sol/work/git/sui-solana-032024/external-crates/move/target/debug/move-mv-llvm-compiler -c tests/flash_lender_tests.move -p /home/sol/work/git/sui-solana-032024/sui_programmability/examples/defi/Move.toml --test -o ~/tmp/defi

Notice that some modules will be built:

sol@dev-equinix-new-york-2:~/work/git/sui-solana-032024/sui_programmability/examples/defi:solana $% u+6$ ll ~/tmp/defi/
total 40
drwxr-xr-x  2 sol users  4096 May 29 01:26 ./
drwxr-xr-x 42 sol users  4096 May 29 01:26 ../
-rw-r--r--  1 sol users  2520 May 29 01:26 0x1__bcs.ll
-rw-r--r--  1 sol users  2536 May 29 01:26 0x1__unit_test.ll
-rw-r--r--  1 sol users  3036 May 29 01:26 0x1__vector.ll
-rw-r--r--  1 sol users 10992 May 29 01:26 0x2__tx_context.ll
-rw-r--r--  1 sol users  5167 May 29 01:26 solana_entrypoint.ll
@jcivlin jcivlin added the bug Something isn't working label May 29, 2024
@jcivlin jcivlin self-assigned this May 29, 2024
@jcivlin jcivlin mentioned this issue May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant