Commit Graph

3385 Commits

Author SHA1 Message Date
xushiwei
a6516de181 Merge pull request #1309 from MeteorsLiu/impl-baremetal-gc
feat: implement baremetal gc
2025-11-17 07:41:31 +08:00
xushiwei
4a268650fc Merge pull request #1400 from cpunion/build/refactor-main-module-generation
build: refactor main module generation and fix stdout/stderr null checks
2025-11-17 07:34:03 +08:00
Li Jie
7e4e53eb1c build: refactor emitStdioNobuf for performance and readability 2025-11-16 20:17:30 +08:00
Li Jie
1473ee98f7 build: add package and function docs 2025-11-16 20:16:16 +08:00
xgopilot
8c7e8b6290 build: apply review feedback on main module generation 2025-11-16 20:16:16 +08:00
xgopilot
2a4b2ef023 build: remove error return from genMainModule
The genMainModule function never returns an error, so simplified
its signature to return only Package.

Updated:
- genMainModule signature: (Package, error) -> Package
- Call site in build.go to not handle error
- Both test cases to remove error checking

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
2025-11-16 20:16:16 +08:00
xgopilot
7abb468592 fix: separate stdout and stderr null checks in emitStdioNobuf
The original code incorrectly used the stdout null check condition
for both stdout and stderr pointer selection. This caused incorrect
behavior when stderr is null but stdout is not, or vice-versa.

This fix separates the null checks for stdout and stderr into
independent conditions, ensuring each stream is properly selected
based on its own null status.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
2025-11-16 20:16:16 +08:00
Li Jie
bf9c6abb23 build: refactor main module generation 2025-11-16 20:16:16 +08:00
xushiwei
2d80951e7d Merge pull request #1396 from goplus/pr-1395
build: fix ldflags rewrites and prep caching
v0.11.6
2025-11-15 07:36:31 +08:00
xgopilot
034b05c53c cl: remove Underlying() call to reject string type aliases in rewrites
Type aliases like `type T string` are no longer supported for
-ldflags -X rewrites. Only direct *string types are now allowed.

- Removed Underlying() call from isStringPtrType
- Added TestRewriteIgnoresStringAlias test case

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
2025-11-14 14:49:30 +00:00
xgopilot
1ba7d1e561 fix: change to isStringPtrType for global string var
- Replace isStringType with isStringPtrType to properly validate that only *string type variables can be rewritten with -ldflags -X
- Remove maxStringTypeDepth constant as it's no longer needed
- Update tests to reflect the new function name and add test case for valid *string type
- Fix compileGlobal to use gbl.Type() for accurate type checking

This addresses the review feedback that Go only allows -X rewrites for the basic string type, not derived types like "type T string".

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
2025-11-14 14:38:46 +00:00
xgopilot
d17ff2592a build: improve error handling and code quality
- Fix missing error handling in exportObject function
- Add explicit warning for non-string variable rewrites
- Improve documentation for maxRewriteValueLength constant

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
2025-11-14 11:37:09 +00:00
Li Jie
4b26cccc90 cl: cover rewrite guards 2025-11-14 18:29:00 +08:00
Li Jie
3a1d8693e9 rewrite: address review feedback 2025-11-14 17:57:05 +08:00
Li Jie
2a52d422c5 cl: broaden rewrite coverage 2025-11-14 17:48:16 +08:00
Li Jie
b0f5d34b39 cl: add rewrite coverage test 2025-11-14 17:32:52 +08:00
Li Jie
8ba8ec71b5 build: write exports into temp files 2025-11-14 16:58:33 +08:00
Li Jie
1e4616a758 build: don't replace ExportFile 2025-11-14 16:58:33 +08:00
Li Jie
22a43622a0 cl: fix global var rewrite in alt pkg 2025-11-14 16:58:30 +08:00
Haolan
065126e270 feat: make defer tls stub for baremetal 2025-11-14 16:13:43 +08:00
Haolan
552156ff40 fix: adjust gc stats struct 2025-11-14 16:13:43 +08:00
Haolan
36e84196c6 test: add test for gc stats 2025-11-14 16:13:43 +08:00
Haolan
7f1e07755a ci: use llgo test instead
ci: use llgo test instead
2025-11-14 16:13:41 +08:00
Haolan
af27d0475d revert some unnecessary change 2025-11-14 16:13:41 +08:00
Haolan
bb29e8c768 docs: add commets for gc mutex
docs: add commets for tinygo gc
2025-11-14 16:13:38 +08:00
Haolan
eec2c271bd feat: replace println with gcPanic 2025-11-14 16:13:38 +08:00
Haolan
1ed924ed50 fix: add pthread GC support for baremetal
test: fix test logic

chore: format codes
2025-11-14 16:13:34 +08:00
Haolan
c46ca84122 revert disabling stdio buffer 2025-11-14 16:13:34 +08:00
Haolan
b36be05c1e fix: GC() signature 2025-11-14 16:13:34 +08:00
Haolan
66a537ad29 fix: add gc dummy mutex 2025-11-14 16:13:34 +08:00
Haolan
33a00dff1b fix: invalid import and improve tests
refactor: remove initGC

test: add test for GC

fix: invalid import in z_gc

ci: test baremetal GC for coverage

ci: test baremetal GC for coverage
2025-11-14 16:13:03 +08:00
Haolan
e4a69ce413 fix: disable buffers 2025-11-14 16:13:03 +08:00
Haolan
531f69ae6a fix: bdwgc.init() causing archive mode building fail
P

P

P
2025-11-14 16:13:03 +08:00
Haolan
812dfd45c9 feat: implement baremetal GC
fix: pthread gc

fix: xiao-esp32c3 symbol

refactor: use clite memset instead of linking

fix: stack top symbol
2025-11-14 16:12:56 +08:00
Li Jie
e2bb68489d build: override vars in alt pkg 2025-11-14 14:37:39 +08:00
Li Jie
9b76be9e9e support ldflags rewrites for initialized globals 2025-11-14 11:59:13 +08:00
xushiwei
2f65c98eb4 Merge pull request #1348 from cpunion/feature/defer-loop
defer: enable loop lowering
2025-11-13 17:59:26 +08:00
Li Jie
aeb5d82d3e ssa: remove unreachable switch case 2025-11-13 16:15:36 +08:00
Li Jie
317de80b42 test: add nested defer/loop/branch/recover tests and fix mixed branch recover mapping 2025-11-13 16:15:33 +08:00
Li Jie
0455ad4443 ssa: Add test for >64 conditional defers; cover panic at eh.go:252-254 2025-11-13 15:48:50 +08:00
Li Jie
e459ca928b runtime: remove overlays for defer workaround 2025-11-13 15:48:50 +08:00
Li Jie
21fef123d2 di: clean unreachable code 2025-11-13 15:48:50 +08:00
Li Jie
983a189c18 test: cover defer recover and nested loops 2025-11-13 15:48:49 +08:00
Li Jie
cb173f91d0 ssa: rely on runtime thread defer TLS 2025-11-13 15:48:49 +08:00
Li Jie
30bde9f6b5 tls: stub handle for go test 2025-11-13 15:48:49 +08:00
Li Jie
3307860d33 ssa: avoid redundant thread defer update 2025-11-13 15:48:49 +08:00
Li Jie
16709411a0 defer: enable loop lowering 2025-11-13 15:48:46 +08:00
xushiwei
3f8c95cf87 Merge pull request #1334 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.19.5
chore(deps): bump github.com/goplus/gogen from 1.19.3 to 1.19.5
2025-11-13 07:49:29 +08:00
xushiwei
0dbe528e6d Merge pull request #1304 from MeteorsLiu/impl-stacksave
feat: implement `llgo.stackSave`
2025-11-13 07:48:01 +08:00
dependabot[bot]
91f6ad9bfa chore(deps): bump github.com/goplus/gogen from 1.19.3 to 1.19.5
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.19.3 to 1.19.5.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.19.3...v1.19.5)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-version: 1.19.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-11 23:40:43 +00:00