[svn:parrot] r47876 - trunk/src/ops
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Jun 26 20:54:09 UTC 2010
Author: chromatic
Date: Sat Jun 26 20:54:09 2010
New Revision: 47876
URL: https://trac.parrot.org/parrot/changeset/47876
Log:
[ops] Reordered conditions in callmethodcc op.
Modified:
trunk/src/ops/core_ops.c
trunk/src/ops/object.ops
Modified: trunk/src/ops/core_ops.c
==============================================================================
--- trunk/src/ops/core_ops.c Sat Jun 26 20:35:56 2010 (r47875)
+++ trunk/src/ops/core_ops.c Sat Jun 26 20:54:09 2010 (r47876)
@@ -18669,12 +18669,19 @@
PMC * const method_pmc = VTABLE_find_method(interp, object, meth);
opcode_t *dest = NULL;
- PMC * const signature = Parrot_pcc_get_signature(interp,
- CURRENT_CONTEXT(interp));
Parrot_pcc_set_pc_func(interp, CURRENT_CONTEXT(interp), next);
- if (PMC_IS_NULL(method_pmc)) {
+ if (!PMC_IS_NULL(method_pmc)) {
+ PMC * const signature = Parrot_pcc_get_signature(interp,
+ CURRENT_CONTEXT(interp));
+ if (!PMC_IS_NULL(signature))
+ Parrot_pcc_set_object(interp, signature, object);
+
+ interp->current_cont = NEED_CONTINUATION;
+ dest = VTABLE_invoke(interp, method_pmc, next);
+ }
+ else {
PMC * const _class = VTABLE_get_class(interp, object);
if (PMC_IS_NULL(_class)) {
dest = Parrot_ex_throw_from_op_args(interp, next,
@@ -18687,12 +18694,6 @@
"Method '%Ss' not found for invocant of class '%Ss'", meth,
VTABLE_get_string(interp, _class));
}
- }
- else {
- if (!PMC_IS_NULL(signature))
- Parrot_pcc_set_object(interp, signature, object);
- interp->current_cont = NEED_CONTINUATION;
- dest = VTABLE_invoke(interp, method_pmc, next);
}return (opcode_t *)dest;
}
@@ -18705,12 +18706,19 @@
PMC * const method_pmc = VTABLE_find_method(interp, object, meth);
opcode_t *dest = NULL;
- PMC * const signature = Parrot_pcc_get_signature(interp,
- CURRENT_CONTEXT(interp));
Parrot_pcc_set_pc_func(interp, CURRENT_CONTEXT(interp), next);
- if (PMC_IS_NULL(method_pmc)) {
+ if (!PMC_IS_NULL(method_pmc)) {
+ PMC * const signature = Parrot_pcc_get_signature(interp,
+ CURRENT_CONTEXT(interp));
+ if (!PMC_IS_NULL(signature))
+ Parrot_pcc_set_object(interp, signature, object);
+
+ interp->current_cont = NEED_CONTINUATION;
+ dest = VTABLE_invoke(interp, method_pmc, next);
+ }
+ else {
PMC * const _class = VTABLE_get_class(interp, object);
if (PMC_IS_NULL(_class)) {
dest = Parrot_ex_throw_from_op_args(interp, next,
@@ -18723,12 +18731,6 @@
"Method '%Ss' not found for invocant of class '%Ss'", meth,
VTABLE_get_string(interp, _class));
}
- }
- else {
- if (!PMC_IS_NULL(signature))
- Parrot_pcc_set_object(interp, signature, object);
- interp->current_cont = NEED_CONTINUATION;
- dest = VTABLE_invoke(interp, method_pmc, next);
}return (opcode_t *)dest;
}
@@ -25076,7 +25078,10 @@
* returns >= 0 (found idx into info_table), -1 if not
*/
-static size_t hash_str(const char *str) {
+PARROT_PURE_FUNCTION
+static
+size_t hash_str(ARGIN(const char *str))
+{
size_t key = 0;
const char *s = str;
@@ -25088,7 +25093,8 @@
return key;
}
-static void store_op(PARROT_INTERP, op_info_t *info, int full) {
+static void store_op(PARROT_INTERP, op_info_t *info, int full)
+{
HOP * const p = mem_gc_allocate_zeroed_typed(interp, HOP);
const size_t hidx =
hash_str(full ? info->full_name : info->name) % OP_HASH_SIZE;
@@ -25097,7 +25103,9 @@
p->next = hop[hidx];
hop[hidx] = p;
}
-static int get_op(PARROT_INTERP, const char * name, int full) {
+
+static int get_op(PARROT_INTERP, const char * name, int full)
+{
const HOP * p;
const size_t hidx = hash_str(name) % OP_HASH_SIZE;
if (!hop) {
@@ -25110,7 +25118,9 @@
}
return -1;
}
-static void hop_init(PARROT_INTERP) {
+
+static void hop_init(PARROT_INTERP)
+{
size_t i;
op_info_t * const info = core_op_lib.op_info_table;
/* store full names */
@@ -25121,6 +25131,7 @@
if (get_op(interp, info[i].name, 0) == -1)
store_op(interp, info + i, 0);
}
+
static void hop_deinit(PARROT_INTERP)
{
if (hop) {
Modified: trunk/src/ops/object.ops
==============================================================================
--- trunk/src/ops/object.ops Sat Jun 26 20:35:56 2010 (r47875)
+++ trunk/src/ops/object.ops Sat Jun 26 20:54:09 2010 (r47876)
@@ -56,12 +56,19 @@
PMC * const method_pmc = VTABLE_find_method(interp, object, meth);
opcode_t *dest = NULL;
- PMC * const signature = Parrot_pcc_get_signature(interp,
- CURRENT_CONTEXT(interp));
Parrot_pcc_set_pc_func(interp, CURRENT_CONTEXT(interp), next);
- if (PMC_IS_NULL(method_pmc)) {
+ if (!PMC_IS_NULL(method_pmc)) {
+ PMC * const signature = Parrot_pcc_get_signature(interp,
+ CURRENT_CONTEXT(interp));
+ if (!PMC_IS_NULL(signature))
+ Parrot_pcc_set_object(interp, signature, object);
+
+ interp->current_cont = NEED_CONTINUATION;
+ dest = VTABLE_invoke(interp, method_pmc, next);
+ }
+ else {
PMC * const _class = VTABLE_get_class(interp, object);
if (PMC_IS_NULL(_class)) {
dest = Parrot_ex_throw_from_op_args(interp, next,
@@ -75,12 +82,7 @@
VTABLE_get_string(interp, _class));
}
}
- else {
- if (!PMC_IS_NULL(signature))
- Parrot_pcc_set_object(interp, signature, object);
- interp->current_cont = NEED_CONTINUATION;
- dest = VTABLE_invoke(interp, method_pmc, next);
- }
+
goto ADDRESS(dest);
}
More information about the parrot-commits
mailing list