stackValueCollection.hpp revision 0:a61af66fc99e
1/*
2 * Copyright 2001-2002 Sun Microsystems, Inc.  All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25class StackValueCollection : public ResourceObj {
26 private:
27  GrowableArray<StackValue*>* _values;
28
29 public:
30  StackValueCollection()            { _values = new GrowableArray<StackValue*>(); }
31  StackValueCollection(int length)  { _values = new GrowableArray<StackValue*>(length); }
32
33  void add(StackValue *val) const   { _values->push(val); }
34  int  size() const                 { return _values->length(); }
35  bool is_empty() const             { return (size() == 0); }
36  StackValue* at(int i) const       { return _values->at(i); }
37
38  // Get typed locals/expressions
39  jint  int_at(int slot) const;
40  jlong long_at(int slot) const;
41  Handle obj_at(int slot) const;
42  jfloat  float_at(int slot) const;
43  jdouble double_at(int slot) const;
44
45  // Set typed locals/expressions
46  void set_int_at(int slot, jint value);
47  void set_long_at(int slot, jlong value);
48  void set_obj_at(int slot, Handle value);
49  void set_float_at(int slot, jfloat value);
50  void set_double_at(int slot, jdouble value);
51
52  void print();
53};
54