src/cpu/sparc/vm/sparc.ad

Print this page
rev 3825 : Specify offset of IC load in java_to_interp stub.

If a compiled static call calls the interpreter, it jumps past a
java_to_interp stub in the compiled code. Patching this call must
find the load of the IC. So far the shared code assumed this is the
first instruction in the stub.
This might not be the case if, for example, the base of the constant
table must be loaded.
Extend CompiledStaticCall to consider an offset from its beginning
where to search the load of the IC.


1640   MacroAssembler _masm(&cbuf);
1641   int offset = ra_->reg2offset(in_RegMask(0).find_first_elem()) + STACK_BIAS;
1642   int reg = ra_->get_encode(this);
1643 
1644   if (Assembler::is_simm13(offset)) {
1645      __ add(SP, offset, reg_to_register_object(reg));
1646   } else {
1647      __ set(offset, O7);
1648      __ add(SP, O7, reg_to_register_object(reg));
1649   }
1650 }
1651 
1652 uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
1653   // BoxLockNode is not a MachNode, so we can't just call MachNode::size(ra_)
1654   assert(ra_ == ra_->C->regalloc(), "sanity");
1655   return ra_->C->scratch_emit_size(this);
1656 }
1657 
1658 //=============================================================================
1659 




1660 // emit call stub, compiled java to interpretor
1661 void emit_java_to_interp(CodeBuffer &cbuf ) {
1662 
1663   // Stub is fixed up when the corresponding call is converted from calling
1664   // compiled code to calling interpreted code.
1665   // set (empty), G5
1666   // jmp -1
1667 
1668   address mark = cbuf.insts_mark();  // get mark within main instrs section
1669 
1670   MacroAssembler _masm(&cbuf);
1671 
1672   address base =
1673   __ start_a_stub(Compile::MAX_stubs_size);
1674   if (base == NULL)  return;  // CodeBuffer::expand failed
1675 
1676   // static stub relocation stores the instruction address of the call
1677   __ relocate(static_stub_Relocation::spec(mark));
1678 
1679   __ set_metadata(NULL, reg_to_register_object(Matcher::inline_cache_reg_encode()));




1640   MacroAssembler _masm(&cbuf);
1641   int offset = ra_->reg2offset(in_RegMask(0).find_first_elem()) + STACK_BIAS;
1642   int reg = ra_->get_encode(this);
1643 
1644   if (Assembler::is_simm13(offset)) {
1645      __ add(SP, offset, reg_to_register_object(reg));
1646   } else {
1647      __ set(offset, O7);
1648      __ add(SP, O7, reg_to_register_object(reg));
1649   }
1650 }
1651 
1652 uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
1653   // BoxLockNode is not a MachNode, so we can't just call MachNode::size(ra_)
1654   assert(ra_ == ra_->C->regalloc(), "sanity");
1655   return ra_->C->scratch_emit_size(this);
1656 }
1657 
1658 //=============================================================================
1659 
1660 // Offset from start of compiled java to interpreter stub to the load
1661 // constant that loads the inline cache (IC) (0 on sparc).
1662 const int CompiledStaticCall::comp_to_int_load_offset = 0;
1663 
1664 // emit call stub, compiled java to interpretor
1665 void emit_java_to_interp(CodeBuffer &cbuf ) {
1666 
1667   // Stub is fixed up when the corresponding call is converted from calling
1668   // compiled code to calling interpreted code.
1669   // set (empty), G5
1670   // jmp -1
1671 
1672   address mark = cbuf.insts_mark();  // get mark within main instrs section
1673 
1674   MacroAssembler _masm(&cbuf);
1675 
1676   address base =
1677   __ start_a_stub(Compile::MAX_stubs_size);
1678   if (base == NULL)  return;  // CodeBuffer::expand failed
1679 
1680   // static stub relocation stores the instruction address of the call
1681   __ relocate(static_stub_Relocation::spec(mark));
1682 
1683   __ set_metadata(NULL, reg_to_register_object(Matcher::inline_cache_reg_encode()));