Author: chromatic
Date: Thu Dec 18 17:57:06 2008
New Revision: 34094
Modified:
trunk/src/dynext.c
trunk/src/events.c
trunk/src/global.c
trunk/src/multidispatch.c
trunk/src/oo.c
trunk/src/pmc/default.pmc
trunk/src/pmc/eventhandler.pmc
trunk/src/pmc/exception.pmc
trunk/src/pmc/exceptionhandler.pmc
trunk/src/pmc/exporter.pmc
trunk/src/pmc/pmcproxy.pmc
trunk/src/pmc/role.pmc
trunk/src/pmc/scheduler.pmc
trunk/src/pmc/sub.pmc
trunk/src/pmc/task.pmc
trunk/src/scheduler.c
Log:
[src] Fixed all CONST_STRING macros so that they don't break across lines.
This should make it easier for picky compilers to get the #line numbers right.
Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c (original)
+++ trunk/src/dynext.c Thu Dec 18 17:57:06 2008
@@ -470,14 +470,18 @@
PMC *
Parrot_clone_lib_into(ARGMOD(Interp *d), ARGMOD(Interp *s), ARGIN(PMC
*lib_pmc))
{
+ STRING * const filename = CONST_STRING(s, "_filename");
+ STRING * const libname = CONST_STRING(s, "_lib_name");
+ STRING * const type_str = CONST_STRING(s, "_type");
+ STRING * const ops = CONST_STRING(s, "Ops");
+
STRING * const wo_ext = clone_string_into(d, s,
- VTABLE_getprop(s, lib_pmc, CONST_STRING(s, "_filename")));
+ VTABLE_getprop(s, lib_pmc, filename));
STRING * const lib_name = clone_string_into(d, s,
- VTABLE_getprop(s, lib_pmc, CONST_STRING(s, "_lib_name")));
+ VTABLE_getprop(s, lib_pmc, libname));
void * const handle = PMC_data(lib_pmc);
STRING * const type =
- VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, CONST_STRING(s,
"_type")));
- STRING * const ops = CONST_STRING(s, "Ops");
+ VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, type_str));
if (!string_equal(s, type, ops)) {
/* we can't clone oplibs in the normal way, since they're actually
Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c (original)
+++ trunk/src/events.c Thu Dec 18 17:57:06 2008
@@ -1357,9 +1357,10 @@
* installed: set severity to EXCEPT_exit
*/
{
- PMC *exception = Parrot_ex_build_exception(interp,
- EXCEPT_exit, exit_code,
- CONST_STRING(interp, "Caught signal."));
+ STRING * const message = CONST_STRING(interp, "Caught
signal.");
+ PMC *exception = Parrot_ex_build_exception(interp,
+ EXCEPT_exit, exit_code, message);
+
Parrot_ex_throw_from_c(interp, exception);
}
break;
Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c (original)
+++ trunk/src/global.c Thu Dec 18 17:57:06 2008
@@ -396,8 +396,7 @@
Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
{
PMC *names;
- Parrot_PCCINVOKE(interp, _namespace,
- CONST_STRING(interp, "get_name"), "->P", &names);
+ Parrot_PCCINVOKE(interp, _namespace, CONST_STRING(interp, "get_name"),
"->P", &names);
return names;
}
Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c (original)
+++ trunk/src/multidispatch.c Thu Dec 18 17:57:06 2008
@@ -1427,8 +1427,10 @@
Parrot_mmd_add_multi_from_long_sig(PARROT_INTERP,
ARGIN(STRING *sub_name), ARGIN(STRING *long_sig), ARGIN(PMC *sub_obj))
{
- PMC *type_list = string_split(interp, CONST_STRING(interp, ","),
long_sig);
- STRING *ns_name = VTABLE_get_string_keyed_int(interp, type_list, 0);
+ PMC *type_list = string_split(interp, CONST_STRING(interp, ","),
long_sig);
+ STRING *ns_name = VTABLE_get_string_keyed_int(interp, type_list, 0);
+ STRING *sub_str = CONST_STRING(interp, "Sub");
+ STRING *closure_str = CONST_STRING(interp, "Closure");
/* Attach a type tuple array to the sub for multi dispatch */
PMC *multi_sig = mmd_build_type_tuple_from_type_list(interp, type_list);
@@ -1436,8 +1438,8 @@
if (sub_obj->vtable->base_type == enum_class_NCI) {
PMC_pmc_val(sub_obj) = multi_sig;
}
- else if (VTABLE_isa(interp, sub_obj, CONST_STRING(interp, "Sub"))
- || VTABLE_isa(interp, sub_obj, CONST_STRING(interp, "Closure"))) {
+ else if (VTABLE_isa(interp, sub_obj, sub_str)
+ || VTABLE_isa(interp, sub_obj, closure_str)) {
PMC_sub(sub_obj)->multi_signature = multi_sig;
}
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c (original)
+++ trunk/src/oo.c Thu Dec 18 17:57:06 2008
@@ -88,8 +88,7 @@
return;
/* Import any methods. */
- Parrot_PCCINVOKE(interp, ns,
- CONST_STRING(interp, "get_associated_methods"), "->P", &methods);
+ Parrot_PCCINVOKE(interp, ns, CONST_STRING(interp,
"get_associated_methods"), "->P", &methods);
if (!PMC_IS_NULL(methods)) {
PMC * const iter = VTABLE_get_iter(interp, methods);
@@ -103,8 +102,7 @@
}
/* Import any vtable methods. */
- Parrot_PCCINVOKE(interp, ns,
- CONST_STRING(interp, "get_associated_vtable_methods"), "->P",
&vtable_overrides);
+ Parrot_PCCINVOKE(interp, ns, CONST_STRING(interp,
"get_associated_vtable_methods"), "->P", &vtable_overrides);
if (!PMC_IS_NULL(vtable_overrides)) {
PMC * const iter = VTABLE_get_iter(interp, vtable_overrides);
@@ -119,8 +117,7 @@
STRING *vtable_name = string_from_cstring(interp, meth_c, 0);
/* Strip leading underscores in the vtable name */
- if (string_str_index(interp, vtable_name,
- CONST_STRING(interp, "__"), 0) == 0) {
+ if (string_str_index(interp, vtable_name, CONST_STRING(interp,
"__"), 0) == 0) {
vtable_name = string_substr(interp, vtable_name, 2,
string_length(interp, vtable_name) - 2, NULL, 0);
}
@@ -820,8 +817,7 @@
if (!string_equal(interp, method_name, CONST_STRING(interp,
"__get_string")))
- return find_method_direct_1(interp, _class,
- CONST_STRING(interp, "__get_repr"));
+ return find_method_direct_1(interp, _class, CONST_STRING(interp,
"__get_repr"));
return PMCNULL;
}
@@ -1208,8 +1204,7 @@
return;
/* Get the methods from the role. */
- Parrot_PCCINVOKE(interp, role,
- CONST_STRING(interp, "methods"), "->P", &methods);
+ Parrot_PCCINVOKE(interp, role, CONST_STRING(interp, "methods"), "->P",
&methods);
if (PMC_IS_NULL(methods))
return;
@@ -1325,8 +1320,7 @@
* that it did itself. Note that we already have the correct methods
* as roles "flatten" the methods they get from other roles into their
* own method list. */
- Parrot_PCCINVOKE(interp, role,
- CONST_STRING(interp, "roles"), "->P", &roles_of_role);
+ Parrot_PCCINVOKE(interp, role, CONST_STRING(interp, "roles"), "->P",
&roles_of_role);
roles_of_role_count = VTABLE_elements(interp, roles_of_role);
for (i = 0; i < roles_of_role_count; i++) {
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc (original)
+++ trunk/src/pmc/default.pmc Thu Dec 18 17:57:06 2008
@@ -41,8 +41,10 @@
static STRING *
caller(PARROT_INTERP, PMC *pmc /*NULLOK*/)
{
- return pmc && pmc->vtable && pmc->vtable->whoami ?
- VTABLE_name(interp, pmc) : CONST_STRING(interp, "(null)");
+ STRING * const null_str = CONST_STRING(interp, "(null)");
+
+ return pmc && pmc->vtable && pmc->vtable->whoami
+ ? VTABLE_name(interp, pmc) : null_str;
}
/*
Modified: trunk/src/pmc/eventhandler.pmc
==============================================================================
--- trunk/src/pmc/eventhandler.pmc (original)
+++ trunk/src/pmc/eventhandler.pmc Thu Dec 18 17:57:06 2008
@@ -92,14 +92,10 @@
code = data;
}
else if (VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Hash"))) {
- code =
- VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP,
"code"));
- interpreter =
- VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP,
"interp"));
- type =
- VTABLE_get_string_keyed_str(INTERP, data, CONST_STRING(INTERP,
"type"));
- priority =
- VTABLE_get_integer_keyed_str(INTERP, data,
CONST_STRING(INTERP, "priority"));
+ code = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP,
"code"));
+ interpreter = VTABLE_get_pmc_keyed_str(INTERP, data,
CONST_STRING(INTERP, "interp"));
+ type = VTABLE_get_string_keyed_str(INTERP, data,
CONST_STRING(INTERP, "type"));
+ priority = VTABLE_get_integer_keyed_str(INTERP, data,
CONST_STRING(INTERP, "priority"));
}
else {
Parrot_ex_throw_from_c_args(INTERP, NULL,
EXCEPTION_INVALID_OPERATION,
Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc (original)
+++ trunk/src/pmc/exception.pmc Thu Dec 18 17:57:06 2008
@@ -111,8 +111,12 @@
*/
VTABLE void init_pmc(PMC *values) {
+ STRING * const severity = CONST_STRING(interp, "severity");
+ STRING * const message = CONST_STRING(interp, "message");
+
Parrot_Exception_attributes * const core_struct =
mem_allocate_zeroed_typed(Parrot_Exception_attributes);
+
INTVAL ishash = VTABLE_isa(interp, values, CONST_STRING(interp,
'Hash'));
/* Set flags for custom DOD mark and destroy. */
@@ -121,13 +125,13 @@
/* Set up the core struct and default values for the exception object.
*/
PMC_data(SELF) = core_struct;
- core_struct->severity = ishash ?
- VTABLE_get_integer_keyed_str(interp, values, CONST_STRING(interp,
'severity')) :
- EXCEPT_error;
+ core_struct->severity = ishash
+ ? VTABLE_get_integer_keyed_str(interp, values, severity)
+ : EXCEPT_error;
core_struct->handled = 0;
- core_struct->message = ishash ?
- VTABLE_get_string_keyed_str(interp, values, CONST_STRING(interp,
'message')) :
- VTABLE_get_string(interp, values);
+ core_struct->message = ishash
+ ? VTABLE_get_string_keyed_str(interp, values, message)
+ : VTABLE_get_string(interp, values);
core_struct->payload = PMCNULL;
core_struct->resume = PMCNULL;
core_struct->backtrace = PMCNULL;
@@ -523,8 +527,10 @@
*/
VTABLE INTVAL is_equal(PMC *value) {
+ STRING * const exception_str = CONST_STRING(INTERP, "Exception");
+
if (value->vtable->base_type == SELF->vtable->base_type
- && VTABLE_isa(INTERP, value, CONST_STRING(INTERP, "Exception"))) {
+ && VTABLE_isa(INTERP, value, exception_str)) {
INTVAL self_compare, value_compare;
GET_ATTR_type(interp, SELF, self_compare);
GET_ATTR_type(interp, value, value_compare);
Modified: trunk/src/pmc/exceptionhandler.pmc
==============================================================================
--- trunk/src/pmc/exceptionhandler.pmc (original)
+++ trunk/src/pmc/exceptionhandler.pmc Thu Dec 18 17:57:06 2008
@@ -191,13 +191,15 @@
*/
METHOD can_handle(PMC *exception) {
+ STRING * const sev = CONST_STRING(interp, "severity");
+ STRING * const ex_str = CONST_STRING(interp, "Exception");
+
Parrot_ExceptionHandler_attributes * const core_struct =
PARROT_EXCEPTIONHANDLER(SELF);
- INTVAL severity =
- VTABLE_get_integer_keyed_str(interp, exception,
CONST_STRING(interp, "severity"));
+ INTVAL severity = VTABLE_get_integer_keyed_str(interp, exception, sev);
if (exception->vtable->base_type == enum_class_Exception
- || VTABLE_isa(INTERP, exception, CONST_STRING(INTERP, "Exception"))) {
+ || VTABLE_isa(INTERP, exception, ex_str)) {
if (severity < core_struct->min_severity) {
RETURN(INTVAL 0);
Modified: trunk/src/pmc/exporter.pmc
==============================================================================
--- trunk/src/pmc/exporter.pmc (original)
+++ trunk/src/pmc/exporter.pmc Thu Dec 18 17:57:06 2008
@@ -245,9 +245,10 @@
*/
METHOD globals(PMC *glb :optional, int got_glb :opt_flag) {
- STRING *s_str = CONST_STRING(interp, "String");
- STRING *s_arr = CONST_STRING(interp, "array");
- STRING *s_hash = CONST_STRING(interp, "hash");
+ STRING * const s_str = CONST_STRING(interp, "String");
+ STRING * const s_arr = CONST_STRING(interp, "array");
+ STRING * const s_hash = CONST_STRING(interp, "hash");
+ STRING * const s_space = CONST_STRING(interp, " ");
if (got_glb) {
STRING * const s_empty = CONST_STRING(interp, "");
@@ -261,9 +262,8 @@
INTVAL n, i;
if (VTABLE_isa(interp, glb, s_str))
- glb_array = string_split(interp,
- CONST_STRING(interp, " "),
- VTABLE_get_string(interp, glb));
+ glb_array = string_split(interp, s_space,
+ VTABLE_get_string(interp, glb));
else
glb_array = glb;
Modified: trunk/src/pmc/pmcproxy.pmc
==============================================================================
--- trunk/src/pmc/pmcproxy.pmc (original)
+++ trunk/src/pmc/pmcproxy.pmc Thu Dec 18 17:57:06 2008
@@ -154,8 +154,7 @@
/* Link the proxy and the namespace, caching the proxy object for
* later retrieval on class lookup. */
- Parrot_PCCINVOKE(interp, proxy_info->_namespace,
- CONST_STRING(interp, "set_class"), "P->", SELF);
+ Parrot_PCCINVOKE(interp, proxy_info->_namespace,
CONST_STRING(interp, "set_class"), "P->", SELF);
/* Extract any methods from the namespace */
Parrot_oo_extract_methods_from_namespace(interp, SELF,
@@ -372,16 +371,22 @@
{
/* Create a hash, then use inspect_str to get all of the data to
* fill it up with. */
+ STRING * const name_str = CONST_STRING(interp, "name");
+ STRING * const ns_str = CONST_STRING(interp, "namespace");
+ STRING * const meth_str = CONST_STRING(interp, "methods");
+ STRING * const parents_str = CONST_STRING(interp, "parents");
+
PMC * const metadata = pmc_new(interp, enum_class_Hash);
- VTABLE_set_pmc_keyed_str(interp, metadata, CONST_STRING(interp,
"name"),
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "name")));
- VTABLE_set_pmc_keyed_str(interp, metadata, CONST_STRING(interp,
"namespace"),
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp,
"namespace")));
- VTABLE_set_pmc_keyed_str(interp, metadata, CONST_STRING(interp,
"methods"),
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "methods")));
- VTABLE_set_pmc_keyed_str(interp, metadata, CONST_STRING(interp,
"parents"),
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "parents")));
+ VTABLE_set_pmc_keyed_str(interp, metadata, name_str,
+ VTABLE_inspect_str(interp, SELF, name_str));
+ VTABLE_set_pmc_keyed_str(interp, metadata, ns_str,
+ VTABLE_inspect_str(interp, SELF, ns_str));
+ VTABLE_set_pmc_keyed_str(interp, metadata, meth_str,
+ VTABLE_inspect_str(interp, SELF, meth_str));
+ VTABLE_set_pmc_keyed_str(interp, metadata, parents_str,
+ VTABLE_inspect_str(interp, SELF, parents_str));
+
return metadata;
}
Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc (original)
+++ trunk/src/pmc/role.pmc Thu Dec 18 17:57:06 2008
@@ -631,8 +631,7 @@
*/
METHOD attributes() {
- PMC *ret_attrib_metadata =
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp,
"attributes"));
+ PMC *ret_attrib_metadata = VTABLE_inspect_str(interp, SELF,
CONST_STRING(interp, "attributes"));
RETURN(PMC *ret_attrib_metadata);
}
Modified: trunk/src/pmc/scheduler.pmc
==============================================================================
--- trunk/src/pmc/scheduler.pmc (original)
+++ trunk/src/pmc/scheduler.pmc Thu Dec 18 17:57:06 2008
@@ -459,13 +459,15 @@
*/
METHOD find_handler(PMC *task) {
- PMC *iter;
+ STRING * const handled_str = CONST_STRING(interp, "handled");
+ STRING * const iter_str = CONST_STRING(interp, "handler_iter");
+ PMC *iter;
/* Exceptions store the handler iterator for rethrow, other kinds of
* tasks don't (though they could). */
if (task->vtable->base_type == enum_class_Exception
- && VTABLE_get_integer_keyed_str(interp, task, CONST_STRING(interp,
"handled")) == -1) {
- iter = VTABLE_get_attr_str(interp, task, CONST_STRING(interp,
"handler_iter"));
+ && VTABLE_get_integer_keyed_str(interp, task, handled_str) == -1) {
+ iter = VTABLE_get_attr_str(interp, task, iter_str);
}
else {
PMC *handlers;
@@ -473,7 +475,7 @@
iter = VTABLE_get_iter(interp, handlers);
if (task->vtable->base_type == enum_class_Exception)
- VTABLE_set_attr_str(interp, task, CONST_STRING(interp,
"handler_iter"), iter);
+ VTABLE_set_attr_str(interp, task, iter_str, iter);
}
/* Loop from newest handler to oldest handler. */
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc (original)
+++ trunk/src/pmc/sub.pmc Thu Dec 18 17:57:06 2008
@@ -891,10 +891,9 @@
}
METHOD arity() {
- PMC *pos_required =
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp,
"pos_required"));
- PMC *named_required =
- VTABLE_inspect_str(interp, SELF, CONST_STRING(interp,
"named_required"));
+ PMC *pos_required = VTABLE_inspect_str(interp, SELF,
CONST_STRING(interp, "pos_required"));
+ PMC *named_required = VTABLE_inspect_str(interp, SELF,
CONST_STRING(interp, "named_required"));
+
INTVAL arity = VTABLE_get_integer(INTERP, pos_required) +
VTABLE_get_integer(INTERP, named_required);
Modified: trunk/src/pmc/task.pmc
==============================================================================
--- trunk/src/pmc/task.pmc (original)
+++ trunk/src/pmc/task.pmc Thu Dec 18 17:57:06 2008
@@ -169,10 +169,8 @@
else
core_struct->birthtime = 0.0;
- core_struct->codeblock =
- VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP,
"code"));
- core_struct->interp = (Parrot_Interp)
- VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP,
"data"));
+ core_struct->codeblock = VTABLE_get_pmc_keyed_str(INTERP, data,
CONST_STRING(INTERP, "code"));
+ core_struct->interp = (Parrot_Interp)VTABLE_get_pmc_keyed_str(INTERP,
data, CONST_STRING(INTERP, "data"));
}
/*
Modified: trunk/src/scheduler.c
==============================================================================
--- trunk/src/scheduler.c (original)
+++ trunk/src/scheduler.c Thu Dec 18 17:57:06 2008
@@ -130,8 +130,7 @@
else if (string_equal(interp, type, CONST_STRING(interp, "event")) ==
0) {
PMC * const handler = Parrot_cx_find_handler_for_task(interp,
task);
if (!PMC_IS_NULL(handler)) {
- PMC * handler_sub =
- VTABLE_get_attr_str(interp, handler, CONST_STRING(interp,
"code"));
+ PMC * handler_sub = VTABLE_get_attr_str(interp, handler,
CONST_STRING(interp, "code"));
Parrot_runops_fromc_args_event(interp, handler_sub,
"vPP", handler, task);
}
@@ -409,6 +408,7 @@
Parrot_cx_delete_suspend_for_gc(PARROT_INTERP)
{
if (interp->scheduler) {
+ STRING *suspend_str = CONST_STRING(interp, "suspend_for_gc");
Parrot_Scheduler_attributes * sched_struct =
PARROT_SCHEDULER(interp->scheduler);
INTVAL num_tasks, index;
@@ -425,8 +425,8 @@
for (index = 0; index < num_tasks; index++) {
PMC *message = VTABLE_get_pmc_keyed_int(interp,
sched_struct->messages, index);
if (!PMC_IS_NULL(message)
- && string_equal(interp, VTABLE_get_string(interp, message),
- CONST_STRING(interp, "suspend_for_gc")) == 0) {
+ && string_equal(interp, VTABLE_get_string(interp, message),
+ suspend_str) == 0) {
VTABLE_delete_keyed_int(interp, sched_struct->messages, index);
UNLOCK(sched_struct->msg_lock);
return message;
@@ -491,18 +491,21 @@
VTABLE_shift_pmc(interp, handlers);
else {
/* Loop from newest handler to oldest handler. */
- INTVAL index;
- const INTVAL elements = VTABLE_elements(interp, handlers);
+ STRING *exception_str = CONST_STRING(interp, "exception");
+ STRING *event_str = CONST_STRING(interp, "event");
+ STRING *handler_str = CONST_STRING(interp, "ExceptionHandler");
+ const INTVAL elements = VTABLE_elements(interp, handlers);
+ INTVAL index;
typedef enum { Hunknown, Hexception, Hevent } Htype;
+
const Htype htype =
- (string_equal(interp, handler_type, CONST_STRING(interp,
"exception")) == 0) ?
+ (string_equal(interp, handler_type, exception_str) == 0) ?
Hexception :
- (string_equal(interp, handler_type, CONST_STRING(interp, "event"))
== 0) ?
+ (string_equal(interp, handler_type, event_str) == 0) ?
Hevent :
Hunknown;
STRING * const handler_name = (htype == Hexception) ?
- CONST_STRING(interp, "ExceptionHandler") :
- (STRING *) NULL;
+ handler_str : (STRING *) NULL;
for (index = 0; index < elements; ++index) {
PMC *handler = VTABLE_get_pmc_keyed_int(interp, handlers, index);
@@ -573,8 +576,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Scheduler was not initialized for this interpreter.\n");
- Parrot_PCCINVOKE(interp, interp->scheduler,
- CONST_STRING(interp, "delete_handler"), "S->", handler_type);
+ Parrot_PCCINVOKE(interp, interp->scheduler, CONST_STRING(interp,
"delete_handler"), "S->", handler_type);
}
/*
@@ -598,8 +600,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Scheduler was not initialized for this interpreter.\n");
- Parrot_PCCINVOKE(interp, interp->scheduler,
- CONST_STRING(interp, "count_handlers"), "S->I", handler_type,
count);
+ Parrot_PCCINVOKE(interp, interp->scheduler, CONST_STRING(interp,
"count_handlers"), "S->I", handler_type, count);
return count;
}
@@ -712,8 +713,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Scheduler was not initialized for this interpreter.\n");
- Parrot_PCCINVOKE(interp, interp->scheduler,
- CONST_STRING(interp, "find_handler"), "P->P", task, &handler);
+ Parrot_PCCINVOKE(interp, interp->scheduler, CONST_STRING(interp,
"find_handler"), "P->P", task, &handler);
#if CX_DEBUG
fprintf(stderr, "done searching for handler\n");
@@ -739,13 +739,15 @@
Parrot_cx_find_handler_local(PARROT_INTERP, ARGIN(PMC *task))
{
Parrot_Context *context;
- PMC *iter = PMCNULL;
+ PMC *iter = PMCNULL;
+ STRING * const handled_str = CONST_STRING(interp, "handled");
+ STRING * const iter_str = CONST_STRING(interp, "handler_iter");
/* Exceptions store the handler iterator for rethrow, other kinds of
* tasks don't (though they could). */
- if (task->vtable->base_type == enum_class_Exception &&
- VTABLE_get_integer_keyed_str(interp, task, CONST_STRING(interp,
"handled")) == -1) {
- iter = VTABLE_get_attr_str(interp, task, CONST_STRING(interp,
"handler_iter"));
+ if (task->vtable->base_type == enum_class_Exception
+ && VTABLE_get_integer_keyed_str(interp, task, handled_str) == -1) {
+ iter = VTABLE_get_attr_str(interp, task, iter_str);
context = (Parrot_Context *)VTABLE_get_pointer(interp, task);
}
else {
@@ -962,7 +964,9 @@
scheduler_process_messages(PARROT_INTERP, ARGMOD(PMC *scheduler))
{
Parrot_Scheduler_attributes * sched_struct = PARROT_SCHEDULER(scheduler);
- PMC *message;
+
+ PMC *message;
+ STRING *suspend_str = CONST_STRING(interp, "suspend_for_gc");
#if CX_DEBUG
fprintf(stderr, "processing messages [interp=%p]\n", interp);
@@ -979,8 +983,8 @@
#endif
UNLOCK(sched_struct->msg_lock);
if (!PMC_IS_NULL(message)
- && string_equal(interp, VTABLE_get_string(interp, message),
- CONST_STRING(interp, "suspend_for_gc")) == 0) {
+ && string_equal(interp, VTABLE_get_string(interp, message),
+ suspend_str) == 0) {
#if CX_DEBUG
fprintf(stderr, "found a suspend, suspending [interp=%p]\n", interp);
#endif