Akiira / Comp-524-program

A genetic algorithm to create test suites that cover every branch of a program
2 stars 0 forks source link

Passing testCase in CFG #1

Closed ambarket closed 9 years ago

ambarket commented 9 years ago

If you want to pass the testCase through all the blocks in the CFG that's fine. It certainly will read better. I was trying to save some resources since its an additional ptr copied every time you make a function call and if we really support loops in the future it might blow up. It was more a concern about the coverage array though which is no longer relavant since we set it directly in the test case. Its up to you. I doubt it will be a problem for the small programs we're running.

Akiira commented 9 years ago

We can pass it by reference then we will not need to dereference a pointer.

ambarket commented 9 years ago

Yea. It's still copying that address onto the program stack though On Mar 2, 2015 11:53 AM, "Akiira" notifications@github.com wrote:

We can pass it by reference then we will not need to dereference a pointer.

— Reply to this email directly or view it on GitHub https://github.com/Akiira/Comp-524-program/issues/1#issuecomment-76749723 .

Akiira commented 9 years ago

If we are going to really try to optimize it we could just remove the function calls by placing it all in block1. So everywhere you see a function call in block just replace that with the code in that function. Keep doing that until all the blocks are in just one block.

ambarket commented 9 years ago

Yeah I thought about that... Would make it so hard to read though. Maybe we'll do that once the CFG code is completely fleshed out and tested when were about to actually run the GA.

Akiira commented 9 years ago

So I cant believe I forgot about this but we should just be able to use C++'s inline keyword to get all the block functions to be compiled into one function. Theres a good chance the optimizer will do this itself but I think we can increase the chance by adding the inline keyword (I say "chance", because the optimizer will ignore the inline keyword if it thinks it knows better).