Commit Graph

3351 Commits

Author SHA1 Message Date
xgopilot
29504f2560 refactor: address final review comments
- Created zcgo.go with defaultCGO_ENABLED constant (Go 1.24 pattern)
- Updated parseGoVersion to panic on unexpected input instead of fallback
- Added runtime.(*Func).Name stub to symtab.go for Go 1.21/1.22 compatibility
- Removed go1.23 build constraint from demo
- Removed internal/buildcfg package (replaced by zcgo.go)

These changes ensure the demo works across Go 1.21+ versions.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 11:07:02 +00:00
xgopilot
ee49fad4a4 refactor: follow Go stdlib conventions for build.go
- Created internal/buildcfg package with DefaultCGO_ENABLED constant
- Updated CGO_ENABLED handling to use buildcfg.DefaultCGO_ENABLED
- Added original Go stdlib comment for release tags
- Simplified toolTags usage by using it directly instead of wrapper function

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 10:39:14 +00:00
xgopilot
946a4bf990 refactor: link internal/buildcfg.ToolTags and enhance demo test coverage
- Link internal/buildcfg.ToolTags variable instead of hardcoding tool tags
- Add comprehensive test cases in demo.go to verify:
  - build.Default.Compiler is correctly patched to "gc"
  - ToolTags are properly populated from internal/buildcfg
  - ReleaseTags are correctly generated
- Validates the go/build patches work as expected

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-16 08:27:39 +00:00
xgopilot
8b61831b0d refactor: address review comments on build.go
- Remove /llgo from .gitignore (unnecessary)
- Move cgoSupported linkname to top with other linknames
- Fix goVersion initialization timing by making it local variable

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-16 07:48:28 +00:00
xgopilot
e96625cf07 feat: add go:linkname directives for defaultToolTags and defaultReleaseTags
Add linkname directives and stdlib comments for defaultToolTags and
defaultReleaseTags variables to match Go standard library pattern. This
allows external packages (like gopherjs) to access these internal variables
via linkname, maintaining compatibility with packages that depend on this
behavior.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-16 07:37:13 +00:00
xgopilot
8ac7ada7f9 refactor: use go:linkname to link internal/platform.CgoSupported
Instead of creating a custom platform package, use the go:linkname
directive to directly link to Go's standard library internal/platform.CgoSupported
function. This approach:

- Eliminates the need to maintain a copy of platform support data
- Uses Go's canonical platform information directly
- Reduces code duplication and maintenance burden
- Follows Go's linkname pattern for accessing internal packages

Changes:
- Added import _ "unsafe" to enable linkname
- Added //go:linkname directive for cgoSupported function
- Removed custom runtime/internal/lib/internal/platform package
- Updated function call from platform.CgoSupported to cgoSupported

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 06:05:54 +00:00
xgopilot
0b00e06185 refactor: update platform package to match original Go structure
Updated runtime/internal/lib/internal/platform/platform.go to match
the original Go internal/platform package structure:

- Added OSArch struct with GOOS and GOARCH fields
- Added osArchInfo struct with CgoSupported, FirstClass, and Broken fields
- Created distInfo map using OSArch as keys
- Updated CgoSupported function to use map lookup (matches original implementation)

This change makes the package structure more consistent with Go's
standard library and follows the established pattern more closely.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 05:53:20 +00:00
xgopilot
c4fdb1edc0 refactor: move cgoSupported to internal/platform package
Created runtime/internal/lib/internal/platform package to house the
CgoSupported function, following the established pattern used by other
internal packages like internal/itoa.

Changes:
- Created runtime/internal/lib/internal/platform/platform.go
- Moved cgoSupported function to platform.CgoSupported
- Updated runtime/internal/lib/go/build/build.go to import and use
  the new package

This refactoring improves code organization by separating
platform-specific utilities into their own package, making the code
more maintainable and reusable.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 04:05:58 +00:00
xgopilot
224e3b9440 fix: add Go 1.23+ build constraint to gobuild demo
Add //go:build go1.23 constraint to skip compilation on Go 1.21/1.22
where runtime.(*Func).Name is not implemented in llgo, causing linker
errors when internal/bisect is pulled in as a dependency.

The demo works correctly on Go 1.23+ where the dependency chain or
internal/bisect behavior avoids calling the unimplemented method.

Fixes compatibility issue reported in PR review.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 03:14:32 +00:00
xgopilot
7fbcc8cd10 refactor: use runtime.Version() instead of hardcoded goVersion
Replaced hardcoded goVersion constant with parseGoVersion() function
that dynamically extracts the Go version from runtime.Version().
This eliminates the need to update the version manually.

🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-16 02:33:53 +00:00
xushiwei
d2a22252c2 Merge pull request #1342 from goplus/dependabot/github_actions/actions/setup-node-6
chore(deps): bump actions/setup-node from 5 to 6
2025-10-16 08:49:12 +08:00
xushiwei
58352e3ee4 Merge pull request #1345 from goplus/xgopilot/claude/issue-1344-1760494923
docs: add hash/maphash to README with partial support status
2025-10-16 08:48:02 +08:00
xushiwei
325e9a93b5 Merge pull request #1347 from cpunion/feature/tls-gc
tls: add gc-aware pthread slots
2025-10-16 08:10:53 +08:00
xgopilot
938f883be9 refactor: use hasAltPkg with minimal implementation (94% reduction)
Learned from other AltPkg implementations to create a truly minimal patch:
- Moved from 2073-line overlay to 127-line hasAltPkg implementation
- Replaced internal package dependencies:
  * internal/buildcfg → runtime.GOARCH/GOOS
  * internal/goversion → hardcoded constant (24)
  * internal/platform.CgoSupported → simplified implementation
  * internal/buildcfg.ToolTags → simplified buildToolTags()
- Used type alias (Context = build.Context) to reference stdlib types
- Added go/build to hasAltPkg map
- Removed overlay entirely

This follows the pattern used by other AltPkg packages and achieves
the minimal patching approach requested.

Demo verified working with llgo.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-15 14:54:29 +00:00
xgopilot
d145967c35 revert: restore full overlay approach for go/build
After investigating the hasAltPkg mechanism, determined that it's not
suitable for go/build.defaultContext() because:

1. hasAltPkg works well for providing additional/alternative functions
2. But defaultContext() needs to REPLACE an existing function that depends
   on internal/buildcfg, internal/goversion, and internal/platform
3. These internal packages cannot be imported from runtime/internal/lib

The full overlay approach (2073 lines) works correctly. Seeking guidance
on whether this is acceptable or if there's an alternative approach.

Demo verified working:
- runtime.Compiler = "llgo"
- go/build.Import() works correctly
- No "unknown compiler" error

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-15 13:11:22 +00:00
xgopilot
2e0fc5fb7f refactor: reduce go/build overlay to minimal 87-line patch
Reduced the go/build overlay from 2073 lines to just 87 lines by only
including the patched defaultContext() function and its direct dependencies
(envOr, defaultGOPATH, and related variables).

The overlay system works by merging with the standard library, so we only
need to provide the functions we're modifying. Unpatched functions
automatically fall back to the Go standard library implementation.

This makes the patch much more maintainable and clearly shows what's
being modified: just the Compiler field assignment in defaultContext().

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-15 12:33:48 +00:00
xgopilot
d8cf93a6cd refactor: move go/build overlay to runtime/internal for minimal patching
- Moved full overlay file from runtime/_overlay/go/build/build.go to
  runtime/internal/go/build/build.go to make it clearer what's being overridden
- Updated runtime/overlay.go to embed from new location
- Created demo under _demo/go/gobuild to demonstrate go/build package working with llgo
- The overlay still contains the full file but is now organized under runtime/internal
  following the project's pattern for patched standard library packages

Fixes #1346

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-15 12:17:38 +00:00
xgopilot
01ada11b74 fix: override go/build.defaultContext() to use gc compiler
Fixes #1346 by creating an overlay for go/build/build.go that sets
Compiler to "gc" in defaultContext(). This allows user code using
go/build package to work with llgo while preserving runtime.Compiler
as "llgo" for identification purposes.

The overlay replaces the entire go/build/build.go file with a modified
version where line 342 changes from 'c.Compiler = runtime.Compiler' to
'c.Compiler = "gc"'. This minimal change ensures go/build recognizes
llgo-compiled binaries without requiring changes to user code.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-15 11:58:36 +00:00
Li Jie
00dd09c7f4 ssa: improve hasTypeParam coverage 2025-10-15 13:51:16 +08:00
Li Jie
1ed418e77e tls: document package and guard helpers 2025-10-15 13:11:35 +08:00
Li Jie
2110db7263 tls: add gc-aware pthread slots 2025-10-15 12:21:51 +08:00
xgopilot
27efaa2eda docs: add hash/maphash to README with partial support status
Update README to reflect that hash/maphash package has been mostly
implemented and verified by adding it to the Go packages support
section with "(partially)" status.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-15 02:23:46 +00:00
dependabot[bot]
355ff1009d chore(deps): bump actions/setup-node from 5 to 6
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v5...v6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-15 00:13:38 +00:00
xushiwei
e03f4dacfb Merge pull request #1339 from goplus/xgopilot/claude/issue-1338-1760425043
fix: add runtime.rand and runtime.memhash for hash/maphash support
2025-10-15 06:41:39 +08:00
xushiwei
75fa863da2 Merge pull request #1336 from goplus/xgopilot/claude/issue-1335-1760330027
Add CLAUDE.md: AI Assistant Guide
2025-10-15 06:34:15 +08:00
xushiwei
18ef7200bc Merge pull request #1341 from luoliwoshang/fix-ci-duplicate-runs
ci: prevent duplicate workflow runs for xgopilot branches
2025-10-15 06:30:59 +08:00
luoliwoshang
bf05779f2f ci: prevent duplicate workflow runs for xgopilot branches
Add !xgopilot/** exclusion pattern to all workflow trigger configurations,
matching the existing dependabot pattern. This ensures that xgopilot branches
only trigger CI checks on pull_request events, eliminating redundant push
event triggers.

Fixes #1340

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 19:00:47 +08:00
xgopilot
2b92b527e1 fix: resolve compilation errors in maphash demo
- Fix line 67: Change unused variable 'n' to blank identifier '_'
- Fix line 102: Correct WriteByte call to expect only error return value
  (WriteByte returns only error, not (int, error))

These fixes resolve the compilation errors reported by the CI.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-14 10:33:30 +00:00
xgopilot
ed3176a6cc test: expand maphash demo with comprehensive API coverage
- Add tests for all major hash/maphash public APIs:
  * Hash basics (WriteString, Sum64, Reset)
  * MakeSeed and SetSeed functionality
  * Write methods (Write, WriteByte, WriteString)
  * Bytes and String convenience functions
- Use panic() for unexpected errors instead of silent failures
- Add proper error checking and validation
- Document Comparable/WriteComparable limitations in overlay

Note: Comparable() and WriteComparable() are not yet supported and will
panic with 'intrinsic' error as they require runtime intrinsic support.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-14 10:18:28 +00:00
xgopilot
e5ebc32583 fix: add randUint64 wrapper for Go 1.21 compatibility
Implement randUint64() directly in the maphash overlay to ensure compatibility
across Go versions. Go 1.21's randUint64() calls runtime.fastrand64, while
Go 1.22+ calls runtime.rand. The wrapper function bridges to llgo's fastrand64
implementation, avoiding undefined symbol errors on Go 1.21.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-14 09:19:55 +00:00
xgopilot
3ce198f103 fix: remove llgo:skipall directive from maphash overlay
The llgo:skipall directive was preventing fallback to the standard library,
causing undefined symbol errors for functions like WriteString, MakeSeed, etc.
The overlay now only defines the two linkname functions, allowing typepatch
to handle the rest.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-14 08:29:26 +00:00
xgopilot
e05c91530e refactor: move hash/maphash linkname bindings to maphash package
Move runtime_rand and runtime_memhash linkname declarations from
runtime/internal/lib/runtime/runtime.go to runtime/internal/lib/hash/maphash/maphash.go
to avoid polluting the runtime package namespace.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
2025-10-14 08:01:10 +00:00
xgopilot
8aadfde64a style: apply linter fixes to maphash test
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-14 07:11:42 +00:00
xgopilot
441b4b15a8 test: add hash/maphash demo test case
Add test case in _demo/go/maphash to verify hash/maphash functionality
with the new runtime.rand and runtime.memhash support.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-14 07:11:17 +00:00
xgopilot
cf6cc937ef fix: add runtime.rand and runtime.memhash for hash/maphash support
- Register hash/maphash in hasAltPkg map in runtime/build.go
- Add rand() function that bridges to fastrand64() in runtime overlay
- Add memhash() function that bridges to internal memhash() in runtime overlay
- Fixes issue where hash/maphash package failed with undefined symbols

Fixes #1338

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-14 07:04:42 +00:00
xgopilot
391e09a407 docs: migrate all build commands to Common Development Tasks
- Add 'Build llgo command specifically' and 'Check llgo version' commands
- Consolidate all build-related commands in one section
- Reduce redundancy by having single section for development tasks

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 08:07:23 +00:00
xgopilot
d6f45c67fb docs: merge Testing and Validation into single section
- Move Build Commands into Common Development Tasks section
- Remove duplicate Validation Workflow section
- Simplify document structure by consolidating build commands

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 08:05:56 +00:00
xgopilot
62198a59ba docs: add descriptive instructions to Code Quality section
- Add requirement to run formatting before submitting code updates
- Emphasize that go fmt must be run before committing changes
- Clarify that formatting ensures consistent code formatting

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 07:53:12 +00:00
xgopilot
00d5aad528 docs: remove duplicate validation section from CLAUDE.md
- Remove 'Validated Commands and Expected Outputs' section (lines 71-95)
- This information is already covered in 'Validation Workflow' section
- Reduces redundancy and improves document clarity

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 07:45:24 +00:00
xgopilot
72602d606d docs: address review feedback on CLAUDE.md
- Move demo examples to Project Structure with simplified descriptions
- Change 'Test a simple example' to focus on writing and running test cases
- Remove standalone Running Examples section to reduce redundancy

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 07:36:11 +00:00
xgopilot
a99f3d9409 docs: refactor Important Notes with clear workflow and requirements
- Add clear 'Validation Workflow' section with numbered steps
- Create prominent 'LLGO_ROOT Environment Variable' section
- Add requirement: All bug fixes/features MUST include tests
- Reorganize Important Notes for better clarity

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 07:16:39 +00:00
xgopilot
1edd4b863e docs: merge Testing and Validation into single section
- Combines Testing and Validation sections for better organization
- Emphasizes these steps are essential when fixing bugs or implementing features
- Maintains all validation information with clearer structure

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 06:52:02 +00:00
xgopilot
c7e3408782 docs: simplify CLAUDE.md per review feedback
- Link Development Environment section to README to avoid redundancy
- Remove 'Verified Environment' subsection
- Remove 'Build pydump' section as not needed for current doc

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 06:39:52 +00:00
xgopilot
f65072d997 docs: address review feedback on CLAUDE.md
- Update _cmptest/ description to clarify its purpose
- Remove scattered 'Verified output' sections
- Consolidate all validation information into unified Validation section

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: xgopilot <noreply@goplus.org>
2025-10-13 06:16:41 +00:00
xgopilot
cadafde540 Merge pull request #1333 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.19.3
chore(deps): bump github.com/goplus/gogen from 1.19.2 to 1.19.3
2025-10-13 04:40:16 +00:00
xushiwei
7e1abf1486 Merge pull request #1333 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.19.3
chore(deps): bump github.com/goplus/gogen from 1.19.2 to 1.19.3
2025-10-12 09:42:42 +08:00
dependabot[bot]
cf55925ff5 chore(deps): bump github.com/goplus/gogen from 1.19.2 to 1.19.3
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.19.2 to 1.19.3.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.19.2...v1.19.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-10 00:12:17 +00:00
Haolan
c3dbc580aa chore: update stacksave signature commets 2025-09-28 09:20:50 +08:00
Haolan
93e660a2b0 fix: amd64 getsp demo 2025-09-28 09:20:50 +08:00
Haolan
2ec5653f5e feat: implement llgo.stackSave 2025-09-28 09:20:50 +08:00