Method Manipulation in an Object

advertisement
Method Manipulation in an
Object-Oriented Processor
OO Process Requirements with
Instruction Analysis of Java Programs
• “An Object Oriented Processor should
provide a fast and secure methodmanipulation procedure.”
• “Data Structures should be defined in an
object-oriented processor for the
storage of context information and local
variables”
• “OOP coding style, requires lots of method
invocation and revocation”, so optimize
Software approaches to OOP
introduce inefficiency & insecurity
• Translation from OOP objects to hardware
instructions and Data takes time
• Method invocations require locating the
method code, access control checking,
and passing control etc.
• Security brought by OOP is lost by the
translation because the hardware does not
manipulate objects directly
Java High Level Instruction Set
Computer (jHISC)
• A research computer jHISC v3 with a 64-bit
(possibly 32 bits) architecture is currently under
development
• Performance on OOP applications running on
HISC system is expected to be faster
• Memory allocations and deallocations are done
by hardware
• Secure method manipulation for OOP by
defining hardware readable data structures for
method context
Java High Level Instruction Set
Computer (jHISC)
• Security and Boundary checking put into
hardware, moves the burden of security
checking into some pipelined stages,
increasing throughput of the processor
• Secure method invocation can safeguard
errors produced by erroneous
programming
www.ee.cityu.edu.hk/~hisc/architecture.html
• Operand Desrcriptor (OD) - Hardware
readable tables and a data structure that
hold the information of objects
• Object Header (OH) - Contains information
of the object such as object type, GC
information and synchronization
information.
• Data Space (DS) – Data spaces are
storage for data, which include LVF
• Method Code Space – Stores instructions
for the method
• Thread State Space (TSS)- For
multithreading state information
State Registers – Store the current
status of the system: running instance,
class, and method context
Stack- stores state changes upon
method invocation and revocation
Method Space Data Structure
Method Space – Hardware Readable structure. Stores Method Header
(MH), Method Code Space (MCS), and Local Variable Frame for a particular
method (LVF).
Recall:
MH - Object type, Synchronization
MCS – Stores instructions for the method (Max 2^24 instructions),
the only data structure that stores instructions in the jHISC architecture
LVF – Dynamically created inside register file (can use up to 128 registers)
upon method invocation and destroyed upon revocation, used for temporary
storage of data.
Parameter Passing
&
Java Methods Map to
jHISC Assembly
Internal Method Invocation
HLL
ASSEMBLY
Class Operand
Descriptor Table
(CODT)
After Internal Method Call Returns via RVK store result into glob_z
Parameter Passing
IN
LOCAL
OUT
Glob_x Glob_y
LVF_1
Before IVK
#0
#1
---------------------------------------Context-Switch------------------------------------------------------IN
LOCAL
OUT
LVF_2
After IVK
Glob_x Glob_y
#0
#1
IN
After Mov
Before RVK
LOCAL
Loc_z Glob_y
#0
Loc_z Loc_y Loc_x
Loc_z Loc_y Loc_x
#1
------------------------------------------Context-Switch---------------------------------------------------
IN
LVF_1
LOCAL
OUT
Loc_z Glob_y
#0
#1
Method Manipulation
• jHISC v3 processor excludes any direct
pointer control transfer instruction
• Access Control - Method invocation and
revocation is the only way to transfer
control between objects
• OOP principles at the architectural level
ensure security (helps prevent
hacking/viruses trying to access protected
information)
Three Types of Method Invocation
Method Invocation
• On invocation, the system pushes
information about the current states into
the machine stack
More switching means pushing more information to the stack
Saving information in
Stack based on the
type of method
invocation
Method – 3 double
words
Class – 4 double
words
Instance – 2 double
words (aberration?)
Two bits in SR.MODE register store which kind of
methods are currently running
Invoking Internal Method
Class Property Descriptor Table (CPDT) – Stores resources that class would
probably access
Class Data Space – Stores static class data
Method Space (MS) -
Method Space Data Structure
Method Space – Hardware Readable structure. Stores Method Header
(MH), Method Code Space (MCS), and Local Variable Frame for a particular
method (LVF).
Recall:
MH - Object type, Synchronization
MCS – Stores instructions for the method (Max 2^24 instructions),
the only data structure that stores instructions in the jHISC architecture
LVF – Dynamically created inside register file (can use up to 128 registers)
upon method invocation and destroyed upon revocation, used for temporary
storage of data.
Invoking Internal Method
Class Property Descriptor Table (CPDT) – Stores resources that class would
probably access
Class Data Space – Stores static class data
Method Space (MS) - You Just Saw it!
The Processor updates MS, Instruction resumes in public void DoSomething() !
Invoking Class Method
Invoking Instance Method
Method Revocation
• Return from current context to caller
context
• Restores previously stored state
information by popping from stack
• Based on the SR.MODE, which stored the
callers context the context is restored
appropriately
SR.MODE register
Typos
Conclusion
www.ee.cityu.edu.hk/~hisc/
• JAVA is relatively a new Object-Oriented Programming
(OOP) language. It has most of the advantages of
object-oriented languages such as encapsulation,
polymorphism, dynamic binding and inheritance.
Consequently programs developed by JAVA are more
reliable and secure. However, as traditional computer
architectures RISC and CISC do not provide much
hardware support for OOP, their performance for OOP is
notoriously poor. jHISC is developed to target for JAVA
and is based on High Level Instruction Set Computer
(HISC) to support Object-Oriented Programming (OOP)
in hardware level. With jHISC architecture, software
developers can take the advantages of OOP without the
performance penalty.
Dreams Do Come True
From Virtual Machine To
Machine
“Compile Once Run Anywhere”
“jHISC Making a Virtual Reality a
Reality”
The End
Download