src/share/vm/ci/ciStreams.hpp

changeset 2462
8012aa3ccede
parent 2314
f95d63e2154a
child 3097
de847cac9235
     1.1 --- a/src/share/vm/ci/ciStreams.hpp	Wed Jan 12 13:59:18 2011 -0800
     1.2 +++ b/src/share/vm/ci/ciStreams.hpp	Thu Jan 13 22:15:41 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2011, 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 @@ -78,8 +78,8 @@
    1.11      else { assert(!is_wide(), "must not be a wide instruction"); }
    1.12    }
    1.13  
    1.14 -  Bytecode* bytecode() const { return Bytecode_at(_bc_start); }
    1.15 -  Bytecode* next_bytecode() const { return Bytecode_at(_pc); }
    1.16 +  Bytecode bytecode() const { return Bytecode(this, _bc_start); }
    1.17 +  Bytecode next_bytecode() const { return Bytecode(this, _pc); }
    1.18  
    1.19  public:
    1.20    // End-Of-Bytecodes
    1.21 @@ -151,11 +151,11 @@
    1.22    bool has_cache_index() const { return Bytecodes::uses_cp_cache(cur_bc_raw()); }
    1.23  
    1.24    int get_index_u1() const {
    1.25 -    return bytecode()->get_index_u1(cur_bc_raw());
    1.26 +    return bytecode().get_index_u1(cur_bc_raw());
    1.27    }
    1.28  
    1.29    int get_index_u1_cpcache() const {
    1.30 -    return bytecode()->get_index_u1_cpcache(cur_bc_raw());
    1.31 +    return bytecode().get_index_u1_cpcache(cur_bc_raw());
    1.32    }
    1.33  
    1.34    // Get a byte index following this bytecode.
    1.35 @@ -169,29 +169,29 @@
    1.36  
    1.37    // Get 2-byte index (byte swapping depending on which bytecode)
    1.38    int get_index_u2(bool is_wide = false) const {
    1.39 -    return bytecode()->get_index_u2(cur_bc_raw(), is_wide);
    1.40 +    return bytecode().get_index_u2(cur_bc_raw(), is_wide);
    1.41    }
    1.42  
    1.43    // Get 2-byte index in native byte order.  (Rewriter::rewrite makes these.)
    1.44    int get_index_u2_cpcache() const {
    1.45 -    return bytecode()->get_index_u2_cpcache(cur_bc_raw());
    1.46 +    return bytecode().get_index_u2_cpcache(cur_bc_raw());
    1.47    }
    1.48  
    1.49    // Get 4-byte index, for invokedynamic.
    1.50    int get_index_u4() const {
    1.51 -    return bytecode()->get_index_u4(cur_bc_raw());
    1.52 +    return bytecode().get_index_u4(cur_bc_raw());
    1.53    }
    1.54  
    1.55    bool has_index_u4() const {
    1.56 -    return bytecode()->has_index_u4(cur_bc_raw());
    1.57 +    return bytecode().has_index_u4(cur_bc_raw());
    1.58    }
    1.59  
    1.60    // Get dimensions byte (multinewarray)
    1.61    int get_dimensions() const { return *(unsigned char*)(_pc-1); }
    1.62  
    1.63    // Sign-extended index byte/short, no widening
    1.64 -  int get_constant_u1()                     const { return bytecode()->get_constant_u1(instruction_size()-1, cur_bc_raw()); }
    1.65 -  int get_constant_u2(bool is_wide = false) const { return bytecode()->get_constant_u2(instruction_size()-2, cur_bc_raw(), is_wide); }
    1.66 +  int get_constant_u1()                     const { return bytecode().get_constant_u1(instruction_size()-1, cur_bc_raw()); }
    1.67 +  int get_constant_u2(bool is_wide = false) const { return bytecode().get_constant_u2(instruction_size()-2, cur_bc_raw(), is_wide); }
    1.68  
    1.69    // Get a byte signed constant for "iinc".  Invalid for other bytecodes.
    1.70    // If prefixed with a wide bytecode, get a wide constant
    1.71 @@ -199,18 +199,18 @@
    1.72  
    1.73    // 2-byte branch offset from current pc
    1.74    int get_dest() const {
    1.75 -    return cur_bci() + bytecode()->get_offset_s2(cur_bc_raw());
    1.76 +    return cur_bci() + bytecode().get_offset_s2(cur_bc_raw());
    1.77    }
    1.78  
    1.79    // 2-byte branch offset from next pc
    1.80    int next_get_dest() const {
    1.81      assert(_pc < _end, "");
    1.82 -    return next_bci() + next_bytecode()->get_offset_s2(Bytecodes::_ifeq);
    1.83 +    return next_bci() + next_bytecode().get_offset_s2(Bytecodes::_ifeq);
    1.84    }
    1.85  
    1.86    // 4-byte branch offset from current pc
    1.87    int get_far_dest() const {
    1.88 -    return cur_bci() + bytecode()->get_offset_s4(cur_bc_raw());
    1.89 +    return cur_bci() + bytecode().get_offset_s4(cur_bc_raw());
    1.90    }
    1.91  
    1.92    // For a lookup or switch table, return target destination
    1.93 @@ -407,4 +407,11 @@
    1.94    }
    1.95  };
    1.96  
    1.97 +
    1.98 +
    1.99 +// Implementation for declarations in bytecode.hpp
   1.100 +Bytecode::Bytecode(const ciBytecodeStream* stream, address bcp): _bcp(bcp != NULL ? bcp : stream->cur_bcp()), _code(Bytecodes::code_at(NULL, addr_at(0))) {}
   1.101 +Bytecode_lookupswitch::Bytecode_lookupswitch(const ciBytecodeStream* stream): Bytecode(stream) { verify(); }
   1.102 +Bytecode_tableswitch::Bytecode_tableswitch(const ciBytecodeStream* stream): Bytecode(stream) { verify(); }
   1.103 +
   1.104  #endif // SHARE_VM_CI_CISTREAMS_HPP

mercurial