Skip to content
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

[2.079] Support minimal runtime #2641

Merged
merged 10 commits into from
Apr 10, 2018
Merged

Conversation

kinke
Copy link
Member

@kinke kinke commented Apr 1, 2018

Thereby deferring requirements wrt. object.d declarations (Object, Throwable, TypeInfo, TypeInfo_Class, TypeInfo_Struct...) and paving the way for a minimal druntime.

This also greatly reduces the -vv output for tiny code samples, e.g., reduced test cases.

@dnadlinger
Copy link
Member

I've been wanting to do this for quite some time, thanks – but wouldn't it be natural to ditch the runtime module altogether now?

@dnadlinger
Copy link
Member

(I.e. create the functions directly in the requesting module.)

@kinke
Copy link
Member Author

kinke commented Apr 1, 2018

import core.stdc.stdio;
// pragma(LDC_no_moduleinfo);

void foo()
{
    printf("Hello LDC2 %d\n", (void*).sizeof);
}

-c -vv output of LDC 1.8: 376 lines
now: 123 lines
with pragma(LDC_no_moduleinfo): 64 lines

@kinke
Copy link
Member Author

kinke commented Apr 1, 2018

Wrt. runtime module, I wasn't sure whether it was just exploited as stringmap or whether caching the functions there brings some performance. Right now, the lazy 'declarers' may declare more than one function (same type, multiple names), so switching this exact scheme to forward-declaring directly into the desired module may yield a few superfluous declarations.

@dnadlinger
Copy link
Member

dnadlinger commented Apr 1, 2018

Do we want to pass through the loc to all of these so we can generate error messages specifying the code that requires the feature in a minimal runtime setting? (Obviously a separate improvement.)

@kinke
Copy link
Member Author

kinke commented Apr 1, 2018

Yep, the loc would be nice to have of course. Given the elision of Module-/TypeInfos if there's no declaration, the chances of a missing TypeInfo should be pretty much restricted to a runtime function call requiring one of the few TypeInfo base types. As such, the existing loc param of getRuntimeFunction() should do fine, it'll just have to be forwarded to the LazyType error msg.


merge-2.079 green on Win64 now with this, on Linux too except for the 32-bit std.file unittests. :)

@kinke
Copy link
Member Author

kinke commented Apr 1, 2018

Well actually it'd probably be useful to do the runtime function lookup as early as possible. In various places, we first construct the args for the runtime function call (incl. TypeInfos) and afterwards do getRuntimeFunction() immediately before the call; the loc will be missed in these cases.

@kinke
Copy link
Member Author

kinke commented Apr 2, 2018

Expecting Win32 to succeed too now and so AppVeyor to become green.

@kinke kinke changed the title [2.079] Forward-declare runtime functions lazily [2.079] Support minimal runtime Apr 2, 2018
kinke added 10 commits April 4, 2018 19:59
Thereby deferring requirements wrt. object.d declarations (Object,
Throwable, TypeInfo, TypeInfo_Class, TypeInfo_Struct...) and paving the
way for a minimal druntime.

This also greatly reduces the `-vv` output for tiny code samples, e.g.,
reduced test cases.
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
Otherwise linking only works if the directory is specified for the
linker, which may not be the case when disabling the config file via
`-conf=`.
To retain the LoC information in case TypeInfo declarations are missing.
@kinke kinke merged commit e4f424b into ldc-developers:merge-2.079 Apr 10, 2018
@kinke kinke deleted the minimal branch April 10, 2018 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants