From 7151b79c6a490eedef4da7d2427b60e5eba75a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=9D=B0?= Date: Tue, 1 Aug 2023 11:51:20 +0800 Subject: [PATCH] classes store pointer to ClassMetadata --- parser/checkpoint.go | 2 +- parser/chunk.go | 9 ++-- parser/event_types.go | 112 +++++++++++++++++++++--------------------- parser/types.go | 56 ++++++++++----------- 4 files changed, 90 insertions(+), 89 deletions(-) diff --git a/parser/checkpoint.go b/parser/checkpoint.go index 6d91d52..02ec36f 100644 --- a/parser/checkpoint.go +++ b/parser/checkpoint.go @@ -67,7 +67,7 @@ func (c *CheckpointEvent) Parse(r reader.Reader, classes ClassMap, cpools PoolMa results[i] = &threads[i] } case "jdk.types.StackTrace": - var classStackFrames ClassMetadata + var classStackFrames *ClassMetadata for _, class := range classes { if class.Name == "jdk.types.StackFrame" { classStackFrames = class diff --git a/parser/chunk.go b/parser/chunk.go index 94e842e..87ca394 100644 --- a/parser/chunk.go +++ b/parser/chunk.go @@ -13,7 +13,7 @@ type CPool struct { Pool map[int]ParseResolvable resolved bool } -type ClassMap map[int]ClassMetadata +type ClassMap map[int]*ClassMetadata type PoolMap map[int]*CPool type Chunk struct { @@ -42,7 +42,7 @@ type Chunk struct { } type ChunkParseOptions struct { - CPoolProcessor func(meta ClassMetadata, cpool *CPool) + CPoolProcessor func(meta *ClassMetadata, cpool *CPool) } func (c *Chunk) Parse(r io.Reader, options *ChunkParseOptions) (err error) { @@ -218,8 +218,9 @@ func (c *Chunk) buildClasses(metadata MetadataEvent) ClassMap { return &c.nativeLibrary }, } - classes := make(map[int]ClassMetadata, len(metadata.Root.Metadata.Classes)) - for _, class := range metadata.Root.Metadata.Classes { + classes := make(map[int]*ClassMetadata, len(metadata.Root.Metadata.Classes)) + for i := range metadata.Root.Metadata.Classes { + class := &metadata.Root.Metadata.Classes[i] var numConstants int for _, field := range class.Fields { if field.ConstantPool { diff --git a/parser/event_types.go b/parser/event_types.go index 0429009..2db7991 100644 --- a/parser/event_types.go +++ b/parser/event_types.go @@ -123,7 +123,7 @@ func (ar *ActiveRecording) parseField(r reader.Reader, name string, p ParseResol return err } -func (ar *ActiveRecording) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ar *ActiveRecording) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ar.parseField) } @@ -154,7 +154,7 @@ func (as *ActiveSetting) parseField(r reader.Reader, name string, p ParseResolva return err } -func (as *ActiveSetting) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (as *ActiveSetting) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, as.parseField) } @@ -179,7 +179,7 @@ func (bf *BooleanFlag) parseField(r reader.Reader, name string, p ParseResolvabl return err } -func (bf *BooleanFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (bf *BooleanFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, bf.parseField) } @@ -210,7 +210,7 @@ func (ci *CPUInformation) parseField(r reader.Reader, name string, p ParseResolv return err } -func (ci *CPUInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ci *CPUInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ci.parseField) } @@ -235,7 +235,7 @@ func (cl *CPULoad) parseField(r reader.Reader, name string, p ParseResolvable) ( return err } -func (cl *CPULoad) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cl *CPULoad) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, cl.parseField) } @@ -263,7 +263,7 @@ func (ctsc *CPUTimeStampCounter) parseField(r reader.Reader, name string, p Pars return err } -func (ctsc *CPUTimeStampCounter) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ctsc *CPUTimeStampCounter) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ctsc.parseField) } @@ -324,7 +324,7 @@ func (cls *ClassLoaderStatistics) parseField(r reader.Reader, name string, p Par return err } -func (cls *ClassLoaderStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cls *ClassLoaderStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, cls.parseField) } @@ -346,7 +346,7 @@ func (cls *ClassLoadingStatistics) parseField(r reader.Reader, name string, p Pa return err } -func (cls *ClassLoadingStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cls *ClassLoadingStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, cls.parseField) } @@ -389,7 +389,7 @@ func (ccc *CodeCacheConfiguration) parseField(r reader.Reader, name string, p Pa return err } -func (ccc *CodeCacheConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ccc *CodeCacheConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ccc.parseField) } @@ -429,7 +429,7 @@ func (ccs *CodeCacheStatistics) parseField(r reader.Reader, name string, p Parse return err } -func (ccs *CodeCacheStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ccs *CodeCacheStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ccs.parseField) } @@ -454,7 +454,7 @@ func (csc *CodeSweeperConfiguration) parseField(r reader.Reader, name string, p return err } -func (csc *CodeSweeperConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (csc *CodeSweeperConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, csc.parseField) } @@ -485,7 +485,7 @@ func (css *CodeSweeperStatistics) parseField(r reader.Reader, name string, p Par return err } -func (css *CodeSweeperStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (css *CodeSweeperStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, css.parseField) } @@ -507,7 +507,7 @@ func (cc *CompilerConfiguration) parseField(r reader.Reader, name string, p Pars return err } -func (cc *CompilerConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cc *CompilerConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, cc.parseField) } @@ -556,7 +556,7 @@ func (cs *CompilerStatistics) parseField(r reader.Reader, name string, p ParseRe return err } -func (cs *CompilerStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cs *CompilerStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, cs.parseField) } @@ -581,7 +581,7 @@ func (df *DoubleFlag) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (df *DoubleFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (df *DoubleFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, df.parseField) } @@ -609,7 +609,7 @@ func (es *ExceptionStatistics) parseField(r reader.Reader, name string, p ParseR return err } -func (es *ExceptionStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (es *ExceptionStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, es.parseField) } @@ -637,7 +637,7 @@ func (es *ExecutionSample) parseField(r reader.Reader, name string, p ParseResol return err } -func (es *ExecutionSample) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (es *ExecutionSample) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, es.parseField) } @@ -680,7 +680,7 @@ func (gc *GCConfiguration) parseField(r reader.Reader, name string, p ParseResol return err } -func (gc *GCConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (gc *GCConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, gc.parseField) } @@ -717,7 +717,7 @@ func (ghc *GCHeapConfiguration) parseField(r reader.Reader, name string, p Parse return err } -func (ghc *GCHeapConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ghc *GCHeapConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ghc.parseField) } @@ -739,7 +739,7 @@ func (gcs *GCSurvivorConfiguration) parseField(r reader.Reader, name string, p P return err } -func (gsc *GCSurvivorConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (gsc *GCSurvivorConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, gsc.parseField) } @@ -764,7 +764,7 @@ func (gtc *GCTLABConfiguration) parseField(r reader.Reader, name string, p Parse return err } -func (gtc *GCTLABConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (gtc *GCTLABConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, gtc.parseField) } @@ -786,7 +786,7 @@ func (iev *InitialEnvironmentVariable) parseField(r reader.Reader, name string, return err } -func (iev *InitialEnvironmentVariable) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (iev *InitialEnvironmentVariable) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, iev.parseField) } @@ -808,7 +808,7 @@ func (isp *InitialSystemProperty) parseField(r reader.Reader, name string, p Par return err } -func (isp *InitialSystemProperty) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (isp *InitialSystemProperty) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, isp.parseField) } @@ -833,7 +833,7 @@ func (f *IntFlag) parseField(r reader.Reader, name string, p ParseResolvable) (e return err } -func (f *IntFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (f *IntFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, f.parseField) } @@ -870,7 +870,7 @@ func (jme *JavaMonitorEnter) parseField(r reader.Reader, name string, p ParseRes return err } -func (jme *JavaMonitorEnter) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (jme *JavaMonitorEnter) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, jme.parseField) } @@ -910,7 +910,7 @@ func (jmw *JavaMonitorWait) parseField(r reader.Reader, name string, p ParseReso return err } -func (jmw *JavaMonitorWait) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (jmw *JavaMonitorWait) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, jmw.parseField) } @@ -938,7 +938,7 @@ func (jts *JavaThreadStatistics) parseField(r reader.Reader, name string, p Pars return err } -func (jts *JavaThreadStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (jts *JavaThreadStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, jts.parseField) } @@ -975,7 +975,7 @@ func (ji *JVMInformation) parseField(r reader.Reader, name string, p ParseResolv return err } -func (ji *JVMInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ji *JVMInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ji.parseField) } @@ -1018,7 +1018,7 @@ func (lcts *LoaderConstraintsTableStatistics) parseField(r reader.Reader, name s return err } -func (lcts *LoaderConstraintsTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (lcts *LoaderConstraintsTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, lcts.parseField) } @@ -1043,7 +1043,7 @@ func (lf *LongFlag) parseField(r reader.Reader, name string, p ParseResolvable) return err } -func (lf *LongFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (lf *LongFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, lf.parseField) } @@ -1065,7 +1065,7 @@ func (me *ModuleExport) parseField(r reader.Reader, name string, p ParseResolvab return err } -func (me *ModuleExport) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (me *ModuleExport) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, me.parseField) } @@ -1087,7 +1087,7 @@ func (mr *ModuleRequire) parseField(r reader.Reader, name string, p ParseResolva return err } -func (mr *ModuleRequire) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (mr *ModuleRequire) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, mr.parseField) } @@ -1112,7 +1112,7 @@ func (nl *NativeLibrary) parseField(r reader.Reader, name string, p ParseResolva return err } -func (nl *NativeLibrary) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (nl *NativeLibrary) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, nl.parseField) } @@ -1137,7 +1137,7 @@ func (nu *NetworkUtilization) parseField(r reader.Reader, name string, p ParseRe return err } -func (nu *NetworkUtilization) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (nu *NetworkUtilization) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, nu.parseField) } @@ -1172,7 +1172,7 @@ func (oa *ObjectAllocationInNewTLAB) parseField(r reader.Reader, name string, p return err } -func (oa *ObjectAllocationInNewTLAB) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (oa *ObjectAllocationInNewTLAB) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, oa.parseField) } @@ -1203,7 +1203,7 @@ func (oa *ObjectAllocationOutsideTLAB) parseField(r reader.Reader, name string, return err } -func (oa *ObjectAllocationOutsideTLAB) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (oa *ObjectAllocationOutsideTLAB) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, oa.parseField) } @@ -1222,7 +1222,7 @@ func (os *OSInformation) parseField(r reader.Reader, name string, p ParseResolva return err } -func (os *OSInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (os *OSInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, os.parseField) } @@ -1244,7 +1244,7 @@ func (pm *PhysicalMemory) parseField(r reader.Reader, name string, p ParseResolv return err } -func (pm *PhysicalMemory) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (pm *PhysicalMemory) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, pm.parseField) } @@ -1287,7 +1287,7 @@ func (pts *PlaceholderTableStatistics) parseField(r reader.Reader, name string, return err } -func (pts *PlaceholderTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (pts *PlaceholderTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, pts.parseField) } @@ -1330,7 +1330,7 @@ func (pdcts *ProtectionDomainCacheTableStatistics) parseField(r reader.Reader, n return err } -func (pdcts *ProtectionDomainCacheTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (pdcts *ProtectionDomainCacheTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, pdcts.parseField) } @@ -1355,7 +1355,7 @@ func (sf *StringFlag) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (sf *StringFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (sf *StringFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, sf.parseField) } @@ -1398,7 +1398,7 @@ func (sts *StringTableStatistics) parseField(r reader.Reader, name string, p Par return err } -func (sts *StringTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (sts *StringTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, sts.parseField) } @@ -1441,7 +1441,7 @@ func (sts *SymbolTableStatistics) parseField(r reader.Reader, name string, p Par return err } -func (sts *SymbolTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (sts *SymbolTableStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, sts.parseField) } @@ -1463,7 +1463,7 @@ func (sp *SystemProcess) parseField(r reader.Reader, name string, p ParseResolva return err } -func (sp *SystemProcess) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (sp *SystemProcess) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, sp.parseField) } @@ -1485,7 +1485,7 @@ func (tas *ThreadAllocationStatistics) parseField(r reader.Reader, name string, return err } -func (tas *ThreadAllocationStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (tas *ThreadAllocationStatistics) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, tas.parseField) } @@ -1510,7 +1510,7 @@ func (tcl *ThreadCPULoad) parseField(r reader.Reader, name string, p ParseResolv return err } -func (tcl *ThreadCPULoad) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (tcl *ThreadCPULoad) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, tcl.parseField) } @@ -1529,7 +1529,7 @@ func (tcsr *ThreadContextSwitchRate) parseField(r reader.Reader, name string, p return err } -func (tcsr *ThreadContextSwitchRate) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (tcsr *ThreadContextSwitchRate) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, tcsr.parseField) } @@ -1548,7 +1548,7 @@ func (td *ThreadDump) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (td *ThreadDump) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (td *ThreadDump) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, td.parseField) } @@ -1588,7 +1588,7 @@ func (tp *ThreadPark) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (tp *ThreadPark) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (tp *ThreadPark) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, tp.parseField) } @@ -1616,7 +1616,7 @@ func (ts *ThreadStart) parseField(r reader.Reader, name string, p ParseResolvabl return err } -func (ts *ThreadStart) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ts *ThreadStart) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ts.parseField) } @@ -1641,7 +1641,7 @@ func (uif *UnsignedIntFlag) parseField(r reader.Reader, name string, p ParseReso return err } -func (uif *UnsignedIntFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (uif *UnsignedIntFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, uif.parseField) } @@ -1666,7 +1666,7 @@ func (ulf *UnsignedLongFlag) parseField(r reader.Reader, name string, p ParseRes return err } -func (ulf *UnsignedLongFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ulf *UnsignedLongFlag) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ulf.parseField) } @@ -1685,7 +1685,7 @@ func (vi *VirtualizationInformation) parseField(r reader.Reader, name string, p return err } -func (vi *VirtualizationInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (vi *VirtualizationInformation) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, vi.parseField) } @@ -1710,7 +1710,7 @@ func (ygc *YoungGenerationConfiguration) parseField(r reader.Reader, name string return err } -func (ygc *YoungGenerationConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ygc *YoungGenerationConfiguration) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ygc.parseField) } @@ -1720,7 +1720,7 @@ func (ue *UnsupportedEvent) parseField(r reader.Reader, name string, p ParseReso return nil } -func (ue *UnsupportedEvent) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ue *UnsupportedEvent) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, ue.parseField) } @@ -1751,6 +1751,6 @@ func (oa *LiveObject) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (oa *LiveObject) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (oa *LiveObject) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, nil, true, oa.parseField) } diff --git a/parser/types.go b/parser/types.go index 9861707..2f84d5b 100644 --- a/parser/types.go +++ b/parser/types.go @@ -61,7 +61,7 @@ func ParseClass(r reader.Reader, classes ClassMap, cpools PoolMap, classID int64 } type Parseable interface { - Parse(reader.Reader, ClassMap, PoolMap, ClassMetadata) error + Parse(reader.Reader, ClassMap, PoolMap, *ClassMetadata) error } type Resolvable interface { @@ -88,7 +88,7 @@ func appendConstant(r reader.Reader, constants *[]constant, name string, class i return nil } -func parseFields(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata, constants *[]constant, resolved bool, cb func(reader.Reader, string, ParseResolvable) error) error { +func parseFields(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata, constants *[]constant, resolved bool, cb func(reader.Reader, string, ParseResolvable) error) error { if constants != nil && cap(*constants) == 0 && class.numConstants != 0 && !resolved { *constants = make([]constant, 0, class.numConstants) } @@ -199,7 +199,7 @@ func resolveConstants(classes ClassMap, cpools PoolMap, constants *[]constant, r type Boolean bool -func (b *Boolean) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (b *Boolean) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { // TODO: Assert simpletype, no fields, etc. x, err := r.Boolean() *b = Boolean(x) @@ -214,7 +214,7 @@ func toBoolean(r reader.Reader) (bool, error) { type Byte int8 -func (b *Byte) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (b *Byte) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.Byte() *b = Byte(x) return err @@ -228,7 +228,7 @@ func toByte(r reader.Reader) (int8, error) { type Double float64 -func (d *Double) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (d *Double) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.Double() *d = Double(x) return err @@ -242,7 +242,7 @@ func toDouble(r reader.Reader) (float64, error) { type Float float32 -func (f *Float) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (f *Float) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.Float() *f = Float(x) return err @@ -256,7 +256,7 @@ func toFloat(r reader.Reader) (float32, error) { type Int int32 -func (i *Int) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (i *Int) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.VarInt() *i = Int(x) return err @@ -270,7 +270,7 @@ func toInt(r reader.Reader) (int32, error) { type Long int64 -func (l *Long) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (l *Long) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.VarLong() *l = Long(x) return err @@ -284,7 +284,7 @@ func toLong(r reader.Reader) (int64, error) { type Short int16 -func (s *Short) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (s *Short) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.VarShort() *s = Short(x) return err @@ -319,7 +319,7 @@ func (c *Class) parseField(r reader.Reader, name string, p ParseResolvable) (err return err } -func (c *Class) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (c *Class) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &c.constants, c.resolved, c.parseField) } @@ -354,7 +354,7 @@ func toClass(p ParseResolvable) (*Class, error) { type String string -func (s *String) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ ClassMetadata) error { +func (s *String) Parse(r reader.Reader, _ ClassMap, _ PoolMap, _ *ClassMetadata) error { x, err := r.String() *s = String(x) return err @@ -389,7 +389,7 @@ func (t *Thread) parseField(r reader.Reader, name string, p ParseResolvable) (er return err } -func (t *Thread) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (t *Thread) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &t.constants, t.resolved, t.parseField) } @@ -422,7 +422,7 @@ func (cl *ClassLoader) parseField(r reader.Reader, name string, p ParseResolvabl return err } -func (cl *ClassLoader) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cl *ClassLoader) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &cl.constants, cl.resolved, cl.parseField) } @@ -464,7 +464,7 @@ func (cbt *CodeBlobType) parseField(r reader.Reader, name string, p ParseResolva return err } -func (cbt *CodeBlobType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (cbt *CodeBlobType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &cbt.constants, cbt.resolved, cbt.parseField) } @@ -494,7 +494,7 @@ func (fvo *FlagValueOrigin) parseField(r reader.Reader, name string, p ParseReso return err } -func (fvo *FlagValueOrigin) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (fvo *FlagValueOrigin) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &fvo.constants, fvo.resolved, fvo.parseField) } @@ -524,7 +524,7 @@ func (ft *FrameType) parseField(r reader.Reader, name string, p ParseResolvable) return err } -func (ft *FrameType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ft *FrameType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &ft.constants, ft.resolved, ft.parseField) } @@ -554,7 +554,7 @@ func (gyt *G1YCType) parseField(r reader.Reader, name string, p ParseResolvable) return err } -func (gyt *G1YCType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (gyt *G1YCType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &gyt.constants, gyt.resolved, gyt.parseField) } @@ -584,7 +584,7 @@ func (gn *GCName) parseField(r reader.Reader, name string, p ParseResolvable) (e return err } -func (gn *GCName) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (gn *GCName) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &gn.constants, gn.resolved, gn.parseField) } @@ -626,7 +626,7 @@ func (m *Method) parseField(r reader.Reader, name string, p ParseResolvable) (er return err } -func (m *Method) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (m *Method) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &m.constants, m.resolved, m.parseField) } @@ -681,7 +681,7 @@ func (m *Module) parseField(r reader.Reader, name string, p ParseResolvable) (er return err } -func (m *Module) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (m *Module) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &m.constants, m.resolved, m.parseField) } @@ -732,7 +732,7 @@ func (nom *NarrowOopMode) parseField(r reader.Reader, name string, p ParseResolv return err } -func (nom *NarrowOopMode) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (nom *NarrowOopMode) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &nom.constants, nom.resolved, nom.parseField) } @@ -762,7 +762,7 @@ func (nim *NetworkInterfaceName) parseField(r reader.Reader, name string, p Pars return err } -func (nim *NetworkInterfaceName) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (nim *NetworkInterfaceName) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &nim.constants, nim.resolved, nim.parseField) } @@ -792,7 +792,7 @@ func (pkg *Package) parseField(r reader.Reader, name string, p ParseResolvable) return err } -func (p *Package) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (p *Package) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &p.constants, p.resolved, p.parseField) } @@ -838,7 +838,7 @@ func (sf *StackFrame) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (sf *StackFrame) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (sf *StackFrame) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &sf.constants, sf.resolved, sf.parseField) } @@ -894,7 +894,7 @@ func (st *StackTrace) parseField(r reader.Reader, name string, p ParseResolvable return err } -func (st *StackTrace) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (st *StackTrace) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &st.constants, st.resolved, st.parseField) } @@ -932,7 +932,7 @@ func (s *Symbol) parseField(r reader.Reader, name string, p ParseResolvable) (er return err } -func (s *Symbol) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (s *Symbol) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &s.constants, s.resolved, s.parseField) } @@ -963,7 +963,7 @@ func (ts *ThreadState) parseField(r reader.Reader, name string, p ParseResolvabl return err } -func (ts *ThreadState) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ts *ThreadState) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &ts.constants, ts.resolved, ts.parseField) } @@ -990,7 +990,7 @@ func (ut *UnsupportedType) parseField(r reader.Reader, name string, p ParseResol return nil } -func (ut *UnsupportedType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class ClassMetadata) error { +func (ut *UnsupportedType) Parse(r reader.Reader, classes ClassMap, cpools PoolMap, class *ClassMetadata) error { return parseFields(r, classes, cpools, class, &ut.constants, ut.resolved, ut.parseField) }