Book description
Today’s programming languages offer productivity and portability, but also make it easy to write sloppy code that isn’t optimized for a compiler. Thinking Low-Level, Writing High-Level will teach you to craft source code that results in good machine code once it’s run through a compiler.
You'll learn:
•How to analyze the output of a compiler to verify that your code generates good machine code
•The types of machine code statements that compilers generate for common control structures, so you can choose the best statements when writing HLL code
•Enough assembly language to read compiler output
•How compilers convert various constant and variable objects into machine data
With an understanding of how compilers work, you’ll be able to write source code that they can translate into elegant machine code.
NEW TO THIS EDITION, COVERAGE OF:
•Programming languages like Swift and Java
•Code generation on modern 64-bit CPUs
•ARM processors on mobile phones and tablets
•Stack-based architectures like the Java Virtual Machine
•Modern language systems like the Microsoft Common Language Runtime
Table of contents
- Cover Page
- Title Page
- Copyright Page
- About the Authors
- BRIEF CONTENTS
- CONTENTS IN DETAIL
- ACKNOWLEDGMENTS
- INTRODUCTION
- 1 THINKING LOW-LEVEL, WRITING HIGH-LEVEL
- 2 SHOULDN’T YOU LEARN ASSEMBLY LANGUAGE?
-
3 80X86 ASSEMBLY FOR THE HLL PROGRAMMER
- 3.1 Learning One Assembly Language Is Good, Learning More Is Better
- 3.2 80x86 Assembly Syntaxes
- 3.3 Literal Constants
- 3.4 Manifest (Symbolic) Constants in Assembly Language
- 3.5 80x86 Addressing Modes
- 3.6 Declaring Data in Assembly Language
- 3.7 Specifying Operand Sizes in Assembly Language
- 3.8 For More Information
-
4 COMPILER OPERATION AND CODE GENERATION
- 4.1 File Types That Programming Languages Use
- 4.2 Source Files
- 4.3 Types of Computer Language Processors
- 4.4 The Translation Process
- 4.5 Compiler Output
- 4.6 Object File Formats
- 4.7 Executable File Formats
- 4.8 Data and Code Alignment in an Object File
- 4.9 How Linkers Affect Code
- 4.10 For More Information
-
5 TOOLS FOR ANALYZING COMPILER OUTPUT
- 5.1 Background
- 5.2 Telling a Compiler to Produce Assembly Output
- 5.3 Using Object Code Utilities to Analyze Compiler Output
- 5.4 Using a Disassembler to Analyze Compiler Output
- 5.5 Using the Java Bytecode Disassembler to Analyze Java Output
- 5.6 Using the IL Disassembler to Analyze Microsoft C# and Visual Basic Output
- 5.7 Using a Debugger to Analyze Compiler Output
- 5.8 Comparing Output from Two Compilations
- 5.9 For More Information
-
6 CONSTANTS AND HIGH-LEVEL LANGUAGES
- 6.1 Literal Constants and Program Efficiency
- 6.2 Binding Times
- 6.3 Literal Constants vs. Manifest Constants
- 6.4 Constant Expressions
- 6.5 Manifest Constants vs. Read-Only Memory Objects
- 6.6 Swift let Statements
- 6.7 Enumerated Types
- 6.8 Boolean Constants
- 6.9 Floating-Point Constants
- 6.10 String Constants
- 6.11 Composite Data Type Constants
- 6.12 Constants Don’t Change
- 6.13 For More Information
- 7 VARIABLES IN A HIGH-LEVEL LANGUAGE
- 8 ARRAY DATA TYPES
-
9 POINTER DATA TYPES
- 9.1 The Definition of a Pointer
- 9.2 Pointer Implementation in High-Level Languages
- 9.3 Pointers and Dynamic Memory Allocation
- 9.4 Pointer Operations and Pointer Arithmetic
- 9.5 A Simple Memory Allocator Example
- 9.6 Garbage Collection
- 9.7 The OS and Memory Allocation
- 9.8 Heap Memory Overhead
- 9.9 Common Pointer Problems
- 9.10 Pointers in Modern Languages
- 9.11 Managed Pointers
- 9.12 For More Information
- 10 STRING DATA TYPES
- 11 RECORD, UNION, AND CLASS DATA TYPES
-
12 ARITHMETIC AND LOGICAL EXPRESSIONS
- 12.1 Arithmetic Expressions and Computer Architecture
- 12.2 Optimization of Arithmetic Statements
- 12.3 Side Effects in Arithmetic Expressions
- 12.4 Containing Side Effects: Sequence Points
- 12.5 Avoiding Problems Caused by Side Effects
- 12.6 Forcing a Particular Order of Evaluation
- 12.7 Short-Circuit Evaluation
- 12.8 The Relative Cost of Arithmetic Operations
- 12.9 For More Information
- 13 CONTROL STRUCTURES AND PROGRAMMATIC DECISIONS
- 14 ITERATIVE CONTROL STRUCTURES
- 15 FUNCTIONS AND PROCEDURES
- AFTERWORD: ENGINEERING SOFTWARE
- GLOSSARY
- ONLINE APPENDIXES
- INDEX
- FOOTNOTES
Product information
- Title: Write Great Code, Volume 2, 2nd Edition
- Author(s):
- Release date: August 2020
- Publisher(s): No Starch Press
- ISBN: 9781718500389
You might also like
book
How Computers Really Work
How Computers Really Work is a hands-on guide to the computing ecosystem: everything from circuits to …
book
Learning TypeScript
TypeScript has conquered the world of JavaScript: it's one of the world's fastest growing and most …
book
HTTP/2 in Action
HTTP/2 in Action teaches you everything you need to know to use HTTP/2 effectively. You'll learn …
book
Dependency Injection Principles, Practices, and Patterns
Dependency Injection Principles, Practices, and Patterns teaches you to use DI to reduce hard-coded dependencies between …