Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Dec 2, 2023
1 parent fbed262 commit 61862b6
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 35 deletions.
8 changes: 5 additions & 3 deletions docs/business/advancedcodeoptimization.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 高级指令优化

:::warning
高级指令优化尚在开发中,预计于2023.10有预览版本
高级指令优化尚在开发中。
:::

高级指令优化技术是独立于标准指令优化技术的实现。高级指令优化技术使用更丰富的编译优化技术,极大提升了解释模块的性能。
Expand All @@ -17,13 +17,15 @@
- 常量复制优化
- 局部复制传播优化
- 全局复制传播优化
- 函数inline,甚至能inline AOT函数
- 解释函数inline
- AOT函数inline(专利技术)
- 提供更多instinct指令,大幅提升常见的指令组合性能
- 条件检查消除技术。消除不必要的空指针检查、类型强转检查、数组越界检查
- CheckOnce运行时检查动态消除优化。例如访问静态成员变量的指令,在第2次执行时不再检查类型是否已经初始化过
- 其他优化


## 性能

待发布后再测试
TODO

17 changes: 14 additions & 3 deletions docs/business/advancedencryption.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# 高级代码加固

高级代码加固是高级指令优化技术的衍生技术。相比标准代码加固更安全可靠
高级代码加固使用自定义的程序集结构和自定义的指令,极大提升了App安全性

## 原理

高级指令优化在优化过程中将IL指令提前转换为寄存器指令,并且做复杂的优化和变换,最后再输出最终的指令。
最终指令与原始IL指令不仅指令集不同,也不存在一一对应关系,无法直接逆向,极大提高了代码安全性。

高级代码加固技术从以下几个方面提升了代码安全性:

- 使用自定义的可随机化的程序集结构。程序集结构定义本身是可以随机化的,通过生成相应的专有代码
来解析相应结构,极大提高了破解难度
- 对所有元数据结构进行自定义的转换,使得无法再被常规的IL反编译工具(如ILSpy)读取
- 提前将IL指令不可逆地转换为自定义寄存器指令集,指令集本身也可以随机化


## 其他优势

- 由于已经离线提前转换为自定义寄存器指令集,指令翻译更快
- 与高级指令优化技术配合,最大程度提升执行效率


17 changes: 17 additions & 0 deletions docs/business/ilinterpreter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# IL解释器

直接执行原始IL指令的解释器。

## 介绍

hybridclr提供的寄存器指令解释器在执行前将原始IL指令转换为独有的寄存器指令,再解释执行。其中不仅有转换指令的开销,
转换后的指令还会占用大量内存。对于大多数dll,充分运行后转换后的寄存器指令大约会占0.9-1.5倍dll大小内存。这对于WebGL
平台来说,是一个不可忽视的开销。

我们实现一个直接解释执行原始IL指令的解释器,虽然会明显降低了执行性能,但节约了内存。在一些内存紧张的场合,有一定实践意义。

## 优点

- 执行前不需要指令转换,启动更快
- 不需要转换为寄存器指令,节约内存
- 可以实施一些有用的执行策略,例如执行10遍后切换到寄存器指令执行模式
26 changes: 18 additions & 8 deletions docs/business/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,48 @@
## 商业化版本

:::tip
所有商业化版本均支持**付费**获得试用版本。如果最终决定购买,则试用费可以从最终价格中完全抵扣;如果
最终因为非产品因素而放弃购买则不退试用费用。

所有商业化版本都会长期支持**Unity 2019-2022 LTS**版本,确保项目有长久稳定的技术支持。

:::

目前有三个商业化版本,它们的具体特性对比如下。
目前有三个商业化版本,具体特性对比如下:

- [专业版](./pro/intro.md)。优化了性能、内存,提供更高的代码安全
- [**旗舰版**](./ultimate/intro.md)。包含专业版的所有功能,另外包含了我们最核心的[DHE技术](./differentialhybridexecution),极大提升了性能,几乎(**未改动时为100%**)达到同等的原生AOT水平
- [热重载版](./reload/intro.md)。包含专业版的所有功能,同时支持卸载和重新加载单独的assembly,当前可以卸载掉程序集**100%**的元数据内存


|特性|社区版|专业版|旗舰版|热重载版|
|-|-|-|-|-|
|解释执行|||||
|MonoBehaviour|||||
|补充元数据|||||
|增量式GC|||||
|Unity 2020-2022 LTS|||||
|Unity 2019 LTS|从3.x版本起不再支持2019||||
|Unity 2019 LTS|从3.x版本起不再支持||||
|[完全泛型共享](./fullgenericsharing)|||||
|[元数据优化](./metadataoptimization.md)|||||
|[标准指令优化](./basiccodeoptimization)|||||
|[标准代码加固](./basicencryption)|||||
|[**DHE技术**](./differentialhybridexecution)|||||
|[IL解释器(实验性)](./ilinterpreter)|||||
|[高级代码加固](./advancedencryption)|||||
|[热重载](./reload/hotreloadassembly)|||||
|技术支持|||||
|[高级指令优化(实验性)](./advancedcodeoptimization)|||||
|[**DHE技术**](./differentialhybridexecution)|||||
|技术支持||1年|2年|2年|

### 价格标准

:::tip
所有商业化版本均支持**付费**获得试用版本。如果最终决定购买,则试用费可以从最终价格中完全抵扣;如果
最终因为非产品因素而放弃购买则不退试用费用。
:::

|版本|价格(人民币)|描述|
|-|-|-|
|社区版|0|免费|
|专业版|邮件咨询商务|买断一个项目的使用权,同时包含2小时的技术支持,提供1年代码更新|
|社区版|0|无限期使用|
|专业版|邮件咨询商务|买断一个项目的使用权,同时包含1年技术支持,提供1年代码更新|
|热重载版|邮件咨询商务|买断一个项目的使用权,同时包含2年技术支持,提供2年代码更新|
|旗舰版|邮件咨询商务|买断一个项目的使用权,同时包含2年技术支持,提供2年代码更新|

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
# Advanced instruction optimization

:::warning
Advanced instruction optimization is still under development and is expected to have a preview version in October 2023.
Advanced instruction optimizations are still under development.
:::

Advanced instruction optimization techniques are implemented independently of standard instruction optimization techniques. Advanced instruction optimization technology uses richer compilation optimization technology to greatly improve the performance of the interpretation module.
The overall execution performance of optimized instructions is improved by 100%-1000% (you read that right, more than 10 times) or even higher, especially the overall improvement of numerical instructions by nearly 300%.
Advanced instruction optimization technology is an implementation independent of standard instruction optimization technology. Advanced instruction optimization technology uses richer compilation optimization technology to greatly improve the performance of the interpretation module.
After optimization, the overall instruction execution performance is improved by 100%-1000% (yes, more than 10 times) or even higher, especially the overall improvement of numerical instructions by nearly 300%.
And because it has been converted in advance, the loading and instruction translation process is faster and the lag is smaller.

## Implementation
## accomplish

Advanced instruction optimization techniques include the following optimization techniques:
Advanced instruction optimization technology includes the following optimization technologies:

- Complete elimination of useless stack instructions. Eliminate all unnecessary stack operations
- Peephole optimization
- Constant copy optimization
- Optimization of local copy propagation
- Global copy propagation optimization
- Function inline, even inline AOT function
- Provide more intrinsic instructions, greatly improving the performance of common instruction combinations
- CheckOnce runtime checks dynamically eliminate optimizations. For example, the instruction to access the static member variable no longer checks whether the type has been initialized when it is executed for the second time
- Explain function inline
- AOT function inline (patented technology)
- Provide more instinct instructions to greatly improve the performance of common instruction combinations
- Conditional check elimination technology. Eliminate unnecessary null pointer checks, type cast checks, and array out-of-bounds checks
- CheckOnce runtime checks dynamically eliminate optimizations. For example, an instruction that accesses a static member variable will no longer check whether the type has been initialized during the second execution.
- Other optimizations


## Performance

Will test again after release.
TODO.
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Advanced Code Encryption
# Advanced code hardening

Advanced code encryption is a derivative of advanced instruction optimization technology. It is safer and more reliable than standard code encryption.
Advanced code hardening uses custom assembly structures and custom instructions to greatly improve App security.

## Principle

Advanced instruction optimization converts IL instructions into register instructions in advance during the optimization process, and performs complex optimization and transformation, and finally outputs the final instructions.
The final instruction and the original IL instruction not only have different instruction sets, but also do not have a one-to-one correspondence. They cannot be directly reversed, which greatly improves code security.

Advanced code hardening technology improves code security in the following aspects:

- Use custom randomizable assembly structures. The assembly structure definition itself can be randomized by generating corresponding proprietary code
To analyze the corresponding structure, greatly improving the difficulty of cracking
- Custom transformation of all metadata structures so that they can no longer be read by regular IL decompilation tools (such as ILSpy)
- Irreversibly convert IL instructions into custom register instruction sets in advance, and the instruction set itself can also be randomized


## Other advantages

- Since it has been converted offline to a custom register instruction set in advance, instruction translation is faster
- Cooperate with advanced instruction optimization technology to maximize execution efficiency
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# IL interpreter

Interpreter that directly executes raw IL instructions.

## introduce

The register instruction interpreter provided by hybridclr converts the original IL instruction into a unique register instruction before execution, and then interprets and executes it. There is not only the overhead of conversion instructions,
The converted instructions also take up a lot of memory. For most dlls, the converted register instructions will occupy approximately 0.9-1.5 times the dll size memory after full operation. This is for WebGL
For the platform, it is an expense that cannot be ignored.

We implement an interpreter that directly interprets and executes the original IL instructions. Although it will significantly reduce the execution performance, it saves memory. In some situations where memory is tight, it has certain practical significance.

## advantage

- No instruction conversion required before execution, faster startup
- No need to convert to register instructions, saving memory
- Some useful execution strategies can be implemented, such as switching to register instruction execution mode after executing 10 times
29 changes: 21 additions & 8 deletions i18n/en/docusaurus-plugin-content-docs/current/business/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,48 @@ We provide a variety of high-end commercial versions and flexibly customizable t
## Commercial version

:::tip
All commercial versions support **paid** trial versions. If you ultimately decide to purchase, the trial fee can be fully deducted from the final price; if
If you ultimately abandon the purchase due to non-product factors, the trial fee will not be refunded.

All commercial versions will support the **Unity 2019-2022 LTS** version for a long time, ensuring that the project has long-term and stable technical support.

:::

There are currently three commercial versions. Their specific features are compared as follows.
There are currently three commercial versions. The specific features are compared as follows:

- [Pro](./pro/intro.md). Optimized performance and memory to provide higher code security
- [**Ultimate**](./ultimate/intro.md). Contains all the functions of the professional version, and also includes our core [DHE technology] (./differentialhybridexecution), which greatly improves performance and almost (**100% without modification**) reaches the same level as native AOT
- [Hot reload version](./reload/intro.md). Contains all the features of the Pro version, while supporting unloading and reloading individual assemblies
- [Hot reload version](./reload/intro.md). Contains all the features of the professional version, and also supports unloading and reloading individual assemblies. Currently, **100%** of the assembly's metadata memory can be unloaded.


|Features|Community Edition|Professional Edition|Ultimate Edition|Hot Reload Edition|
|-|-|-|-|-|
|Explanation and Execution|||||
|MonoBehaviour|||||
|Supplemental Metadata|||||
|Incremental GC|||||
|Unity 2020-2022 LTS|||||
|Unity 2019 LTS|No longer supported from version 3.x||||
|[Full Generic Sharing](./fullgenericsharing)|||||
|[Metadata Optimization](./metadataoptimization.md)|||||
|[Standard command optimization](./basiccodeoptimization)|||||
|[Standard code reinforcement](./basicencryption)|||||
|[**DHE Technology**](./differentialhybridexecution)|||||
|[IL Interpreter (Experimental)](./ilinterpreter)|||||
|[Advanced code hardening](./advancedencryption)|||||
|[Hot reload](./reload/hotreloadassembly)|||||
|Technical Support|||||
|[Advanced code optimization (experimental)](./advancedcodeoptimization)|||||
|[**DHE Technology**](./differentialhybridexecution)|||||
|Technical support||1 year|2 years|2 years|

### Price Standard

:::tip
All commercial versions support **paid** trial versions. If you ultimately decide to purchase, the trial fee can be fully deducted from the final price; if
If you ultimately abandon the purchase due to non-product factors, the trial fee will not be refunded.
:::

|Version|Price (RMB)|Description|
|-|-|-|
|Community Edition|0|Free|
|Professional Edition|E-mail business consultation|Buy out the right to use a project, while providing 2 hours of technical support and 1 year of code updates|
|Professional Edition|Email Consultation Business|Buy out the right to use a project, including 1 year of technical support and 1 year of code updates|
|Hot reload version|E-mail business consultation|Buy out the right to use a project, including 2 years of technical support and 2 years of code updates|
|Ultimate version|E-mail consultation business|Buy out the right to use a project, including 2 years of technical support and 2 years of code updates|

Expand Down Expand Up @@ -62,4 +75,4 @@ The unused time in a single service can be reserved for next use. In order to sa

## contact us

Please use your company's **company email** to initiate consultations to business@code-philosophy.com. Emails initiated by individuals such as QQ or 126 email addresses will be ignored, please understand.
Please use your company's **company email** to initiate consultations to business@code-philosophy.com. Emails initiated by individuals such as QQ or 126 email addresses will be ignored, please understand.
3 changes: 3 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ const sidebars = {
'business/metadataoptimization',
'business/basiccodeoptimization',
'business/basicencryption',
'business/advancedcodeoptimization',
'business/advancedencryption',
'business/ilinterpreter',
'business/businesscase',
{
type: 'category',
Expand Down

0 comments on commit 61862b6

Please sign in to comment.