Re: New ABI NSConstantString

2018-04-08 Thread David Chisnall
On 8 Apr 2018, at 16:27, Richard Frith-Macdonald wrote: >> I also note that a lot of the NSString method implementations are not well >> optimised. > > Yes ... because they are almost never used as we historically had unicode > string methods and

Re: New ABI NSConstantString

2018-04-08 Thread David Chisnall
On 8 Apr 2018, at 16:19, Fred Kiefer wrote: > > I think your implementation of characterAtIndex: is wrong for the UTF8 case. > Sadly things are more complicated. Please have a look at the (slow) way the > old code is handling this. All of the UTF-8 and UTF-32 cases are

Re: New ABI NSConstantString

2018-04-08 Thread Richard Frith-Macdonald
> On 8 Apr 2018, at 12:41, David Chisnall wrote: > > On 8 Apr 2018, at 10:55, Richard Frith-Macdonald > wrote: >> >> >> >>> On 6 Apr 2018, at 11:00, David Chisnall wrote: >>> >>> It would

Re: New ABI NSConstantString

2018-04-08 Thread Fred Kiefer
> Am 08.04.2018 um 16:11 schrieb David Chisnall : > > On 8 Apr 2018, at 12:41, David Chisnall wrote: >> >> On 8 Apr 2018, at 10:55, Richard Frith-Macdonald >> wrote: >>> >>> >>> On 6 Apr

Re: New ABI NSConstantString

2018-04-08 Thread David Chisnall
On 8 Apr 2018, at 12:41, David Chisnall wrote: > > On 8 Apr 2018, at 10:55, Richard Frith-Macdonald > wrote: >> >> >> >>> On 6 Apr 2018, at 11:00, David Chisnall wrote: >>> >>> It would

Re: New ABI NSConstantString

2018-04-08 Thread Richard Frith-Macdonald
> On 6 Apr 2018, at 11:00, David Chisnall wrote: > > It would probably help catch more bugs if we made use of NSString’s > class-cluster nature more in -base. I have just fixed a bug in GSString > where we were checking one object matched a particular class before

Re: New ABI NSConstantString

2018-04-07 Thread Stefan Bidigaray
I looked into this extensively when I was working on CFString, and came to the conclusion that that was probably the path of least resistance. But just to clarify, the Unicode situation is even more complicated than that. Serogates are considered reserved character, and not allowed in UTF-8. So

Re: New ABI NSConstantString

2018-04-07 Thread Richard Frith-Macdonald
> On 7 Apr 2018, at 10:21, Ivan Vučica wrote: > > On Sat, Apr 7, 2018, 09:50 David Chisnall wrote: > > > My current plan is to make the format support ASCII, UTF-8, UTF-16, and > UTF-32, but only generate ASCII and UTF-16 in the compiler and then

Re: New ABI NSConstantString

2018-04-07 Thread David Chisnall
On 7 Apr 2018, at 10:21, Ivan Vučica wrote: > > On Sat, Apr 7, 2018, 09:50 David Chisnall wrote: > > > My current plan is to make the format support ASCII, UTF-8, UTF-16, and > UTF-32, but only generate ASCII and UTF-16 in the compiler and then

Re: New ABI NSConstantString

2018-04-07 Thread Ivan Vučica
On Sat, Apr 7, 2018, 09:50 David Chisnall wrote: > > > My current plan is to make the format support ASCII, UTF-8, UTF-16, and > UTF-32, but only generate ASCII and UTF-16 in the compiler and then decide > later if we want to support generating UTF-8 and UTF-32. I

Re: New ABI NSConstantString

2018-04-07 Thread David Chisnall
On 5 Apr 2018, at 20:09, Stefan Bidigaray wrote: > > I know this is probably going to be rejected, but how about making constant > string either ASCII or UTF-16 only? Scratching UTF-8 altogether? I know this > would increase the byte count for most European languages

Re: New ABI NSConstantString

2018-04-06 Thread David Chisnall
On 1 Apr 2018, at 11:36, Fred Kiefer wrote: > > Wouldn’t the most useful structure be the one we already use for GSString? > > @interface GSString : NSString > { > @public > GSCharPtr _contents; > unsigned int _count; > struct { >unsigned int wide: 1;//

Re: New ABI NSConstantString

2018-04-05 Thread David Chisnall
On 6 Apr 2018, at 00:25, Stefan Bidigaray wrote: > > I use the gmail web interface, which is not great. I'll just comment without > quoting. > > The thing I'm trying to address is the fact that all CF objects must start > with: > struct { > void *isa; >

Re: New ABI NSConstantString

2018-04-05 Thread Stefan Bidigaray
I use the gmail web interface, which is not great. I'll just comment without quoting. The thing I'm trying to address is the fact that all CF objects must start with: struct { void *isa; uint32_t info; }; That 32-bit info value includes the CFTypeID (a 16-bit value) and 16-bit for

Re: New ABI NSConstantString

2018-04-05 Thread David Chisnall
This might be slightly confusing, because your mail client doesn’t seem to do anything sane for quoting: On 5 Apr 2018, at 20:09, Stefan Bidigaray wrote: > > On Thu, Apr 5, 2018 at 1:41 PM, David Chisnall > wrote: > On 5 Apr 2018, at 17:27,

Re: New ABI NSConstantString

2018-04-05 Thread Stefan Bidigaray
On Thu, Apr 5, 2018 at 1:41 PM, David Chisnall wrote: > On 5 Apr 2018, at 17:27, Stefan Bidigaray wrote: > > > > Hi David, > > I forgot to make a comment when you originally posted the idea, and I > think this would be a great time to add my 2

Re: New ABI NSConstantString

2018-04-05 Thread Ivan Vučica
Thank you, this was very informative! On Thu, Apr 5, 2018 at 6:41 PM, David Chisnall wrote: > On 5 Apr 2018, at 17:01, Ivan Vučica wrote: >> >> Layman question: does it make sense to optimize for space, too, and have a >> smaller structure for tiny

Re: New ABI NSConstantString

2018-04-05 Thread David Chisnall
On 5 Apr 2018, at 17:01, Ivan Vučica wrote: > > Layman question: does it make sense to optimize for space, too, and have a > smaller structure for tiny constant strings? With the new ABI, we get much better deduplication across compilation units for selectors and protocols,

Re: New ABI NSConstantString

2018-04-05 Thread David Chisnall
On 5 Apr 2018, at 17:27, Stefan Bidigaray wrote: > > Hi David, > I forgot to make a comment when you originally posted the idea, and I think > this would be a great time to add my 2 cents. > > Regarding the structure: > * Would it not be better to add the flags bit field

Re: New ABI NSConstantString

2018-04-05 Thread Stefan Bidigaray
Hi David, I forgot to make a comment when you originally posted the idea, and I think this would be a great time to add my 2 cents. Regarding the structure: * Would it not be better to add the flags bit field immediately after the isa pointer? My thought here is that it can be checked for if

Re: New ABI NSConstantString

2018-04-05 Thread Ivan Vučica
Layman question: does it make sense to optimize for space, too, and have a smaller structure for tiny constant strings? For 32bit ptrs and longs, this would be 20 bytes without the string itself. I don't think that's a lot, but I thought I'd ask. On Thu, Apr 5, 2018, 16:25 David Chisnall

Re: New ABI NSConstantString

2018-04-05 Thread David Chisnall
On 1 Apr 2018, at 14:06, Richard Frith-Macdonald wrote: > > > I wasn't aware of that ... it would make sense for your new ABI, when > individual bits, to have them specified as particular bits rather than as a > bitfield, avoiding the possibility of

Re: New ABI NSConstantString

2018-04-01 Thread Richard Frith-Macdonald
> On 1 Apr 2018, at 12:21, David Chisnall wrote: > > On 1 Apr 2018, at 11:36, Fred Kiefer wrote: >> >> Wouldn’t the most useful structure be the one we already use for GSString? > > That’s certainly a good starting point! > >> >> @interface

Re: New ABI NSConstantString

2018-04-01 Thread David Chisnall
On 1 Apr 2018, at 11:36, Fred Kiefer wrote: > > Wouldn’t the most useful structure be the one we already use for GSString? That’s certainly a good starting point! > > @interface GSString : NSString > { > @public > GSCharPtr _contents; > unsigned int _count; Is this the

Re: New ABI NSConstantString

2018-04-01 Thread Fred Kiefer
Am 01.04.2018 um 11:52 schrieb David Chisnall : > > Hello the list, > > I have nearly finished the ELF version of the new Objective-C ABI. It is > able to pass the same tests that the previous one did in -base, with a > smaller binary and better reflection metadata.