It's all about the goto

Video in TIB AV-Portal: It's all about the goto

Formal Metadata

It's all about the goto
Title of Series
CC Attribution 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date

Content Metadata

Subject Area
In this presentation, I am showing you some of the inner workings of PHP. We are going to look at how different language keywords and constructs are handled internally. Basically, everything is converted to goto, but the how and why, is not as simple as it seems! This is a very in depth talk, mostly interesting to people that want to know how PHP works internally. Expect lots of wonkyness, a form of assembly, and trees.
Keywords Development

Related Material

Video is cited by the following resource
Slide rule Computer animation Key (cryptography) Meeting/Interview Term (mathematics) Multiplication sign Cuboid Quicksort Digital watermarking
Slide rule Programming language Computer animation Mapping Interior (topology) Network topology Quicksort
Scripting language Code Source code Moment (mathematics) Set (mathematics) Student's t-test Code Formal language Word Computer animation Network topology Representation (politics) Right angle
Slide rule Group action State of matter Token ring Code Multiplication sign Execution unit Sheaf (mathematics) Set (mathematics) Web browser Open set Function (mathematics) Mereology Formal language Element (mathematics) Different (Kate Ryan album) String (computer science) Operator (mathematics) Cuboid Arrow of time Data structure Error message Social class Task (computing) Scripting language Information Namespace Software developer Cellular automaton Closed set Moment (mathematics) Content (media) Line (geometry) Variable (mathematics) System call Arithmetic mean Sparse matrix Word Computer animation Angle Personal digital assistant Statement (computer science) Video game Right angle Quicksort Spacetime Asynchronous Transfer Mode
Functional programming Group action State of matter Code Direction (geometry) Multiplication sign Sheaf (mathematics) Water vapor Function (mathematics) Formal language Computer configuration Flag Extension (kinesiology) Recursion Belegleser Social class Scripting language Algorithm Binary code Variable (mathematics) Abstract syntax tree Process (computing) Right angle Video game console Spacetime Backup Computer file Token ring Rule of inference Declarative programming 2 (number) Element (mathematics) Number Programmschleife Operator (mathematics) String (computer science) Associative property Standard deviation Inheritance (object-oriented programming) Interface (computing) Line (geometry) Word Computer animation Personal digital assistant Network topology Statement (computer science) Interpreter (computing) Finite-state machine Abstraction
Point (geometry) Functional programming Slide rule Statistics Link (knot theory) State of matter Code Multiplication sign Design by contract Branch (computer science) Parameter (computer programming) Mereology Graph coloring Declarative programming Formal language Element (mathematics) Operator (mathematics) Core dump Flag Data conversion Data structure Mathematical optimization Social class Exception handling Scripting language Dependent and independent variables Quantum state Information Block (periodic table) Reflection (mathematics) Interface (computing) Moment (mathematics) Expression Physical law Constructor (object-oriented programming) Electronic mailing list Thermal expansion Line (geometry) Variable (mathematics) Category of being Type theory Digital photography Computer animation Personal digital assistant Statement (computer science) Right angle Resultant
Scripting language Functional programming Message passing Computer animation Electronic mailing list Video game Bit Quicksort Field (computer science) Formal language
Point (geometry) Functional programming Code Multiplication sign Set (mathematics) Parameter (computer programming) Code Number Revision control Object-oriented programming Operator (mathematics) Single-precision floating-point format Software testing Mathematical optimization Hydraulic jump Information Constructor (object-oriented programming) Debugger Keyboard shortcut Electronic mailing list Bit Line (geometry) Variable (mathematics) Substitute good Category of being Computer animation Personal digital assistant Statement (computer science) Free variables and bound variables Speech synthesis Pole (complex analysis)
Metre Building Code State of matter Control flow Design by contract Mereology Code Information technology consulting Formal language Programmschleife Internet forum Operator (mathematics) Flag Hydraulic jump Pairwise comparison Multiplication Matching (graph theory) Constructor (object-oriented programming) Expression Binary code Physical law Bit Line (geometry) Opcode System call Word Computer animation Personal digital assistant Universe (mathematics) Order (biology) Statement (computer science) Video game Right angle Figurate number Quicksort Resultant
Pairwise comparison Observational study Block (periodic table) Expression Constructor (object-oriented programming) Branch (computer science) Water vapor Bit Element (mathematics) Programmschleife Loop (music) Computer animation Personal digital assistant Statement (computer science) Square number Energy level Circle Right angle Quicksort Hydraulic jump Physical system
Complex (psychology) Group action Code Multiplication sign Sheaf (mathematics) 1 (number) Mereology Junction (traffic) Office suite God Exception handling Moment (mathematics) Keyboard shortcut Electronic mailing list Sound effect Bit Opcode Order (biology) output Right angle Summierbarkeit Quicksort Freeware Reading (process) Resultant Slide rule Trail Similarity (geometry) Branch (computer science) Code Field (computer science) Element (mathematics) Number Programmschleife Object-oriented programming Natural number Operator (mathematics) String (computer science) Energy level Data structure Initial value problem Hydraulic jump Condition number Multiplication Matching (graph theory) Key (cryptography) Information Expression Basis <Mathematik> Line (geometry) Limit (category theory) Cursor (computers) Loop (music) Pointer (computer programming) Computer animation Personal digital assistant Statement (computer science) Speech synthesis Collision
Point (geometry) Functional programming Decision theory Multiplication sign Decimal Mereology Code Computer icon Field (computer science) Theory Computer programming Heegaard splitting Array data structure Goodness of fit Programmschleife Bit rate Term (mathematics) Semiconductor memory Arrow of time Data structure Hydraulic jump Social class Graph (mathematics) Ordinary differential equation Line (geometry) Demoscene Computer animation Personal digital assistant Network topology Statement (computer science) Logische Programmiersprache
Slide rule Matching (graph theory) Validity (statistics) Multiplication sign Keyboard shortcut Motion capture Similarity (geometry) Number Computer animation Lecture/Conference Personal digital assistant String (computer science) Order (biology) Statement (computer science) Right angle Quicksort Exception handling Condition number Social class
Functional programming Code Multiplication sign Mathematical analysis Maxima and minima Staff (military) Line (geometry) Code System call Unicode Computer animation Statement (computer science) Mathematical optimization
Functional programming Pulse (signal processing) Greatest element Presentation of a group Code Multiplication sign Connectivity (graph theory) Source code Execution unit Branch (computer science) Solid geometry Mereology Graph coloring Number Average Green's function Software testing Lie group Scripting language Multiplication Potenz <Mathematik> Graph (mathematics) Moment (mathematics) Gradient Mathematical analysis Line (geometry) Computer animation Personal digital assistant Computer science Statement (computer science) Speech synthesis Configuration space Video game Right angle Resultant
Scripting language Bytecode Code Token ring Block (periodic table) State of matter Multiplication sign Price index Mereology Abstract syntax tree Computer animation Bit rate Single-precision floating-point format Linearization Data structure Extension (kinesiology) Hydraulic jump Local ring
Scripting language Multiplication Standard deviation Run time (program lifecycle phase) Parsing Inheritance (object-oriented programming) Interface (computing) Moment (mathematics) Special unitary group Mass Rule of inference Semantics (computer science) Personal digital assistant Phase transition Right angle Fiber (mathematics) Pole (complex analysis) Social class God
Trail Functional programming Computer animation Keyboard shortcut Statement (computer science) Speech synthesis Quicksort Line (geometry) Whiteboard System call Exception handling
Bytecode Code Design by contract Branch (computer science) Function (mathematics) Metadata Computer animation Different (Kate Ryan album) Personal digital assistant Operator (mathematics) Order (biology) Speech synthesis Data conversion Quicksort Reading (process) Mathematical optimization
Presentation of a group Open source Token ring Cellular automaton Mathematical analysis Line (geometry) Variable (mathematics) Code Food energy Computer icon Different (Kate Ryan album) Personal digital assistant String (computer science) Chain Speech synthesis Right angle Quicksort Codierung <Programmierung> Hydraulic jump Spacetime Social class
Slide rule Link (knot theory) Information Multiplication sign Moment (mathematics) Electronic mailing list Virtual machine Open set Estimator Computer animation QR code Right angle Local ring
Computer animation
the our whole column so we could not Metaxas talk here in terms time I need to switch to English known so welcome everybody um yes the sort talk this afternoon but I'm here in the watermarks some and it's very great also from the UK in born in netherlands uh really did a lot of work to be made in terms of pH key um now works of hormone would it be as a senior engineer and I think you did that makes the box for the PHP uh contributed to OpenStreetMap what is put on my slide so if I had a cellular OK
so you can do better than this so
that you can tell a lot about the inner workings of PHP the so on death and uh he said there are going to expect you lots of warning is performances them the then trees so I think you were much there's these things sort introduction the only thing mention that I like maps the and with the next slides as so this
afternoon we're going to look at a few things a few different stages and with a suitable stages of of convergence status and conclusion is the idea of the stall is to sort of let she know how many computer languages although the examples are mostly PhD many computer language go
from the script source all the way to running things or seeking so we going through different stages that between us and see you know what kind of what will what was necessary to get the bill of a language and I will look at some other interesting techniques on looking at code itself so that's that's the that
have a look at what status we actually have in running so the 4 stages in at
least in the extreme and the 1st thing is passing the script passing the scripts and also means converting codon into total those words we know that in a moment and 2nd stages we go to have to create a logical representation of the go basically that's where the students of other coders and make something out of it right and it needs to understand well the process so that the 2nd set that from that their own you're creating executable codes and I will go over in this tree into codes and then beat the executes a spike in something that is called his invention right so the
1st stage the departing states is that the way how passer works is it looks at what happened the you script basically line by line and if it encounters specific keywords it tends to different states so this simple example if you've ever written a features is pretty like for in PHP it is basically a ation right if you don't write a PHP it just gets sent out straight to the browser and those who believe that anywhere but it's still something you can do so the initial states also the past in the is basically saying echo things the output and then that is the initial state of discussed but as a fuel is as well that the the most important 1 is as for example the moment you see a each starting to that the path to switch to different modes of called st in scripting that that is texts for all we currently passing it the code no longer just think straight to the browser and that even in the in the in the scripting state there are different things sometimes things behave differently depending on which complex so for example if you're are in double quotes the variables get interpreted in a different way so the needs at a specific stage for knowing how to do would be a of all parts in things within double-quotes and similarly if you've now box which is like a longer form all features scripts there's going to be something similar him no anytime so the tokenization step is defined in a big follower is and language scanner adults sense for lecture and it basically defines all the tokens that that could find and for each of those things have an action so if we look at the very simple Peachtree OpenText yeah it's it's it's as only applied as if to the initial state because of course if you always scripting we want to ignore the that the PC open tactical makes no sense to the tries to pass the final action and is then followed by a space attack any like all the so what this basically says that all the peace open is an the angle brackets that question pt followed by stated that and life and which means the need new line at the time of thing happens and when it does that it needs to do something that any line because been needs to know which lined up to go it is currently at a lower the Contra correct errors just kind of and it out that sections to different state by using this begin thing and then returns to Tokyo so at for everything that it passes everything different elements that it dense units this token with no meaning is given to the so the scanner the tokenization only looks at the different keywords that are in and have a DPT confident open such as they connect you have a look at what the parts Ecclesiastes was so this scanner actually so if you have this example scripts and most of my examples will that will be related to a little whiskey at that arose called from that I but you more than happy to have a look at a shinto whiskey or particular or any until the spirits and so you might some will be coming from there so this is a really simple use the script but it does do that doesn't do anything that defines a class in the namespace animal a particularly interesting class of that and so when the tokenized goes over that it it it changes this into all tokens so that's slightly edited the output of those tokenizer the removal of white space and analyze it would silly and that's the the main con structed picks out of the oddity opened that amount we might remember from 2 slides ago and the value of that is the pitch coping tag then you get the name space which is the namespace keywords that to some white space we
get T strain and then the road runner mile but if you see it doesn't actually associate this string gram I O directly the namespace is just tokens that the ceasefire that sees and the namespace token it see the string and the string has the value called remind so it doesn't do anything more than that this similarly you get like the closing statement uh semi call on the advice they think that the task you want to get on a string which is called was but a value string is risky and not necessarily every token has a value like till content doesn't have a martini spaces and have somebody string does have a lot because of course in in the end sort of know what the value of the strings are to limiting useless at simulate get private for private purity public and to object operator to the arrow operator and whole words of all the things that is about will remember about maybe 100 tokens of cell and they're those leaves names that you see when you write something code and syntax error will tell you all unexpected token and then the gives the names the token in the development of cell you it if there's so both past extinctions but as a set of sparse in stages into anything logically information fights in the script that is owned by scanner to the scanner converts tokens or collection of tokens into have something called case the In into a structure that represents the logical information that is encoded in these
tokens and this is kind of complicated how hard it looks like an yet this is probably the most complicated part of besides ex executive the basically this is not a state change its state machines that stand that starts that nothing as the nothing is in this case called the top statement in the top statement is basically the 1st thing in the PHP scripts and there's no state and are at some what they put in the beach is going can put a class definition or function definition or traits declaration or you can just put in standard code or statements so those are the 4 options that you have here and the way how does the scanner rules written that all the top statement is either a statement or a function declaration statement or class declaration statement or tree declaration statement and there's always that's as letters out people's ran out of space and the only other now just a quick look at what the class declaration so the class declaration remember impeach Predacon they can have modifiers so you can that's a class or final class and then you can have a class they or you can just have the class and right from the start which the modifiers optional it and that is basically what assessed so that 2 options here that the pipeline tells you that isn't war exceeded its rule set audio rule sets and the first one is what we have class qualifiers and entity class token but then we need to check what are those class modifies for us right so that so this Canada's then sees this all word definition of that are highlighted in being here and being done sense or the tarsal the fires that are either going to be class modifier water going to class more modifies followed by class qualified and this is a way how to additionally scanners would all like move uh recursion and things it doesn't defined solely can have 2 possible to find a tree class 1 of local that the silly thing do the special for state and you never know how many them to so an impossible mollified and check that the the the abstract 40 and then it with each of the rules that finds between the curly braces and the then association actually so for if it finds the Africa to final it basically says that all of of those the output of this action we setting it's 2 years and ACC explicit explicit after class that is a flag in as well there's enough for class they have the same thing for its entries final mark and as a final if this this solstice rule sets no then falls back to direction along say you have an abstract class of whiskey and and sees this T class token it and it doesn't do something with this class the 1st thing it does it basically assigns the current line mercury internal variable so that it can create a fork at his affectionate console between which lines a specific class all sorts of and not the most interesting thing as this song you then get the string for the name of the class and then it says extends from implements this backup local looking and it's a very long and basically what this as long we can have things that this class extends from like inheritance which is the extent from which and a like Dan phytostanols implemented interfaces which is the 2nd then there's the back of documents is if a class has a specific you form of contourlets it also do something with and stored so that you can look at the comments later and rule sets it then and create sections so will the says here in red 5 typesetters and the AST create declaration and all those and AST calls that being run it as as he called them uh later they build up this tree of the logical interpretation of his scripts and that's the next step that we have so the scanner rules they give meaning to the tokens and form this is constructed AST through rules and he has that for every different elements that for binary operations for assignment operations for for 4 groups of if else loops and so on and so on and the scanner rules is something that we write in a file called stand language scandal y and this is a follow-up converted into an enormous see file and that has basically has stayed the state number for every all the different aspects that make up this big process and this class decoration statement and so being case 1 6 7 1 6 8 and there's I think between 1 2 thousand of it's more the fall you want to look at the LC you will you don't have to look at because all of the generated for the national to the book so His
scannables converted into this abstract syntax tree and that is really difficult were to say very quickly so I'm going to call a lazy from now on I've learned that from a previous time I gave this talk the right so this is a is seated
in a city describes the structure all fewer of the past scripts and each node is a language contract and language culture can you classification function of mission statement and so on and so I'll show in a moment senescence structures are represented through history is also if you have a nested if statement it will look nested in this AST it also doesn't keep all the original code and text I could strips on all whitespace that strips out all the comments that not with a class or function because they know you can see that true reflection Alicia Concert and and then it is the call so that you can visualize this 84 you have eaten by 1 of the older Peachtree core contributors and I Urich ideas that from this a connected run some optimizations figure out which states can never be that can never happen like if you haven't if true they clearly notable of the branches in the if else statement can never happen because it's always going to be true and things like that these itself doesn't do a lot of as you conversations about because there isn't a city in there it allows its for all extensions like and all cash to look at is a optimize that the forward generates by protons if the reason might be to itself doesn't do this waltz is because if you know that if the feces script every a script it will pass its created a fear of and executed dual optimization from the state vector quite expensive to do so it makes no sense the every request of course if you get a passion there like example then it can spend more time on this optimization the 1st time it square that means doing this the 1st and take more time but all subsequent requests because it has discussion it doesn't have to do this anymore so does all the optimisation will then they're making even faster so this result BP doesn't it itself but it's something that of text and this is just 1 of the things the object of and
so yeah if you do the out if you do if you call in the past called always get a get like this very very long line like it's it's I is very well of course when I pick node right that's this school so very very very very big complicated thing to it so we don't do that locally it has a similar method that actually allows you to form that for you and that looks a lot easier on so the start of a script is this is the statement that as the inter-sensor statements and then the law has a constant and it's not sure the consumers in this case acting and and all the rest came from but then it is which is then the class and all classes have different attributes like at the flags could be is that static class so no abstract class or from the cluster example has a name it could implement all or they could inherit from other classes it doesn't do that so that's where it is that no they can also implement interfaces that's only so that's also known and then you have to this statement said that belong to this class and statements that belong to class like can be constant information they can property definitions or of course they can be met slides and to this case there's only 2 elements to statements in a class which is well 1st of all we dead define a private property so as a property declaration with a flight private making a private property that has a name as in name known as little value and then we get a method that definition and you probably can guess for the 1st on does statistical structure so there's a public constructor and it has a list of arguments or parameters in this case as long as you can see that the title does no like no time not no type is defined for its present in a main and a the visual value know then that for each methods after the parameter declaration he got all the statements that belong to and so on and so on if you have this AUC you can basically rewrite back original scripts except that you probably lose all your new lines co-speech he doesn't necessarily care photos when having to execute code but for some reason the like the stored at but I'm not sure notoriety expansion doesn't show that information but it should be there and because it is necessary to to create a new paradigm of at some point and she had said about part of it and of course this goes a little further but omission this and so you have to to link them back to how this response from in India in the AC itself yeah to make a sugar colors are right is that will different parts that made of by little constructor and link them back to 2 different elements for the 1st method declaration right and you know what I really want to look at here is that this name assignments assignments that's to so the 1st thing the only statement in this method is very assigned a value of named to the property so that's the main property of the class so that is an assignment operation which is Deep purple link which is standard operating you have in there and Simon operators to cite has a variable left-hand side and expression right inside the variable is more than the simple variable it is a more complicated variables courses a property and seduce a the problem sets all the AC fire a property consists of 2 things is an expression the right hand side which is the name of your property in most cases sorry the name of the left-hand side as you variable name in this case this and then the property is not so this little blocks as we assign a value of name to this name and then we right so DAC no
DAC is still something that these we cannot execute because and it's going be converted to
something that isn't actually future can and that is something that impeached recalled by coat so by
holds we also called on mob goes come to different ways to make it easier FIL according to each
function each method and each main body of the script is represented by something we call operate and operate is basically a list of all coats it's a linear this lexical quotes so from a safety we need to convert all the methods also functions to this array of all coats and this and that she will return will execute each of those all patent turn the message is a function called ankles of function start executing the operate belong to that function matter that and at the end it returns back to the previous function and executing is sort of expect that to happen right and it is very similar to some instructions if you've ever seen in the language is clearly not the same about the concept although some instructions that comparing the 2 p feel quote is very very similar and and there's a tool that you can use of his life that does this through different tools actually funnel cash there's in beach PDBj and as a tool that I've written 16 or 2 years ago called field that also allows you to look at this so because I notice so that it won't be using that right so to convert this little bit of a city that I have and start if this was my
constructor wasn't very very simple constructed with reconverting Int'l coats and in this case them and that being said goes right number 0 2 6 the 1st 1 is called X mold and obese and for no operator that doesn't basically do anything anymore but it it is basically a placeholder for the function underscores score construct but that you don't have to say shit any code with its but it's a lens of being and and what is exactly I don't there's also things like why is this like this I don't know because of speech we so there's lots of interesting and really complicated things in that so every all codes has 2 operands and a return value the so we see that over or up to 2 operands and return value the the 1st codes besides nobody's called are you see the stands for receive yeah basically tells you all be going to accept an argument that's being pushed on the stack into the function in this case were receiving an arguments and the name of this argument with the value of this argument going to put in a variable called exclamation mark 0 not the speed doesn't have exclamation mark syntaxes for viral variables that you know is internal speak for it compiled variable so this is a placeholder number for any connected up slightly higher it tells you that is the name variable so this is a quick substitution as an optimization so the doesn't have to look up where to find the variable every time it sees the name of a fair so fossil things that came in which he 5 3 they had x statements EC statement doesn't do anything but it's great for the debuggers because this is the point where they can move in for our poles and the believer that take statements for and if you do not have a debugger loaded that'll collecting all be there we just generated and and then you get the assignment operator will say right I said every but all go test at most a return value and 2 operands but that's not true here through most of the time but it's PHP so in the the 1st examples here which is a curious 1 because if you look at the operands there's only 1 operand list but actually to the there's 2 x 1 is silent because as a PHP has lots of short make things go fosters expect so do you sign over 80 the current assigns it property of a specific variable and assigns a value to that for that it needs at operands right it needs the name also do variable the name of the property and then the values so that is actually need 3 3 bits of information to do so but as a set that the Mexican only have 2 but that this is a shortcut so you only have 1 and so you have this long long variable and this is implied him but it's only set of values and that this because that is the normal case it at the Texas a secondary or go to this called all data on which is in some cases like this long use for giving the 3rd upfront In this case the name of the variable so those 2 lines basically say or assigning the value of all the explain charge there which is the name of a named variable to do name property on the this object of this then it has more like statement because examples afterwards and that does return no every single function and that's and Peachtree always has a return statement idea if you don't said it yourself there will be returned or if you said yourself at the reader knows is no longer there although earlier versions of Peachtree 5 it actually wasn't removed this is clear this is kind of complicated I know it's a very small example below that mark the more they will the more difficult need to start small so now let's
have a look at jumps and the I've seen
people do this all this rockets crazy this also about 700 meters orthographic gical continent some of let's have a look at the if
statements so the ith although it is more than local it is a very simple language contract and this is where to go to sort of common as I said that all opcodes are executed 1 by 1 in order in a linear line so if you want to do loops and that is the sort of have a way to skip things and go back and things if you have a forum for example this statement is very simple you actually execute to coach the statements inside the match or you don't that's basically all this so in this case will be comparing value a 242 and if that's true we act to like universe not to see this in a seed looks like flawlessly at T is 2 years which is the language construct 1 that has a multiple possibilities right it's the comparison in this case is a binary operation you compare value but variable to value as 2 bits of it it has a left side and the right side the left side is a variable name the side of the by the operator and on the right inside side you have a constant value which is 42 and the flags for binary operation is is equal they can also be greater than or less than or multi call and extra equal and stuff like that for the crucial and I think it's the right word for the 3 uh the and then if it matches then there is a little statements others can execute and the statements in this case is my echoes there exists to life the universe and everything now because this is something that is being conditionally execute needs to be a way to get parts of the plant if you look at your code that is something you see back so in this case we have 6 of codes next statement the starts and again is there so that the rest consult but a 1st important thing is the is the call operators and operands which compares the variable which 8 the expression so the variable in this case is that the major start explanation might in again and the value or the expression is the constant value 42 so that's a very simple and other people does its comparative values and risk returns the result of this expression into added till the along temporary variable so this is more a variable that persist for more than 1 or 2 states the law rather from more than 1 region of Kazakhstan and then the next codes says Jim that and there's that sense for 0 they think he this means that a return of the previous operation and if it is false or 0 then it will jump to the opcodes that is specified in the 2nd operand so this that's basically if there is of April 42 is false we go to Germany told Gordon 5 and that is what this building here indicates so in other words if the if case doesn't match the jump over the case so that they don't do the uh echo to lighten as everything right this makes sense right but it's also lie because MPEG 7 1 B is equal and the germs are contracted into 1 operation but for the logical that this is basically how it works yet also shortcuts to make things go faster but this work so why not continue doing it today the corpus construction but still codes are still there they had not been converted into special assault goes because that's and 1st of all break code like this that looks at world jumps articles because it needs to be able to determine that for later for like like figure out where can have a code that you don't have any work on the executed to and and being my status of that so it is not something can just be removed from here and but a destructive and most every case either but most of and then at the end we have to return 1 which I don't know where it came from right so if you can of course all 7 L
statement right and in this case here is no statement this and if you have 10 for each of those cases it has this if elem constructs so Alameda value is an expression that compares H 2 in this case height and then the 2nd if element elements does not have a conditional because as you should also always if executed if it had set fire and then odeco square squares not to look at your posts again there's more jumps in and out of the 1st comparison antigens that you've seen before by that just a normal a statement of course at the end of the 1st echo that the occur circles you make sure it doesn't act also execute echoes squares suddenly Regenbogen sort of study the last step all the statements in the 1st block of this statement there's now a jump instruction GNP that Jim straighten Exogean peeled unconditional jump yeah the I will just basically are go to its by there's nothing else about their a bit more clever because the the sometimes conditional on which gently happening in the and then go to this and and to echo squares that's ever look at loops or ranks anybody want to guess what it this there is no reason why for just levels specifically referring to disfiguring the between water from systems this very rigorous yeah they're encodes 7 right so yeah the for
the for loop is a 1st looked at looking at and if you look
at a for loop it has notable parts right it has your initial that assignment it has a condition that has a and through operation this of operations to run and it has all the statements in there and those are the 4 things that come back if you look at the AUC for the uh constructing indicates the search the initialization step which is a list of expressions remember you can use a common in there and yes a commission which can also be multiple collisions in there and then you have to do do which is the thing that gets executed the and now if you look at how people opcodes can arrange for this he sees gets it out of order right because if you look at a 1st moment alignment only the 1st bit of number 2 that a bit of money for them a bit of number to now this kind of weird but if you think about it you can rewrite for oops would go to statements may should never do this in in any code you write 2 candidates so if you do that it becomes a lot more clear to how the close actually related this so if we we rewrite our for loop to the initial condition go to the condition if a commission matches then we go to execute a statement right and the end of the list of statements in this debate you operator for the end of loop increments and if you rearrange like this then it is a one-to-one match which of course that you get out of it again and then it becomes here so the for loop as this and yet don't ever write code like the presence of anything else interesting and here's look that sort of although a similar thing right you have an issue or they can be by the for loop as a wall because of you want to so you have initial statements yet the wall keywords and yet the Commission and then you have the statements in there and then you can do in and all through structure which in this case we have gone goes of the input of all case so here we have well we do the assignments you the we do to jump immediately because uh agential quote 6 to do the the to do the Commission and if the condition matches it engines back to all code for 2 D to echo itself is not so if the germ moles that instruction doesn't match like the previous 1 out walls falls in this case then it will just fall down without having to jump so by rearranging those of God's nature limits clever recalls last junction aren't necessary at the speed things up do all very similar thing just slightly reorganized will go spend too much time on the slide for each gets more complicated for each loop is an for each of these fields over elements in an array or elements and
expression reading and in order to do that it need to keep track internally all where it is in the air right so it has an extra pointer or courses that leads to hearing and any time we do 42 speech we annotate discoursal objects and it does that through an opcodes called at the recent are the annotators goes also sets it back to sort of string as a result of this is your own this correctly is the all that exaggerated if the race and T. then handle multi even do this and just jump straight over over again this is a shortcut so the at the recent are it's d x 9 5 0 and the jump 211 basis as a delay and you would just jump straight up and down the border in anything that is great the this inside every loop it needs to fetch information right and is in fact you can you value so that's the 1st thing that happens here facts are factions the value into the value intuitive it such as the value into the very low value the variable that's trickle since all again if and then advances the cursor and if it knows if if that call themselves of also jump out of the loop they have the assignments the assignments the quote 5 is there for assigning key uh because it if p don't do the key to Arab value that all code simply missing because it is not necessary no well again that I say about how many operons and all code hats was still wasn't look at the long opcode code number 3 how many officers that have have free open and yet sometimes speech he does that's it has is extended value that the sum that that often only and codes it jump instruction that's the only thing got wall with an exception here because it's the right because they so what is important 1 working on to point out here is that because for a for each group it seems to yeah allocate discuss object and it's a free at the and which is its unity at the free line level this is 1 of the reasons why bent each P x goal to go to keywords which by the way you should use it restraints on he cannot exigent into loops because of this reason because if you jump straight into line it's a line 7 and then it wasn't the curse wasn't wasn't I said that allocated right so if you then jump to the thing where Jesus effect something from the cost the above and there and that you can't answer questions so this is 1 of the Y 1 of your section go use in doesn't allow to just inside of concept but only jump out of of together these values of and they get a really complex loops way multiple nested levels
that the terms of the something like this sometimes if you have any of using I don't want to just
once the unions and the phone OK so to really complex loops let let me visualize those with the tool because that makes it easier to to see
all sort of skip only and the codes here because you can have a look at and is so little precise online and you can set the scene at 2 in the tree structure air quality gets constructed from your codes that are being there and they're very similar to what to expect right like in like 2 and 3 it does too so if realization sets the value during the day and you have 2 for each In our so called Monday's point In line 3 you have like matching this line so there is a decision to be made right their race and there is not empty the arrays and the least jump straight out of that's the chance to of goods solvent in online 8 which is I believe this on here so Jim straight out of the loop and that the Saudi the arrow points out here right if you if the arrays on the we jump straight out of it and then release the function 0 theories and dancing all we have to 1st statement refers of they and you can go left it's true or a right it's false if it is true if this falls in this case you get a knowledge statement in which case it can be true or false ODE arrays that the grasp its once more into our any time you have a conditional it you get an extra split in your graph and then of course they can back because 42 of course until we or a so spec to factional of value decimal cities class which is actually part field the tool can actually create grounds for you that's heart rate muscle logical icon grows things muscles of and memory lazy program I right so so the doctrine
then we get exceptions which also the difficult
and the exceptions are called in order so if you if 2 exception and that it's on detection and
if the captures the match it will look for the next catch it other than should look pronounced texts and if that's all there it will bubble of the exception so the actually if you look at this you sorta realize that if you exception classes that called away more also not always he she put that sort of have to put much stock because the makes the quicker in a similar way if you do this with them but switch statement which I don't think that a slide was a similar thing right if almost all every single time the validation matching against which it is she put us at start goes that as the 1st condition at the to check for you and in the 2nd and the 3rd on and so on and so on this is something that's going to be addressed MPEG 7 where if all the values in your case statements are you'd all numbers for all strings that to create a hashmap for that short move shortcuts and the whole thing so it doesn't have to check every single statement again making it faster and so many little tricks OK so what can we
do yeah that's that's also this
false calls really complicated if 5 time about I will try to explain they that it's the yeah so the death coating bring something to write codes that can never be executed right things that you do also return statements so as very simple
things like a cool 40 return an unicode
to clearly that is never going to be executed because we have just returned from a function so some codes and In both as well as an xt but that makes heavy use all the code analysis spots and fielding actually figures out which British lines of code which operands or adopt codes cannot be executed at Max's little staff often them so you can see that all code for the ICO to is marked with as little star because it can never be executed this is useful to have goes optimizes K users to get rid of them to make you got smaller so I 5 by 10 to
the 5 minutes and hope finish presentations and so why is this useful to have a look at analysis old where D multiple sorry long a common thing to do if I if you a test cases is figuring out what you called over till the functions are right so if we have this function if then else as we have seen and related if statements in that we have the 1st if a constant and secondly if people struck I can make sure that my test case covers all the lies in this function but just issue to call I can't balls and where a is true and B is false or where it is false and B is true and I've covered every single line and felt that she had tested also parts in code because you haven't tested a boat AI boat India true or rare in false a several years ago the developed of speech units at all we need to fix this and you write some code for excited that took me about a year and a half to do because complicated article busy with life happens and the but I did that to get into xt but 2 for lawless 2 problems with this it is very difficult to visualize result explain in a moment also to meticulously so also think 1 of us so that if you run is it emits code-coverage if you set it up yourself you do those 2 lines pulse components of it it looks bad better if I show you the output of that I can see all 6 lines are green right because I've managed to hit all the lines in the coat that's a lot the so exceeded to 4 as a new new flat for code covers cult CC branch check which is a pneumatic source average also extra analysis of doing this bottom branch coverage this is the the slow to do because it needs to figure out which branches that are and then which parts you have through making use of all these branches and also every time you conditional statements we duplicated number of plants that yet so it's an exponential growth right and that is Milton grades add computer science thing to have really so what happens here adjusted to the if statement she patent 5 branches along the 40 statements a branch and each side for each of these things right and then you have 4 possible possibility but that they should it's making your laughter rights ICT the gentle code 5 which is inside you work 8 which is outside of its and so on so on so let's see that actually figured out for you here is that which branches of being 8 which is all on the and which parts are being at which is you can see here is only the 2 out of 4 and is a tricky to yes of Mars it is this outperform is something that comes out of the book but a little contribute a script that is in the config dot of excellent the this species-specific specific yeah so to visualize this well we can do this in the following year right for that if you cut across
previous on all of the can do for every part being at the drawl solid line and for every bar that has not been hit to draw also life and so let's use a different color for each of the possible paths and if you have both for and that is quite easy to do well consider you have 8 if statements in there how many paths I don't have you have 256 rights that makes it really really like graph also can you read a distinguished and 56 different colors the charts 1056 you might manage the but if you get a thousand twenty-four you kind of screwed right you just can't do that and it's just too much of a so somebody needs to write something clever to visualize that and I don't have that kind of stuff so the balls and Sebastian score to the developer of difficult covert and he is now spent a year and a half trying to figure out how to do so does have common went so we go the quick recap to go over could deal with think that we talk about there
is some time for more questions so we use that a different stages that we have we had 1st had a code script self written in ASCII what
not quite UTF-8 really we converted to the tokens the tokens are the blocks that make
up every single part of scripts the tokens that converted by passing state into this is to use abstract syntax tree everything that converts about the reason that execute if you look at most of the jump structures here and all tends to be all the looping structures they end up being converted into the linear rate of of quotes the jumps in the fountain code as for fun and profit to figure out which things can be removed from our code on to stored in our cash I mean if you just don't executed an intro to away then why bother removing the 1st this was going to try to anyway and there's no profit in this just from currently we've had for the few 278 Peachtree tokenizer which shows you all the tokens we have looked at indicators AC extension to this like tasting is if another at feel the that called shows the across the bytecode and there really have looked at local coverage alright that pretty much connect to talk about R&D the fossil goes lost the yeah melody
questions I I was the right of it was like the most of the mass of the sun of the scanner be the the this scanner will noted about fiber could start with is I said I was going to repeat a question and then and then items that had to be canceled the question is does the scanner already knows something about 0 semantics and yes the scanner Peachtree dust knows something about it 1st of all it knows that matters can be public private and protected by the something needs to know that is there a similar needs to know that and how the inheritance works goes a little mold allow you to actually inherits form uh 38 on the multiple narratives BP so it has rules will then for that is also knows for example that if a class has already been loaded being passed before a new parse a something that implements this this interface standard it already knows that because the poles the facility that should then it classes implement the interfaces it also knows that at that moment and I'll show you an air so the In many cases it knows something about previous scripts or closing phase is only being loaded but not always and if it doesn't noted that rules all these things at runtime relationship Work of God what it and this is so if you have a lot of the it is a way you know all the that would be yeah you must look again at notes yet go of it yes the
the and and about the so that it could never did it lost lost its
of and what alright so that's a bit longer question for me to repeat so in short how the speech you know that there's an X cynical yeah you yeah the the echo-free 1st 2nd things would be a trail because this happens in the same function that's easy enough right you can easily see that would be catch goes and it just follows them to the line to see benefits that if it is a function call that chose the exception than among you do an exception of function call the function of boards and the execution guess falls back to where it was called and then these we can find a four-step statement and I actually believe that PHP internally already knows all which yeah open lines there's catch data search shortcut that little but sometimes on the most isn't just goes down until Ford's finds a 1st static if it doesn't find its then it it knows already written excellent so the something I in quite explain so this can actually runs twice sort of like 2 stages in the 1st stage it doesn't know about these things and the 2nd stage it figures out all those catch statements are and form that build up in this all the linking off to catch statements as well as the statements so that had been like is more the full apostle the scanner but it's something additional us as a sort of 2nd stage kind of thing yeah and
and what what the the the the and because it also knows between which lines they're trying catch statements it that is true that does not show up in the hope coats but it
shows up in the meta information associated with each operate which really cannot as a less of a doesn't always which would be nice if it could be that but as of right and know you can think of it as that of the
same kind of my reading of the of of of the and of the it it from the new optimization that you'll catch thus basic killed by it's government that code of can it also sometimes we reorganise things if you like it will convert post-increment a pre increment that kind of stuff so users operation took over because speed and beat isn't much of a difference that it will reorganize it'll also ask if it's can contract jump instructions because in some cases the output all the scope output off today the 2 byte code conversion it does to jump instructions right after each other sometimes and and and then go optimise it out if it can and that sort of the things does there's always of orders but I can't quite remember that in we adjust it doesn't do very complex things although I say that every 1st speech the they're becoming more and more complex which makes it harder to explain yeah there is this is why you would say that you know what they are really all about the
1 of the things that we know of no you this miracle so the question is why are tokens and all code-named abbreviates what is there reason there is it is yeah yeah I'd icons if I would do this now if that's what we would happen so it is historical reasons then chemicals J. P can be jumps up Friday it there's no space requirement associated with any of them because they basically constant values and is also it would be quite easy to do is change yield to write out the name of the old guy there's nothing nothing special about them and the same 2 names of tokens is tokens are a bit different because there the names already defined in in the lexicon so this sort of 1 article is I can't really do anything out of that without defining all myself but for the of course you need to do it anyway so yeah there's no real is also the reason why but in some cases I a t a prefix and exams in this course I don't know why that was a linear presentation over all prefixes and underscore also went the and energy yeah and the yeah and yet at the strings are URL-encoded only because of the I need to make sure there's no new lines and it's a massive amount so that's just not going out on the beach you felt as most euro encoder every single strand but silly rights yeah toward people uh ardent is built on top of the PAC each PAC PACT yes are there's a tool called which sense of his PhD in the consumption of uh is written I think by Rasmus that CXC that's their own that's have to figure out whether they can move the peace the 5 codes speech the 7 because I found can also read these sky 5 coat and again can see where BAT would have chains covertness from 55 to be the cell so that just do some static analysis of these things and and I believe so what things are built on top of that I also believe that it's I wish it should be possible to use EAC to enforce solid primacy would become syntax things in that
syntactic stripped out but all the things like every class must have a constructed and that kind of things you can enforced by looking at the AC and stuff like that for names of variables of course you can see their their tools they want found from at C is is a good 1 to have a look at which is open source I think that's anything else you want you fast question I can't think of something
the suicide right I have 1 more slide
in it which is my last slide that has a QR code that goes to link to the slides they're
not at their local estimates among men and if you go to the yearly cannot only find a slight you can also find a list of resources so the tools I spoke about has some links to more information about the internal as a great article there and written by indicates that about these 7 virtual machine it really really good article if you've any questions on FIL moment by are hope to answer your questions in a reasonable time for timeframe to complement promises of the candidates everything thanks very much open something and enjoy of conference fj