Skip to content

docs: Add optimizer documentation#1481

Merged
Jim8y merged 2 commits intoneo-project:master-n3from
Jim8y:docs/optimizer-documentation
Jan 27, 2026
Merged

docs: Add optimizer documentation#1481
Jim8y merged 2 commits intoneo-project:master-n3from
Jim8y:docs/optimizer-documentation

Conversation

@Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Jan 26, 2026

Summary

Add comprehensive documentation for the bytecode optimizer.

Changes

  • Created README.md in Optimizer/ directory
  • Documented all optimization strategies (Peephole, JumpCompresser, Reachability, Miscellaneous)
  • Added architecture overview and usage instructions

Documentation Includes

  • Strategy descriptions with examples
  • Performance impact estimates
  • Guide for adding new strategies

Document the bytecode optimization strategies including:
- Peephole optimization
- Jump compression
- Reachability analysis
- Miscellaneous optimizations

Also includes architecture overview and usage instructions.
nccs MyContract.csproj --no-optimize

# Specific optimization level
nccs MyContract.csproj --optimize basic
Copy link
Member

Choose a reason for hiding this comment

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

before I remember there was something like "--optimize all", was it removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@Jim8y Jim8y merged commit 73b0b45 into neo-project:master-n3 Jan 27, 2026
3 checks passed
Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

Lgtm

Jim8y added a commit that referenced this pull request Jan 28, 2026
* Update neo submodule to master-n3 (#1453)

Co-authored-by: Neo Dev Bot <dev@neo.local>

* Use stable framework package in templates (#1456)

* Add: FindOptions.Backwards definition (#1458)

* Add: IsContract for ContractManagement (#1454) (#1455)

Co-authored-by: Will <201105916+Wi1l-B0t@users.noreply.github.com>

* CI: run on master-n3 (#1459)

* Update neo (#1463)

* Upgrade devpack to Neo v3.9.0 (#1464)

* Upgrade devpack to Neo v3.9.0

* Restore manifest version in test artifacts

* Add: comment doc for Framework.Services (#1460) (#1467)

* Fix: remove many compiler warnings (#1461) (#1469)

* Reorder (#1472)

* Fix CS0067 warning in artifacts (#1474)

* Avoid CS0067 in artifacts

* one more

* Add: comments doc for ContractMethod CallFlags (#1479)

* Add reference (#1476)

* docs: Clarify Base58CheckDecode FAULT behavior in UInt160.Parse (#1483)

Update documentation to warn that invalid Base58Check addresses will cause
execution to FAULT (abort) rather than throw a catchable exception.

Fixes #1443

* fix: HexStringInterpreter regex should only accept hex characters (#1484)

Change regex from [a-zA-Z0-9_] to [a-fA-F0-9] to properly validate
hexadecimal strings (0-9, a-f, A-F only).

Fixes #1264

* docs: Add optimizer documentation (#1481)

* docs: Add optimizer documentation

Document the bytecode optimization strategies including:
- Peephole optimization
- Jump compression
- Reachability analysis
- Miscellaneous optimizations

Also includes architecture overview and usage instructions.

* docs: add OptimizationType enum options to optimizer documentation

* fix(compiler): extend division overflow check and improve temp file security (#1485)

* fix(compiler): extend division overflow check to IntPtr type

- Add comprehensive documentation for CheckDivideOverflow method
- Extend overflow check to include IntPtr (nint) type
- Use BigInteger for consistent handling of min values
- Add clear comments explaining which types need/don't need overflow checks

Fixes HIGH-002 from security audit

* test: add unit tests for division overflow fix

Demonstrates the IntPtr (nint) division overflow issue and fix:
- Before fix: nint.MinValue / -1 would silently overflow
- After fix: properly throws in checked context

Tests cover Int32, Int64, IntPtr, and BigInteger division scenarios.

* fix: remove unsupported nint/nuint types from tests

Neo compiler does not support nint/nuint (IntPtr/UIntPtr) types.
Removed IntPtr handling from division overflow check and tests.

* test: add testing artifacts for division overflow and shift contracts

- Add Contract_DivisionOverflow.cs testing artifact
- Update Contract_shift.cs with new shift methods

All 938 tests pass locally.

* chore: revert neo submodule to master-n3 version

* fix: Support Event?.Invoke() conditional invocation pattern (#1482)

Add support for invoking events using the null-conditional operator.
When calling Event?.Invoke(...), the compiler now correctly recognizes
this as an event invocation and emits the appropriate System.Runtime.Notify call.

Fixes #1093

* Update examples for Neo v3.9 (#1465)

* Update examples for v3.9

* chore: Remove example nef and manifest artifacts

Remove compiled artifacts from examples as requested in PR review.
These files should be generated during build, not committed.

* refactor: replace neo submodule with NuGet package references (Neo 3.9.1) (#1489)

* refactor: replace neo submodule with NuGet package references (Neo 3.9.1)

- Remove neo submodule dependency
- Update project references to use NuGet packages:
  - Neo 3.9.1
  - Neo.Extensions 3.9.1
  - Neo.IO 3.9.1
  - Neo.Json 3.9.1
- Simplify CI workflow by removing submodule-related version extraction
- Fix PublishPackage job that was failing due to empty VERSION_NEO variable

* fix: workflow should support both master and master-n3 branches

* fix: restore Release job in workflow

* fix: remove neo submodule projects from solution file

* fix: handle partial class compilation with correct SemanticModel (#1488)

* fix: handle partial class compilation with correct SemanticModel

- Add SemanticModelExtensions.GetModelForNode() helper method
- Fix Expression.cs to check syntax tree before GetConstantValue
- Fix InvocationExpression.cs to get correct model for GetSymbolInfo
- Fix SourceConvert.cs to get correct model for GetTypeInfo

This fixes NC5001 errors when compiling contracts with partial classes
(e.g., Example.SmartContract.NFT) where syntax nodes may come from
different syntax trees than the current semantic model.

Closes #1363

* test: add unit tests for partial class cross-file compilation

Tests the fix for issue #1363 where syntax nodes from different
syntax trees caused NC5001 errors during compilation.

New tests cover:
- Cross-file method invocations in partial classes
- Expression-bodied members using constants from other files
- Complex expressions using both constants and methods across files

* refactor: use GetModelForNode helper in TryConvertConstant

Apply review suggestion to use the GetModelForNode extension method
instead of inline syntax tree check. This allows constant evaluation
to work across partial class files.

---------

Co-authored-by: Jimmy <jimmy@r3e.network>
Co-authored-by: Neo Dev Bot <dev@neo.local>
Co-authored-by: Will <201105916+Wi1l-B0t@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants