annotate src/cpu/x86/vm/c1_FpuStackSim_x86.hpp @ 17716:cdb71841f4bc

6498581: ThreadInterruptTest3 produces wrong output on Windows Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set. Reviewed-by: acorn, kvn Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author minqi
date Wed, 26 Feb 2014 15:20:41 -0800
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
0
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 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Simulates the FPU stack and maintains mapping [fpu-register -> stack offset]
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // FPU registers are described as numbers from 0..nof_fpu_regs-1
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 class Compilation;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class FpuStackSim VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
35 Compilation* _compilation;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 int _stack_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 int _regs[FrameMap::nof_fpu_regs];
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 int tos_index() const { return _stack_size - 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 int regs_at(int i) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 void set_regs_at(int i, int val);
a61af66fc99e Initial load
duke
parents:
diff changeset
43 void dec_stack_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
44 void inc_stack_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // unified bailout support
a61af66fc99e Initial load
duke
parents:
diff changeset
47 Compilation* compilation() const { return _compilation; }
a61af66fc99e Initial load
duke
parents:
diff changeset
48 void bailout(const char* msg) const { compilation()->bailout(msg); }
a61af66fc99e Initial load
duke
parents:
diff changeset
49 bool bailed_out() const { return compilation()->bailed_out(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
52 FpuStackSim(Compilation* compilation);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 void pop ();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 void pop (int rnr); // rnr must be on tos
a61af66fc99e Initial load
duke
parents:
diff changeset
55 void push(int rnr);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 void swap(int offset); // exchange tos with tos + offset
a61af66fc99e Initial load
duke
parents:
diff changeset
57 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
58 int get_slot(int tos_offset) const; // return the entry at the given offset from TOS
a61af66fc99e Initial load
duke
parents:
diff changeset
59 void set_slot(int tos_offset, int rnr); // set the entry at the given offset from TOS
a61af66fc99e Initial load
duke
parents:
diff changeset
60 void rename(int old_rnr, int new_rnr); // rename all instances of old_rnr to new_rnr
a61af66fc99e Initial load
duke
parents:
diff changeset
61 bool contains(int rnr); // debugging support only
a61af66fc99e Initial load
duke
parents:
diff changeset
62 bool is_empty();
a61af66fc99e Initial load
duke
parents:
diff changeset
63 bool slot_is_empty(int tos_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
64 int stack_size() const { return _stack_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 void clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
66 intArray* write_state();
a61af66fc99e Initial load
duke
parents:
diff changeset
67 void read_state(intArray* fpu_stack_state);
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void print() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
71
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
72 #endif // CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP