Upload
elfinhe
View
190
Download
2
Tags:
Embed Size (px)
Citation preview
2/49
Themes
Hackerdom Programming Languages
3/49
Fascinating Problems
“The world is full of fascinating problems waiting to be solved.”
Eric Raymond, How to become a hacker
Eric Raymond. How To Become A Hacker. http://catb.org/~esr/faqs/hacker-howto.htmlEric Raymond. The Cathedral and the Bazaar. http://catb.org/esr/writings/homesteading/
4/49
Hacker
Not Cracker, But Creator Eager to Communicate
5/49
FLOSS community
Not only Free Source But an Efficiency Way
to Communicate, Study and Work Tashi
“Talk is cheap. Show me the code.” Linus
FLOSS: Free-Libre and Open Source Software
6/49
IF NOT OPEN?
Information Inequality Esoterica
Design Patterns No Feedback
Herbert Schiller. Information Inequality: The Deepening Social Crisis in America, Routledge 1995, ISBN 0415907659
7/49
KISS: Keep It Simple and Stupid
“Perfection (in design) is achieved not when there is nothing more to add, but rather when there is nothing more to take away.”
Linux Fid Process Memory
Design Patterns
8/49
Tools
Everything
9/49
Tools
Lingoes
10/49
Tools
Wakoopa
11/49
Tools
SuperMemo
12/49
Thank you!
13/49
Themes
Hackerdom Programming Languages
14/49
Why we use Programming Languages?
For customers To meet their requirements. ( For example , OA
systems) For machine ( Von Neumann Architecture )
Instruction flow Data
Strange, isn’t it ?
15/49
Other Problems
Common Elements in High-Level Languages?
Dynamic ? Syntax, Semantics and Pragmatics ? Semantics and Logic?
16/49
Assembler Language
17/49
Assembler Language
Macro of Machine Code While Programming
Registers Data Seg Code Seg Stack Seg
Von Neumann Architecture Instruction fetch Instruction execute
18/49
We have Data Seg already.Why we need Stack Seg ?
Modules But Stack is manual
19/49
Why we need Modules ?
Recursion Reusability Scope Encapsulation
20/49
Stacks and Modules’ Disadvantages
Time Space: Stack Overflow
21/49
The C Programming Language
22/49
What’s NEW in C
Expressions (Formal Languages, Automaton ) For Instruction
Arithmetic Expressions ( 3+2-5*3 ) Control Flow Expressions ( for, if…else…, ) Function Expressions
For Data Type System
Atom Structure
We have a Compiler now
23/49
Advantages from Expressions
Human For Instruction
Arithmetic Expressions ( 3+2-5*3 ) Control Flow Expressions ( for, if…else…, ) Function Expressions
For Data Type System
Atom Structure
24/49
Advantages from Compiler
Expressions Modules : Stack is Automatic Code Optimization ( Inline, Tail Recursion )
25/49
Compile-time vs. Run-time in C
Compile-time Type Information Function Information
Run-time null
26/49
The C++ Programming Language
27/49
What’s NEW in C++?
Paradigms Class Member Functions Inheritance Hierarchies Virtual Function & Virtual Inherit Template
28/49
Paradigms in C++
Procedural ADT OO
29/49
Class Member Functions
Special Code ___ClsA_Func2(..., ClsA *this)
30/49
Inheritance Hierarchies
Almost Compile-time Virtual: Run-time
31/49
C++ want to be as Efficiency as C
It’s all right for Procedural and ADT But not for OO with Virtual No Run-time Hierarchies Meta-data for
Polymorphism
32/49
Virtual Function: Virtual Function Table
33/49
Inheritance
Single Inheritance Multiple Inheritance Single Virtual Inheritance Multiple Virtual Inheritance
34/49
Virtual Inheritance: Virtual Base Table
35/49
Compile-time vs. Run-time in C++
Compile-time Inheritance Hierarchies Information Function Information
Run-time ( Dynamic ) Virtual Function Table Virtual Base Table
36/49
Cross-Platform in C++?
Source-Level: Yes Cross-Platform is Manual for different OS API
Execution-Level : No
37/49
What is not Efficiency C++?
Run-time Virtual Function Virtual Inheritance
Virtual Base Class without Virtual Function and Data will be optimized.
Java can Multiple Implement Interfaces.
Compile-time Inheritance Hierarchies
38/49
The Java Programming Language
Mark Stoodley. Issues in static and dynamic native Java code compilation. http://www.ibm.com/developerworks/java/library/j-rtj2/index.html
39/49
What’s NEW in Java?
JVM Dynamic Compilation
40/49
虚拟机的好处有什么?
跨平台:在 OS与字节码间隔了一层。实现了程序员无负担的跨平台。
动态编译:许多信息不必在编译后确定,为动态特性提供可能,稍后详细说。
运行时维护着类型信息,甚至可以加载新的类型。( CORBRA依赖这个实现。)
41/49
Java编译执行的过程是怎样的?
编译后产生一个基于堆栈的字节码 JRE在不同的 OS上提供支持 起初的 JRE是解释执行的,效率低下。
获取待执行的下一个字节码。解码。从操作数堆栈获取所需的操作数。按照 JVM 规范执行操作。将结果写回堆栈。
42/49
Java如何解决执行效率低下问题?
43/49
JIT是怎样运行的呢?
每次按照一个 function来编译 转成中间表示,并优化,转成可执行码 编译线程和执行线程 分析框架 Profiler观察程序行为
例如热点 function内部对象维持一个池。
44/49
动态编译的优点有什么?
学习程序的行为并优化频繁执行的 function——热方法 arrayCopy方法,拷贝大段内存,特殊指令例如类层次结构,多态的优化。
(大多数虚调用都有其固定的一个目标, JIT因此生成的代码比虚表调用代码的效率会更高。)
45/49
动态编译的缺点有什么?
初始编译会影响启动时间。 运行时编译,行为分析需要花费时间。 运行效率达到稳定需要时间。 GUI不能忍受动态编译和 GC带来的延迟。
46/49
Java如何解决实时的需求?
AOT( Ahead-of-time)编译器预先编译成为可执行码
47/49
48/49
Java适合怎样的应用呢?
Java比较时候需要长期运行的应用, Web服务器 Daemon服务
49/49
Thank you!