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

[Type] [refactor] Make TypeFactory Global #1963

Merged

Conversation

Hanke98
Copy link
Contributor

@Hanke98 Hanke98 commented Oct 16, 2020

Related issue = #1905

In this pr, we replace Program::get_type_factory() with TypeFactory::get_instance(). We currently reserve the former function which may be removed in the future.
[Click here for the format server]


@codecov
Copy link

codecov bot commented Oct 16, 2020

Codecov Report

Merging #1963 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1963   +/-   ##
=======================================
  Coverage   43.64%   43.64%           
=======================================
  Files          45       45           
  Lines        6225     6225           
  Branches     1106     1106           
=======================================
  Hits         2717     2717           
  Misses       3334     3334           
  Partials      174      174           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c2e5e9...626ddcf. Read the comment docs.

@Hanke98 Hanke98 changed the title [Type][refactor] Make TypeFactory Global [Type] [refactor] Make TypeFactory Global Oct 16, 2020
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Cool! LGTM in general. Just one concern to address and it can be merged. Thanks!

Comment on lines 5 to 8
TypeFactory &TypeFactory::get_instance() {
static TypeFactory type_factory;
return type_factory;
}
Copy link
Member

Choose a reason for hiding this comment

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

We probably want to stick to the old implementation in Program::get_type_factory since if type_factory get destroyed before other global variables that use it, the program won't finish smoothly.

Copy link
Member

Choose a reason for hiding this comment

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

Btw, since #1962 is in, feel free to remove Program::get_type_factory() in a different PR :-) Thanks!

Copy link
Contributor Author

@Hanke98 Hanke98 Oct 16, 2020

Choose a reason for hiding this comment

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

We probably want to stick to the old implementation in Program::get_type_factory since if type_factory get destroyed before other global variables that use it, the program won't finish smoothly.

Yes, you are right. let me change it to the old implementation. Thanks for pointing it out!

@Hanke98 Hanke98 requested a review from yuanming-hu October 16, 2020 15:36
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@Hanke98 Hanke98 merged commit 049c89f into taichi-dev:master Oct 16, 2020
@yuanming-hu yuanming-hu mentioned this pull request Oct 17, 2020
@Hanke98 Hanke98 deleted the refactor-make-TypeFactory-singleton branch November 27, 2020 06:30
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.

3 participants