Skip to content

Commit

Permalink
preallocate StackFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
zdyj3170101136 committed Aug 1, 2023
1 parent a1b27a8 commit 550121d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions parser/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,37 @@ func (c *CheckpointEvent) Parse(r reader.Reader, classes ClassMap, cpools PoolMa
results[i] = &threads[i]
}
case "jdk.types.StackTrace":
var classStackFrames ClassMetadata
for _, class := range classes {
if class.Name == "jdk.types.StackFrame" {
classStackFrames = class
break
}
}
var (
stackFrames []StackFrame
indexStackFrames int
)
createStackFrames := func() ParseResolvable {
if indexStackFrames >= len(stackFrames) {
stackFrames = make([]StackFrame, m)
contantsSlice = getConstantsSlice(int(m), classStackFrames.numConstants)
for i := range stackFrames {
stackFrames[i].constants = contantsSlice[i]
}
indexStackFrames = 0
}
result := &stackFrames[indexStackFrames]
indexStackFrames++
return result
}
for i, class := range classes {
if class.Name == "jdk.types.StackFrame" {
class.typeFn = createStackFrames
classes[i] = class
break
}
}
var pointerToStackFrames []*StackFrame
indexPointerToStackFrames := 0
getPointerToStackFrames := func(n int) []*StackFrame {
Expand Down

0 comments on commit 550121d

Please sign in to comment.