2828
2929#ifndef AVM_CREATE_STACKTRACES
3030
31- term stacktrace_create_raw (Context * ctx , Module * mod , int current_offset )
31+ term stacktrace_create_raw (Context * ctx , Module * mod , size_t current_offset )
3232{
3333 UNUSED (ctx );
3434 UNUSED (mod );
@@ -37,7 +37,7 @@ term stacktrace_create_raw(Context *ctx, Module *mod, int current_offset)
3737 return context_exception_class (ctx );
3838}
3939
40- term stacktrace_create_raw_mfa (Context * ctx , Module * mod , int current_offset , term module_atom , term function_atom , int arity )
40+ term stacktrace_create_raw_mfa (Context * ctx , Module * mod , size_t current_offset , term module_atom , term function_atom , int arity )
4141{
4242 UNUSED (ctx );
4343 UNUSED (mod );
@@ -102,12 +102,12 @@ static bool location_sets_append(GlobalContext *global, Module *mod, const uint8
102102 return true;
103103}
104104
105- term stacktrace_create_raw (Context * ctx , Module * mod , int current_offset )
105+ term stacktrace_create_raw (Context * ctx , Module * mod , size_t current_offset )
106106{
107107 return stacktrace_create_raw_mfa (ctx , mod , current_offset , UNDEFINED_ATOM , UNDEFINED_ATOM , 0 );
108108}
109109
110- term stacktrace_create_raw_mfa (Context * ctx , Module * mod , int current_offset , term module_atom , term function_atom , int arity )
110+ term stacktrace_create_raw_mfa (Context * ctx , Module * mod , size_t current_offset , term module_atom , term function_atom , int arity )
111111{
112112 term exception_class = context_exception_class (ctx );
113113
@@ -150,7 +150,7 @@ term stacktrace_create_raw_mfa(Context *ctx, Module *mod, int current_offset, te
150150 unsigned int num_aux_terms = 0 ;
151151 size_t filename_lens = 0 ;
152152 Module * prev_mod = NULL ;
153- long prev_mod_offset = -1 ;
153+ size_t prev_mod_offset = ( size_t ) -1 ;
154154 term * ct = ctx -> e ;
155155 term * stack_base = context_stack_base (ctx );
156156
@@ -161,7 +161,7 @@ term stacktrace_create_raw_mfa(Context *ctx, Module *mod, int current_offset, te
161161 if (term_is_cp (* ct )) {
162162
163163 Module * cp_mod ;
164- long mod_offset ;
164+ size_t mod_offset ;
165165
166166 module_cp_to_label_offset (* ct , & cp_mod , NULL , NULL , & mod_offset , ctx -> global );
167167 // TODO: investigate
@@ -187,7 +187,7 @@ term stacktrace_create_raw_mfa(Context *ctx, Module *mod, int current_offset, te
187187 int label = term_to_catch_label_and_module (* ct , & module_index );
188188
189189 Module * cl_mod = globalcontext_get_module_by_index (ctx -> global , module_index );
190- int mod_offset = module_label_code_offset (cl_mod , label );
190+ size_t mod_offset = module_label_code_offset (cl_mod , label );
191191
192192 if (!(prev_mod == cl_mod && mod_offset == prev_mod_offset )) {
193193 ++ num_frames ;
@@ -214,7 +214,7 @@ term stacktrace_create_raw_mfa(Context *ctx, Module *mod, int current_offset, te
214214 uint32_t line ;
215215 const uint8_t * filename ;
216216 size_t filename_len ;
217- if (LIKELY (module_find_line (mod , ( unsigned int ) current_offset , & line , & filename_len , & filename ))) {
217+ if (LIKELY (module_find_line (mod , current_offset , & line , & filename_len , & filename ))) {
218218 if (!location_sets_append (ctx -> global , mod , filename , filename_len , & filename_lens , & locations , & num_locations )) {
219219 return UNDEFINED_ATOM ;
220220 }
@@ -289,14 +289,14 @@ term stacktrace_create_raw_mfa(Context *ctx, Module *mod, int current_offset, te
289289 raw_stacktrace = term_list_prepend (frame_info , raw_stacktrace , & ctx -> heap );
290290
291291 prev_mod = NULL ;
292- prev_mod_offset = -1 ;
292+ prev_mod_offset = ( size_t ) -1 ;
293293 // GC may have moved stack
294294 ct = ctx -> e ;
295295 stack_base = context_stack_base (ctx );
296296 while (ct != stack_base ) {
297297 if (term_is_cp (* ct )) {
298298 Module * cp_mod ;
299- long mod_offset ;
299+ size_t mod_offset ;
300300
301301 module_cp_to_label_offset (* ct , & cp_mod , NULL , NULL , & mod_offset , ctx -> global );
302302 if (mod_offset != cp_mod -> end_instruction_ii && !(prev_mod == cp_mod && mod_offset == prev_mod_offset )) {
@@ -315,7 +315,7 @@ term stacktrace_create_raw_mfa(Context *ctx, Module *mod, int current_offset, te
315315 int module_index ;
316316 int label = term_to_catch_label_and_module (* ct , & module_index );
317317 Module * cl_mod = globalcontext_get_module_by_index (ctx -> global , module_index );
318- int mod_offset = module_label_code_offset (cl_mod , label );
318+ size_t mod_offset = module_label_code_offset (cl_mod , label );
319319
320320 if (!(prev_mod == cl_mod && mod_offset == prev_mod_offset )) {
321321
@@ -434,7 +434,7 @@ term stacktrace_build(Context *ctx, term *stack_info, uint32_t live)
434434
435435 Module * cp_mod ;
436436 int label ;
437- long mod_offset ;
437+ size_t mod_offset ;
438438 module_cp_to_label_offset (cp , & cp_mod , & label , NULL , & mod_offset , ctx -> global );
439439
440440 term module_name = module_get_name (cp_mod );
0 commit comments