Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/compiler/backend/cpp-backend-compilers/clang.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Clang

Clang is a C/C++ compiler using LLVM. Jule gives priority support to Clang and is recommended to be used with Clang whenever possible. Jule and related projects use Clang as the backend compiler and are primarily tested for Clang.
Clang is a C/C++ compiler using LLVM. Jule gives priority support to Clang and it's recommended to be used with Clang whenever possible. Jule and related projects use Clang as the backend compiler and are primarily tested for Clang.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this one is fine actually


## Why Do We Recommend Clang?

Expand All @@ -15,12 +15,12 @@ Clang is a C/C++ compiler using LLVM. Jule gives priority support to Clang and i

Jule has a standard library implemented entirely using the Windows API on Windows. For detailed information about Jule's Windows API support, refer to the [Windows API](/compiler/backend/cpp-backend-compilers/#windows-api-compatibility) section.

By default, Jule assumes that you are using Clang (not MinGW; with GCC command-line interface, not MSVC) on Windows if you are using Clang. However, if you are using MinGW Clang, it should not require additional effort.
By default, Jule assumes that you are using Clang (not MinGW; with GCC command-line interface, not MSVC) on Windows, if you are using Clang. However, if you are using MinGW Clang, it should not require additional effort.

If you want to use MinGW Clang, the [LLVM/Clang/LLD based mingw-w64 toolchain](https://github.com/mstorsjo/llvm-mingw) GitHub repository is recommended.

### Jule 0.1.3 and Before

The [Windows API](/compiler/backend/cpp-backend-compilers/#windows-api-compatibility) section mentions Jule's support for Windows API. You may want to use Clang on Windows. There is a Clang build we recommend so you can do this. It uses the MinGW toolchain. Compatible with compiling Jule IRs by default. Windows API support is not guaranteed.
The [Windows API](/compiler/backend/cpp-backend-compilers/#windows-api-compatibility) section mentions Jule's support for Windows API. You may want to use Clang on Windows. There is a Clang build we recommend so you can do this which uses the MinGW toolchain. Compatible with compiling Jule IRs by default. Windows API support is not guaranteed.

Here is the recommended [LLVM/Clang/LLD based mingw-w64 toolchain](https://github.com/mstorsjo/llvm-mingw) repository on GitHub.
12 changes: 6 additions & 6 deletions src/compiler/backend/cpp-backend-compilers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Even if you can compile code generated outside of official support compilers wit

### Primary Support

Primary support are primarily supported, most important and most recommended compilers. When a problem occurs in these compilers, priority is given to the solution and it is tried to be solved quickly.
Primary support is the primarily supported, most important and most recommended compilers. When a problem occurs in these compilers, priority is given to the solution and it is tried to be solved quickly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Primary support is the primarily supported, most important and most recommended compilers. When a problem occurs in these compilers, priority is given to the solution and it is tried to be solved quickly.
Primary support refers to the most important and recommended compilers. When a problem occurs with these compilers, it is given priority and addressed as quickly as possible.


### Partial Support

Partial support is compilers that are officially supported but not always guaranteed to be as accurate as primary supported compilers. Even if they can compile your code, there is also no guarantee that the executable will execute as expected.
Partial support is compilers that are officially supported but not always guaranteed to be as accurate as primary support compilers. Even if they can compile your code, there is no guarantee that the executable will run as expected.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Partial support is compilers that are officially supported but not always guaranteed to be as accurate as primary support compilers. Even if they can compile your code, there is no guarantee that the executable will run as expected.
Partial support covers compilers that are officially supported but offer lower accuracy and reliability than primary support compilers. Code may compile successfully, but correct runtime behavior is not guaranteed.


Partial support may not be available for all platforms and is broad in scope. Therefore, please read the relevant compiler's manual to find out why the associated compiler qualifies as partial support.

Expand All @@ -35,7 +35,7 @@ Supports compilation for C++14, C++17, C++20 standards. As for the standard, it

### Jule 0.0.10

It fixes compilation errors that caused by API when using C++14 standard.
It fixes compilation errors that are caused by the API when using C++14 standard.

### From Beta 0.0.7 to Jule 0.0.9

Expand Down Expand Up @@ -67,13 +67,13 @@ These tests were performed on Linux. When we tested GCC compilation on Windows w

### Jule 0.1.4 and Higher Versions

Jule supports Windows API. Our GitHub Action workflows use Clang (not MinGW) on Windows machines to compile Jule programs. In Jule 0.1.4, the `std/sys` package and whole standard library implemented using Windows API.
Jule supports Windows API. Our GitHub Action workflows use Clang (not MinGW) on Windows machines to compile Jule programs. In Jule 0.1.4, the `std/sys` package and standard library were implemented using Windows API.

If you encounter issues about Windows support, please report us via [Jule Issue Tracker](https://github.com/julelang/jule/issues).
If you encounter issues with Windows support, please report them to us via [Jule Issue Tracker](https://github.com/julelang/jule/issues).

### From Jule 0.0.14 to Jule 0.1.3

Jule supports the Windows API. Our GitHub Action workflows use Clang (not MinGW) on Windows machines to compile Jule programs. However, Windows API support is not guaranteed to work as expected. When using the Windows API,, your program may be able to compile successfully, but may need to take additional actions like linking missing libraries. If you encounter issues like that, please report us via [Jule Issue Tracker](https://github.com/julelang/jule/issues).
Jule supports the Windows API. Our GitHub Action workflows use Clang (not MinGW) on Windows machines to compile Jule programs. However, Windows API support is not guaranteed to work as expected. When using the Windows API, your program may be able to compile successfully, but it may need to take additional actions like linking missing libraries. If you encounter issues like that, please report them to us via [Jule Issue Tracker](https://github.com/julelang/jule/issues).

### Jule 0.0.13 and Older Versions

Expand Down
12 changes: 6 additions & 6 deletions src/compiler/basic-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The basics of compiler commands.

## help
Shows help about of commands.
Shows help about different commands.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Shows help about different commands.
Shows command-specific help.

```
$ julec help
$ julec help <command>
Expand All @@ -12,7 +12,7 @@ $ julec help <command>
The build command compiles the packages named by the import paths.

The compile path must be the main package directory of the program.
When compiling packages, build ignores files that end in `_test.jule`.
When compiling packages, build ignores files that end with `_test.jule`.
The main package must have the entry point `main` function.
```
$ julec build [arguments] <path>
Expand All @@ -23,8 +23,8 @@ The test command compiles the packages named by the import paths for testing.

The compile path must be the package directory of the program to be tested.
When compiling packages for testing, it will include files that end in `_test.jule`.
The package may have not the entry point `main` function, it will not be used.
Test compilations uses implicitly generated entry point for testing.
The package may not have the entry point `main` function, it will not be used.
Test compilations use an implicitly generated entry point for testing.

Read the [writing tests](/debugging/testing/writing-tests) section for more information.
```
Expand All @@ -39,7 +39,7 @@ Module commands.\
Read the [modules](/packages/modules/) section for more information.

## version
Shows version of the julec.
Shows the version of julec.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Shows the version of julec.
Shows the julec version.

```
$ julec version
```
Expand All @@ -52,7 +52,7 @@ $ julec tool
```

## env
Show information about jule environment.
Show information about the jule environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Show information about the jule environment.
Shows information about the jule environment.

```
$ julec env
```
62 changes: 31 additions & 31 deletions src/compiler/compiler-optimizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Some optimizations may not be applied for some scopes and expressions.
:::

`--opt-zcopy` \
Enabled special optimizations for the built-in copy function.
Enables special optimizations for the built-in copy function.
- If the source slice is an array slicing, it avoids allocating a new slice by making the slicing mutable. This only applies to the last sliced ​​array of expression.

---

`--opt-zappend` \
Enabled special optimizations for the built-in append function.
Enables special optimizations for the built-in append function.

- If the element slice is an array slicing, it avoids allocating a new slice by making the slicing mutable. This only applies to the last sliced ​​array of expression.

Expand Down Expand Up @@ -66,17 +66,17 @@ It eliminates dead (unused / unreachable) codes from object code.
---

`--opt-append` \
Enables special optimizations for built-in `append` function.
Enables special optimizations for the built-in `append` function.

- It prevents the allocating and destruction of a new slice by adding slice literals element-by-element if append used at single assignment statement.
- It prevents the allocating and destruction of a new slice by adding slice literals element-by-element if append is used at single assignment statement.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- It prevents the allocating and destruction of a new slice by adding slice literals element-by-element if append is used at single assignment statement.
- Prevents allocating and destruction of a new slice by adding slice literals element-by-element if append is used at single assignment statements.


---

`--opt-len` \
Enables special optimizations for built-in `len` function.
Enables special optimizations for the built-in `len` function.

- Simplifies expressions such as `len([]byte(myStr))` to `len(myStr)`.
- Converts expressions such as `len([]rune(myStr))` to more efficient variant which is avoids making allocation.
- Converts expressions such as `len([]rune(myStr))` to a more efficient variant which avoids making allocation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Converts expressions such as `len([]rune(myStr))` to a more efficient variant which avoids making allocation.
- Converts expressions such as `len([]rune(myStr))` to a more efficient variant which avoids allocation.


---

Expand All @@ -85,9 +85,9 @@ Enables special optimizations for mathematical operations.

- Skips the divide-by-zero check for division when operand is constant.
- Skips the divide-by-zero check for modulo when operand is constant.
- Converts multiplications to bit shifting if possible. Good conditions for this optimization: operands are integer, multiplier is constant and power of 2.
- Converts multiplications to bit shifting if possible. Good conditions for this optimization: operands are integers, multiplier is constant and power of 2.
- Converts modulo by 2 expressions to equivalent bitwise operation.
- Eliminates neutral binary expressions such as such as addition/subtraction with the constant-zero.
- Eliminates neutral binary expressions such as addition/subtraction with the constant-zero.
- Eliminates runtime overflow checking for binary shifting expressions if right operand is constant.
- Eliminates cost of the `x^0`, `0^x`, `x|0`, or `0|x` computations. It will be simplified to `x` expression.
- Eliminates cost of the `x&0`, `0&x` computations. It will be simplified to `0` expression.
Expand All @@ -99,8 +99,8 @@ Enables special optimizations for mathematical operations.
`--opt-access` \
Enables special optimizations for memory accessing.

- Skips safety checks such as boundary checking if accessed to array via constant index expression.
- Removes the cost of boundary checking of expressions like `array[i&(len(array)-1)]` for arrays whose length is power of two.
- Skips safety checks such as boundary checking if accessed an array via constant index expression.
- Removes the cost of boundary checking of expressions like `array[i&(len(array)-1)]` for arrays whose length is a power of two.
- If in a range iteration the iterated variable referred to by a immutable index variable is indexed, it is optimized as direct access and the cost of safety measures such as boundary checking is bypassed. <div class="warning-badge">experimental</div>
- If it can be understood that the index value used in any indexing process is within the boundaries, it removes the cost of boundary checking. <div class="warning-badge">experimental</div>
- If it can be understood that the smart pointer or reference pointer is not nil, it removes the cost of nil dereferencing. <div class="warning-badge">experimental</div>
Expand All @@ -110,7 +110,7 @@ Enables special optimizations for memory accessing.
`--opt-inline` \
Enables special optimizations for inlining.

- The IR is generated includes encourage inline optimizations of the backend compiler.
- The IR-generated includes encourage inline optimizations of the backend compiler.

---

Expand All @@ -125,29 +125,29 @@ Enables special optimizations for pointers.
Enables special optimizations for conditional expressions and structures.

- Removes unreachable if-else chain cases such as having constant false expressions. Applied for if-else chains, and match-cases.
- Remove unnecessary trailing cases that comes after constant true case. Applied for if-else chains, and match-cases.
- Removes unnecessary trailing cases that come after constant true case. Applied for if-else chains, and match-cases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Removes unnecessary trailing cases that come after constant true case. Applied for if-else chains, and match-cases.
- Removes unnecessary trailing cases that come after constant true cases. Applied for if-else chains and match-cases.

- Removes condition eval overhead of constant true cases. Applied for if-else chains, and match-cases.
- Avoids using wrapper for strings if string compared with literal.
- Eliminates and simplifies predictable boolean expressions. Such as `if (x || true)` will be handled as `if (true)` or `if (x && false)` will be handled as `if (false)`.
- Eliminates predictable comparison expressions. Such as `if (x > x)` will be handles ad `if (false)` or `if (x == x)` will be handled as `if (true)`.
- Avoids using a wrapper for a string if the string is compared with a literal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Avoids using a wrapper for a string if the string is compared with a literal.
- Avoids using wrapping strings compared with literals.

- Eliminates and simplifies predictable boolean expressions. Such as `if (x || true)` will be handled as `if (true)` and `if (x && false)` will be handled as `if (false)`.
- Eliminates predictable comparison expressions. Such as `if (x > x)` will be handled as `if (false)` and `if (x == x)` will be handled as `if (true)`.

---

`--opt-str` \
Enables special optimizations for string operations.

- Converts string comparison with empty literal to `len(s) == 0` check.
- Erases relevant ranges of string's itself instead of making allocation for substring and assignment if string gets assignment with substring from itself.
- Converts string comparison with empty literal to a `len(s) == 0` check.
- Erases relevant ranges of the string itself instead of making allocation for substring and assignment, if the string gets assigned with a substring from itself.
- Eliminates neutral binary expressions such as concatenation with the empty string.
- Optimizes allocations of the string concatenations if possible.
- Optimizes allocations of string concatenations if possible.
- Optimizes string and bytes conversions of binary expressions such as `str([]byte) == str([]byte)`.

---

`--opt-slice` \
Enables special optimizations for slice operations.

- Erases relevant ranges of slice's itself instead of making allocation for subslice and assignment if slice gets assignment with subslice from itself.
- Erases relevant ranges of the slice itself instead of making allocation for subslice and assignment, if a slice gets assigned with a subslice from itself.

---

Expand All @@ -161,10 +161,10 @@ Enables special optimizations for array operations.
`--opt-assign`\
Enables special optimizations for assignments.

It's will not check deeply whether expressions are same. So if you want take advantage of this optimization, keep simple your assignments.
It will not check deeply whether expressions are same. So if you want take advantage of this optimization, keep your assignments simple.

- Removes self assignments such as `a = a` or `a, b = a, b`.
- Optimize swap assignments such as `a, b = b, a`.
- Optimizes swap assignments such as `a, b = b, a`.

---

Expand All @@ -181,21 +181,21 @@ Enables special optimizations for iterations.

- Removes casting if non-constant string casted to byte slice for range iteration. Uses string's bytes directly.
- Removes casting if non-constant string casted to rune slice for range iteration. Avoids making allocation for temporary rune slice, iterates runes of string directly.
- Makes array the slice literal expressions of the range iterations.
- Makes arrays the slice literal expressions of the range iterations.

---

`--opt-dynamic`\
Enables special optimizations for dynamic programming features.

- If it can be understood that the `<any>` is the type `x` and not nil, it removes the cost of not-nil and type compatibility checking for type assertion expressions with type `t`. <div class="warning-badge">experimental</div>
- If it can be understood that `<any>` is the type of `x` and it isn't nil, it removes the cost of not-nil and type compatibility checking for type assertion expressions with type `t`. <div class="warning-badge">experimental</div>

---

`--opt-std-strings`\
Enables special optimizations for the `std/strings` package.

- Removes exceptional handling cost if possible of the `Write`, `WriteByte`, `WriteRune`, and `WriteStr` methods of the `Builder` struct.
- Removes exceptional handling costs, if possible, of the `Write`, `WriteByte`, `WriteRune`, and `WriteStr` methods of the `Builder` struct.

## Optimization Levels

Expand All @@ -211,8 +211,8 @@ Set optimization level to `<level>`.
The optimization levels are as follows:

- `L0`: The default optimization level: no special optimizations.
- `L1`: passes all `L0` flags with `--opt-zcopy`, `--opt-zappend`, `--opt-copy`, `--opt-deadcode`, `--opt-append`, `--opt-math`, `--opt-access`, `--opt-inline`, `--opt-ptr`, `--opt-cond`, `--opt-str`, `--opt-slice`, `--opt-assign`, `--opt-iter`, `--opt-dynamic`, `--opt-array`, `--opt-len`
- `L2`: passes all `L1` flags with `--opt-std-strings`
- `L1`: passes all `L0` flags along with `--opt-zcopy`, `--opt-zappend`, `--opt-copy`, `--opt-deadcode`, `--opt-append`, `--opt-math`, `--opt-access`, `--opt-inline`, `--opt-ptr`, `--opt-cond`, `--opt-str`, `--opt-slice`, `--opt-assign`, `--opt-iter`, `--opt-dynamic`, `--opt-array`, `--opt-len`
- `L2`: passes all `L1` flags along with `--opt-std-strings`

## Production Compilation

Expand All @@ -235,21 +235,21 @@ Pros of enabling production compilation:
Cons of enabling production compilation:
- Harder debugging.
- Longer compile time.
- Some subtle bugs can only occur with optimizations enabled by production compilation and can cause the executable to behave differently than expected. It is mostly related to the codes you write or use when using C/C++ interoperability.
- Some subtle bugs can only occur with optimizations enabled by production compilation and can cause the executable to behave differently than expected. It is mostly related to the code you write or use when using C/C++ interoperability.
- If the backend compiler you are using has some new optimizations or contains bugs, your code may run fast but not as expected. These types of optimization-related bugs can be difficult to track down.

## Optimization Options vs Production Compilation

Optimization options and production compilation focus on different things. Optimization options focus on achieving optimizations on the IR generated by your compiler. It doesn't interfere with anything else. Production compilation now focuses on compiling the IR you get when you want to compile software that is ready for production. Production compiler never enables the optimization flag. It focuses solely on compiling IR for production. If necessary, IR can remove things that are not required for production, but these changes are not improvements provided by optimization options. For best performance and optimization in production, optimization options and production compilation should be used together.
Optimization options and production compilation focus on different things. Optimization options focus on achieving optimizations on the IR generated by your compiler. It doesn't interfere with anything else. Production compilation focuses on compiling the IR you get when you want to compile software that is ready for production. Production compiler never enables the optimization flag. It focuses solely on compiling IR for production. If necessary, IR can remove things that are not required for production, but these changes are not improvements provided by optimization options. For best performance and optimization in production, optimization options and production compilation should be used together.

### Optimization Options

- Focus to code generation optimizations, better IR.
- Never do not touch backend compiler.
- Focus on code generation optimizations, better IR.
- Never interact with backend compiler.

### Production Compilation

- Focus to faster executables as possible.
- Focus on the fastest executable possible.
- Optimize code generation for better IR if necessary.
- Enable optimizations of backend compiler.
- Generate production-ready IR.
Loading