Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parsing char array string in emitted code #33

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func main() {
}

func write(dst, s string) {

formattedSource, err := format.Source([]byte(s))
if err != nil {
panic(err)
Expand Down Expand Up @@ -514,9 +515,17 @@ func emitString() string {
res += " }\n"

res += " bs := data[pos : pos+int(v32_)]\n"
res += fmt.Sprintf(" s_ = *(*string)(unsafe.Pointer(&bs))\n")

res += " s_ = *(*string)(unsafe.Pointer(&bs))\n"
res += " pos += int(v32_)\n"
res += "case 4:\n"
res += emitReadI32()
res += " bl := int(v32_)\n"
res += " buf := make([]rune,bl)\n"
res += " for i := 0; i < bl; i++ {\n"
res += emitReadI32()
res += " buf[i] = rune(v32_)\n"
res += " }\n"
res += " s_ = string(buf)\n"
res += "default:\n"
res += " return 0, fmt.Errorf(\"unknown string type %d at %d\", b_, pos)\n"
res += "}\n"
Expand Down
Binary file added parser/testdata/dd-trace-java.jfr.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
74 changes: 74 additions & 0 deletions parser/types/active_settings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions parser/types/allocation_in_new_tlab.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions parser/types/allocation_outside_tlab.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions parser/types/class.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading