private void charArray ( char [ ] vals , int limit ) { int len ; char c ; int left , right ; String str ; int instrsPerChunk = 6 ; int maxLen ; int used ; left = 0 ; len = vals . length ; // len/CHUNK + 1 is conservative because len % CHUNK may be 0 maxLen = 3 + ( len / CHUNK + 1 ) * instrsPerChunk + 1 ; if ( limit < maxLen ) { pushMethod ( char . class ) ; if ( limit < maxLen ) { throw new IllegalStateException ( "array size ..." ) ; } charArray ( vals , MAX_INSTRUCTIONS ) ; popMethod ( ) ; return ; } dest . emit ( LDC , len ) ; ClassRef . CHAR . emitArrayNew ( dest ) ; dest . emit ( ASTORE , buffer ) ; // store array reference while ( left < len ) { c = vals [ left ] ; if ( c != 0 ) { right = Math . min ( len , left + CHUNK ) ; used = right - left ; while ( used > 0 && vals [ left + used - 1 ] == 0 ) { used -- ; } if ( used > 0 ) { str = String . copyValueOf ( vals , left , used ) ; dest . emit ( LDC , str ) ; dest . emit ( LDC , 0 ) ; dest . emit ( LDC , used ) ; dest . emit ( ALOAD , buffer ) ; dest . emit ( LDC , left ) ; dest . emit ( INVOKEVIRTUAL , GET_CHARS ) ; left = right ; } else { // empty chunk, don't save it } } else { left ++ ; } } dest . emit ( ALOAD , buffer ) ; }
reference on the operand stack