Skip to content

Commit

Permalink
Merge branch 'master' into jit_prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Mar 20, 2011
2 parents 60c8c62 + 6bd28a1 commit ec9b285
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/pmc/packfilebytecodesegment.pmc
Expand Up @@ -127,6 +127,36 @@ Return a pointer to a PackFile_ByteCode* built from this PMC's data.
return bc;
}

/*
=item C<void set_pointer()>

Initialize PackfileBytecodeSegment from PackFile_Bytecode*

=cut
*/
VTABLE void set_pointer(void *pointer) {
const PackFile_ByteCode * const pfseg =
(const PackFile_ByteCode *)pointer;
opcode_t i, j;
PMC *op_map;

GET_ATTR_op_map(INTERP, SELF, op_map);

/* Recreate OpMapping */
for (i = 0; i < pfseg->op_mapping.n_libs; i++) {
PackFile_ByteCode_OpMappingEntry entry = pfseg->op_mapping.libs[i];
for (j = 0; j < entry.n_ops; j++) {
opcode_t lib_op = entry.lib_ops[j];
VTABLE_get_integer_keyed_str(INTERP, op_map,
Parrot_str_from_platform_cstring(INTERP, entry.lib->op_info_table[lib_op].full_name));
}
}

/* TODO. Figure out how to generate OpLibs and where to store them */

SUPER(pointer);
}


/*

Expand Down
6 changes: 6 additions & 0 deletions src/pmc/packfileopmap.pmc
Expand Up @@ -177,6 +177,8 @@ Get Op PMC by name.
/*
=item C<get_string_keyed_int()>

=item C<get_pmc_keyed_int()>

Lookup op name by mapped id.

=cut
Expand All @@ -187,6 +189,10 @@ Lookup op name by mapped id.
return VTABLE_get_string_keyed_int(INTERP, ops, key);
}

VTABLE PMC* get_pmc_keyed_int(INTVAL key) {
Parrot_pmc_box_string(INTERP, STATICSELF.get_string_keyed_int(key));
}


/*

Expand Down

0 comments on commit ec9b285

Please sign in to comment.