-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Number
often uses to_u1024_bytes
for bitwise/arithmetic operations, but u1024 has 128bytes while Number
is up to 1024bytes
#88
Comments
to_u1024_bytes
, but the input could be r2048
/r4096
/r8192
to_u1024_bytes
on Number
, but u1024 has 128bytes while Number
is at most 1024bytes
to_u1024_bytes
on Number
, but u1024 has 128bytes while Number
is at most 1024bytesNumber
often uses to_u1024_bytes
for bitwise/arithmetic operations, but u1024 has 128bytes while Number
is at most 1024bytes
Number
often uses to_u1024_bytes
for bitwise/arithmetic operations, but u1024 has 128bytes while Number
is at most 1024bytesNumber
often uses to_u1024_bytes
for bitwise/arithmetic operations, but u1024 has 128bytes while Number
is up to 1024bytes
e.g. |
It is true, but it is just a sideffect. The only solution to this is to have a different Number types for A and R registers. There is no point in SHL/SHR and other arithmetic operations for R register since they are used to represent hashes/curve points and can't be operated with normal arithmetics. |
Unlike bitwise operations like SHL/SHR, arithmetic operation does not exist for R register. Instead of introducing another |
because it is relatively easier to perform bitwise operations on a byte array, than arithmetic operations |
I think this is a very good idea! |
The change is quite complex: it requires changing multiple APIs which abstract a specific register type and allow to operate with any A, R or F register providing The change is also an API-breaking |
We we need to do is to change CoreRegs::get so that it accepts |
Agree, that is the best way forward. Can you work on that please? |
Do we stop using |
It's ok to have API breaking changes - the bytecode breakes (or business logic in instruction execution) is much much worse. I think your proposal is a good solution. |
Hi, hasn't been active for a while. I am facing a challenge regarding with the solution above. Taking MoveOp::MovR(reg, idx1, idx2) => {
regs.get_r_mut(*reg, idx2).copy_from_slice(regs.get_r(*reg, idx1));
} This will not compile because it borrows |
I think we just need to clone the result of |
A heap allocation is inevitable when cloning a slice. I thought we should ensure that a program would run without any memory allocation except at VM startup time, are we ok with that? |
The point was to avoid large memory allocations which may affect low-end hardware (like 64kB+ etc). Even now AluVM does a lot of allocations of a smaller size. |
I mean it would be great to avoid any allocations runtime, but I think this is the larger goal than the scope of this issue and it will require more refactoring, so should be left for the future. |
Fulfilled with v0.12 |
https://github.com/AluVM/rust-aluvm/blob/2bde05b47e10fc0a06eb12c868a14dbeff1551ec/src/data/bitwise.rs#L50-L57
https://github.com/AluVM/rust-aluvm/blob/97bd8e7c3e95093a9bf5960b82775f39df3ebeed/src/data/arithm.rs#L128-L133
The text was updated successfully, but these errors were encountered: