Skip to content

Commit

Permalink
applies sealant
Browse files Browse the repository at this point in the history
  • Loading branch information
ike709 committed May 1, 2024
1 parent c474351 commit 1c9234f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
36 changes: 18 additions & 18 deletions DMCompiler/Optimizer/AnnotatedBytecode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IAnnotatedBytecode {
public Location GetLocation();
}

internal class AnnotatedBytecodeInstruction : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeInstruction : IAnnotatedBytecode {
private List<IAnnotatedBytecode> _args = new();
public Location Location;
public DreamProcOpcode Opcode;
Expand Down Expand Up @@ -129,7 +129,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeVariable : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeVariable : IAnnotatedBytecode {
public int Exit;
public bool Exitingscope;
public Location Location;
Expand Down Expand Up @@ -162,7 +162,7 @@ public Location GetLocation() {
}


internal class AnnotatedBytecodeInteger : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeInteger : IAnnotatedBytecode {
public Location Location;
public int Value;

Expand All @@ -185,7 +185,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeFloat : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeFloat : IAnnotatedBytecode {
public Location Location;
public float Value;

Expand All @@ -208,7 +208,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeString : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeString : IAnnotatedBytecode {
public int ID;
public Location Location;
public string Value;
Expand All @@ -233,7 +233,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeArgumentType : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeArgumentType : IAnnotatedBytecode {
public Location Location;
public DMCallArgumentsType Value;

Expand All @@ -256,7 +256,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeType : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeType : IAnnotatedBytecode {
public Location Location;
public DMValueType Value;

Expand All @@ -279,7 +279,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeTypeID : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeTypeID : IAnnotatedBytecode {
public Location Location;
public DreamPath? Path;
public int TypeID;
Expand All @@ -304,7 +304,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeProcID : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeProcID : IAnnotatedBytecode {
public Location Location;
public DreamPath? Path;
public int ProcID;
Expand All @@ -329,7 +329,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeFormatCount : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeFormatCount : IAnnotatedBytecode {
public int Count;
public Location Location;

Expand All @@ -352,7 +352,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeStackDelta : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeStackDelta : IAnnotatedBytecode {
public int Delta;
public Location Location;

Expand All @@ -375,7 +375,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeListSize : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeListSize : IAnnotatedBytecode {
public Location Location;
public int Size;

Expand All @@ -398,7 +398,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodePickCount : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodePickCount : IAnnotatedBytecode {
public int Count;
public Location Location;

Expand All @@ -421,7 +421,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeConcatCount : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeConcatCount : IAnnotatedBytecode {
public int Count;
public Location Location;

Expand All @@ -444,7 +444,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeResource : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeResource : IAnnotatedBytecode {
public Location Location;
public int ResourceID;
public string Value;
Expand All @@ -469,7 +469,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeLabel : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeLabel : IAnnotatedBytecode {
public string LabelName;
public Location Location;

Expand All @@ -493,7 +493,7 @@ public Location GetLocation() {
}


internal class AnnotatedBytecodeFilter : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeFilter : IAnnotatedBytecode {
public DreamPath FilterPath;
public int FilterTypeId;
public Location Location;
Expand All @@ -518,7 +518,7 @@ public Location GetLocation() {
}
}

internal class AnnotatedBytecodeReference : IAnnotatedBytecode {
internal sealed class AnnotatedBytecodeReference : IAnnotatedBytecode {
public int Index;
public Location Location;
public DMReference.Type RefType;
Expand Down
36 changes: 18 additions & 18 deletions DMCompiler/Optimizer/PeepholeOptimizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace DMCompiler.Optimizer;
// Assign [ref]
// Pop
// -> AssignPop [ref]
internal class AssignPop : IPeepholeOptimization {
internal sealed class AssignPop : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.Assign,
Expand All @@ -33,7 +33,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushNull
// AssignPop [ref]
// -> AssignNull [ref]
internal class AssignNull : IPeepholeOptimization {
internal sealed class AssignNull : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushNull,
Expand Down Expand Up @@ -64,7 +64,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushReferenceValue [ref]
// DereferenceField [field]
// -> PushRefAndDereferenceField [ref, field]
internal class PushField : IPeepholeOptimization {
internal sealed class PushField : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushReferenceValue,
Expand Down Expand Up @@ -92,7 +92,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushReferenceValue [ref]
// JumpIfFalse [label]
// -> JumpIfReferenceFalse [ref] [label]
internal class JumpIfReferenceFalse : IPeepholeOptimization {
internal sealed class JumpIfReferenceFalse : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushReferenceValue,
Expand Down Expand Up @@ -121,7 +121,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// ...
// PushString [string]
// -> PushNStrings [count] [string] ... [string]
internal class PushNStrings : IPeepholeOptimization {
internal sealed class PushNStrings : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushString,
Expand Down Expand Up @@ -157,7 +157,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// ...
// PushFloat [float]
// -> PushNFloats [count] [float] ... [float]
internal class PushNFloats : IPeepholeOptimization {
internal sealed class PushNFloats : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushFloat,
Expand Down Expand Up @@ -193,7 +193,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// ...
// PushReferenceValue [ref]
// -> PushNRef [count] [ref] ... [ref]
internal class PushNRef : IPeepholeOptimization {
internal sealed class PushNRef : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushReferenceValue,
Expand Down Expand Up @@ -229,7 +229,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushString [string]
// PushFloat [float]
// -> PushStringFloat [string] [float]
internal class PushStringFloat : IPeepholeOptimization {
internal sealed class PushStringFloat : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushString,
Expand Down Expand Up @@ -257,7 +257,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushFloat [float]
// SwitchCase [label]
// -> SwitchOnFloat [float] [label]
internal class SwitchOnFloat : IPeepholeOptimization {
internal sealed class SwitchOnFloat : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushFloat,
Expand Down Expand Up @@ -285,7 +285,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushString [string]
// SwitchCase [label]
// -> SwitchOnString [string] [label]
internal class SwitchOnString : IPeepholeOptimization {
internal sealed class SwitchOnString : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushString,
Expand Down Expand Up @@ -314,7 +314,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// ...
// PushStringFloat [string] [float]
// -> PushArbitraryNOfStringFloat [count] [string] [float] ... [string] [float]
internal class PushNOfStringFloat : IPeepholeOptimization {
internal sealed class PushNOfStringFloat : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushStringFloat,
Expand Down Expand Up @@ -350,7 +350,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// ...
// PushResource [resource]
// -> PushNResources [count] [resource] ... [resource]
internal class PushNResources : IPeepholeOptimization {
internal sealed class PushNResources : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushResource,
Expand Down Expand Up @@ -384,7 +384,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushNFloats [count] [float] ... [float]
// CreateList [count]
// -> CreateListNFloats [count] [float] ... [float]
internal class CreateListNFloats : IPeepholeOptimization {
internal sealed class CreateListNFloats : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushNFloats,
Expand Down Expand Up @@ -430,7 +430,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushNStrings [count] [string] ... [string]
// CreateList [count]
// -> CreateListNStrings [count] [string] ... [string]
internal class CreateListNStrings : IPeepholeOptimization {
internal sealed class CreateListNStrings : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushNStrings,
Expand Down Expand Up @@ -476,7 +476,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushNResources [count] [resource] ... [resource]
// CreateList [count]
// -> CreateListNResources [count] [resource] ... [resource]
internal class CreateListNResources : IPeepholeOptimization {
internal sealed class CreateListNResources : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushNResources,
Expand Down Expand Up @@ -523,7 +523,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushNRefs [count] [ref] ... [ref]
// CreateList [count]
// -> CreateListNRefs [count] [ref] ... [ref]
internal class CreateListNRefs : IPeepholeOptimization {
internal sealed class CreateListNRefs : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushNRefs,
Expand Down Expand Up @@ -568,7 +568,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// Jump [label1]
// Jump [label2] <- Dead code
// -> Jump [label1]
internal class RemoveJumpFollowedByJump : IPeepholeOptimization {
internal sealed class RemoveJumpFollowedByJump : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.Jump,
Expand All @@ -584,7 +584,7 @@ public void Apply(List<IAnnotatedBytecode> input, int index) {
// PushType [type]
// IsType
// -> IsTypeDirect [type]
internal class IsTypeDirect : IPeepholeOptimization {
internal sealed class IsTypeDirect : IPeepholeOptimization {
public ReadOnlySpan<DreamProcOpcode> GetOpcodes() {
return [
DreamProcOpcode.PushType,
Expand Down

0 comments on commit 1c9234f

Please sign in to comment.