i would have just made this a separate class for maximal call site simplicity  although it honestly does not bother me too much the way it is because shadowframe is already a mess  class lockcounttracker std  unique ptr lockcountdata  data  public void begintracking void endtracking void trackmonitorenter void trackmonitorexit bool checkmonitorsunheldorthrow struct shadowframe lockcounttracker lock count tracker  