annotate src/cpu/x86/vm/c1_FpuStackSim_x86.hpp @ 71:3d62cb85208d

6662967: Optimize I2D conversion on new x86 Summary: Use CVTDQ2PS and CVTDQ2PD for integer values conversions to float and double values on new AMD cpu. Reviewed-by: sgoldman, never
author kvn
date Wed, 19 Mar 2008 15:33:25 -0700
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // Simulates the FPU stack and maintains mapping [fpu-register -> stack offset]
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // FPU registers are described as numbers from 0..nof_fpu_regs-1
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class Compilation;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class FpuStackSim VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 Compilation* _compilation;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 int _stack_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 int _regs[FrameMap::nof_fpu_regs];
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 int tos_index() const { return _stack_size - 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 int regs_at(int i) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 void set_regs_at(int i, int val);
a61af66fc99e Initial load
duke
parents:
diff changeset
40 void dec_stack_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
41 void inc_stack_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // unified bailout support
a61af66fc99e Initial load
duke
parents:
diff changeset
44 Compilation* compilation() const { return _compilation; }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 void bailout(const char* msg) const { compilation()->bailout(msg); }
a61af66fc99e Initial load
duke
parents:
diff changeset
46 bool bailed_out() const { return compilation()->bailed_out(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
49 FpuStackSim(Compilation* compilation);
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void pop ();
a61af66fc99e Initial load
duke
parents:
diff changeset
51 void pop (int rnr); // rnr must be on tos
a61af66fc99e Initial load
duke
parents:
diff changeset
52 void push(int rnr);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 void swap(int offset); // exchange tos with tos + offset
a61af66fc99e Initial load
duke
parents:
diff changeset
54 int offset_from_tos(int rnr) const; // return the offset of the topmost instance of rnr from TOS
a61af66fc99e Initial load
duke
parents:
diff changeset
55 int get_slot(int tos_offset) const; // return the entry at the given offset from TOS
a61af66fc99e Initial load
duke
parents:
diff changeset
56 void set_slot(int tos_offset, int rnr); // set the entry at the given offset from TOS
a61af66fc99e Initial load
duke
parents:
diff changeset
57 void rename(int old_rnr, int new_rnr); // rename all instances of old_rnr to new_rnr
a61af66fc99e Initial load
duke
parents:
diff changeset
58 bool contains(int rnr); // debugging support only
a61af66fc99e Initial load
duke
parents:
diff changeset
59 bool is_empty();
a61af66fc99e Initial load
duke
parents:
diff changeset
60 bool slot_is_empty(int tos_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
61 int stack_size() const { return _stack_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 void clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
63 intArray* write_state();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 void read_state(intArray* fpu_stack_state);
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void print() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 };