5/6/99 Ashish Sabharwal1 JVM Architecture n Local storage area –Randomly accessible –Just like standard RAM –Stores variables (eg. an array) –Have to specify.

Slides:



Advertisements
Similar presentations
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Advertisements

1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Procedures 2 Intructions Supporting Procedures Making Use of a Stack.
INSTRUCTION SET ARCHITECTURES
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
ELEN 468 Advanced Logic Design
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
Computer Architecture CSCE 350
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
1 1 Lecture 14 Java Virtual Machine Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Informationsteknologi Saturday, September 29, 2007 Computer Architecture I - Class 41 Today’s class More assembly language programming.
1 Storage Registers vs. memory Access to registers is much faster than access to memory Goal: store as much data as possible in registers Limitations/considerations:
CS 536 Spring Code generation I Lecture 20.
EECC250 - Shaaban #1 Lec # 5 Winter Stacks A stack is a First In Last Out (FILO) buffer containing a number of data items usually implemented.
Consider With x = 10 we may proceed as (10-1) = 9 (10-7) = 3 (9*3) = 27 (10-11) = -1 27/(-1) = -27 Writing intermediates on paper.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Basic Operational Concepts of a Computer
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 18: 0xCAFEBABE (Java Byte Codes)
Compiler Construction Lecture 17 Mapping Variables to Memory.
Lecture 17 Today’s Lecture –Instruction formats Little versus big endian Internal storage in the CPU: stacks vs. registers Number of operands and instruction.
CS-2710 Dr. Mark L. Hornick 1 Defining and calling procedures (subroutines) in assembly And using the Stack.
The Stack Pointer and the Frame Pointer (Lecture #19) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Programming Language Principles Lecture 24 Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Subroutines.
An Efficient Stack Machine Martin Schöberl. JOP Stack Architecture2 Overview JVM stack machine Parameter passing Stack access patterns Common stack caches.
Instruction Set Architecture Basics. Our Progress Done with levels 0 and 1 Seen multiple examples of level 2 Ready for ISA general principles.
The x86 Architecture Lecture 15 Fri, Mar 4, 2005.
Procedure Calls and the Stack (Lectures #18) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
Lecture 4: MIPS Instruction Set Reminders: –Homework #1 posted: due next Wed. –Midterm #1 scheduled Friday September 26 th, 2014 Location: TODD 430 –Midterm.
Chapter 5 A Closer Look at Instruction Set Architectures.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Procedure (Method) Calls Ellen Spertus MCS 111 September 25, 2003.
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
Lecture 4: MIPS Instruction Set
MAL 3 - Procedures Lecture 13. MAL procedure call The use of procedures facilitates modular programming. Four steps to transfer to and return from a procedure:
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-2.ppt Modification date: March 23, Procedures Essential ingredient of high level.
More on MIPS programs n SPIM does not support everything supported by a general MIPS assembler. For example, –.end doesn’t work Use j $ra –.macro doesn’t.
Addressing Modes MTT CPU08 Core Motorola CPU08 ADDRESSING MODES.
ITEC 352 Lecture 19 Functions in Assembly. Functions + Assembly Review Questions? Project due on Friday Stacks Function activation / deactivation.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Function Calling. Mips Assembly Call and Return Steps for procedure calling –Save the return address –Jump to the procedure (function) –Execute the procedure.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Programming Model CS 333 Sam Houston State University Dr. Tim McGuire.
RealTimeSystems Lab Jong-Koo, Lim
Function Calls in Assembly MIPS R3000 Language (extensive use of stack) Updated 7/11/2013.
Rocky K. C. Chang Version 0.1, 25 September 2017
Overview of Instruction Set Architectures
A Closer Look at Instruction Set Architectures
The Stack.
CS216: Program and Data Representation
ELEN 468 Advanced Logic Design
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
8051 Addressing Modes The way, using which the data source or destination addresses are specified in the instruction mnemonic for moving the data, is.
Arithmetic using a stack
MIPS Instructions.
Processor Organization and Architecture
The University of Adelaide, School of Computer Science
Instruction Set Architectures Continued
Instruction encoding The ISA defines Format = Encoding
Instruction encoding The ISA defines Format = Encoding
Instruction Set Principles
Program and memory layout
Instruction encoding The ISA defines Format = Encoding
Program and memory layout
Where is all the knowledge we lost with information? T. S. Eliot
Computer Architecture and System Programming Laboratory
Presentation transcript:

5/6/99 Ashish Sabharwal1 JVM Architecture n Local storage area –Randomly accessible –Just like standard RAM –Stores variables (eg. an array) –Have to specify address to load/store data n Stack of operands –Grows dynamically like the MIPS stack –Abstraction : can access only the top element –Serves two purposes: 1. Call stack (like MIPS stack) (you don’t worry about this for the simulation because you have no function calls to handle) 2. Operand stack (like MIPS registers) (this is what you need to implement) n Program -- Java bytecodes –Variable length instructions –STORE/PUSH : operands come from instruction –LOAD/POP: operands come from stack –Arithmetic: operands come from stack –Branch/Goto: operands from stack, offset from instruction

5/6/99 Ashish Sabharwal2 JVM Instructions n Four categories –Arithmetic –Stack –Memory –Branch/jump n All immediates are 8-bit or 16-bit, stored as 32-bits –8-bit: consider immed as a signed 8-bit number –16-bit: consider immedhi_immedlo together as a signed 16- bit number –For simulation, we store immediates as 32-bit numbers Why ? –Implementation: 1. Read immediate value (8-bit or 16-bit) 2. Sign extend it to 32 bits (done by decode stage) 3. Then use normal MIPS instructions to simulate JVM instruction n Semantically, each instruction has zero or one argument –2 argument bytes just denote a 16-bit argument –Execute stage should be able to assume 1 argument passed as 32-bit sign-extended parameter

5/6/99 Ashish Sabharwal3 JVM Instructions (cont’d) n Each instruction can be implemented in terms of 4 basic operations: –POP return top ; decrement JVM stack pointer –PUSH increment stack pointer; store onto stack –PUSH * increment stack pointer; load value from memory_base + 4* onto stack (4* because we store every argument as 4 bytes) –Add offset to JVM PC (JVM PC is just the address of the current bytecode) (Offset here is the number of bytes, not bytecodes) n All you need to do is –Implement these four operations –Expand each instruction in terms of these operations eg. IADD : POP v1, POP v2, PUSH (v1+v2) –For those using sample solution Just fill in appropriate things in handler routines n Assume –There will be no overflows/underflows –All JVM programs will have a valid offset (remember offset is number of bytes, not bytecodes)

5/6/99 Ashish Sabharwal4 JVM Programming n Write a JVM function that, given two addresses, adds the variables at these addresses and returns the result on the stack. C Prototype: int sum(int* x, int* y); n Before calling the JVM routine, you main function initializes JVM memory with the correct data –# fill JVM memory/stack with data –la $t0, memory# load memory_base –sw 25, 0($t0) # x = 0, *x = 25 –sw 15, 4($t0) # y = 1, *y = 15 # y is a word address for our JVM implementation # Therefore, y = 1 and not 4, though it is actually stored at # offset 4 –la $t1, stack # load stack_base –subi$t1, $t1, 8 # arguments to sum # go on JVM stack –sw 0, 0($t1) # x (word address) –sw 1, 4($t1) # y (word address) –# fill in arguments for the JVM procedure –…….. –# call your JVM routine –jalJVM –# print value at the top of stack –……..

5/6/99 Ashish Sabharwal5 JVM programming (cont’d) n First write your JVM function in terms of symbolic instructions: –# stack starts with {y, x} –IALOAD# load *x # stack = {y, *x} –ISTORE8# store *x in local memory # stack = {y} –IALOAD# load *y # stack = {*y} –ILOAD8# stack = {*y, *x} –IADD# stack = {*x + *y} –END n Now convert each of these into actual bytecodes –0x2e, 0x36, 0x08, 0x2e, 0x15, 0x08, 0x60, 0x00