CALL & Pthread

CALL & Pthread
 
CALL 
& Pthread
yiming
Interpretation vs Translation
Interpreter: Directly executes a program in the source language
For example:
 
python foo.py
sh foo.sh
Translator: Converts a program from the source language to anequivalent
program in another language
For example:
gcc -FLAG flags foo.c -o foo
./foo
javac logism.java –o logism.jar
java -jar logism.jar
CALL chain
Compiler
Assembler
Linker
Loader
Compiler foo.s
High-Level Language Code -> Assembly
Language Code (e.g. MAL)
Convert marcos …
Output may contain pseudo-instructions
For example:
Move $x $y
Assembler-Proj1.1 
foo.o
Assembly Language Code (MAL) -> Object Code,
information tables(TAL)
Totally numbers
TAL is some numbers
Assembler-Proj1.1 
foo.o
Contains 2 passes.
first pass
Replace pseudo-instruction
To code without labels
Second pass
Handle branches and labels
Assembler-Proj1.1 
pass1 TODO list
1.
Skip comments
2.
Add labels in symbol table (labels, data)
3.
Give addresses
4.
Check if invalid inst
int pass_one(FILE* input, FILE* output, SymbolTable* symtbl)
Note: There are characters. I mean, normal codes 
No
pseudo. The symbol table contains position of labels.
Symbol Table
Relocation Table
Assembler-Proj1.1 
pass2 TODO list
 
1.
Check if invalid inst
2.
Use label position to generate numbers.
3.
Record relocation things to reltbl
 
int pass_two(FILE *input, FILE* output,
SymbolTable* symtbl, SymbolTable* reltbl)
Note: the pc is with suffix 00 or not
???
After Assembler-Proj1.1
 
1.
The object file with header
2.
Code (number)
3.
Data
4.
Relocation table
5.
Symbol table
6.
Debug infos
 
Linker-Proj1.2 
TODO list
Object code files, information tables -> Executable code
Briefly. Combine multiple object file to a single one
Use relocation table and symbol table.
1.
Merge text/data segment
2.
Create absolute memory addresses
3.
Modify & merge symbol and relocation tables
4.
Edit Addresses in relocation table
5.
Output executable of merged modules(instructions + data + details)
L
o
a
d
e
r
 
p
r
o
j
e
c
t
2
 
p
a
r
t
./a.out
1.
Read instructions allocate space
for program
2.
Copy data to memory
3.
Copy args to stack
4.
Init register
5.
Execute
Logisim based
 
CPU
Guest lecture: 
Pthread
Yifan
Slide Note
Embed
Share

This content delves into the intricacies of the compilation process in software development, covering topics such as interpretation vs. translation, assembler functions, symbolic tables, relocation tables, and more. It provides detailed insights into the stages involved in converting high-level language code to assembly code, object code, and finally generating executable programs.

  • Compilation Process
  • Software Development
  • Assembly Code
  • Symbolic Tables
  • Relocation Tables

Uploaded on Feb 23, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CALL & Pthread

  2. CALL & Pthread yiming

  3. Interpretation vs Translation Interpreter: Directly executes a program in the source language For example: python foo.py sh foo.sh Translator: Converts a program from the source language to anequivalent program in another language For example: gcc -FLAG flags foo.c -o foo ./foo javac logism.java o logism.jar java -jar logism.jar

  4. CALL chain Compiler Assembler Linker Loader

  5. Compiler foo.s High-Level Language Code -> Assembly Language Code (e.g. MAL) Convert marcos Output may contain pseudo-instructions For example: Move $x $y

  6. Assembler-Proj1.1 foo.o Assembly Language Code (MAL) -> Object Code, information tables(TAL) Totally numbers TAL is some numbers

  7. Assembler-Proj1.1 foo.o Contains 2 passes. first pass Replace pseudo-instruction To code without labels Second pass Handle branches and labels

  8. Assembler-Proj1.1 pass1 TODO list 1. Skip comments 2. Add labels in symbol table (labels, data) 3. Give addresses 4. Check if invalid inst int pass_one(FILE* input, FILE* output, SymbolTable* symtbl) Note: There are characters. I mean, normal codes No pseudo. The symbol table contains position of labels.

  9. Symbol Table

  10. Relocation Table

  11. Assembler-Proj1.1 pass2 TODO list 1. Check if invalid inst 2. Use label position to generate numbers. 3. Record relocation things to reltbl int pass_two(FILE *input, FILE* output, SymbolTable* symtbl, SymbolTable* reltbl) Note: the pc is with suffix 00 or not

  12. ???

  13. After Assembler-Proj1.1 1. The object file with header 2. Code (number) 3. Data 4. Relocation table 5. Symbol table 6. Debug infos

  14. Linker-Proj1.2 TODO list Object code files, information tables -> Executable code Briefly. Combine multiple object file to a single one Use relocation table and symbol table. 1. Merge text/data segment 2. Create absolute memory addresses 3. Modify & merge symbol and relocation tables 4. Edit Addresses in relocation table 5. Output executable of merged modules(instructions + data + details)

  15. Loader Loader project2 part ./a.out 1. Read instructions allocate space for program 2. Copy data to memory 3. Copy args to stack 4. Init register 5. Execute

  16. Logisim based CPU

  17. Guest lecture: Pthread Yifan

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#