-
Notifications
You must be signed in to change notification settings - Fork 445
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
Check that verify is only used in parsers. #611
Conversation
@mbudiu-vmw I'm not sure about this fix. Can you have a look? In particular:
|
@@ -48,6 +48,18 @@ void ValidateParsedProgram::postorder(const IR::Method* m) { | |||
} | |||
} | |||
|
|||
/// Check that verify is not used outside of parsers | |||
void ValidateParsedProgram::postorder(const IR::MethodCallExpression* e) { |
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.
This will work with the current language definition, but it would be more robust to use MethodInstance to resolve the method. This check could probably be better placed in TypeInference::postorder(IR::MethodCallExpression* e)
. There is already a call to MethodInstance, one just needs to add a check for this particular built-in method.
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.
Okay, I'll move it there. Thanks!
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.
Whoops, actually I don't understand.
-
The check is already in IR::MethodCallExpression. I extended the visitor to override that case. Are you suggesting moving it elsewhere? Or keeping it there?
-
I do see that using
MethodInstance
could help streamline the analysis and make it more robust, but I don't see any uses in this pass. In particular, thetypeMap
andrefMap
are not available, and most of theresolve
methods seem to require them. Which is the existing call you were referring to (maybe a link to a line number?)
I suggested TypeInference, the typeChecker.cpp file. |
Ahh, I see. Got it. |
Sorry, one more question: it's not obvious to me that |
In that case this is actually an ExternFunction. |
@mbudiu-vmw
However, the
|
ef->method is a pointer to a Method object, which has a name. One cannot create packet_in/out objects, so they only appear where the architecture allows them. |
I haven't read through the recent comments in this issue carefully, but I did want to point out that |
@cc10512 I'm going with Mihai's proposal. Perhaps this does belong earlier, but we are getting some mileage out of the |
Fix for issue #608