Quellcode-Bibliothek c1_FpuStackSim_x86.cpp
Sprache: C
/* * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
void FpuStackSim::rename(int old_rnr, int new_rnr) { if (TraceFPUStack) { tty->print("FPU-rename %d %d", old_rnr, new_rnr); print(); tty->cr(); } if (old_rnr == new_rnr) return; bool found = false; for (int i = 0; i < stack_size(); i++) {
assert(regs_at(i) != new_rnr, "should not see old occurrences of new_rnr on the stack"); if (regs_at(i) == old_rnr) {
set_regs_at(i, new_rnr);
found = true;
}
}
assert(found, "should have found at least one instance of old_rnr");
}
bool FpuStackSim::contains(int rnr) { for (int i = 0; i < stack_size(); i++) { if (regs_at(i) == rnr) { returntrue;
}
} returnfalse;
}
bool FpuStackSim::is_empty() { #ifdef ASSERT if (stack_size() == 0) { for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
assert(regs_at(i) == EMPTY, "must be empty");
}
} #endif return stack_size() == 0;
}
void FpuStackSim::clear() { if (TraceFPUStack) { tty->print("FPU-clear"); print(); tty->cr(); } for (int i = tos_index(); i >= 0; i--) {
set_regs_at(i, EMPTY);
}
_stack_size = 0;
}
intArray* FpuStackSim::write_state() {
intArray* res = new intArray(1 + FrameMap::nof_fpu_regs);
res->append(stack_size()); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
res->append(regs_at(i));
} return res;
}
void FpuStackSim::read_state(intArray* fpu_stack_state) {
_stack_size = fpu_stack_state->at(0); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
set_regs_at(i, fpu_stack_state->at(1 + i));
}
}
#ifndef PRODUCT void FpuStackSim::print() {
tty->print(" N=%d[", stack_size());\ for (int i = 0; i < stack_size(); i++) { int reg = regs_at(i); if (reg != EMPTY) {
tty->print("%d", reg);
} else {
tty->print("_");
}
};
tty->print(" ]");
} #endif
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.23Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.