Releases: cardillan/mindcode
3.16.1
3.16.1 – 2026-04-12
Fixed
- Fixed incorrect Condition Optimization (#307).
Added
- Added a limit on the maximum length of mlog string literals (65,535 bytes in UTF-8 encoding). String literals larger than this limit cause compilation errors.
- Added a limit on the maximum generated mlog code size (102,400 bytes in UTF-8 encoding). When the generated or loaded mlog code exceeds this limit, an error or warning is generated, depending on the value of the
enforce-instruction-limitcompiler option. - Added support for the new
setrule pauseDisabledinstruction.
Changed
- The new version of the Mlog Watcher mod is now used by default by the tool app.
- Updated the Mindustry metadata to the latest version, adding the new
@large-canvasblock.
3.16.0
3.16.0 – 2026-03-06
Changed
- The
targetattribute specified in a Schemacode definition file now expects only the version number (e.g.,target = 8.0). The processor type cannot be specified using thetargetattribute, but is inferred from the block type in the schematic. - The web application has been completely overhauled. The highlights of the new web app are:
- Modern, mobile-friendly design.
- The compilation happens without page refresh, meaning the edit history of the code is not lost on compilation. It is also possible to undo (
Ctrl-Z) the action of loading an example code or clearing the editor. - Syntax highlighting in the source code editor. All syntaxes (Mindcode including mlog blocks, Schemacode) are supported.
- Code folding in all source code editors.
- Indicating syntax errors from the last compilation directly in the editor.
- Support for running schematics and generic mlog code on the built-in processor emulator.
3.15.1
3.15.1 – 2026-02-28
Fixed
- Fixed compiler crashing when an unsupported combination of a processor version and a processor type is specified (e.g.,
#set target = 6;). - Fixed wrong handling of linked blocks by the DFO (#303).
- Fixed Boolean Optimization bugs (#304):
- The optimization may crash when compiling for targets 8.0 and lower.
- The optimization incorrectly processes some noninteger values.
3.15.0
3.15.0 – 2026-02-22
Note
Atomic code sections are only guaranteed to execute correctly in Minddustry build 155 Beta or later.
Note
The new Mlog Watcher functionality available with the tool app requires a new version of the Mlog Watcher mod. The new version has not yet been released, but a Mindustry 8-compatible binary is available here. To use that version, the --watcher-version v1 command line argument must be specified.
Fixed
- Fixed a possible error in the tool app handling command-line parameters (#302).
Added
- Breaking: the
loopkeyword has been reintroduced, to create infinite loops. Code that usesloopas a function or variable name will not compile, and the variable or function will have to be renamed. - Added the possibility to use the
breakstatement to exit code blocks. - Added implicit labels to loops and code blocks.
Changed
- Breaking: Changed the meaning of the
targetcompiler option: when no processor type is specified, the compiler generates the code for a non-processor context. Privileged instructions are supported, but atomic sections and waits aren't.
3.14.0
3.14.0 – 2026-02-08
Note
Atomic code execution are only guaranteed to execute correctly in the latest BE version (build 26658 or later). The latest beta release (v154.3) doesn't provide necessary support for atomic code execution.
Note
The new Mlog Watcher functionality available with the tool app requires a new version of the Mlog Watcher mod. The new version has not yet been released, but a Mindustry 8-compatible build is available here. To use that version, the --watcher-version v1 command line argument must be specified.
Fixed
- Fixed an internal error when compiling a function in the main program declared as
export. - Fixed incorrect Temp variable elimination (#298).
- Fixed a possible internal error when parsing a syntactically incorrect file.
- Fixed incorrect handling of some privileged instructions by the Print Merging optimization (#300).
- Fixed incorrect handling of function calls in short-circuit expressions by the Data Flow Optimization (#301).
Added
- Added the
atomic()intrinsic function andatomicfunction modifier. - Added support for nested atomic sections and atomic function calls from an atomic section. The entire topmost atomic section is executed atomically.
- Added support atomic section merging. The duration limit of a merged section can be specified using the
atomic-merge-levelcompiler option (one tick by default). - Added a
atomic-safety-margincompiler option. No safety margin is necessary with the latest Mindustry BE build, though. - Added new tool app functionalities:
- Support for the new version of Mlog Watcher mod, providing several useful new ways to send or extract mlog code and schematics to/from a running game. To use the new Mlog Watcher mod, the
--watcher-version v1command-line argument needs to be specified. - Ability to execute mlog code loaded from a file on the processor emulator and for sending it to the Mlog Watcher. Use the new
pmorprocess-mlogcommand-line argument. - Ability to execute schematics loaded from a file on the processor emulator and for sending it to the new version of the Mlog Watcher. Use the new
psorprocess-schematiccommand-line argument.
- Support for the new version of Mlog Watcher mod, providing several useful new ways to send or extract mlog code and schematics to/from a running game. To use the new Mlog Watcher mod, the
- Added a validation step to the compiler to verify the generated code doesn't exceed the maximum number of instructions. The
enforce-instruction-limitcompiler option can be used to control this behavior.
Changed
- When an atomic section doesn't contain any protected instruction, the
waitinstruction providing the atomicity of the section is not generated. - The
setrateinstruction is no longer allowed in atomic sections. - The
volatile-atomiccompiler option has been renamed toatomic-full-protection, with inverted meaning. - Changed Mindcode syntax to allow specifying multiple function modifiers in arbitrary order. For example, it is now possible to declare a function as
inline debugas well asdebug inline(which was the only allower order previously). - Compiler and optimizer messages are no longer output on the console in the command-line application. To access these messages, a log file needs to be generated.
- Console output is generated on the fly, instead of being cached and dumped all at once when the processing is finished.
Deprecated
- The
dm(decompile mlog) andds(decompile schematic) command-line arguments are deprecated. Usepmandpsinstead ("p" stands for "process" as the command-line tool now allows more actions to be performed in addition to decompilation, such as running it on the internal emulator). - The Schematics Refresher mod is deprecated and will be no longer maintained. The Mlog Watcher mod will provide better functionality for managing schematics in the game.
3.13.0
3.13.0 – 2026-01-18
Note
The atomic code blocks are only guaranteed to execute correctly in the latest BE version (build 26609 or higher). The latest beta release (v154.3) doesn't provide necessary support for atomic code blocks.
Fixed
- Fixed incorrect emulation of the instruction accumulator for targets 6 and 7 affecting instruction scheduling.
Added
- Added new
@maxUnitssensable property. - Added an atomic code block: a block of code guaranteed to be executed atomically (without interruption), meaning that other processors or game updates do not change the world state.
- Added the
setrateandiptcompiler options. These options specify the rate at which a world processor executes instructions (used by the compiler when building atomic blocks). - Added the
volatile-atomiccompiler option governing the way atomic blocks are created. - Added the
processor-id,program-nameandprogram-versioncompiler options. These options take string values, which are then encoded into a*idvariable and can be used to identify the processor in the schematics. - Added the
emulator-fpscompiler options to specify the frame rate to be emulated by the processor emulator. While frames are always emulated fully by Mindcode emulator, the change in instruction scheduling caused by different frame rate only affects situations where an interaction between two or more processors is being emulated. - Added the ability to run the compiled schematics on the schematics emulator to the tool app.
- Added support for sensing
@xand@yin blocks when emulating schematics. - Added the
encode-zero-characterscompiler option, which allows encoding zero characters in string literals. Use with caution: resulting code cannot be edited or passed via clipboard. Option has no effect in the web app.
Changed
- Runtime errors generated when running the code in the processor emulator no longer prevent outputting the compiled code in the tool app.
- Changed the format of the
targetcompiler option. Instead of a processor edition (standard or world), a particular processor type is now specified, using the first letter of the type name (i.e.,mfor micro-,lfor logic-,hfor hyper-, andwfor world-processor, case-insensitive), for example,#set target = 8L;. - When compiling Mindcode for a processor in a schematic, the target type of the processor is determined by the block type in the schematic.
- Compiler-defined constants now follow the
@@VARIABLEpattern, instead of earlier__VARIABLE__(for example,@@MINDUSTRY_VERSION). - Changed the emulator handling of the
waitinstruction with zero argument to match the latest Mindustry BE behavior.
Miscellaneous
- The system of compiler options has been updated to allow determining whether a given option has been set. This allows the default values of unset options to be derived from the values of other options.
- The transfer variable, defined for uncached external and remote variables, is no longer used for reads. Instead, a fresh new temporary variable is used each time. This may increase the number of temporary variables generated but avoids unnecessary instructions when using postfix operators on these variables. This became quite important with atomic blocks.
3.12.1
3.12.0
3.12.0 - 2026-01-11
Fixed
- Fixed incorrect evaluation of some numeric mlog constants (#295).
- Fixed the Mandelbrot schematic sample not rendering after build.
Changed
- The Loop Rotation optimization has been updated:
- Full loop rotation is performed even for conditions which contain complex code (such as nested loops or function calls).
- A full loop rotation is also considered alongside a partial rotation if it could be beneficial to Loop Hoisting.
- The Loop Hoisting optimization has been extended:
- The optimizer gathers information to support the Loop Rotation optimization.
- When a loop is fully rotated, an instruction can be hoisted in such a way that it's executed at most once, but only if the loop actually runs.
- When a loop is not known to execute at least once, an instruction affecting just the loop can still get hoisted entirely out of the loop if the loop is nested.
- The mlog processor emulator has been completely rewritten. The emulator now matches the behavior if a Mindustry processor of the version identified by the
target(oremulator-targetcompiler options. - The execution flags have been updated to match the new processor emulator. Some flags have been removed, some have been added, and some have been renamed.
- The processor emulator is now able to execute supported instructions even when created using an
mlog()fuction or an mlog block. This includes the code generated by thecompatibilitylibrary.
3.11.0
3.11.0 - 2025-12-25
Note: the new features in this release bring about changes to the best practices for writing Mindcode.
Fixed
- Some
selectoptimizations were not applied when optimizing for size. As a result, code optimized for size might end up larger than code optimized for speed. - Some
selectoptimizations may have been incorrect. Due to the previous bug, the probability of them being applied was low (#290). - Fixed the wrong optimization of volatile variables in If Expression Optimization (#291).
- Fixed instructions being hoisted in front of the loop even when the loop is not guaranteed to run (#293).
- Fixed loop-dependent instructions being possibly hoisted in front of the loop (#294).
Added
- Breaking: new keywords have been added to the language:
publicandprivateand are reserved for future use. Code that uses any of these keywords as a function or variable name will not compile, and the variable or function will have to be renamed. - Added the
no-argument-paddingcompiler option. When activated, instructions are not padded to the maximum number of arguments. - Added the
authorcompiler option. The option adds an entry to the list of authors, which is then displayed alongside the usual compiler signature. - Added support for new instruction opcode (
ucontrol deconstruct). - Added a binary
inoperator for testing whether a value is contained in a given range or a list of values.
Changed
- Breaking: The
andandoroperators now perform short-circuit evaluation. - The Jump Optimization has been renamed to Condition Optimization, and has been significantly extended:
- Condition streamlining is now applied to the
selectandorinstructions as well as tojump. - The optimization is applied to all variables, not just temporary ones. The results of the DFO analysis are used to track user-defined variables.
- On
advancedlevel, constant folding of conditional expressions is now also performed.
- Condition streamlining is now applied to the
- Breaking: The
jump-optimizationcommand-line option and compiler directive has been renamed tocondition-optimization. - The Loop Optimization has been renamed to Loop Rotation, and has been extended to support short-circuit conditions. Full and partial loop rotations are now supported.
- Breaking: The
loop-optimizationcommand-line option and compiler directive has been renamed toloop-rotation. - The Boolean Optimization, previously included in the If Expression Optimization as a Select Optimization, has been extracted into a separate optimization class and enhanced:
- Several optimizations aimed at short-circuited conditional expressions were added.
- Where possible, an
opinstruction is used instead ofselect. This allows applying some optimizations even when the compilation target doesn't supportselect.
- The Expression Optimization has been updated:
- More cases where a
selectinstruction can be replaced with asetinstruction are now supported. - When the resulting values of
selectare0and1and the condition allows it, the instruction is replaced with anopinstruction. - The instruction normalizing the result of an
||operator to0or1is removed when not needed. - Added an optimization turning a
readinstruction with a constant string and a constant index into asetinstruction setting the character value directly.
- More cases where a
- When evaluating
jumpandselectconditions during optimizations, cases where the operands of the condition are identical (the same variable) are handled. - The
compatibilitysystem library now also performs a test to find out whether assigningnullto@counteris ignored by the processor. - The mimex metadata have been updated to match the current BE version. The most significant change is a new set of sound constants.
- The documentation has been restructured. Individual optimizers are described in separate files, and the description of Logic functions with links to the Function reference was also moved to a separate file.
Miscellaneous
- A new optimization, Instruction Reordering, is being developed. The corresponding compiler directive is already present, but the optimization, even when explicitly enabled, is not yet functional.
- All experimental features are now considered standard. The default optimization level is now advanced. Going forward, only features controllable via compiler options will be marked experimental, and the default optimization level will be
advanced. Note that Mindcode is a live system and features may be modified to support new functionalities. A reasonable effort will be spent to ensure smooth conversion or backwards compatibility, but all features, both well-established and relatively recent, can be changed or removed in a new release.
3.10.0
3.10.0 - 2025-11-17
Fixed
- Fixed an error in the Single Step Elimination optimization causing some superfluous jumps not being removed.
Added
- A new fast dispatch optimization is available for case expressions. Fast dispatch uses just a single instruction to transfer the control to the desired branch of a case expression, including the
elsebranch. - A new value translation optimization, which reads values encoded into a text string using the
readinstruction, may be applied on case expressions (#289). - Added the
use-text-translationscompiler option to allow/disallow using encoding values into a text string for the above optimization.
Changed
- Breaking: the
text-tablescompiler option has been renamed (yet again - sorry) touse-text-jump-tables. - The Case Switcher optimization was updated to fully support
nullvalues inwhenbranches (even in integer expressions). - The Extended testing tool now accepts values for any compiler directive in the settings file.