Commit b06225a4 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>

        * src/inst/register.hh:
        Add a copy constructor.
        * dev/inst-nodes-gen.py:
        Copy inst::Registers instead of keeping a pointer on them,
        avoiding hazardous memory manipulations.
        * dev/inst-builder-gen.py, src/inst/program_builder.cc,
        * src/vm/cpu.cc (bubble_):
        Prefer copy to reallocation of inst::Registers.
        * dev/parse-asm-parse-gen.py:
        Once they are copied, delete the inst::Registers created by the
        scanner.
parent 5090881f
2004-05-08 Benot Perrot <benoit@lrde.epita.fr>
* src/inst/register.hh:
Add a copy constructor.
* dev/inst-nodes-gen.py:
Copy inst::Registers instead of keeping a pointer on them,
avoiding hazardous memory manipulations.
* dev/inst-builder-gen.py, src/inst/program_builder.cc,
* src/vm/cpu.cc (bubble_):
Prefer copy to reallocation of inst::Registers.
* dev/parse-asm-parse-gen.py:
Once they are copied, delete the inst::Registers created by the
scanner.
2004-05-01 Benot Perrot <benoit@lrde.epita.fr>
* src/shell/shell.cc:
Use std::cin when readline library cannot be used. Add history to
readline.
2004-05-01 Benot Perrot <benoit@lrde.epita.fr>
* configure.ac, config/readline.m4,
......@@ -11,12 +25,12 @@
Improve readline detection and related information use.
2004-05-01 Benot Perrot <benoit@lrde.epita.fr>
* src/shell/cmd.hh,
* src/shell/shell.hh, src/shell/shell.cc:
* src/shell/shell.hh, src/shell/shell.cc:
Use std::string instead of char* or std::string*, avoiding
hazardous memory manipulations.
2004-04-25 Benot Perrot <benoit@lrde.epita.fr>
* src/shell/cmd.hh,
......
......@@ -66,8 +66,8 @@ namespace inst
// FIXME: fill end of program with NOPs for pipeline (really dirty!)
for (unsigned i = 0; i < 6; ++i)
program_->text_section().
add_inst (new Sll(new Register(Register::general, Cpu::zero),
new Register(Register::general, Cpu::zero),
add_inst (new Sll(Register(Register::general, Cpu::zero),
Register(Register::general, Cpu::zero),
new IntExp(0)));
return program_;
}
......@@ -122,6 +122,8 @@ for inst in instructions:
call = ""
for attribute in inst.format.attributes:
proto = proto + attribute.type + " *" + attribute.name + ", "
if attribute.type == "Register":
call = call + "*"
call = call + attribute.name + ", "
proto = string.rstrip(proto, ", ")
call = string.rstrip(call, ", ")
......@@ -132,9 +134,9 @@ for inst in instructions:
if inst.kind == "branch":
print " if (fill_delay_slot_p_)"
print " program_->text_section()."
print " add_inst (new Sll(new Register(Register::general, " + \
print " add_inst (new Sll(Register(Register::general, " + \
"Cpu::zero), "
print " new Register(Register::general, " + \
print " Register(Register::general, " + \
"Cpu::zero), "
print " new IntExp(0)));"
print " }"
......
......@@ -82,7 +82,12 @@ def class_generate(inst):
init = ""
dels = ""
for attribute in format.attributes:
args = args + attribute.type + " *" + attribute.name + ", "
if attribute.type == "Register":
args = args + "const " + attribute.type + " &"
else:
args = args + attribute.type + " *"
args = args + attribute.name + ", "
init = init + attribute.name + "_(" + attribute.name + "), "
args = string.rstrip(args, ", ")
init = string.rstrip(init, ", ")
......@@ -108,7 +113,8 @@ def class_generate(inst):
print " {"
for attribute in format.attributes:
# FIXME: there should be some preconditions
print " delete " + attribute.name + "_;"
if attribute.type != "Register":
print " delete " + attribute.name + "_;"
print " }\n"
# Methods: accessors
......@@ -128,7 +134,10 @@ def class_generate(inst):
print " " + c + attribute.type + " &"
print " " + class_id + "::get_" + attribute.name + "() " + c
print " {"
print " return *" + attribute.name + "_;"
if attribute.type == "Register":
print " return " + attribute.name + "_;"
else:
print " return *" + attribute.name + "_;"
print " }"
sys.stdout = header
print " /** \\} */"
......@@ -171,14 +180,20 @@ def class_generate(inst):
print " " + class_id + "::print(std::ostream &ostr) const"
print " {"
s = ""
for i, v in enumerate(format.attributes):
i = 0
while i < len(format.attributes):
if (i < len(format.attributes) - 1) and \
(format.attributes[i].type == "Exp") and \
(format.attributes[i + 1].type == "Register"):
s = s + " << *" + format.attributes[i].name + "_" + \
" << '(' << " + format.attributes[i + 1].name + "_ << ')' "
" << '(' << " + format.attributes[i + 1].name + "_ << ')' "
i = i + 1
else:
s = s + " << *" + format.attributes[i].name + "_ << \", \""
s = s + " << "
if format.attributes[i].type != "Register":
s = s + "*"
s = s + format.attributes[i].name + "_ << \", \""
i = i + 1
s = string.rstrip(s, "<< \", \"")
print " ostr << \"" + inst.opcode + "\\t\"" + s + ";"
print " }"
......@@ -189,8 +204,11 @@ def class_generate(inst):
print " protected:"
for attribute in format.attributes:
id = attribute.name + "_"
print " " + attribute.type + "\t*" + id + ";"
if attribute.type == "Register":
print " " + attribute.type + "\t" + id + ";"
else:
print " " + attribute.type + "\t*" + id + ";"
# End of declaration
print " };"
......
......@@ -208,6 +208,8 @@ for inst in instructions:
# Build rule and action
rule = "|"
action = "program_builder.add_"
delete = ""
deleted = []
if syntax.alias != "":
action = action + syntax.alias + "("
else:
......@@ -224,11 +226,14 @@ for inst in instructions:
token[2])
if token[0] in tokid_map.values():
action = action + value + ", "
if token[0] == "REGISTER" and value not in deleted:
delete = delete + " delete " + value + ";\n"
deleted.append(value)
action = string.rstrip(action, ", ") + ")"
# Dump rule and associated action
print rule
print "{ " + action + "; }"
print "{ " + action + ";\n" + delete + "}"
## Epilogue --------------------------
......
......@@ -2,21 +2,30 @@
(Created-By-Prcs-Version 1 3 2)
(Project-Description "")
(Project-Version mipsy 0 93)
(Parent-Version mipsy 0 92)
(Project-Version mipsy 0 94)
(Parent-Version mipsy 0 93)
(Version-Log
"Index: ChangeLog
from Benot Perrot <benoit@lrde.epita.fr>
* src/shell/shell.cc:
Use std::cin when readline library cannot be used. Add history to
readline.
* src/inst/register.hh:
Add a copy constructor.
* dev/inst-nodes-gen.py:
Copy inst::Registers instead of keeping a pointer on them,
avoiding hazardous memory manipulations.
* dev/inst-builder-gen.py, src/inst/program_builder.cc,
* src/vm/cpu.cc (bubble_):
Prefer copy to reallocation of inst::Registers.
* dev/parse-asm-parse-gen.py:
Once they are copied, delete the inst::Registers created by the
scanner.
")
(New-Version-Log
"")
(Checkin-Time "Sun, 02 May 2004 15:35:43 +0200")
(Checkin-Time "Sat, 08 May 2004 19:38:13 +0200")
(Checkin-Login benoit)
(Files
......@@ -24,7 +33,7 @@ from Beno
;; ./
(AUTHORS (mipsy/0_AUTHORS 1.2 644))
(COPYING (mipsy/1_COPYING 1.1 644))
(ChangeLog (mipsy/2_ChangeLog 1.87 604))
(ChangeLog (mipsy/2_ChangeLog 1.88 604))
(INSTALL (mipsy/b/12_INSTALL 1.1 604))
(Makefile.am (mipsy/3_Makefile.a 1.9 604))
(NEWS (mipsy/b/25_NEWS 1.10 604))
......@@ -40,13 +49,13 @@ from Beno
;; ./dev/
(dev/doc-inst-set-gen.py (mipsy/c/21_doc-inst-s 1.4 705))
(dev/inst-builder-gen.py (mipsy/15_mipsy-buil 1.12 705))
(dev/inst-builder-gen.py (mipsy/15_mipsy-buil 1.13 705))
(dev/inst-makefile-gen.py (mipsy/b/15_mipsy-mk-i 1.9 705))
(dev/inst-nodes-gen.py (mipsy/12_mipsy-inst 1.10 705))
(dev/inst-nodes-gen.py (mipsy/12_mipsy-inst 1.11 705))
(dev/inst-solver-gen.py (mipsy/b/13_inst-solve 1.3 755))
(dev/mipsy.py (mipsy/16_mipsy.py 1.10 705))
(dev/mipsy.xml (mipsy/17_mipsy.xml 1.17 604))
(dev/parse-asm-parse-gen.py (mipsy/13_mipsy-pars 1.10 705))
(dev/parse-asm-parse-gen.py (mipsy/13_mipsy-pars 1.11 705))
(dev/parse-asm-scan-gen.py (mipsy/14_mipsy-scan 1.12 705))
;; ./doc/
......@@ -75,8 +84,8 @@ from Beno
(src/inst/label.cc (mipsy/b/21_label.cc 1.4 604))
(src/inst/label.hh (mipsy/b/20_label.hh 1.4 604))
(src/inst/program.hh (mipsy/28_program.hh 1.4 644))
(src/inst/program_builder.cc (mipsy/29_program_bu 1.14 604))
(src/inst/register.hh (mipsy/31_register.h 1.8 644))
(src/inst/program_builder.cc (mipsy/29_program_bu 1.15 604))
(src/inst/register.hh (mipsy/31_register.h 1.9 644))
(src/inst/section.hh (mipsy/b/24_section.hh 1.8 604))
(src/inst/text_section.hh (mipsy/32_text_secti 1.8 604))
(src/inst/text_section.cc (mipsy/c/33_text_secti 1.2 644))
......@@ -118,7 +127,7 @@ from Beno
(src/vm/Makefile.am (mipsy/b/0_Makefile.a 1.5 604))
(src/vm/cp0.hh (mipsy/b/16_cp0.hh 1.2 644))
(src/vm/cpu.hh (mipsy/b/1_cpu.hh 1.19 604))
(src/vm/cpu.cc (mipsy/b/5_virtual_ma 1.27 604))
(src/vm/cpu.cc (mipsy/b/5_virtual_ma 1.28 604))
(src/vm/memory.hh (mipsy/b/2_memory.hh 1.10 604))
(src/vm/mmu.hh (mipsy/c/15_mmu.hh 1.3 604))
(src/vm/segment.hh (mipsy/b/3_segment.hh 1.5 644))
......
This diff is collapsed.
......@@ -44,7 +44,11 @@ namespace inst
kind_(kind), index_(index)
{
}
Register& operator=(const Register& reg)
Register(const Register &reg):
kind_(reg.kind_), index_(reg.index_)
{}
Register& operator=(const Register &reg)
{
kind_ = reg.kind_;
index_ = reg.index_;
......
......@@ -40,10 +40,9 @@ namespace vm
istr_(istr), ostr_(ostr),
check_callee_save_p_(check_callee_save_p),
trace_p_(trace_p),
bubble_(new inst::Sll
(new inst::Register(inst::Register::general, Cpu::zero),
new inst::Register(inst::Register::general, Cpu::zero),
new inst::IntExp(0)))
bubble_(new inst::Sll(inst::Register(inst::Register::general, Cpu::zero),
inst::Register(inst::Register::general, Cpu::zero),
new inst::IntExp(0)))
{
reset();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment