Chapt.2 Machine Architecture: - Impact of Languages
Chapt.2 Machine Architecture: - Impact of Languages
2 Machine Architecture
Impact of languages
Support faster, more secure
Primitive Operations
e.g. nested subroutine calls Subroutines implemented with stack (ex: PL/1- recursion)
Limitations
Space Time
Operations on data
Primitive operations manipulate data Integer, character, bit string, (1-dimensional) arrays Possibly floating-point, character string Data operations are valid on all data cells
Hardware
Sequence control (control operations)
Sequence (von Neumann architecture)
Program address register (PC) incremented automatically
Data access
Operation (move, load, etc.) Operand typically address of cell
Hardware
Effect of current access times
Register access 5-10 nsec Memory access 50-70 nsec I/O access 10-15 msec.
Modular programs can make efficient use of cache and virtual memory (hits) Cost of tasking In-line modules Multi-dimensional arrays
Computer states
State transitions for representing virtual machine State transition diagrams for proving correctness
Role of firmware
Instructions in microprogram Emulation to create virtual computer FORTRAN hardware machine
Statements in hardware/firmware
Translators
Translators allow for the creation of virtual machines A program language defines its own machine
May restrict data operations
e.g., pure LISP does not have use floating point operations
Translators
Interpreter decodes and executes each hardware machine instruction or higher level statement (initially Basic, Snobol, LISP, Perl, Smalltalk, Java)
Does not create object code Each statement (even in a loop) must be repeatedly translated
Translators
Virtual machine is portable, user friendly(?)
Compiler creates object code in assembler or hardware machine language Quick and dirty Optimizing Cross compiler translates to machine language of another machine (simulation) Useful for designing code for small chips Load or link editor - source code is typically relocatable and object code is a single executable program with external references resolved Preprocessor or macroprocessor Source and object code both in high level language Initial pass for expanding macros, constants, C++, etc.
C virtual computer
Hides/ adds capabilities C library routines
Binding Times
Binding of data: association with cell(s) Binding of operation: association with hardware primitive operation(s) Typically several intermediate steps Flexibility versus efficiency/ reliability
Late binding provides greater flexibility, less efficiency, typically less reliability
Binding Times
During program execution
Module entry- semi-dynamic Arbitrary run times dynamic
Binding Times
During language implementation for specific hardware
possibly number implementation
Cs int Issue of portability
Association of +
Language definition determines what + can be (or sum, etc.) Binding of + to hardware or software op Compile time in FORTRAN, C At arbitrary pts of execution in C++ polymorphism