#region DefineDynamicAssembly
- /**********************************************
- * If an AssemblyName has a public key specified, the assembly is assumed
- * to have a strong name and a hash will be computed when the assembly
- * is saved.
- **********************************************/
+ /// <summary>
+ /// If an AssemblyName has a public key specified, the assembly is assumed
+ /// to have a strong name and a hash will be computed when the assembly
+ /// is saved.
+ /// </summary>
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
public static AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
#endregion
#region DefineDynamicModule
- /**********************************************
- *
- * Defines a named dynamic module. It is an error to define multiple
- * modules within an Assembly with the same name. This dynamic module is
- * a transient module.
- *
- **********************************************/
+ /// <summary>
+ /// Defines a named dynamic module. It is an error to define multiple
+ /// modules within an Assembly with the same name. This dynamic module is
+ /// a transient module.
+ /// </summary>
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
public ModuleBuilder DefineDynamicModule(
string name)
#endregion
- /**********************************************
- *
- * return a dynamic module with the specified name.
- *
- **********************************************/
+ /// <summary>
+ /// return a dynamic module with the specified name.
+ /// </summary>
public ModuleBuilder GetDynamicModule(
string name) // the name of module for the look up
{
}
- /**********************************************
- * Use this function if client decides to form the custom attribute blob themselves
- **********************************************/
+ /// <summary>
+ /// Use this function if client decides to form the custom attribute blob themselves
+ /// </summary>
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
if (con == null)
}
}
- /**********************************************
- * Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder
- **********************************************/
+ /// <summary>
+ /// Use this function if client wishes to build CustomAttribute using CustomAttributeBuilder
+ /// </summary>
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
if (customBuilder == null)
}
- /**********************************************
- *
- * Internal structure to track the list of ResourceWriter for
- * AssemblyBuilder & ModuleBuilder.
- *
- **********************************************/
+ /// <summary>
+ /// Internal structure to track the list of ResourceWriter for
+ /// AssemblyBuilder & ModuleBuilder.
+ /// </summary>
internal class ResWriterData
{
internal string m_strName;
CreateCustomAttribute(mod, tkOwner, mod.GetConstructorToken(m_con).Token, false);
}
- //*************************************************
- // Call this function with toDisk=1, after on disk module has been snapped.
- //*************************************************
+ /// <summary>
+ /// Call this function with toDisk=1, after on disk module has been snapped.
+ /// </summary>
internal void CreateCustomAttribute(ModuleBuilder mod, int tkOwner, int tkAttrib, bool toDisk)
{
TypeBuilder.DefineCustomAttribute(mod, tkOwner, tkAttrib, m_blob, toDisk,
get { return m_typeBuilder.Name; }
}
- /****************************************************
- *
- * abstract methods defined in the base class
- *
- */
+ /// <summary>
+ /// abstract methods defined in the base class
+ /// </summary>
public override Guid GUID
{
get
}
- /***************************
- *
- * Scope Tree is a class that track the scope structure within a method body
- * It keeps track two parallel array. m_ScopeAction keeps track the action. It can be
- * OpenScope or CloseScope. m_iOffset records the offset where the action
- * takes place.
- *
- ***************************/
+ /// <summary>
+ /// Scope Tree is a class that track the scope structure within a method body
+ /// It keeps track two parallel array. m_ScopeAction keeps track the action. It can be
+ /// OpenScope or CloseScope. m_iOffset records the offset where the action
+ /// takes place.
+ /// </summary>
internal enum ScopeAction
{
Open = 0x0,
m_iCount = 0;
}
- /***************************
- *
- * Find the current active lexical scope. For example, if we have
- * "Open Open Open Close",
- * we will return 1 as the second BeginScope is currently active.
- *
- ***************************/
+ /// <summary>
+ /// Find the current active lexical scope. For example, if we have
+ /// "Open Open Open Close",
+ /// we will return 1 as the second BeginScope is currently active.
+ /// </summary>
internal int GetCurrentActiveScopeIndex()
{
int cClose = 0;
m_iOpenScopeCount--;
}
- /**************************
- *
- * Helper to ensure arrays are large enough
- *
- **************************/
+ /// <summary>
+ /// Helper to ensure arrays are large enough
+ /// </summary>
internal void EnsureCapacity()
{
if (m_iCount == 0)
}
- /***************************
- *
- * This class tracks the line number info
- *
- ***************************/
+ /// <summary>
+ /// This class tracks the line number info
+ /// </summary>
internal sealed class LineNumberInfo
{
internal LineNumberInfo()
return m_iLastFound;
}
- /**************************
- *
- * Helper to ensure arrays are large enough
- *
- **************************/
+ /// <summary>
+ /// Helper to ensure arrays are large enough
+ /// </summary>
private void EnsureCapacity()
{
if (m_DocumentCount == 0)
}
- /***************************
- *
- * This class tracks the line number info
- *
- ***************************/
+ /// <summary>
+ /// This class tracks the line number info
+ /// </summary>
internal sealed class REDocument
{
internal REDocument(ISymbolDocumentWriter document)
checked { m_iLineNumberCount++; }
}
- /**************************
- *
- * Helper to ensure arrays are large enough
- *
- **************************/
+ /// <summary>
+ /// Helper to ensure arrays are large enough
+ /// </summary>
private void EnsureCapacity()
{
if (m_iLineNumberCount == 0)
m_containingType = containingType;
}
- //************************************************
- // Set the default value of the Property
- //************************************************
+ /// <summary>
+ /// Set the default value of the Property
+ /// </summary>
public void SetConstant(object defaultValue)
{
m_containingType.ThrowIfCreated();
namespace System.Threading
{
- // After much discussion, we decided the Interlocked class doesn't need
- // any HPA's for synchronization or external threading. They hurt C#'s
- // codegen for the yield keyword, and arguably they didn't protect much.
- // Instead, they penalized people (and compilers) for writing threadsafe
- // code.
+ /// <summary>
+ /// After much discussion, we decided the Interlocked class doesn't need
+ /// any HPA's for synchronization or external threading. They hurt C#'s
+ /// codegen for the yield keyword, and arguably they didn't protect much.
+ /// Instead, they penalized people (and compilers) for writing threadsafe
+ /// code.
+ /// </summary>
public static class Interlocked
{
- /******************************
- * Increment
- * Implemented: int
- * long
- *****************************/
-
+ /// <summary>
+ /// Implemented: int, long
+ /// </summary>
public static int Increment(ref int location)
{
return Add(ref location, 1);
return Add(ref location, 1);
}
- /******************************
- * Decrement
- * Implemented: int
- * long
- *****************************/
-
+ /// <summary>
+ /// Implemented: int, long
+ /// </summary>
public static int Decrement(ref int location)
{
return Add(ref location, -1);
return Add(ref location, -1);
}
- /******************************
- * Exchange
- * Implemented: int
- * long
- * float
- * double
- * Object
- * IntPtr
- *****************************/
-
+ /// <summary>
+ /// Implemented: int, long, float, double, Object, IntPtr
+ /// </summary>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int Exchange(ref int location1, int value);
return Unsafe.As<T>(Exchange(ref Unsafe.As<T, object>(ref location1), value));
}
- /******************************
- * CompareExchange
- * Implemented: int
- * long
- * float
- * double
- * Object
- * IntPtr
- *****************************/
-
+ /// <summary>
+ /// Implemented: int, long, float, double, Object, IntPtr
+ /// </summary>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int CompareExchange(ref int location1, int value, int comparand);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern int CompareExchange(ref int location1, int value, int comparand, ref bool succeeded);
- /******************************
- * Add
- * Implemented: int
- * long
- *****************************/
-
+ /// <summary>
+ /// Implemented: int, long
+ /// </summary>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern int ExchangeAdd(ref int location1, int value);
return ExchangeAdd(ref location1, value) + value;
}
- /******************************
- * Read
- *****************************/
public static long Read(ref long location)
{
return Interlocked.CompareExchange(ref location, 0, 0);
pdecOut.High = (uint)high;
}
- /***
- * Div96By32
- *
- * Entry:
- * bufNum - 96-bit dividend as array of ULONGs, least-sig first
- * ulDen - 32-bit divisor.
- *
- * Purpose:
- * Do full divide, yielding 96-bit result and 32-bit remainder.
- *
- * Exit:
- * Quotient overwrites dividend.
- * Returns remainder.
- *
- * Exceptions:
- * None.
- *
- ***********************************************************************/
+ /// <summary>
+ /// Do full divide, yielding 96-bit result and 32-bit remainder.
+ /// </summary>
+ /// <param name="bufNum">96-bit dividend as array of ULONGs, least-sig first</param>
+ /// <param name="ulDen">32-bit divisor</param>
+ /// <returns>remainder</returns>
private static uint Div96By32(ref Buf12 bufNum, uint ulDen)
{
// TODO: https://github.com/dotnet/coreclr/issues/3439
scale--;
}
- /***
- * Div96By64
- *
- * Entry:
- * bufNum - 96-bit dividend as array of ULONGs, least-sig first
- * sdlDen - 64-bit divisor.
- *
- * Purpose:
- * Do partial divide, yielding 32-bit result and 64-bit remainder.
- * Divisor must be larger than upper 64 bits of dividend.
- *
- * Exit:
- * Remainder overwrites lower 64-bits of dividend.
- * Returns quotient.
- *
- * Exceptions:
- * None.
- *
- ***********************************************************************/
+ /// <summary>
+ /// Do partial divide, yielding 32-bit result and 64-bit remainder.
+ /// Divisor must be larger than upper 64 bits of dividend.
+ /// </summary>
+ /// <param name="bufNum">96-bit dividend as array of ULONGs, least-sig first</param>
+ /// <param name="sdlDen">64-bit divisor</param>
+ /// <returns>quotient</returns>
private static uint Div96By64(ref Buf12 bufNum, ulong den)
{
uint quo;
return quo;
}
- /***
- * Div128By96
- *
- * Entry:
- * bufNum - 128-bit dividend as array of ULONGs, least-sig first
- * bufDen - 96-bit divisor.
- *
- * Purpose:
- * Do partial divide, yielding 32-bit result and 96-bit remainder.
- * Top divisor ULONG must be larger than top dividend ULONG. This is
- * assured in the initial call because the divisor is normalized
- * and the dividend can't be. In subsequent calls, the remainder
- * is multiplied by 10^9 (max), so it can be no more than 1/4 of
- * the divisor which is effectively multiplied by 2^32 (4 * 10^9).
- *
- * Exit:
- * Remainder overwrites lower 96-bits of dividend.
- * Returns quotient.
- *
- * Exceptions:
- * None.
- *
- ***********************************************************************/
+ /// <summary>
+ /// Do partial divide, yielding 32-bit result and 96-bit remainder.
+ /// Top divisor ULONG must be larger than top dividend ULONG. This is
+ /// assured in the initial call because the divisor is normalized
+ /// and the dividend can't be. In subsequent calls, the remainder
+ /// is multiplied by 10^9 (max), so it can be no more than 1/4 of
+ /// the divisor which is effectively multiplied by 2^32 (4 * 10^9).
+ /// </summary>
+ /// <param name="bufNum">128-bit dividend as array of ULONGs, least-sig first</param>
+ /// <param name="bufDen">96-bit divisor</param>
+ /// <returns>quotient</returns>
private static uint Div128By96(ref Buf16 bufNum, ref Buf12 bufDen)
{
ulong dividend = bufNum.High64;
return quo;
}
- /***
- * IncreaseScale
- *
- * Entry:
- * bufNum - 96-bit number as array of ULONGs, least-sig first
- * ulPwr - Scale factor to multiply by
- *
- * Purpose:
- * Multiply the two numbers. The low 96 bits of the result overwrite
- * the input. The last 32 bits of the product are the return value.
- *
- * Exit:
- * Returns highest 32 bits of product.
- *
- * Exceptions:
- * None.
- *
- ***********************************************************************/
+ /// <summary>
+ /// Multiply the two numbers. The low 96 bits of the result overwrite
+ /// the input. The last 32 bits of the product are the return value.
+ /// </summary>
+ /// <param name="bufNum">96-bit number as array of ULONGs, least-sig first</param>
+ /// <param name="ulPwr">Scale factor to multiply by</param>
+ /// <returns>Returns highest 32 bits of product</returns>
private static uint IncreaseScale(ref Buf12 bufNum, uint ulPwr)
{
ulong tmp = UInt32x32To64(bufNum.U0, ulPwr);
bufNum.High64 = tmp;
}
- /***
- * ScaleResult
- *
- * Entry:
- * bufRes - Array of ULONGs with value, least-significant first.
- * iHiRes - Index of last non-zero value in bufRes.
- * iScale - Scale factor for this value, range 0 - 2 * DEC_SCALE_MAX
- *
- * Purpose:
- * See if we need to scale the result to fit it in 96 bits.
- * Perform needed scaling. Adjust scale factor accordingly.
- *
- * Exit:
- * bufRes updated in place, always 3 ULONGs.
- * New scale factor returned.
- *
- ***********************************************************************/
+ /// <summary>
+ /// See if we need to scale the result to fit it in 96 bits.
+ /// Perform needed scaling. Adjust scale factor accordingly.
+ /// </summary>
+ /// <param name="bufRes">Array of ULONGs with value, least-significant first</param>
+ /// <param name="iHiRes">Index of last non-zero value in bufRes
+ /// <param name="iScale">Scale factor for this value, range 0 - 2 * DEC_SCALE_MAX</param>
+ /// <returns>New scale factor</returns>
private static unsafe int ScaleResult(Buf24* bufRes, uint iHiRes, int iScale)
{
Debug.Assert(iHiRes < bufRes->Length);
return iScale;
}
- /***
- * SearchScale
- *
- * Entry:
- * bufQuo - 96-bit quotient
- * iScale - Scale factor of quotient, range -DEC_SCALE_MAX to DEC_SCALE_MAX-1
- *
- * Purpose:
- * Determine the max power of 10, <= 9, that the quotient can be scaled
- * up by and still fit in 96 bits.
- *
- * Exit:
- * Returns power of 10 to scale by.
- *
- ***********************************************************************/
+ /// <summary>
+ /// Determine the max power of 10, <= 9, that the quotient can be scaled
+ /// up by and still fit in 96 bits.
+ /// </summary>
+ /// <param name="bufQuo">96-bit quotient</param>
+ /// <param name="iScale ">Scale factor of quotient, range -DEC_SCALE_MAX to DEC_SCALE_MAX-1</param>
+ /// <returns>power of 10 to scale by</returns>
private static int SearchScale(ref Buf12 bufQuo, int iScale)
{
const uint OVFL_MAX_9_HI = 4;
#endregion
- //**********************************************************************
- // VarCyFromDec - Convert Currency to Decimal (similar to OleAut32 api.)
- //**********************************************************************
+ /// <summary>
+ /// Convert Currency to Decimal (similar to OleAut32 api.)
+ /// </summary>
internal static long VarCyFromDec(ref DecCalc pdecIn)
{
long value;
throw new OverflowException(SR.Overflow_Currency);
}
- //**********************************************************************
- // VarDecCmp - Decimal Compare updated to return values similar to ICompareTo
- //**********************************************************************
+ /// <summary>
+ /// Decimal Compare updated to return values similar to ICompareTo
+ /// </summary>
internal static int VarDecCmp(in decimal pdecL, in decimal pdecR)
{
if ((pdecR.Low | pdecR.Mid | pdecR.High) == 0)
return sign;
}
- //**********************************************************************
- // VarDecMul - Decimal Multiply
- //**********************************************************************
+ /// <summary>
+ /// Decimal Multiply
+ /// </summary>
internal static unsafe void VarDecMul(ref DecCalc pdecL, ref DecCalc pdecR)
{
int iScale = (byte)(pdecL.uflags + pdecR.uflags >> ScaleShift);
pdecL = default;
}
- //**********************************************************************
- // VarDecFromR4 - Convert float to Decimal
- //**********************************************************************
+ /// <summary>
+ /// Convert float to Decimal
+ /// </summary>
internal static void VarDecFromR4(float input, out DecCalc pdecOut)
{
pdecOut = default;
pdecOut.uflags = flags;
}
- //**********************************************************************
- // VarDecFromR8 - Convert double to Decimal
- //**********************************************************************
+ /// <summary>
+ /// Convert double to Decimal
+ /// </summary>
internal static void VarDecFromR8(double input, out DecCalc pdecOut)
{
pdecOut = default;
pdecOut.uflags = flags;
}
- //**********************************************************************
- // VarR4ToDec - Convert Decimal to float
- //**********************************************************************
+ /// <summary>
+ /// Convert Decimal to float
+ /// </summary>
internal static float VarR4FromDec(ref decimal pdecIn)
{
return (float)VarR8FromDec(ref pdecIn);
}
- //**********************************************************************
- // VarR8ToDec - Convert Decimal to double
- //**********************************************************************
+ /// <summary>
+ /// Convert Decimal to double
+ /// </summary>
internal static double VarR8FromDec(ref decimal pdecIn)
{
// Value taken via reverse engineering the double that corresponds to 2^64. (oleaut32 has ds2to64 = DEFDS(0, 0, DBLBIAS + 65, 0))
throw new OverflowException(SR.Overflow_Decimal);
}
- //**********************************************************************
- // VarDecMod - Computes the remainder between two decimals
- //**********************************************************************
+ /// <summary>
+ /// Computes the remainder between two decimals
+ /// </summary>
internal static void VarDecMod(ref DecCalc d1, ref DecCalc d2)
{
if ((d2.ulo | d2.umid | d2.uhi) == 0)