├── .gitattributes ├── .github └── workflows │ ├── build.yml │ └── publish.yml ├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── ILAssembler.build.ps1 ├── ILAssemblier.sln ├── LICENSE.txt ├── README.md ├── build.ps1 ├── docs └── en-US │ ├── New-IlDelegate.md │ ├── about_BadImageFormat.md │ ├── add.md │ ├── add.ovf.md │ ├── add.ovf.un.md │ ├── and.md │ ├── arglist.md │ ├── beq.md │ ├── beq.s.md │ ├── bge.md │ ├── bge.s.md │ ├── bge.un.md │ ├── bge.un.s.md │ ├── bgt.md │ ├── bgt.s.md │ ├── bgt.un.md │ ├── bgt.un.s.md │ ├── ble.md │ ├── ble.s.md │ ├── ble.un.md │ ├── ble.un.s.md │ ├── blt.md │ ├── blt.s.md │ ├── blt.un.md │ ├── blt.un.s.md │ ├── bne.un.md │ ├── bne.un.s.md │ ├── box.md │ ├── br.md │ ├── br.s.md │ ├── break.md │ ├── brfalse.md │ ├── brfalse.s.md │ ├── brtrue.md │ ├── brtrue.s.md │ ├── call.md │ ├── calli.md │ ├── callvirt.md │ ├── castclass.md │ ├── ceq.md │ ├── cgt.md │ ├── cgt.un.md │ ├── ckfinite.md │ ├── clt.md │ ├── clt.un.md │ ├── constrained..md │ ├── conv.i.md │ ├── conv.i1.md │ ├── conv.i2.md │ ├── conv.i4.md │ ├── conv.i8.md │ ├── conv.ovf.i.md │ ├── conv.ovf.i.un.md │ ├── conv.ovf.i1.md │ ├── conv.ovf.i1.un.md │ ├── conv.ovf.i2.md │ ├── conv.ovf.i2.un.md │ ├── conv.ovf.i4.md │ ├── conv.ovf.i4.un.md │ ├── conv.ovf.i8.md │ ├── conv.ovf.i8.un.md │ ├── conv.ovf.u.md │ ├── conv.ovf.u.un.md │ ├── conv.ovf.u1.md │ ├── conv.ovf.u1.un.md │ ├── conv.ovf.u2.md │ ├── conv.ovf.u2.un.md │ ├── conv.ovf.u4.md │ ├── conv.ovf.u4.un.md │ ├── conv.ovf.u8.md │ ├── conv.ovf.u8.un.md │ ├── conv.r.un.md │ ├── conv.r4.md │ ├── conv.r8.md │ ├── conv.u.md │ ├── conv.u1.md │ ├── conv.u2.md │ ├── conv.u4.md │ ├── conv.u8.md │ ├── cpblk.md │ ├── cpobj.md │ ├── div.md │ ├── div.un.md │ ├── dup.md │ ├── endfilter.md │ ├── endfinally.md │ ├── initblk.md │ ├── initobj.md │ ├── isinst.md │ ├── jmp.md │ ├── ldarg.0.md │ ├── ldarg.1.md │ ├── ldarg.2.md │ ├── ldarg.3.md │ ├── ldarg.md │ ├── ldarg.s.md │ ├── ldarga.md │ ├── ldarga.s.md │ ├── ldc.i4.0.md │ ├── ldc.i4.1.md │ ├── ldc.i4.2.md │ ├── ldc.i4.3.md │ ├── ldc.i4.4.md │ ├── ldc.i4.5.md │ ├── ldc.i4.6.md │ ├── ldc.i4.7.md │ ├── ldc.i4.8.md │ ├── ldc.i4.m1.md │ ├── ldc.i4.md │ ├── ldc.i4.s.md │ ├── ldc.i8.md │ ├── ldc.r4.md │ ├── ldc.r8.md │ ├── ldelem.i.md │ ├── ldelem.i1.md │ ├── ldelem.i2.md │ ├── ldelem.i4.md │ ├── ldelem.i8.md │ ├── ldelem.md │ ├── ldelem.r4.md │ ├── ldelem.r8.md │ ├── ldelem.ref.md │ ├── ldelem.u1.md │ ├── ldelem.u2.md │ ├── ldelem.u4.md │ ├── ldelema.md │ ├── ldfld.md │ ├── ldflda.md │ ├── ldftn.md │ ├── ldind.i.md │ ├── ldind.i1.md │ ├── ldind.i2.md │ ├── ldind.i4.md │ ├── ldind.i8.md │ ├── ldind.r4.md │ ├── ldind.r8.md │ ├── ldind.ref.md │ ├── ldind.u1.md │ ├── ldind.u2.md │ ├── ldind.u4.md │ ├── ldlen.md │ ├── ldloc.0.md │ ├── ldloc.1.md │ ├── ldloc.2.md │ ├── ldloc.3.md │ ├── ldloc.auto.md │ ├── ldloc.md │ ├── ldloc.s.md │ ├── ldloca.auto.md │ ├── ldloca.md │ ├── ldloca.s.md │ ├── ldnull.md │ ├── ldobj.md │ ├── ldsfld.md │ ├── ldsflda.md │ ├── ldstr.md │ ├── ldtoken.md │ ├── ldvirtftn.md │ ├── leave.md │ ├── leave.s.md │ ├── localloc.md │ ├── mkrefany.md │ ├── mul.md │ ├── mul.ovf.md │ ├── mul.ovf.un.md │ ├── neg.md │ ├── newarr.md │ ├── newobj.md │ ├── nop.md │ ├── not.md │ ├── or.md │ ├── pop.md │ ├── readonly..md │ ├── refanytype.md │ ├── refanyval.md │ ├── rem.md │ ├── rem.un.md │ ├── ret.md │ ├── rethrow.md │ ├── shl.md │ ├── shr.md │ ├── shr.un.md │ ├── sizeof.md │ ├── starg.md │ ├── starg.s.md │ ├── stelem.i.md │ ├── stelem.i1.md │ ├── stelem.i2.md │ ├── stelem.i4.md │ ├── stelem.i8.md │ ├── stelem.md │ ├── stelem.r4.md │ ├── stelem.r8.md │ ├── stelem.ref.md │ ├── stfld.md │ ├── stind.i.md │ ├── stind.i1.md │ ├── stind.i2.md │ ├── stind.i4.md │ ├── stind.i8.md │ ├── stind.r4.md │ ├── stind.r8.md │ ├── stind.ref.md │ ├── stloc.0.md │ ├── stloc.1.md │ ├── stloc.2.md │ ├── stloc.3.md │ ├── stloc.auto.md │ ├── stloc.md │ ├── stloc.s.md │ ├── stobj.md │ ├── stsfld.md │ ├── sub.md │ ├── sub.ovf.md │ ├── sub.ovf.un.md │ ├── switch.md │ ├── tailcall.md │ ├── throw.md │ ├── unaligned..md │ ├── unbox.any.md │ ├── unbox.md │ ├── volatile..md │ └── xor.md ├── examples └── InvokeInlineAssembly.ps1 ├── module ├── ILAssembler.psd1 └── ILAssembler.psm1 ├── requirements.psd1 ├── src └── ILAssembler │ ├── AstExtensions.cs │ ├── BranchBuilder.cs │ ├── CilAssemblage.cs │ ├── CilAssembler.cs │ ├── CilAssemblerBase.cs │ ├── CilAssemblyContext.cs │ ├── Commands │ └── NewIlDelegateCommand.cs │ ├── ConstructorIdentifier.cs │ ├── Debug.cs │ ├── DelegateTypeFactory.cs │ ├── DoesNotReturnAttribute.cs │ ├── EncoderExtensions.cs │ ├── ErrorRecordInfo.cs │ ├── ExceptionExtensions.cs │ ├── ExceptionHandlerReader.cs │ ├── ExtentOps.cs │ ├── FieldIdentifier.cs │ ├── FieldSignatureParser.cs │ ├── FindMemberTypeAstVisitor.cs │ ├── GlobalSuppressions.cs │ ├── HashCode.cs │ ├── ILAssembler.csproj │ ├── ILParseException.cs │ ├── IReadOnlyListExtensions.cs │ ├── InstructionArguments.cs │ ├── LocalSignatureParser.cs │ ├── MemberIdentifier.cs │ ├── MemberSignatureParser.cs │ ├── MethodIdentifier.cs │ ├── MethodSignatureParser.cs │ ├── NameExpectation.cs │ ├── OpCodeStore.cs │ ├── OpCodes │ ├── AnyTokenOpCodeInfo.cs │ ├── AutoLocalOpCodeInfo.cs │ ├── BranchOpCodeInfo.cs │ ├── ByteOpCodeInfo.cs │ ├── CalliOpCodeInfo.cs │ ├── ConstructorOpCodeInfo.cs │ ├── DoubleOpCodeInfo.cs │ ├── EmitOpCode.cs │ ├── FieldOpCodeInfo.cs │ ├── GeneralOpCodeInfo.cs │ ├── Int32OpCodeInfo.cs │ ├── Int64OpCodeInfo.cs │ ├── MethodOpCodeInfo.cs │ ├── NoOperandOpCodeInfo.cs │ ├── OpCodeInfo.cs │ ├── SingleNumericArgumentOpCodeInfo.cs │ ├── SingleOpCodeInfo.cs │ ├── StringOpCodeInfo.cs │ ├── SwitchOpCodeInfo.cs │ ├── TokenOpCodeInfo.cs │ ├── TypeOpCodeInfo.cs │ └── VariableExpressionOpCodeInfo.cs │ ├── RangePolyfill.cs │ ├── ReadOnlyListSegment.cs │ ├── SR.cs │ ├── SR.resx │ ├── ScopedState.cs │ ├── SignatureKey.cs │ ├── SignatureParser.cs │ ├── SpecialTypes.cs │ ├── Throw.cs │ ├── TypeArgumentSignatureParser.cs │ ├── TypeResolver.cs │ ├── TypeSignatureParser.cs │ ├── TypedIdentifier.cs │ ├── TypedIdentifierExtensions.cs │ └── ValueList.cs ├── tests ├── Common.ps1 ├── DelegateSignatures.tests.ps1 └── OpCodeSignatures.tests.ps1 └── tools ├── GetDotNet.ps1 └── MarkdownToMaml.ps1 /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | env: 12 | DOTNET_CLI_TELEMETRY_OPTOUT: 1 13 | POWERSHELL_TELEMETRY_OPTOUT: 1 14 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 15 | DOTNET_NOLOGO: true 16 | 17 | defaults: 18 | run: 19 | shell: pwsh 20 | 21 | jobs: 22 | build: 23 | name: Build and Test 24 | runs-on: ${{ matrix.os }} 25 | strategy: 26 | fail-fast: false 27 | matrix: 28 | os: [ ubuntu-latest, macos-latest, windows-latest ] 29 | steps: 30 | - uses: actions/checkout@v1 31 | - name: Enable null conditional operators 32 | run: Enable-ExperimentalFeature PSNullConditionalOperators -ErrorAction Ignore -WarningAction Ignore 33 | - name: Test and Build 34 | run: ./build.ps1 -Force 35 | - uses: actions/upload-artifact@v1 36 | if: matrix.os == 'windows-latest' 37 | with: 38 | name: ILAssembler 39 | path: ./Release/ILAssembler 40 | - uses: actions/upload-artifact@v1 41 | if: matrix.os != 'windows-latest' 42 | with: 43 | name: ILAssembler-${{ matrix.os }} 44 | path: ./Release/ILAssembler 45 | - name: Upload Test Results 46 | if: always() 47 | uses: actions/upload-artifact@v2 48 | with: 49 | name: Unit Test Results (${{ matrix.os }}) 50 | path: ./TestResults/Pester.xml 51 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | on: 3 | release: 4 | types: [ published ] 5 | 6 | env: 7 | DOTNET_CLI_TELEMETRY_OPTOUT: 1 8 | POWERSHELL_TELEMETRY_OPTOUT: 1 9 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 10 | DOTNET_NOLOGO: true 11 | 12 | 13 | defaults: 14 | run: 15 | shell: pwsh 16 | 17 | jobs: 18 | build: 19 | name: Publish 20 | runs-on: windows-latest 21 | steps: 22 | - uses: actions/checkout@v1 23 | - name: Enable null conditional operators 24 | run: Enable-ExperimentalFeature PSNullConditionalOperators -ErrorAction Ignore -WarningAction Ignore 25 | - name: Test and Build 26 | run: ./build.ps1 -Force -Publish 27 | env: 28 | GALLERY_API_KEY: ${{ secrets.GALLERY_API_KEY }} 29 | - name: Upload Test Results 30 | if: always() 31 | uses: actions/upload-artifact@v2 32 | with: 33 | name: Unit Test Results 34 | path: ./TestResults/Pester.xml 35 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": ".NET Core Attach", 9 | "type": "coreclr", 10 | "request": "attach", 11 | "processId": "${command:pickProcess}", 12 | }, 13 | { 14 | "name": ".NET Core Attach - non-JMC", 15 | "type": "coreclr", 16 | "request": "attach", 17 | "processId": "${command:pickProcess}", 18 | "justMyCode": false, 19 | }, 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "build", 8 | "command": "dotnet", 9 | "type": "shell", 10 | "args": [ 11 | "build", 12 | // Ask dotnet build to generate full paths for file names. 13 | "/property:GenerateFullPaths=true", 14 | // Do not generate summary otherwise it leads to duplicate errors in Problems panel 15 | "/consoleloggerparameters:NoSummary" 16 | ], 17 | "group": { 18 | "isDefault": true, 19 | "kind": "build", 20 | }, 21 | "problemMatcher": "$msCompile" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Patrick Meinecke 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param( 3 | [Parameter()] 4 | [ValidateSet('Debug', 'Release')] 5 | [string] $Configuration = 'Release', 6 | 7 | [Parameter()] 8 | [switch] $Force, 9 | 10 | [Parameter()] 11 | [switch] $Publish 12 | ) 13 | end { 14 | $IsUnix = $PSEdition -eq 'Core' -and -not $IsWindows 15 | $requirements = Import-PowerShellDataFile $PSScriptRoot\requirements.psd1 16 | foreach ($requirement in $requirements.GetEnumerator()) { 17 | if ($requirement.Key -match 'Dotnet') { 18 | $global:dotnet = & "$PSScriptRoot/tools/GetDotNet.ps1" -Version $requirement.Value -Unix:$IsUnix 19 | continue 20 | } 21 | 22 | $importModuleSplat = @{ 23 | MinimumVersion = $requirement.Value 24 | Force = $true 25 | ErrorAction = 'Ignore' 26 | PassThru = $true 27 | Name = $requirement.Key 28 | } 29 | 30 | if (-not (Import-Module @importModuleSplat)) { 31 | $installModuleSplat = @{ 32 | MinimumVersion = $requirement.Value 33 | Scope = 'CurrentUser' 34 | AllowClobber = $true 35 | AllowPrerelease = $true 36 | SkipPublisherCheck = $true 37 | Force = $true 38 | Name = $requirement.Key 39 | } 40 | 41 | Install-Module @installModuleSplat -ErrorAction Stop 42 | $importModuleSplat['ErrorAction'] = 'Stop' 43 | $null = Import-Module @importModuleSplat 44 | } 45 | } 46 | 47 | if ($Publish) { 48 | $ibTask = 'Publish' 49 | } else { 50 | $ibTask = 'Test' 51 | } 52 | 53 | $invokeBuildSplat = @{ 54 | Task = $ibTask 55 | File = "$PSScriptRoot/ILAssembler.build.ps1" 56 | Force = $Force.IsPresent 57 | Configuration = $Configuration 58 | } 59 | 60 | Invoke-Build @invokeBuildSplat 61 | } 62 | -------------------------------------------------------------------------------- /docs/en-US/and.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.and 4 | schema: 2.0.0 5 | --- 6 | 7 | # and 8 | 9 | ## SYNOPSIS 10 | 11 | Computes the bitwise AND of two values and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | and 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Instruction | 24 | | ------ | ----------- | 25 | | 5F | and | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value1` and `value2` are popped from the stack; the bitwise AND of the two values is computed. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `and` instruction computes the bitwise AND of the top two values on the stack and leaves the result on the stack. 38 | 39 | `and` is an integer-specific operation. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/arglist.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.arglist 4 | schema: 2.0.0 5 | --- 6 | 7 | # arglist 8 | 9 | ## SYNOPSIS 10 | 11 | Returns an unmanaged pointer to the argument list of the current method. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | arglist 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 00 | arglist | 26 | 27 | No evaluation stack behaviors are performed by this operation. 28 | 29 | The `arglist` instruction returns an opaque handle (an unmanaged pointer, of type `native int`) that represents the argument list of the current method. This handle is valid only during the lifetime of the current method. You can, however, pass the handle to other methods as long as the current method is on the thread of control. You can only execute the `arglist` instruction within a method that takes a variable number of arguments. 30 | 31 | ## INPUTS 32 | 33 | ### None 34 | 35 | This function cannot be used with the pipeline. 36 | 37 | ## OUTPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/en-US/br.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.br 4 | schema: 2.0.0 5 | --- 6 | 7 | # br 8 | 9 | ## SYNOPSIS 10 | 11 | Unconditionally transfers control to a target instruction. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | br 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | -------------- | --------------- | 25 | | 38 < `int32` > | br `target` | 26 | 27 | No evaluation stack behaviors are performed by this operation. 28 | 29 | The `br` instruction unconditionally transfers control to a target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction. 30 | 31 | If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction. 32 | 33 | ## PARAMETERS 34 | 35 | ### -branch 36 | 37 | Specifies the label representing the target offset. 38 | 39 | ```yaml 40 | Type: branch_name 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/br.s.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.br_s 4 | schema: 2.0.0 5 | --- 6 | 7 | # br.s 8 | 9 | ## SYNOPSIS 10 | 11 | Unconditionally transfers control to a target instruction (short form). 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | br.s 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------------- | --------------- | 25 | | 2B < `int8` > | br.s `target` | 26 | 27 | No evaluation stack behaviors are performed by this operation. 28 | 29 | The `br.s` instruction unconditionally transfers control to a target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction. 30 | 31 | If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction. 32 | 33 | ## PARAMETERS 34 | 35 | ### -branch 36 | 37 | Specifies the label representing the target offset. 38 | 39 | ```yaml 40 | Type: branch_name 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/break.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.break 4 | schema: 2.0.0 5 | --- 6 | 7 | # break 8 | 9 | ## SYNOPSIS 10 | 11 | Signals the Common Language Infrastructure (CLI) to inform the debugger that a break point has been tripped. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | break 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 01 | break | 26 | 27 | No evaluation stack behaviors are performed by this operation. 28 | 29 | The `break` instruction is for debugging support. It signals the CLI to inform the debugger that a break point has been tripped. It has no other effect on the interpreter state. 30 | 31 | The `break` instruction has the smallest possible instruction size enabling code patching with a break point and generating minimal disturbance to the surrounding code. 32 | 33 | The `break` instruction can trap to a debugger, do nothing, or raise a security exception. The exact behavior is implementation-defined. 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/ceq.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ceq 4 | schema: 2.0.0 5 | --- 6 | 7 | # ceq 8 | 9 | ## SYNOPSIS 10 | 11 | Compares two values. If they are equal, the integer value `1` (`int32`) is pushed onto the evaluation stack; otherwise `0` (`int32`) is pushed onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ceq 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 01 | ceq | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value1` is compared to `value2`. 34 | 35 | 4. If `value1` is equal to `value2`, 1 is pushed onto the stack; otherwise 0 is pushed onto the stack. 36 | 37 | The `ceq` instruction compares `value1` and `value2`. If `value1` is equal to `value2`, then `1` (of type `int32`) is pushed on the stack. Otherwise `0` (of type `int32`) is pushed on the stack. 38 | 39 | For floating-point number, `ceq` will return `0` if the numbers are unordered (either or both are `NaN`). The infinite values are equal to themselves. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/cgt.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.cgt 4 | schema: 2.0.0 5 | --- 6 | 7 | # cgt 8 | 9 | ## SYNOPSIS 10 | 11 | Compares two values. If the first value is greater than the second, the integer value `1` (`int32`) is pushed onto the evaluation stack; otherwise `0` (`int32`) is pushed onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | cgt 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 02 | cgt | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `cgt` tests if `value1` is greater than `value2`. 34 | 35 | 4. If `value1` is greater than `value2`, 1 is pushed onto the stack; otherwise 0 is pushed onto the stack. 36 | 37 | The `cgt` instruction compares `value1` and `value2`. If `value1` is strictly greater than `value2`, then an `int32` value of 1 is pushed on the stack. Otherwise, an `int32` value of 0 is pushed on the stack. 38 | 39 | - For floating-point numbers, `cgt` returns 0 if the numbers are unordered (that is, if one or both of the arguments are NaN). 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/cgt.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.cgt_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # cgt.un 8 | 9 | ## SYNOPSIS 10 | 11 | Compares two unsigned or unordered values. If the first value is greater than the second, the integer value 1 (`int32`) is pushed onto the evaluation stack; otherwise 0 (`int32`) is pushed onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | cgt.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 03 | cgt.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `cgt.un` tests if `value1` is greater than `value2`. 34 | 35 | 4. If `value1` is greater than `value2`, 1 is pushed onto the stack; otherwise 0 is pushed onto the stack. 36 | 37 | An `int32` value of 1 is pushed on the stack if any of the following is `true` : 38 | 39 | For floating-point numbers, `value1` is not ordered with respect to `value2`. 40 | 41 | For integer values, `value1` is strictly greater than `value2` when considered as unsigned numbers. 42 | 43 | Otherwise an `int32` value of 0 is pushed on the stack. 44 | 45 | ## INPUTS 46 | 47 | ### None 48 | 49 | This function cannot be used with the pipeline. 50 | 51 | ## OUTPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## NOTES 58 | 59 | ## RELATED LINKS 60 | -------------------------------------------------------------------------------- /docs/en-US/ckfinite.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ckfinite 4 | schema: 2.0.0 5 | --- 6 | 7 | # ckfinite 8 | 9 | ## SYNOPSIS 10 | 11 | Throws `System.ArithmeticException` if value is not a finite number. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ckfinite 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | C3 | ckfinite | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the `ckfinite` instruction is performed on it. 32 | 33 | 3. `value` is pushed back onto the stack if no exception is thrown. 34 | 35 | The `ckfinite` instruction throws `System.ArithmeticException` if `value` (a floating-point number) is either a "not a number" value (NaN) or a `+-` infinity value. `Ckfinite` leaves the value on the stack if no exception is thrown. Execution is unspecified if `value` is not a floating-point number. 36 | 37 | `System.ArithmeticException` is thrown if `value` is not a 'normal' number. 38 | 39 | Note that a special exception or a derived class of `System.ArithmeticException` may be more appropriate, passing the incorrect value to the exception handler. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/clt.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.clt 4 | schema: 2.0.0 5 | --- 6 | 7 | # clt 8 | 9 | ## SYNOPSIS 10 | 11 | Compares two values. If the first value is less than the second, the integer value 1 (`int32`) is pushed onto the evaluation stack; otherwise 0 (`int32`) is pushed onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | clt 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 04 | clt | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `clt` tests if `value1` is less than `value2`. 34 | 35 | 4. If `value1` is less than `value2`, 1 is pushed onto the stack; otherwise 0 is pushed onto the stack. 36 | 37 | The `clt` instruction compares `value1` and `value2`. If `value1` is strictly less than `value2`, then an `int32` value of 1 is pushed on the stack. Otherwise, an `int32` value of 0 is pushed on the stack. 38 | 39 | - For floating-point numbers, `clt` returns 0 if the numbers are unordered (that is, if one or both of the arguments are NaN). 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/clt.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.clt_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # clt.un 8 | 9 | ## SYNOPSIS 10 | 11 | Compares the unsigned or unordered values `value1` and `value2`. If `value1` is less than `value2`, then the integer value 1 (`int32`) is pushed onto the evaluation stack; otherwise 0 (`int32`) is pushed onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | clt.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 05 | clt.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `clt.un` tests if `value1` is less than `value2`. 34 | 35 | 4. If `value1` is less than `value2`, 1 is pushed onto the stack; otherwise 0 is pushed onto the stack. 36 | 37 | The `clt.un` instruction compares `value1` and `value2`. An `int32` value of 1 is pushed on the stack if any of the following is true: 38 | 39 | - `value1` is strictly less than `value2` (as for `clt`). 40 | 41 | - For floating-point numbers, `value1` is not ordered with respect to `value2`. 42 | 43 | - For integer values, `value1` is strictly less than `value2` when considered as unsigned numbers. 44 | 45 | Otherwise, an `int32` value of 0 is pushed on the stack. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.i.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_i 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.i 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the signed value on top of the evaluation stack to signed `native int`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.i 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | D4 | conv.ovf.i | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.i` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.i.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_i_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.i.un 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the unsigned value on top of the evaluation stack to signed `native int`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.i.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 8A | conv.ovf.i.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.i.un` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.i4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_i4 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.i4 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the signed value on top of the evaluation stack to signed `int32`, throwing `System.OverflowException` /> on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.i4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | B7 | conv.ovf.i4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.i4` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.i4.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_i4_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.i4.un 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the unsigned value on top of the evaluation stack to signed `int32`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.i4.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 84 | conv.ovf.i4.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.i4.un` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.i8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_i8 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.i8 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the signed value on top of the evaluation stack to signed `int64`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.i8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | B9 | conv.ovf.i8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.i8` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.i8.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_i8_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.i8.un 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the unsigned value on top of the evaluation stack to signed `int64`, throwing `System.OverflowException` /> on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.i8.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 85 | conv.ovf.i8.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.i8.un` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.u.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_u 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.u 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the signed value on top of the evaluation stack to `unsigned native int`, throwing `System.OverflowException` /> on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.u 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | D5 | conv.ovf.u | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.u` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.u.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_u_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.u.un 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the unsigned value on top of the evaluation stack to `unsigned native int`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.u.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 8B | conv.ovf.u.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.u.un` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.u4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_u4 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.u4 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the signed value on top of the evaluation stack to `unsigned int32`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.u4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | B8 | conv.ovf.u4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.u4` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.u4.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_u4_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.u4.un 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the unsigned value on top of the evaluation stack to `unsigned int32`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.u4.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 88 | conv.ovf.u4.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.u4.un` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.u8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_u8 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.u8 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the signed value on top of the evaluation stack to `unsigned int64`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.u8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | BA | conv.ovf.u8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.u8` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/conv.ovf.u8.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_ovf_u8_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # conv.ovf.u8.un 8 | 9 | ## SYNOPSIS 10 | 11 | Converts the unsigned value on top of the evaluation stack to `unsigned int64`, throwing `System.OverflowException` on overflow. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | conv.ovf.u8.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 89 | conv.ovf.u8.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and the conversion operation is attempted. If overflow occurs, an exception is thrown. 32 | 33 | 3. If the conversion is successful, the resulting value is pushed onto the stack. 34 | 35 | The `conv.ovf.u8.un` opcode converts the `value` on top of the stack to the type specified in the opcode, and places that converted value on the top of the stack. If the value is too large or too small to be represented by the target type, an exception is thrown. 36 | 37 | Conversions from floating-point numbers to integer values truncate the number toward zero. Note that integer values of less than 4 bytes are extended to `int32` when they are loaded onto the evaluation stack (unless `conv.ovf.i` or `conv.ovf.u` are used, in which case the result is also `native int`). 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/div.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.div_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # div.un 8 | 9 | ## SYNOPSIS 10 | 11 | Divides two unsigned integer values and pushes the result (`int32`) onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | div.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 5C | div.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value1` is divided by `value2`. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `div.un` instruction computes `value1` divided by `value2`, both taken as unsigned integers, and pushes the `result` on the stack. 38 | 39 | ## INPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## OUTPUTS 46 | 47 | ### None 48 | 49 | This function cannot be used with the pipeline. 50 | 51 | ## NOTES 52 | 53 | ## RELATED LINKS 54 | -------------------------------------------------------------------------------- /docs/en-US/dup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.dup 4 | schema: 2.0.0 5 | --- 6 | 7 | # dup 8 | 9 | ## SYNOPSIS 10 | 11 | Copies the current topmost value on the evaluation stack, and then pushes the copy onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | dup 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 25 | dup | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped off of the stack for duplication. 32 | 33 | 3. `value` is pushed back onto the stack. 34 | 35 | 4. A duplicate value is pushed onto the stack. 36 | 37 | The `dup` instruction duplicates the top element of the stack, and leaves two identical values atop it. 38 | 39 | ## INPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## OUTPUTS 46 | 47 | ### None 48 | 49 | This function cannot be used with the pipeline. 50 | 51 | ## NOTES 52 | 53 | ## RELATED LINKS 54 | -------------------------------------------------------------------------------- /docs/en-US/initblk.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.initblk 4 | schema: 2.0.0 5 | --- 6 | 7 | # initblk 8 | 9 | ## SYNOPSIS 10 | 11 | Initializes a specified block of memory at a specific address to a given size and initial value. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | initblk 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 18 | initblk | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A starting address is pushed onto the stack. 30 | 31 | 2. An initialization value is pushed onto the stack. 32 | 33 | 3. The number of bytes to initialize is pushed onto the stack. 34 | 35 | 4. The number of bytes, the initialization value, and the starting address are popped from the stack, and the initialization is performed as per their values. 36 | 37 | The `initblk` instruction sets the number (`unsigned int32`) of bytes starting at the specified address (of type `native int`, `&`, or `*`) to the initialization value (of type `unsigned int8`). `initblk` assumes that the starting address is aligned to the natural size of the machine. 38 | 39 | The operation of the `initblk` instructions can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 40 | 41 | `System.NullReferenceException` may be thrown if an invalid address is detected. 42 | 43 | ## INPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## OUTPUTS 50 | 51 | ### None 52 | 53 | This function cannot be used with the pipeline. 54 | 55 | ## NOTES 56 | 57 | ## RELATED LINKS 58 | -------------------------------------------------------------------------------- /docs/en-US/jmp.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.jmp 4 | schema: 2.0.0 5 | --- 6 | 7 | # jmp 8 | 9 | ## SYNOPSIS 10 | 11 | Exits current method and jumps to specified method. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | jmp 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------- | --------------- | 25 | | 27 < `T` > | jmp `method` | 26 | 27 | There are no stack transition behaviors for this instruction. 28 | 29 | The `jmp` (jump) instruction transfers control to the method specified by `method`, which is a metadata token for a method reference. The current arguments are transferred to the destination method. 30 | 31 | The evaluation stack must be empty when this instruction is executed. The calling convention, number and type of arguments at the destination address must match that of the current method. 32 | 33 | The `jmp` instruction cannot be used to transferred control out of a `try`, `filter`, `catch`, or `finally` block. 34 | 35 | ## PARAMETERS 36 | 37 | ### -signature 38 | 39 | Specifies the target signature. 40 | 41 | ```yaml 42 | Type: signature 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ## INPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## OUTPUTS 60 | 61 | ### None 62 | 63 | This function cannot be used with the pipeline. 64 | 65 | ## NOTES 66 | 67 | ## RELATED LINKS 68 | -------------------------------------------------------------------------------- /docs/en-US/ldarg.0.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldarg_0 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldarg.0 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the argument at index 0 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldarg.0 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 02 | ldarg.0 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The argument value at index 0 is pushed onto the stack. 30 | 31 | The `ldarg.0` instruction is an efficient encoding for loading the argument value at index 0. 32 | 33 | The `ldarg.0` instruction pushes the argument indexed at 0 onto the evaluation stack. The `ldarg.0` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature. 34 | 35 | Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/ldarg.1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldarg_1 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldarg.1 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the argument at index 1 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldarg.1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 03 | ldarg.1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The argument value at index 1 is pushed onto the stack. 30 | 31 | The `ldarg.1` instruction is an efficient encoding for loading the argument value at index 1. 32 | 33 | The `ldarg.1` instruction pushes the argument indexed at 1 onto the evaluation stack. The `ldarg.1` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature. 34 | 35 | Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/ldarg.2.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldarg_2 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldarg.2 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the argument at index 2 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldarg.2 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 04 | ldarg.2 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The argument value at index 2 is pushed onto the stack. 30 | 31 | The `ldarg.2` instruction is an efficient encoding for loading the argument value at index 2. 32 | 33 | The `ldarg.2` instruction pushes the argument indexed at 2 onto the evaluation stack. The `ldarg.2` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature. 34 | 35 | Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/ldarg.3.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldarg_3 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldarg.3 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the argument at index 3 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldarg.3 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 05 | ldarg.3 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The argument value at index 3 is pushed onto the stack. 30 | 31 | The `ldarg.3` instruction is an efficient encoding for loading the argument value at index 3. 32 | 33 | The `ldarg.3` instruction pushes the argument indexed at 3 onto the evaluation stack. The `ldarg.3` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature. 34 | 35 | Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/ldarga.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldarga 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldarga 8 | 9 | ## SYNOPSIS 10 | 11 | Load an argument address onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldarga 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | -------------------------- | --------------- | 25 | | FE 0A < `unsigned int16` > | ldarga `index` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The address `addr` of the argument indexed by `index` is pushed onto the stack. 30 | 31 | The `ldarga` instruction fetches the address (of type `*`) of the argument indexed by `index`, where arguments are indexed from 0 onwards. The address `addr` is always aligned to a natural boundary on the target machine. 32 | 33 | For procedures that take a variable-length argument list, the `ldarga` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature. 34 | 35 | `ldarga` is used for by-ref parameter passing. For other cases, `ldarg` and `starg` should be used. 36 | 37 | ## PARAMETERS 38 | 39 | ### -index 40 | 41 | Specifies the index to load. 42 | 43 | ```yaml 44 | Type: int32 45 | Parameter Sets: (All) 46 | Aliases: 47 | 48 | Required: True 49 | Position: 1 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ## INPUTS 56 | 57 | ### None 58 | 59 | This function cannot be used with the pipeline. 60 | 61 | ## OUTPUTS 62 | 63 | ### None 64 | 65 | This function cannot be used with the pipeline. 66 | 67 | ## NOTES 68 | 69 | ## RELATED LINKS 70 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.0.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_0 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.0 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 0 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.0 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 16 | ldc.i4.0 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 0 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 0. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_1 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.1 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 1 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 17 | ldc.i4.1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 1 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 1. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.2.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_2 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.2 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 2 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.2 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 18 | ldc.i4.2 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 2 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 2. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.3.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_3 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.3 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 3 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.3 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 19 | ldc.i4.3 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 3 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 3. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_4 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.4 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 4 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 1A | ldc.i4.4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 4 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 4. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.5.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_5 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.5 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 4 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.5 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 1B | ldc.i4.5 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 5 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 5. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.6.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_6 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.6 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 4 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.6 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 1C | ldc.i4.6 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 6 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 6. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.7.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_7 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.7 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 4 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.7 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 1D | ldc.i4.7 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 7 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 7. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_8 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.8 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of 4 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 1E | ldc.i4.8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value 8 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value 8. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.m1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_m1 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.m1 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the integer value of -1 onto the evaluation stack as an `int32`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.m1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 15 | ldc.i4.m1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value -1 is pushed onto the stack. 30 | 31 | This is a special short encoding for the push of the integer value -1. All special short encodings push 4 byte integers on the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i4.s.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i4_s 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i4.s 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the supplied `int8` value onto the evaluation stack as an `int32`, short form. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i4.s 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------------- | --------------- | 25 | | 1F < `int8` > | ldc.i4.s `num` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value `num` is pushed onto the stack. 30 | 31 | `ldc.i4.s` is a more efficient encoding for pushing the integers from -128 to 127 onto the evaluation stack. 32 | 33 | ## PARAMETERS 34 | 35 | ### -value 36 | 37 | Specifies the constant to push onto the stack. 38 | 39 | ```yaml 40 | Type: branch_name 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/ldc.i8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_i8 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.i8 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes a supplied value of type `int64` onto the evaluation stack as an `int64`. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.i8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | -------------- | --------------- | 25 | | 21 < `int64` > | ldc.i8 `num` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value `num` is pushed onto the stack. 30 | 31 | This encoding pushes an `int64` value onto the stack. 32 | 33 | ## PARAMETERS 34 | 35 | ### -value 36 | 37 | Specifies the constant to push onto the stack. 38 | 39 | ```yaml 40 | Type: int64 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/ldc.r4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_r4 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.r4 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes a supplied value of type `float32` onto the evaluation stack as type `F` (float). 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.r4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------------- | --------------- | 25 | | 22 < `float32` > | ldc.r4 `num` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value `num` is pushed onto the stack. 30 | 31 | This encoding pushes a `float32` value onto the stack. 32 | 33 | ## PARAMETERS 34 | 35 | ### -value 36 | 37 | Specifies the constant to push onto the stack. 38 | 39 | ```yaml 40 | Type: branch_name 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/ldc.r8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldc_r8 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldc.r8 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes a supplied value of type `float64` onto the evaluation stack as type `F` (float). 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldc.r8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------------- | --------------- | 25 | | 23 < `float64` > | ldc.r8 `num` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value `num` is pushed onto the stack. 30 | 31 | This encoding pushes a `float64` value onto the stack. 32 | 33 | ## PARAMETERS 34 | 35 | ### -value 36 | 37 | Specifies the constant to push onto the stack. 38 | 39 | ```yaml 40 | Type: branch_name 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/ldelem.ref.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldelem_ref 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldelem.ref 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the element containing an object reference at a specified array index onto the top of the evaluation stack as type `O` (object reference). 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldelem.ref 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 9A | ldelem.ref | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference `array` is pushed onto the stack. 30 | 31 | 2. An index value `index` is pushed onto the stack. 32 | 33 | 3. `index` and `array` are popped from the stack; the value stored at position `index` in `array` is looked up. 34 | 35 | 4. The value is pushed onto the stack. 36 | 37 | The `ldelem.ref` instruction loads the value of the element with index `index` (type `native int`) in the zero-based one-dimensional array `array` and places it on the top of the stack. Arrays are objects and hence represented by a value of type `O`. 38 | 39 | The return value for `ldelem.ref` is type `O` (object reference). 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 44 | 45 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/ldftn.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldftn 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldftn 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes an unmanaged pointer (type `native int`) to the native code implementing a specific method onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldftn 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------------- | --------------- | 25 | | FE 06 < `T` > | ldftn `method` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The unmanaged pointer to a specific method is pushed onto the stack. 30 | 31 | The specific method (`method`) can be called using the `calli` instruction if it references a managed method (or a stub that transitions from managed to unmanaged code). 32 | 33 | The value returned points to native code using the CLR calling convention. This method pointer should not be passed to unmanaged native code as a callback routine. 34 | 35 | ## PARAMETERS 36 | 37 | ### -signature 38 | 39 | Specifies the target signature. 40 | 41 | ```yaml 42 | Type: signature 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ## INPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## OUTPUTS 60 | 61 | ### None 62 | 63 | This function cannot be used with the pipeline. 64 | 65 | ## NOTES 66 | 67 | ## RELATED LINKS 68 | -------------------------------------------------------------------------------- /docs/en-US/ldlen.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldlen 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldlen 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the number of elements of a zero-based, one-dimensional array onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldlen 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 8E | ldlen | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array is pushed onto the stack. 30 | 31 | 2. The array reference is popped from the stack and the length is computed. 32 | 33 | 3. The length is pushed onto the stack. 34 | 35 | Arrays are objects and hence represented by a value of type `O`. The length is returned as a `natural unsigned int`. 36 | 37 | `System.NullReferenceException` is thrown if the array reference is a null reference. 38 | 39 | ## INPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## OUTPUTS 46 | 47 | ### None 48 | 49 | This function cannot be used with the pipeline. 50 | 51 | ## NOTES 52 | 53 | ## RELATED LINKS 54 | -------------------------------------------------------------------------------- /docs/en-US/ldloc.0.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldloc_0 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloc.0 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the local variable at index 0 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloc.0 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 06 | ldloc.0 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The local variable value at the index 0 is pushed onto the stack. 30 | 31 | `ldloc.0` is an especially efficient encoding for `ldloc`, allowing access to the local variable at index 0. 32 | 33 | The type of the value is the same as the type of the local variable, which is specified in the method header. Local variables that are smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/ldloc.1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldloc_1 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloc.1 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the local variable at index 1 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloc.1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 07 | ldloc.1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The local variable value at the index 1 is pushed onto the stack. 30 | 31 | `ldloc.1` is an especially efficient encoding for `ldloc`, allowing access to the local variable at index 1. 32 | 33 | The type of the value is the same as the type of the local variable, which is specified in the method header. Local variables that are smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/ldloc.2.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldloc_2 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloc.2 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the local variable at index 2 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloc.2 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | Description | 24 | | ------ | --------------- | -------------------------------------------------------------- | 25 | | 08 | ldloc.2 | Loads the local variable at index 2 onto the evaluation stack. | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The local variable value at the index 2 is pushed onto the stack. 30 | 31 | `ldloc.2` is an especially efficient encoding for `ldloc`, allowing access to the local variable at index 2. 32 | 33 | The type of the value is the same as the type of the local variable, which is specified in the method header. Local variables that are smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/ldloc.3.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldloc_3 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloc.3 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the local variable at index 3 onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloc.3 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 09 | ldloc.3 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The local variable value at the index 3 is pushed onto the stack. 30 | 31 | `ldloc.3` is an especially efficient encoding for `ldloc`, allowing access to the local variable at index 3. 32 | 33 | The type of the value is the same as the type of the local variable, which is specified in the method header. Local variables that are smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/ldloc.auto.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://github.com/SeeminglyScience/ILAssembler/blob/master/docs/en-US/ldloc.auto.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloc.auto 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the specified local variable evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloc.auto 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The `ldloc.auto` instruction is a meta instruction specific to the `ILAssembler` PowerShell module. By passing a variable expression (e.g. `$varName`) that corresponds with a local defined in the `.locals` directive, this instruction will be replaced with the most appropriate `ldloc*` instruction. 22 | 23 | The stack transitional behavior, in sequential order, is: 24 | 25 | 1. The local variable value specified by the variable expression is pushed onto the stack. 26 | 27 | The type of the value is the same as the type of the local variable, which is specified in the method header. See Partition I. Local variables that are smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`). 28 | 29 | ## PARAMETERS 30 | 31 | ### -variable 32 | 33 | Specifies the variable to load. 34 | 35 | ```yaml 36 | Type: psvariable 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/ldloca.auto.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://github.com/SeeminglyScience/ILAssembler/blob/master/docs/en-US/ldloca.auto.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloca.auto 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the address of the specified local variable onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloca.auto 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The `ldloca.auto` instruction is a meta instruction specific to the `ILAssembler` PowerShell module. By passing a variable expression (e.g. `$varName`) that corresponds with a local defined in the `.locals` directive, this instruction will be replaced with the most appropriate `ldloca*` instruction. 22 | 23 | The stack transitional behavior, in sequential order, is: 24 | 25 | 1. The address stored in the specified local variable is pushed onto the stack. 26 | 27 | The `ldloca.auto` instruction pushes the address of the local variable number at the passed index onto the stack, where local variables are numbered 0 onwards. The value pushed on the stack is already aligned correctly for use with instructions like `ldind.i` and `stind.i`. The result is a transient pointer (type `*`). 28 | 29 | ## PARAMETERS 30 | 31 | ### -variable 32 | 33 | Specifies the variable to load. 34 | 35 | ```yaml 36 | Type: psvariable 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: True 41 | Position: 1 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/ldloca.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldloca 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloca 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the address of the local variable at a specific index onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloca 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | -------------------------- | --------------- | 25 | | FE OD < `unsigned int16` > | ldloca `index` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The address stored in the local variable at the specified index is pushed onto the stack. 30 | 31 | The `ldloca` instruction pushes the address of the local variable number at the passed index onto the stack, where local variables are numbered 0 onwards. The value pushed on the stack is already aligned correctly for use with instructions like `ldind.i` and `stind.i`. The result is a transient pointer (type `*`). 32 | 33 | ## PARAMETERS 34 | 35 | ### -index 36 | 37 | Specifies the index to load. 38 | 39 | ```yaml 40 | Type: int32 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: False 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | This function cannot be used with the pipeline. 56 | 57 | ## OUTPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | -------------------------------------------------------------------------------- /docs/en-US/ldloca.s.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldloca_s 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldloca.s 8 | 9 | ## SYNOPSIS 10 | 11 | Loads the address of the local variable at a specific index onto the evaluation stack, short form. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldloca.s 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------------------- | ---------------- | 25 | | 12 < `unsigned int8` > | ldloca.s `index` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The address stored in the local variable at the specified index is pushed onto the stack. 30 | 31 | The `ldloca.s` instruction pushes the address of the local variable number at the passed index onto the stack, where local variables are numbered 0 onwards. The value pushed on the stack is already aligned correctly for use with instructions like `ldind.i` and `stind.i`. The result is a transient pointer (type `*`). 32 | 33 | The `ldloca.s` instruction provides an efficient encoding for use with the local variables 0 through 255. 34 | 35 | ## PARAMETERS 36 | 37 | ### -index 38 | 39 | Specifies the index to load. 40 | 41 | ```yaml 42 | Type: byte 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ## INPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## OUTPUTS 60 | 61 | ### None 62 | 63 | This function cannot be used with the pipeline. 64 | 65 | ## NOTES 66 | 67 | ## RELATED LINKS 68 | -------------------------------------------------------------------------------- /docs/en-US/ldnull.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldnull 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldnull 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes a null reference (type `O`) onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldnull 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 14 | ldnull | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A null object reference is pushed onto the stack. 30 | 31 | `ldnull` pushes a null reference (type `O`) on the stack. This is used to initialize locations before they are populated with data, or when they become deprecated. 32 | 33 | `ldnull` provides a null reference that is size-independent. 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/ldsfld.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldsfld 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldsfld 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the value of a static field onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldsfld 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------- | --------------- | 25 | | 7E < `T` > | ldsfld `field` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The value of the specific field is pushed onto the stack. 30 | 31 | The `ldsfld` instruction pushes the value of a static (shared among all instances of a class) field on the stack. The return type is that associated with the passed metadata token `field`. 32 | 33 | The `ldsfld` instruction can have a `volatile.` prefix. 34 | 35 | ## PARAMETERS 36 | 37 | ### -signature 38 | 39 | Specifies the target signature. 40 | 41 | ```yaml 42 | Type: signature 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ## INPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## OUTPUTS 60 | 61 | ### None 62 | 63 | This function cannot be used with the pipeline. 64 | 65 | ## NOTES 66 | 67 | ## RELATED LINKS 68 | -------------------------------------------------------------------------------- /docs/en-US/ldstr.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldstr 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldstr 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes a new object reference to a string literal stored in the metadata. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldstr 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------- | --------------- | 25 | | 72 < `T` > | ldstr `mdToken` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to a string is pushed onto the stack. 30 | 31 | The `ldstr` instruction pushes an object reference (type `O`) to a new string object representing the specific string literal stored in the metadata. The `ldstr` instruction allocates the requisite amount of memory and performs any format conversion required to convert the string literal from the form used in the file to the string format required at runtime. 32 | 33 | The Common Language Infrastructure (CLI) guarantees that the result of two `ldstr` instructions referring to two metadata tokens that have the same sequence of characters return precisely the same string object (a process known as "string interning"). 34 | 35 | ## PARAMETERS 36 | 37 | ### -value 38 | 39 | Specifies the constant to push onto the stack. 40 | 41 | ```yaml 42 | Type: string 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ## INPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## OUTPUTS 60 | 61 | ### None 62 | 63 | This function cannot be used with the pipeline. 64 | 65 | ## NOTES 66 | 67 | ## RELATED LINKS 68 | -------------------------------------------------------------------------------- /docs/en-US/ldtoken.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.ldtoken 4 | schema: 2.0.0 5 | --- 6 | 7 | # ldtoken 8 | 9 | ## SYNOPSIS 10 | 11 | Converts a metadata token to its runtime representation, pushing it onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | ldtoken 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------- | --------------- | 25 | | D0 < `T` > | ldtoken `token` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The passed token is converted to a `RuntimeHandle` and pushed onto the stack. 30 | 31 | The `ldtoken` instruction pushes a `RuntimeHandle` for the specified metadata token. A `RuntimeHandle` can be a `fieldref/fielddef`, a `methodref/methoddef`, or a `typeref/typedef`. 32 | 33 | The value pushed on the stack can be used in calls to `Reflection` methods in the system class library. 34 | 35 | For information on runtime handles, see the following classes: `System.RuntimeFieldHandle`, `System.RuntimeTypeHandle`, and `System.RuntimeMethodHandle`. 36 | 37 | ## PARAMETERS 38 | 39 | ### -signature 40 | 41 | Specifies the target signature. 42 | 43 | ```yaml 44 | Type: signature 45 | Parameter Sets: (All) 46 | Aliases: 47 | 48 | Required: True 49 | Position: 1 50 | Default value: None 51 | Accept pipeline input: False 52 | Accept wildcard characters: False 53 | ``` 54 | 55 | ## INPUTS 56 | 57 | ### None 58 | 59 | This function cannot be used with the pipeline. 60 | 61 | ## OUTPUTS 62 | 63 | ### None 64 | 65 | This function cannot be used with the pipeline. 66 | 67 | ## NOTES 68 | 69 | ## RELATED LINKS 70 | -------------------------------------------------------------------------------- /docs/en-US/mul.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.mul 4 | schema: 2.0.0 5 | --- 6 | 7 | # mul 8 | 9 | ## SYNOPSIS 10 | 11 | Multiplies two values and pushes the result on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | mul 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 5A | mul | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value1` is multiplied by `value2`. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `mul` instruction multiplies `value1` by `value2` and pushes the result on the stack. Integer operations silently truncate the upper bits on overflow. 38 | 39 | See `mul.ovf` for an integer-specific multiply operation with overflow handling. 40 | 41 | For floating-point types, 0 * infinity = NaN. 42 | 43 | ## INPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## OUTPUTS 50 | 51 | ### None 52 | 53 | This function cannot be used with the pipeline. 54 | 55 | ## NOTES 56 | 57 | ## RELATED LINKS 58 | -------------------------------------------------------------------------------- /docs/en-US/mul.ovf.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.mul_ovf 4 | schema: 2.0.0 5 | --- 6 | 7 | # mul.ovf 8 | 9 | ## SYNOPSIS 10 | 11 | Multiplies two integer values, performs an overflow check, and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | mul.ovf 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | D8 | mul.ovf | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value1` is multiplied by `value2`, with an overflow check. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `mul.ovf` instruction multiplies integer `value1` by integer `value2` and pushes the result on the stack. An exception is thrown if the result will not fit in the result type. 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/mul.ovf.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.mul_ovf_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # mul.ovf.un 8 | 9 | ## SYNOPSIS 10 | 11 | Multiplies two unsigned integer values, performs an overflow check, and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | mul.ovf.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | D9 | mul.ovf.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value1` is multiplied by `value2`, with an overflow check. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `mul.ovf.un` instruction multiplies unsigned integer `value1` by unsigned integer `value2` and pushes the result on the stack. An exception is thrown if the result will not fit in the result type. 38 | 39 | `System.OverflowException` is thrown if the result can not be represented in the result type. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/neg.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.neg 4 | schema: 2.0.0 5 | --- 6 | 7 | # neg 8 | 9 | ## SYNOPSIS 10 | 11 | Negates a value and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | neg 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 65 | neg | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is pushed onto the stack. 30 | 31 | 2. A value is popped from the stack and negated. 32 | 33 | 3. The result is pushed onto the stack. 34 | 35 | The `neg` instruction negates value and pushes the result on top of the stack. The return type is the same as the operand type. 36 | 37 | Negation of integral values is standard two's complement negation. In particular, negating the most negative number (which does not have a positive counterpart) yields the most negative number. To detect this overflow use the `sub.ovf` instruction instead (that is, subtract from 0). 38 | 39 | Negating a floating-point number cannot overflow, and negating NaN returns NaN. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/nop.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.nop 4 | schema: 2.0.0 5 | --- 6 | 7 | # nop 8 | 9 | ## SYNOPSIS 10 | 11 | Fills space if opcodes are patched. No meaningful operation is performed although a processing cycle can be consumed. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | nop 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 00 | nop | 26 | 27 | There is no stack transitional behavior defined for this instruction. 28 | 29 | The `nop` operation does nothing. It is intended to fill in space if opcodes are patched. 30 | 31 | ## INPUTS 32 | 33 | ### None 34 | 35 | This function cannot be used with the pipeline. 36 | 37 | ## OUTPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/en-US/not.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.not 4 | schema: 2.0.0 5 | --- 6 | 7 | # not 8 | 9 | ## SYNOPSIS 10 | 11 | Computes the bitwise complement of the integer value on top of the stack and pushes the result onto the evaluation stack as the same type. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | not 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 66 | not | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value` is pushed onto the stack. 30 | 31 | 2. `value` is popped from the stack and its bitwise complement computed. 32 | 33 | 3. The result is pushed onto the stack. 34 | 35 | The `not` instruction computes the bitwise complement of an integer value and pushes the result onto the stack. The return type is the same as the operand type. 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/or.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.or 4 | schema: 2.0.0 5 | --- 6 | 7 | # or 8 | 9 | ## SYNOPSIS 10 | 11 | Compute the bitwise complement of the two integer values on top of the stack and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | or 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 60 | or | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack and their bitwise OR computed. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `or` instruction computes the bitwise OR of two values atop the stack, pushing the result onto the stack. 38 | 39 | `or` is an integer-specific operation. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/pop.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.pop 4 | schema: 2.0.0 5 | --- 6 | 7 | # pop 8 | 9 | ## SYNOPSIS 10 | 11 | Removes the value currently on top of the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | pop 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 26 | pop | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The top value is popped from the stack. 30 | 31 | The `pop` instruction removes the top element from the stack. 32 | 33 | ## INPUTS 34 | 35 | ### None 36 | 37 | This function cannot be used with the pipeline. 38 | 39 | ## OUTPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## NOTES 46 | 47 | ## RELATED LINKS 48 | -------------------------------------------------------------------------------- /docs/en-US/refanytype.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.refanytype 4 | schema: 2.0.0 5 | --- 6 | 7 | # refanytype 8 | 9 | ## SYNOPSIS 10 | 11 | Retrieves the type token embedded in a typed reference. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | refanytype 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 1D | refanytype | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value type reference is pushed onto the stack. 30 | 31 | 2. The typed reference is popped from the stack and its corresponding type token retrieved. 32 | 33 | 3. The type token is pushed onto the stack. 34 | 35 | A typed reference contains a type token and an address to an object instance. 36 | 37 | The `refanytype` instruction retrieves the type token embedded in the typed reference. See the `mkrefany` instruction for information on creating typed references. 38 | 39 | ## INPUTS 40 | 41 | ### None 42 | 43 | This function cannot be used with the pipeline. 44 | 45 | ## OUTPUTS 46 | 47 | ### None 48 | 49 | This function cannot be used with the pipeline. 50 | 51 | ## NOTES 52 | 53 | ## RELATED LINKS 54 | -------------------------------------------------------------------------------- /docs/en-US/rem.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.rem 4 | schema: 2.0.0 5 | --- 6 | 7 | # rem 8 | 9 | ## SYNOPSIS 10 | 11 | Divides two values and pushes the remainder onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | rem 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 5D | rem | 26 | 27 | 28 | The stack transitional behavior, in sequential order, is: 29 | 30 | 1. A `value1` is pushed onto the stack. 31 | 32 | 2. `value2` is pushed onto the stack. 33 | 34 | 3. `value2` and `value1` are popped from the stack and the remainder of `value1` `div` `value2` computed. 35 | 36 | 4. The result is pushed onto the stack. 37 | 38 | `result` = `value1` `rem` `value2` satisfies the following conditions: 39 | 40 | `result` = `value1` - `value2` `×` (`value1` `div` `value2`), and: 41 | 42 | 0 = | `result` | < | `value2` |, sign(`result`) = sign(`value1`), where `div` is the division instruction that truncates towards zero. 43 | 44 | If `value2` is zero or `value1` is infinity the result is NaN. If `value2` is infinity, the result is `value1` (negated for `-infinity`). 45 | 46 | Integral operations throw `System.DivideByZeroException` if `value2` is zero. 47 | 48 | Note that on the Intel-based platforms an `System.OverflowException` is thrown when computing (minint `rem` -1). 49 | 50 | ## INPUTS 51 | 52 | ### None 53 | 54 | This function cannot be used with the pipeline. 55 | 56 | ## OUTPUTS 57 | 58 | ### None 59 | 60 | This function cannot be used with the pipeline. 61 | 62 | ## NOTES 63 | 64 | ## RELATED LINKS 65 | -------------------------------------------------------------------------------- /docs/en-US/rem.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.rem_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # rem.un 8 | 9 | ## SYNOPSIS 10 | 11 | Divides two unsigned values and pushes the remainder onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | rem.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 5E | rem.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack and the remainder of `value1` `div` `value2` computed. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | `result` = `value1` `rem.un` `value2` satisfies the following conditions: 38 | 39 | `result` = `value1` - `value2` x(`value1` `div.un` `value2`), and: 40 | 41 | 0 = `result` < `value2`, where `div.un` is the unsigned division instruction. 42 | 43 | The `rem.un` instruction computes `result` and pushes it on the stack. `Rem.un` treats its arguments as unsigned integers, while `rem` treats them as signed integers. 44 | 45 | `rem.un` is unspecified for floating-point numbers. 46 | 47 | Integral operations throw `System.DivideByZeroException` if `value2` is zero. 48 | 49 | ## INPUTS 50 | 51 | ### None 52 | 53 | This function cannot be used with the pipeline. 54 | 55 | ## OUTPUTS 56 | 57 | ### None 58 | 59 | This function cannot be used with the pipeline. 60 | 61 | ## NOTES 62 | 63 | ## RELATED LINKS 64 | -------------------------------------------------------------------------------- /docs/en-US/rethrow.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.rethrow 4 | schema: 2.0.0 5 | --- 6 | 7 | # rethrow 8 | 9 | ## SYNOPSIS 10 | 11 | Rethrows the current exception. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | rethrow 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 1A | rethrow | 26 | 27 | No stack transition behavior is defined for this instruction. 28 | 29 | The `rethrow` instruction is only permitted within the body of a `catch` handler. It throws the same exception that was caught by this handler. 30 | 31 | ## INPUTS 32 | 33 | ### None 34 | 35 | This function cannot be used with the pipeline. 36 | 37 | ## OUTPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/en-US/shl.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.shl 4 | schema: 2.0.0 5 | --- 6 | 7 | # shl 8 | 9 | ## SYNOPSIS 10 | 11 | Shifts an integer value to the left (in zeroes) by a specified number of bits, pushing the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | shl 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 62 | shl | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is pushed onto the stack. 30 | 31 | 2. The amount of bits to be shifted is pushed onto the stack. 32 | 33 | 3. The number of bits to be shifted and the value are popped from the stack; the value is shifted left by the specified number of bits. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `shl` instruction shifts the value (type `int32`, `int64` or `native int`) left by the specified number of bits. The number of bits is a value of type `int32` or `native int`. The return value is unspecified if the number of bits to be shifted is greater than or equal to the width (in bits) of the supplied value. 38 | 39 | `shl` inserts a zero bit in the lowest position on each shift. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/shr.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.shr 4 | schema: 2.0.0 5 | --- 6 | 7 | # shr 8 | 9 | ## SYNOPSIS 10 | 11 | Shifts an integer value (in sign) to the right by a specified number of bits, pushing the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | shr 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 63 | shr | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is pushed onto the stack. 30 | 31 | 2. The amount of bits to be shifted is pushed onto the stack. 32 | 33 | 3. The number of bits to be shifted and the value are popped from the stack; the value is shifted right by the specified number of bits. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `shr.un` instruction shifts the value (type `int32`, `int64` or `native int`) right by the specified number of bits. The number of bits is a value of type `int32` or `native int`. The return value is unspecified if the number of bits to be shifted is greater than or equal to the width (in bits) of the supplied value. 38 | 39 | `shr` replicates the high order bit on each shift, preserving the sign of the original value in the `result`. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/shr.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.shr_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # shr.un 8 | 9 | ## SYNOPSIS 10 | 11 | Shifts an unsigned integer value (in zeroes) to the right by a specified number of bits, pushing the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | shr.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 64 | shr.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is pushed onto the stack. 30 | 31 | 2. The amount of bits to be shifted is pushed onto the stack. 32 | 33 | 3. The number of bits to be shifted and the value are popped from the stack; the value is shifted right by the specified number of bits. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | The `shr.un` instruction shifts the value (type `int32`, `int64` or `native int`) right by the specified number of bits. The number of bits is a value of type `int32`, `int64` or `native int`. The return value is unspecified if the number of bits to be shifted is greater than or equal to the width (in bits) of the supplied value. 38 | 39 | `shr.un` inserts a zero bit in the highest position on each shift. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/sizeof.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.sizeof 4 | schema: 2.0.0 5 | --- 6 | 7 | # sizeof 8 | 9 | ## SYNOPSIS 10 | 11 | Pushes the size, in bytes, of a supplied value type onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | sizeof 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------------- | ---------------- | 25 | | FE 1C < `T` > | sizeof `valType` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. The size (in bytes) of the supplied value type (`valType`) is pushed onto the stack. 30 | 31 | `valType` must be a metadata token (a `typeref` or `typedef`) that specifies a value type, reference type, or generic type parameter. 32 | 33 | For a reference type, the size returned is the size of a reference value of the corresponding type (4 bytes on 32-bit systems), not the size of the data stored in objects referred to by the reference value. A generic type parameter can be used only in the body of the type or method that defines it. When that type or method is instantiated, the generic type parameter is replaced by a value type or reference type. 34 | 35 | ## PARAMETERS 36 | 37 | ### -signature 38 | 39 | Specifies the target signature. 40 | 41 | ```yaml 42 | Type: signature 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ## INPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## OUTPUTS 60 | 61 | ### None 62 | 63 | This function cannot be used with the pipeline. 64 | 65 | ## NOTES 66 | 67 | ## RELATED LINKS 68 | -------------------------------------------------------------------------------- /docs/en-US/stelem.i.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_i 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.i 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `native int` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.i 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 9B | stelem.i | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.i` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `native int` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stelem.i1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_i1 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.i1 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `int8` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.i1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 9C | stelem.i1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.i1` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `int8` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stelem.i2.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_i2 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.i2 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `int16` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.i2 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 9D | stelem.i2 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.i2` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `int16` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stelem.i4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_i4 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.i4 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `int32` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.i4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 9E | stelem.i4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.i4` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `int32` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stelem.i8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_i8 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.i8 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `int64` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.i8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 9F | stelem.i8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.i8` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `int64` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stelem.r4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_r4 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.r4 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `float32` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.r4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | A0 | stelem.r4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.r4` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `float32` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stelem.r8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stelem_r8 4 | schema: 2.0.0 5 | --- 6 | 7 | # stelem.r8 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the array element at a given index with the `float64` value on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stelem.r8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | A1 | stelem.r8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference to an array, `array`, is pushed onto the stack. 30 | 31 | 2. A valid index to an element in `array` is pushed onto the stack. 32 | 33 | 3. A value is pushed onto the stack. 34 | 35 | 4. The value, the index, and the array reference are popped from the stack; the value is put into the array element at the given index. 36 | 37 | The `stelem.r8` instruction replaces the value of the element `index` in the one-dimensional array `array` with the `float64` value pushed onto the stack. 38 | 39 | Arrays are objects and hence represented by a value of type `O`. The index is type `native int`. 40 | 41 | `System.NullReferenceException` is thrown if `array` is a null reference. 42 | 43 | `System.IndexOutOfRangeException` is thrown if `index` is negative, or larger than the bound of `array`. 44 | 45 | `System.ArrayTypeMismatchException` is thrown if `array` does not hold elements of the required type. 46 | 47 | ## INPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## OUTPUTS 54 | 55 | ### None 56 | 57 | This function cannot be used with the pipeline. 58 | 59 | ## NOTES 60 | 61 | ## RELATED LINKS 62 | -------------------------------------------------------------------------------- /docs/en-US/stind.i.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_i 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.i 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `native int` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.i 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | DF | stind.i | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.i` instruction stores a `native int` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.i` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.i` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.i1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_i1 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.i1 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `int8` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.i1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 52 | stind.i1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.i1` instruction stores an `int8` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.i1` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.i1` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.i2.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_i2 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.i2 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `int16` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.i2 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 53 | stind.i2 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.i2` instruction stores an `int16` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.2i` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.i2` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.i4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_i4 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.i4 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `int32` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.i4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 54 | stind.i4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.i4` instruction stores an `int32` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.i4` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.i4` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.i8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_i8 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.i8 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `int64` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.i8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 55 | stind.i8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.i8` instruction stores an `int64` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.i8` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.i` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.r4.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_r4 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.r4 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `float32` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.r4 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 56 | stind.r4 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.r4` instruction stores a `float32` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.r4` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.r4` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.r8.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_r8 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.r8 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a value of type `float64` at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.r8 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 57 | stind.r8 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.r8` instruction stores a `float64` value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.r8` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.r8` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stind.ref.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stind_ref 4 | schema: 2.0.0 5 | --- 6 | 7 | # stind.ref 8 | 9 | ## SYNOPSIS 10 | 11 | Stores a object reference value at a supplied address. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stind.ref 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 51 | stind.ref | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | 2. A value is pushed onto the stack. 32 | 33 | 3. The value and the address are popped from the stack; the value is stored at the address. 34 | 35 | The `stind.ref` instruction stores an object reference value at the supplied address (type `native int`, `*`, or `&`). 36 | 37 | Type safe operation requires that the `stind.ref` instruction be used in a manner consistent with the type of the pointer. The operation of the `stind.ref` instruction can be altered by an immediately preceding `volatile.` or `unaligned.` prefix instruction. 38 | 39 | `System.NullReferenceException` is thrown if `addr` is not naturally aligned for the argument type implied by the instruction suffix. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/stloc.0.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stloc_0 4 | schema: 2.0.0 5 | --- 6 | 7 | # stloc.0 8 | 9 | ## SYNOPSIS 10 | 11 | Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 0. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stloc.0 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 0A | stloc.0 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is popped off of the stack and placed in the local variable indexed by 0. 30 | 31 | The `stloc.0` instruction pops the top value off the evaluation stack and moves it into the local variable indexed by 0. The type of the value must match the type of the local variable as specified in the current method's local signature. 32 | 33 | `stloc.0` is an especially efficient encoding for storing values in local variable 0. 34 | 35 | Storing into locals that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the local variable. Floating-point values are rounded from their native size (type `F`) to the size associated with the argument. 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/stloc.1.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stloc_1 4 | schema: 2.0.0 5 | --- 6 | 7 | # stloc.1 8 | 9 | ## SYNOPSIS 10 | 11 | Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 1. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stloc.1 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 0B | stloc.1 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is popped off of the stack and placed in the local variable indexed by 1. 30 | 31 | The `stloc.1` instruction pops the top value off the evaluation stack and moves it into the local variable indexed by 1. The type of the value must match the type of the local variable as specified in the current method's local signature. 32 | 33 | `stloc.1` is an especially efficient encoding for storing values in local variable 1. 34 | 35 | Storing into locals that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the local variable. Floating-point values are rounded from their native size (type `F`) to the size associated with the argument. 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/stloc.2.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stloc_2 4 | schema: 2.0.0 5 | --- 6 | 7 | # stloc.2 8 | 9 | ## SYNOPSIS 10 | 11 | Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 2. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stloc.2 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 0C | stloc.2 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is popped off of the stack and placed in the local variable indexed by 2. 30 | 31 | The `stloc.2` instruction pops the top value off the evaluation stack and moves it into the local variable indexed by 2. The type of the value must match the type of the local variable as specified in the current method's local signature. 32 | 33 | `stloc.2` is an especially efficient encoding for storing values in local variable 2. 34 | 35 | Storing into locals that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the local variable. Floating-point values are rounded from their native size (type `F`) to the size associated with the argument. 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/stloc.3.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stloc_3 4 | schema: 2.0.0 5 | --- 6 | 7 | # stloc.3 8 | 9 | ## SYNOPSIS 10 | 11 | Pops the current value from the top of the evaluation stack and stores it in a the local variable list at index 3. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stloc.3 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 0D | stloc.3 | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is popped off of the stack and placed in the local variable indexed by 3. 30 | 31 | The `stloc.3` instruction pops the top value off the evaluation stack and moves it into the local variable indexed by 3. The type of the value must match the type of the local variable as specified in the current method's local signature. 32 | 33 | `stloc.3` is an especially efficient encoding for storing values in local variable 3. 34 | 35 | Storing into locals that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the local variable. Floating-point values are rounded from their native size (type `F`) to the size associated with the argument. 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/stsfld.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.stsfld 4 | schema: 2.0.0 5 | --- 6 | 7 | # stsfld 8 | 9 | ## SYNOPSIS 10 | 11 | Replaces the value of a static field with a value from the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | stsfld 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ---------- | --------------- | 25 | | 80 < `T` > | stsfld `field` | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. A value is pushed onto the stack. 30 | 31 | 2. A value is popped from the stack and stored in `field`. 32 | 33 | The `stsfld` instruction replaces the value of a static field with a value from the stack. `field` is a metadata token that must refer to a static field member. 34 | 35 | The `stsfld` instruction may be prefixed by `volatile.`. 36 | 37 | `System.MissingFieldException` is thrown if field is not found in the metadata. This is typically checked when Microsoft Intermediate Language (MSIL) instructions are converted to native code, not at run time. 38 | 39 | ## PARAMETERS 40 | 41 | ### -signature 42 | 43 | Specifies the target signature. 44 | 45 | ```yaml 46 | Type: signature 47 | Parameter Sets: (All) 48 | Aliases: 49 | 50 | Required: True 51 | Position: 1 52 | Default value: None 53 | Accept pipeline input: False 54 | Accept wildcard characters: False 55 | ``` 56 | 57 | ## INPUTS 58 | 59 | ### None 60 | 61 | This function cannot be used with the pipeline. 62 | 63 | ## OUTPUTS 64 | 65 | ### None 66 | 67 | This function cannot be used with the pipeline. 68 | 69 | ## NOTES 70 | 71 | ## RELATED LINKS 72 | -------------------------------------------------------------------------------- /docs/en-US/sub.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.sub 4 | schema: 2.0.0 5 | --- 6 | 7 | # sub 8 | 9 | ## SYNOPSIS 10 | 11 | Subtracts one value from another and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | sub 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 59 | sub | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value2` is subtracted from `value1`. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | Overflow is not detected for integer operations (for proper overflow handling, see `sub.ovf`). 38 | 39 | Integer subtraction wraps, rather than saturates. For example: assuming 8-bit integers, where `value1` is set to 0 and `value2` is set to 1, the "wrapped" result will be 255. 40 | 41 | Floating-point overflow returns `+inf` (`PositiveInfinity`) or `-inf` (`NegativeInfinity`). 42 | 43 | ## INPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## OUTPUTS 50 | 51 | ### None 52 | 53 | This function cannot be used with the pipeline. 54 | 55 | ## NOTES 56 | 57 | ## RELATED LINKS 58 | -------------------------------------------------------------------------------- /docs/en-US/sub.ovf.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.sub_ovf 4 | schema: 2.0.0 5 | --- 6 | 7 | # sub.ovf 8 | 9 | ## SYNOPSIS 10 | 11 | Subtracts one integer value from another, performs an overflow check, and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | sub.ovf 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | DA | sub.ovf | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value2` is subtracted from `value1` with a check for overflow. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | `System.OverflowException` is thrown if the result can not be represented in the result type. 38 | 39 | This operation is performed on signed integers; for floating-point values, use `sub`. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/sub.ovf.un.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.sub_ovf_un 4 | schema: 2.0.0 5 | --- 6 | 7 | # sub.ovf.un 8 | 9 | ## SYNOPSIS 10 | 11 | Subtracts one unsigned integer value from another, performs an overflow check, and pushes the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | sub.ovf.un 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | DB | sub.ovf.un | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack; `value2` is subtracted from `value1` with a check for overflow. 34 | 35 | 4. The result is pushed onto the stack. 36 | 37 | `System.OverflowException` is thrown if the result can not be represented in the result type. 38 | 39 | This operation is performed on signed integers; for floating-point values, use `sub`. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /docs/en-US/throw.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.throw 4 | schema: 2.0.0 5 | --- 6 | 7 | # throw 8 | 9 | ## SYNOPSIS 10 | 11 | Throws the exception object currently on the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | throw 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 7A | throw | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An object reference (to an exception) is pushed onto the stack. 30 | 31 | 2. The object reference is popped from the stack and the exception thrown. 32 | 33 | The `throw` instruction throws the exception object (type `O`) currently on the stack. 34 | 35 | `System.NullReferenceException` is thrown if the object reference is a null reference. 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | 41 | This function cannot be used with the pipeline. 42 | 43 | ## OUTPUTS 44 | 45 | ### None 46 | 47 | This function cannot be used with the pipeline. 48 | 49 | ## NOTES 50 | 51 | ## RELATED LINKS 52 | -------------------------------------------------------------------------------- /docs/en-US/volatile..md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.volatile 4 | schema: 2.0.0 5 | --- 6 | 7 | # volatile. 8 | 9 | ## SYNOPSIS 10 | 11 | Specifies that an address currently atop the evaluation stack might be volatile, and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | volatile. 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | FE 13 | volatile. | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. An address is pushed onto the stack. 30 | 31 | `volatile.`. specifies that the address is a volatile address (that is, it can be referenced externally to the current thread of execution) and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed. Marking an access as `volatile.` affects only that single access; other accesses to the same location must be marked separately. Access to volatile locations need not be performed atomically. 32 | 33 | The `unaligned.` and `volatile.` prefixes can be combined in either order. They must immediately precede a `ldind`, `stind`, `ldfld`, `stfld`, `ldobj`, `stobj`, `initblk`, or `cpblk` instruction. Only the `volatile.` prefix is allowed for the `ldsfld` and `stsfld` instructions. 34 | 35 | ## INPUTS 36 | 37 | ### None 38 | 39 | This function cannot be used with the pipeline. 40 | 41 | ## OUTPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## NOTES 48 | 49 | ## RELATED LINKS 50 | -------------------------------------------------------------------------------- /docs/en-US/xor.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: ILAssembler-help.xml 3 | online version: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.xor 4 | schema: 2.0.0 5 | --- 6 | 7 | # xor 8 | 9 | ## SYNOPSIS 10 | 11 | Computes the bitwise XOR of the top two values on the evaluation stack, pushing the result onto the evaluation stack. 12 | 13 | ## SYNTAX 14 | 15 | ```powershell 16 | xor 17 | ``` 18 | 19 | ## DESCRIPTION 20 | 21 | The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary: 22 | 23 | | Format | Assembly Format | 24 | | ------ | --------------- | 25 | | 61 | xor | 26 | 27 | The stack transitional behavior, in sequential order, is: 28 | 29 | 1. `value1` is pushed onto the stack. 30 | 31 | 2. `value2` is pushed onto the stack. 32 | 33 | 3. `value2` and `value1` are popped from the stack and their bitwise XOR computed. 34 | 35 | 4. The bitwise XOR of `value2` and `value1` is pushed onto the stack. 36 | 37 | The `xor` instruction computes the bitwise XOR of the top two values on the stack and leaves the result on the stack. 38 | 39 | `xor` is an integer-specific operation. 40 | 41 | ## INPUTS 42 | 43 | ### None 44 | 45 | This function cannot be used with the pipeline. 46 | 47 | ## OUTPUTS 48 | 49 | ### None 50 | 51 | This function cannot be used with the pipeline. 52 | 53 | ## NOTES 54 | 55 | ## RELATED LINKS 56 | -------------------------------------------------------------------------------- /requirements.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | InvokeBuild = '5.6.2' 3 | Pester = '5.0.4' 4 | 'DotnetSdk::release' = '5.0.100-rc.2.20462.2' 5 | } 6 | -------------------------------------------------------------------------------- /src/ILAssembler/CilAssemblyContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection.Emit; 4 | using System.Reflection.Metadata; 5 | using System.Reflection.Metadata.Ecma335; 6 | 7 | namespace ILAssembler 8 | { 9 | internal sealed class CilAssemblyContext 10 | { 11 | private InstructionEncoder _encoder; 12 | 13 | public CilAssemblyContext(DynamicILInfo ilInfo) 14 | { 15 | _encoder = new InstructionEncoder(new BlobBuilder()); 16 | BranchBuilder = new BranchBuilder(_encoder); 17 | ILInfo = ilInfo; 18 | } 19 | 20 | public DynamicILInfo ILInfo { get; } 21 | 22 | public BranchBuilder BranchBuilder { get; } 23 | 24 | public string[]? Locals { get; set; } 25 | 26 | public ref InstructionEncoder Encoder => ref _encoder; 27 | 28 | public LabelHandle GetOrAddLabel(string name) 29 | { 30 | return BranchBuilder.GetOrCreateLabel(name); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ILAssembler/Debug.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | using Dbg = System.Diagnostics.Debug; 5 | 6 | namespace ILAssembler 7 | { 8 | internal static class Debug 9 | { 10 | [Conditional("DEBUG")] 11 | public static void Assert([DoesNotReturnIf(false)] bool condition) 12 | { 13 | Dbg.Assert(condition); 14 | } 15 | 16 | [Conditional("DEBUG")] 17 | public static void Assert([DoesNotReturnIf(false)] bool condition, string? message) 18 | { 19 | Dbg.Assert(condition, message); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ILAssembler/DoesNotReturnAttribute.cs: -------------------------------------------------------------------------------- 1 | #if !CORE 2 | using System; 3 | 4 | namespace System.Diagnostics.CodeAnalysis 5 | { 6 | [AttributeUsage(AttributeTargets.Method, Inherited = false)] 7 | internal sealed class DoesNotReturnAttribute : Attribute 8 | { 9 | } 10 | 11 | [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] 12 | internal sealed class DoesNotReturnIfAttribute : Attribute 13 | { 14 | public DoesNotReturnIfAttribute(bool parameterValue) 15 | { 16 | ParameterValue = parameterValue; 17 | } 18 | 19 | public bool ParameterValue { get; } 20 | } 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /src/ILAssembler/ErrorRecordInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation; 2 | 3 | namespace ILAssembler 4 | { 5 | internal sealed class ErrorRecordInfo 6 | { 7 | public ErrorRecordInfo(string id, ErrorCategory category, object? targetObject) 8 | { 9 | Id = id; 10 | Category = category; 11 | TargetObject = targetObject; 12 | } 13 | 14 | public string Id { get; } 15 | 16 | public ErrorCategory Category { get; } 17 | 18 | public object? TargetObject { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ILAssembler/ExceptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Management.Automation; 3 | 4 | namespace ILAssembler 5 | { 6 | internal static class ExceptionExtensions 7 | { 8 | public static TException WithErrorInfo( 9 | this TException exception, 10 | string? id = null, 11 | ErrorCategory category = ErrorCategory.NotSpecified, 12 | object? targetObject = null) 13 | where TException : Exception 14 | { 15 | exception.Data[typeof(ErrorRecordInfo)] = new ErrorRecordInfo( 16 | id ?? typeof(TException).Name, 17 | category, 18 | targetObject); 19 | 20 | return exception; 21 | } 22 | 23 | public static bool TryCreateErrorRecord(this Exception exception, out ErrorRecord errorRecord) 24 | { 25 | object? data = exception.Data[typeof(ErrorRecordInfo)]; 26 | if (data is not ErrorRecordInfo info) 27 | { 28 | errorRecord = null!; 29 | return false; 30 | } 31 | 32 | errorRecord = new ErrorRecord( 33 | exception, 34 | info.Id, 35 | info.Category, 36 | info.TargetObject); 37 | return true; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/ILAssembler/ExtentOps.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | 3 | namespace ILAssembler 4 | { 5 | internal static class ExtentOps 6 | { 7 | public static IScriptExtent ExtentOf(IScriptExtent start, IScriptExtent end) 8 | { 9 | if (start == end) 10 | { 11 | return start; 12 | } 13 | 14 | var fullScript = start.StartScriptPosition.GetFullScript(); 15 | var newStart = new ScriptPosition( 16 | start.File, 17 | start.StartLineNumber, 18 | start.StartColumnNumber, 19 | start.StartScriptPosition.Line, 20 | fullScript); 21 | 22 | var newEnd = new ScriptPosition( 23 | end.File, 24 | end.EndLineNumber, 25 | end.EndColumnNumber, 26 | end.EndScriptPosition.Line, 27 | fullScript); 28 | 29 | return new ScriptExtent(newStart, newEnd); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/ILAssembler/FieldIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Management.Automation.Language; 3 | using System.Reflection; 4 | 5 | namespace ILAssembler 6 | { 7 | internal class FieldIdentifier : MemberIdentifier 8 | { 9 | public TypedIdentifier FieldType { get; } 10 | 11 | public FieldIdentifier(TypedIdentifier declaringType, string name, bool isStatic, TypedIdentifier fieldType) 12 | : base(declaringType, name, isStatic) 13 | { 14 | FieldType = fieldType; 15 | } 16 | 17 | public override int GetToken(CilAssemblyContext context, IScriptExtent subject) 18 | { 19 | Debug.Assert( 20 | DeclaringType is not null, 21 | "FieldSignatureParser.GetMemberIdentifier should have thrown when declaring type is null."); 22 | 23 | FieldInfo? field = DeclaringType.Type.GetField( 24 | Name, 25 | GetFlags()); 26 | 27 | if (field is null) 28 | { 29 | throw ErrorMemberNotFound(subject); 30 | } 31 | 32 | if (field.DeclaringType!.IsGenericType) 33 | { 34 | return context.ILInfo.GetTokenFor( 35 | field.FieldHandle, 36 | field.DeclaringType.TypeHandle); 37 | } 38 | 39 | return context.ILInfo.GetTokenFor(field.FieldHandle); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ILAssembler/FieldSignatureParser.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | 3 | namespace ILAssembler 4 | { 5 | internal class FieldSignatureParser : MemberSignatureParser 6 | { 7 | public override MemberIdentifier GetMemberIdentifier(IScriptExtent subject) 8 | { 9 | if (DeclaringType is null) 10 | { 11 | Throw.ParseException(subject, nameof(SR.MissingDeclaringType), SR.MissingDeclaringType); 12 | } 13 | 14 | if (ReturnType is null) 15 | { 16 | Throw.ParseException(subject, nameof(SR.FieldTypeNotFound), SR.FieldTypeNotFound); 17 | } 18 | 19 | if (Name is null) 20 | { 21 | Throw.ParseException(subject, nameof(SR.FieldNameNotFound), SR.FieldNameNotFound); 22 | } 23 | 24 | var result = new FieldIdentifier( 25 | DeclaringType, 26 | Name, 27 | IsStatic, 28 | ReturnType); 29 | 30 | Reset(); 31 | return result; 32 | } 33 | 34 | public override void VisitInvokeMemberExpression(InvokeMemberExpressionAst invokeMemberExpressionAst) 35 | { 36 | ErrorUnexpectedNode(invokeMemberExpressionAst); 37 | } 38 | 39 | protected override ILParseException ErrorExpectedSignature(IScriptExtent extent) 40 | { 41 | return ILParseException.Create( 42 | extent, 43 | nameof(SR.ExpectedFieldSignature), 44 | SR.ExpectedFieldSignature); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ILAssembler/FindMemberTypeAstVisitor.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Management.Automation.Language; 3 | 4 | namespace ILAssembler 5 | { 6 | internal class FindMemberTypeAstVisitor : DefaultCustomAstVisitor 7 | { 8 | public override object? VisitScriptBlock(ScriptBlockAst scriptBlockAst) 9 | { 10 | return scriptBlockAst.EndBlock?.Visit(this); 11 | } 12 | 13 | public override object? VisitNamedBlock(NamedBlockAst namedBlockAst) 14 | { 15 | return namedBlockAst.Statements?.FirstOrDefault()?.Visit(this); 16 | } 17 | 18 | public override object? VisitPipeline(PipelineAst pipelineAst) 19 | { 20 | return pipelineAst.PipelineElements?.FirstOrDefault()?.Visit(this); 21 | } 22 | 23 | public override object? VisitCommandExpression(CommandExpressionAst commandExpressionAst) 24 | { 25 | return commandExpressionAst.Expression.Visit(this); 26 | } 27 | 28 | public override object? VisitConvertExpression(ConvertExpressionAst convertExpressionAst) 29 | { 30 | return convertExpressionAst.Child.Visit(this); 31 | } 32 | 33 | public override object? VisitTypeExpression(TypeExpressionAst typeExpressionAst) 34 | { 35 | return typeExpressionAst; 36 | } 37 | 38 | public override object? VisitMemberExpression(MemberExpressionAst memberExpressionAst) 39 | { 40 | return memberExpressionAst; 41 | } 42 | 43 | public override object? VisitInvokeMemberExpression(InvokeMemberExpressionAst invokeMemberExpressionAst) 44 | { 45 | return invokeMemberExpressionAst; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/ILAssembler/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | [assembly: SuppressMessage("Usage", "RCS1146", Justification = "Hurts readability.")] 4 | [assembly: SuppressMessage("Usage", "CA2249", Justification = "string.Contains(char) is Core only.")] 5 | -------------------------------------------------------------------------------- /src/ILAssembler/IReadOnlyListExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ILAssembler 4 | { 5 | internal static class IReadOnlyListExtensions 6 | { 7 | public static ReadOnlyListSegment Slice(this IReadOnlyList source, int start) 8 | { 9 | return new ReadOnlyListSegment( 10 | source, 11 | start, 12 | source.Count - start); 13 | } 14 | 15 | public static ReadOnlyListSegment Slice(this IReadOnlyList source, int start, int length) 16 | { 17 | return new ReadOnlyListSegment( 18 | source, 19 | start, 20 | length); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ILAssembler/MemberIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection; 3 | 4 | namespace ILAssembler 5 | { 6 | internal abstract class MemberIdentifier 7 | { 8 | protected MemberIdentifier(TypedIdentifier? declaringType, string name, bool isStatic) 9 | { 10 | DeclaringType = declaringType; 11 | Name = name; 12 | IsStatic = isStatic; 13 | } 14 | 15 | public TypedIdentifier? DeclaringType { get; } 16 | 17 | public string Name { get; } 18 | 19 | public bool IsStatic { get; } 20 | 21 | public abstract int GetToken(CilAssemblyContext context, IScriptExtent subject); 22 | 23 | protected virtual ILParseException ErrorMemberNotFound(IScriptExtent subject) 24 | { 25 | return ILParseException.Create( 26 | subject, 27 | nameof(SR.MemberNotFound), 28 | SR.MemberNotFound); 29 | } 30 | 31 | protected virtual BindingFlags GetFlags() 32 | { 33 | BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public; 34 | flags |= IsStatic ? BindingFlags.Static : BindingFlags.Instance; 35 | return flags; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ILAssembler/NameExpectation.cs: -------------------------------------------------------------------------------- 1 | namespace ILAssembler 2 | { 3 | internal enum NameExpectation 4 | { 5 | Allow = 0, 6 | 7 | Require = 1, 8 | 9 | Reject = 2, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/BranchOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class BranchOpCodeInfo : GeneralOpCodeInfo 7 | { 8 | public BranchOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 13 | { 14 | arguments.AssertArgumentCount(1); 15 | if (arguments[0] is StringConstantExpressionAst stringConstant) 16 | { 17 | context.BranchBuilder.Branch( 18 | OpCode, 19 | context.GetOrAddLabel(stringConstant.Value)); 20 | 21 | return; 22 | } 23 | 24 | context.Encoder.OpCode(OpCode); 25 | if (OpCode.GetBranchOperandSize() == 1) 26 | { 27 | sbyte shortArg = arguments[0].ReadNumber(); 28 | context.Encoder.CodeBuilder.WriteSByte(shortArg); 29 | return; 30 | } 31 | 32 | int longArg = arguments[0].ReadNumber(); 33 | context.Encoder.CodeBuilder.WriteCompressedSignedInteger(longArg); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/ByteOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | using System.Reflection.Metadata.Ecma335; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class ByteOpCodeInfo : SingleNumericArgumentOpCodeInfo 7 | { 8 | public ByteOpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | protected override void EmitArgument(ref InstructionEncoder encoder, byte argument) 14 | { 15 | encoder.CodeBuilder.WriteByte(argument); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/ConstructorOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal class ConstructorOpCodeInfo : TokenOpCodeInfo 7 | { 8 | public ConstructorOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | protected override string ExpectedSignatureErrorId => "ExpectedConstructorSignature"; 13 | 14 | protected override string ExpectedSignatureMessage => "Expected constructor signature, e.g. { [void] [DeclaringType].new([type] $optionalParameterName) }"; 15 | 16 | protected override int GetToken(CilAssemblyContext context, ScriptBlockExpressionAst signatureBody) 17 | { 18 | var parser = new MethodSignatureParser(rejectCtor: false, requireResolvableDeclaringType: true); 19 | signatureBody.ScriptBlock.Visit(parser); 20 | MemberIdentifier identifier = parser.GetMemberIdentifierAndReset(signatureBody.Extent); 21 | if (identifier is not ConstructorIdentifier) 22 | { 23 | throw ErrorExpectedSignature(signatureBody); 24 | } 25 | 26 | return identifier.GetToken(context, signatureBody.Extent); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/DoubleOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | using System.Reflection.Metadata.Ecma335; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class DoubleOpCodeInfo : SingleNumericArgumentOpCodeInfo 7 | { 8 | public DoubleOpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | protected override void EmitArgument(ref InstructionEncoder encoder, double argument) 14 | { 15 | encoder.CodeBuilder.WriteDouble(argument); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/EmitOpCode.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal class EmitOpCodeInfo : OpCodeInfo 7 | { 8 | public override string Name => "_emit"; 9 | 10 | public override ILOpCode OpCode => default; 11 | 12 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 13 | { 14 | arguments.AssertArgumentCount(1); 15 | arguments[0].Visit(new ConstantEmitter(context)); 16 | } 17 | 18 | private sealed class ConstantEmitter : SignatureParser 19 | { 20 | private readonly CilAssemblyContext _context; 21 | 22 | public ConstantEmitter(CilAssemblyContext context) => _context = context; 23 | 24 | public override void VisitParenExpression(ParenExpressionAst parenExpressionAst) 25 | { 26 | parenExpressionAst.Pipeline.Visit(this); 27 | } 28 | 29 | public override void VisitArrayLiteral(ArrayLiteralAst arrayLiteralAst) 30 | { 31 | for (int i = 0; i < arrayLiteralAst.Elements.Count; i++) 32 | { 33 | arrayLiteralAst.Elements[i].Visit(this); 34 | } 35 | } 36 | 37 | public override void VisitConstantExpression(ConstantExpressionAst constantExpressionAst) 38 | { 39 | _context.Encoder.CodeBuilder.WriteByte(constantExpressionAst.ReadNumber()); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/FieldOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal class FieldOpCodeInfo : TokenOpCodeInfo 7 | { 8 | public FieldOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | protected override string ExpectedSignatureErrorId => "ExpectedFieldSignature"; 13 | 14 | protected override string ExpectedSignatureMessage => "Expected field signature, e.g. { [FieldType] [DeclaringType]._fieldName }"; 15 | 16 | protected override int GetToken(CilAssemblyContext context, ScriptBlockExpressionAst signatureBody) 17 | { 18 | var parser = new FieldSignatureParser(); 19 | signatureBody.ScriptBlock.Visit(parser); 20 | MemberIdentifier identifier = parser.GetMemberIdentifierAndReset(signatureBody.Extent); 21 | return identifier.GetToken(context, signatureBody.Extent); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/GeneralOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | 3 | namespace ILAssembler.OpCodes 4 | { 5 | internal abstract class GeneralOpCodeInfo : OpCodeInfo 6 | { 7 | protected GeneralOpCodeInfo(string name, ILOpCode opCode) 8 | { 9 | Name = name; 10 | OpCode = opCode; 11 | } 12 | 13 | public override string Name { get; } 14 | 15 | public override ILOpCode OpCode { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/Int32OpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | using System.Reflection.Metadata.Ecma335; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class Int32OpCodeInfo : SingleNumericArgumentOpCodeInfo 7 | { 8 | public Int32OpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | protected override void EmitArgument(ref InstructionEncoder encoder, int argument) 14 | { 15 | encoder.CodeBuilder.WriteCompressedSignedInteger(argument); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/Int64OpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | using System.Reflection.Metadata.Ecma335; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class Int64OpCodeInfo : SingleNumericArgumentOpCodeInfo 7 | { 8 | public Int64OpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | protected override void EmitArgument(ref InstructionEncoder encoder, long argument) 14 | { 15 | encoder.CodeBuilder.WriteInt64(argument); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/MethodOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal class MethodOpCodeInfo : TokenOpCodeInfo 7 | { 8 | public MethodOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | protected override string ExpectedSignatureErrorId => "ExpectedMethodSignature"; 13 | 14 | protected override string ExpectedSignatureMessage => "Expected method signature, e.g. { [ReturnType] [DeclaringType].MethodName([type] $optionalParameterName) }"; 15 | 16 | protected override int GetToken(CilAssemblyContext context, ScriptBlockExpressionAst signatureBody) 17 | { 18 | var parser = new MethodSignatureParser(rejectCtor: true, requireResolvableDeclaringType: true); 19 | signatureBody.ScriptBlock.Visit(parser); 20 | MemberIdentifier identifier = parser.GetMemberIdentifierAndReset(signatureBody.Extent); 21 | return identifier.GetToken(context, signatureBody.Extent); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/NoOperandOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class NoOperandOpCodeInfo : GeneralOpCodeInfo 7 | { 8 | public NoOperandOpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 14 | { 15 | arguments.AssertArgumentCount(0); 16 | context.Encoder.OpCode(OpCode); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/OpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal abstract class OpCodeInfo 7 | { 8 | public abstract string Name { get; } 9 | 10 | public abstract ILOpCode OpCode { get; } 11 | 12 | public abstract void Emit(CilAssemblyContext context, in InstructionArguments arguments); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/SingleNumericArgumentOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | using System.Reflection.Metadata.Ecma335; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal abstract class SingleNumericArgumentOpCodeInfo : GeneralOpCodeInfo 7 | where T : unmanaged 8 | { 9 | protected SingleNumericArgumentOpCodeInfo(string name, ILOpCode opCode) 10 | : base(name, opCode) 11 | { 12 | } 13 | 14 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 15 | { 16 | arguments.AssertArgumentCount(1); 17 | T argument = arguments[0].ReadNumber(); 18 | context.Encoder.OpCode(OpCode); 19 | EmitArgument(ref context.Encoder, argument); 20 | } 21 | 22 | protected abstract void EmitArgument(ref InstructionEncoder encoder, T argument); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/SingleOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection.Metadata; 2 | using System.Reflection.Metadata.Ecma335; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class SingleOpCodeInfo : SingleNumericArgumentOpCodeInfo 7 | { 8 | public SingleOpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | protected override void EmitArgument(ref InstructionEncoder encoder, float argument) 14 | { 15 | encoder.CodeBuilder.WriteSingle(argument); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/StringOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal class StringOpCodeInfo : GeneralOpCodeInfo 7 | { 8 | public StringOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 13 | { 14 | arguments.AssertArgumentCount(1); 15 | if (arguments[0] is not StringConstantExpressionAst stringConstant) 16 | { 17 | Throw.UnexpectedType(arguments[0], "string"); 18 | return; 19 | } 20 | 21 | int token = context.ILInfo.GetTokenFor(stringConstant.Value); 22 | context.Encoder.OpCode(OpCode); 23 | context.Encoder.Token(token); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/SwitchOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal sealed class SwitchOpCodeInfo : GeneralOpCodeInfo 7 | { 8 | public SwitchOpCodeInfo(string name, ILOpCode opCode) 9 | : base(name, opCode) 10 | { 11 | } 12 | 13 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 14 | { 15 | arguments.AssertArgumentCount(1); 16 | ReadOnlyListSegment branches; 17 | if (arguments[0] is ArrayLiteralAst arrayLiteralAst) 18 | { 19 | branches = arrayLiteralAst.Elements; 20 | } 21 | else if (arguments[0] is StringConstantExpressionAst stringConstant) 22 | { 23 | branches = new ExpressionAst[] { stringConstant }; 24 | } 25 | else 26 | { 27 | throw ILParseException.Create( 28 | arguments.StartPosition.ToScriptExtent(), 29 | nameof(SR.MissingBranches), 30 | SR.MissingBranches); 31 | } 32 | 33 | var labels = new LabelHandle[branches.Count]; 34 | for (int i = 0; i < labels.Length; i++) 35 | { 36 | if (branches[i] is not StringConstantExpressionAst branchName) 37 | { 38 | throw ILParseException.Create( 39 | branches[i].Extent, 40 | nameof(SR.MissingBranchName), 41 | SR.MissingBranchName); 42 | } 43 | 44 | labels[i] = context.GetOrAddLabel(branchName.Value); 45 | } 46 | 47 | context.BranchBuilder.Switch(labels); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/TokenOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal abstract class TokenOpCodeInfo : GeneralOpCodeInfo 7 | { 8 | protected TokenOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | protected abstract string ExpectedSignatureErrorId { get; } 13 | 14 | protected abstract string ExpectedSignatureMessage { get; } 15 | 16 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 17 | { 18 | arguments.AssertArgumentCount(1); 19 | if (arguments[0] is not ScriptBlockExpressionAst signatureBody) 20 | { 21 | throw ErrorExpectedSignature(arguments[0]); 22 | } 23 | 24 | int token = GetToken(context, signatureBody); 25 | context.Encoder.OpCode(OpCode); 26 | EmitImpl(context, token); 27 | } 28 | 29 | protected virtual ILParseException ErrorExpectedSignature(Ast ast) 30 | { 31 | return ILParseException.Create( 32 | ast.Extent, 33 | ExpectedSignatureErrorId, 34 | ExpectedSignatureMessage); 35 | } 36 | 37 | protected virtual void EmitImpl(CilAssemblyContext context, int token) 38 | { 39 | context.Encoder.Token(token); 40 | } 41 | 42 | protected abstract int GetToken( 43 | CilAssemblyContext context, 44 | ScriptBlockExpressionAst signatureBody); 45 | 46 | protected static int FallBackGetToken( 47 | TokenOpCodeInfo fallBackTo, 48 | CilAssemblyContext context, 49 | ScriptBlockExpressionAst signatureBody) 50 | { 51 | return fallBackTo.GetToken(context, signatureBody); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/TypeOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal class TypeOpCodeInfo : TokenOpCodeInfo 7 | { 8 | public TypeOpCodeInfo(string name, ILOpCode opCode) : base(name, opCode) 9 | { 10 | } 11 | 12 | protected override string ExpectedSignatureErrorId => "ExpectedTypeSignature"; 13 | 14 | protected override string ExpectedSignatureMessage => "Expected type signature, e.g. { [string] }"; 15 | 16 | protected override int GetToken(CilAssemblyContext context, ScriptBlockExpressionAst signatureBody) 17 | { 18 | var parser = new TypeArgumentSignatureParser(allowPinned: false, allowByRef: true); 19 | signatureBody.ScriptBlock.Visit(parser); 20 | TypedIdentifier identifier = parser.GetSignatureAndReset(signatureBody.Extent); 21 | return context.ILInfo.GetTokenFor(identifier.GetModifiedType().TypeHandle); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ILAssembler/OpCodes/VariableExpressionOpCodeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Management.Automation.Language; 2 | using System.Reflection.Metadata; 3 | 4 | namespace ILAssembler.OpCodes 5 | { 6 | internal abstract class VariableExpressionOpCodeInfo : OpCodeInfo 7 | { 8 | protected readonly ILOpCode IfByte; 9 | 10 | protected readonly ILOpCode IfInt; 11 | 12 | protected VariableExpressionOpCodeInfo(string name, ILOpCode ifByte, ILOpCode ifInt) 13 | { 14 | Name = name; 15 | IfByte = ifByte; 16 | IfInt = ifInt; 17 | } 18 | 19 | public override string Name { get; } 20 | 21 | public override ILOpCode OpCode => default; 22 | 23 | public override void Emit(CilAssemblyContext context, in InstructionArguments arguments) 24 | { 25 | arguments.AssertArgumentCount(1); 26 | if (arguments[0] is not VariableExpressionAst variable) 27 | { 28 | Throw.UnexpectedType(arguments[0], "variable"); 29 | return; 30 | } 31 | 32 | var index = GetIndex(context, variable); 33 | if (index >= 0xFF) 34 | { 35 | context.Encoder.OpCode(IfInt); 36 | context.Encoder.CodeBuilder.WriteCompressedSignedInteger(index); 37 | return; 38 | } 39 | 40 | if (TryGetSimpleOpCode(index, out ILOpCode simple)) 41 | { 42 | context.Encoder.OpCode(simple); 43 | return; 44 | } 45 | 46 | context.Encoder.OpCode(IfByte); 47 | context.Encoder.CodeBuilder.WriteByte((byte)index); 48 | } 49 | 50 | protected abstract int GetIndex(CilAssemblyContext context, VariableExpressionAst variable); 51 | 52 | protected virtual bool TryGetSimpleOpCode(int index, out ILOpCode opCode) 53 | { 54 | opCode = default; 55 | return false; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/ILAssembler/SR.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace ILAssembler 4 | { 5 | internal partial class SR 6 | { 7 | public static string Format(string format, object? arg0) 8 | { 9 | return string.Format(CultureInfo.CurrentCulture, format, arg0); 10 | } 11 | 12 | public static string Format(string format, object? arg0, object? arg1) 13 | { 14 | return string.Format(CultureInfo.CurrentCulture, format, arg0, arg1); 15 | } 16 | 17 | public static string Format(string format, object? arg0, object? arg1, object? arg2) 18 | { 19 | return string.Format(CultureInfo.CurrentCulture, format, arg0, arg1, arg2); 20 | } 21 | 22 | public static string Format(string format, params object?[] args) 23 | { 24 | return string.Format(CultureInfo.CurrentCulture, format, args); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ILAssembler/ScopedState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | 5 | namespace ILAssembler 6 | { 7 | internal class ScopedState where TState : struct 8 | { 9 | private Stack? _stack; 10 | 11 | public TState Current; 12 | 13 | public void PushScope() 14 | { 15 | (_stack ??= new Stack()).Push(Current); 16 | Current = default; 17 | } 18 | 19 | public ref TState PopScope() 20 | { 21 | if (_stack is null or { Count: 0 }) 22 | { 23 | ThrowCannotPop(); 24 | } 25 | 26 | Current = _stack.Pop(); 27 | return ref Current; 28 | 29 | [DoesNotReturn] 30 | static void ThrowCannotPop() 31 | { 32 | throw new InvalidOperationException("Stack empty."); 33 | } 34 | } 35 | 36 | public ScopeHandle UseNewScope() 37 | { 38 | PushScope(); 39 | return new ScopeHandle(this); 40 | } 41 | 42 | public readonly ref struct ScopeHandle 43 | { 44 | private readonly ScopedState _parent; 45 | 46 | public ScopeHandle(ScopedState parent) => _parent = parent; 47 | 48 | public void Dispose() => _parent.PopScope(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ILAssembler/SpecialTypes.cs: -------------------------------------------------------------------------------- 1 | namespace ILAssembler 2 | { 3 | internal static class SpecialTypes 4 | { 5 | public const string ByRef = "byref"; 6 | 7 | public const string Ref = "ref"; 8 | 9 | public const string Pinned = "pinned"; 10 | 11 | public const string Pointer = "pointer"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ILAssembler/TypeArgumentSignatureParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Management.Automation.Language; 3 | 4 | namespace ILAssembler 5 | { 6 | internal sealed class TypeArgumentSignatureParser : SignatureParser 7 | { 8 | private readonly TypeSignatureParser _parser; 9 | 10 | public TypeArgumentSignatureParser(bool allowPinned, bool allowByRef) 11 | => _parser = new(NameExpectation.Reject, allowPinned, allowByRef); 12 | 13 | public TypedIdentifier GetSignatureAndReset(IScriptExtent subject) 14 | { 15 | return _parser.GetSignatureAndReset(subject); 16 | } 17 | 18 | public override void VisitCommandExpression(CommandExpressionAst commandExpressionAst) 19 | { 20 | commandExpressionAst.Expression.Visit(_parser); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ILAssembler/TypedIdentifierExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ILAssembler 4 | { 5 | internal static class TypedIdentifierExtensions 6 | { 7 | public static Type[] ToModifiedTypeArray(this TypedIdentifier[] types) 8 | { 9 | var result = new Type[types.Length]; 10 | for (int i = types.Length - 1; i >= 0; i--) 11 | { 12 | result[i] = types[i].GetModifiedType(); 13 | } 14 | 15 | return result; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ILAssembler/ValueList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace ILAssembler 6 | { 7 | internal struct ValueList 8 | { 9 | private T[]? _list; 10 | 11 | public int Length => _list?.Length ?? 0; 12 | 13 | public ref T Add() 14 | { 15 | if (_list is null) 16 | { 17 | _list = new T[1]; 18 | return ref _list[0]; 19 | } 20 | 21 | Array.Resize(ref _list, _list.Length + 1); 22 | return ref _list[^1]; 23 | } 24 | 25 | public ref T this[int index] 26 | { 27 | get 28 | { 29 | if (_list is null) 30 | { 31 | ThrowInvalidOperation(); 32 | } 33 | 34 | return ref _list[index]; 35 | 36 | [DoesNotReturn, MethodImpl(MethodImplOptions.NoInlining)] 37 | static void ThrowInvalidOperation() 38 | { 39 | throw new InvalidOperationException(); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | --------------------------------------------------------------------------------