> For the complete documentation index, see [llms.txt](https://docs.kimlikdao.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kimlikdao.org/the-gcc-backend.md).

# The gcc backend

In the `opt` mode, kdts uses a fork of Google Closure Compiler (gcc) as a backend. This fork, which is called kdts-gcc in this document, is hosted at <https://github.com/KimlikDAO/gcc>.

Compared to stock gcc, this fork performs more aggressive optimizations; which often means making more assumptions about the accuracy of user provided types.

Some differences between kdts-gcc and stock gcc:

#### Constant folding of type predicates

In kdts-gcc, type predicates such as `Array.isArray(x)`, `typeof x == y`, `x instanceof y` are constant-folded if the declared or inferred type of the expression is enough the conclude the value of the expression.

See the [commit](https://github.com/google/closure-compiler/commit/95bd88c1ae26bea5f1e6c5a0f96a9470e844842a)

#### Color narrowing after a function inline

Stock gcc has advanced function inlining capabilities. If a function is inlined in the block mode, the body preserves the colors (types) of the original function. kdts-gcc tries to narrow the colors to ones implied by the specific parameters at the call site. This narrowing can lead to cascaded folds in the following passes.

See the [commit](https://github.com/google/closure-compiler/commit/7e6a1546d04802ac286a25525534599476371673)
