@@ -268,7 +268,9 @@ ThreadInfo::unwind_tasks(EchionSampler& echion, PyThreadState* tstate)
268268 if (auto it = task_coro_stacks.find (task.origin ); it != task_coro_stacks.end ()) {
269269 const auto & cached = it->second ;
270270 const size_t frames_to_push = std::min (cached.frames .size (), max_frames - task_frames.size ());
271- task_frames.insert (task_frames.end (), cached.frames .begin (), cached.frames .begin () + frames_to_push);
271+ task_frames.insert (task_frames.end (),
272+ cached.frames .begin (),
273+ cached.frames .begin () + static_cast <FrameStack::difference_type>(frames_to_push));
272274 if (task.is_on_cpu ) {
273275 has_on_cpu_task = true ;
274276 on_cpu_task_depth = cached.depth ;
@@ -325,7 +327,8 @@ ThreadInfo::unwind_tasks(EchionSampler& echion, PyThreadState* tstate)
325327 size_t task_locations = 0 ;
326328 const size_t task_to_keep = select_frame_prefix (task_frames, 0 , task_frames.size (), max_frames, task_locations);
327329 const bool task_truncated = task_collection_full || task_to_keep < task_frames.size ();
328- task_frames.erase (task_frames.begin () + task_to_keep, task_frames.end ());
330+ task_frames.erase (task_frames.begin () + static_cast <FrameStack::difference_type>(task_to_keep),
331+ task_frames.end ());
329332
330333 // Task frames receive the reporting budget first. If capacity remains,
331334 // fill it with physical context. For an on-CPU task, split that context
@@ -359,24 +362,26 @@ ThreadInfo::unwind_tasks(EchionSampler& echion, PyThreadState* tstate)
359362 if ((leaf_truncated || runtime_truncated) && locations >= max_frames) {
360363 if (runtime_to_keep > 0 ) {
361364 runtime_to_keep--;
362- locations -= rendered_location_count (python_stack[runtime_start + runtime_to_keep]);
363365 } else if (leaf_to_keep > 0 ) {
364366 leaf_to_keep--;
365- locations -= rendered_location_count (python_stack[leaf_to_keep]);
366367 }
367368 leaf_truncated = leaf_depth > leaf_to_keep;
368369 runtime_truncated = runtime_available > runtime_to_keep;
369370 }
370371
371- stack.insert (stack.end (), python_stack.begin (), python_stack.begin () + leaf_to_keep);
372+ stack.insert (stack.end (),
373+ python_stack.begin (),
374+ python_stack.begin () + static_cast <FrameStack::difference_type>(leaf_to_keep));
372375 if (leaf_truncated) {
373376 stack_info->omission_index = stack.size ();
374377 stack_info->omitted_frames = leaf_depth - leaf_to_keep;
375378 }
376379 stack.insert (stack.end (), task_frames.begin (), task_frames.end ());
380+ const auto runtime_begin =
381+ python_stack.begin () + static_cast <FrameStack::difference_type>(runtime_start);
377382 stack.insert (stack.end (),
378- python_stack. begin () + runtime_start ,
379- python_stack. begin () + runtime_start + runtime_to_keep);
383+ runtime_begin ,
384+ runtime_begin + static_cast <FrameStack::difference_type>( runtime_to_keep) );
380385 if (!leaf_truncated && runtime_truncated) {
381386 stack_info->omission_index = stack.size ();
382387 stack_info->omitted_frames = runtime_available - runtime_to_keep;
@@ -387,11 +392,12 @@ ThreadInfo::unwind_tasks(EchionSampler& echion, PyThreadState* tstate)
387392 bool sync_truncated = python_stack.size () > sync_to_keep;
388393 if (sync_truncated && locations >= max_frames && sync_to_keep > 0 ) {
389394 sync_to_keep--;
390- locations -= rendered_location_count (python_stack[sync_to_keep]);
391395 }
392396
393397 stack = std::move (task_frames);
394- stack.insert (stack.end (), python_stack.begin (), python_stack.begin () + sync_to_keep);
398+ stack.insert (stack.end (),
399+ python_stack.begin (),
400+ python_stack.begin () + static_cast <FrameStack::difference_type>(sync_to_keep));
395401 if (sync_truncated) {
396402 stack_info->omission_index = stack.size ();
397403 stack_info->omitted_frames = python_stack.size () - sync_to_keep;
0 commit comments