From 2c1f94d93f3d69be19f87e3c20ca2fa1782bc949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 26 May 2021 00:00:00 +0000 Subject: [PATCH 1/5] Mangling: Use `` for namespace production instead of a mix of `` and ``. --- text/2603-rust-symbol-name-mangling-v0.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/text/2603-rust-symbol-name-mangling-v0.md b/text/2603-rust-symbol-name-mangling-v0.md index 6da9cfba09b..3a19e298492 100644 --- a/text/2603-rust-symbol-name-mangling-v0.md +++ b/text/2603-rust-symbol-name-mangling-v0.md @@ -625,12 +625,12 @@ Mangled names conform to the following grammar: // The specifies the encoding version. = "_R" [] [] - = "C" // crate root - | "M" // (inherent impl) - | "X" // (trait impl) - | "Y" // (trait definition) - | "N" // ...::ident (nested path) - | "I" {} "E" // ... (generic args) + = "C" // crate root + | "M" // (inherent impl) + | "X" // (trait impl) + | "Y" // (trait definition) + | "N" // ...::ident (nested path) + | "I" {} "E" // ... (generic args) | // Path to an impl (without the Self type or the trait). @@ -655,10 +655,10 @@ Mangled names conform to the following grammar: // A-Z are used for special namespaces (e.g. closures), which the demangler // can show in a special way (e.g. `NC...` as `...::{closure}`), or just // default to showing the uppercase character. - = "C" // closure - | "S" // shim - | // other special namespaces - | // internal namespaces + = "C" // closure + | "S" // shim + | // other special namespaces + | // internal namespaces = | @@ -748,7 +748,7 @@ Mangled names conform to the following grammar: ### Namespace Tags Namespaces are identified by an implementation defined single character tag -(the `` production). Only closures (`C`) and shims (`S`) have a +(the `` production). Only closures (`C`) and shims (`S`) have a specific character assigned to them so that demanglers can reliable adjust their output accordingly. Other namespace tags have to be omitted or shown verbatim during demangling. From 3b701d1f0077798ca17ce6610759b036738c8a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 26 May 2021 00:00:00 +0000 Subject: [PATCH 2/5] Mangling: Use `=` to define `` rule --- text/2603-rust-symbol-name-mangling-v0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/2603-rust-symbol-name-mangling-v0.md b/text/2603-rust-symbol-name-mangling-v0.md index 3a19e298492..708f585cd28 100644 --- a/text/2603-rust-symbol-name-mangling-v0.md +++ b/text/2603-rust-symbol-name-mangling-v0.md @@ -715,7 +715,7 @@ Mangled names conform to the following grammar: // If the "U" is present then the function is `unsafe`. // The return type is always present, but demanglers can // choose to omit the ` -> ()` by special-casing "u". - := ["U"] ["K" ] {} "E" + = ["U"] ["K" ] {} "E" = "C" | From 230ad2a145a9ed13dd77815b7a489b16698a7662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 26 May 2021 00:00:00 +0000 Subject: [PATCH 3/5] Mangling: Make `` optional in `` and `` --- text/2603-rust-symbol-name-mangling-v0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/text/2603-rust-symbol-name-mangling-v0.md b/text/2603-rust-symbol-name-mangling-v0.md index 708f585cd28..519e1047076 100644 --- a/text/2603-rust-symbol-name-mangling-v0.md +++ b/text/2603-rust-symbol-name-mangling-v0.md @@ -675,6 +675,7 @@ Mangled names conform to the following grammar: // innermost lifetimes, e.g. in `for<'a, 'b> fn(for<'c> fn(...))`, // any s in ... (but not inside more binders) will observe // the indices 1, 2, and 3 refer to 'c, 'b, and 'a, respectively. +// The number of bound lifetimes is value of + 1. = "G" = @@ -715,12 +716,12 @@ Mangled names conform to the following grammar: // If the "U" is present then the function is `unsafe`. // The return type is always present, but demanglers can // choose to omit the ` -> ()` by special-casing "u". - = ["U"] ["K" ] {} "E" + = [] ["U"] ["K" ] {} "E" = "C" | - = {} "E" + = [] {} "E" = {} = "p" = @@ -1150,3 +1151,4 @@ pub static QUUX: u32 = { - Add a recommended resolution for open question around Punycode identifiers. - Add a recommended resolution for open question around encoding function parameter types. - Allow identifiers to start with a digit. +- Make `` optional in `` and `` productions. From dd0d8f485ab2c7d56b136a222ba14ec082265e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 26 May 2021 00:00:00 +0000 Subject: [PATCH 4/5] Mangling: Add encoding of bool values, char values, and signed integers --- text/2603-rust-symbol-name-mangling-v0.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/text/2603-rust-symbol-name-mangling-v0.md b/text/2603-rust-symbol-name-mangling-v0.md index 519e1047076..7b5c59afbdc 100644 --- a/text/2603-rust-symbol-name-mangling-v0.md +++ b/text/2603-rust-symbol-name-mangling-v0.md @@ -728,10 +728,12 @@ Mangled names conform to the following grammar: | "p" // placeholder (e.g. for polymorphic constants), shown as _: T | -// The encoding of a constant depends on its type, currently only -// unsigned integers (mainly usize, for arrays) are supported, and they -// use their value, in base 16 (0-9a-f), not their memory representation. - = {} "_" +// The encoding of a constant depends on its type. Integers use their value, +// in base 16 (0-9a-f), not their memory representation. Negative integer +// values are preceded with "n". The bool value false is encoded as `0_`, true +// value as `1_`. The char constants are encoded using their Unicode scalar +// value. + = ["n"] {} "_" // uses 0-9-a-z-A-Z as digits, i.e. 'a' is decimal 10 and // 'Z' is decimal 61. @@ -1152,3 +1154,4 @@ pub static QUUX: u32 = { - Add a recommended resolution for open question around encoding function parameter types. - Allow identifiers to start with a digit. - Make `` optional in `` and `` productions. +- Extend `` to include `bool` values, `char` values, and negative integer values. From e57408eba49f74fa82fa831fe6e72ad757558247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 26 May 2021 00:00:00 +0000 Subject: [PATCH 5/5] Mangling: Remove type from constant placeholders --- text/2603-rust-symbol-name-mangling-v0.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text/2603-rust-symbol-name-mangling-v0.md b/text/2603-rust-symbol-name-mangling-v0.md index 7b5c59afbdc..abed85138e1 100644 --- a/text/2603-rust-symbol-name-mangling-v0.md +++ b/text/2603-rust-symbol-name-mangling-v0.md @@ -725,7 +725,7 @@ Mangled names conform to the following grammar: = {} = "p" = - | "p" // placeholder (e.g. for polymorphic constants), shown as _: T + | "p" // placeholder, shown as _ | // The encoding of a constant depends on its type. Integers use their value, @@ -1155,3 +1155,4 @@ pub static QUUX: u32 = { - Allow identifiers to start with a digit. - Make `` optional in `` and `` productions. - Extend `` to include `bool` values, `char` values, and negative integer values. +- Remove type from constant placeholders.