| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
!1901 merge fix_native_ffi_java_get_env_calls_optimization into main fix: minimize get jni env calls for java mirrors Created-by: deed Commit-by: dmitriy sokolov Merged-by: CangjiePL Description: ## Change Details (Required) This PR is part of series of PRs that target Java FFI performance with cangjie. In this pr: added memoization on "get jni env" call result on @JavaMirror members like method, member variable, mirror constructor. This allows minimize such calls in runtime. ## Change Type (Required) Please describe the type of changes in this Pull Request (reason). **Simply save and click the checkbox, or when editing, change [ ] to [x] for the relevant item.** - [ ] Feature - [x] Bugfix - [ ] Build Process or Auxiliary Tool Changes - [ ] Documentation Update ## Self-Check of Changes (Required) **Please do not modify or delete the following options. Simply save and click the checkbox, or when editing, change [ ] to [x] for the relevant item.** ### Platform Differences: - [x] No difference - [ ] Difference - [ ] Windows - [ ] Linux - [ ] macOS - [ ] Other (Please explain the reasons below) ### Affected Components: - [x] cjc (Cangjie Compiler) - [ ] LSP (Cangjie Language Server) - [ ] cjfmt (Cangjie Formatter) - [ ] cjlint (Cangjie Lint Tool) - [ ] stdx (Cangjie Standard Library Extensions) - [ ] Other (Please explain the reasons below) ### Local Compilation Verification Results: - [x] Cangjie Compiler compiled successfully - [x] Cangjie Runtime compiled successfully - [x] Cangjie Standard Library compiled successfully - [ ] Not applicable (select this option for auxiliary tool changes or documentation updates) ### Local Test Case Verification Results: - [x] Pass. Please provide screenshots below. - [ ] Not applicable. Please explain the reasons below.  ## Related Issues (Required) [#998](https://gitcode.com/Cangjie/cangjie_compiler/issues/998) ## Comparison ### On integration tests Total calls to Java_CFFI_get_env() within all CJMP/java/integration tests (69 tests) Before opimization: **2992** After opimization: **1984** Note: integration tests are mostly targeting @JavaImpl classes, actual numbers for mirrors should be lower. ### On bechmarks Despite the fact total calls count is reduced, overall performance of java calls in @JavaMirror is not changed significantly because of Java_CFFI_get_env() is quite fast. On benchmarks, I see the following picture (No real impact on current numbers): Before optimization: CJ->Java static Iter=0 time 7992 ms; per call: 3996 4023 3973 4096 4191 AVG 4056 ns CJ->Java static Iter=100 time 8767 ms; per call: 4383 4741 4435 4572 4476 AVG 4522 ns CJ->Java static Iter=200 time 10703 ms; per call: 5351 4939 4985 5023 5157 AVG 5091 ns CJ->Java instance Iter=0 time 6984 ms; per call: 3492 2964 3537 2955 3518 AVG 3293 ns CJ->Java instance Iter=100 time 6874 ms; per call: 3437 4035 3427 3428 4014 AVG 3668 ns CJ->Java instance Iter=200 time 7800 ms; per call: 3900 4505 3897 4462 3897 AVG 4132 ns After optimization: CJ->Java static Iter=0 time 7870 ms; per call: 3935 3924 4099 3808 4101 AVG 3973 ns CJ->Java static Iter=100 time 8563 ms; per call: 4281 4362 4735 4475 4407 AVG 4452 ns CJ->Java static Iter=200 time 9778 ms; per call: 4889 5333 4914 4952 5116 AVG 5041 ns CJ->Java instance Iter=0 time 5851 ms; per call: 2925 3470 2961 3511 2941 AVG 3161 ns CJ->Java instance Iter=100 time 7955 ms; per call: 3977 3396 3390 4005 3398 AVG 3633 ns CJ->Java instance Iter=200 time 8889 ms; per call: 4444 3869 4451 3875 3880 AVG 4104 ns Nevertheless, profiling method calls, I can see (insignificant) performance impromement. The following is related to java instance benchmark. Before optimization: Java_CFFI_get_env: 3946 samples mirror method call: 86k samples  After optimization: Java_CFFI_get_env: 1698 samples mirror method call: 86k samples  See merge request: Cangjie/cangjie_compiler!1901 | 5 天前 | |
!1794 merge fix_issues_after_jd_case into main fix: objc block params missing retain and objcpointer wrap Created-by: filaco Commit-by: Dmitrii Chizha Merged-by: CangjiePL Description: ## Change Details (Required) Recently we have found the following issues with Cangjie uses ObjC interop: ObjCPointer<?Mirror> is unusable which is crucial for handling NSError** params from Objective-C ObjCBlock object collecting causes use after free Clang blames for our generated stub ctors (they don't have return statement) etc. Here is a [gist](https://gitcode.com/filaco/gists_public/blob/main/Retaining%20rules%20of%20@ObjC%20non-primitive%20types.md) describes the retain/release logic established. ## Change Type (Required) Please describe the type of changes in this Pull Request (reason). **Simply save and click the checkbox, or when editing, change [ ] to [x] for the relevant item.** - [ ] Feature - [x] Bugfix - [ ] Build Process or Auxiliary Tool Changes - [ ] Documentation Update ## Self-Check of Changes (Required) **Please do not modify or delete the following options. Simply save and click the checkbox, or when editing, change [ ] to [x] for the relevant item.** ### Platform Differences: - [x] No difference - [ ] Difference - [ ] Windows - [ ] Linux - [ ] macOS - [ ] Other (Please explain the reasons below) ### Affected Components: - [x] cjc (Cangjie Compiler) - [ ] LSP (Cangjie Language Server) - [ ] cjfmt (Cangjie Formatter) - [ ] cjlint (Cangjie Lint Tool) - [ ] stdx (Cangjie Standard Library Extensions) - [ ] Other (Please explain the reasons below) ### Local Compilation Verification Results: - [x] Cangjie Compiler compiled successfully - [x] Cangjie Runtime compiled successfully - [x] Cangjie Standard Library compiled successfully - [ ] Not applicable (select this option for auxiliary tool changes or documentation updates) ### Local Test Case Verification Results: - [x] Pass. Please provide screenshots below. - [ ] Not applicable. Please explain the reasons below.  ## Related Issues (Required) https://gitcode.com/Cangjie/cangjie_compiler/issues/933 See merge request: Cangjie/cangjie_compiler!1794 | 24 天前 | |
feat: add some new features support optional organization name in package deleclaration support cross compilation for ios(11) and andriod(31) support the extend synta for common/platform keyword Signed-off-by: wyq1213 <wangyinqiang2@huawei.com> | 8 个月前 | |
feat: java impl wrappers implementation for java ffi Signed-off-by: dmitriy sokolov <sokolov.dmitriy@huawei-partners.com> | 1 个月前 | |
feat: java impl wrappers implementation for java ffi Signed-off-by: dmitriy sokolov <sokolov.dmitriy@huawei-partners.com> | 1 个月前 | |
feat: add some new features support optional organization name in package deleclaration support cross compilation for ios(11) and andriod(31) support the extend synta for common/platform keyword Signed-off-by: wyq1213 <wangyinqiang2@huawei.com> | 8 个月前 |