Skip to content

Commit

Permalink
Read Ref IDs as uint64 (#43)
Browse files Browse the repository at this point in the history
Fixes overflow error in parsing Ref IDs
  • Loading branch information
sivachandran authored Oct 16, 2024
1 parent 1987b3f commit a8d22a1
Show file tree
Hide file tree
Showing 33 changed files with 227 additions and 184 deletions.
4 changes: 2 additions & 2 deletions gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ func generateBindLoop(typ *def.Class, bindName string, nestedAllowed bool) strin
res += fmt.Sprintf(" }\n")
res += fmt.Sprintf(" for %sArrayIndex := 0; %sArrayIndex < %sArraySize; %sArrayIndex++ {\n", bindName, bindName, bindName, bindName)
res += fmt.Sprintf(" if %s.Fields[%sFieldIndex].Field.ConstantPool {\n", bindName, bindName)
res += emitReadI32()
res += emitReadU64()
if len(cpoolFields) > 0 {
res += fmt.Sprintf(" switch %s.Fields[%sFieldIndex].Field.Type {\n", bindName, bindName)
for _, field := range cpoolFields {
res += fmt.Sprintf(" case typeMap.%s:\n", TypeID2Sym(field.Type))
res += fmt.Sprintf(" if %s.Fields[%sFieldIndex].%s != nil {\n", bindName, bindName, goTypeName(field))
res += fmt.Sprintf(" *%s.Fields[%sFieldIndex].%s = %s(v32_)\n", bindName, bindName, goTypeName(field), goTypeName(field))
res += fmt.Sprintf(" *%s.Fields[%sFieldIndex].%s = %s(v64_)\n", bindName, bindName, goTypeName(field), goTypeName(field))
res += fmt.Sprintf(" }\n")
}
res += fmt.Sprintf(" }\n")
Expand Down
Binary file added parser/testdata/uint64-ref-id.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.
Binary file not shown.
Binary file not shown.
20 changes: 11 additions & 9 deletions parser/types/active_settings.go

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

22 changes: 12 additions & 10 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.

22 changes: 12 additions & 10 deletions parser/types/allocation_outside_tlab.go

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

22 changes: 12 additions & 10 deletions parser/types/allocation_sample.go

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

22 changes: 12 additions & 10 deletions parser/types/class.go

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

20 changes: 11 additions & 9 deletions parser/types/classloader.go

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

22 changes: 12 additions & 10 deletions parser/types/execution_sample.go

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

16 changes: 9 additions & 7 deletions parser/types/frametype.go

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

Loading

0 comments on commit a8d22a1

Please sign in to comment.