-
-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some support for classes without TypeInfos #2765
Conversation
Pinging @JinShil. |
// emit the interfaceInfosZ symbol if necessary | ||
if (cd->vtblInterfaces && cd->vtblInterfaces->dim > 0) { | ||
irAggr->getInterfaceArraySymbol(); // initializer is applied when it's built | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore the comment, this only declared it. It should be declared lazily on-demand anyway.
cc @ibuclaw I never got this working for |
@JinShil - I generate typeinfo layouts if the user doesn't define them in object.d. But ended up doing the same with removing vtable references, albeit with more code as it required some refactoring. D-Programming-GDC/gdc@ef979f6 |
When making runnable/minimal2.d's main() |
Sorry if this turned out to be a PITA. My intention was that if My intention in all of this is for druntime to be less special and treated just like any other library: If a symbol is not declared, but is used, the compiler emits an error just like it would for any other library. If a symbol is not declared, but also not used, it would merrily carry on. It was an idea I proposed almost 4 years ago. When @WalterBright implemented -betterC, I saw the chance to make it work. |
I think I understand what you're trying to achieve, and see value in it. All I'm saying is that you still need a custom My intention is to also enable usage of class instances with a minimal runtime, e.g., I don't see why virtual function calls shouldn't work (excl. interfaces) with manually (or class A
{
int x;
bool foo() const { return false; }
}
class B : A
{
override bool foo() const { return true; }
}
__gshared immutable A a = new A();
__gshared immutable B b = new B();
extern(C) int main()
{
assert(!a.foo());
assert((cast(A) b).foo());
return 0;
} |
@kinke Perhaps it's easiest to create a |
@JohanEngelen: Good idea, I implemented something similar in the WebAssembly-PR, e46cf56. I'll add the code above as further test here after that one is merged. |
For -betterC and/or a minimal object.d without TypeInfo: * Skip TypeInfo emission for classes and interfaces. * Emit null as first vtable member. Makes dmd-testsuite's {compilable,runnable}/minimal2.d work.
For
-betterC
and/or a minimalobject.d
without TypeInfo:Makes dmd-testsuite's
{compilable,runnable}/minimal2.d
work.