com presentations: Added uncommitted extra exercise slides: deepdive-dpc19.xml slides/internals/exercise-strict-switch.xml
slides/internals/switch-confusion.xml slides/internals/switch-followup.xml slides/internals/switch.xml slides/xdebug/derick-new-512x512.jpg
| From: | Derick Rethans | Date: | Wed, 02 Oct 2019 09:05:05 +0000 |
| Subject: | com presentations: Added uncommitted extra exercise slides: deepdive-dpc19.xml slides/internals/exercise-strict-switch.xml slides/internals/switch-confusion.xml slides/internals/switch-followup.xml slides/internals/switch.xml slides/xdebug/derick-new-512x512.jpg |
||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-2363@lists.php.net to get a copy of this message | ||
Commit: c2230559db8c8ddad000d91f7e0f43877c685db7
Author: Derick Rethans <github@derickrethans.nl> Wed, 2 Oct 2019 10:05:05 +0100
Parents: de760ece87e97cb9daf8bfecb665bd25289a5426
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=c2230559db8c8ddad000d91f7e0f43877c685db7
Log:
Added uncommitted extra exercise slides
Changed paths:
M deepdive-dpc19.xml
A slides/internals/exercise-strict-switch.xml
A slides/internals/switch-confusion.xml
A slides/internals/switch-followup.xml
A slides/internals/switch.xml
A slides/xdebug/derick-new-512x512.jpg
Diff:
diff --git a/deepdive-dpc19.xml b/deepdive-dpc19.xml
index 212f6ae1..c8c4ed7f 100644
--- a/deepdive-dpc19.xml
+++ b/deepdive-dpc19.xml
@@ -76,6 +76,12 @@ Opcodes
<slide>slides/internals/loops.xml</slide>
<slide>slides/internals/jumps-complex-dot.xml</slide>
+<!-- EXERCISE: STRICT SWITCH -->
+<slide>slides/internals/switch-confusion.xml</slide>
+<slide>slides/internals/switch.xml</slide>
+<slide>slides/internals/exercise-strict-switch.xml</slide>
+<slide>slides/internals/switch-followup.xml</slide>
+
<!--
Try/Catch nonsense
- FASTCALL/FASTRET
diff --git a/slides/internals/exercise-strict-switch.xml
b/slides/internals/exercise-strict-switch.xml
new file mode 100644
index 00000000..aaf82386
--- /dev/null
+++ b/slides/internals/exercise-strict-switch.xml
@@ -0,0 +1,10 @@
+<slide>
+<title>Exercise: Make %switch% Strict</title>
+
+<list>
+ <bullet>%IS_EQUAL% vs. %IS_IDENTICAL%</bullet>
+ <bullet>The %zend_compile_switch% function in %Zend/zend_compile.c% compiles the AST
node</bullet>
+ <bullet>Change the behaviour, compile, and run the tests</bullet>
+</list>
+
+</slide>
diff --git a/slides/internals/switch-confusion.xml b/slides/internals/switch-confusion.xml
new file mode 100644
index 00000000..3f453dcb
--- /dev/null
+++ b/slides/internals/switch-confusion.xml
@@ -0,0 +1,17 @@
+<slide>
+<title>Switch?</title>
+
+<example result="1"><![CDATA[<?php
+$t = 'false';
+
+switch ($t) {
+ case true:
+ echo 'true';
+ break;
+
+ case false:
+ echo 'false';
+ break;
+}
+?>]]></example>
+</slide>
diff --git a/slides/internals/switch-followup.xml b/slides/internals/switch-followup.xml
new file mode 100644
index 00000000..fc3e44ed
--- /dev/null
+++ b/slides/internals/switch-followup.xml
@@ -0,0 +1,41 @@
+<slide>
+<title>Switch follow-up</title>
+
+<example inline="1">&lt;?php
+function foo()
+{
+ return '42';
+}
+
+switch (foo()) {
+ case true:
+ die('true');
+
+ case 42:
+ die('42');
+
+ case '42':
+ die("'42'");
+}</example>
+
+<div effect="fade-in">
+<example inline="2">
+line #* E I O op return operands
+ 2 0 E > NOP
+ 7 1 INIT_FCALL 'foo'
+ 2 DO_UCALL *$0*
+ 3 *CASE* ~1 $0, &lt;true>
+ 4 > JMPNZ ~1, ->10
+ 11 5 > *CASE* ~1 $0, 42
+ 6 > JMPNZ ~1, ->11
+ 14 7 > *CASE* ~1 $0, '42'
+ 8 > JMPNZ ~1, ->12
+ 9 > > JMP ->13
+ 9 10 > > EXIT 'true'
+ 12 11 > > EXIT '42'
+ 15 12 > > EXIT '%2742%27'
+ 13 > FREE $0
+ 17 14 > RETURN 1
+</example>
+</div>
+</slide>
diff --git a/slides/internals/switch.xml b/slides/internals/switch.xml
new file mode 100644
index 00000000..9fe7c1c0
--- /dev/null
+++ b/slides/internals/switch..xml
@@ -0,0 +1,39 @@
+<slide>
+<title>Switch</title>
+
+<example inline="1">&lt;?php
+$variable = '42';
+
+switch ($variable) {
+ case true:
+ die('true');
+
+ case 42:
+ die('42');
+
+ case '42':
+ die("'42'");
+}
+</example>
+
+<example inline="1">
+compiled vars: !0 = $variable
+line #* E I O op return operands
+
+ 2 0 E > EXT_STMT
+ 1 ASSIGN !0, '42'
+ 4 2 EXT_STMT
+ 3 > JMPNZ !0, ->8
+ 8 4 > IS_EQUAL ~1 !0, 42
+ 5 > JMPNZ ~1, ->10
+ 11 6 > IS_EQUAL ~1 !0, '42'
+ 7 > JMPZNZ ~1, ->14, ->12
+ 6 8 > EXT_STMT
+ 9 > EXIT 'true'
+ 9 10 > EXT_STMT
+ 11 > EXIT '42'
+ 12 12 > EXT_STMT
+ 13 > EXIT '%%%2742%27'
+ 14 14 > > RETURN 1
+</example>
+</slide>
diff --git a/slides/xdebug/derick-new-512x512.jpg b/slides/xdebug/derick-new-512x512.jpg
new file mode 100644
index 00000000..478ec3a9
Binary files /dev/null and b/slides/xdebug/derick-new-512x512.jpg differ