Commit Graph

3352 Commits

Author SHA1 Message Date
Li Jie
22a43622a0 cl: fix global var rewrite in alt pkg 2025-11-14 16:58:30 +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
xushiwei
4d1906d722 Merge pull request #1391 from goplus/dependabot/go_modules/github.com/goplus/lib-0.3.1
chore(deps): bump github.com/goplus/lib from 0.3.0 to 0.3.1
2025-11-12 07:38:32 +08:00
dependabot[bot]
ff4a180860 chore(deps): bump github.com/goplus/lib from 0.3.0 to 0.3.1
Bumps [github.com/goplus/lib](https://github.com/goplus/lib) from 0.3.0 to 0.3.1.
- [Release notes](https://github.com/goplus/lib/releases)
- [Commits](https://github.com/goplus/lib/compare/v0.3.0...v0.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-11 23:19:50 +00:00
xushiwei
7ce2733edf Merge pull request #1383 from luoliwoshang/feat/nil/recover
fix(runtime): restore SIGSEGV signal handler for non-wasm platforms
2025-11-12 06:43:02 +08:00
luoliwoshang
2363d28d57 feat(runtime): add SIGSEGV signal handler to convert nil pointer dereference to recoverable panic
- Add z_rt_default.go with signal handler for SIGSEGV on non-wasm platforms
- Convert segmentation faults from nil pointer access to Go panic
- Enable recover() to catch nil pointer dereference errors
- Use build tag (!wasm) to maintain wasm platform compatibility
- Remove commented-out signal handling code from z_rt.go

This aligns llgo's behavior with standard Go, where accessing nil pointer
fields triggers a recoverable panic instead of immediate program crash.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 15:15:51 +08:00
xushiwei
830e8e7058 Merge pull request #1381 from goplus/xgopilot/claude/document-outll-process-1730340128
docs(CLAUDE.md): document out.ll update process after IR changes
2025-11-10 13:55:01 +08:00
xushiwei
34caf518a1 Merge pull request #1386 from goplus/xgopilot/claude/issue-1385-1762256384
chore: remove deprecated //export LLGoVersion comment
2025-11-10 13:53:02 +08:00
xushiwei
a676ba29db Merge pull request #1387 from luoliwoshang/runtime/iface/func
fix(runtime): segmentation fault when calling interface private methods cross-package
2025-11-10 13:51:42 +08:00
xushiwei
d368cade1c Merge pull request #1388 from luoliwoshang/ci/no-auto-update
ci:avoid auto upgrade before brew install
2025-11-10 13:47:43 +08:00
luoliwoshang
4e374a99ff test:refression test for https://github.com/goplus/llgo/issues/1370
Co-authored-by: xgopilot <noreply@goplus.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-06 21:02:36 +08:00
luoliwoshang
41b403aef7 fix(runtime): segmentation fault when calling interface private methods cross-package
Co-authored-by: xgopilot <noreply@goplus.org>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-06 21:00:37 +08:00
luoliwoshang
cda9d682f2 ci:avoid brew auto upgrade dependant 2025-11-06 19:13:11 +08:00
xgopilot
742bfd95a2 chore: remove deprecated //export LLGoVersion comment
Removes the deprecated //export LLGoVersion comment from internal/env/version.go
as it is no longer needed.

Fixes #1385

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-11-04 11:45:10 +00:00
xgopilot
01af858a2e docs(CLAUDE.md): remove redundant test failure mention
Removed the sentence about test failures as requested.
The "Why this matters" section now focuses on the benefits
of the process rather than the negative consequences.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-31 03:43:06 +00:00
xgopilot
c557aa2af1 docs(CLAUDE.md): remove pro tip line
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-31 03:34:08 +00:00
xgopilot
c15c7a05b7 docs(CLAUDE.md): add gentests for batch out.ll updates
Updated the out.ll update workflow to document both tools:
- gentests: batch regeneration of all test files (recommended)
- llgen: individual test directory regeneration (for inspection)

Verified gentests works correctly by testing the regeneration
of all out.ll files. The tool successfully processes all
non-Python test directories.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-31 03:27:49 +00:00
xgopilot
8f5f36e447 docs(CLAUDE.md): document out.ll update process after IR changes
Add comprehensive documentation explaining:
- What out.ll files are (IR comparison test files)
- When to update them (after modifying IR generation logic)
- How to update them (reinstall llgen, regenerate files)
- Why this matters (test consistency and regression detection)

This documentation will help avoid wasting time on repeatedly updating
test files, as it clarifies the required workflow when making compiler
changes that affect IR generation.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-31 02:43:06 +00:00
Haolan
bf6f785988 Merge branch 'main' of https://github.com/goplus/llgo into impl-stacksave 2025-10-30 13:48:13 +08:00
xushiwei
86cafff113 Merge pull request #1375 from goplus/dependabot/github_actions/actions/download-artifact-6
chore(deps): bump actions/download-artifact from 5 to 6
2025-10-27 16:37:07 +08:00
xushiwei
3c88949557 Merge pull request #1376 from goplus/dependabot/github_actions/actions/upload-artifact-5
chore(deps): bump actions/upload-artifact from 4 to 5
2025-10-27 16:36:57 +08:00
dependabot[bot]
533ba9ebd8 chore(deps): bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 00:17:07 +00:00
dependabot[bot]
f34062166b chore(deps): bump actions/download-artifact from 5 to 6
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 00:17:03 +00:00
xushiwei
c036243b3f Merge pull request #1352 from goplus/xgopilot/claude/issue-1351-1760682793
Remove redundant CompareString from llgo:skip directive
2025-10-27 07:18:05 +08:00
xushiwei
e16fc69ce3 Merge pull request #1349 from goplus/xgopilot/claude/issue-1346-1760499310
fix: set build.Default.Compiler to gc in init function
2025-10-27 07:16:15 +08:00
xushiwei
a2c81327ea Merge pull request #1355 from goplus/feature/reflect-indirect
feat(reflect): add Indirect function
2025-10-27 07:13:54 +08:00
xgopilot
a74ca940e2 feat(reflect): add struct test cases for Indirect function
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-20 02:29:18 +00:00
xgopilot
0c68ae00c9 refactor: rename reflect-indirect to reflectindirect
Follow naming convention of other demo folders (reflectfunc, gotime, etc.)

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-17 09:19:20 +00:00
xgopilot
8d6d1b76f2 refactor: move reflect.Indirect test to _demo and use panic()
- Moved test from _cmptest/reflect_indirect/ to _demo/go/reflect-indirect/
- Refactored to use panic() for validation instead of fmt.Println
- Added proper assertions for all test cases

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-17 09:06:09 +00:00
xgopilot
e47728b053 feat(reflect): add Indirect function
Implements reflect.Indirect function to support pointer dereferencing.
This function returns the value that a pointer points to, or returns
the value unchanged if it's not a pointer.

Fixes #1354

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-17 08:06:30 +00:00
xgopilot
9b397725da Remove redundant CompareString from llgo:skip directive
The CompareString in the llgo:skip directive is redundant because
the overlay mechanism automatically handles symbol skipping when
an overlay package defines a symbol.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-17 06:36:46 +00:00
xgopilot
420ad8e010 refactor: simplify go/build patch - use build.Default directly
Remove unnecessary go:linkname, runtime import, and unsafe import.
Access build.Default.Compiler directly instead of via linkname.

- Removed go:linkname directive
- Removed runtime and unsafe imports
- Removed unnecessary _ = runtime.Compiler line
- Simplified from 27 lines to 19 lines
- Same functionality, cleaner code

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 13:28:54 +00:00
xgopilot
6e41cc702f refactor: simplify go/build patch using init function
Use go:linkname to access build.Default and modify Compiler in init function.
This is much simpler than patching defaultContext() and all its dependencies.

- Reduced from 137 lines to 27 lines
- Removed zcgo.go (no longer needed)
- Removed complex parseGoVersion, defaultContext, and helper functions
- Now just sets build.Default.Compiler = "gc" in init()

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 13:09:32 +00:00
xgopilot
0a94a54772 test: enhance demo to test multiple go/build public functions
Enhanced the demo test to cover comprehensive import scenarios:
- Test 1: build.Default context with GOOS/GOARCH validation
- Test 2: Standard library package import (fmt)
- Test 3: Nested standard library package (os/exec)
- Test 4: Internal package import (internal/cpu)
- Test 5: Runtime package with Dir validation
- Test 6: ImportDir with current directory
- Test 7: IsLocalImport with multiple path formats
- Test 8: Context GOPATH/GOROOT validation
- Test 9: Import with AllowBinary flag
- Test 10: Release tags validation

All tests include proper result validation to ensure go/build
patches work correctly across different use cases.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 11:55:02 +00:00
xgopilot
d09ce613c8 fix: remove trailing newline in build.go
Fixed formatting issue that was causing CI to fail.
The file had an extra blank line at the end which go fmt removed.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 11:36:49 +00:00