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

Mbudiu #21

Merged
merged 2 commits into from
Apr 22, 2016
Merged

Mbudiu #21

merged 2 commits into from
Apr 22, 2016

Conversation

mbudiu-bfn
Copy link
Contributor

No description provided.

@@ -3,6 +3,10 @@

namespace P4 {

std::map<int, const IR::Type_Bits*> TypeMap::signedTypes;
std::map<int, const IR::Type_Bits*> TypeMap::unsignedTypes;
const IR::Type_InfInt* TypeMap::canonInfInt = new IR::Type_InfInt();
Copy link
Contributor

Choose a reason for hiding this comment

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

You should never construct a Type_InfInt -- always call IR::Type::InfInt::get to get the singleton Type::InfInt object. (ctor should be private, but there's no easy way to do that through the ir generator)

Code depends on there only being one instance of this (and other) type objects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just sent an email about this. This is no longer a singleton.

Mihai

From: Chris Dodd notifications@github.com
Reply-To: p4lang/p4c reply@reply.github.com
Date: Friday, April 22, 2016 at 11:11 AM
To: p4lang/p4c p4c@noreply.github.com
Cc: Mihai Budiu mbudiu@barefootnetworks.com, Author author@noreply.github.com
Subject: Re: [p4lang/p4c] Mbudiu (#21)

In frontends/common/typeMap.cpp:

@@ -3,6 +3,10 @@

namespace P4 {

+std::map<int, const IR::Type_Bits*> TypeMap::signedTypes;
+std::map<int, const IR::Type_Bits*> TypeMap::unsignedTypes;
+const IR::Type_InfInt* TypeMap::canonInfInt = new IR::Type_InfInt();
You should never construct a Type_InfInt -- always call IR::Type::InfInt::get to get the singleton Type::InfInt object. (ctor should be private, but there's no easy way to do that through the ir generator)

Code depends on there only being one instance of this (and other) type objects.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

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