@@ -72,7 +72,7 @@ struct LineRefOffset
7272{
7373 struct ListHead head ;
7474 uint16_t line_ref ;
75- unsigned offset ;
75+ unsigned int offset ;
7676};
7777
7878struct Module
@@ -293,39 +293,7 @@ static inline const uint8_t *module_get_str(Module *mod, size_t offset, size_t *
293293 * @param function_name (output) the function name, as an AtomString.
294294 * @param arity (output) the function arity
295295 */
296- static inline bool module_get_fun_from_label (Module * this_module , int label , AtomString * function_name , int * arity ) {
297- int best_label = -1 ;
298- const uint8_t * table_data = (const uint8_t * ) this_module -> export_table ;
299- int exports_count = READ_32_ALIGNED (table_data + 8 );
300- for (int export_index = exports_count - 1 ; export_index >= 0 ; export_index -- ) {
301- int fun_atom_index = READ_32_ALIGNED (table_data + (export_index * 12 ) + 12 );
302- int fun_arity = READ_32_ALIGNED (table_data + (export_index * 12 ) + 4 + 12 );
303- int fun_label = READ_32_ALIGNED (table_data + (export_index * 12 ) + 8 + 12 );
304- if (fun_label <= label && best_label < fun_label ) {
305- best_label = fun_label ;
306- * arity = fun_arity ;
307- * function_name = module_get_atom_string_by_id (this_module , fun_atom_index );
308- }
309- }
310-
311- table_data = (const uint8_t * ) this_module -> local_table ;
312- int locals_count = READ_32_ALIGNED (table_data + 8 );
313- for (int local_index = locals_count - 1 ; local_index >= 0 ; local_index -- ) {
314- int fun_atom_index = READ_32_ALIGNED (table_data + (local_index * 12 ) + 12 );
315- int fun_arity = READ_32_ALIGNED (table_data + (local_index * 12 ) + 4 + 12 );
316- int fun_label = READ_32_ALIGNED (table_data + (local_index * 12 ) + 8 + 12 );
317- if (fun_label <= label && best_label < fun_label ) {
318- best_label = fun_label ;
319- * arity = fun_arity ;
320- * function_name = module_get_atom_string_by_id (this_module , fun_atom_index );
321- }
322- }
323- if (UNLIKELY (best_label == -1 )) {
324- // Couldn't find the function.
325- return false;
326- }
327- return true;
328- }
296+ bool module_get_fun_from_label (Module * this_module , int label , AtomString * function_name , int * arity );
329297
330298/*
331299 * @brief Insert the instruction offset for a given module at a line reference instruction.
@@ -362,7 +330,7 @@ int module_find_line(Module *mod, int offset);
362330 */
363331static inline bool module_has_line_chunk (Module * mod )
364332{
365- return ! IS_NULL_PTR ( mod -> line_refs ) ;
333+ return mod -> line_refs != NULL ;
366334}
367335
368336#ifdef __cplusplus
0 commit comments