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

allow enabling GC instead of bump-ptr allocations via command line switch -GC #9210

Closed
wants to merge 7 commits into from

Conversation

rainers
Copy link
Member

@rainers rainers commented Jan 6, 2019

Alternative to #9048 reusing most of @kinke changes to rmem.d.

Should best be compiled with a recent druntime to reduce memory overhead for GC allocations: dlang/druntime#2384

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @rainers!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#9210"

@rainers
Copy link
Member Author

rainers commented Jan 6, 2019

Oops, the makefiles build via a library so they are hit by #9132.

@@ -0,0 +1,3 @@
// REQUIRED_ARGS: -GC -Jrunnable

mixin(import("testptrref.d"));
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this test as testptrref.d was the only test that failed (for yet unknown reasons) when building the test suite on win64 including phobos unittests. xtest46.d is just one of the larger test files to cover at least some GC activity.

src/dmd/mars.d Outdated
{
// does not support pragma(crt_constructor) yet
import gcc.attribute;
@attribute("section", ".ctors") auto pini = &initGC;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is ELF specific.

src/dmd/mars.d Outdated
{
// does not allow arguments on pragma(crt_constructor)
import ldc.attributes : section;
@section(".ctors") auto pini = &initGC;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, ELF specific.

@kinke
Copy link
Contributor

kinke commented Jan 6, 2019

I'm not convinced this (edit: CRT ctor method) is much of an improvement. - I also don't like the -GC switch; I tried to avoid any mentioning of GC, as people probably associate it with their code.

@nordlow
Copy link
Contributor

nordlow commented Jan 6, 2019

Are there any benchmarks illustrating reductions in maximum memory usage when compiling typical projects?

@rainers
Copy link
Member Author

rainers commented Jan 6, 2019

Are there any benchmarks illustrating reductions in maximum memory usage when compiling typical projects?

Latest results with LDC are here: ldc-developers/ldc#2916 (comment)

…ith hacky access to gc.config.config.disable
@rainers
Copy link
Member Author

rainers commented Jan 6, 2019

I'm not convinced this (CRT ctor method) is much of an improvement.

You are probably right, support for pragma(crt_constructor) varies too much across compilers and platforms.

I've now tried a hacky access to gc.config.config.disable with the command line option --DRT-gcopt=disable:0 ;-)

@rainers
Copy link
Member Author

rainers commented Jan 8, 2019

I've now tried a hacky access to gc.config.config.disable

With the introduction of the ProtoGC the GC configuration is initialized too late, so that also doesn't work.

@rainers rainers closed this Jan 8, 2019
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.

5 participants