-
Notifications
You must be signed in to change notification settings - Fork 0
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
Signature infering as a new command in swam cli #12
Conversation
cli/src/swam/cli/Main.scala
Outdated
functionName match { | ||
case Some(x) => { | ||
if(x == func_name){ | ||
println(s"This is function name : $func_name") |
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 line is redundant, we already know the function name :). Remove it
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.
Removed line in commit 324334e
cli/src/swam/cli/Main.scala
Outdated
case Some(x) => { | ||
if(x == func_name){ | ||
println(s"This is function name : $func_name") | ||
println(s"This is param names : ${tpe.params}") |
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.
To better integrate with the already implemented features:
- Remove the prefix text "This is a param names: ..."
- Map the SWAM types to the ones that we are using in the env for wafl:
I32
toInt32
,I64
toInt64
,F32
toFloat32
andF64
toFloat64
- Print only the data types separated by comma as follows: 'Int32,Int64...'
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.
To better integrate with the already implemented features:
- Remove the prefix text "This is a param names: ..."
- Map the SWAM types to the ones that we are using in the env for wafl:
I32
toInt32
,I64
toInt64
,F32
toFloat32
andF64
toFloat64
- Print only the data types separated by comma as follows: 'Int32,Int64...'
Printing the parameters below format,
sudo mill cli.run infer --wasi code_analysis/test/resources/coverage-test/formal_data/Deconvolution-1D.wasm _fft
Int32,Int32,Int32,Int32
cli/src/swam/cli/Main.scala
Outdated
} | ||
} | ||
case None => { | ||
println(s"The function name does not exists.") |
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.
Print to stderr and then exit SWAM with non-zero code
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.
cli/src/swam/cli/Main.scala
Outdated
names.get(typeIndex) | ||
case _ => | ||
None | ||
}) | ||
functionName match { | ||
case Some(x) => { | ||
if(x == func_name){ | ||
println(s"This is function name : $func_name") | ||
println(s"This is param names : ${tpe.params}") | ||
val mapping = tpe.params.map(y => { |
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.
The lambda body can be replaced by removing the y =>
part
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.
Removed lambda body as part of the commit 2022710
cli/src/swam/cli/Main.scala
Outdated
val check = mapList.exists(j => {j == func_name}) | ||
if(!check){ | ||
System.err.println("Function name does not exists.") | ||
sys.exit(1) |
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.
Take a look at how this is handled in a CommandIOApp. You never should directly exit in this way
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.
Checked with ExitCode.Error but probably in my code, it was not stopping the execution at that point. But checked you refactored code and understood that the exit code needs to return so that CommandIOApp can capture it and tell the status whether the status of execution is Success or Error
Creating a pull request from Tareq one.
Signature inferring prints the value of the parameter of the functions name given by the command.
sudo mill cli.run infer --wasi code_analysis/test/resources/coverage-test/formal_data/Deconvolution-1D.wasm _fft
This is function name: _fft
This is param names: Vector(I32, I32, I32, I32)