C# Class kOS.Safe.Compilation.OpcodePushRelocateLater

This class is an ugly placeholder to handle the fact that sometimes The compiler creates an OpcodePush that uses relocatable DestinationLabels as a temporary place to store their arguments in the list until they get added to the program. Basically, it's this: Old way: 1. In some cases, like setting up locks, Compiler would create an OpcodePush with Argument = null, and a DestinationLabel = something. 2. ProgramBuilder would rebuild the OpcodePush's Argument by copying it from the DestinationLabel as part of ReplaceLabels at runtime. The Problem: When storing this in the ML file, BOTH the Argument AND the DestinationLabel would need to be stored as [MLFields] even though they are never BOTH populated at the same time, which causes ridiculous bloat. New Way: 1. Compiler creates an OpcodePushRelocateLater with a DestinationLabel = something. 2. ProgramBuilder replaces this with a normal OpcodePush who's argument is set to the relocated value of the DestinationLabel. Why: This way the MLFile only stores 1 argument: If it's an OpcodePush, it stores OpcodePush.Argument. If it's an OpcodePushRelocateLater, then it stores just OpcodePushRelocateLater.DestinationLabel and no argument.
Inheritance: Opcode
Exibir arquivo Open project: KSP-KOS/KOS

Private Properties

Property Type Description

Public Methods

Method Description
Execute ( ICpu cpu ) : void
OpcodePushRelocateLater ( string destLabel ) : System
PopulateFromMLFields ( List fields ) : void
ToString ( ) : string

Protected Methods

Method Description
OpcodePushRelocateLater ( ) : System

This variant of the constructor is just for ML file save/load to use.

Method Details

Execute() public method

public Execute ( ICpu cpu ) : void
cpu ICpu
return void

OpcodePushRelocateLater() protected method

This variant of the constructor is just for ML file save/load to use.
protected OpcodePushRelocateLater ( ) : System
return System

OpcodePushRelocateLater() public method

public OpcodePushRelocateLater ( string destLabel ) : System
destLabel string
return System

PopulateFromMLFields() public method

public PopulateFromMLFields ( List fields ) : void
fields List
return void

ToString() public method

public ToString ( ) : string
return string