Skip to content
Jeff Cho edited this page Jan 21, 2018 · 1 revision

Yaser Alkayale

Tuesday Dec 12, 2017

What was done?

  • Mutating and non-mutating functions. Basically if a function is mutating, it has the ability to modify instance variables of a class.
  • typealias keyword. It has similar behaviour to typedef in C++;
  • associatedtype allows us to have more flexibility in the types of instance variables that we can have when implementing a protocol.
  • hopefully comprehensive testing of the most common array functions
  • Very simple import statement
  • Using the super keyword to access superclass variables.
  • using "inout" keyword to pass variables by reference and allowing them to be modified.
  • Creating a generic function with inout keyword to modify different types.
  • Using "where" clauses to allow us to have specialized extensions and specialized for loops.

Where I am stuck?

  • No where :)

What was learned?

  • Everything mentioned in the done section was well researched.

What is planned for next week?

  • Enjoy the break!

Tuesday Dec 5, 2017

What was done?

Implemented testcases the following features:
  • didSet and willSet which are two functions that get executed around the time a variable is being set
  • the required keyword which required the user to use a given initializer so that a protocol is guaranteed to be implemented properly.
  • final keyword which doesn't allow a class to be inherited by anything else.
  • Failable initializers are probably the coolest feature so far. It allows us to return a nil pointer if an object could not be created within the constructor. Most other languages I know force you to construct an object once a constructor is called but Swift doesn't.
  • nil coalescing operator is syntactic sugar to allow us to set a variable to something and set it to something else if the firsr thing is nil.
  • static keyword is very similar to most other languages.
  • private and public vars
  • multicase switch statements
  • numeric operations were added to test what kind of optimization the compiler does before moving to the SIL stage.

Where I am stuck?

  • What is? @IBOutlet var imageView: UIImageView!

What was learned?

  • Learnt about all the different cases up

What is planned for next week?

Tuesday Nov 28, 2017

What was done?

  • Added ten test cases
  • Tested extensions of structures
  • Special switch statement where variables are bound within a case
  • Tested fileprivate keyword where an object is only instantiable within the file it is written in
  • toString for objects using the CustomStringConvertible
  • Testing localized structs within other structs. This helps us create extra functionality that cannot be used outside

Where I am stuck?

  • How do I compile multiple files and have them access elements from each other using commandline.
  • what is this var dreamDidChange: ((Dream) -> Void)?

What was learned?

  • toString in Swift is actually just a property names "description", and the compiler searches for it when printing out an object (struct or class) CustomStringConvertible is needed to be extended
  • An extension is basically a way for us to add extra functionality into a struct or a class

What is planned for next week?

-Finish the last ten test cases of the semester! -

===================================================================

Tuesday Nov 21, 2017

What was done?

  • Removed the file from the app which was added by accident to the wala-next branch.
  • Watched video explaining the project and the ideas behind it.
  • Cleaned up test cases from the previous week by adding more meaningful header comments and splitting some test cases out so that they are more explicit in what they are testing

Where I am stuck?

  • Picking the exact next class to work on continues to be a challenge, but I believe that I am on the right track.

What was learned?

  • The code for the App is available online for anyone to download. I was super scared for including a file from the app in the project, but now it is removed.
  • Local reasoning is the idea that the data structures we create should be localized to our specific needs.
  • Composition is the idea to not use inheritance and try and use specific instances of a given class in our local code. This helps us not worry about dependencies for neither super nor subclasses.
  • We can create protocols and get any class to extend them using the extension semantics. This is very important as we can modify classes from other libraries to ensure that they implement given functionality so that we can use them in our program and avoid major bugs.
  • Xcode is the best tool to navigate the files because it adds a lot of structure to the files and folders that are not found in a simple system viewer.

What is planned for next week?

  • Add 10 more testcases that would allow us to catch the bugs that are in the code.

===================================================================

Tuesday Nov 14, 2017

What was done?

  • Provided test cases for switch statements that take simple integers
  • Provided test cases for switch statements that take enum values
  • Switch statements with a tuple as the switch value
  • Switch statements with derived type by switching on localized enum within a different struct
  • Created functions to overload operators for a given class/struct
  • Variable initialization within a struct using a switch statement. Very cool syntactic sugar provided by swift!

Where I am stuck?

  • What should I prioritize next? Should I just go to the next file, or is there one in particular I should look at?
  • Can I get some feedback on the test cases? Are they good? or should I do something differently.

What was learned?

  • Function input parameters have a lot of things not found in different languages. A variable can have two names one for the function to use and one to be used when calling the function. That is very cool, but can be confusing.
  • Never knew variables could be initialized like this using an "anonymous" switch statement. I find it fascinating!
  • Derived types for switches with enums makes it so much easier and less cluttered.

What is planned for next week?

  • Continue working on as many files as I can.

===================================================================

Tuesday Nov 17, 2017

What was done?

  • Went over the iPhone application provided by Kareem
  • Fixed bugs found in the application
  • Fixed XCode certificate and signing problems
  • Loaded the App onto the iphone and simulator
  • Created generic testCases for classes and string intropolation found in the testFiles folder

Where I am stuck?

  • Not sure what type of testCases to work on from here.

What was learned?

  • I learnt a lot more about Swift syntax and how it deals with classes.
  • Learnt the problems that arise with XCode and how to fix some of them
  • Learned how to navigate an XCode project

What is planned for next week?

  • Disect the code provided by Karim and add test cases that will cover pretty much everything in it.

===================================================================

Tuesday Oct 31, 2017

What was done?

Where I am stuck?

  • Going over the lexical structure, there are a lot of variations as to how Swift can accept things. For instance, Strings can be read with single quotes or triple quotes for longer strings. This in theory should not affect the SIL code that we receive because the parser should deal with them the same way. For this I am not sure, if we should test different input types, or that would not matter for that analysis.
  • Still trying to wrap my head around the code to make changes to the C++ codebase.
  • Added the testFiles directory
  • Made sure to name the test-cases properly so that we can group them and go through them easily with regex expressions.

What was learned?

  • I learned about the lexical structure of the Swift programming language.
  • Learned the problems in testing compilers as there are different stages of the compilation process. This leads us to needing specialized cases so that we can test the proper part of the analyzer.

What is planned for next week?

  • Contact Lydia and Chen to check with them about what we should test next after the literals.
  • Complete 20 more testFiles for next week.

===================================================================

Tuesday Oct 24, 2017

What was done?

  • Figured out how to recompile iteratively using Ninja rather than using the compile script.
  • Recompiled the code from scratch multiple times.
  • Spent over 5 hours going over the code and was unable to make any meaningful changes.

Where I am stuck?

  • Still was unable to add any code to the C++ codebase.
  • Trying to print out the different outputs to see the SIL structure and other outputs

What was learned?

  • Learnt about the function that are being connected with the C++ code through the Java code.
  • Have a much better understanding of the higher level design of the Swift compiler code.

What is planned for next week?

  • Start writing a minimum of 10 test-cases for the next week.
  • Contact Chen to go over the code with him and ask him the questions I'm stuck on.
  • Still unsure why we are getting exceptions when running swiftc. Where is it coming from? Should it be suppressed?

===================================================================

Tuesday Oct 17, 2017

What was done?

  • Added one untested function to support Integer literals.
  • Struggled understanding the codebase in both the Java and C++ side of things.
  • Looked up a lot about the swift codebase itself and worked on understanding Lidya and Chen's code.

Where I am stuck?

  • Recompiling Swift was taking too long. Understanding the code is still a challenge.

What was learned?

  • Adding code to the codebase is not the easiest. There are a lot of unknown parts of the system.
  • Rigorous testing of the specific parts added will be needed.

What is planned for next week?

  • Figure out how to recompile only the needed parts rather than recompiling everything from scratch.

===================================================================

Tuesday Oct 10, 2017

What was done?

  • I added onto Chen's code and created dummy methods for a couple of the AST Instructions
  • Studied more on AST format and Swift Syntax
  • Started collaborating with Ronny properly and now have set weekly time for collaboration.
  • Recompiled Swift (For some reason recompiling took over 2 hours, even though it was not a clean build. I believe the reason could do with updating my MacOS or a substantial commit to the wala-next branch (unlikely))

Where I am stuck?

-I am not sure how we would deal with single-threaded deadlock situations. -A little unclear on how to print the AST in a readable format -Trying to print things from C++ is not printing anything during compileTime, or rinTime. Where does the printing go?????

What was learned?

-Swift may run into deadlock situations even in single-threaded applications. This is due to cases where two variables are pointing to the same space in memory and at least one of them is trying to modify that memory. Swift guarantees that these situations give either compile-time or runtime errors.

What is planned for next week?

  • Meet with Ronny on Thursday (virtually) for 2 hours to do "pair programming" -Get unstuck on all of my points above. -Finish a minimum of 3 functions to parse 3 different instructions
===================================================================

Sept 24, 2017

What was done?

Added support for IntegerLiterals. Found this resource that is written by Apple which includes explanations for the Swift instructions that we are trying to translate into WALA nodes. https://github.com/apple/swift/blob/master/docs/SIL.rst Read more about Swift syntax and semantics.

Where I am stuck?

Trying to understand the codebase in detail has definitely been a challenge. The lack of documentation has made it more difficult to understand different architectural decisions of the project. This will get a lot better as I get more used to the constructs and the code-base.

What was learned?

I learned how LLVM has different stages for compiling SIL which broke down source code into different abstractions. Each of these abstractions had their own pros and cons and are each useful in their own respective ways. While the implementation this week relies on the SIL representation without any optimization, it might be better to get one of the other representations of the code.

I also learned more about jobjects and how java is connecting to the C++ code-base which is making it possible for them to communication.

Another thing is that Swift does not have many primitive operations in its SIL representation that we are working on. Most of the instructions are very low level memoryAddress operations, and function calls.

What is planned for next week?

More collaboration with Jeff so that we can possibly change the implementation to get more meaningful data structures from LLVM. Another thing is that I will keep in mind to make as good documentation as possible as we go. If I understand any part well, I will make sure to document it so that others who pick up the project will have the ability to get started on it more efficiently.

Clone this wiki locally