diff --git a/gen/main.go b/gen/main.go index 0c380f0..51cc4eb 100644 --- a/gen/main.go +++ b/gen/main.go @@ -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") diff --git a/parser/testdata/uint64-ref-id.jfr.gz b/parser/testdata/uint64-ref-id.jfr.gz new file mode 100644 index 0000000..f3f3c8e Binary files /dev/null and b/parser/testdata/uint64-ref-id.jfr.gz differ diff --git a/parser/testdata/uint64-ref-id_0_block_contentions__count delay__nanoseconds_expected.txt.gz b/parser/testdata/uint64-ref-id_0_block_contentions__count delay__nanoseconds_expected.txt.gz new file mode 100644 index 0000000..2363aae Binary files /dev/null and b/parser/testdata/uint64-ref-id_0_block_contentions__count delay__nanoseconds_expected.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_0_block_contentions__count delay__nanoseconds_expected_collapsed.txt.gz b/parser/testdata/uint64-ref-id_0_block_contentions__count delay__nanoseconds_expected_collapsed.txt.gz new file mode 100644 index 0000000..069f36e Binary files /dev/null and b/parser/testdata/uint64-ref-id_0_block_contentions__count delay__nanoseconds_expected_collapsed.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_1_memory_alloc_in_new_tlab_objects__count alloc_in_new_tlab_bytes__bytes_expected.txt.gz b/parser/testdata/uint64-ref-id_1_memory_alloc_in_new_tlab_objects__count alloc_in_new_tlab_bytes__bytes_expected.txt.gz new file mode 100644 index 0000000..be84cca Binary files /dev/null and b/parser/testdata/uint64-ref-id_1_memory_alloc_in_new_tlab_objects__count alloc_in_new_tlab_bytes__bytes_expected.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_1_memory_alloc_in_new_tlab_objects__count alloc_in_new_tlab_bytes__bytes_expected_collapsed.txt.gz b/parser/testdata/uint64-ref-id_1_memory_alloc_in_new_tlab_objects__count alloc_in_new_tlab_bytes__bytes_expected_collapsed.txt.gz new file mode 100644 index 0000000..a0ecfdc Binary files /dev/null and b/parser/testdata/uint64-ref-id_1_memory_alloc_in_new_tlab_objects__count alloc_in_new_tlab_bytes__bytes_expected_collapsed.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_2_memory_alloc_outside_tlab_objects__count alloc_outside_tlab_bytes__bytes_expected.txt.gz b/parser/testdata/uint64-ref-id_2_memory_alloc_outside_tlab_objects__count alloc_outside_tlab_bytes__bytes_expected.txt.gz new file mode 100644 index 0000000..9418e3c Binary files /dev/null and b/parser/testdata/uint64-ref-id_2_memory_alloc_outside_tlab_objects__count alloc_outside_tlab_bytes__bytes_expected.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_2_memory_alloc_outside_tlab_objects__count alloc_outside_tlab_bytes__bytes_expected_collapsed.txt.gz b/parser/testdata/uint64-ref-id_2_memory_alloc_outside_tlab_objects__count alloc_outside_tlab_bytes__bytes_expected_collapsed.txt.gz new file mode 100644 index 0000000..1b4edf5 Binary files /dev/null and b/parser/testdata/uint64-ref-id_2_memory_alloc_outside_tlab_objects__count alloc_outside_tlab_bytes__bytes_expected_collapsed.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_3_memory_alloc_sample_objects__count alloc_sample_bytes__bytes_expected.txt.gz b/parser/testdata/uint64-ref-id_3_memory_alloc_sample_objects__count alloc_sample_bytes__bytes_expected.txt.gz new file mode 100644 index 0000000..d81b78b Binary files /dev/null and b/parser/testdata/uint64-ref-id_3_memory_alloc_sample_objects__count alloc_sample_bytes__bytes_expected.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_3_memory_alloc_sample_objects__count alloc_sample_bytes__bytes_expected_collapsed.txt.gz b/parser/testdata/uint64-ref-id_3_memory_alloc_sample_objects__count alloc_sample_bytes__bytes_expected_collapsed.txt.gz new file mode 100644 index 0000000..00b175b Binary files /dev/null and b/parser/testdata/uint64-ref-id_3_memory_alloc_sample_objects__count alloc_sample_bytes__bytes_expected_collapsed.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_4_process_cpu_cpu__nanoseconds_expected.txt.gz b/parser/testdata/uint64-ref-id_4_process_cpu_cpu__nanoseconds_expected.txt.gz new file mode 100644 index 0000000..aa4dd6f Binary files /dev/null and b/parser/testdata/uint64-ref-id_4_process_cpu_cpu__nanoseconds_expected.txt.gz differ diff --git a/parser/testdata/uint64-ref-id_4_process_cpu_cpu__nanoseconds_expected_collapsed.txt.gz b/parser/testdata/uint64-ref-id_4_process_cpu_cpu__nanoseconds_expected_collapsed.txt.gz new file mode 100644 index 0000000..b334c2e Binary files /dev/null and b/parser/testdata/uint64-ref-id_4_process_cpu_cpu__nanoseconds_expected_collapsed.txt.gz differ diff --git a/parser/types/active_settings.go b/parser/types/active_settings.go index b4435ba..b12044d 100644 --- a/parser/types/active_settings.go +++ b/parser/types/active_settings.go @@ -120,29 +120,31 @@ func (this *ActiveSetting) Parse(data []byte, bind *BindActiveSetting, typeMap * } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } } } else { diff --git a/parser/types/allocation_in_new_tlab.go b/parser/types/allocation_in_new_tlab.go index bdea16e..fa1ed6d 100644 --- a/parser/types/allocation_in_new_tlab.go +++ b/parser/types/allocation_in_new_tlab.go @@ -120,33 +120,35 @@ func (this *ObjectAllocationInNewTLAB) Parse(data []byte, bind *BindObjectAlloca } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } } } else { diff --git a/parser/types/allocation_outside_tlab.go b/parser/types/allocation_outside_tlab.go index 231d4c4..40547f2 100644 --- a/parser/types/allocation_outside_tlab.go +++ b/parser/types/allocation_outside_tlab.go @@ -113,33 +113,35 @@ func (this *ObjectAllocationOutsideTLAB) Parse(data []byte, bind *BindObjectAllo } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } } } else { diff --git a/parser/types/allocation_sample.go b/parser/types/allocation_sample.go index d0fb142..9ca9d8a 100644 --- a/parser/types/allocation_sample.go +++ b/parser/types/allocation_sample.go @@ -113,33 +113,35 @@ func (this *ObjectAllocationSample) Parse(data []byte, bind *BindObjectAllocatio } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } } } else { diff --git a/parser/types/class.go b/parser/types/class.go index 0f552b9..afe26c7 100644 --- a/parser/types/class.go +++ b/parser/types/class.go @@ -130,33 +130,35 @@ func (this *ClassList) Parse(data []byte, bind *BindClass, typeMap *def.TypeMap) } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_CLASS_LOADER: if bind.Fields[bindFieldIndex].ClassLoaderRef != nil { - *bind.Fields[bindFieldIndex].ClassLoaderRef = ClassLoaderRef(v32_) + *bind.Fields[bindFieldIndex].ClassLoaderRef = ClassLoaderRef(v64_) } case typeMap.T_SYMBOL: if bind.Fields[bindFieldIndex].SymbolRef != nil { - *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v32_) + *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v64_) } case typeMap.T_PACKAGE: if bind.Fields[bindFieldIndex].PackageRef != nil { - *bind.Fields[bindFieldIndex].PackageRef = PackageRef(v32_) + *bind.Fields[bindFieldIndex].PackageRef = PackageRef(v64_) } } } else { diff --git a/parser/types/classloader.go b/parser/types/classloader.go index f453186..5d0eec6 100644 --- a/parser/types/classloader.go +++ b/parser/types/classloader.go @@ -126,29 +126,31 @@ func (this *ClassLoaderList) Parse(data []byte, bind *BindClassLoader, typeMap * } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } case typeMap.T_SYMBOL: if bind.Fields[bindFieldIndex].SymbolRef != nil { - *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v32_) + *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v64_) } } } else { diff --git a/parser/types/execution_sample.go b/parser/types/execution_sample.go index fa8aa04..3cc7c96 100644 --- a/parser/types/execution_sample.go +++ b/parser/types/execution_sample.go @@ -106,33 +106,35 @@ func (this *ExecutionSample) Parse(data []byte, bind *BindExecutionSample, typeM } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_THREAD_STATE: if bind.Fields[bindFieldIndex].ThreadStateRef != nil { - *bind.Fields[bindFieldIndex].ThreadStateRef = ThreadStateRef(v32_) + *bind.Fields[bindFieldIndex].ThreadStateRef = ThreadStateRef(v64_) } } } else { diff --git a/parser/types/frametype.go b/parser/types/frametype.go index 59d1097..c23c170 100644 --- a/parser/types/frametype.go +++ b/parser/types/frametype.go @@ -118,19 +118,21 @@ func (this *FrameTypeList) Parse(data []byte, bind *BindFrameType, typeMap *def. } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { diff --git a/parser/types/live_object.go b/parser/types/live_object.go index c70feb5..2dc49a4 100644 --- a/parser/types/live_object.go +++ b/parser/types/live_object.go @@ -113,33 +113,35 @@ func (this *LiveObject) Parse(data []byte, bind *BindLiveObject, typeMap *def.Ty } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } } } else { diff --git a/parser/types/loglevel.go b/parser/types/loglevel.go index b907653..bc6f666 100644 --- a/parser/types/loglevel.go +++ b/parser/types/loglevel.go @@ -118,19 +118,21 @@ func (this *LogLevelList) Parse(data []byte, bind *BindLogLevel, typeMap *def.Ty } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { diff --git a/parser/types/method.go b/parser/types/method.go index 6c0464d..00f726d 100644 --- a/parser/types/method.go +++ b/parser/types/method.go @@ -137,29 +137,31 @@ func (this *MethodList) Parse(data []byte, bind *BindMethod, typeMap *def.TypeMa } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } case typeMap.T_SYMBOL: if bind.Fields[bindFieldIndex].SymbolRef != nil { - *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v32_) + *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v64_) } } } else { diff --git a/parser/types/monitor_enter.go b/parser/types/monitor_enter.go index 3f2f53f..6724b25 100644 --- a/parser/types/monitor_enter.go +++ b/parser/types/monitor_enter.go @@ -127,33 +127,35 @@ func (this *JavaMonitorEnter) Parse(data []byte, bind *BindJavaMonitorEnter, typ } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } } } else { diff --git a/parser/types/package.go b/parser/types/package.go index 4feaa18..ad7a1b2 100644 --- a/parser/types/package.go +++ b/parser/types/package.go @@ -118,25 +118,27 @@ func (this *PackageList) Parse(data []byte, bind *BindPackage, typeMap *def.Type } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_SYMBOL: if bind.Fields[bindFieldIndex].SymbolRef != nil { - *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v32_) + *bind.Fields[bindFieldIndex].SymbolRef = SymbolRef(v64_) } } } else { diff --git a/parser/types/skipper.go b/parser/types/skipper.go index 9fd3169..72a56a4 100644 --- a/parser/types/skipper.go +++ b/parser/types/skipper.go @@ -105,19 +105,21 @@ func (this *SkipConstantPoolList) Parse(data []byte, bind *BindSkipConstantPool, } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { diff --git a/parser/types/stackframe.go b/parser/types/stackframe.go index 529a78b..a5fbe58 100644 --- a/parser/types/stackframe.go +++ b/parser/types/stackframe.go @@ -90,29 +90,31 @@ func (this *StackFrame) Parse(data []byte, bind *BindStackFrame, typeMap *def.Ty } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_METHOD: if bind.Fields[bindFieldIndex].MethodRef != nil { - *bind.Fields[bindFieldIndex].MethodRef = MethodRef(v32_) + *bind.Fields[bindFieldIndex].MethodRef = MethodRef(v64_) } case typeMap.T_FRAME_TYPE: if bind.Fields[bindFieldIndex].FrameTypeRef != nil { - *bind.Fields[bindFieldIndex].FrameTypeRef = FrameTypeRef(v32_) + *bind.Fields[bindFieldIndex].FrameTypeRef = FrameTypeRef(v64_) } } } else { diff --git a/parser/types/stacktrace.go b/parser/types/stacktrace.go index c9ca6de..33b1f19 100644 --- a/parser/types/stacktrace.go +++ b/parser/types/stacktrace.go @@ -129,19 +129,21 @@ func (this *StackTraceList) Parse(data []byte, bind *BindStackTrace, bindStackFr } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { @@ -307,29 +309,31 @@ func (this *StackTraceList) Parse(data []byte, bind *BindStackTrace, bindStackFr } for bindStackFrameArrayIndex := 0; bindStackFrameArrayIndex < bindStackFrameArraySize; bindStackFrameArrayIndex++ { if bindStackFrame.Fields[bindStackFrameFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bindStackFrame.Fields[bindStackFrameFieldIndex].Field.Type { case typeMap.T_METHOD: if bindStackFrame.Fields[bindStackFrameFieldIndex].MethodRef != nil { - *bindStackFrame.Fields[bindStackFrameFieldIndex].MethodRef = MethodRef(v32_) + *bindStackFrame.Fields[bindStackFrameFieldIndex].MethodRef = MethodRef(v64_) } case typeMap.T_FRAME_TYPE: if bindStackFrame.Fields[bindStackFrameFieldIndex].FrameTypeRef != nil { - *bindStackFrame.Fields[bindStackFrameFieldIndex].FrameTypeRef = FrameTypeRef(v32_) + *bindStackFrame.Fields[bindStackFrameFieldIndex].FrameTypeRef = FrameTypeRef(v64_) } } } else { diff --git a/parser/types/symbol.go b/parser/types/symbol.go index 6ef4bc2..6b744d8 100644 --- a/parser/types/symbol.go +++ b/parser/types/symbol.go @@ -118,19 +118,21 @@ func (this *SymbolList) Parse(data []byte, bind *BindSymbol, typeMap *def.TypeMa } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { diff --git a/parser/types/thread.go b/parser/types/thread.go index 0f157b6..45055f0 100644 --- a/parser/types/thread.go +++ b/parser/types/thread.go @@ -140,19 +140,21 @@ func (this *ThreadList) Parse(data []byte, bind *BindThread, typeMap *def.TypeMa } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { diff --git a/parser/types/thread_park.go b/parser/types/thread_park.go index 6ce8aeb..ab335f3 100644 --- a/parser/types/thread_park.go +++ b/parser/types/thread_park.go @@ -134,33 +134,35 @@ func (this *ThreadPark) Parse(data []byte, bind *BindThreadPark, typeMap *def.Ty } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } switch bind.Fields[bindFieldIndex].Field.Type { case typeMap.T_THREAD: if bind.Fields[bindFieldIndex].ThreadRef != nil { - *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v32_) + *bind.Fields[bindFieldIndex].ThreadRef = ThreadRef(v64_) } case typeMap.T_STACK_TRACE: if bind.Fields[bindFieldIndex].StackTraceRef != nil { - *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v32_) + *bind.Fields[bindFieldIndex].StackTraceRef = StackTraceRef(v64_) } case typeMap.T_CLASS: if bind.Fields[bindFieldIndex].ClassRef != nil { - *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v32_) + *bind.Fields[bindFieldIndex].ClassRef = ClassRef(v64_) } } } else { diff --git a/parser/types/threadstate.go b/parser/types/threadstate.go index c10e411..e127803 100644 --- a/parser/types/threadstate.go +++ b/parser/types/threadstate.go @@ -118,19 +118,21 @@ func (this *ThreadStateList) Parse(data []byte, bind *BindThreadState, typeMap * } for bindArrayIndex := 0; bindArrayIndex < bindArraySize; bindArrayIndex++ { if bind.Fields[bindFieldIndex].Field.ConstantPool { - v32_ = uint32(0) - for shift = uint(0); ; shift += 7 { - if shift >= 32 { - return 0, def.ErrIntOverflow - } + v64_ = 0 + for shift = uint(0); shift <= 56; shift += 7 { if pos >= l { return 0, io.ErrUnexpectedEOF } b_ = data[pos] pos++ - v32_ |= uint32(b_&0x7F) << shift - if b_ < 0x80 { + if shift == 56 { + v64_ |= uint64(b_&0xFF) << shift break + } else { + v64_ |= uint64(b_&0x7F) << shift + if b_ < 0x80 { + break + } } } } else { diff --git a/pprof/parser_test.go b/pprof/parser_test.go index 7defc5e..b446e8a 100644 --- a/pprof/parser_test.go +++ b/pprof/parser_test.go @@ -47,6 +47,7 @@ var testfiles = []testdata{ {"cpool-uint64-constant-index", "", 5}, {"event-with-type-zero", "", 5}, {"object-allocation-sample", "", 3}, + {"uint64-ref-id", "", 5}, } type gprofile struct {