Skip to content

Commit

Permalink
Release 2024-01-22
Browse files Browse the repository at this point in the history
  • Loading branch information
cardillan committed Jan 22, 2024
1 parent f64d743 commit d54809c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
14 changes: 7 additions & 7 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

## Unreleased
## 2024-01-22

### Added

Expand All @@ -12,14 +12,14 @@ All notable changes to this project will be documented in this file.
* Added support for the [`effect` instruction](doc/syntax/FUNCTIONS_V7A.markdown#instruction-effect).
* Added more capabilities to the
[Expression Optimization](doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown#expression-optimization):
* Replacing `@this.x` and `@this.y` expressions by `@thisx`/`@thisy` built-in constants.
* Replacing `@constant.id` expressions by an integer value of the ID assigned to the `@constant`, assuming it is a
known item, liquid, block type or unit type. This optimization is only active on `aggresive` optimization level.
* Replacing `@this.x` and `@this.y` expressions by the `@thisx`/`@thisy` built-in constants.
* Replacing `@constant.id` expressions by an integer value of the ID assigned to the `@constant`, assuming it is
a known item, liquid, block type or unit type. This optimization is only active on `aggresive` optimization level.
For example, `id = @graphite.id` gets compiled down to `set id 3`, allowing further optimizations on the
constant value (`3`) to take place.
* Replacing multiplication by literal zero with setting the target variable to a zero directly, and replacing
multiplication/division and addition/subtraction of a zero with setting the target variable to the other operand
directly.
* Replacing multiplication by literal zero by an instruction setting the target variable to a zero directly, and
replacing multiplication/division by one and addition/subtraction of zero by an instruction setting the target
variable to the other operand directly.

## 2024-01-19

Expand Down
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The main focus of Mindcode design is two-fold:

Some of the latest enhancements to Mindcode are:

* All instructions added in Mindustry 7 build 146 are now supported.
* A number of powerful code optimizations:
[Data Flow Optimization](doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown#data-flow-optimization),
[Loop Unrolling](doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown#loop-unrolling),
Expand Down
10 changes: 7 additions & 3 deletions ROADMAP.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ This documents servers as a scratch pad to track ideas and possible enhancements

# Incremental improvements

* Expand Data FLow Optimization to handle multiplication by zero, multiplication/division by one, and
addition/subtraction of zero directly.
* Expand handling of expressions by the Data Flow Optimization:
* handle multiplication by zero, multiplication/division by one, and addition/subtraction of zero directly (i.e.
independently of the Expression Optimization).
* When there are two subsequent MUL/DIV or ADD/SUB instructions, the first one not being used by any other
instruction and the second one containing a constant, move the constant to the first instruction. Would facilitate
constant folding for more complex expressions.
* Add factoring-out capability to more complex expressions.
* Utilizing the new `id` property:
* Add built-in constants to the documentation, ensure uniform terminology.
* Schemacode
* replace the `Item` and `Liquid` enums with metadata, possibly utilize units).
* Mindcode
Expand Down
3 changes: 3 additions & 0 deletions doc/syntax/SYNTAX-6-OPTIMIZATIONS.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ optimizations are available:
* `sensor var @this @x` and `sensor var @this @y` are replaced by `set var @thisx` and `set var @thisy` respectively.
Data Flow Optimization can then apply [constant propagation](#constant-propagation) to the `@thisx`/`@thisy`
built-in constants.
* Multiplication by literal zero is replaced by a `set` instruction setting the target variable to a zero.
* Multiplication/division by one and addition/subtraction of zero are replaced by a `set` instruction setting the
target variable to the other operand.
* All set instructions assigning a variable to itself (e.g. `set x x`) are removed.

If the optimization level is `aggressive`, the following additional expressions are handled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,14 @@ void generatesNewPathfind() {
createInstruction(END)
);
}

@Test
void generatesNewAutoPathfind() {
assertCompilesTo("""
autoPathfind()
""",
createInstruction(UCONTROL, "autoPathfind"),
createInstruction(END)
);
}
}
2 changes: 1 addition & 1 deletion webapp/src/main/resources/templates/common.ftlh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<#macro footer>
<footer class="mt-8 text-xs text-center border border-t-2 border-l-0 border-r-0 border-b-0 border-gray-700">
<div class="mt-4 flex justify-between">
<div><strong>2024-01-19</strong></div>
<div><strong>2024-01-22</strong></div>
<div><strong>PRIVACY POLICY</strong>: This website does not track its users. The Mindcode and schematics you submit for compilation is kept for later analysis.
No other information is kept about you or your actions on the site.</div>
<div>Created by François (<a class="underline text-blue-500" href="https://github.com/francois">GitHub</a>,
Expand Down

0 comments on commit d54809c

Please sign in to comment.