예제 #1
0
void SourceAssembler::add_using_gp(Register reg, const char *name, 
                                   Condition cond) {
  int offset = find_gp_offset(name);
  if (is_rotated_imm(offset)) {
    eol_comment(name);
    add(reg, gp, imm(offset), cond);
  } else {
    char buff[128];
    jvm_sprintf(buff, "slow add_gp_imm %s %d", name, offset);
    eol_comment(buff);
    offset -= 1024;
    GUARANTEE(is_rotated_imm(1024), "sanity");
    GUARANTEE(is_rotated_imm(offset), "sanity");
    add(reg, gp, imm(1024), cond);
    add(reg, reg, imm(offset), cond);
  }
}                  
// Bytecode dispatch table for ARM Interpreter/Compiler
void GPTableGenerator::generate_arm_bytecode_dispatch_table()
{
  int i;
  bind("gp_base_label");
  set_current_commented_offset(0);
  set_use_offset_comments(true);

  for (i = 0; i <= 253; i++) {
    Bytecodes::Code bc = (Bytecodes::Code) i;
    if (Bytecodes::is_defined(bc) && !GenerateGPTableOnly) {
      char buffer[256];
      if (GenerateGNUCode) {
        jvm_sprintf(buffer, "bc_impl_%-30s /* 0x%x */", Bytecodes::name(bc),
                    (int)bc);
      } else {
        jvm_sprintf(buffer, "bc_impl_%-30s ; 0x%x", Bytecodes::name(bc), 
                    (int)bc);
      }
      define_long(buffer);
    } else {
      eol_comment("undefined bytecode 0x%x", bc);
      define_long(0);
    }
  }

  if (ENABLE_DISPATCH_TABLE_PADDING) {
    define_long("bytecode_dispatch_0x0FE");
    define_long("bytecode_dispatch_0x0FF");
    define_long("bytecode_dispatch_0x100");
    define_long("bytecode_dispatch_0x101");
    define_long("bytecode_dispatch_0x102");
    define_long("bytecode_dispatch_0x103");
    define_long("bytecode_dispatch_0x104");
    define_long("bytecode_dispatch_0x105");
  }
  define_long(0);                           // 255 or 262
  define_long(0);                           // 256 or 263
}