|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
INLINE float
|
|
|
|
|
get_f32(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(float *)address;
|
|
|
|
@ -16,7 +16,7 @@ get_f32(i32 offset)
|
|
|
|
|
INLINE double
|
|
|
|
|
get_f64(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(double *)address;
|
|
|
|
@ -25,7 +25,7 @@ get_f64(i32 offset)
|
|
|
|
|
INLINE i8
|
|
|
|
|
get_i8(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(i8 *)address;
|
|
|
|
@ -34,7 +34,7 @@ get_i8(i32 offset)
|
|
|
|
|
INLINE i16
|
|
|
|
|
get_i16(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(i16 *)address;
|
|
|
|
@ -43,7 +43,7 @@ get_i16(i32 offset)
|
|
|
|
|
INLINE i32
|
|
|
|
|
get_i32(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(i32 *)address;
|
|
|
|
@ -52,7 +52,7 @@ get_i32(i32 offset)
|
|
|
|
|
INLINE i64
|
|
|
|
|
get_i64(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(i64 *)address;
|
|
|
|
@ -61,7 +61,7 @@ get_i64(i32 offset)
|
|
|
|
|
INLINE i32
|
|
|
|
|
get_global_i32(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(i32 *)address;
|
|
|
|
@ -70,7 +70,7 @@ get_global_i32(i32 offset)
|
|
|
|
|
INLINE i64
|
|
|
|
|
get_global_i64(i32 offset)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
return *(i64 *)address;
|
|
|
|
@ -80,7 +80,7 @@ get_global_i64(i32 offset)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_f32(i32 offset, float v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(float *)address = v;
|
|
|
|
@ -89,7 +89,7 @@ set_f32(i32 offset, float v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_f64(i32 offset, double v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(double *)address = v;
|
|
|
|
@ -98,7 +98,7 @@ set_f64(i32 offset, double v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_i8(i32 offset, i8 v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(i8 *)address = v;
|
|
|
|
@ -107,7 +107,7 @@ set_i8(i32 offset, i8 v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_i16(i32 offset, i16 v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(i16 *)address = v;
|
|
|
|
@ -116,7 +116,7 @@ set_i16(i32 offset, i16 v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_i32(i32 offset, i32 v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(i32 *)address = v;
|
|
|
|
@ -125,7 +125,7 @@ set_i32(i32 offset, i32 v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_i64(i32 offset, i64 v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(i64 *)address = v;
|
|
|
|
@ -134,7 +134,7 @@ set_i64(i32 offset, i64 v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_global_i32(i32 offset, i32 v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(i32 *)address = v;
|
|
|
|
@ -143,7 +143,7 @@ set_global_i32(i32 offset, i32 v)
|
|
|
|
|
INLINE void
|
|
|
|
|
set_global_i64(i32 offset, i64 v)
|
|
|
|
|
{
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_member_cache.linear_memory_start;
|
|
|
|
|
char *mem_as_chars = (char *)local_sandbox_context_cache.linear_memory_start;
|
|
|
|
|
void *address = &mem_as_chars[offset];
|
|
|
|
|
|
|
|
|
|
*(i64 *)address = v;
|
|
|
|
@ -155,7 +155,7 @@ get_function_from_table(u32 idx, u32 type_id)
|
|
|
|
|
{
|
|
|
|
|
assert(idx < INDIRECT_TABLE_SIZE);
|
|
|
|
|
|
|
|
|
|
struct indirect_table_entry f = local_sandbox_member_cache.module_indirect_table[idx];
|
|
|
|
|
struct indirect_table_entry f = local_sandbox_context_cache.module_indirect_table[idx];
|
|
|
|
|
|
|
|
|
|
// assert(f.type_id == type_id);
|
|
|
|
|
assert(f.func_pointer);
|
|
|
|
|