src/share/vm/runtime/stackValue.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/runtime/stackValue.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,117 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_RUNTIME_STACKVALUE_HPP
    1.29 +#define SHARE_VM_RUNTIME_STACKVALUE_HPP
    1.30 +
    1.31 +#include "code/location.hpp"
    1.32 +#include "runtime/handles.hpp"
    1.33 +#include "utilities/top.hpp"
    1.34 +
    1.35 +class StackValue : public ResourceObj {
    1.36 + private:
    1.37 +  BasicType _type;
    1.38 +  intptr_t  _i; // Blank java stack slot value
    1.39 +  Handle    _o; // Java stack slot value interpreted as a Handle
    1.40 + public:
    1.41 +
    1.42 +  StackValue(intptr_t value) {
    1.43 +    _type  = T_INT;
    1.44 +    _i     = value;
    1.45 +  }
    1.46 +
    1.47 +  StackValue(Handle value, intptr_t scalar_replaced = 0) {
    1.48 +    _type    = T_OBJECT;
    1.49 +    _i       = scalar_replaced;
    1.50 +    _o       = value;
    1.51 +    assert(_i == 0 || _o.is_null(), "not null object should not be marked as scalar replaced");
    1.52 +  }
    1.53 +
    1.54 +  StackValue() {
    1.55 +    _type   = T_CONFLICT;
    1.56 +    _i      = 0;
    1.57 +  }
    1.58 +
    1.59 +  // Only used during deopt- preserve object type.
    1.60 +  StackValue(intptr_t o, BasicType t) {
    1.61 +    assert(t == T_OBJECT, "should not be used");
    1.62 +    _type   = t;
    1.63 +    _i      = o;
    1.64 +  }
    1.65 +
    1.66 +  Handle get_obj() const {
    1.67 +    assert(type() == T_OBJECT, "type check");
    1.68 +    return _o;
    1.69 +  }
    1.70 +
    1.71 +  bool obj_is_scalar_replaced() const {
    1.72 +    assert(type() == T_OBJECT, "type check");
    1.73 +    return _i != 0;
    1.74 +  }
    1.75 +
    1.76 +  void set_obj(Handle value) {
    1.77 +    assert(type() == T_OBJECT, "type check");
    1.78 +    _o = value;
    1.79 +  }
    1.80 +
    1.81 +  intptr_t get_int() const {
    1.82 +    assert(type() == T_INT, "type check");
    1.83 +    return _i;
    1.84 +  }
    1.85 +
    1.86 +  // For special case in deopt.
    1.87 +  intptr_t get_int(BasicType t) const {
    1.88 +    assert(t == T_OBJECT && type() == T_OBJECT, "type check");
    1.89 +    return _i;
    1.90 +  }
    1.91 +
    1.92 +  void set_int(intptr_t value) {
    1.93 +    assert(type() == T_INT, "type check");
    1.94 +    _i = value;
    1.95 +  }
    1.96 +
    1.97 +  BasicType type() const { return  _type; }
    1.98 +
    1.99 +  bool equal(StackValue *value) {
   1.100 +    if (_type != value->_type) return false;
   1.101 +    if (_type == T_OBJECT)
   1.102 +      return (_o == value->_o);
   1.103 +    else {
   1.104 +      assert(_type == T_INT, "sanity check");
   1.105 +      // [phh] compare only low addressed portions of intptr_t slots
   1.106 +      return (*(int *)&_i == *(int *)&value->_i);
   1.107 +    }
   1.108 +  }
   1.109 +
   1.110 +  static StackValue* create_stack_value(const frame* fr, const RegisterMap* reg_map, ScopeValue* sv);
   1.111 +  static BasicLock*  resolve_monitor_lock(const frame* fr, Location location);
   1.112 +
   1.113 +#ifndef PRODUCT
   1.114 + public:
   1.115 +  // Printing
   1.116 +  void print_on(outputStream* st) const;
   1.117 +#endif
   1.118 +};
   1.119 +
   1.120 +#endif // SHARE_VM_RUNTIME_STACKVALUE_HPP

mercurial