src/share/vm/ci/ciStreams.cpp

changeset 1934
e9ff18c4ace7
parent 1907
c18cbe5936b8
parent 1920
ab102d5d923e
child 1957
136b78722a08
     1.1 --- a/src/share/vm/ci/ciStreams.cpp	Tue Jun 01 11:48:33 2010 -0700
     1.2 +++ b/src/share/vm/ci/ciStreams.cpp	Wed Jun 02 22:45:42 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -81,27 +81,21 @@
    1.11  // providing accessors for constant pool items.
    1.12  
    1.13  // ------------------------------------------------------------------
    1.14 -// ciBytecodeStream::wide
    1.15 -//
    1.16 -// Special handling for the wide bytcode
    1.17 -Bytecodes::Code ciBytecodeStream::wide()
    1.18 -{
    1.19 -  // Get following bytecode; do not return wide
    1.20 -  Bytecodes::Code bc = (Bytecodes::Code)_pc[1];
    1.21 -  _pc += 2;                     // Skip both bytecodes
    1.22 -  _pc += 2;                     // Skip index always
    1.23 -  if( bc == Bytecodes::_iinc )
    1.24 -    _pc += 2;                   // Skip optional constant
    1.25 -  _was_wide = _pc;              // Flag last wide bytecode found
    1.26 -  return bc;
    1.27 -}
    1.28 -
    1.29 -// ------------------------------------------------------------------
    1.30 -// ciBytecodeStream::table
    1.31 +// ciBytecodeStream::next_wide_or_table
    1.32  //
    1.33  // Special handling for switch ops
    1.34 -Bytecodes::Code ciBytecodeStream::table( Bytecodes::Code bc ) {
    1.35 -  switch( bc ) {                // Check for special bytecode handling
    1.36 +Bytecodes::Code ciBytecodeStream::next_wide_or_table(Bytecodes::Code bc) {
    1.37 +  switch (bc) {                // Check for special bytecode handling
    1.38 +  case Bytecodes::_wide:
    1.39 +    // Special handling for the wide bytcode
    1.40 +    // Get following bytecode; do not return wide
    1.41 +    assert(Bytecodes::Code(_pc[0]) == Bytecodes::_wide, "");
    1.42 +    bc = Bytecodes::java_code(_raw_bc = (Bytecodes::Code)_pc[1]);
    1.43 +    assert(Bytecodes::wide_length_for(bc) > 2, "must make progress");
    1.44 +    _pc += Bytecodes::wide_length_for(bc);
    1.45 +    _was_wide = _pc;              // Flag last wide bytecode found
    1.46 +    assert(is_wide(), "accessor works right");
    1.47 +    break;
    1.48  
    1.49    case Bytecodes::_lookupswitch:
    1.50      _pc++;                      // Skip wide bytecode
    1.51 @@ -164,7 +158,7 @@
    1.52  int ciBytecodeStream::get_klass_index() const {
    1.53    switch(cur_bc()) {
    1.54    case Bytecodes::_ldc:
    1.55 -    return get_index();
    1.56 +    return get_index_u1();
    1.57    case Bytecodes::_ldc_w:
    1.58    case Bytecodes::_ldc2_w:
    1.59    case Bytecodes::_checkcast:
    1.60 @@ -173,7 +167,7 @@
    1.61    case Bytecodes::_multianewarray:
    1.62    case Bytecodes::_new:
    1.63    case Bytecodes::_newarray:
    1.64 -    return get_index_big();
    1.65 +    return get_index_u2();
    1.66    default:
    1.67      ShouldNotReachHere();
    1.68      return 0;
    1.69 @@ -199,10 +193,10 @@
    1.70  int ciBytecodeStream::get_constant_index() const {
    1.71    switch(cur_bc()) {
    1.72    case Bytecodes::_ldc:
    1.73 -    return get_index();
    1.74 +    return get_index_u1();
    1.75    case Bytecodes::_ldc_w:
    1.76    case Bytecodes::_ldc2_w:
    1.77 -    return get_index_big();
    1.78 +    return get_index_u2();
    1.79    default:
    1.80      ShouldNotReachHere();
    1.81      return 0;
    1.82 @@ -239,7 +233,7 @@
    1.83           cur_bc() == Bytecodes::_putfield ||
    1.84           cur_bc() == Bytecodes::_getstatic ||
    1.85           cur_bc() == Bytecodes::_putstatic, "wrong bc");
    1.86 -  return get_index_big();
    1.87 +  return get_index_u2_cpcache();
    1.88  }
    1.89  
    1.90  
    1.91 @@ -319,7 +313,9 @@
    1.92      ShouldNotReachHere();
    1.93    }
    1.94  #endif
    1.95 -  return get_index_int();
    1.96 +  if (has_index_u4())
    1.97 +    return get_index_u4();  // invokedynamic
    1.98 +  return get_index_u2_cpcache();
    1.99  }
   1.100  
   1.101  // ------------------------------------------------------------------

mercurial