13.07.2015 Views

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3. 17 Miscellaneous Object Operations3.18 Monitorsne wCreate new objectSyntax:new .---. 187ifidethyle Iinde.th)te2monitorenterEnter monitored region of codeSyntax:monitorenter =I1941Stack: ...,objectref =>checkcastStack. ..objectrefIndexbytel and indexbyte2 are used to construct an index into the constant pool of the current class. <strong>The</strong>item at that index must he a class name that can be resolved to a class pointer, class. A new instance ofthat class is then created and a reference to the object is pushed on the stack.Make sure object is of given typeSyntaxStack: ..., ob ectref =>cheekenst = 192lndextr)re telifideAb)te2objected!inclexbytel and indexbyte2 are used to construct an index into the constant pool of the current class. <strong>The</strong>string at that index of the constant pool is presumed to be a class name which can be resolved to a classpointer, class. objecfref must be a reference to an object.checkcast determines whether objectref can be cast to be a reference to an object of class class. Anu 11 objectref can be cast to any class. Otherwise the referenced object must be an instance of class orone of its superclasses. (See the lava Impinge Specification for information on how to determinewhether a objectref is an instance of a class.) If objectref can be cast to class execution proceeds at the nextinstruction, and the objectref remains on the stack.It objectref cannot be cast to class, a Cl as sCa s t Except ion is thrownNote. Mustn't refer to the lava Language Specification; give semantics here.monitorexitobjectref must be a reference to an object .<strong>The</strong> interpreter attempts to obtain exclusive access via a lock mechanism to object ref. If another threadalready has objectref locked, than the current thread waits until the object is unlocked. If the currentthread already has the object locked, then continue execution. If the object is not locked, then obtain anexclusive lock.If objecfref is null, then a Null Po i nterExcept. ion is thrown instead.Exit monitored region of codeSyntax:Stack: ..., objectref =>nuinirorexit = 195 Iobjectref must be a reference to an object.<strong>The</strong> lock on the object released. If this is the last lock that this thread has on that object (one thread isallowed to have multiple lockr, on a single object), then other threads that are waiting for the object tobe available are allowed to proceed.If objecfref is null, then a Nu 11 Poi n erExcept. ion is thrown instead.instanceofDeternune if an object is of given typeSyntax:inowicrof = 193indorb)te IincleAb)te2Stack. ..., ob ectref => ..., resultindexbyte I and indexbyte2 are used to construct an index into the constant pool of the current class. <strong>The</strong>string at that index of the constant pool is presumed to be a class name which can be resolved to a classpointer, class. objecfref must be a reference to an object.mstanceof determines whether objecfref can be cast to be a reference to an object of the class class. Thisinstruction will overwrite objectref with I if objectrel is an instance of class or one of its superclasses. (Seethe lava language Specification for information on how to determine whether a object reference is aninstance of a class.) Otherwise, objectref is overwritten by 0. If object ref is null, its overwritten by 0.Note: Mustn't refer to the lava liniguage Specification; give semantics here.August 2.2, 1995 Jaya Vifitial Machine SpeC111(allOn 71 72 Java Virtual Machine Spetilt(Ation August 22, 1995

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!