Skip to content

Commit

Permalink
Merge pull request #33 from sivachandran/parse-char-array-string
Browse files Browse the repository at this point in the history
Support parsing char array string in emitted code
  • Loading branch information
korniltsev authored Aug 15, 2024
2 parents 863b92b + 4d3234e commit 4296f63
Show file tree
Hide file tree
Showing 30 changed files with 1,492 additions and 2 deletions.
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

0 comments on commit 4296f63

Please sign in to comment.