mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 08:13:11 +00:00
Switch a few uses of current-context memory to kernel memory
E.g. make sure the RLP segment is only used with the kernel context. Using current-context memory would also work, we just need to be consistent. For transaction parsing etc, the context should be 0 anyway, but explicitly referring to kernel memory feels more idiomatic to me.
This commit is contained in:
parent
2aeb8c92c7
commit
a8e30b0ca0
@ -132,7 +132,7 @@ pubkey_to_addr:
|
|||||||
// stack: PKx, PKy, retdest
|
// stack: PKx, PKy, retdest
|
||||||
PUSH 0
|
PUSH 0
|
||||||
// stack: 0, PKx, PKy, retdest
|
// stack: 0, PKx, PKy, retdest
|
||||||
MSTORE // TODO: switch to kernel memory (like `%mstore_current(@SEGMENT_KERNEL_GENERAL)`).
|
MSTORE // TODO: switch to kernel memory (like `%mstore_kernel(@SEGMENT_KERNEL_GENERAL)`).
|
||||||
// stack: PKy, retdest
|
// stack: PKy, retdest
|
||||||
PUSH 0x20
|
PUSH 0x20
|
||||||
// stack: 0x20, PKy, retdest
|
// stack: 0x20, PKy, retdest
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
global decode_rlp_string_len:
|
global decode_rlp_string_len:
|
||||||
// stack: pos, retdest
|
// stack: pos, retdest
|
||||||
DUP1
|
DUP1
|
||||||
%mload_current(@SEGMENT_RLP_RAW)
|
%mload_kernel(@SEGMENT_RLP_RAW)
|
||||||
// stack: first_byte, pos, retdest
|
// stack: first_byte, pos, retdest
|
||||||
DUP1
|
DUP1
|
||||||
%gt_const(0xb7)
|
%gt_const(0xb7)
|
||||||
@ -89,7 +89,7 @@ global decode_rlp_scalar:
|
|||||||
global decode_rlp_list_len:
|
global decode_rlp_list_len:
|
||||||
// stack: pos, retdest
|
// stack: pos, retdest
|
||||||
DUP1
|
DUP1
|
||||||
%mload_current(@SEGMENT_RLP_RAW)
|
%mload_kernel(@SEGMENT_RLP_RAW)
|
||||||
// stack: first_byte, pos, retdest
|
// stack: first_byte, pos, retdest
|
||||||
SWAP1
|
SWAP1
|
||||||
%increment // increment pos
|
%increment // increment pos
|
||||||
@ -151,7 +151,7 @@ decode_int_given_len_loop:
|
|||||||
// stack: acc << 8, pos, end_pos, retdest
|
// stack: acc << 8, pos, end_pos, retdest
|
||||||
DUP2
|
DUP2
|
||||||
// stack: pos, acc << 8, pos, end_pos, retdest
|
// stack: pos, acc << 8, pos, end_pos, retdest
|
||||||
%mload_current(@SEGMENT_RLP_RAW)
|
%mload_kernel(@SEGMENT_RLP_RAW)
|
||||||
// stack: byte, acc << 8, pos, end_pos, retdest
|
// stack: byte, acc << 8, pos, end_pos, retdest
|
||||||
ADD
|
ADD
|
||||||
// stack: acc', pos, end_pos, retdest
|
// stack: acc', pos, end_pos, retdest
|
||||||
|
|||||||
@ -23,7 +23,7 @@ read_rlp_to_memory_loop:
|
|||||||
// stack: byte, pos, len, retdest
|
// stack: byte, pos, len, retdest
|
||||||
DUP2
|
DUP2
|
||||||
// stack: pos, byte, pos, len, retdest
|
// stack: pos, byte, pos, len, retdest
|
||||||
%mstore_current(@SEGMENT_RLP_RAW)
|
%mstore_kernel(@SEGMENT_RLP_RAW)
|
||||||
// stack: pos, len, retdest
|
// stack: pos, len, retdest
|
||||||
%increment
|
%increment
|
||||||
// stack: pos', len, retdest
|
// stack: pos', len, retdest
|
||||||
|
|||||||
@ -18,14 +18,14 @@ read_txn_from_memory:
|
|||||||
// first byte >= 0xc0, so there is no overlap.
|
// first byte >= 0xc0, so there is no overlap.
|
||||||
|
|
||||||
PUSH 0
|
PUSH 0
|
||||||
%mload_current(@SEGMENT_RLP_RAW)
|
%mload_kernel(@SEGMENT_RLP_RAW)
|
||||||
%eq_const(1)
|
%eq_const(1)
|
||||||
// stack: first_byte == 1, retdest
|
// stack: first_byte == 1, retdest
|
||||||
%jumpi(process_type_1_txn)
|
%jumpi(process_type_1_txn)
|
||||||
// stack: retdest
|
// stack: retdest
|
||||||
|
|
||||||
PUSH 0
|
PUSH 0
|
||||||
%mload_current(@SEGMENT_RLP_RAW)
|
%mload_kernel(@SEGMENT_RLP_RAW)
|
||||||
%eq_const(2)
|
%eq_const(2)
|
||||||
// stack: first_byte == 2, retdest
|
// stack: first_byte == 2, retdest
|
||||||
%jumpi(process_type_2_txn)
|
%jumpi(process_type_2_txn)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user