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.

anewarrayAllocate new array of references to objectsSyntaxStack: ..., siu,=> resultsize roust be an integer. It represents the number of elements in the new array.nutexbytel and itulexbyle2 are used to construct an index into the constant pool of the current class. <strong>The</strong>item at that index is resolved <strong>The</strong> resulting entry must be a class.A new array of the indicated class type and capable of holding size elements is allocated, and result is areference to this new object. Allocation of an array large enough to contain size items of the given classtype is attempted. All elements of the array are initialized to nu 11.If size is less than zero, a Negat iveArraySizeExcept ion is thrown. If there is not enoughmemory to allocate the array, an Out.OfMemoryEr ror is thrown.anewar ray is used to create a single dimension of an array of object references. For example, to createnew Thread( 7 )the following code is used:bi push 7anewar ray anewar ray can also be used to create the first dimension of a multi-dimensional array. For example,the following array declaration:new int(6)1)is created with the following code:bipush 6anewarray See cONSTANT_Class in the "Class File Format" chapter for information on array class names.multianewarrayAllocate new multi-dimensional arraySyntaxu<strong>net</strong>tlrrt) = 1891te lindexbyte2multionewarria = 197itulexb)te 1itulexb)te2Stack: ..., sari srze2.. men => resultEach size must be an integer. Each represents the number of elements in a dimension of the array.indexbytel and indexbytel are used to construct an index into the constant pool of the current class. <strong>The</strong>item at that index is resolved. <strong>The</strong> resulting entry must be an array class of one or more dimensions.dimensions has the following aspects:• It must be an integer 2 1.It represents the number of dimensions being created. It must be S the number of dimensions ofthe array class.arraylengthialoadWoad• It represents the number of elements that are popped off the stack All must be integers greaterthan or equal to zero. <strong>The</strong>se are used as the sizes of the dimension For example, to createnew int (61( 31 (1the following code is used:bipush 6bipush 3multianewarray value-toordl, valuequord2nrrayreimust be a reference to an array of long integers. index must be an integer. <strong>The</strong> long integer valueat position number index in the array is retrieved and pushed onto the top of the stack .If arrayref is null a NullPointer Except ion is thrown. If index is not within the bounds of thearray an Ar ray nde xOu tO f BoundsExcept i on is thrown.A llgUSi 52, 1995lava Vinuxt Machine Spedlication37 38lAvAV.h..IMAchmeSveciiKMmn Aopoi 2). 199‘

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

Saved successfully!

Ooh no, something went wrong!