comparison src/share/vm/asm/assembler.cpp @ 7197:1acccb7c0b01

8003850: add support for constants in stub code Summary: remember the code section and switch back to the proper one when adding constants. Reviewed-by: twisti, kvn Contributed-by: goetz.lindenmaier@sap.com
author kvn
date Tue, 27 Nov 2012 17:41:38 -0800
parents b9a9ed0f8eeb
children 6ab62ad83507
comparison
equal deleted inserted replaced
7196:2aff40cb4703 7197:1acccb7c0b01
102 102
103 // Inform CodeBuffer that incoming code and relocation will be for stubs 103 // Inform CodeBuffer that incoming code and relocation will be for stubs
104 address AbstractAssembler::start_a_const(int required_space, int required_align) { 104 address AbstractAssembler::start_a_const(int required_space, int required_align) {
105 CodeBuffer* cb = code(); 105 CodeBuffer* cb = code();
106 CodeSection* cs = cb->consts(); 106 CodeSection* cs = cb->consts();
107 assert(_code_section == cb->insts(), "not in insts?"); 107 assert(_code_section == cb->insts() || _code_section == cb->stubs(), "not in insts/stubs?");
108 sync(); 108 sync();
109 address end = cs->end(); 109 address end = cs->end();
110 int pad = -(intptr_t)end & (required_align-1); 110 int pad = -(intptr_t)end & (required_align-1);
111 if (cs->maybe_expand_to_ensure_remaining(pad + required_space)) { 111 if (cs->maybe_expand_to_ensure_remaining(pad + required_space)) {
112 if (cb->blob() == NULL) return NULL; 112 if (cb->blob() == NULL) return NULL;
119 set_code_section(cs); 119 set_code_section(cs);
120 return end; 120 return end;
121 } 121 }
122 122
123 // Inform CodeBuffer that incoming code and relocation will be code 123 // Inform CodeBuffer that incoming code and relocation will be code
124 // Should not be called if start_a_const() returned NULL 124 // in section cs (insts or stubs).
125 void AbstractAssembler::end_a_const() { 125 void AbstractAssembler::end_a_const(CodeSection* cs) {
126 assert(_code_section == code()->consts(), "not in consts?"); 126 assert(_code_section == code()->consts(), "not in consts?");
127 sync(); 127 sync();
128 set_code_section(code()->insts()); 128 set_code_section(cs);
129 } 129 }
130
131 130
132 void AbstractAssembler::flush() { 131 void AbstractAssembler::flush() {
133 sync(); 132 sync();
134 ICache::invalidate_range(addr_at(0), offset()); 133 ICache::invalidate_range(addr_at(0), offset());
135 } 134 }