EVM-C: Replace evm_result payload with 24 bytes union

This commit is contained in:
Paweł Bylica 2017-05-29 16:24:56 +02:00
parent cb90d9f35c
commit 497f92bcb8
2 changed files with 13 additions and 7 deletions

View File

@ -94,7 +94,6 @@ static struct evm_result execute(struct evm_instance* instance,
ret.output_data = output_data; ret.output_data = output_data;
ret.output_size = address_size; ret.output_size = address_size;
ret.release = &free_result_output_data; ret.release = &free_result_output_data;
ret.payload.pointer = NULL; // We don't need another pointer.
return ret; return ret;
} }
else if (code_size == strlen(counter) && else if (code_size == strlen(counter) &&

View File

@ -170,12 +170,19 @@ struct evm_result {
/// function to the result itself allows EVM composition. /// function to the result itself allows EVM composition.
evm_release_result_fn release; evm_release_result_fn release;
/// Reserved data to be optionally used by implementations. /// Reserved data that MAY be used by a evm_result object creator.
union { ///
uint8_t bytes[24]; /// This reserved 24 bytes extends the size of the evm_result to 64 bytes
struct evm_uint160be address; /// (full cache line).
void* pointer; /// An EVM implementation MAY use this memory to keep additional data
} payload; /// when returning result from ::evm_execute_fn.
/// The host application MAY use this memory to keep additional data
/// when returning result of performed calls from ::evm_call_fn.
union
{
void* context; ///< A pointer for storing external objects.
uint8_t data[24]; ///< 24 bytes of reserved data.
} reserved;
}; };
/// The query callback key. /// The query callback key.