1 / 23

Extending The C Programming Language to Handle Multi-Formatted N-Bit Blocks

Extending The C Programming Language to Handle Multi-Formatted N-Bit Blocks. Jing Yang Department of Computer Science University of Virginia. Multi-Formatted N-Bit Blocks. Applications in a variety of domains need to represent and manipulate blocks of data at the bit level

bryson
Download Presentation

Extending The C Programming Language to Handle Multi-Formatted N-Bit Blocks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Extending The C Programming Language to Handle Multi-Formatted N-Bit Blocks Jing Yang Department of Computer Science University of Virginia

  2. Multi-Formatted N-Bit Blocks • Applications in a variety of domains need to represent and manipulate blocks of data at the bit level • Binary analysis – instruction encoding & decoding • Computer networks – packet classification (filtering) • Cryptography – the Rijndael algorithm (AES)

  3. The SPARC ISA

  4. IPv4 Packet Header

  5. AES – Substitution

  6. AES – Row Shifting

  7. AES – Column Mixing

  8. Characteristics • Continuously allocated in the memory • Variable-sized with an upper limit (a multiple of 8 bits) • Partitioned into several fields, each taking up a few bits (not necessarily continuous) – a format • Have multiple formats and the exact format of an instance may change during runtime – due to context or algorithm

  9. Languages • C • Aggregate types • Bit shifting & masking • ML • Strong type system • C++ or Java • Class • Domain-specific languages

  10. An Example

  11. Type Bob

  12. Type Interpret

  13. A Small C-Like Language with Extensions

  14. Typing Rules

  15. Derivation Rules for The Type System

  16. Type Safety

  17. Simplex Type Checking • Static type checking • Dynamic type checking • Track the type during runtime • High overhead

  18. Hybrid Type Checking – Static Analysis • The strict type system • The relaxed type system

  19. Hybrid Type Checking – Dynamic Analysis

  20. Hybrid Type Checking – Dynamic Analysis

  21. Implementation • Build upon CIL • Bob -> array of unsigned char • Bob ref -> unsigned char ref • Interpret -> no visible code • Bob field access -> a sequence of bit shifting & masking • Optimization – several accesses combined to one single word implementation

  22. Evaluation • Can only run trivial programs now, but • The revised code still shows: • Clearer structure • Shorter size • At least the same performance

  23. Questions ?

More Related