void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
    // At this point we know that marking is in progress.
    // If do_load() is true then we have to emit the
    // load of the previous value; otherwise it has already
    // been loaded into _pre_val.

    __ bind(_entry);

    assert(pre_val()->is_register(), "Precondition.");
    Register pre_val_reg = pre_val()->as_register();

    if (do_load()) {
        ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
    }

    if (__ is_in_wdisp16_range(_continuation)) {
        __ br_null(pre_val_reg, /*annul*/false, Assembler::pt, _continuation);
    } else {
        __ cmp(pre_val_reg, G0);
        __ brx(Assembler::equal, false, Assembler::pn, _continuation);
    }
    __ delayed()->nop();

    __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
    __ delayed()->mov(pre_val_reg, G4);
    __ br(Assembler::always, false, Assembler::pt, _continuation);
    __ delayed()->nop();

}
Example #2
0
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {

  // At this point we know that marking is in progress

  __ bind(_entry);
  assert(pre_val()->is_register(), "Precondition.");

  Register pre_val_reg = pre_val()->as_register();

  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);

  __ cmpptr(pre_val_reg, (int32_t) NULL_WORD);
  __ jcc(Assembler::equal, _continuation);
  ce->store_parameter(pre_val()->as_register(), 0);
  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id)));
  __ jmp(_continuation);

}
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
  __ bind(_entry);

  assert(pre_val()->is_register(), "Precondition.");

  Register pre_val_reg = pre_val()->as_register();

  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false);
  __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
                    pre_val_reg, _continuation);
  __ delayed()->nop();

  __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
  __ delayed()->mov(pre_val_reg, G4);
  __ br(Assembler::always, false, Assembler::pt, _continuation);
  __ delayed()->nop();

}
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
  // At this point we know that marking is in progress.
  // If do_load() is true then we have to emit the
  // load of the previous value; otherwise it has already
  // been loaded into _pre_val.

  __ bind(_entry);
  assert(pre_val()->is_register(), "Precondition.");

  Register pre_val_reg = pre_val()->as_register();

  if (do_load()) {
    ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
  }
  __ cbz(pre_val_reg, _continuation);
  ce->store_parameter(pre_val()->as_register(), 0);
  __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id)));
  __ b(_continuation);
}
Example #5
0
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
  // At this point we know that marking is in progress.
  // If do_load() is true then we have to emit the
  // load of the previous value; otherwise it has already
  // been loaded into _pre_val.
  __ bind(_entry);
  ce->check_reserved_argument_area(16); // RT stub needs 2 spill slots.
  assert(pre_val()->is_register(), "Precondition.");

  Register pre_val_reg = pre_val()->as_register();

  if (do_load()) {
    ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
  }

  __ z_ltgr(Z_R1_scratch, pre_val_reg); // Pass oop in Z_R1_scratch to Runtime1::g1_pre_barrier_slow_id.
  __ branch_optimized(Assembler::bcondZero, _continuation);
  ce->emit_call_c(Runtime1::entry_for (Runtime1::g1_pre_barrier_slow_id));
  CHECK_BAILOUT();
  __ branch_optimized(Assembler::bcondAlways, _continuation);
}
Example #6
0
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
  __ bind(_entry);

  assert(pre_val()->is_register(), "Precondition.");

  Register pre_val_reg = pre_val()->as_register();

  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
  if (__ is_in_wdisp16_range(_continuation)) {
    __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
                      pre_val_reg, _continuation);
  } else {
    __ cmp(pre_val_reg, G0);
    __ brx(Assembler::equal, false, Assembler::pn, _continuation);
  }
  __ delayed()->nop();

  __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
  __ delayed()->mov(pre_val_reg, G4);
  __ br(Assembler::always, false, Assembler::pt, _continuation);
  __ delayed()->nop();

}
Example #7
0
  /* Walks through object's relocation entries and relocate. */
  void link_node::apply_relocations(unsigned char *mem, unsigned char word_size)
  {
    unsigned int i, j, aux;
    Elf32_Word info;
    Elf32_Addr target, location;
    Elf_Symndx symndx;
    Elf32_Sym *elf_symbol;
    symbol_wrapper *symbol;
    
    if (!has_relocations)
      return;
    
    for (i = 0;
	 i < dyn_relocs.get_size();
	 i++) 
      {
        unsigned char target_size = word_size;
        unsigned reloc_type;
	info = dyn_relocs.read_info(i);
	symndx = ELF32_R_SYM(info);
	elf_symbol = dyn_table.get_symbol(symndx);
	symbol = new symbol_wrapper(elf_symbol, match_endian);
	target = symbol->read_value();
	symbol->read_size();
	delete symbol;
	target += dyn_relocs.read_addend(i);
	location = dyn_relocs.read_offset(i);
	location += load_addr;

        FETCH_RELOC_TYPE(info, reloc_type);
	
	switch(reloc_type)
	  {
	  case 0: /* NULL */
	    break; 
	  case 1: /* RELATIVE */
            if (match_endian) {
              for (j=0; j<target_size; j++)
                *(((unsigned char*)(&aux))+j) = *(unsigned char *)(mem + location + j);
            } else {
              for (j=0; j<target_size; j++)
                *(((unsigned char*)(&aux))+j) = *(unsigned char *)(mem + location+target_size-1-j) ;
            }
            aux += load_addr;
            patch_code(mem+location, aux, target_size);
	    break;
	  case 2: /* COPY */
	    /* We copy this symbol at adjust_symbols() function. */
	    break;
          case 5: /* ABS8 */
            target_size = 8;
            patch_code(mem+location, target, target_size);
            break;
	  case 6: /* ABS16 */
            target_size = 16;
            /* Fall through */
          case 7: /* ABS32 */
	  case 3: /* JUMP_SLOT */
	  case 4: /* GLOB_DAT */
            patch_code(mem+location, target, target_size);
	    break;
          case 8:  /* REL8  */
            target -= location;
            target_size = 8;
            patch_code(mem+location, target, target_size);
            break;
          case 9:  /* REL16 */
            target -= location;
            target_size = 16;
            patch_code(mem+location, target, target_size);
            break;
          case 10: /* REL32 */
            target -= location;
            patch_code(mem+location, target, target_size);
            break;
	  default:
	    AC_ERROR("Run-time dynamic linker: Unknown relocation code \"" << 
		     reloc_type << "\"." << std::endl <<"\
 If this dynamic object was not created with an ArchC generated linker, please"
                     << std::endl << "\
 include a path to locate this model's conversion map ac_rtld.relmap. To do" <<
                     std::endl << "\
 this, set the environment variable AC_LIBRARY_PATH with the path.");
	    exit(EXIT_FAILURE);
	  }
	
      } /* for(i=0;i<dyn_relocs.get_size();i++) */
  } /* apply_relocations() */
Example #8
0
struct FASL_Header *fasl_load( const char *path, rs_bool verboseq )
{
  struct FASL_Header temph, *h;
  struct stat s;
  int fd;
  void *rgn;

  timepoint( 100 );

  fd = open( path, O_RDONLY );
  if (fd < 0)
    {
      perror( path );
      return NULL;
    }

  fstat( fd, &s );

  if ((read( fd, &temph, sizeof( struct FASL_Header ) )
      != sizeof( struct FASL_Header ))
      || (temph.image_magic != FASL_MAGIC))
    {
      fprintf( stderr, "%s: not a FASL file\n", path );
      return NULL;
    }

  timepoint( 101 );

  rgn = map_it( path, fd, temph.pre_loaded_at, s.st_size );
  if (!rgn)
    return NULL;

  fasl_loaded_at = rgn;
  h = (struct FASL_Header *)rgn;
  timepoint( 102 );

  if (h->image_magic != FASL_MAGIC)
    {
      fprintf( stderr, "%s: not a FASL file\n", path );
      return NULL;
    }

  timepoint( 103 );

  if (verboseq && h->num_roots >= 2)
    {
      if (h->root_list[2])
	printf( "%s\n", (char *)h->root_list[2] );
    }

  /* patch up code pointers */

  timepoint( 105 );
  patch_code(h);
  timepoint( 106 );

  /* patch up <allocation-area>'s (which have code ptrs) */
  {
    AllocArea *nxt, *aa = h->first_alloc_area;
    while (aa)
      {
	nxt = (AllocArea *)aa->allocfn;
	aa->allocfn = default_alloc_obj;
	aa = nxt;
      }
  }
  timepoint( 107 );

  return h;
}