Invariance principles for some stochastic processes relating to M-estimators and their role in sequential statistical inference