From 4bb60281640dd084b04ee00330c947bfbb9fe3e6 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 6 Aug 2020 21:41:46 -0700 Subject: [PATCH] Changing size values to iree_host_size_t (size_t). --- iree/base/api.h | 4 ++ iree/vm/bytecode_dispatch.c | 10 ++--- iree/vm/bytecode_dispatch_util.h | 44 ++++++++++----------- iree/vm/bytecode_module.c | 65 ++++++++++++++------------------ iree/vm/bytecode_module_impl.h | 10 ++--- iree/vm/module.c | 5 ++- iree/vm/module.h | 26 +++++++------ iree/vm/module_abi_cc.h | 13 +++---- 8 files changed, 88 insertions(+), 89 deletions(-) diff --git a/iree/base/api.h b/iree/base/api.h index cf730399d4bb..e618d9b0847d 100644 --- a/iree/base/api.h +++ b/iree/base/api.h @@ -217,6 +217,10 @@ typedef uint64_t iree_device_size_t; // Whole length of the underlying buffer. #define IREE_WHOLE_BUFFER (iree_device_size_t(-1)) +//===----------------------------------------------------------------------===// +// Byte buffers and memory utilities +//===----------------------------------------------------------------------===// + // A span of mutable bytes (ala std::span of uint8_t). typedef struct { uint8_t* data; diff --git a/iree/vm/bytecode_dispatch.c b/iree/vm/bytecode_dispatch.c index 531b4d513038..974ecb201e38 100644 --- a/iree/vm/bytecode_dispatch.c +++ b/iree/vm/bytecode_dispatch.c @@ -154,7 +154,7 @@ iree_status_t iree_vm_bytecode_dispatch( if (global < 0 || global >= module_state->global_ref_count) { return iree_make_status( IREE_STATUS_OUT_OF_RANGE, - "global ref ordinal out of range: %d (table=%d)", global, + "global ref ordinal out of range: %d (table=%zu)", global, module_state->global_ref_count); } const iree_vm_type_def_t* type_def = VM_DecTypeOf("value"); @@ -170,7 +170,7 @@ iree_status_t iree_vm_bytecode_dispatch( if (global < 0 || global >= module_state->global_ref_count) { return iree_make_status( IREE_STATUS_OUT_OF_RANGE, - "global ref ordinal out of range: %d (table=%d)", global, + "global ref ordinal out of range: %d (table=%zu)", global, module_state->global_ref_count); } const iree_vm_type_def_t* type_def = VM_DecTypeOf("value"); @@ -186,7 +186,7 @@ iree_status_t iree_vm_bytecode_dispatch( if (global < 0 || global >= module_state->global_ref_count) { return iree_make_status( IREE_STATUS_OUT_OF_RANGE, - "global ref ordinal out of range: %d (table=%d)", global, + "global ref ordinal out of range: %d (table=%zu)", global, module_state->global_ref_count); } const iree_vm_type_def_t* type_def = VM_DecTypeOf("value"); @@ -202,7 +202,7 @@ iree_status_t iree_vm_bytecode_dispatch( if (global < 0 || global >= module_state->global_ref_count) { return iree_make_status( IREE_STATUS_OUT_OF_RANGE, - "global ref ordinal out of range: %d (table=%d)", global, + "global ref ordinal out of range: %d (table=%zu)", global, module_state->global_ref_count); } const iree_vm_type_def_t* type_def = VM_DecTypeOf("value"); @@ -240,7 +240,7 @@ iree_status_t iree_vm_bytecode_dispatch( rodata_ordinal >= module_state->rodata_ref_count) { return iree_make_status( IREE_STATUS_OUT_OF_RANGE, - "rodata ref ordinal out of range: %d (table=%d)", rodata_ordinal, + "rodata ref ordinal out of range: %d (table=%zu)", rodata_ordinal, module_state->rodata_ref_count); } bool result_is_move; diff --git a/iree/vm/bytecode_dispatch_util.h b/iree/vm/bytecode_dispatch_util.h index c9ca964b5d81..b944ec9ab4a3 100644 --- a/iree/vm/bytecode_dispatch_util.h +++ b/iree/vm/bytecode_dispatch_util.h @@ -94,29 +94,29 @@ static const int kRegSize = sizeof(uint16_t); // Bytecode data access macros for reading values of a given type from a byte // offset within the current function. #if defined(IREE_IS_LITTLE_ENDIAN) -#define OP_I8(i) bytecode_data[pc + i] -#define OP_I16(i) *((uint16_t*)&bytecode_data[pc + i]) -#define OP_I32(i) *((uint32_t*)&bytecode_data[pc + i]) -#define OP_I64(i) *((uint64_t*)&bytecode_data[pc + i]) +#define OP_I8(i) bytecode_data[pc + (i)] +#define OP_I16(i) *((uint16_t*)&bytecode_data[pc + (i)]) +#define OP_I32(i) *((uint32_t*)&bytecode_data[pc + (i)]) +#define OP_I64(i) *((uint64_t*)&bytecode_data[pc + (i)]) #else -#define OP_I8(i) bytecode_data[pc + i] -#define OP_I16(i) \ - ((uint16_t)bytecode_data[pc + 0 + i]) | \ - ((uint16_t)bytecode_data[pc + 1 + i] << 8) -#define OP_I32(i) \ - ((uint32_t)bytecode_data[pc + 0 + i]) | \ - ((uint32_t)bytecode_data[pc + 1 + i] << 8) | \ - ((uint32_t)bytecode_data[pc + 2 + i] << 16) | \ - ((uint32_t)bytecode_data[pc + 3 + i] << 24) -#define OP_I64(i) \ - ((uint64_t)bytecode_data[pc + 0 + i]) | \ - ((uint64_t)bytecode_data[pc + 1 + i] << 8) | \ - ((uint64_t)bytecode_data[pc + 2 + i] << 16) | \ - ((uint64_t)bytecode_data[pc + 3 + i] << 24) | \ - ((uint64_t)bytecode_data[pc + 4 + i] << 32) | \ - ((uint64_t)bytecode_data[pc + 5 + i] << 40) | \ - ((uint64_t)bytecode_data[pc + 6 + i] << 48) | \ - ((uint64_t)bytecode_data[pc + 7 + i] << 56) +#define OP_I8(i) bytecode_data[pc + (i)] +#define OP_I16(i) \ + ((uint16_t)bytecode_data[pc + 0 + (i)]) | \ + ((uint16_t)bytecode_data[pc + 1 + (i)] << 8) +#define OP_I32(i) \ + ((uint32_t)bytecode_data[pc + 0 + (i)]) | \ + ((uint32_t)bytecode_data[pc + 1 + (i)] << 8) | \ + ((uint32_t)bytecode_data[pc + 2 + (i)] << 16) | \ + ((uint32_t)bytecode_data[pc + 3 + (i)] << 24) +#define OP_I64(i) \ + ((uint64_t)bytecode_data[pc + 0 + (i)]) | \ + ((uint64_t)bytecode_data[pc + 1 + (i)] << 8) | \ + ((uint64_t)bytecode_data[pc + 2 + (i)] << 16) | \ + ((uint64_t)bytecode_data[pc + 3 + (i)] << 24) | \ + ((uint64_t)bytecode_data[pc + 4 + (i)] << 32) | \ + ((uint64_t)bytecode_data[pc + 5 + (i)] << 40) | \ + ((uint64_t)bytecode_data[pc + 6 + (i)] << 48) | \ + ((uint64_t)bytecode_data[pc + 7 + (i)] << 56) #endif // IREE_IS_LITTLE_ENDIAN //===----------------------------------------------------------------------===// diff --git a/iree/vm/bytecode_module.c b/iree/vm/bytecode_module.c index 1013ae1cdc26..b5ff44bb8407 100644 --- a/iree/vm/bytecode_module.c +++ b/iree/vm/bytecode_module.c @@ -195,14 +195,13 @@ static iree_status_t iree_vm_bytecode_module_flatbuffer_verify( return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, "exports[%zu] missing signature", i); } - int32_t internal_ordinal = + iree_host_size_t internal_ordinal = iree_vm_ExportFunctionDef_internal_ordinal(export_def); - if (internal_ordinal < 0 || - internal_ordinal >= - iree_vm_InternalFunctionDef_vec_len(internal_functions)) { + if (internal_ordinal >= + iree_vm_InternalFunctionDef_vec_len(internal_functions)) { return iree_make_status( IREE_STATUS_INVALID_ARGUMENT, - "exports[%zu] internal_ordinal out of bounds (0 < %d < %zu)", i, + "exports[%zu] internal_ordinal out of bounds (0 < %zu < %zu)", i, internal_ordinal, iree_vm_InternalFunctionDef_vec_len(internal_functions)); } @@ -280,7 +279,7 @@ static iree_vm_module_signature_t iree_vm_bytecode_module_signature( } static iree_status_t iree_vm_bytecode_module_get_function( - void* self, iree_vm_function_linkage_t linkage, int32_t ordinal, + void* self, iree_vm_function_linkage_t linkage, iree_host_size_t ordinal, iree_vm_function_t* out_function, iree_string_view_t* out_name, iree_vm_function_signature_t* out_signature) { if (out_function) { @@ -299,11 +298,10 @@ static iree_status_t iree_vm_bytecode_module_get_function( if (linkage == IREE_VM_FUNCTION_LINKAGE_IMPORT) { iree_vm_ImportFunctionDef_vec_t imported_functions = iree_vm_BytecodeModuleDef_imported_functions(module->def); - if (ordinal < 0 || - ordinal >= iree_vm_ImportFunctionDef_vec_len(imported_functions)) { + if (ordinal >= iree_vm_ImportFunctionDef_vec_len(imported_functions)) { return iree_make_status( IREE_STATUS_INVALID_ARGUMENT, - "import ordinal out of range (0 < %d < %zu)", ordinal, + "import ordinal out of range (0 < %zu < %zu)", ordinal, iree_vm_ImportFunctionDef_vec_len(imported_functions)); } iree_vm_ImportFunctionDef_table_t import_def = @@ -313,16 +311,15 @@ static iree_status_t iree_vm_bytecode_module_get_function( if (out_function) { out_function->module = &module->interface; out_function->linkage = linkage; - out_function->ordinal = ordinal; + out_function->ordinal = (uint16_t)ordinal; } } else if (linkage == IREE_VM_FUNCTION_LINKAGE_EXPORT) { iree_vm_ExportFunctionDef_vec_t exported_functions = iree_vm_BytecodeModuleDef_exported_functions(module->def); - if (ordinal < 0 || - ordinal >= iree_vm_ExportFunctionDef_vec_len(exported_functions)) { + if (ordinal >= iree_vm_ExportFunctionDef_vec_len(exported_functions)) { return iree_make_status( IREE_STATUS_INVALID_ARGUMENT, - "export ordinal out of range (0 < %d < %zu)", ordinal, + "export ordinal out of range (0 < %zu < %zu)", ordinal, iree_vm_ExportFunctionDef_vec_len(exported_functions)); } iree_vm_ExportFunctionDef_table_t export_def = @@ -345,11 +342,10 @@ static iree_status_t iree_vm_bytecode_module_get_function( } else { iree_vm_InternalFunctionDef_vec_t internal_functions = iree_vm_BytecodeModuleDef_internal_functions(module->def); - if (ordinal < 0 || - ordinal >= iree_vm_InternalFunctionDef_vec_len(internal_functions)) { + if (ordinal >= iree_vm_InternalFunctionDef_vec_len(internal_functions)) { return iree_make_status( IREE_STATUS_INVALID_ARGUMENT, - "function ordinal out of range (0 < %d < %zu)", ordinal, + "function ordinal out of range (0 < %zu < %zu)", ordinal, iree_vm_InternalFunctionDef_vec_len(internal_functions)); } iree_vm_InternalFunctionDef_table_t function_def = @@ -359,7 +355,7 @@ static iree_status_t iree_vm_bytecode_module_get_function( if (out_function) { out_function->module = &module->interface; out_function->linkage = IREE_VM_FUNCTION_LINKAGE_INTERNAL; - out_function->ordinal = ordinal; + out_function->ordinal = (uint16_t)ordinal; const iree_vm_FunctionDescriptor_t* function_descriptor = &module->function_descriptor_table[ordinal]; @@ -385,13 +381,13 @@ static iree_status_t iree_vm_bytecode_module_get_function( } static iree_status_t iree_vm_bytecode_module_get_function_reflection_attr( - void* self, iree_vm_function_linkage_t linkage, int32_t ordinal, - int32_t index, iree_string_view_t* key, iree_string_view_t* value) { + void* self, iree_vm_function_linkage_t linkage, iree_host_size_t ordinal, + iree_host_size_t index, iree_string_view_t* key, + iree_string_view_t* value) { if (linkage != IREE_VM_FUNCTION_LINKAGE_INTERNAL) { iree_vm_function_t internal_function; IREE_RETURN_IF_ERROR(iree_vm_bytecode_module_get_function( self, linkage, ordinal, &internal_function, NULL, NULL)); - linkage = internal_function.linkage; ordinal = internal_function.ordinal; } @@ -399,11 +395,10 @@ static iree_status_t iree_vm_bytecode_module_get_function_reflection_attr( iree_vm_InternalFunctionDef_vec_t internal_functions = iree_vm_BytecodeModuleDef_internal_functions(module->def); - if (ordinal < 0 || - ordinal >= iree_vm_InternalFunctionDef_vec_len(internal_functions)) { + if (ordinal >= iree_vm_InternalFunctionDef_vec_len(internal_functions)) { return iree_make_status( IREE_STATUS_INVALID_ARGUMENT, - "function ordinal out of range (0 < %d < %zu)", ordinal, + "function ordinal out of range (0 < %zu < %zu)", ordinal, iree_vm_InternalFunctionDef_vec_len(internal_functions)); } @@ -413,10 +408,9 @@ static iree_status_t iree_vm_bytecode_module_get_function_reflection_attr( iree_vm_InternalFunctionDef_signature(function_def); iree_vm_ReflectionAttrDef_vec_t reflection_attrs = iree_vm_FunctionSignatureDef_reflection_attrs(signature); - if (index < 0 || - index >= iree_vm_ReflectionAttrDef_vec_len(reflection_attrs)) { + if (index >= iree_vm_ReflectionAttrDef_vec_len(reflection_attrs)) { return iree_make_status(IREE_STATUS_NOT_FOUND, - "reflection attribute at index %d not found", + "reflection attribute at index %zu not found", index); } iree_vm_ReflectionAttrDef_table_t attr = @@ -516,16 +510,16 @@ static iree_host_size_t iree_vm_bytecode_module_layout_state( iree_vm_bytecode_module_state_t* state) { iree_vm_ModuleStateDef_table_t module_state = iree_vm_BytecodeModuleDef_module_state(module_def); - int rwdata_storage_capacity = 0; - int global_ref_count = 0; + iree_host_size_t rwdata_storage_capacity = 0; + iree_host_size_t global_ref_count = 0; if (module_state) { rwdata_storage_capacity = iree_vm_ModuleStateDef_global_bytes_capacity(module_state); global_ref_count = iree_vm_ModuleStateDef_global_ref_count(module_state); } - int rodata_ref_count = iree_vm_RodataSegmentDef_vec_len( + iree_host_size_t rodata_ref_count = iree_vm_RodataSegmentDef_vec_len( iree_vm_BytecodeModuleDef_rodata_segments(module_def)); - int import_function_count = iree_vm_ImportFunctionDef_vec_len( + iree_host_size_t import_function_count = iree_vm_ImportFunctionDef_vec_len( iree_vm_BytecodeModuleDef_imported_functions(module_def)); uint8_t* base_ptr = (uint8_t*)state; @@ -614,14 +608,14 @@ static void iree_vm_bytecode_module_free_state( } static iree_status_t iree_vm_bytecode_module_resolve_import( - void* self, iree_vm_module_state_t* module_state, int32_t ordinal, + void* self, iree_vm_module_state_t* module_state, iree_host_size_t ordinal, iree_vm_function_t function) { IREE_ASSERT_ARGUMENT(module_state); iree_vm_bytecode_module_state_t* state = (iree_vm_bytecode_module_state_t*)module_state; - if (ordinal < 0 || ordinal >= state->import_count) { + if (ordinal >= state->import_count) { return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, - "import ordinal out of range (0 < %d < %d)", + "import ordinal out of range (0 < %zu < %zu)", ordinal, state->import_count); } // TODO(benvanik): verify signature. @@ -648,10 +642,9 @@ static iree_status_t iree_vm_bytecode_module_begin_call( } iree_vm_bytecode_module_t* module = (iree_vm_bytecode_module_t*)self; - if (function.ordinal < 0 || - function.ordinal >= module->function_descriptor_count) { + if (function.ordinal >= module->function_descriptor_count) { return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, - "function ordinal out of range (0 < %d < %d)", + "function ordinal out of range (0 < %u < %zu)", function.ordinal, module->function_descriptor_count); } diff --git a/iree/vm/bytecode_module_impl.h b/iree/vm/bytecode_module_impl.h index 0f4e81874d5d..14758d674364 100644 --- a/iree/vm/bytecode_module_impl.h +++ b/iree/vm/bytecode_module_impl.h @@ -54,7 +54,7 @@ typedef struct { // Table of internal function bytecode descriptors. // Mapped 1:1 with internal functions. Each defined bytecode span represents a // range of bytes in |bytecode_data|. - int32_t function_descriptor_count; + iree_host_size_t function_descriptor_count; const iree_vm_FunctionDescriptor_t* function_descriptor_table; // A pointer to the bytecode data embedded within the module. @@ -69,7 +69,7 @@ typedef struct { iree_vm_BytecodeModuleDef_table_t def; // Type table mapping module type IDs to registered VM types. - int32_t type_count; + iree_host_size_t type_count; iree_vm_type_def_t* type_table; } iree_vm_bytecode_module_t; @@ -83,18 +83,18 @@ typedef struct { iree_byte_span_t rwdata_storage; // Global ref_ptr values, indexed by global ordinal. - int32_t global_ref_count; + iree_host_size_t global_ref_count; iree_vm_ref_t* global_ref_table; // TODO(benvanik): move to iree_vm_bytecode_module_t if always static. // Initialized references to rodata segments. // Right now these don't do much, however we can perform lazy caching and // on-the-fly decompression using this information. - int32_t rodata_ref_count; + iree_host_size_t rodata_ref_count; iree_vm_ro_byte_buffer_t* rodata_ref_table; // Resolved function imports. - int32_t import_count; + iree_host_size_t import_count; iree_vm_function_t* import_table; // Allocator used for the state itself and any runtime allocations needed. diff --git a/iree/vm/module.c b/iree/vm/module.c index 2cc964fe9285..b8d7b18c1002 100644 --- a/iree/vm/module.c +++ b/iree/vm/module.c @@ -69,7 +69,7 @@ iree_vm_module_lookup_function_by_name(const iree_vm_module_t* module, IREE_API_EXPORT iree_status_t IREE_API_CALL iree_vm_module_lookup_function_by_ordinal(const iree_vm_module_t* module, iree_vm_function_linkage_t linkage, - int32_t ordinal, + iree_host_size_t ordinal, iree_vm_function_t* out_function, iree_string_view_t* linkage_name) { return module->get_function(module->self, linkage, ordinal, out_function, @@ -128,7 +128,8 @@ iree_vm_function_reflection_attr(const iree_vm_function_t* function, } IREE_API_EXPORT iree_status_t IREE_API_CALL -iree_vm_get_function_reflection_attr(iree_vm_function_t function, int32_t index, +iree_vm_get_function_reflection_attr(iree_vm_function_t function, + iree_host_size_t index, iree_string_view_t* key, iree_string_view_t* value) { if (!function.module->get_function_reflection_attr) { diff --git a/iree/vm/module.h b/iree/vm/module.h index 3081e10b156a..e8418917458e 100644 --- a/iree/vm/module.h +++ b/iree/vm/module.h @@ -91,20 +91,20 @@ static_assert(sizeof(iree_vm_function_t) == 8 + sizeof(void*), typedef struct { // TODO(#1979): rework to add useful information here (types, etc). // Total number of arguments to the function. - int32_t argument_count; + iree_host_size_t argument_count; // Total number of results from the function. - int32_t result_count; + iree_host_size_t result_count; } iree_vm_function_signature_t; // Describes the imports, exports, and capabilities of a module. typedef struct { // Total number of imported functions. - int32_t import_function_count; + iree_host_size_t import_function_count; // Total number of exported functions. - int32_t export_function_count; + iree_host_size_t export_function_count; // Total number of internal functions, if debugging info is present and they // can be queried. - int32_t internal_function_count; + iree_host_size_t internal_function_count; } iree_vm_module_signature_t; // Internal storage for the module state. @@ -165,7 +165,7 @@ typedef struct iree_vm_module { // - |out_name| set to the function name. // - |out_signature| set to the function signature. iree_status_t(IREE_API_PTR* get_function)( - void* self, iree_vm_function_linkage_t linkage, int32_t ordinal, + void* self, iree_vm_function_linkage_t linkage, iree_host_size_t ordinal, iree_vm_function_t* out_function, iree_string_view_t* out_name, iree_vm_function_signature_t* out_signature); @@ -188,8 +188,8 @@ typedef struct iree_vm_module { // The function is guaranteed to remain valid for the lifetime of the module // state. iree_status_t(IREE_API_PTR* resolve_import)( - void* self, iree_vm_module_state_t* module_state, int32_t ordinal, - iree_vm_function_t function); + void* self, iree_vm_module_state_t* module_state, + iree_host_size_t ordinal, iree_vm_function_t function); // Begins a function call with the given |call| arguments. // Execution may yield in the case of asynchronous code and require one or @@ -212,8 +212,9 @@ typedef struct iree_vm_module { // the function. // See: docs/design_docs/function_abi.md iree_status_t(IREE_API_PTR* get_function_reflection_attr)( - void* self, iree_vm_function_linkage_t linkage, int32_t ordinal, - int32_t index, iree_string_view_t* key, iree_string_view_t* value); + void* self, iree_vm_function_linkage_t linkage, iree_host_size_t ordinal, + iree_host_size_t index, iree_string_view_t* key, + iree_string_view_t* value); } iree_vm_module_t; #ifndef IREE_API_NO_PROTOTYPES @@ -261,7 +262,7 @@ iree_vm_module_lookup_function_by_name(const iree_vm_module_t* module, IREE_API_EXPORT iree_status_t IREE_API_CALL iree_vm_module_lookup_function_by_ordinal(const iree_vm_module_t* module, iree_vm_function_linkage_t linkage, - int32_t ordinal, + iree_host_size_t ordinal, iree_vm_function_t* out_function, iree_string_view_t* out_linkage_name); @@ -291,7 +292,8 @@ iree_vm_function_reflection_attr(const iree_vm_function_t* function, // the function. // See: docs/design_docs/function_abi.md IREE_API_EXPORT iree_status_t IREE_API_CALL -iree_vm_get_function_reflection_attr(iree_vm_function_t function, int32_t index, +iree_vm_get_function_reflection_attr(iree_vm_function_t function, + iree_host_size_t index, iree_string_view_t* key, iree_string_view_t* value); diff --git a/iree/vm/module_abi_cc.h b/iree/vm/module_abi_cc.h index 57ce872da5ef..48b2eded1b2b 100644 --- a/iree/vm/module_abi_cc.h +++ b/iree/vm/module_abi_cc.h @@ -127,7 +127,7 @@ class NativeModule { } static iree_status_t ModuleGetFunction( - void* self, iree_vm_function_linkage_t linkage, int32_t ordinal, + void* self, iree_vm_function_linkage_t linkage, iree_host_size_t ordinal, iree_vm_function_t* out_function, iree_string_view_t* out_name, iree_vm_function_signature_t* out_signature) { if (out_function) { @@ -141,9 +141,9 @@ class NativeModule { std::memset(out_signature, 0, sizeof(*out_signature)); } auto* module = FromModulePointer(self); - if (ordinal < 0 || ordinal > module->dispatch_table_.size()) { + if (ordinal > module->dispatch_table_.size()) { return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, - "function out of bounds: 0 < %d < %zu", ordinal, + "function out of bounds: 0 < %zu < %zu", ordinal, module->dispatch_table_.size()); } if (out_function) { @@ -209,7 +209,7 @@ class NativeModule { static iree_status_t ModuleResolveImport(void* self, iree_vm_module_state_t* module_state, - int32_t ordinal, + iree_host_size_t ordinal, iree_vm_function_t function) { return iree_make_status(IREE_STATUS_UNIMPLEMENTED, "C++ API does not support imports"); @@ -221,10 +221,9 @@ class NativeModule { IREE_ASSERT_ARGUMENT(out_result); std::memset(out_result, 0, sizeof(*out_result)); auto* module = FromModulePointer(self); - if (call->function.ordinal < 0 || - call->function.ordinal >= module->dispatch_table_.size()) { + if (call->function.ordinal >= module->dispatch_table_.size()) { return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, - "function ordinal out of bounds: 0 < %d < %zu", + "function ordinal out of bounds: 0 < %u < %zu", call->function.ordinal, module->dispatch_table_.size()); }