8003850: add support for constants in stub code

Remember the code section and switch back to the proper one when adding constants.

Reviewed-by: twisti, kvn
This commit is contained in:
Goetz Lindenmaier 2012-11-27 17:41:38 -08:00 committed by Vladimir Kozlov
parent 2d2532e740
commit 8e00acca17
3 changed files with 29 additions and 11 deletions

View file

@ -104,7 +104,7 @@ void AbstractAssembler::end_a_stub() {
address AbstractAssembler::start_a_const(int required_space, int required_align) {
CodeBuffer* cb = code();
CodeSection* cs = cb->consts();
assert(_code_section == cb->insts(), "not in insts?");
assert(_code_section == cb->insts() || _code_section == cb->stubs(), "not in insts/stubs?");
sync();
address end = cs->end();
int pad = -(intptr_t)end & (required_align-1);
@ -121,14 +121,13 @@ address AbstractAssembler::start_a_const(int required_space, int required_align)
}
// Inform CodeBuffer that incoming code and relocation will be code
// Should not be called if start_a_const() returned NULL
void AbstractAssembler::end_a_const() {
// in section cs (insts or stubs).
void AbstractAssembler::end_a_const(CodeSection* cs) {
assert(_code_section == code()->consts(), "not in consts?");
sync();
set_code_section(code()->insts());
set_code_section(cs);
}
void AbstractAssembler::flush() {
sync();
ICache::invalidate_range(addr_at(0), offset());