diff 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
line wrap: on
line diff
--- a/src/share/vm/asm/assembler.cpp	Tue Nov 27 17:24:15 2012 -0800
+++ b/src/share/vm/asm/assembler.cpp	Tue Nov 27 17:41:38 2012 -0800
@@ -104,7 +104,7 @@
 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 @@
 }
 
 // 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());