On 2/8/2018 5:26 AM, Steven Schveighoffer wrote:
The extra data in the object file comes from the inclusion of the hexStringImpl function, and from the template parameter (the symbol _D3std4conv__T9hexStringVAyaa8_6465616462656566ZQBiyAa is in there as well, which will always be larger than the actual string passed to hexString).

I also see the data in there twice for some reason.

This is no longer the case with the PR.

  import std.conv;

  void test() {
    __gshared immutable char[4] s = hexString!"deadbeef";
  }

produces the following, with no sign of the template and the data is there only once:

_TEXT   segment dword use32 public 'CODE'       ;size is 0
_TEXT   ends
_DATA   segment para use32 public 'DATA'        ;size is 4
_DATA   ends
CONST   segment para use32 public 'CONST'       ;size is 14
CONST   ends
_BSS    segment para use32 public 'BSS' ;size is 0
_BSS    ends
FLAT    group   
        extrn   _D5test24testFZv

        public  _D5test24testFZ1syG4a
FMB     segment dword use32 public 'DATA'       ;size is 0
FMB     ends
FM      segment dword use32 public 'DATA'       ;size is 4
FM      ends
FME     segment dword use32 public 'DATA'       ;size is 0
FME     ends

        public  _D5test212__ModuleInfoZ
_D5test24testFZv        COMDAT flags=x0 attr=x0 align=x0

_TEXT   segment
        assume  CS:_TEXT
_TEXT   ends
_DATA   segment
_D5test24testFZ1syG4a:
        db      0ffffffdeh,0ffffffadh,0ffffffbeh,0ffffffefh     ;....
_DATA   ends
CONST   segment
_D5test212__ModuleInfoZ:
        db      004h,010h,000h,000h,000h,000h,000h,000h ;........
        db      074h,065h,073h,074h,032h,000h   ;test2.
CONST   ends
_BSS    segment
_BSS    ends
FMB     segment
FMB     ends
FM      segment
        dd      offset FLAT:_D5test212__ModuleInfoZ
FM      ends
FME     segment
FME     ends
_D5test24testFZv        comdat
        assume  CS:_D5test24testFZv
                ret
_D5test24testFZv        ends
        end



Reply via email to