diff --git a/DMCompiler/Bytecode/DreamProcOpcode.cs b/DMCompiler/Bytecode/DreamProcOpcode.cs index 20b67e3b1b..4241c81664 100644 --- a/DMCompiler/Bytecode/DreamProcOpcode.cs +++ b/DMCompiler/Bytecode/DreamProcOpcode.cs @@ -293,8 +293,6 @@ public enum DreamProcOpcode : byte { NullRef = 0x96, [OpcodeMetadata(0, OpcodeArgType.Reference)] ReturnReferenceValue = 0x97, - [OpcodeMetadata(0, OpcodeArgType.Reference)] - AssignAndPushReferenceValue = 0x98, } // ReSharper restore MissingBlankLines diff --git a/DMCompiler/Optimizer/PeepholeOptimizations.cs b/DMCompiler/Optimizer/PeepholeOptimizations.cs index a14961608d..30949b63d0 100644 --- a/DMCompiler/Optimizer/PeepholeOptimizations.cs +++ b/DMCompiler/Optimizer/PeepholeOptimizations.cs @@ -743,7 +743,8 @@ public void Apply(List input, int index) { // AssignPop [ref] // PushReferenceValue [ref] -// -> AssignAndPushReferenceValue [ref] +// -> Assign [ref] +// These opcodes can be reduced to a single Assign as long as the [ref]s are the same internal sealed class AssignAndPushReferenceValue : IPeepholeOptimization { public ReadOnlySpan GetOpcodes() { return [ @@ -776,7 +777,7 @@ public void Apply(List input, int index) { AnnotatedBytecodeReference assignTarget = firstInstruction.GetArg(0); input.RemoveRange(index, 2); - input.Insert(index, new AnnotatedBytecodeInstruction(DreamProcOpcode.AssignAndPushReferenceValue, [assignTarget])); + input.Insert(index, new AnnotatedBytecodeInstruction(DreamProcOpcode.Assign, [assignTarget])); } } diff --git a/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs b/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs index 1617e29c93..71c71ce539 100644 --- a/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs +++ b/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs @@ -2900,16 +2900,6 @@ public static ProcStatus AssignPop(DMProcState state) { return ProcStatus.Continue; } - public static ProcStatus AssignAndPushReferenceValue(DMProcState state) { - DreamReference reference = state.ReadReference(); - DreamValue value = state.Pop(); - - state.AssignReference(reference, value); - state.Push(value); - - return ProcStatus.Continue; - } - public static ProcStatus PushReferenceAndDereferenceField(DMProcState state) { DreamReference reference = state.ReadReference(); string fieldName = state.ReadString(); diff --git a/OpenDreamRuntime/Procs/DMProc.cs b/OpenDreamRuntime/Procs/DMProc.cs index be4484a58c..d67fc650d2 100644 --- a/OpenDreamRuntime/Procs/DMProc.cs +++ b/OpenDreamRuntime/Procs/DMProc.cs @@ -305,7 +305,6 @@ public sealed class DMProcState : ProcState { {DreamProcOpcode.PushRefandJumpIfNotNull, DMOpcodeHandlers.PushReferenceAndJumpIfNotNull}, {DreamProcOpcode.NullRef, DMOpcodeHandlers.NullRef}, {DreamProcOpcode.AssignPop, DMOpcodeHandlers.AssignPop}, - {DreamProcOpcode.AssignAndPushReferenceValue, DMOpcodeHandlers.AssignAndPushReferenceValue}, {DreamProcOpcode.PushRefAndDereferenceField, DMOpcodeHandlers.PushReferenceAndDereferenceField}, {DreamProcOpcode.PushNRefs, DMOpcodeHandlers.PushNRefs}, {DreamProcOpcode.PushNFloats, DMOpcodeHandlers.PushNFloats}, diff --git a/OpenDreamRuntime/Procs/ProcDecoder.cs b/OpenDreamRuntime/Procs/ProcDecoder.cs index 45e4d16278..f5725b082a 100644 --- a/OpenDreamRuntime/Procs/ProcDecoder.cs +++ b/OpenDreamRuntime/Procs/ProcDecoder.cs @@ -108,7 +108,6 @@ public ITuple DecodeInstruction() { case DreamProcOpcode.PushReferenceValue: case DreamProcOpcode.PopReference: case DreamProcOpcode.AssignPop: - case DreamProcOpcode.AssignAndPushReferenceValue: case DreamProcOpcode.ReturnReferenceValue: return (opcode, ReadReference());