Skip to content

Commit 602ab18

Browse files
committed
Revert "Add support for fetching signed values from tagged pointers."
This reverts commit 4d9039c. This is causing the greendragon bots to fail most of the time when running TestNSDictionarySynthetic.py. Reverting until Jim has a chance to look at this on Monday. Running the commands from that test from the command line, it fails 10-13% of the time on my desktop. This is a revert of Jim's changes in https://reviews.llvm.org/D99694
1 parent c4c5113 commit 602ab18

File tree

6 files changed

+17
-92
lines changed

6 files changed

+17
-92
lines changed

lldb/source/Plugins/Language/ObjC/Cocoa.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static void NSNumber_FormatInt(ValueObject &valobj, Stream &stream, int value,
351351
}
352352

353353
static void NSNumber_FormatLong(ValueObject &valobj, Stream &stream,
354-
int64_t value, lldb::LanguageType lang) {
354+
uint64_t value, lldb::LanguageType lang) {
355355
static ConstString g_TypeHint("NSNumber:long");
356356

357357
std::string prefix, suffix;
@@ -456,15 +456,9 @@ bool lldb_private::formatters::NSNumberSummaryProvider(
456456
return NSDecimalNumberSummaryProvider(valobj, stream, options);
457457

458458
if (class_name == "NSNumber" || class_name == "__NSCFNumber") {
459-
int64_t value = 0;
459+
uint64_t value = 0;
460460
uint64_t i_bits = 0;
461-
if (descriptor->GetTaggedPointerInfoSigned(&i_bits, &value)) {
462-
// Check for "preserved" numbers. We still don't support them yet.
463-
if (i_bits & 0x8) {
464-
lldbassert(!static_cast<bool>("We should handle preserved numbers!"));
465-
return false;
466-
}
467-
461+
if (descriptor->GetTaggedPointerInfo(&i_bits, &value)) {
468462
switch (i_bits) {
469463
case 0:
470464
NSNumber_FormatChar(valobj, stream, (char)value, options.GetLanguage());

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor {
4141
return false;
4242
}
4343

44-
bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,
45-
int64_t *value_bits = nullptr,
46-
uint64_t *payload = nullptr) override {
47-
return false;
48-
}
49-
5044
uint64_t GetInstanceSize() override;
5145

5246
ObjCLanguageRuntime::ObjCISA GetISA() override { return m_objc_class_ptr; }
@@ -259,7 +253,7 @@ class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor {
259253

260254
ClassDescriptorV2Tagged(
261255
ObjCLanguageRuntime::ClassDescriptorSP actual_class_sp,
262-
uint64_t u_payload, int64_t s_payload) {
256+
uint64_t payload) {
263257
if (!actual_class_sp) {
264258
m_valid = false;
265259
return;
@@ -270,10 +264,9 @@ class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor {
270264
return;
271265
}
272266
m_valid = true;
273-
m_payload = u_payload;
267+
m_payload = payload;
274268
m_info_bits = (m_payload & 0x0FULL);
275269
m_value_bits = (m_payload & ~0x0FULL) >> 4;
276-
m_value_bits_signed = (s_payload & ~0x0FLL) >> 4;
277270
}
278271

279272
~ClassDescriptorV2Tagged() override = default;
@@ -315,18 +308,6 @@ class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor {
315308
return true;
316309
}
317310

318-
bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,
319-
int64_t *value_bits = nullptr,
320-
uint64_t *payload = nullptr) override {
321-
if (info_bits)
322-
*info_bits = GetInfoBits();
323-
if (value_bits)
324-
*value_bits = GetValueBitsSigned();
325-
if (payload)
326-
*payload = GetPayload();
327-
return true;
328-
}
329-
330311
uint64_t GetInstanceSize() override {
331312
return (IsValid() ? m_pointer_size : 0);
332313
}
@@ -338,10 +319,6 @@ class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor {
338319
// these calls are not part of any formal tagged pointers specification
339320
virtual uint64_t GetValueBits() { return (IsValid() ? m_value_bits : 0); }
340321

341-
virtual int64_t GetValueBitsSigned() {
342-
return (IsValid() ? m_value_bits_signed : 0);
343-
}
344-
345322
virtual uint64_t GetInfoBits() { return (IsValid() ? m_info_bits : 0); }
346323

347324
virtual uint64_t GetPayload() { return (IsValid() ? m_payload : 0); }
@@ -352,7 +329,6 @@ class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor {
352329
bool m_valid;
353330
uint64_t m_info_bits;
354331
uint64_t m_value_bits;
355-
int64_t m_value_bits_signed;
356332
uint64_t m_payload;
357333
};
358334

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ class AppleObjCRuntimeV1 : public AppleObjCRuntime {
6464
return false;
6565
}
6666

67-
bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,
68-
int64_t *value_bits = nullptr,
69-
uint64_t *payload = nullptr) override {
70-
return false;
71-
}
72-
7367
uint64_t GetInstanceSize() override { return m_instance_size; }
7468

7569
ObjCISA GetISA() override { return m_isa; }

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,6 +2460,7 @@ ObjCLanguageRuntime::ClassDescriptorSP
24602460
AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor(
24612461
lldb::addr_t ptr) {
24622462
ClassDescriptorSP actual_class_descriptor_sp;
2463+
uint64_t data_payload;
24632464
uint64_t unobfuscated = (ptr) ^ m_runtime.GetTaggedPointerObfuscator();
24642465

24652466
if (!IsPossibleTaggedPointer(unobfuscated))
@@ -2487,15 +2488,12 @@ AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor(
24872488
m_cache[slot] = actual_class_descriptor_sp;
24882489
}
24892490

2490-
uint64_t data_payload =
2491+
data_payload =
24912492
(((uint64_t)unobfuscated << m_objc_debug_taggedpointer_payload_lshift) >>
24922493
m_objc_debug_taggedpointer_payload_rshift);
2493-
int64_t data_payload_signed =
2494-
((int64_t)((int64_t)unobfuscated
2495-
<< m_objc_debug_taggedpointer_payload_lshift) >>
2496-
m_objc_debug_taggedpointer_payload_rshift);
2497-
return ClassDescriptorSP(new ClassDescriptorV2Tagged(
2498-
actual_class_descriptor_sp, data_payload, data_payload_signed));
2494+
2495+
return ClassDescriptorSP(
2496+
new ClassDescriptorV2Tagged(actual_class_descriptor_sp, data_payload));
24992497
}
25002498

25012499
AppleObjCRuntimeV2::TaggedPointerVendorExtended::TaggedPointerVendorExtended(
@@ -2547,6 +2545,7 @@ ObjCLanguageRuntime::ClassDescriptorSP
25472545
AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor(
25482546
lldb::addr_t ptr) {
25492547
ClassDescriptorSP actual_class_descriptor_sp;
2548+
uint64_t data_payload;
25502549
uint64_t unobfuscated = (ptr) ^ m_runtime.GetTaggedPointerObfuscator();
25512550

25522551
if (!IsPossibleTaggedPointer(unobfuscated))
@@ -2577,16 +2576,12 @@ AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor(
25772576
m_ext_cache[slot] = actual_class_descriptor_sp;
25782577
}
25792578

2580-
uint64_t data_payload = (((uint64_t)unobfuscated
2581-
<< m_objc_debug_taggedpointer_ext_payload_lshift) >>
2582-
m_objc_debug_taggedpointer_ext_payload_rshift);
2583-
int64_t data_payload_signed =
2584-
((int64_t)((int64_t)unobfuscated
2585-
<< m_objc_debug_taggedpointer_ext_payload_lshift) >>
2586-
m_objc_debug_taggedpointer_ext_payload_rshift);
2579+
data_payload = (((uint64_t)unobfuscated
2580+
<< m_objc_debug_taggedpointer_ext_payload_lshift) >>
2581+
m_objc_debug_taggedpointer_ext_payload_rshift);
25872582

2588-
return ClassDescriptorSP(new ClassDescriptorV2Tagged(
2589-
actual_class_descriptor_sp, data_payload, data_payload_signed));
2583+
return ClassDescriptorSP(
2584+
new ClassDescriptorV2Tagged(actual_class_descriptor_sp, data_payload));
25902585
}
25912586

25922587
AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache(

lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,10 @@ class ObjCLanguageRuntime : public LanguageRuntime {
8787

8888
virtual bool IsValid() = 0;
8989

90-
/// There are two routines in the ObjC runtime that tagged pointer clients
91-
/// can call to get the value from their tagged pointer, one that retrieves
92-
/// it as an unsigned value and one a signed value. These two
93-
/// GetTaggedPointerInfo methods mirror those two ObjC runtime calls.
94-
/// @{
9590
virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
9691
uint64_t *value_bits = nullptr,
9792
uint64_t *payload = nullptr) = 0;
9893

99-
virtual bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,
100-
int64_t *value_bits = nullptr,
101-
uint64_t *payload = nullptr) = 0;
102-
/// @}
103-
10494
virtual uint64_t GetInstanceSize() = 0;
10595

10696
// use to implement version-specific additional constraints on pointers

lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_coreframeworks_and_run_command(self):
4545
'(Point) point = (v=7, h=12)', '(Point *) point_ptr = (v=7, h=12)',
4646
'(SEL) foo_selector = "foo_selector_impl"'
4747
]
48+
4849
self.expect("frame variable", substrs=expect_strings)
4950

5051
if self.getArchitecture() in ['i386', 'x86_64']:
@@ -55,28 +56,3 @@ def test_coreframeworks_and_run_command(self):
5556
'(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)',
5657
]
5758
self.expect("frame variable", substrs=extra_string)
58-
59-
# The original tests left out testing the NSNumber values, so do that here.
60-
# This set is all pointers, with summaries, so we only check the summary.
61-
var_list_pointer = [
62-
['NSNumber *', 'num1', '(int)5'],
63-
['NSNumber *', 'num2', '(float)3.140000'],
64-
['NSNumber *', 'num3', '(double)3.14'],
65-
['NSNumber *', 'num4', '(int128_t)18446744073709551614'],
66-
['NSNumber *', 'num5', '(char)65'],
67-
['NSNumber *', 'num6', '(long)255'],
68-
['NSNumber *', 'num7', '(long)2000000'],
69-
['NSNumber *', 'num8_Y', 'YES'],
70-
['NSNumber *', 'num8_N', 'NO'],
71-
['NSNumber *', 'num9', '(short)-31616'],
72-
['NSNumber *', 'num_at1', '(int)12'],
73-
['NSNumber *', 'num_at2', '(int)-12'],
74-
['NSNumber *', 'num_at3', '(double)12.5'],
75-
['NSNumber *', 'num_at4', '(double)-12.5'],
76-
['NSDecimalNumber *', 'decimal_number', '123456 x 10^-10'],
77-
['NSDecimalNumber *', 'decimal_number_neg', '-123456 x 10^10']
78-
]
79-
for type, var_path, summary in var_list_pointer:
80-
self.expect_var_path(var_path, summary, None, type)
81-
82-

0 commit comments

Comments
 (0)