[Bug 246] New: [Implementation] Reference symbol initializers should be done at runtime
via D.gnu
d.gnu at puremagic.com
Sat Oct 29 02:51:26 PDT 2016
http://bugzilla.gdcproject.org/show_bug.cgi?id=246
Bug ID: 246
Summary: [Implementation] Reference symbol initializers should
be done at runtime
Product: GDC
Version: development
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: Normal
Component: gdc
Assignee: ibuclaw at gdcproject.org
Reporter: ibuclaw at gdcproject.org
Example:
---
class A
{
char a;
}
class B : A
{
int b;
this(char a, int b) pure
{
this.a = a;
this.b = b;
}
}
const A var = new B('E', 88);
---
This is achieved by creating a hidden static of the record type B, then
initializing var with it's address.
Maybe (as a distinct implementation detail) we should instead initialize these
variables at runtime, rather than putting them in static data.
We already generate module shared and static constructors, that are managed by
druntime, so there's no additional scaffolding needed in place to support this.
This can be applied to dynamic creation of classes, structs, and dynamic arrays
(where we use "C", "S", and "A" prefixed static decls respectively to
initialize static user data).
There's no bugs for this as a result of what we do, the change is purely
aesthetic.
Potential implementation blockers are the last components of the dt_t routines
(notably ClassReference::toDt2), which could be removed completely instead of
converted over to the shared visitor for generating runtime and static data
expressions.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the D.gnu
mailing list