Adding support for Machine Integer version of Bytes, List, and MInt functions#1209
Conversation
56451cf to
8482578
Compare
…d MInt{64}
Implementing `hook_MINT_pow256` in LLVM IR
Implementing `hook_MINT_pow64` in int.cpp
Adding `mint-pow` unit test
Implementing `hook_MINT_MInt2Bytes` in LLVM IR Adding `mint2bytes` unit test
Implementing `hook_MINT_Bytes2MInt` in LLVM IR Adding `bytes2mint` unit test
…} and MInt{64}
Implementing `hook_BYTES_length256` in LLVM IR
Implementing `hook_BYTES_length64` in bytes.cpp
Adding `lengthbytes` unit test
…56} and MInt{64}
Implementing `hook_BYTES_padRight256` in LLVM IR
Implementing `hook_BYTES_padRight64` in bytes.cpp
Adding `padrightbytes` unit test
…6} and MInt{64}
Implementing `hook_BYTES_padLeft256` in LLVM IR
Implementing `hook_BYTES_padLeft64` in bytes.cpp
Adding `padleftbytes` unit test
…256} and MInt{64}
Implementing `hook_BYTES_replaceAt256` in LLVM IR
Implementing `hook_BYTES_replaceAt64` in bytes.cpp
Adding `replaceatbytes` unit test
Declaring functions needed by other functions in the `llvm_hearder.inc`
Defining `interger_overflow` used in used in `hook_BYTES_pad*` functions in `llvm_hearder.inc`
…} and MInt{64}
Implementing `hook_BYTES_substr256` in LLVM IR
Implementing `hook_BYTES_substr64` in bytes.cpp
Adding `substrbytes` unit test
…nd MInt{64}
Implementing `hook_BYTES_get256` in LLVM IR
Implementing `hook_BYTES_get64` in bytes.cpp
Adding `bytes-get` unit test
…} and MInt{64}
Implementing `hook_BYTES_update256` in LLVM IR
Implementing `hook_BYTES_update64` in bytes.cpp
Adding `bytes-update` unit test
…nd MInt{64}
Implementing `hook_LIST_size256` in LLVM IR
Implementing `hook_LIST_size64` in bytes.cpp
Adding `list-size` unit test
Implementing `hook_LIST_get64` in bytes.cpp Adding `list-get` unit test
…64} only Adding `list-update` unit test
d1d5580 to
d7efaf7
Compare
dwightguth
left a comment
There was a problem hiding this comment.
I'd suggest considering the following two factors regarding the hooks added:
- Is there a particularly compelling reason why both arguments of hooks with more than one mint arg need to have the same size?
- If a mint arg or return value carresponds to a size in bytes or in elements of something in memory, you should be able to use a non parametric mint 64 for it.
None of this is absolutely necessary but if we're adding hooks to the frontend we ought to think about this.
| return list->size(); | ||
| } | ||
|
|
||
| uint64_t hook_LIST_size64(SortList list) { |
There was a problem hiding this comment.
hook_list_size_long already does this. Check for other similar duplicates that may exist.
There was a problem hiding this comment.
But it can return a 32-bit in 32-bit machines, right? As in CreateTerm.cpp, we set this return type fixed in i64; wouldn't it be better to be sure we're always returning the correct type?
Not necessarily, but that's how we defined it in the frontend. We also haven't reached the need to use 2 different bit sizes as well.
I agree, and it makes sense, but it will enforce a Also, @dwightguth, do you have any comments on how I can have:
|
There was a problem hiding this comment.
Thank you @Robertorosmaninho. I added only two minor comments.
bb5318b
into
develop
This PR introduces the concrete implementation of the following new Machine Integer hooks:
Most of these hooks have an initial implementation for
64and256-bitIntegers, being the former defined in C++ in its respective collection file while the latter is defined in thellvm_header.incfile, as C++ doesn't support 256-bit integer natively.The only exceptions for now are 12 and 13, which are only implemented for 64-bit, as we have the
immerlimitation that the index should be ain64_t.