[pypy-commit] extradoc extradoc: one more slide
antocuni
noreply at buildbot.pypy.org
Sat Jun 30 21:39:15 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: extradoc
Changeset: r4235:c51f91f2b591
Date: 2012-06-30 21:36 +0200
http://bitbucket.org/pypy/extradoc/changeset/c51f91f2b591/
Log: one more slide
diff --git a/talk/ep2012/jit/talk/talk.rst b/talk/ep2012/jit/talk/talk.rst
--- a/talk/ep2012/jit/talk/talk.rst
+++ b/talk/ep2012/jit/talk/talk.rst
@@ -121,3 +121,97 @@
.. animage:: diagrams/tracing-phases-p*.pdf
:align: center
:scale: 100%
+
+
+Tracing Example (1)
+--------------------
+
+.. we use java instead of RPython to avoid confusion with applevel Python
+
+
+|scriptsize|
+|example<| |small| java |end_small| |>|
+
+.. sourcecode:: java
+
+ interface Operation {
+ int DoSomething(int x);
+ }
+ class IncrOrDecr implements Operation {
+ public int DoSomething(int x) {
+ if (x < 0) return x-1;
+ else return x+1;
+ }
+ }
+ class tracing {
+ public static void main(String argv[]) {
+ int N = 100;
+ int i = 0;
+ Operation op = new IncrOrDecr();
+ while (i < N) {
+ i = op.DoSomething(i);
+ }
+ System.out.println(i);
+ }
+ }
+
+|end_example|
+|end_scriptsize|
+
+
+Tracing Example (2)
+--------------------
+
+|scriptsize|
+|column1|
+|example<| |small| Java bytecode |end_small| |>|
+
+.. sourcecode:: java
+
+ class IncrOrDecr {
+ ...
+ public DoSomething(I)I
+ ILOAD 1
+ IFGE LABEL_0
+ ILOAD 1
+ ICONST_1
+ ISUB
+ IRETURN
+ LABEL_0
+ ILOAD 1
+ ICONST_1
+ IADD
+ IRETURN
+ }
+
+|end_example|
+
+|pause|
+
+|column2|
+|example<| |small| Java bytecode |end_small| |>|
+
+.. sourcecode:: java
+
+ class tracing {
+ ...
+ public static main(
+ [Ljava/lang/String;)V
+ ...
+ LABEL_0
+ ILOAD 2
+ ILOAD 1
+ IF_ICMPGE LABEL_1
+ ALOAD 3
+ ILOAD 2
+ INVOKEINTERFACE
+ Operation.DoSomething (I)I
+ ISTORE 2
+ GOTO LABEL_0
+ LABEL_1
+ ...
+ }
+
+|end_example|
+|end_columns|
+|end_scriptsize|
More information about the pypy-commit
mailing list