Skip to content

Commit

Permalink
Reapply "Implement NSDate as a small object (tagged pointer) - clang/…
Browse files Browse the repository at this point in the history
…libobjc2 only (#451)" because of GUI breakage: apps hang when loading NSMenu

This reverts commit cac43f7.
  • Loading branch information
rfm committed Nov 1, 2024
1 parent cfa3cd3 commit 9978c05
Show file tree
Hide file tree
Showing 6 changed files with 832 additions and 437 deletions.
17 changes: 16 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,22 @@
* Source/NSFileManager.m: Create an NSError object when we fail to
copy because the destination item already exists.

2024-09-23: Hugo Melder <[email protected]>
2024-10-10: Hugo Melder <[email protected]>

* Source/NSDate.m:
* Source/NSDatePrivate.h:
NSDate is now a small object in slot 6, when configuring GNUstep with the
clang/libobjc2 toolchain. This is done by compressing the binary64 fp
holding the seconds since reference date (because someone at Apple thought
it would be a good idea to represent a time interval as a fp). Note that
this assumes that IEEE 754 is used.
* Source/NSCalendarDate.m:
Remove access to the NSDate private concrete Class
and implement -timeIntervalSinceReferenceDate instead.
Previously, all methods of the concrete date class were
added to NSCalendarDate via GSObjCAddClassBehavior.

2024-23-09: Hugo Melder <[email protected]>

* Headers/Foundation/NSThread.h:
* Source/NSString.m:
Expand Down
9 changes: 5 additions & 4 deletions Source/NSCalendarDate.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ @interface GSTimeZone : NSObject // Help the compiler
@class GSAbsTimeZone;
@interface GSAbsTimeZone : NSObject // Help the compiler
@end
@class NSGDate;
@interface NSGDate : NSObject // Help the compiler
@end


#define DISTANT_FUTURE 63113990400.0
Expand Down Expand Up @@ -396,7 +393,6 @@ + (void) initialize
absAbrIMP = (NSString* (*)(id,SEL,id))
[absClass instanceMethodForSelector: abrSEL];

GSObjCAddClassBehavior(self, [NSGDate class]);
[pool release];
}
}
Expand Down Expand Up @@ -463,6 +459,11 @@ + (id) dateWithYear: (NSInteger)year
return AUTORELEASE(d);
}

- (NSTimeInterval) timeIntervalSinceReferenceDate
{
return _seconds_since_ref;
}

/**
* Creates and returns a new NSCalendarDate object by taking the
* value of the receiver and adding the interval in seconds specified.
Expand Down
Loading

0 comments on commit 9978c05

Please sign in to comment.