lit_cpointer_t
serializer_get_literal_cp_by_uid (uint8_t id, opcode_counter_t oc)
{
  if (bytecode_data.lit_id_hash == null_hash)
  {
    return INVALID_LITERAL;
  }
  return lit_id_hash_table_lookup (bytecode_data.lit_id_hash, id, oc);
}
Exemple #2
0
/**
 * Convert literal id (operand value of instruction) to compressed pointer to literal
 *
 * Bytecode is divided into blocks of fixed size and each block has independent encoding of variable names,
 * which are represented by 8 bit numbers - ids.
 * This function performs conversion from id to literal.
 *
 * @return compressed pointer to literal
 */
lit_cpointer_t
serializer_get_literal_cp_by_uid (uint8_t id, /**< literal idx */
                                  const vm_instr_t *instrs_p, /**< pointer to bytecode */
                                  vm_instr_counter_t oc) /**< position in the bytecode */
{
  lit_id_hash_table *lit_id_hash = GET_HASH_TABLE_FOR_BYTECODE (instrs_p == NULL ? bytecode_data.instrs_p : instrs_p);
  if (lit_id_hash == null_hash)
  {
    return INVALID_LITERAL;
  }
  return lit_id_hash_table_lookup (lit_id_hash, id, oc);
} /* serializer_get_literal_cp_by_uid */
/**
 * Convert literal id (operand value of instruction) to compressed pointer to literal
 *
 * Bytecode is divided into blocks of fixed size and each block has independent encoding of variable names,
 * which are represented by 8 bit numbers - ids.
 * This function performs conversion from id to literal.
 *
 * @return compressed pointer to literal
 */
lit_cpointer_t
bc_get_literal_cp_by_uid (uint8_t id, /**< literal idx */
                          const bytecode_data_header_t *bytecode_data_p, /**< pointer to bytecode */
                          vm_instr_counter_t oc) /**< position in the bytecode */
{
  JERRY_ASSERT (bytecode_data_p);

  lit_id_hash_table *lit_id_hash = MEM_CP_GET_POINTER (lit_id_hash_table, bytecode_data_p->lit_id_hash_cp);

  if (lit_id_hash == NULL)
  {
    return INVALID_LITERAL;
  }

  return lit_id_hash_table_lookup (lit_id_hash, id, oc);
} /* bc_get_literal_cp_by_uid */
Exemple #4
0
/**
 * Convert literal id (operand value of instruction) to compressed pointer to literal
 *
 * Bytecode is divided into blocks of fixed size and each block has independent encoding of variable names,
 * which are represented by 8 bit numbers - ids.
 * This function performs conversion from id to literal.
 *
 * @return compressed pointer to literal
 */
lit_cpointer_t
serializer_get_literal_cp_by_uid (uint8_t id, /**< literal idx */
                                  const bytecode_data_header_t *bytecode_data_p, /**< pointer to bytecode */
                                  vm_instr_counter_t oc) /**< position in the bytecode */
{
  lit_id_hash_table *lit_id_hash = null_hash;
  if (bytecode_data_p)
  {
    lit_id_hash = MEM_CP_GET_POINTER (lit_id_hash_table, bytecode_data_p->lit_id_hash_cp);
  }
  else
  {
    lit_id_hash = MEM_CP_GET_POINTER (lit_id_hash_table, first_bytecode_header_p->lit_id_hash_cp);
  }

  if (lit_id_hash == null_hash)
  {
    return INVALID_LITERAL;
  }

  return lit_id_hash_table_lookup (lit_id_hash, id, oc);
} /* serializer_get_literal_cp_by_uid */