SlideShare a Scribd company logo
窮得只剩下 Compiler




       Jim Huang( 黃敬群 ) “jserv”
   website: http://jserv.sayya.org/
blog: http://blog.linux.org.tw/jserv/
        Apr 19, 2009 @ OSDC.tw
十字架 = cross
cross
     compiler
corss compiler 在新時代中,被賦予新的意義
What Can Compilers Do for Us?

Recommended for you

淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道

Linux uses /proc/iomem as a "Rosetta Stone" to establish relationships between software and hardware. /proc/iomem maps physical memory addresses to devices, similar to how the Rosetta Stone helped map Egyptian hieroglyphs to Greek and decode ancient Egyptian texts. This virtual file allows the kernel to interface with devices by providing address translations between physical and virtual memory spaces.

kerneldevicelinux
Embedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile DevicesEmbedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile Devices

The key problematic instructions for virtualization on ARM are those that change processor state or mode, access privileged resources, or cause unpredictable behavior when executed in user mode. These must be trapped and emulated by the virtual machine monitor.

microkernelandroidvirtualization
Introduction to gdb
Introduction to gdbIntroduction to gdb
Introduction to gdb

This document provides an introduction to GDB (GNU Debugger) including what it is, why it is useful, basic GDB commands, and examples of using GDB to debug a C program. Key points include: - GDB is an interactive debugger that allows debugging of C/C++ programs. - It helps developers find bugs by allowing them to watch/modify variables, determine why programs fail, and change program flow. - Basic GDB commands demonstrated include breakpoints, backtraces, printing variables, and stepping through code. - An example program is debugged using GDB to step through functions and view variable values.

gdb
簡單的 C 語言程式
void rewind(FILE *pLove);

int main(int argc, char **argv)
{
   FILE *p = fopen(“/dev/heart”, “w+”);
   rewind(p);
   fclose(p);
   return 0;
}
void rewind(FILE *pLove);

int main(int argc, char **argv)           宅色夫 @OSDC.tw# 癡傻 % 愚昧 & 宅
{                                         *** 最後一次見到你的路口我現在
   FILE *p = fopen(“/dev/heart”, “w+”);   才明白那原來是一條河或是一道地
                                          層下陷從那裡開始時間有了不同的
   rewind(p);
                                          轉速我們再也不站立在同一個地面
   fclose(p);
                                          了從軌道最靠近交錯的那一點逸出
   return 0;
                                          朝向全然不同的宇宙逐步擴張的距
}
                                          離我曾經以為會是荒涼的而今竟令
                                          我心安所謂錯過並不是什麼「如果
                            Compiler      那時再努力一點」或「要是做了另
                                          一個決定」就好的事從來都不是那
                                          是兩個星系不同的軌道與規
探索人生的進入點                                  則 .....
打開心扉,強制撕裂著自己接受
愛回到最初,不過是場空
於是,我悄悄閉塞內心的思緒
終了,就回到原點吧
                                   Interpreter
探索人生的進入點,打開心扉,強制撕裂
著自己接受曾經以為會是荒涼的而今竟令我心安所
謂錯過並不是什麼「如果那時再努力一點」或「要是做                     JIT compiler
了另一個決定」 ...
回顧編譯器流程
program               compiler                  checker
          .c                       exe
           .c                       exe
             .c                       exe
              .c                       exe
                .c                       exe
                 .c                       exe




程式碼的編譯與生成                        執行、評估,與驗證

  解析原始程式碼,建立 AST (Abstract Syntax Tree)
  依據 AST ,生成中間的 object ,稍後作 linking
  執行生成的機械碼


                                                          7
編譯器離我們好遠,是嗎?
運算模式已大幅改觀
 Framework-driven
 SIMD/vectorization, Cell, muticore/SMP, ...
虛擬化 (Virtualization) 技術的時代:更多元、
更安全、更有效率地使用硬體
資訊技術的雜交 (cross-over)
LLVM 正夯!

Recommended for you

ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)

2016年2月20日(金)のZynq Ultrasclae+ MPSoC 勉強会で使った資料です。 追記) 2016.05.08 公式ARM Trusted Firmwareのサイトに、Zynq UltraScale+ MPSoCの実装が追加されていていることを明記した This is the material I used at Zynq Ultrasclae + MPSoC SIG on 20th February (Friday). Addendum) 2016.05.08 We stated that the implementation of Zynq UltraScale + MPSoC was added to the official ARM Trusted Firmware site.

armv8xilinxzynq
The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger

The document discusses using the GNU Debugger (gdb) to debug applications. It covers when to use a debugger, invoking and configuring gdb, setting breakpoints, examining stack frames and data, disassembling code, and viewing registers. Gdb allows stepping through code, viewing variables and memory, and setting conditional breakpoints to debug programs.

提綱
隱藏在我們周遭的 Compiler 技術
回首 Compiler 已遠:從 A0 到 LLVM
透過 LLVM 建構虛擬機器
技術大融通與未來展望
隱藏在我們周遭的編譯器
       Java/.Net( 虛擬機器 +Just-In-Time compiler)
       網路瀏覽器
        Mozilla/Firefox (ActionMonkey/Tamarin)
        WebKit (SquirrelFish)
        Google Chrome (V8 engine)
       Web 應用程式: JSP/Servlet, SilverLight/.Net
       手機平台: Java ME, Android, iPhone
       繪圖軟體: Adobe PixelBender, Shader
       3D 高品質圖形處理: Gallium3D / OpenGL /
       Direct3D
pple Inc. 是 LLVM 開發最主要的贊助廠商,僱用 Chris Lattner
回首 Compiler 已遠
    從 A0 到 LLVM
 Grace Hopper (1906-1992)
 美國電腦科學家、海軍軍官
 1951-1952 年間,為 UNIVAC I 開發 A-0
 system (Arithmatic Language version 0) 編譯器
 ,具備 loader/linker
多才多藝的
LLVM

Recommended for you

GNU ld的linker script簡介
GNU ld的linker script簡介GNU ld的linker script簡介
GNU ld的linker script簡介

Dec/29/2014: 修正小錯誤以及增加封面圖片

Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)

Let's turn the table. Suppose your goal is to deliberately create buggy programs in C and C++ with serious security vulnerabilities that can be "easily" exploited. Then you need to know about things like stack smashing, shellcode, arc injection, return-oriented programming. You also need to know about annoying protection mechanisms such as address space layout randomization, stack canaries, data execution prevention, and more. These slides will teach you the basics of how to deliberately write insecure programs in C and C++. A PDF version of the slides can be downloaded from my homepage: http://olvemaudal.com/talks Here is a video recording of me presenting these slides at NDC 2014: http://vimeo.com/channels/ndc2014/97505677 Enjoy!

bugssoftwaresecurity
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明

「哥教的不是知識,是 guts !」 GUTS: 與其死板傳授片面的知識,還不如讓學生有 能力、有勇氣面對資訊科技產業的種種挑戰

embeddedrtosncku
What Can Compilers Do for Us?
LLVM =
Low Level Virtual Machine
  三特性、三元素、三頭六臂
LLVM =
Low Level Virtual Machine
         此 VM 非彼 VM
“LLVM does not imply things that you would expect from a
    high-level virtual machine. It does not require garbage
collection or run-time code generation (In fact, LLVM makes a
 great static compiler!). Note that optional LLVM components
  can be used to build high-level virtual machines and other
               systems that need these services.”
                       http://www.llvm.org/
LLVM 三大特性
Low-Level VM

完整的編譯器基礎建設
 可重用的、用以建構編譯器的軟體元件 (compiler
 compiler 顯然不足以應付 )
 允許更快更完整的打造新的編譯器
 static compiler, JIT, trace-based optimizer, ...

開放的編譯器框架
 多種程式語言支援
 高彈性的自由軟體授權模式 (BSD License)
 豐富的編譯輸出: C, machine code (Alpha, ARM, x86,
 Sparc, PowerPC, Cell SPU, 台灣心 Andes)

Recommended for you

Vim Rocks!
Vim Rocks!Vim Rocks!
Vim Rocks!

This document discusses tips and tricks for using the Vim text editor. It begins with an introduction to Vim and emphasizes the importance of learning basic Vim commands. It then provides recommendations for basic Vim training materials. The bulk of the document focuses on introducing 15 useful Vim plugins and customizations that can be made in the ~/.vimrc file. These are meant to enhance Vim's functionality and usability for tasks like code completion, indentation, commenting code, and diff/merging files. Links are provided to external resources for further reference.

programmercodingvimrc
Understand more about C
Understand more about CUnderstand more about C
Understand more about C

The code compares pointers and arrays in C by printing their sizes and string lengths. When a string literal is assigned to a pointer, sizeof(pointer) returns the pointer size rather than the string length, while sizeof(array) returns the full array size including the null terminator. strlen(pointer) and strlen(array) both return the string length excluding the null terminator. When an array is passed to a function, it converts to a pointer and sizeof then returns the pointer size rather than full array size.

compilerarmc
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroid
android
LLVM 三大元件
RISC 式虛擬指令集 (instruction set)
 多種語言適用、與硬體架構無關的
 IR(Intermediate Representation)

完整的高度整合函式庫與編譯器服務
 Analyses, optimizations, code generators,
 JIT compiler, garbage collection support,
 profiling, …

豐富的工具集
 Assemblers, automatic debugger, linker,
 code generator, compiler driver, modular
 optimizer, …
LLVM:
三頭六臂
Frontend   LLVM IR   Backend
Frontend   LLVM IR   Backend

Recommended for you

從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題

本簡報大量引用網路討論,試著從阿妹、江蕙演唱會前,大量網友無法透過線上購票系統順利購票的狀況,以系統設計的觀點,去分析這些線上購票系統出了哪些問題

serverlockingconcurrent
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!

ATF(ARM Trusted Firmware)は、ARMv8では重要なソフトウェア。 全体を利用するのではなく、その一部を利用可能。 この資料では、BL31(EL3 Runtime Firmware)を単体で使う場合、どうすればいいのかを、Xilinx社のZynq UltraScale+ MPSoCを例に説明しています。 ATF (ARM Trusted Firmware) is an important software in ARMv8. Instead of using the whole, part of it is available. This document explains how to do when using BL31 (EL3 Runtime Firmware) alone, for example, with Xilinx's Zynq UltraScale + MPSoC.

armzynqmpzynq mpsoc
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...

This document describes setting up a QEMU virtual machine with Ubuntu 20.04.1 to debug Linux kernel code using gdb. It has a 2-socket CPU configuration with 16GB of memory and disabled KASAN and ASLR. The QEMU VM can be used to run sample code and observe Linux kernel behavior under gdb, such as setting conditional breakpoints to analyze page fault behavior for mmap addresses by referencing a gdb debugging text file.

linux kernelgdbqemu
一系列變換處理的
API 與銜接的服務
優化與轉換程序




中間輸出與
生成處理
What Can Compilers Do for Us?
C file         llvmgcc        .o file        C++ file          llvmg++        .o file




 C to LLVM               Compile-time          C++ to LLVM            Compile-time
  Frontend                Optimizer             Frontend               Optimizer

    “cc1”                 “gccas”              “cc1plus”                 “gccas”



            LLVM IR         LLVM         LLVM Analysis &             LLVM .bc
             Parser         Verifier    Optimization Passes          File Writer

    Modified version of GCC                             Modified version of G++
    Emits LLVM IR as text file                          Emits LLVM IR as text file
    Lowers C AST to LLVM                                Lowers C++ AST to LLVM



               Dead Global Elimination, IP Constant Propagation, Dead
            Argument Elimination, Inlining, Reassociation, LICM, Loop Opts,
                Memory Promotion, Dead Store Elimination, ADCE, …

Recommended for you

OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみたOPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた

第六回闇PHP勉強会発表資料

phpopcache
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer

The document discusses three sanitizers - AddressSanitizer, ThreadSanitizer, and MemorySanitizer - that detect bugs in C/C++ programs. AddressSanitizer detects memory errors like buffer overflows and use-after-frees. ThreadSanitizer finds data races between threads. MemorySanitizer identifies uses of uninitialized memory. The sanitizers work by instrumenting code at compile-time and providing a run-time library for error detection and reporting. They have found thousands of bugs in major software projects with reasonable overhead. Future work includes supporting more platforms and detecting additional classes of bugs.

cpprussiac++
Shibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼうShibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼう

The document provides an overview and summary of the Gnash project, which aims to create a free and open-source Flash Player implementation. It discusses Gnash's support for SWF version 7 features, compatibility with Ubuntu Linux, and methods for compiling and using Gnash from source code. The architecture of Gnash is also briefly outlined, including components like the virtual machine, parser, garbage collection implementation, and how individual ActionScript actions are executed.

gcc                     llvm-gcc




        %tmp2 = sub i32 %tmp1, 1
           ; <i32> [#uses=1]
        %tmp3 = call i32 (...)* bitcast (i32 (i32)* @fib to
        i32 (...)*)(...)
        %tmp2 ) nounwind     ; <i32> [#uses=1]



           .bc (LLVM
           BitCode)


llvm-gcc -emit-llvm
窮!
變!
http://sakura690606.pixnet.net/blog/post/23225124




        「娘,我也
        想要性感的
        編譯器」
透過 LLVM
    建構
   虛擬機器
這是一個到處都有虛擬機器 (VM) 的時代

Recommended for you

企业级搜索引擎Solr交流
企业级搜索引擎Solr交流企业级搜索引擎Solr交流
企业级搜索引擎Solr交流

The document provides an introduction to Lucene, an open-source text search engine library written in Java. It discusses Lucene's history and architecture at a high level, how it parses query terms and fields, and supports modifiers and Boolean operators to connect terms. The summary also lists some common sub-projects built with Lucene like Solr.

enginelucene搜索引擎solrsearch
Five Minutes Introduction For Rails
Five Minutes Introduction For RailsFive Minutes Introduction For Rails
Five Minutes Introduction For Rails

The document discusses the origins and concepts behind the Ruby on Rails web application framework. It notes that Rails was created in 2005 by David Heinemeier Hanson to address the "lost Quality of Engineering Life" felt by many programmers. Rails aimed to make programming more fun and productive by embracing conventions over configurations and prioritizing developer happiness. The document outlines some of Rails' core concepts like active record and convention over configuration.

Revisited
RevisitedRevisited
Revisited

The document discusses concepts related to distributed systems and web services architectures. It covers topics like remote procedure calls (RPC), stubs/skeletons, and standards like SOAP, WSDL, and UDDI. Examples of RPC implementations include Sun RPC, DCE RPC, CORBA, and Java RMI. The document also references concepts from the Matrix movies like the Oracle, the red/blue pills, and characters like Morpheus, Cypher, and Trinity.

javawebservices
(VM 之 ) 道在屎溺
      Shader / Raytracing (OpenGL/DirectX)
      Web Browser / Adobe Flash
      Android Dalvik VM
      ...
手法:
JIT : Just-In-Time (Jizz In [My Pants]Time?!) compiler
➔




IR to backend translation / code generation
➔
編譯器流程 ::JIT
AST                    compiler                  checker
           .c                       exe
            .c                       exe
              .c                       exe
               .c                       exe
                 .c                       exe
                  .c                       exe




程式碼的編譯與生成                         執行、評估,與驗證

  建立 IR
  載入必要的函式庫
  連結程式模組
  Optimizations + Transforms
  codegen
                                                           30
當 LLVM 煞到
    OpenGL Shader


動態編譯器就在眼前
Pixel shader
PouetLink: www.pouet.net/prod.php?which=50865
Cocoon website: cocoon.planet-d.net

Recommended for you

Ruby on Rails Tutorial Part I
Ruby on Rails Tutorial Part IRuby on Rails Tutorial Part I
Ruby on Rails Tutorial Part I

This document provides an overview and agenda for a Ruby on Rails tutorial part 1. It discusses installing Ruby and Rails on Windows, creating a simple DailyLog application to demonstrate the Rails framework, and using the MVC architecture and RESTful design. It also covers generating scaffolds, models, controllers and views, routing and helpers. The document concludes with a section on unit testing in Rails.

rorrailsruby
4200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.04200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.0

The document provides instructions for using a Keithley 4200 semiconductor characterization system (4200-SCS) to perform current-voltage (I-V) measurements and analyze the results. It introduces the 4200-SCS, describes how to set up and execute an I-V test using the Keithley Interactive Test Environment (KITE) software, store and export measurement data and curves, and utilize additional features for automated testing and data analysis.

4200
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)

The document discusses Windows compatibility features, including: - The Windows Resource Protection (WRP) protects system files. - The Program Compatibility Assistant (PCA) is triggered when programs fail to install or run correctly. - Driver signing and file signature verification help ensure only trusted software runs on the system. - The document also covers installation detection technology, user account control features, and compatibility modes.

windows
3D/Shader 的考量點
         光
         反射
         移動的演算法

Reyes(scanline,polygon)   Raytracing




 可引入 SIMD 優化
push N
surface
matte(float Ka = 1.0; float Kd = 1.1;)   normalize
{                                        push I
  normal Nf = faceforward(               faceforward
              normalize(N), I);          ...
  Oi = Os;
  Ci = Os * Cs * (Ka * ambient() +
                  Kd * diffuse(Nf));  
 
}
push N
surface
                                         normalize
matte(float Ka = 1.0; float Kd = 1.1;)
                                         push I
{
                                         faceforward
  normal Nf = faceforward(
                                         ...
              normalize(N), I);
  Oi = Os;
  Ci = Os * Cs * (Ka * ambient() +
                  Kd * diffuse(Nf));  
 
}


   Raytracing 的難題
   無法善用 SIMD
   運算相依性高且繁瑣
   需要動態調整快速運算
   的路徑
Specialize       以 color space 轉換來說,相當大量
                 且繁瑣的運算,如
  技巧             BGRA 444R --> RGBA 8888




 Speedup depends on src/dest format:
 – 5.4x speedup on average, 19.3x max
 speedup: (13.3MB/s to 257.7MB/s)

Recommended for you

XS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt JapaneseXS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt Japanese

This document provides an overview of the Xen API and how it can be used with JRuby. The Xen API allows for managing virtual machines and their resources through a standardized interface. It uses XML-RPC to expose methods that can be called from various programming languages. JRuby allows accessing the Xen API through Ruby code and RubyGems by wrapping the underlying C/C++ libvirt library. Examples are given showing how to connect to a Xen host, get information on VMs, and reboot a VM using the Xen API via Ruby code.

xen.orgfujitsu8
QQ
QQQQ
QQ

The document describes the directory structure of a website located at ftp://etoptek.com.tw/www. It includes directories for drivers, images, manuals, and support documentation. Many of the directories contain subdirectories that further organize the files by manufacturer, device, or operating system. The website also contains HTML files for product information and support pages in both Chinese and English.

Peeling The Onion For Ipdc Forum09 Mix Ver1
Peeling The Onion For Ipdc Forum09 Mix Ver1Peeling The Onion For Ipdc Forum09 Mix Ver1
Peeling The Onion For Ipdc Forum09 Mix Ver1

The document summarizes optimization of IPDC (Intel Internet Data Center) performance. It discusses common system and application level performance issues including memory configuration, storage configuration, BIOS settings, and multi-threaded application design issues like locking granularity, concurrency, and thread pool selection. It provides examples of how optimizing these areas through techniques like SSD usage, lock splitting, and using thread building block libraries can improve performance.

What Can Compilers Do for Us?
Mandelbort 碎形運算透過 LLVM JIT 後,
提昇效能達到 11 倍
LLVM 與繪圖處理的應用
手機平台: Android PixelFlinger
繪圖軟體: Adobe PixelBender, Shader
3D 高品質圖形處理: Gallium3D / OpenGL
Android OpenGL|ES

Recommended for you

P2P Bug Tracking with SD
P2P Bug Tracking with SDP2P Bug Tracking with SD
P2P Bug Tracking with SD

SD is a peer-to-peer (P2P) bug tracking system that allows users to track bugs and work even when offline or without reliable network access. It was created by Jesse Vincent, the founder of Best Practical, because existing bug tracking solutions did not meet his needs as someone who spends a lot of time traveling without reliable WiFi access. SD synchronizes issues and changes across devices and other issue trackers using a distributed model rather than depending on a centralized network infrastructure.

p2ptrackingsocial
微软客户端技术纵览
微软客户端技术纵览微软客户端技术纵览
微软客户端技术纵览

This document provides an overview of Microsoft's client technology strategy, including new features for Windows 7 like multi-touch support and Jump Lists, improvements to Internet Explorer 8, and technologies like the Windows Ribbon interface, Federated Search, and Silverlight. It discusses the development approaches and APIs available for multi-touch applications on Windows, customizing the Windows 7 taskbar, and accelerators in IE8 to improve the browsing experience.

How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP

The document provides an overview of domain-specific languages (DSLs) and language-oriented programming. It discusses how DSLs are specialized computer languages for a particular domain and provides examples of DSLs. It also describes how language-oriented programming uses DSLs to define programming abstractions and implementations through language tools and workbenches. Finally, it outlines how a DSL for object-relational mapping was developed in PHP using a lexer, parser, and Eclipse integration.

phppieceframeworkdsl
當 LLVM 煞到
       Adobe Flash


安全多元的享受 C/C++ 的美好
有時,你不會想看到遙遙 ...
      ( 不安全、不舒服的 C 語言 )
「可是,男人都想要當
   慣C」
承認吧,慣 C 有很多好處,所以
Adobe 建立 Alchemy(FlaCC) 專案
             當然啦,慣 C 的風險也很高
             「學長,我不敢修電腦」
虛擬機器: AVM2
Adobe Alchemy
實驗性的 LLVM Backend
LLVM → ABC (ActionScript Bytecode)
ABC 類似精簡的 x86 指令集
提供 POSIX 模擬層與完整的 BSD libc + GNU
ISO C++ library
足以執行若干重要的應用程式

Recommended for you

Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese Version

This document summarizes the key new features in Ruby on Rails 2.1, which was released on June 1, 2008. It introduces features like timezones support, dirty tracking, gem dependencies, named scopes, UTC-based migrations, and better caching. It also provides Chinese translations of chapters from the book "Ruby on Rails 2.1 - What's New" to explain ActiveRecord improvements like SUM method expressions, HAS_ONE through option, and named scopes.

chineserailsruby
WindowsユーザのためのはじめてのPerlプログラミング
WindowsユーザのためのはじめてのPerlプログラミングWindowsユーザのためのはじめてのPerlプログラミング
WindowsユーザのためのはじめてのPerlプログラミング

This document provides instructions on how to use Perl on Windows and call functions between Perl and x86 code. It discusses using ActivePerl to run Perl on Windows, calling DLL functions from Perl using Win32::API, calling x86 code from Perl using signal handlers, and calling Perl subs from x86 code. Examples are provided for each technique.

shibuya.pm
20090410 Gree Opentech Main
20090410 Gree Opentech Main20090410 Gree Opentech Main
20090410 Gree Opentech Main

2009/04/10 GREE Labs で開かれた勉強会の資料です。オープニングと岩松さんの New Maintainer Process 資料と共にお楽しみください。 (ODF版でアップロードしたらフォントがガタガタなので、PDFでアップロードし直ししたい…)

greeflossdebianjp
What Can Compilers Do for Us?
What Can Compilers Do for Us?
What Can Compilers Do for Us?
當 LLVM 煞到
         Android


安全多元的享受 C/C++ 的美好

Recommended for you

Lcos显示产业在中国的机遇
Lcos显示产业在中国的机遇Lcos显示产业在中国的机遇
Lcos显示产业在中国的机遇

The document discusses the opportunity for the LCOS display industry in China. It begins with an introduction to LCOS (Liquid Crystal on Silicon) microdisplays, which have the highest resolution of any microdisplay technology. It then discusses trends in the microdisplay industry and market, including growing applications for rear projection HDTVs, pico/nano projection systems, and large video walls. The document proposes that LCOS technology can help drive the development of the display industry in China.

....?2008....?
Web應用程式以及資安問題的探討
Web應用程式以及資安問題的探討Web應用程式以及資安問題的探討
Web應用程式以及資安問題的探討

This document discusses the OWASP Top 10, which is a list of the most critical web application security risks. It provides details on each of the top 10 risks, including examples of how they can occur and recommendations for how to address them. The top risks are: #1- Cross-Site Scripting (XSS), #2 - SQL Injection, #3 - Malicious File Execution, #4 - Insecure Direct Object Reference, #5 - Cross-Site Request Forgery (CSRF), #6 - Security Misconfiguration, #7 - Broken Authentication and Session Management, #8 - Insecure Cryptographic Storage, #9 - Insecure Communication, and #10 - Failure to Restrict URL Access. For each

資訊安全資安owasp
Richard Databoard
Richard DataboardRichard Databoard
Richard Databoard

This document provides information about the Sysview Confidential DataBoard, a digital signage and interactive whiteboard product. It describes the key features and functions of the DataBoard, including its touchscreen capabilities, automatic recording and sharing of audio and visual materials, ability to display various types of media content, and remote management system. Applications of the DataBoard discussed include modern digital education, conferences, multimedia classrooms, mobile cinemas, and digital signage.

databoard....?2008
0xlab LLVM hacks
實驗性的 LLVM Backend
LLVM → Android Dalvik bytecode (DEX)
仿效 Adobe Alchemy ,目標平台則是
DalvikVM
提供 C/C++ 原始碼 → LLVM → DEX
bytecode 的執行環境,無 JNI (Java Native
Interface) 介入

 「我只會寫 Java VM ,不會寫 Java
 應用程式」,宅色夫 (2005)
What Can Compilers Do for Us?
application.
apk

Dalvik VM
技術大融通
             與
     未來展望
「你的時代到了!」 LLVM 一統天下

Recommended for you

20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編

The document discusses the development of a web application using Adobe Flex and ActionScript. It describes creating a framework, displaying search result location information and listings, and implementing features like search and map clicks. The application will be compiled into a SWF file to run on Flash Player or as an AIR application.

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime

PyPy takes a tracing just-in-time (JIT) compilation approach to optimize Python programs. It works by first interpreting the program, then tracing hot loops and optimizing their performance by compiling them to machine code. This JIT compilation generates and runs optimized trace trees representing the control flow and operations within loops. If guards placed in the compiled code fail, indicating the optimization may no longer apply, execution falls back to the interpreter or recompiles the trace with additional information. PyPy's approach aims to optimize the most common execution paths of Python programs for high performance while still supporting Python's dynamic nature.

Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time

This document discusses making Linux capable of hard real-time performance. It begins by defining hard and soft real-time systems and explaining that real-time does not necessarily mean fast but rather determinism. It then covers general concepts around real-time performance in Linux like preemption, interrupts, context switching, and scheduling. Specific features in Linux like RT-Preempt, priority inheritance, and threaded interrupts that improve real-time capabilities are also summarized.

LLVM 的時代到了!
clang: 嶄新的 C/C++/Objective-C 語言前端
vmkit: Java/.Net 虛擬機器
llvm + OpenGL
Sun OpenJDK → RedHat Zero/Shark
Trident: VHDL compiler for FPGA
llvmruby, yarv2llvm, RubyComp, MacRuby
PyPy, Google unladen-Swallow
HLVM: Haskell, Ocaml, ...
自由軟體編譯器技術的一統標準已定!
多元的整合,如 clang 可作為 static
compiler ,亦可挪用為 JIT compiler
技術集中,創意多元


         「人生兩條路:『生活的幸福』
         不等於『生命的幸福』,兩樣幸
         福我們都需要」
                      王陽明牧師
參考資料
〈 LLVM and Clang:
Next Generation Compiler Technology 〉 , Chris Lattner
BSDCan 2008


《美麗程式》 (Beautiful Code), O'Reilly
 第八章〈動態產生影像處理程式〉

LLVM – http://www.llvm.org/
Projects built with LLVM – http://www.llvm.org/ProjectsWithLLVM/
Open LLVM Projects – http://www.llvm.org/OpenProjects.html
UI customizing



   Platform Builder

                      三個願望一次滿足
                      一系列的自由軟體
   Device Potential
                      四月 27 日開張
                      ( 42710=0x1ab )


感謝您!

Recommended for you

2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明

與其死板傳授片面的知識,還不如讓學生有能力、 有勇氣面對資訊科技產業的種種挑戰 − GUTS = General Unix Talk Show − 向 Unix 作業系統學習,同時銜接最新產業發展,全程採用活躍 的開放原始碼技術,不用擔心學習的是「屠龍術」 目標:開拓視野,從做中學習、從做中肯定自己

iotarmncku
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明

號稱與資訊科技產業「零距離」、兼顧理論和實務,由第一線軟體工程師全程規劃的精實課程,目標:模擬產業生態和規格、銜接產業界的發展水平、採用業界標準的開發工具與流程 、100% 應用活躍的開放原始碼軟體,以及提供資訊科技工作諮詢和模擬面試

csiearmv7armv8
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明

三大主軸 – ARM 組織和結構 – 作業系統界面和設計 – 系統效能、可靠度和安全議題

csieembeddedgnu

More Related Content

What's hot

The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
National Cheng Kung University
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
National Cheng Kung University
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDB
Linaro
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
National Cheng Kung University
 
Embedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile DevicesEmbedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile Devices
National Cheng Kung University
 
Introduction to gdb
Introduction to gdbIntroduction to gdb
Introduction to gdb
Owen Hsu
 
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
Mr. Vengineer
 
The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
Gregor Schmidt
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
Priyank Kapadia
 
GNU ld的linker script簡介
GNU ld的linker script簡介GNU ld的linker script簡介
GNU ld的linker script簡介
Wen Liao
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)
Olve Maudal
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
National Cheng Kung University
 
Vim Rocks!
Vim Rocks!Vim Rocks!
Vim Rocks!
Kent Chen
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
Yi-Hsiu Hsu
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroid
l_b__
 
從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題
National Cheng Kung University
 
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!
Mr. Vengineer
 
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
Adrian Huang
 
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみたOPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
Yoshio Hanawa
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
Platonov Sergey
 

What's hot (20)

The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDB
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
 
Embedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile DevicesEmbedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile Devices
 
Introduction to gdb
Introduction to gdbIntroduction to gdb
Introduction to gdb
 
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
ZynqMPのブートとパワーマネージメント : (ZynqMP Boot and Power Management)
 
The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
 
GNU ld的linker script簡介
GNU ld的linker script簡介GNU ld的linker script簡介
GNU ld的linker script簡介
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
 
Vim Rocks!
Vim Rocks!Vim Rocks!
Vim Rocks!
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroid
 
從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題
 
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!
 
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...
 
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみたOPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
OPcacheの新機能ファイルベースキャッシュの内部実装を読んでみた
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
 

Similar to What Can Compilers Do for Us?

Shibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼうShibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼう
gyuque
 
企业级搜索引擎Solr交流
企业级搜索引擎Solr交流企业级搜索引擎Solr交流
企业级搜索引擎Solr交流
chuan liang
 
Five Minutes Introduction For Rails
Five Minutes Introduction For RailsFive Minutes Introduction For Rails
Five Minutes Introduction For Rails
Koichi ITO
 
Revisited
RevisitedRevisited
Revisited
Shunsaku Kudo
 
Ruby on Rails Tutorial Part I
Ruby on Rails Tutorial Part IRuby on Rails Tutorial Part I
Ruby on Rails Tutorial Part I
Wei Jen Lu
 
4200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.04200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.0
wayneliao
 
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Chui-Wen Chiu
 
XS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt JapaneseXS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt Japanese
The Linux Foundation
 
QQ
QQQQ
Peeling The Onion For Ipdc Forum09 Mix Ver1
Peeling The Onion For Ipdc Forum09 Mix Ver1Peeling The Onion For Ipdc Forum09 Mix Ver1
Peeling The Onion For Ipdc Forum09 Mix Ver1
hutuworm
 
P2P Bug Tracking with SD
P2P Bug Tracking with SDP2P Bug Tracking with SD
P2P Bug Tracking with SD
Jesse Vincent
 
微软客户端技术纵览
微软客户端技术纵览微软客户端技术纵览
微软客户端技术纵览
ntoskrnl
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP
Atsuhiro Kubo
 
Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese Version
Libin Pan
 
WindowsユーザのためのはじめてのPerlプログラミング
WindowsユーザのためのはじめてのPerlプログラミングWindowsユーザのためのはじめてのPerlプログラミング
WindowsユーザのためのはじめてのPerlプログラミング
Yosuke HASEGAWA
 
20090410 Gree Opentech Main
20090410 Gree Opentech Main20090410 Gree Opentech Main
20090410 Gree Opentech Main
Hideki Yamane
 
Lcos显示产业在中国的机遇
Lcos显示产业在中国的机遇Lcos显示产业在中国的机遇
Lcos显示产业在中国的机遇
巍 陆
 
Web應用程式以及資安問題的探討
Web應用程式以及資安問題的探討Web應用程式以及資安問題的探討
Web應用程式以及資安問題的探討
Mu Chun Wang
 
Richard Databoard
Richard DataboardRichard Databoard
Richard Databoard
巍 陆
 
20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編
mochiko AsTech
 

Similar to What Can Compilers Do for Us? (20)

Shibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼうShibuya.abc - Gnashで遊ぼう
Shibuya.abc - Gnashで遊ぼう
 
企业级搜索引擎Solr交流
企业级搜索引擎Solr交流企业级搜索引擎Solr交流
企业级搜索引擎Solr交流
 
Five Minutes Introduction For Rails
Five Minutes Introduction For RailsFive Minutes Introduction For Rails
Five Minutes Introduction For Rails
 
Revisited
RevisitedRevisited
Revisited
 
Ruby on Rails Tutorial Part I
Ruby on Rails Tutorial Part IRuby on Rails Tutorial Part I
Ruby on Rails Tutorial Part I
 
4200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.04200 Kte7.0 Training V1.0
4200 Kte7.0 Training V1.0
 
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
Windows 7兼容性系列课程(3):有针对的兼容性开发(上)
 
XS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt JapaneseXS Japan 2008 Xen Mgmt Japanese
XS Japan 2008 Xen Mgmt Japanese
 
QQ
QQQQ
QQ
 
Peeling The Onion For Ipdc Forum09 Mix Ver1
Peeling The Onion For Ipdc Forum09 Mix Ver1Peeling The Onion For Ipdc Forum09 Mix Ver1
Peeling The Onion For Ipdc Forum09 Mix Ver1
 
P2P Bug Tracking with SD
P2P Bug Tracking with SDP2P Bug Tracking with SD
P2P Bug Tracking with SD
 
微软客户端技术纵览
微软客户端技术纵览微软客户端技术纵览
微软客户端技术纵览
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP
 
Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese Version
 
WindowsユーザのためのはじめてのPerlプログラミング
WindowsユーザのためのはじめてのPerlプログラミングWindowsユーザのためのはじめてのPerlプログラミング
WindowsユーザのためのはじめてのPerlプログラミング
 
20090410 Gree Opentech Main
20090410 Gree Opentech Main20090410 Gree Opentech Main
20090410 Gree Opentech Main
 
Lcos显示产业在中国的机遇
Lcos显示产业在中国的机遇Lcos显示产业在中国的机遇
Lcos显示产业在中国的机遇
 
Web應用程式以及資安問題的探討
Web應用程式以及資安問題的探討Web應用程式以及資安問題的探討
Web應用程式以及資安問題的探討
 
Richard Databoard
Richard DataboardRichard Databoard
Richard Databoard
 
20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編20090418 イケテルRails勉強会 第2部Air編
20090418 イケテルRails勉強会 第2部Air編
 

More from National Cheng Kung University

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
National Cheng Kung University
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
National Cheng Kung University
 
2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明
National Cheng Kung University
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
National Cheng Kung University
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
National Cheng Kung University
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
National Cheng Kung University
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
National Cheng Kung University
 
Implement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVMImplement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVM
National Cheng Kung University
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
National Cheng Kung University
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
National Cheng Kung University
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and Implementation
National Cheng Kung University
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
National Cheng Kung University
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
National Cheng Kung University
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
National Cheng Kung University
 
Open Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to EcosystemOpen Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to Ecosystem
National Cheng Kung University
 
Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)
National Cheng Kung University
 
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
National Cheng Kung University
 
Faults inside System Software
Faults inside System SoftwareFaults inside System Software
Faults inside System Software
National Cheng Kung University
 
Hints for L4 Microkernel
Hints for L4 MicrokernelHints for L4 Microkernel
Hints for L4 Microkernel
National Cheng Kung University
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
National Cheng Kung University
 

More from National Cheng Kung University (20)

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Implement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVMImplement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVM
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and Implementation
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
 
Open Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to EcosystemOpen Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to Ecosystem
 
Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)
 
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
 
Faults inside System Software
Faults inside System SoftwareFaults inside System Software
Faults inside System Software
 
Hints for L4 Microkernel
Hints for L4 MicrokernelHints for L4 Microkernel
Hints for L4 Microkernel
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 

Recently uploaded

論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
Toru Tamaki
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
welrejdoall
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
ScyllaDB
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
Matthew Sinclair
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 

Recently uploaded (20)

論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 

What Can Compilers Do for Us?

  • 1. 窮得只剩下 Compiler Jim Huang( 黃敬群 ) “jserv” website: http://jserv.sayya.org/ blog: http://blog.linux.org.tw/jserv/ Apr 19, 2009 @ OSDC.tw
  • 3. cross compiler corss compiler 在新時代中,被賦予新的意義
  • 5. 簡單的 C 語言程式 void rewind(FILE *pLove); int main(int argc, char **argv) { FILE *p = fopen(“/dev/heart”, “w+”); rewind(p); fclose(p); return 0; }
  • 6. void rewind(FILE *pLove); int main(int argc, char **argv) 宅色夫 @OSDC.tw# 癡傻 % 愚昧 & 宅 { *** 最後一次見到你的路口我現在 FILE *p = fopen(“/dev/heart”, “w+”); 才明白那原來是一條河或是一道地 層下陷從那裡開始時間有了不同的 rewind(p); 轉速我們再也不站立在同一個地面 fclose(p); 了從軌道最靠近交錯的那一點逸出 return 0; 朝向全然不同的宇宙逐步擴張的距 } 離我曾經以為會是荒涼的而今竟令 我心安所謂錯過並不是什麼「如果 Compiler 那時再努力一點」或「要是做了另 一個決定」就好的事從來都不是那 是兩個星系不同的軌道與規 探索人生的進入點 則 ..... 打開心扉,強制撕裂著自己接受 愛回到最初,不過是場空 於是,我悄悄閉塞內心的思緒 終了,就回到原點吧 Interpreter 探索人生的進入點,打開心扉,強制撕裂 著自己接受曾經以為會是荒涼的而今竟令我心安所 謂錯過並不是什麼「如果那時再努力一點」或「要是做 JIT compiler 了另一個決定」 ...
  • 7. 回顧編譯器流程 program compiler checker .c exe .c exe .c exe .c exe .c exe .c exe 程式碼的編譯與生成 執行、評估,與驗證 解析原始程式碼,建立 AST (Abstract Syntax Tree) 依據 AST ,生成中間的 object ,稍後作 linking 執行生成的機械碼 7
  • 8. 編譯器離我們好遠,是嗎? 運算模式已大幅改觀 Framework-driven SIMD/vectorization, Cell, muticore/SMP, ... 虛擬化 (Virtualization) 技術的時代:更多元、 更安全、更有效率地使用硬體 資訊技術的雜交 (cross-over) LLVM 正夯!
  • 9. 提綱 隱藏在我們周遭的 Compiler 技術 回首 Compiler 已遠:從 A0 到 LLVM 透過 LLVM 建構虛擬機器 技術大融通與未來展望
  • 10. 隱藏在我們周遭的編譯器 Java/.Net( 虛擬機器 +Just-In-Time compiler) 網路瀏覽器 Mozilla/Firefox (ActionMonkey/Tamarin) WebKit (SquirrelFish) Google Chrome (V8 engine) Web 應用程式: JSP/Servlet, SilverLight/.Net 手機平台: Java ME, Android, iPhone 繪圖軟體: Adobe PixelBender, Shader 3D 高品質圖形處理: Gallium3D / OpenGL / Direct3D pple Inc. 是 LLVM 開發最主要的贊助廠商,僱用 Chris Lattner
  • 11. 回首 Compiler 已遠 從 A0 到 LLVM Grace Hopper (1906-1992) 美國電腦科學家、海軍軍官 1951-1952 年間,為 UNIVAC I 開發 A-0 system (Arithmatic Language version 0) 編譯器 ,具備 loader/linker
  • 14. LLVM = Low Level Virtual Machine 三特性、三元素、三頭六臂
  • 15. LLVM = Low Level Virtual Machine 此 VM 非彼 VM “LLVM does not imply things that you would expect from a high-level virtual machine. It does not require garbage collection or run-time code generation (In fact, LLVM makes a great static compiler!). Note that optional LLVM components can be used to build high-level virtual machines and other systems that need these services.” http://www.llvm.org/
  • 16. LLVM 三大特性 Low-Level VM 完整的編譯器基礎建設 可重用的、用以建構編譯器的軟體元件 (compiler compiler 顯然不足以應付 ) 允許更快更完整的打造新的編譯器 static compiler, JIT, trace-based optimizer, ... 開放的編譯器框架 多種程式語言支援 高彈性的自由軟體授權模式 (BSD License) 豐富的編譯輸出: C, machine code (Alpha, ARM, x86, Sparc, PowerPC, Cell SPU, 台灣心 Andes)
  • 17. LLVM 三大元件 RISC 式虛擬指令集 (instruction set) 多種語言適用、與硬體架構無關的 IR(Intermediate Representation) 完整的高度整合函式庫與編譯器服務 Analyses, optimizations, code generators, JIT compiler, garbage collection support, profiling, … 豐富的工具集 Assemblers, automatic debugger, linker, code generator, compiler driver, modular optimizer, …
  • 19. Frontend LLVM IR Backend
  • 20. Frontend LLVM IR Backend
  • 24. C file llvmgcc .o file C++ file llvmg++ .o file C to LLVM Compile-time C++ to LLVM Compile-time Frontend Optimizer Frontend Optimizer “cc1” “gccas” “cc1plus” “gccas” LLVM IR LLVM LLVM Analysis & LLVM .bc Parser Verifier Optimization Passes File Writer Modified version of GCC Modified version of G++ Emits LLVM IR as text file Emits LLVM IR as text file Lowers C AST to LLVM Lowers C++ AST to LLVM Dead Global Elimination, IP Constant Propagation, Dead Argument Elimination, Inlining, Reassociation, LICM, Loop Opts, Memory Promotion, Dead Store Elimination, ADCE, …
  • 25. gcc llvm-gcc %tmp2 = sub i32 %tmp1, 1 ; <i32> [#uses=1] %tmp3 = call i32 (...)* bitcast (i32 (i32)* @fib to i32 (...)*)(...) %tmp2 ) nounwind ; <i32> [#uses=1] .bc (LLVM BitCode) llvm-gcc -emit-llvm
  • 27. 變! http://sakura690606.pixnet.net/blog/post/23225124 「娘,我也 想要性感的 編譯器」
  • 28. 透過 LLVM 建構 虛擬機器 這是一個到處都有虛擬機器 (VM) 的時代
  • 29. (VM 之 ) 道在屎溺 Shader / Raytracing (OpenGL/DirectX) Web Browser / Adobe Flash Android Dalvik VM ... 手法: JIT : Just-In-Time (Jizz In [My Pants]Time?!) compiler ➔ IR to backend translation / code generation ➔
  • 30. 編譯器流程 ::JIT AST compiler checker .c exe .c exe .c exe .c exe .c exe .c exe 程式碼的編譯與生成 執行、評估,與驗證 建立 IR 載入必要的函式庫 連結程式模組 Optimizations + Transforms codegen 30
  • 31. 當 LLVM 煞到 OpenGL Shader 動態編譯器就在眼前
  • 33. 3D/Shader 的考量點 光 反射 移動的演算法 Reyes(scanline,polygon) Raytracing 可引入 SIMD 優化
  • 34. push N surface matte(float Ka = 1.0; float Kd = 1.1;) normalize { push I   normal Nf = faceforward( faceforward               normalize(N), I); ...   Oi = Os;   Ci = Os * Cs * (Ka * ambient() +                   Kd * diffuse(Nf));     }
  • 35. push N surface normalize matte(float Ka = 1.0; float Kd = 1.1;) push I { faceforward   normal Nf = faceforward( ...               normalize(N), I);   Oi = Os;   Ci = Os * Cs * (Ka * ambient() +                   Kd * diffuse(Nf));     } Raytracing 的難題 無法善用 SIMD 運算相依性高且繁瑣 需要動態調整快速運算 的路徑
  • 36. Specialize 以 color space 轉換來說,相當大量 且繁瑣的運算,如 技巧 BGRA 444R --> RGBA 8888 Speedup depends on src/dest format: – 5.4x speedup on average, 19.3x max speedup: (13.3MB/s to 257.7MB/s)
  • 38. Mandelbort 碎形運算透過 LLVM JIT 後, 提昇效能達到 11 倍
  • 39. LLVM 與繪圖處理的應用 手機平台: Android PixelFlinger 繪圖軟體: Adobe PixelBender, Shader 3D 高品質圖形處理: Gallium3D / OpenGL
  • 41. 當 LLVM 煞到 Adobe Flash 安全多元的享受 C/C++ 的美好
  • 42. 有時,你不會想看到遙遙 ... ( 不安全、不舒服的 C 語言 )
  • 43. 「可是,男人都想要當 慣C」 承認吧,慣 C 有很多好處,所以 Adobe 建立 Alchemy(FlaCC) 專案 當然啦,慣 C 的風險也很高 「學長,我不敢修電腦」 虛擬機器: AVM2
  • 44. Adobe Alchemy 實驗性的 LLVM Backend LLVM → ABC (ActionScript Bytecode) ABC 類似精簡的 x86 指令集 提供 POSIX 模擬層與完整的 BSD libc + GNU ISO C++ library 足以執行若干重要的應用程式
  • 48. 當 LLVM 煞到 Android 安全多元的享受 C/C++ 的美好
  • 49. 0xlab LLVM hacks 實驗性的 LLVM Backend LLVM → Android Dalvik bytecode (DEX) 仿效 Adobe Alchemy ,目標平台則是 DalvikVM 提供 C/C++ 原始碼 → LLVM → DEX bytecode 的執行環境,無 JNI (Java Native Interface) 介入 「我只會寫 Java VM ,不會寫 Java 應用程式」,宅色夫 (2005)
  • 52. 技術大融通 與 未來展望 「你的時代到了!」 LLVM 一統天下
  • 53. LLVM 的時代到了! clang: 嶄新的 C/C++/Objective-C 語言前端 vmkit: Java/.Net 虛擬機器 llvm + OpenGL Sun OpenJDK → RedHat Zero/Shark Trident: VHDL compiler for FPGA llvmruby, yarv2llvm, RubyComp, MacRuby PyPy, Google unladen-Swallow HLVM: Haskell, Ocaml, ...
  • 54. 自由軟體編譯器技術的一統標準已定! 多元的整合,如 clang 可作為 static compiler ,亦可挪用為 JIT compiler 技術集中,創意多元 「人生兩條路:『生活的幸福』 不等於『生命的幸福』,兩樣幸 福我們都需要」 王陽明牧師
  • 55. 參考資料 〈 LLVM and Clang: Next Generation Compiler Technology 〉 , Chris Lattner BSDCan 2008 《美麗程式》 (Beautiful Code), O'Reilly 第八章〈動態產生影像處理程式〉 LLVM – http://www.llvm.org/ Projects built with LLVM – http://www.llvm.org/ProjectsWithLLVM/ Open LLVM Projects – http://www.llvm.org/OpenProjects.html
  • 56. UI customizing Platform Builder 三個願望一次滿足 一系列的自由軟體 Device Potential 四月 27 日開張 ( 42710=0x1ab ) 感謝您!