Skip to content

Commit

Permalink
Changed functions in sub.c to meet standards
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net>
  • Loading branch information
schallert authored and leto committed Dec 4, 2010
1 parent 6702284 commit 6233b6e
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion include/parrot/oplib/core_ops.h
Expand Up @@ -51,7 +51,7 @@ op_lib_t *Parrot_DynOp_core_2_10_1(PARROT_INTERP, long init);
opcode_t * Parrot_yield(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_tailcall_p(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_returncc(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_capture_lex_p(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_sub_capture_lex_p(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_newclosure_p_p(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_set_args_pc(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_get_params_pc(opcode_t *, PARROT_INTERP);
Expand Down
36 changes: 18 additions & 18 deletions include/parrot/sub.h
Expand Up @@ -162,7 +162,7 @@ typedef struct Parrot_Context_info {
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */

PARROT_EXPORT
void Parrot_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
void Parrot_sub_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*sub_pmc);
Expand All @@ -179,7 +179,7 @@ int Parrot_Context_get_info(PARROT_INTERP,
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
STRING* Parrot_Context_infostr(PARROT_INTERP, ARGIN(PMC *ctx))
STRING* Parrot_sub_Context_infostr(PARROT_INTERP, ARGIN(PMC *ctx))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

Expand All @@ -198,22 +198,22 @@ void * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, ARGIN(PMC *subclass))
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
PMC* parrot_new_closure(PARROT_INTERP, ARGIN(PMC *sub_pmc))
PMC* Parrot_sub_new_closure(PARROT_INTERP, ARGIN(PMC *sub_pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

void mark_context_start(void);
void Parrot_continuation_check(PARROT_INTERP, ARGIN(const PMC *pmc))
void Parrot_sub_continuation_check(PARROT_INTERP, ARGIN(const PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

void Parrot_continuation_rewind_environment(PARROT_INTERP, ARGIN(PMC *pmc))
void Parrot_sub_continuation_rewind_environment(PARROT_INTERP, ARGIN(PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
PMC* Parrot_find_dynamic_pad(PARROT_INTERP,
PMC* Parrot_sub_find_dynamic_pad(PARROT_INTERP,
ARGIN(STRING *lex_name),
ARGIN(PMC *ctx))
__attribute__nonnull__(1)
Expand All @@ -222,32 +222,32 @@ PMC* Parrot_find_dynamic_pad(PARROT_INTERP,

PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
PMC* Parrot_find_pad(PARROT_INTERP,
PMC* Parrot_sub_find_pad(PARROT_INTERP,
ARGIN(STRING *lex_name),
ARGIN(PMC *ctx))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);

PARROT_CANNOT_RETURN_NULL
STRING * Parrot_Sub_get_filename_from_pc(PARROT_INTERP,
STRING * Parrot_sub_get_filename_from_pc(PARROT_INTERP,
ARGIN_NULLOK(PMC *subpmc),
ARGIN_NULLOK(opcode_t *pc))
__attribute__nonnull__(1);

INTVAL Parrot_Sub_get_line_from_pc(PARROT_INTERP,
INTVAL Parrot_sub_get_line_from_pc(PARROT_INTERP,
ARGIN_NULLOK(PMC *subpmc),
ARGIN_NULLOK(opcode_t *pc))
__attribute__nonnull__(1);

#define ASSERT_ARGS_Parrot_capture_lex __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_capture_lex __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(sub_pmc))
#define ASSERT_ARGS_Parrot_Context_get_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(info))
#define ASSERT_ARGS_Parrot_Context_infostr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_Context_infostr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_full_sub_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Expand All @@ -256,29 +256,29 @@ INTVAL Parrot_Sub_get_line_from_pc(PARROT_INTERP,
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(subclass))
#define ASSERT_ARGS_parrot_new_closure __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_new_closure __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(sub_pmc))
#define ASSERT_ARGS_mark_context_start __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_continuation_check __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_continuation_check __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_continuation_rewind_environment \
#define ASSERT_ARGS_Parrot_sub_continuation_rewind_environment \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_find_dynamic_pad __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_find_dynamic_pad __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lex_name) \
, PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_find_pad __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_find_pad __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lex_name) \
, PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_Sub_get_filename_from_pc \
#define ASSERT_ARGS_Parrot_sub_get_filename_from_pc \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_Sub_get_line_from_pc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
#define ASSERT_ARGS_Parrot_sub_get_line_from_pc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/sub.c */
Expand Down
4 changes: 2 additions & 2 deletions src/debug.c
Expand Up @@ -3267,7 +3267,7 @@ PDB_backtrace(PARROT_INTERP)
PMC *ctx = CURRENT_CONTEXT(interp);

if (!PMC_IS_NULL(sub)) {
str = Parrot_Context_infostr(interp, ctx);
str = Parrot_sub_Context_infostr(interp, ctx);
if (str) {
Parrot_io_eprintf(interp, "%Ss", str);
if (interp->code->annotations) {
Expand Down Expand Up @@ -3309,7 +3309,7 @@ PDB_backtrace(PARROT_INTERP)
break;


str = Parrot_Context_infostr(interp, Parrot_pcc_get_caller_ctx(interp, ctx));
str = Parrot_sub_Context_infostr(interp, Parrot_pcc_get_caller_ctx(interp, ctx));


if (!str)
Expand Down
2 changes: 1 addition & 1 deletion src/namespace.c
Expand Up @@ -688,7 +688,7 @@ Parrot_ns_find_named_item(PARROT_INTERP, ARGIN(STRING *name), SHIM(void *next))
{
ASSERT_ARGS(Parrot_ns_find_named_item)
PMC * const ctx = CURRENT_CONTEXT(interp);
PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, name, ctx);
PMC * g = PMCNULL;

if (!PMC_IS_NULL(lex_pad)) {
Expand Down
4 changes: 2 additions & 2 deletions src/ops/core.ops
Expand Up @@ -440,11 +440,11 @@ inline op returncc() :flow {
}

inline op capture_lex(invar PMC) {
Parrot_capture_lex(interp, $1);
Parrot_sub_capture_lex(interp, $1);
}

inline op newclosure(out PMC, invar PMC) {
$1 = parrot_new_closure(interp, $2);
$1 = Parrot_sub_new_closure(interp, $2);
}

=back
Expand Down
30 changes: 15 additions & 15 deletions src/ops/core_ops.c
Expand Up @@ -105,7 +105,7 @@ static op_func_t core_op_func_table[1074] = {
Parrot_yield, /* 27 */
Parrot_tailcall_p, /* 28 */
Parrot_returncc, /* 29 */
Parrot_capture_lex_p, /* 30 */
Parrot_sub_capture_lex_p, /* 30 */
Parrot_newclosure_p_p, /* 31 */
Parrot_set_args_pc, /* 32 */
Parrot_get_params_pc, /* 33 */
Expand Down Expand Up @@ -1553,7 +1553,7 @@ static op_info_t core_op_info_table[1074] = {
/* type PARROT_INLINE_OP, */
"capture_lex",
"capture_lex_p",
"Parrot_capture_lex_p",
"Parrot_sub_capture_lex_p",
/* "", body */
0,
2,
Expand Down Expand Up @@ -15388,16 +15388,16 @@ Parrot_returncc(opcode_t *cur_opcode, PARROT_INTERP) {
}

opcode_t *
Parrot_capture_lex_p(opcode_t *cur_opcode, PARROT_INTERP) {
Parrot_sub_capture_lex_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
Parrot_capture_lex(interp, PREG(1));
Parrot_sub_capture_lex(interp, PREG(1));

return (opcode_t *)cur_opcode + 2;}

opcode_t *
Parrot_newclosure_p_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = parrot_new_closure(interp, PREG(2));
PREG(1) = Parrot_sub_new_closure(interp, PREG(2));

return (opcode_t *)cur_opcode + 3;}

Expand Down Expand Up @@ -23514,7 +23514,7 @@ Parrot_store_lex_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = SREG(1);
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);

if (PMC_IS_NULL(lex_pad)) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL,
Expand All @@ -23530,7 +23530,7 @@ Parrot_store_lex_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = SCONST(1);
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);

if (PMC_IS_NULL(lex_pad)) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL,
Expand All @@ -23550,7 +23550,7 @@ Parrot_store_dynamic_lex_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const lex_pad =
PMC_IS_NULL(ctx)
? PMCNULL
: Parrot_find_dynamic_pad(interp, lex_name, ctx);
: Parrot_sub_find_dynamic_pad(interp, lex_name, ctx);

if (PMC_IS_NULL(lex_pad)) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL,
Expand All @@ -23570,7 +23570,7 @@ Parrot_store_dynamic_lex_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const lex_pad =
PMC_IS_NULL(ctx)
? PMCNULL
: Parrot_find_dynamic_pad(interp, lex_name, ctx);
: Parrot_sub_find_dynamic_pad(interp, lex_name, ctx);

if (PMC_IS_NULL(lex_pad)) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL,
Expand All @@ -23586,7 +23586,7 @@ Parrot_find_lex_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = SREG(2);
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);

PMC * const result =
PMC_IS_NULL(lex_pad)
Expand All @@ -23601,7 +23601,7 @@ Parrot_find_lex_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = SCONST(2);
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);

PMC * const result =
PMC_IS_NULL(lex_pad)
Expand All @@ -23620,7 +23620,7 @@ Parrot_find_dynamic_lex_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const lex_pad =
PMC_IS_NULL(ctx)
? PMCNULL
: Parrot_find_dynamic_pad(interp, lex_name, ctx);
: Parrot_sub_find_dynamic_pad(interp, lex_name, ctx);
PMC * const result =
PMC_IS_NULL(lex_pad)
? PMCNULL
Expand All @@ -23638,7 +23638,7 @@ Parrot_find_dynamic_lex_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
PMC * const lex_pad =
PMC_IS_NULL(ctx)
? PMCNULL
: Parrot_find_dynamic_pad(interp, lex_name, ctx);
: Parrot_sub_find_dynamic_pad(interp, lex_name, ctx);
PMC * const result =
PMC_IS_NULL(lex_pad)
? PMCNULL
Expand All @@ -23658,7 +23658,7 @@ Parrot_find_caller_lex_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
!PMC_IS_NULL(ctx) && PMC_IS_NULL(result);
ctx = Parrot_pcc_get_caller_ctx(interp, ctx))
{
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);
if (!PMC_IS_NULL(lex_pad)) {
result = VTABLE_get_pmc_keyed_str(interp, lex_pad, lex_name);
}
Expand All @@ -23679,7 +23679,7 @@ Parrot_find_caller_lex_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
!PMC_IS_NULL(ctx) && PMC_IS_NULL(result);
ctx = Parrot_pcc_get_caller_ctx(interp, ctx))
{
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);
if (!PMC_IS_NULL(lex_pad)) {
result = VTABLE_get_pmc_keyed_str(interp, lex_pad, lex_name);
}
Expand Down
10 changes: 5 additions & 5 deletions src/ops/var.ops
Expand Up @@ -41,7 +41,7 @@ Parrot's LexPad throws an exception for unknown names.
op store_lex(in STR, invar PMC) {
PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = $1;
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);

if (PMC_IS_NULL(lex_pad)) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL,
Expand Down Expand Up @@ -70,7 +70,7 @@ op store_dynamic_lex(in STR, invar PMC) {
PMC * const lex_pad =
PMC_IS_NULL(ctx)
? PMCNULL
: Parrot_find_dynamic_pad(interp, lex_name, ctx);
: Parrot_sub_find_dynamic_pad(interp, lex_name, ctx);

if (PMC_IS_NULL(lex_pad)) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL,
Expand All @@ -93,7 +93,7 @@ Null PMC if the variable is not found.
op find_lex(out PMC, in STR) {
PMC * const ctx = CURRENT_CONTEXT(interp);
STRING * const lex_name = $2;
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);

PMC * const result =
PMC_IS_NULL(lex_pad)
Expand All @@ -120,7 +120,7 @@ op find_dynamic_lex(out PMC, in STR) {
PMC * const lex_pad =
PMC_IS_NULL(ctx)
? PMCNULL
: Parrot_find_dynamic_pad(interp, lex_name, ctx);
: Parrot_sub_find_dynamic_pad(interp, lex_name, ctx);
PMC * const result =
PMC_IS_NULL(lex_pad)
? PMCNULL
Expand All @@ -146,7 +146,7 @@ op find_caller_lex(out PMC, in STR) {
!PMC_IS_NULL(ctx) && PMC_IS_NULL(result);
ctx = Parrot_pcc_get_caller_ctx(interp, ctx))
{
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const lex_pad = Parrot_sub_find_pad(interp, lex_name, ctx);
if (!PMC_IS_NULL(lex_pad)) {
result = VTABLE_get_pmc_keyed_str(interp, lex_pad, lex_name);
}
Expand Down
6 changes: 3 additions & 3 deletions src/pmc/continuation.pmc
Expand Up @@ -259,8 +259,8 @@ destination to continue execution.
GET_ATTR_to_ctx(INTERP, SELF, to_ctx);
GET_ATTR_to_call_object(INTERP, SELF, call_obj);

Parrot_continuation_check(INTERP, SELF);
Parrot_continuation_rewind_environment(INTERP, SELF);
Parrot_sub_continuation_check(INTERP, SELF);
Parrot_sub_continuation_rewind_environment(INTERP, SELF);

if (!PMC_IS_NULL(from_obj))
Parrot_pcc_set_signature(INTERP, CURRENT_CONTEXT(INTERP), from_obj);
Expand All @@ -287,7 +287,7 @@ Experimental: returns caller info as a STRING.
PMC *to_ctx;

GET_ATTR_to_ctx(INTERP, SELF, to_ctx);
return Parrot_Context_infostr(INTERP, to_ctx);
return Parrot_sub_Context_infostr(INTERP, to_ctx);
}


Expand Down
4 changes: 2 additions & 2 deletions src/pmc/exceptionhandler.pmc
Expand Up @@ -142,8 +142,8 @@ Set up the environment for the exception handler to be invoked.
VTABLE opcode_t *invoke(void *next) {
opcode_t * const pc = PARROT_CONTINUATION(SELF)->address;

Parrot_continuation_check(INTERP, SELF);
Parrot_continuation_rewind_environment(INTERP, SELF);
Parrot_sub_continuation_check(INTERP, SELF);
Parrot_sub_continuation_rewind_environment(INTERP, SELF);

/* switch code segment if needed */
if (INTERP->code != PARROT_CONTINUATION(SELF)->seg)
Expand Down
6 changes: 3 additions & 3 deletions src/runcore/profiling.c
Expand Up @@ -527,10 +527,10 @@ ARGIN(PMC *ctx_pmc))
INTVAL line_num = hash_value_to_int(interp, runcore->line_cache,
parrot_hash_get(interp, runcore->line_cache, ctx->current_pc));

/* Parrot_Sub_get_line_from_pc eats up about 20-30% of execution time
/* Parrot_sub_get_line_from_pc eats up about 20-30% of execution time
* *with* this cache in place. */
if (line_num == 0) {
line_num = Parrot_Sub_get_line_from_pc(interp,
line_num = Parrot_sub_get_line_from_pc(interp,
Parrot_pcc_get_sub(interp, ctx_pmc), ctx->current_pc);
parrot_hash_put(interp, runcore->line_cache, ctx->current_pc, (void *) line_num);
}
Expand Down Expand Up @@ -762,7 +762,7 @@ ARGIN(PMC* ctx_pmc), ARGIN(opcode_t *pc))

ASSERT_ARGS(get_filename_cstr)

STRING *filename = Parrot_Sub_get_filename_from_pc(interp,
STRING *filename = Parrot_sub_get_filename_from_pc(interp,
Parrot_pcc_get_sub(interp, ctx_pmc), pc);
char *filename_cstr = Parrot_str_to_cstring(interp, filename);

Expand Down

0 comments on commit 6233b6e

Please sign in to comment.