Skip to content

Proposal: Tiny. and Mini. prefixes. #4211

@AdamSpeight2008

Description

@AdamSpeight2008

The current IL switch as a form similar to this.

switch ( n : u32 ){ L1 : i32 .. Ln:i32 }
[ 45    02 00 00 00    03 00 00 00    05 00 00 00 ]

which can be a waste of byte if the destinations of the switch branches are relatively close.
So I propose to additional prefixes to IL.

tiny.

The tiny. prefix requires the parameters to by 1 byte in width, and the branches are now relative jumps.

tiny.switch ( n : u8  ){ J1 : i8 , Jn : i8  }
[ FD 45    02    03    05 ]

mini.

The mini. prefix requires the parameters to be 2 bytes in width, and the branches are now relative jumps.

mini.switch { n : u16 ){ J1 : i16, Jn : i16 }
[ FC 45    02 00    03 00    05 00 ]

This would reduce the size of the produced IL
Other possible uses for mini. and tiny. are prefixing JMP and Branch ins instructions.

Note:
The actual byte codes used I've selected may clash with pre-existing IL instructions, from the information available to me, suggest that FC and FD are unused.

category:proposal
theme:msil
skill-level:intermediate
cost:large

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIdesign-discussionOngoing discussion about design without consensusenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions