void BeginCatch(ISehHandlerBlock block, AbcCode code, AbcExceptionHandler e, ref int var, bool dupException, bool catchAnyException) { var beginIndex = code.Count; var catchInfo = new CatchInfo { CatchAnyException = catchAnyException }; bool coerceAny = catchAnyException; if (var < 0 || catchAnyException) { coerceAny = true; var = SharedExceptionVar; catchInfo.IsTempVar = true; } catchInfo.ExceptionVar = var; e.LocalVariable = var; var handlerInfo = block.Tag as SehHandlerInfo; if (handlerInfo == null) { handlerInfo = new SehHandlerInfo { CatchInfo = catchInfo }; block.Tag = handlerInfo; } else { handlerInfo.CatchInfo = catchInfo; } //NOTE: we store exception in temp variable to use for rethrow operation if (dupException && !catchAnyException) { code.Dup(); } if (coerceAny) { code.CoerceAnyType(); } //store exception in variable to use for rethrow operation code.SetLocal(var); _resolver.Add(code[beginIndex], new ExceptionTarget(e)); }
private void InitPointers(AbcCode code) { if (!HasActivationVar) { return; } if (AbcGenConfig.UseActivationTraits) { code.NewActivation(); if (AbcGenConfig.UseFuncPointers) { code.Dup(); code.PushThisScope(); code.PushScope(); } } else { code.CreateInstance(_activation); } code.SetLocal(_activationVar); if (IsThisAddressed) { var ptr = DefineThisPtr(); GetActivation(code); code.LoadThis(); code.SetSlot(ptr.Slot); InitSlotPtr(code, ptr); } //store arguments in slots int n = _method.Parameters.Count; for (int i = 0; i < n; ++i) { var p = _method.Parameters[i]; var ptr = p.Data as VarPtr; if (ptr == null) { continue; } GetActivation(code); code.GetLocal(GetArgIndex(i)); code.SetSlot(ptr.Slot); InitSlotPtr(code, ptr); } if (HasLocalVariables) { n = VarCount; for (int i = 0; i < n; ++i) { var v = GetVar(i); var ptr = v.Data as VarPtr; if (ptr == null) { continue; } InitSlotPtr(code, ptr); } } //NOTE: Because of VerifyError #1068 if (AbcGenConfig.UseActivationTraits && AbcGenConfig.UseFuncPointers) { code.PopScope(); //activation code.PopScope(); //this } }