Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions spec/abi.dd
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ $(H3 $(LNAME2 name_mangling, Name Mangling))
$(GNAME MangledName):
$(B _D) $(GLINK QualifiedName) $(GLINK Type)
$(B _D) $(GLINK QualifiedName) $(B M) $(GLINK Type)
$(B _D) $(GLINK QualifiedName) $(B Z) $(GREEN // Internal)

$(GNAME QualifiedName):
$(GLINK SymbolName)
Expand All @@ -214,6 +215,7 @@ $(H3 $(LNAME2 name_mangling, Name Mangling))
$(GNAME SymbolName):
$(GLINK LName)
$(GLINK TemplateInstanceName)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move the less common anonymous symbol case to the bottom.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amended.

BTW: I've only seen this with overload sets as template arguments, but it looks like a bug to me: the overloaded symbol has these anonymous parents, but something like the location of the lookup should be encoded instead.

$(B 0) $(GREEN // anonymous symbols)
)

$(P The $(B M) means that the symbol is a function that requires
Expand All @@ -225,7 +227,11 @@ $(H3 $(LNAME2 name_mangling, Name Mangling))

$(GRAMMAR
$(GNAME TemplateInstanceName):
$(GLINK Number) $(B __T) $(GLINK LName) $(GLINK TemplateArgs) $(B Z)
$(GLINK Number) $(GLINK TemplateID) $(GLINK LName) $(GLINK TemplateArgs) $(B Z)

$(GNAME TemplateID):
$(B __T)
$(B __U) $(GREEN // for symbols declared inside template constraint)

$(GNAME TemplateArgs):
$(GLINK TemplateArg)
Expand All @@ -238,11 +244,11 @@ $(H3 $(LNAME2 name_mangling, Name Mangling))
$(GNAME TemplateArgX):
$(B T) $(GLINK Type)
$(B V) $(GLINK Type) $(GLINK Value)
$(B S) $(GLINK LName)
$(B S) $(GLINK SymbolName)
$(B S) $(GLINK MangledName)
Copy link
Copy Markdown
Member

@ibuclaw ibuclaw Apr 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this should be QualifiedName / MangledName.

Example: https://github.com/dlang/phobos/blob/31e1b462d2311f9d8cecb33172b28eab587b255d/std/parallelism.d#L43-L77

Instantiates this symbol:

std.parallelism.Task!(run, real delegate(MapResult!(getTerm, Result), ulong, ulong) @system, MapResult!(getTerm, Result), ulong, ulong).Task.impl

Mangled as:

_D3std11parallelism301__T4TaskS213std11parallelism3runTDFS3std9algorithm9iteration91__T9MapResultS31_D8parallel4mainFZ7getTermMFiZeTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ9MapResultmmZeTS3std9algorithm9iteration91__T9MapResultS31_D8parallel4mainFZ7getTermMFiZeTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ9MapResultTmTmZ4Task4implFPvZv

Right at the beginning of the first template you have:

__T4TaskS213std11parallelism3run
           ^

Also, this cunningly forgets Bugzilla 3043 where symbol arguments are prefixed with their length.

The correct grammar should be:

         $(GNAME TemplateArgX):
            $(B T) $(GLINK Type)
            $(B V) $(GLINK Type) $(GLINK Value)
            $(B S) $(GLINK Number) $(GLINK QualifiedName)
            $(B S) $(GLINK Number) $(GLINK MangledName)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, noticed this too last night, see https://issues.dlang.org/show_bug.cgi?id=14591#c7


$(GNAME Value):
$(B n)
$(GLINK Number)
$(B i) $(GLINK Number)
$(B N) $(GLINK Number)
$(B e) $(GLINK HexFloat)
Expand Down Expand Up @@ -391,6 +397,8 @@ $(H3 $(LNAME2 type_mangling, Type Mangling))
$(GLINK TypeUint)
$(GLINK TypeLong)
$(GLINK TypeUlong)
$(GLINK TypeCent)
$(GLINK TypeUcent)
$(GLINK TypeFloat)
$(GLINK TypeDouble)
$(GLINK TypeReal)
Expand All @@ -407,9 +415,8 @@ $(H3 $(LNAME2 type_mangling, Type Mangling))
$(GLINK TypeNull)
$(GLINK TypeTuple)
$(GLINK TypeVector)
$(GLINK Internal)

$(GNAME TypeModifiers)
$(GNAME TypeModifiers):
$(GLINK Const)
$(GLINK Wild)
$(GLINK Wild) $(GLINK Const)
Expand Down Expand Up @@ -447,14 +454,15 @@ $(H3 $(LNAME2 type_mangling, Type Mangling))
$(B Nh) $(GLINK Type)

$(GNAME TypeFunction):
$(GLINK CallConvention) $(GLINK FuncAttrs) $(GLINK Parameters) $(GLINK ParamClose) $(GLINK Type)
$(GLINK CallConvention) $(GLINK FuncAttrs)$(OPT) $(GLINK Parameters) $(GLINK ParamClose) $(GLINK Type)

$(GNAME CallConvention):
$(B F) $(GREEN // D)
$(B U) $(GREEN // C)
$(B W) $(GREEN // Windows)
$(B V) $(GREEN // Pascal)
$(B R) $(GREEN // C++)
$(B Y) $(GREEN // Objective-C)

$(GNAME FuncAttrs):
$(GLINK FuncAttr)
Expand Down Expand Up @@ -563,6 +571,12 @@ $(H3 $(LNAME2 type_mangling, Type Mangling))
$(GNAME TypeUlong):
$(B m)

$(GNAME TypeCent):
$(B zi)

$(GNAME TypeUcent):
$(B zk)

$(GNAME TypeFloat):
$(B f)

Expand Down Expand Up @@ -607,9 +621,6 @@ $(H3 $(LNAME2 type_mangling, Type Mangling))

$(GNAME TypeTuple):
$(B B) $(GLINK Number) $(GLINK Parameters)

$(GNAME Internal):
$(B Z)
)

$(H3 $(LNAME2 function_calling_conventions, Function Calling Conventions))
Expand Down