Property changes on: runtime/parrot/library/Rules.mak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/runtime/parrot/library/Rules.mak:r48886-48917 Index: runtime/parrot/library/P6object.pir =================================================================== --- runtime/parrot/library/P6object.pir (revision 48898) +++ runtime/parrot/library/P6object.pir (revision 48924) @@ -260,6 +260,9 @@ .local pmc methodpmc methodname = shift methoditer methodpmc = methods[methodname] + # don't add NativePCCMethods + $I0 = isa methodpmc, 'NativePCCMethod' + if $I0 goto method_loop # don't add NCI methods (they don't work) $I0 = isa methodpmc, 'NCI' if $I0 goto method_loop Property changes on: runtime/parrot/library/Math/Rand.pir ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/runtime/parrot/library/Math/Rand.pir:r48886-48917 Property changes on: runtime/parrot/languages ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/runtime/parrot/languages:r48886-48917 Index: src/embed.c =================================================================== --- src/embed.c (revision 48898) +++ src/embed.c (revision 48924) @@ -25,6 +25,7 @@ #include "pmc/pmc_sub.h" #include "pmc/pmc_callcontext.h" #include "parrot/runcore_api.h" +#include "parrot/oplib/core_ops.h" #include "../compilers/imcc/imc.h" @@ -1077,6 +1078,7 @@ Parrot_run_native(PARROT_INTERP, native_func_t func) { ASSERT_ARGS(Parrot_run_native) + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); PackFile * const pf = PackFile_new(interp, 0); static opcode_t program_code[2] = { 0, /* enternative */ @@ -1084,8 +1086,8 @@ }; static op_func_t op_func_table[2]; - op_func_table[0] = interp->op_func_table[ interp->op_lib->op_code(interp, "enternative", 0) ]; - op_func_table[1] = interp->op_func_table[ interp->op_lib->op_code(interp, "end", 0) ]; + op_func_table[0] = core_ops->op_func_table[PARROT_OP_enternative]; + op_func_table[1] = core_ops->op_func_table[PARROT_OP_end]; pf->cur_cs = (PackFile_ByteCode *) Index: src/oo.c =================================================================== --- src/oo.c (revision 48898) +++ src/oo.c (revision 48924) @@ -260,12 +260,8 @@ || base_type == enum_class_ResizableStringArray || base_type == enum_class_String) type = Parrot_pmc_get_type(interp, key); - else if (VTABLE_does(interp, key, CONST_STRING(interp, "string")) || - base_type == enum_class_NameSpace) - type = Parrot_pmc_get_type_str(interp, VTABLE_get_string(interp, key)); else - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, - "can't get class from an instance of class '%Ss'", VTABLE_name(interp, key)); + type = Parrot_pmc_get_type_str(interp, VTABLE_get_string(interp, key)); classobj = get_pmc_proxy(interp, type); } Index: src/ops/core_ops.c =================================================================== --- src/ops/core_ops.c (revision 48898) +++ src/ops/core_ops.c (revision 48924) @@ -26205,6 +26205,7 @@ hop = NULL; hop_buckets = NULL; } +PARROT_EXPORT op_lib_t * Parrot_DynOp_core_2_7_0(PARROT_INTERP, long init) { /* initialize and return op_lib ptr */ Index: src/global_setup.c =================================================================== --- src/global_setup.c (revision 48898) +++ src/global_setup.c (revision 48924) @@ -23,6 +23,7 @@ #define INSIDE_GLOBAL_SETUP #include "parrot/parrot.h" +#include "parrot/oplib/core_ops.h" #include "global_setup.str" /* These functions are defined in the auto-generated file core_pmcs.c */ @@ -217,6 +218,19 @@ create_initial_context(interp); + /* initialize the ops hash */ + if (interp->parent_interpreter) { + interp->op_hash = interp->parent_interpreter->op_hash; + } + else { + op_lib_t *core_ops = PARROT_CORE_OPLIB_INIT(interp, 1); + interp->op_hash = parrot_create_hash_sized(interp, enum_type_ptr, Hash_key_type_cstring, + (hash_comp_fn)hash_compare_cstring, + (hash_hash_key_fn)key_hash_cstring, + core_ops->op_count); + parrot_hash_oplib(interp, core_ops); + } + /* create the namespace root stash */ interp->root_namespace = Parrot_pmc_new(interp, enum_class_NameSpace); Parrot_init_HLL(interp); Index: src/hash.c =================================================================== --- src/hash.c (revision 48898) +++ src/hash.c (revision 48924) @@ -54,21 +54,6 @@ __attribute__nonnull__(2); PARROT_WARN_UNUSED_RESULT -PARROT_PURE_FUNCTION -static int hash_compare_cstring(SHIM_INTERP, - ARGIN(const char *a), - ARGIN(const char *b)) - __attribute__nonnull__(2) - __attribute__nonnull__(3); - -PARROT_WARN_UNUSED_RESULT -PARROT_PURE_FUNCTION -static size_t key_hash_cstring(SHIM_INTERP, - ARGIN(const void *value), - size_t seed) - __attribute__nonnull__(2); - -PARROT_WARN_UNUSED_RESULT PARROT_CONST_FUNCTION static size_t key_hash_pointer(SHIM_INTERP, ARGIN(const void *value), @@ -97,11 +82,6 @@ #define ASSERT_ARGS_get_string_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(value)) -#define ASSERT_ARGS_hash_compare_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ - PARROT_ASSERT_ARG(a) \ - , PARROT_ASSERT_ARG(b)) -#define ASSERT_ARGS_key_hash_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ - PARROT_ASSERT_ARG(value)) #define ASSERT_ARGS_key_hash_pointer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(value)) #define ASSERT_ARGS_parrot_mark_hash_both __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ @@ -238,8 +218,7 @@ /* -=item C +=item C Creates and returns a hash value from a string. @@ -254,7 +233,7 @@ PARROT_WARN_UNUSED_RESULT PARROT_PURE_FUNCTION -static size_t +size_t key_hash_cstring(SHIM_INTERP, ARGIN(const void *value), size_t seed) { ASSERT_ARGS(key_hash_cstring) @@ -272,8 +251,7 @@ /* -=item C +=item C Compares two C strings for equality, returning -1, 0, and 1 if the first string is less than, equal to, or greater than the second, respectively. @@ -284,7 +262,7 @@ PARROT_WARN_UNUSED_RESULT PARROT_PURE_FUNCTION -static int +int hash_compare_cstring(SHIM_INTERP, ARGIN(const char *a), ARGIN(const char *b)) { ASSERT_ARGS(hash_compare_cstring) Index: src/pbc_merge.c =================================================================== --- src/pbc_merge.c (revision 48898) +++ src/pbc_merge.c (revision 48924) @@ -41,6 +41,7 @@ #include "parrot/parrot.h" #include "parrot/embed.h" #include "parrot/oplib/ops.h" +#include "parrot/oplib/core_ops.h" #include "pmc/pmc_sub.h" @@ -699,6 +700,7 @@ opcode_t *ops = bc->base.data; opcode_t cur_op = 0; int cur_input = 0; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); /* Loop over the ops in the merged bytecode. */ while (cur_op < (opcode_t)bc->base.size) { @@ -738,10 +740,10 @@ /* Handle special case variable argument opcodes. */ op_func = interp->code->op_func_table[op_num]; - if (op_func == interp->op_func_table[PARROT_OP_set_args_pc] || - op_func == interp->op_func_table[PARROT_OP_get_results_pc] || - op_func == interp->op_func_table[PARROT_OP_get_params_pc] || - op_func == interp->op_func_table[PARROT_OP_set_returns_pc]) { + if (op_func == core_ops->op_func_table[PARROT_OP_set_args_pc] || + op_func == core_ops->op_func_table[PARROT_OP_get_results_pc] || + op_func == core_ops->op_func_table[PARROT_OP_get_params_pc] || + op_func == core_ops->op_func_table[PARROT_OP_set_returns_pc]) { /* Get the signature. */ PMC * const sig = bc->const_table->constants[op_ptr[1]].u.key; Index: src/debug.c =================================================================== --- src/debug.c (revision 48898) +++ src/debug.c (revision 48924) @@ -33,6 +33,7 @@ #include "debug.str" #include "pmc/pmc_continuation.h" #include "pmc/pmc_callcontext.h" +#include "parrot/oplib/core_ops.h" /* Hand switched debugger tracing * Set to 1 to enable tracing to stderr @@ -2256,6 +2257,7 @@ int j; size_t size = 0; int specialop = 0; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); /* Write the opcode name */ const char * p = full_name ? info->full_name : info->name; @@ -2452,15 +2454,15 @@ one fixed parameter (the signature vector), plus a varying number of registers/constants. For each arg/return, we show the register and its flags using PIR syntax. */ - if (OPCODE_IS(interp, interp->code, *(op), PARROT_OP_set_args_pc) - || OPCODE_IS(interp, interp->code, *(op), PARROT_OP_set_returns_pc)) + if (OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_set_args_pc) + || OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_set_returns_pc)) specialop = 1; /* if it's a retrieving op, specialop = 2, so that later a :flat flag * can be changed into a :slurpy flag. See flag handling below. */ - if (OPCODE_IS(interp, interp->code, *(op), PARROT_OP_get_results_pc) - || OPCODE_IS(interp, interp->code, *(op), PARROT_OP_get_params_pc)) + if (OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_get_results_pc) + || OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_get_params_pc)) specialop = 2; if (specialop > 0) { Index: src/namespace.c =================================================================== --- src/namespace.c (revision 48898) +++ src/namespace.c (revision 48924) @@ -203,12 +203,12 @@ { ASSERT_ARGS(internal_ns_keyed) - if (VTABLE_isa(interp, pmc_key, CONST_STRING(interp, "String"))) { + if (PMC_IS_TYPE(pmc_key, Key)) + return internal_ns_keyed_key(interp, base_ns, pmc_key, flags); + else if (VTABLE_isa(interp, pmc_key, CONST_STRING(interp, "String"))) { STRING * const str_key = VTABLE_get_string(interp, pmc_key); return internal_ns_keyed_str(interp, base_ns, str_key, flags); } - else if (PMC_IS_TYPE(pmc_key, Key)) - return internal_ns_keyed_key(interp, base_ns, pmc_key, flags); else { /* array of strings */ STRING * const isans = CONST_STRING(interp, "NameSpace"); Index: src/pmc/oplib.pmc =================================================================== --- src/pmc/oplib.pmc (revision 48898) +++ src/pmc/oplib.pmc (revision 48924) @@ -64,9 +64,9 @@ INTVAL num; GET_ATTR_oplib(INTERP, SELF, oplib); - num = oplib->op_code(INTERP, cstr, 1); + num = oplib->_op_code(INTERP, cstr, 1); if (num == -1) - num = oplib->op_code(INTERP, cstr, 0); + num = oplib->_op_code(INTERP, cstr, 0); Parrot_str_free_cstring(cstr); return num; Index: src/pmc/object.pmc =================================================================== --- src/pmc/object.pmc (revision 48898) +++ src/pmc/object.pmc (revision 48924) @@ -677,10 +677,11 @@ */ VTABLE INTVAL isa(STRING *classname) { - if (SUPER(classname)) + if (SELF->vtable->whoami == classname + || Parrot_str_equal(INTERP, SELF->vtable->whoami, classname)) return 1; else { - PMC * _class = VTABLE_get_class(INTERP, SELF); + PMC *_class = PARROT_OBJECT(SELF)->_class; return VTABLE_isa(INTERP, _class, classname); } } Index: src/pmc/nativepccmethod.pmc =================================================================== --- src/pmc/nativepccmethod.pmc (revision 48898) +++ src/pmc/nativepccmethod.pmc (revision 48924) @@ -20,7 +20,7 @@ /* HEADERIZER HFILE: none */ -pmclass NativePCCMethod auto_attrs { +pmclass NativePCCMethod auto_attrs provides invokable { ATTR STRING *signature; ATTR void *func; Index: src/pmc/packfile.pmc =================================================================== --- src/pmc/packfile.pmc (revision 48898) +++ src/pmc/packfile.pmc (revision 48924) @@ -21,6 +21,19 @@ #include "pmc/pmc_packfiledirectory.h" +typedef enum { + attr_wordsize, + attr_byteorder, + attr_fptype, + attr_version_major, + attr_version_minor, + attr_version_patch, + attr_bytecode_major, + attr_bytecode_minor, + attr_uuid_type, + attr_NONE = -1 +} AttrEnumPackfile; + /* HEADERIZER HFILE: none */ /* HEADERIZER BEGIN: static */ /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ @@ -33,10 +46,18 @@ __attribute__nonnull__(3) FUNC_MODIFIES(*self); +static AttrEnumPackfile getAttrEnum(PARROT_INTERP, + ARGIN(const STRING *name)) + __attribute__nonnull__(1) + __attribute__nonnull__(2); + #define ASSERT_ARGS_copy_packfile_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(self) \ , PARROT_ASSERT_ARG(pf)) +#define ASSERT_ARGS_getAttrEnum __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ + PARROT_ASSERT_ARG(interp) \ + , PARROT_ASSERT_ARG(name)) /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ /* HEADERIZER END: static */ @@ -243,28 +264,40 @@ VTABLE INTVAL get_integer_keyed_str(STRING *key) { Parrot_Packfile_attributes * const attrs = PARROT_PACKFILE(SELF); - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "wordsize"))) - return attrs->wordsize; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "byteorder"))) - return attrs->byteorder; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "fptype"))) - return attrs->fptype; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "version_major"))) - return attrs->version_major; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "version_minor"))) - return attrs->version_minor; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "version_patch"))) - return attrs->version_patch; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "bytecode_major"))) - return attrs->bytecode_major; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "bytecode_minor"))) - return attrs->bytecode_minor; - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid_type"))) - return attrs->uuid_type; - - Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND, - "Packfile: No such integer key \"%s\"", - Parrot_str_cstring(INTERP, key)); + INTVAL result; + switch (getAttrEnum(INTERP, key)) { + case attr_wordsize: + result = attrs->wordsize; + break; + case attr_byteorder: + result = attrs->byteorder; + break; + case attr_fptype: + result = attrs->fptype; + break; + case attr_version_major: + result = attrs->version_major; + break; + case attr_version_minor: + result = attrs->version_minor; + break; + case attr_version_patch: + result = attrs->version_patch; + break; + case attr_bytecode_major: + result = attrs->bytecode_major; + break; + case attr_bytecode_minor: + result = attrs->bytecode_minor; + break; + case attr_uuid_type: + result = attrs->uuid_type; + break; + default: + Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND, + "Packfile: No such integer key \"%Ss\"", key); + } + return result; } /* @@ -287,8 +320,7 @@ return PARROT_PACKFILE(SELF)->uuid; Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND, - "Packfile: No such string key \"%s\"", - Parrot_str_cstring(INTERP, key)); + "Packfile: No such string key \"%Ss\"", key); } @@ -346,25 +378,23 @@ */ VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) { Parrot_Packfile_attributes * const attrs = PARROT_PACKFILE(SELF); - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "version_major"))) { + switch (getAttrEnum(INTERP, key)) { + case attr_version_major: attrs->version_major = value; - return; - } - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "version_minor"))) { + break; + case attr_version_minor: attrs->version_minor = value; - return; - } - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "version_patch"))) { + break; + case attr_version_patch: attrs->version_patch = value; - return; - } - if (!Parrot_str_compare(INTERP, key, CONST_STRING(INTERP, "uuid_type"))) { + break; + case attr_uuid_type: attrs->uuid_type = value; - return; + break; + default: + Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND, + "Packfile: No such integer key \"%Ss\"", key); } - Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND, - "Packfile: No such integer key \"%s\"", - Parrot_str_cstring(INTERP, key)); } @@ -407,8 +437,7 @@ } Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND, - "Packfile: No such string key \"%s\"", - Parrot_str_cstring(INTERP, key)); + "Packfile: No such string key \"%Ss\"", key); } /* @@ -471,7 +500,10 @@ PMC * const dir = PARROT_PACKFILE(SELF)->directory; RETURN(PMC *dir); } + } + + /* =back @@ -481,6 +513,57 @@ */ /* + +=head2 Auxliary functions + +=over 4 + +=item C + +Gets an enumerated value corresponding to the attribute with that name. + +=cut + +*/ + +static AttrEnumPackfile +getAttrEnum(PARROT_INTERP, ARGIN(const STRING *name)) +{ + ASSERT_ARGS(getAttrEnum) + + AttrEnumPackfile r; + if (Parrot_str_equal(interp, name, CONST_STRING(interp, "wordsize"))) + r = attr_wordsize; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "byteorder"))) + r = attr_byteorder; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "fptype"))) + r = attr_fptype; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_major"))) + r = attr_version_major; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_minor"))) + r = attr_version_minor; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "version_patch"))) + r = attr_version_patch; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_major"))) + r = attr_bytecode_major; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "bytecode_minor"))) + r = attr_bytecode_minor; + else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "uuid_type"))) + r = attr_uuid_type; + else + r = attr_NONE; + return r; +} + +/* + +=back + +=cut + +*/ + +/* * Local variables: * c-file-style: "parrot" * End: Index: src/pmc/sub.pmc =================================================================== --- src/pmc/sub.pmc (revision 48898) +++ src/pmc/sub.pmc (revision 48924) @@ -19,6 +19,7 @@ */ #include "parrot/oplib/ops.h" +#include "parrot/oplib/core_ops.h" #include "sub.str" /* HEADERIZER HFILE: none */ @@ -863,14 +864,14 @@ if (!sub->arg_info) { /* Get pointer into the bytecode where this sub starts. */ const opcode_t *pc = sub->seg->base.data + sub->start_offs; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(INTERP); /* Allocate structure to store argument information in. */ sub->arg_info = mem_gc_allocate_zeroed_typed(INTERP, Parrot_sub_arginfo); /* If the first instruction is a get_params... */ - if (sub->seg->op_func_table[*pc] - == interp->op_func_table[PARROT_OP_get_params_pc]) { + if (OPCODE_IS(INTERP, sub->seg, *pc, core_ops, PARROT_OP_get_params_pc)) { /* Get the signature (the next thing in the bytecode). */ PMC * const sig = PF_CONST(sub->seg, *(++pc)).u.key; Property changes on: src/gc/alloc_memory.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/alloc_memory.c:r48886-48917 Property changes on: src/gc/alloc_resources.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/alloc_resources.c:r48886-48917 Index: src/gc/system.c =================================================================== --- src/gc/system.c (revision 48898) +++ src/gc/system.c (revision 48924) @@ -453,8 +453,8 @@ prefix = mask & buffer_min; for (cur_var_ptr = hi_var_ptr; - (ptrdiff_t)cur_var_ptr < (ptrdiff_t)lo_var_ptr; - cur_var_ptr = (size_t)((ptrdiff_t)cur_var_ptr + sizeof (void *))) { + (ptrdiff_t)cur_var_ptr < (ptrdiff_t)lo_var_ptr; + cur_var_ptr = (size_t)((ptrdiff_t)cur_var_ptr + sizeof (void *))) { const size_t ptr = *(size_t *)cur_var_ptr; /* Do a quick approximate range check by bit-masking */ @@ -463,14 +463,14 @@ * guaranteed to be live pmcs/buffers, and could very well have * had their bufstart/vtable destroyed due to the linked list of * free headers... */ - if ((pmc_min <= ptr) && (ptr < pmc_max) && is_pmc_ptr(mem_pools, (void *)ptr)) { - Parrot_gc_mark_PObj_alive(interp, (PObj *)ptr); + if ((pmc_min <= ptr) + && (ptr < pmc_max) + && is_pmc_ptr(mem_pools, (void *)ptr)) { + Parrot_gc_mark_PMC_alive(interp, (PMC *)ptr); } - else if ((buffer_min <= ptr) && (ptr < buffer_max) && - is_buffer_ptr(mem_pools, (void *)ptr)) { - /* ...and since Parrot_gc_mark_PObj_alive doesn't care about bufstart, it - * doesn't really matter if it sets a flag */ - Parrot_gc_mark_PObj_alive(interp, (PObj *)ptr); + else if ((buffer_min <= ptr) && (ptr < buffer_max) + && is_buffer_ptr(mem_pools, (void *)ptr)) { + Parrot_gc_mark_STRING_alive(interp, (STRING *)ptr); } } } Property changes on: src/gc/system.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/system.c:r48886-48917 Property changes on: src/gc/malloc_trace.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/malloc_trace.c:r48886-48917 Property changes on: src/gc/malloc.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/malloc.c:r48886-48917 Property changes on: src/gc/api.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/api.c:r48886-48917 Property changes on: src/gc/mark_sweep.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/gc/mark_sweep.c:r48886-48917 Index: src/interp/inter_create.c =================================================================== --- src/interp/inter_create.c (revision 48898) +++ src/interp/inter_create.c (revision 48924) @@ -252,10 +252,6 @@ Parrot_runcore_init(interp); /* Load the core op func and info tables */ - interp->op_lib = PARROT_CORE_OPLIB_INIT(interp, 1); - interp->op_count = interp->op_lib->op_count; - interp->op_func_table = interp->op_lib->op_func_table; - interp->op_info_table = interp->op_lib->op_info_table; interp->all_op_libs = NULL; interp->evc_func_table = NULL; interp->evc_func_table_size = 0; Property changes on: src/interp/inter_create.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/interp/inter_create.c:r48886-48917 Property changes on: src/interp/inter_cb.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/interp/inter_cb.c:r48886-48917 Property changes on: src/interp/inter_misc.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/interp/inter_misc.c:r48886-48917 Index: src/sub.c =================================================================== --- src/sub.c (revision 48898) +++ src/sub.c (revision 48924) @@ -23,6 +23,7 @@ #include "sub.str" #include "pmc/pmc_sub.h" #include "pmc/pmc_continuation.h" +#include "parrot/oplib/core_ops.h" /* HEADERIZER HFILE: include/parrot/sub.h */ Property changes on: src/call/ops.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/call/ops.c:r48886-48917 Property changes on: src/call/pcc.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/call/pcc.c:r48886-48917 Property changes on: src/runcore/trace.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/runcore/trace.c:r48886-48917 Index: src/runcore/main.c =================================================================== --- src/runcore/main.c (revision 48898) +++ src/runcore/main.c (revision 48924) @@ -36,17 +36,12 @@ /* HEADERIZER BEGIN: static */ /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ -static void dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new) - __attribute__nonnull__(1); - PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static oplib_init_f get_dynamic_op_lib_init(SHIM_INTERP, ARGIN(const PMC *lib)) __attribute__nonnull__(2); -#define ASSERT_ARGS_dynop_register_switch __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ - PARROT_ASSERT_ARG(interp)) #define ASSERT_ARGS_get_dynamic_op_lib_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(lib)) /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ @@ -272,15 +267,6 @@ mem_gc_free(interp, interp->all_op_libs); interp->all_op_libs = NULL; - - /* dynop libs */ - if (interp->n_libs <= 0) - return; - - mem_gc_free(interp, interp->op_info_table); - mem_gc_free(interp, interp->op_func_table); - interp->op_info_table = NULL; - interp->op_func_table = NULL; } @@ -305,21 +291,12 @@ dynop_register(PARROT_INTERP, ARGIN(PMC *lib_pmc)) { ASSERT_ARGS(dynop_register) - op_lib_t *lib, *core; - oplib_init_f init_func; - op_func_t *new_func_table; - op_info_t *new_info_table; - size_t i, n_old, n_new, n_tot; + op_lib_t *lib; + oplib_init_f init_func; if (n_interpreters > 1) { - /* This is not supported because oplibs are always shared. - * If we mem_sys_reallocate() the op_func_table while another - * interpreter is running using that exact op_func_table, - * this will cause problems - * Also, the mapping from op name to op number is global even for - * dynops (!). The mapping is done by get_op in core_ops.c (even for - * dynops) and uses a global hash as a cache and relies on modifications - * to the static-scoped core_op_lib data structure to see dynops. + /* This is not supported yet because interp->all_op_libs + * and interp->op_hash are shared. */ Parrot_ex_throw_from_c_args(interp, NULL, 1, "loading a new dynoplib while " "more than one thread is running is not supported."); @@ -340,77 +317,34 @@ /* if we are registering an op_lib variant, called from below the base * names of this lib and the previous one are the same */ if (interp->n_libs >= 2 - && (STREQ(interp->all_op_libs[interp->n_libs-2]->name, lib->name))) { - /* registering is handled below */ + && (STREQ(interp->all_op_libs[interp->n_libs-2]->name, lib->name))) return; - } - n_old = interp->op_count; - n_new = lib->op_count; - n_tot = n_old + n_new; - core = PARROT_CORE_OPLIB_INIT(interp, 1); - - PARROT_ASSERT(interp->op_count == core->op_count); - - if (core->flags & OP_FUNC_IS_ALLOCATED) { - new_func_table = mem_gc_realloc_n_typed_zeroed(interp, - core->op_func_table, n_tot, n_old, op_func_t); - new_info_table = mem_gc_realloc_n_typed_zeroed(interp, - core->op_info_table, n_tot, n_old, op_info_t); - } - else { - /* allocate new op_func and info tables */ - new_func_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t); - new_info_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_info_t); - - /* copy old */ - for (i = 0; i < n_old; ++i) { - new_func_table[i] = interp->op_func_table[i]; - new_info_table[i] = interp->op_info_table[i]; - } - } - - /* add new */ - for (i = n_old; i < n_tot; ++i) { - new_func_table[i] = ((op_func_t*)lib->op_func_table)[i - n_old]; - new_info_table[i] = lib->op_info_table[i - n_old]; - } - - /* deinit core, so that it gets rehashed */ - (void) PARROT_CORE_OPLIB_INIT(interp, 0); - - /* set table */ - core->op_func_table = interp->op_func_table = new_func_table; - core->op_info_table = interp->op_info_table = new_info_table; - core->op_count = interp->op_count = n_tot; - core->flags = OP_FUNC_IS_ALLOCATED | OP_INFO_IS_ALLOCATED; - - /* done for plain core */ - dynop_register_switch(interp, n_old, n_new); + parrot_hash_oplib(interp, lib); } - - /* -=item C +=item C -Used only at the end of dynop_register. Sums the old and new op_counts -storing the result into the operations count field of the interpreter -object. +Add the ops in C to the global name => op_info hash. =cut */ -static void -dynop_register_switch(PARROT_INTERP, size_t n_old, size_t n_new) +void +parrot_hash_oplib(PARROT_INTERP, ARGIN(op_lib_t *lib)) { - ASSERT_ARGS(dynop_register_switch) - op_lib_t * const lib = PARROT_CORE_OPLIB_INIT(interp, 1); - lib->op_count = n_old + n_new; + ASSERT_ARGS(parrot_hash_oplib) + int i; + for (i = 0; i < lib->op_count; i++) { + op_info_t *op = &lib->op_info_table[i]; + parrot_hash_put(interp, interp->op_hash, (void *)op->full_name, (void *)op); + if (!parrot_hash_exists(interp, interp->op_hash, (void *)op->name)) + parrot_hash_put(interp, interp->op_hash, (void *)op->name, (void *)op); + } } Property changes on: src/runcore/main.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/runcore/main.c:r48886-48917 Property changes on: src/runcore/profiling.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/runcore/profiling.c:r48886-48917 Property changes on: src/runcore/cores.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/src/runcore/cores.c:r48886-48917 Property changes on: docs/book/draft/ch07_dynpmcs.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch07_dynpmcs.pod:r48886-48917 Property changes on: docs/book/draft/ch08_dynops.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch08_dynops.pod:r48886-48917 Property changes on: docs/book/draft/chXX_library.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/chXX_library.pod:r48886-48917 Property changes on: docs/book/draft/appe_source_code.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/appe_source_code.pod:r48886-48917 Property changes on: docs/book/draft/ch10_opcode_reference.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch10_opcode_reference.pod:r48886-48917 Property changes on: docs/book/draft/appc_command_line_options.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/appc_command_line_options.pod:r48886-48917 Property changes on: docs/book/draft/ch02_getting_started.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch02_getting_started.pod:r48886-48917 Property changes on: docs/book/draft/appa_glossary.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/appa_glossary.pod:r48886-48917 Property changes on: docs/book/draft/chXX_testing_and_debugging.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/chXX_testing_and_debugging.pod:r48886-48917 Property changes on: docs/book/draft/ch11_directive_reference.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch11_directive_reference.pod:r48886-48917 Property changes on: docs/book/draft/README ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/README:r48886-48917 Property changes on: docs/book/draft/appb_patch_submission.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/appb_patch_submission.pod:r48886-48917 Property changes on: docs/book/draft/appd_build_options.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/appd_build_options.pod:r48886-48917 Property changes on: docs/book/draft/ch12_operator_reference.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch12_operator_reference.pod:r48886-48917 Property changes on: docs/book/draft/ch01_introduction.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/ch01_introduction.pod:r48886-48917 Property changes on: docs/book/draft/chXX_hlls.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/draft/chXX_hlls.pod:r48886-48917 Property changes on: docs/book/pct/ch02_getting_started.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/pct/ch02_getting_started.pod:r48886-48917 Property changes on: docs/book/pct/ch03_compiler_tools.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/pct/ch03_compiler_tools.pod:r48886-48917 Property changes on: docs/book/pct/ch04_pge.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/pct/ch04_pge.pod:r48886-48917 Property changes on: docs/book/pct/ch01_introduction.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/pct/ch01_introduction.pod:r48886-48917 Property changes on: docs/book/pct/ch05_nqp.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/book/pct/ch05_nqp.pod:r48886-48917 Property changes on: docs/dev/c_functions.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/dev/c_functions.pod:r48886-48917 Property changes on: docs/pdds/pdd30_install.pod ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/docs/pdds/pdd30_install.pod:r48886-48917 Property changes on: ext/nqp-rx/Rules.mak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/ext/nqp-rx/Rules.mak:r48886-48917 Property changes on: tools/build/README ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/build/README:r48886-48917 Property changes on: tools/build/h2inc.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/build/h2inc.pl:r48886-48917 Property changes on: tools/release/crow.pir ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/release/crow.pir:r48886-48917 Property changes on: tools/release/templates.json ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/release/templates.json:r48886-48917 Property changes on: tools/release/release.json ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/release/release.json:r48886-48917 Property changes on: tools/release/gen_release_info.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/release/gen_release_info.pl:r48886-48917 Property changes on: tools/release/inc_ver.pir ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/release/inc_ver.pir:r48886-48917 Property changes on: tools/dev/perltidy.conf ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/perltidy.conf:r48886-48917 Property changes on: tools/dev/update_copyright.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/update_copyright.pl:r48886-48917 Index: tools/dev/fetch_languages.pl =================================================================== --- tools/dev/fetch_languages.pl (revision 48898) +++ tools/dev/fetch_languages.pl (revision 48924) @@ -231,7 +231,7 @@ { name => 'pir', scm => 'GIT', - repository => 'http://github.com/bacek/pir.git' + repository => 'http://github.com/parrot/pir.git' }, { Property changes on: tools/dev/fetch_languages.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/fetch_languages.pl:r48886-48917 Index: tools/dev/headerizer.pl =================================================================== --- tools/dev/headerizer.pl (revision 48898) +++ tools/dev/headerizer.pl (revision 48924) @@ -330,8 +330,8 @@ # Walk the object files and find corresponding source (either .c or .pmc) for my $ofile (@ofiles) { - # Skip files in the src/ops/ subdirectory. - + # Skip files in the src/ops/ subdirectory. + next if $ofile =~ m/^\Qsrc$PConfig{slash}ops\E/ || # if run by hand... $ofile =~ m{^src/ops}; # ... or by makefile Property changes on: tools/dev/headerizer.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/headerizer.pl:r48886-48917 Property changes on: tools/dev/dump_pbc.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/dump_pbc.pl:r48886-48917 Property changes on: tools/dev/ncidef2pasm.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/ncidef2pasm.pl:r48886-48917 Property changes on: tools/dev/perlcritic-cage.conf ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/perlcritic-cage.conf:r48886-48917 Property changes on: tools/dev/perlcritic.conf ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/perlcritic.conf:r48886-48917 Property changes on: tools/dev/mk_gitignore.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/mk_gitignore.pl:r48886-48917 Property changes on: tools/dev/README ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/README:r48886-48917 Property changes on: tools/dev/addopstags.pl ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/addopstags.pl:r48886-48917 Property changes on: tools/dev/parrot-config.pir ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/tools/dev/parrot-config.pir:r48886-48917 Property changes on: lib/Parrot/Configure/Step/Test.pm ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/lib/Parrot/Configure/Step/Test.pm:r48886-48917 Property changes on: lib/Parrot/H2inc.pm ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/lib/Parrot/H2inc.pm:r48886-48917 Property changes on: ports/cygwin/parrot-1.0.0-1.cygport ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/ports/cygwin/parrot-1.0.0-1.cygport:r48886-48917 Property changes on: ports/debian/parrot.install.in ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/ports/debian/parrot.install.in:r48886-48917 Property changes on: ports/debian/libparrot-dev.install.in ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/ports/debian/libparrot-dev.install.in:r48886-48917 Property changes on: ports/debian/parrot-doc.install.in ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/ports/debian/parrot-doc.install.in:r48886-48917 Property changes on: ports/debian/libparrot.install.in ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/ports/debian/libparrot.install.in:r48886-48917 Property changes on: include/parrot/runcore_trace.h ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/include/parrot/runcore_trace.h:r48886-48917 Index: include/parrot/oplib.h =================================================================== --- include/parrot/oplib.h (revision 48898) +++ include/parrot/oplib.h (revision 48924) @@ -32,7 +32,7 @@ size_t op_count; op_info_t * op_info_table; op_func_t * op_func_table; - int (*op_code)(PARROT_INTERP, const char * name, int full); + int (*_op_code)(PARROT_INTERP, const char * name, int full); } op_lib_t; typedef enum { Index: include/parrot/runcore_api.h =================================================================== --- include/parrot/runcore_api.h (revision 48898) +++ include/parrot/runcore_api.h (revision 48924) @@ -78,6 +78,10 @@ __attribute__nonnull__(1) __attribute__nonnull__(2); +void parrot_hash_oplib(PARROT_INTERP, ARGIN(op_lib_t *lib)) + __attribute__nonnull__(1) + __attribute__nonnull__(2); + void Parrot_runcore_destroy(PARROT_INTERP) __attribute__nonnull__(1); @@ -103,6 +107,9 @@ #define ASSERT_ARGS_Parrot_runcore_switch __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(name)) +#define ASSERT_ARGS_parrot_hash_oplib __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ + PARROT_ASSERT_ARG(interp) \ + , PARROT_ASSERT_ARG(lib)) #define ASSERT_ARGS_Parrot_runcore_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) #define ASSERT_ARGS_Parrot_runcore_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ Property changes on: include/parrot/runcore_api.h ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/include/parrot/runcore_api.h:r48886-48917 Index: include/parrot/call.h =================================================================== --- include/parrot/call.h (revision 48898) +++ include/parrot/call.h (revision 48924) @@ -303,10 +303,11 @@ } while (0) #define ADD_OP_VAR_PART(interp, seg, pc, n) do { \ - if (OPCODE_IS((interp), (seg), *(pc), PARROT_OP_set_args_pc) \ - || OPCODE_IS((interp), (seg), *(pc), PARROT_OP_get_results_pc) \ - || OPCODE_IS((interp), (seg), *(pc), PARROT_OP_get_params_pc) \ - || OPCODE_IS((interp), (seg), *(pc), PARROT_OP_set_returns_pc)) { \ + op_lib_t *_core_ops = PARROT_GET_CORE_OPLIB(interp); \ + if (OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_set_args_pc) \ + || OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_get_results_pc) \ + || OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_get_params_pc) \ + || OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_set_returns_pc)) { \ PMC * const sig = (seg)->const_table->constants[(pc)[1]].u.key; \ (n) += VTABLE_elements((interp), sig); \ } \ Property changes on: include/parrot/call.h ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/include/parrot/call.h:r48886-48917 Index: include/parrot/op.h =================================================================== --- include/parrot/op.h (revision 48898) +++ include/parrot/op.h (revision 48924) @@ -78,9 +78,12 @@ struct op_lib_t *lib; } op_info_t; -#define OPCODE_IS(interp, seg, opnum, global_opnum) \ - ((seg)->op_func_table[(opnum)] == (interp)->op_func_table[(global_opnum)]) +#define OP_INFO_OPNUM(oi) ((oi) - (oi)->lib->op_info_table) +#define OP_INFO_OPFUNC(oi) ((oi)->lib->op_func_table[OP_INFO_OPNUM(oi)]) +#define OPCODE_IS(interp, seg, opnum, lib, oplibnum) \ + ((seg)->op_func_table[(opnum)] == (lib)->op_func_table[(oplibnum)]) + #endif /* PARROT_OP_H_GUARD */ /* Index: include/parrot/hash.h =================================================================== --- include/parrot/hash.h (revision 48898) +++ include/parrot/hash.h (revision 48924) @@ -234,6 +234,14 @@ __attribute__nonnull__(1); PARROT_WARN_UNUSED_RESULT +PARROT_PURE_FUNCTION +int hash_compare_cstring(SHIM_INTERP, + ARGIN(const char *a), + ARGIN(const char *b)) + __attribute__nonnull__(2) + __attribute__nonnull__(3); + +PARROT_WARN_UNUSED_RESULT PARROT_CONST_FUNCTION int hash_compare_int(SHIM_INTERP, ARGIN_NULLOK(const void *a), @@ -364,6 +372,11 @@ __attribute__nonnull__(2); PARROT_WARN_UNUSED_RESULT +PARROT_PURE_FUNCTION +size_t key_hash_cstring(SHIM_INTERP, ARGIN(const void *value), size_t seed) + __attribute__nonnull__(2); + +PARROT_WARN_UNUSED_RESULT PARROT_CONST_FUNCTION size_t key_hash_int(SHIM_INTERP, ARGIN_NULLOK(const void *value), @@ -485,6 +498,9 @@ PARROT_ASSERT_ARG(interp)) #define ASSERT_ARGS_parrot_new_pointer_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp)) +#define ASSERT_ARGS_hash_compare_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ + PARROT_ASSERT_ARG(a) \ + , PARROT_ASSERT_ARG(b)) #define ASSERT_ARGS_hash_compare_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) #define ASSERT_ARGS_hash_compare_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ @@ -544,6 +560,8 @@ #define ASSERT_ARGS_hash_value_to_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ , PARROT_ASSERT_ARG(hash)) +#define ASSERT_ARGS_key_hash_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ + PARROT_ASSERT_ARG(value)) #define ASSERT_ARGS_key_hash_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (0) #define ASSERT_ARGS_key_hash_PMC __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ Property changes on: include/parrot/runcore_profiling.h ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/include/parrot/runcore_profiling.h:r48886-48917 Index: include/parrot/interpreter.h =================================================================== --- include/parrot/interpreter.h (revision 48898) +++ include/parrot/interpreter.h (revision 48924) @@ -182,17 +182,6 @@ struct _ParrotIOData *piodata; /* interpreter's IO system */ - op_lib_t *op_lib; /* Opcode library */ - size_t op_count; /* The number of ops */ - op_info_t *op_info_table; /* Opcode info table - * (name, nargs, arg types) */ - - op_func_t *op_func_table; /* opcode dispatch table - * (functions, labels, or nothing - * (e.g. switched core), which - * the interpreter is currently - * running */ - op_func_t *evc_func_table; /* event check opcode dispatch */ size_t evc_func_table_size; @@ -216,7 +205,9 @@ struct PackFile *initial_pf; /* first created PF */ struct _imc_info_t *imc_info; /* imcc data */ + Hash *op_hash; /* mapping from op names to op_info_t */ + const char *output_file; /* where to write output */ PDB_t *pdb; /* debug /trace system */ Property changes on: include/parrot/gc_api.h ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/include/parrot/gc_api.h:r48886-48917 Property changes on: compilers/tge/Rules.mak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/compilers/tge/Rules.mak:r48886-48917 Property changes on: compilers/data_json/Rules.mak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/compilers/data_json/Rules.mak:r48886-48917 Index: compilers/opsc/src/Ops/Emitter.pm =================================================================== --- compilers/opsc/src/Ops/Emitter.pm (revision 48898) +++ compilers/opsc/src/Ops/Emitter.pm (revision 48924) @@ -257,6 +257,7 @@ # TODO There is a bug in NQP about \{ $fh.print(q| +PARROT_EXPORT op_lib_t * | ~ self.init_func ~ q|(PARROT_INTERP, long init) { /* initialize and return op_lib ptr */ Property changes on: compilers/pct/Rules.mak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/compilers/pct/Rules.mak:r48886-48917 Index: compilers/imcc/cfg.c =================================================================== --- compilers/imcc/cfg.c (revision 48898) +++ compilers/imcc/cfg.c (revision 48924) @@ -29,6 +29,7 @@ #include #include "imc.h" #include "optimizer.h" +#include "parrot/oplib/core_ops.h" /* HEADERIZER HFILE: compilers/imcc/cfg.h */ @@ -276,7 +277,7 @@ ins->index = ++i; ins->bbindex = unit->n_basic_blocks - 1; - if (ins->opnum == -1 && (ins->type & ITPCCSUB)) { + if (!ins->op && (ins->type & ITPCCSUB)) { if (first) { if (ins->type & ITLABEL) { expand_pcc_sub_ret(interp, unit, ins); @@ -347,9 +348,10 @@ { ASSERT_ARGS(bb_check_set_addr) const Instruction *ins; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); for (ins = unit->instructions; ins; ins = ins->next) { - if ((ins->opnum == PARROT_OP_set_addr_p_ic) + if ((ins->op == &core_ops->op_info_table[PARROT_OP_set_addr_p_ic]) && STREQ(label->name, ins->symregs[1]->name)) { IMCC_debug(interp, DEBUG_CFG, "set_addr %s\n", ins->symregs[1]->name); Index: compilers/imcc/pbc.c =================================================================== --- compilers/imcc/pbc.c (revision 48898) +++ compilers/imcc/pbc.c (revision 48924) @@ -9,6 +9,7 @@ #include "parrot/pmc_freeze.h" #include "pmc/pmc_sub.h" #include "pmc/pmc_callcontext.h" +#include "parrot/oplib/core_ops.h" /* HEADERIZER HFILE: compilers/imcc/pbc.h */ @@ -642,6 +643,7 @@ ASSERT_ARGS(get_code_size) Instruction *ins = unit->instructions; size_t code_size; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); /* run through instructions: * - sanity check @@ -664,12 +666,12 @@ } else if (ins->opname && *ins->opname) { (*src_lines)++; - if (ins->opnum < 0) + if (!ins->op) IMCC_fatal(interp, 1, "get_code_size: " "no opnum ins#%d %d\n", ins->index, ins); - if (ins->opnum == PARROT_OP_set_p_pc) { + if (ins->op == &core_ops->op_info_table[PARROT_OP_set_p_pc]) { /* set_p_pc opcode */ IMCC_debug(interp, DEBUG_PBC_FIXUP, "PMC constant %s\n", ins->symregs[1]->name); @@ -702,11 +704,10 @@ static opcode_t -bytecode_map_op(PARROT_INTERP, opcode_t op) { +bytecode_map_op(PARROT_INTERP, op_info_t *info) { int i; - op_info_t *info = &interp->op_info_table[op]; op_lib_t *lib = info->lib; - op_func_t op_func = interp->op_func_table[op]; + op_func_t op_func = OP_INFO_OPFUNC(info); PackFile_ByteCode *bc = interp->code; PackFile_ByteCode_OpMappingEntry *om; @@ -857,6 +858,7 @@ ASSERT_ARGS(fixup_globals) subs_t *s; int jumppc = 0; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); for (s = IMCC_INFO(interp)->globals->cs->first; s; s = s->next) { const SymHash * const hsh = &s->fixup; @@ -912,7 +914,7 @@ SymReg * const nam = mk_const(interp, fixup->name, fixup->type & VT_ENCODED ? 'U' : 'S'); - const int op = interp->op_lib->op_code(interp, "find_sub_not_null_p_sc", 1); + op_info_t *op = &core_ops->op_info_table[PARROT_OP_find_sub_not_null_p_sc]; PARROT_ASSERT(op); interp->code->base.data[addr] = bytecode_map_op(interp, op); @@ -2227,9 +2229,10 @@ ASSERT_ARGS(verify_signature) PMC *changed_sig = NULL; PMC * const sig_arr = interp->code->const_table->constants[pc[-1]].u.key; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); int needed = 0; - int no_consts = (ins->opnum == PARROT_OP_get_results_pc - || ins->opnum == PARROT_OP_get_params_pc); + int no_consts = (ins->op == &core_ops->op_info_table[PARROT_OP_get_results_pc] + || ins->op == &core_ops->op_info_table[PARROT_OP_get_params_pc]); INTVAL i, n; @@ -2305,7 +2308,8 @@ { ASSERT_ARGS(e_pbc_emit) int ok = 0; - int op, i; + int i; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); /* first instruction, do initialisation ... */ if (ins == unit->instructions) { @@ -2429,16 +2433,14 @@ IMCC_INFO(interp)->debug_seg->base.data[IMCC_INFO(interp)->ins_line++] = (opcode_t)ins->line; - op = (opcode_t)ins->opnum; - /* Get the info for that opcode */ - op_info = &interp->op_info_table[op]; + op_info = ins->op; IMCC_debug(interp, DEBUG_PBC, "%d %s", IMCC_INFO(interp)->npc, op_info->full_name); /* Start generating the bytecode */ - *(IMCC_INFO(interp)->pc)++ = bytecode_map_op(interp, op); + *(IMCC_INFO(interp)->pc)++ = bytecode_map_op(interp, op_info); for (i = 0; i < op_info->op_count-1; i++) { switch (op_info->types[i]) { @@ -2490,10 +2492,10 @@ break; } } - if (ins->opnum == PARROT_OP_set_args_pc - || ins->opnum == PARROT_OP_get_results_pc - || ins->opnum == PARROT_OP_get_params_pc - || ins->opnum == PARROT_OP_set_returns_pc) { + if (ins->op == &core_ops->op_info_table[PARROT_OP_set_args_pc] + || ins->op == &core_ops->op_info_table[PARROT_OP_get_results_pc] + || ins->op == &core_ops->op_info_table[PARROT_OP_get_params_pc] + || ins->op == &core_ops->op_info_table[PARROT_OP_set_returns_pc]) { /* TODO get rid of verify_signature - PIR call sigs are already * fixed, but PASM still needs it */ Index: compilers/imcc/instructions.c =================================================================== --- compilers/imcc/instructions.c (revision 48898) +++ compilers/imcc/instructions.c (revision 48924) @@ -10,6 +10,7 @@ #include "pbc.h" #include "optimizer.h" #include "pmc/pmc_callcontext.h" +#include "parrot/oplib/core_ops.h" /* @@ -112,7 +113,7 @@ ins->symregs[i] = r[i]; ins->flags = flags; - ins->opnum = -1; + ins->op = NULL; return ins; } @@ -133,20 +134,23 @@ { ASSERT_ARGS(instruction_reads) int f, i; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(NULL); - if (ins->opnum == PARROT_OP_set_args_pc - || ins->opnum == PARROT_OP_set_returns_pc) { + if (ins->op && ins->op->lib == core_ops) { + if (OP_INFO_OPNUM(ins->op) == PARROT_OP_set_args_pc + || OP_INFO_OPNUM(ins->op) == PARROT_OP_set_returns_pc) { - for (i = ins->symreg_count - 1; i >= 0; --i) - if (r == ins->symregs[i]) - return 1; + for (i = ins->symreg_count - 1; i >= 0; --i) + if (r == ins->symregs[i]) + return 1; - return 0; + return 0; + } + else if (OP_INFO_OPNUM(ins->op) == PARROT_OP_get_params_pc || + OP_INFO_OPNUM(ins->op) == PARROT_OP_get_results_pc) { + return 0; + } } - else if (ins->opnum == PARROT_OP_get_params_pc || - ins->opnum == PARROT_OP_get_results_pc) { - return 0; - } f = ins->flags; @@ -172,7 +176,7 @@ /* a sub call reads the previous args */ if (ins->type & ITPCCSUB) { - while (ins && ins->opnum != PARROT_OP_set_args_pc) + while (ins && ins->op != &core_ops->op_info_table[PARROT_OP_set_args_pc]) ins = ins->prev; if (!ins) @@ -204,9 +208,10 @@ ASSERT_ARGS(instruction_writes) const int f = ins->flags; int j; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(NULL); /* a get_results opcode occurs after the actual sub call */ - if (ins->opnum == PARROT_OP_get_results_pc) { + if (ins->op == &core_ops->op_info_table[PARROT_OP_get_results_pc]) { int i; /* but only if it isn't the get_results opcode of @@ -231,7 +236,7 @@ * and point to the most recent pcc_sub * structure */ - while (ins && ins->opnum != PARROT_OP_get_results_pc) + while (ins && ins->op != &core_ops->op_info_table[PARROT_OP_get_results_pc]) ins = ins->next; if (!ins) @@ -245,7 +250,7 @@ return 0; } - if (ins->opnum == PARROT_OP_get_params_pc) { + if (ins->op == &core_ops->op_info_table[PARROT_OP_get_params_pc]) { int i; for (i = ins->symreg_count - 1; i >= 0; --i) { @@ -255,8 +260,8 @@ return 0; } - else if (ins->opnum == PARROT_OP_set_args_pc - || ins->opnum == PARROT_OP_set_returns_pc) { + else if (ins->op == &core_ops->op_info_table[PARROT_OP_set_args_pc] + || ins->op == &core_ops->op_info_table[PARROT_OP_set_returns_pc]) { return 0; } Index: compilers/imcc/pcc.c =================================================================== --- compilers/imcc/pcc.c (revision 48898) +++ compilers/imcc/pcc.c (revision 48924) @@ -29,6 +29,7 @@ #include #include "imc.h" #include "parser.h" +#include "parrot/oplib/core_ops.h" /* HEADERIZER HFILE: compilers/imcc/imc.h */ @@ -675,6 +676,7 @@ SymReg *regs[2]; Instruction *get_params, *tmp_ins, *unused_ins; char *buf; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); if (!(unit->instructions->type & ITLABEL)) return 0; @@ -696,7 +698,7 @@ get_params = unit->instructions->next; - if (get_params->opnum != PARROT_OP_get_params_pc) + if (get_params->op != &core_ops->op_info_table[PARROT_OP_get_params_pc]) return 0; buf = (char *)malloc(strlen(this_sub->name) + 3); Index: compilers/imcc/instructions.h =================================================================== --- compilers/imcc/instructions.h (revision 48898) +++ compilers/imcc/instructions.h (revision 48924) @@ -34,7 +34,7 @@ struct _Instruction *prev; struct _Instruction *next; - int opnum; /* parrot op number */ + op_info_t *op; /* parrot opcode */ int opsize; /* parrot op size */ int line; /* source code line number */ int symreg_count; /* count of regs in **symregs */ Index: compilers/imcc/imc.h =================================================================== --- compilers/imcc/imc.h (revision 48898) +++ compilers/imcc/imc.h (revision 48924) @@ -196,8 +196,8 @@ __attribute__nonnull__(3) FUNC_MODIFIES(*error_message); -PARROT_WARN_UNUSED_RESULT -int check_op(PARROT_INTERP, +void check_op(PARROT_INTERP, + ARGOUT(op_info_t **op_info), ARGOUT(char *fullname), ARGIN(const char *name), ARGIN(SymReg * const * r), @@ -207,6 +207,8 @@ __attribute__nonnull__(2) __attribute__nonnull__(3) __attribute__nonnull__(4) + __attribute__nonnull__(5) + FUNC_MODIFIES(*op_info) FUNC_MODIFIES(*fullname); PARROT_WARN_UNUSED_RESULT @@ -317,7 +319,7 @@ __attribute__nonnull__(1); PARROT_WARN_UNUSED_RESULT -int try_find_op(PARROT_INTERP, +op_info_t * try_find_op(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(const char *name), ARGMOD(SymReg **r), @@ -337,6 +339,7 @@ , PARROT_ASSERT_ARG(error_message)) #define ASSERT_ARGS_check_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ PARROT_ASSERT_ARG(interp) \ + , PARROT_ASSERT_ARG(op_info) \ , PARROT_ASSERT_ARG(fullname) \ , PARROT_ASSERT_ARG(name) \ , PARROT_ASSERT_ARG(r)) Property changes on: compilers/imcc/Rules.in ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/compilers/imcc/Rules.in:r48886-48917 Index: compilers/imcc/optimizer.c =================================================================== --- compilers/imcc/optimizer.c (revision 48898) +++ compilers/imcc/optimizer.c (revision 48924) @@ -74,6 +74,7 @@ #include "pbc.h" #include "optimizer.h" #include "pmc/pmc_callcontext.h" +#include "parrot/oplib/core_ops.h" /* HEADERIZER HFILE: compilers/imcc/optimizer.h */ @@ -368,7 +369,7 @@ last->symregs[reg] = go; tmp = INS(interp, unit, neg_op, "", last->symregs, args, 0, 0); - last->opnum = tmp->opnum; + last->op = tmp->op; last->opsize = tmp->opsize; mem_sys_free(last->opname); last->opname = mem_sys_strdup(tmp->opname); @@ -409,6 +410,7 @@ SymReg *r; int changes = 0; FLOATVAL f; + op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp); IMCC_info(interp, 2, "\tstrength_reduce\n"); for (ins = unit->instructions; ins; ins = ins->next) { @@ -428,37 +430,37 @@ * div Nx, Nx, Ny => sub Nx, Ny * fdiv Nx, Nx, Ny => sub Nx, Ny */ - if (((ins->opnum == PARROT_OP_sub_i_i_i || - ins->opnum == PARROT_OP_sub_i_i_ic || - ins->opnum == PARROT_OP_sub_i_ic_i || - ins->opnum == PARROT_OP_div_i_i_i || - ins->opnum == PARROT_OP_div_i_i_ic || - ins->opnum == PARROT_OP_div_i_ic_i || - ins->opnum == PARROT_OP_fdiv_i_i_i || - ins->opnum == PARROT_OP_fdiv_i_i_ic || - ins->opnum == PARROT_OP_fdiv_i_ic_i || - ins->opnum == PARROT_OP_sub_n_n_n || - ins->opnum == PARROT_OP_sub_n_n_nc || - ins->opnum == PARROT_OP_sub_n_nc_n || - ins->opnum == PARROT_OP_div_n_n_n || - ins->opnum == PARROT_OP_div_n_n_nc || - ins->opnum == PARROT_OP_div_n_nc_n || - ins->opnum == PARROT_OP_fdiv_n_n_n || - ins->opnum == PARROT_OP_fdiv_n_n_nc || - ins->opnum == PARROT_OP_fdiv_n_nc_n) && + if (((ins->op == &core_ops->op_info_table[PARROT_OP_sub_i_i_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_i_ic_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_i_i_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_i_ic_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_i_i_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_i_ic_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_n_n_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_n_nc_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_n_n_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_n_nc_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_n_n_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_n_nc_n]) && ins->symregs[0] == ins->symregs[1]) - || ((ins->opnum == PARROT_OP_add_i_i_i || - ins->opnum == PARROT_OP_add_i_i_ic || - ins->opnum == PARROT_OP_add_i_ic_i || - ins->opnum == PARROT_OP_mul_i_i_i || - ins->opnum == PARROT_OP_mul_i_i_ic || - ins->opnum == PARROT_OP_mul_i_ic_i || - ins->opnum == PARROT_OP_add_n_n_n || - ins->opnum == PARROT_OP_add_n_n_nc || - ins->opnum == PARROT_OP_add_n_nc_n || - ins->opnum == PARROT_OP_mul_n_n_n || - ins->opnum == PARROT_OP_mul_n_n_nc || - ins->opnum == PARROT_OP_mul_n_nc_n) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_add_i_i_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_add_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_add_i_ic_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_i_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_ic_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_add_n_n_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_add_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_add_n_nc_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_n_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_nc_n]) && (ins->symregs[0] == ins->symregs[1] || ins->symregs[0] == ins->symregs[2]))) { IMCC_debug(interp, DEBUG_OPT1, "opt1 %d => ", ins); @@ -483,19 +485,19 @@ * div Nx, 1 => delete * fdiv Nx, 1 => delete */ - if (((ins->opnum == PARROT_OP_add_i_ic || - ins->opnum == PARROT_OP_sub_i_ic) && + if (((ins->op == &core_ops->op_info_table[PARROT_OP_add_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_i_ic]) && IMCC_int_from_reg(interp, ins->symregs[1]) == 0) - || ((ins->opnum == PARROT_OP_mul_i_ic || - ins->opnum == PARROT_OP_div_i_ic || - ins->opnum == PARROT_OP_fdiv_i_ic) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_i_ic]) && IMCC_int_from_reg(interp, ins->symregs[1]) == 1) - || ((ins->opnum == PARROT_OP_add_n_nc || - ins->opnum == PARROT_OP_sub_n_nc) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_add_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_n_nc]) && (f = atof(ins->symregs[1]->name), FLOAT_IS_ZERO(f))) - || ((ins->opnum == PARROT_OP_mul_n_nc || - ins->opnum == PARROT_OP_div_n_nc || - ins->opnum == PARROT_OP_fdiv_n_nc) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_n_nc]) && atof(ins->symregs[1]->name) == 1.0)) { IMCC_debug(interp, DEBUG_OPT1, "opt1 %d => ", ins); ins = delete_ins(unit, ins); @@ -513,16 +515,16 @@ * sub Ix, 1 => dec Ix * sub Nx, 1 => dec Nx */ - if (((ins->opnum == PARROT_OP_add_i_ic || - ins->opnum == PARROT_OP_sub_i_ic) && + if (((ins->op == &core_ops->op_info_table[PARROT_OP_add_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_i_ic]) && IMCC_int_from_reg(interp, ins->symregs[1]) == 1) - || ((ins->opnum == PARROT_OP_add_n_nc || - ins->opnum == PARROT_OP_sub_n_nc) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_add_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_n_nc]) && atof(ins->symregs[1]->name) == 1.0)) { IMCC_debug(interp, DEBUG_OPT1, "opt1 %d => ", ins); --ins->symregs[1]->use_count; - if (ins->opnum == PARROT_OP_add_i_ic || - ins->opnum == PARROT_OP_add_n_nc) + if (ins->op == &core_ops->op_info_table[PARROT_OP_add_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_add_n_nc]) tmp = INS(interp, unit, "inc", "", ins->symregs, 1, 0, 0); else tmp = INS(interp, unit, "dec", "", ins->symregs, 1, 0, 0); @@ -548,27 +550,27 @@ * div Nx, Ny, 1 => set Nx, Ny * fdiv Nx, Ny, 1 => set Nx, Ny */ - if (((ins->opnum == PARROT_OP_add_i_i_ic || - ins->opnum == PARROT_OP_sub_i_i_ic) && + if (((ins->op == &core_ops->op_info_table[PARROT_OP_add_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_i_i_ic]) && IMCC_int_from_reg(interp, ins->symregs[2]) == 0) - || (ins->opnum == PARROT_OP_add_i_ic_i && + || (ins->op == &core_ops->op_info_table[PARROT_OP_add_i_ic_i] && IMCC_int_from_reg(interp, ins->symregs[1]) == 0) - || ((ins->opnum == PARROT_OP_mul_i_i_ic || - ins->opnum == PARROT_OP_div_i_i_ic || - ins->opnum == PARROT_OP_fdiv_i_i_ic) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_i_i_ic] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_i_i_ic]) && IMCC_int_from_reg(interp, ins->symregs[2]) == 1) - || (ins->opnum == PARROT_OP_mul_i_ic_i && + || (ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_ic_i] && IMCC_int_from_reg(interp, ins->symregs[1]) == 1) - || ((ins->opnum == PARROT_OP_add_n_n_nc || - ins->opnum == PARROT_OP_sub_n_n_nc) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_add_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_sub_n_n_nc]) && (f = atof(ins->symregs[2]->name), FLOAT_IS_ZERO(f))) - || (ins->opnum == PARROT_OP_add_n_nc_n && + || (ins->op == &core_ops->op_info_table[PARROT_OP_add_n_nc_n] && (f = atof(ins->symregs[1]->name), FLOAT_IS_ZERO(f))) - || ((ins->opnum == PARROT_OP_mul_n_n_nc || - ins->opnum == PARROT_OP_div_n_n_nc || - ins->opnum == PARROT_OP_fdiv_n_n_nc) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_div_n_n_nc] || + ins->op == &core_ops->op_info_table[PARROT_OP_fdiv_n_n_nc]) && atof(ins->symregs[2]->name) == 1.0) - || (ins->opnum == PARROT_OP_mul_n_nc_n && + || (ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_nc_n] && atof(ins->symregs[1]->name) == 1.0)) { IMCC_debug(interp, DEBUG_OPT1, "opt1 %d => ", ins); if (ins->symregs[1]->type == VTCONST) { @@ -590,15 +592,15 @@ * mul Ix, 0, Iy => set Ix, 0 * mul Ix, 0 => set Ix, 0 */ - if ((ins->opnum == PARROT_OP_mul_i_i_ic && + if ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_i_ic] && IMCC_int_from_reg(interp, ins->symregs[2]) == 0) - || ((ins->opnum == PARROT_OP_mul_i_ic_i || - ins->opnum == PARROT_OP_mul_i_ic) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_ic_i] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_i_ic]) && IMCC_int_from_reg(interp, ins->symregs[1]) == 0) - || (ins->opnum == PARROT_OP_mul_n_n_nc && + || (ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_n_nc] && (f = atof(ins->symregs[2]->name), FLOAT_IS_ZERO(f))) - || ((ins->opnum == PARROT_OP_mul_n_nc_n || - ins->opnum == PARROT_OP_mul_n_nc) && + || ((ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_nc_n] || + ins->op == &core_ops->op_info_table[PARROT_OP_mul_n_nc]) && (f = atof(ins->symregs[1]->name), FLOAT_IS_ZERO(f)))) { IMCC_debug(interp, DEBUG_OPT1, "opt1 %d => ", ins); r = mk_const(interp, "0", ins->symregs[0]->set); @@ -616,9 +618,9 @@ * set Ix, 0 => null Ix * set Nx, 0 => null Nx */ - if ((ins->opnum == PARROT_OP_set_i_ic && + if ((ins->op == &core_ops->op_info_table[PARROT_OP_set_i_ic] && IMCC_int_from_reg(interp, ins->symregs[1]) == 0) - || (ins->opnum == PARROT_OP_set_n_nc && + || (ins->op == &core_ops->op_info_table[PARROT_OP_set_n_nc] && (f = atof(ins->symregs[1]->name), FLOAT_IS_ZERO(f)) && ins->symregs[1]->name[0] != '-')) { IMCC_debug(interp, DEBUG_OPT1, "opt1 %d => ", ins); @@ -714,16 +716,15 @@ } else { char fullname[128]; - const int op = check_op(interp, fullname, ins2->opname, + check_op(interp, &ins2->op, fullname, ins2->opname, ins2->symregs, ins2->symreg_count, ins2->keys); - if (op < 0) { + if (!ins2->op) { ins2->symregs[i] = old; IMCC_debug(interp, DEBUG_OPT2, " - no %s\n", fullname); } else { --old->use_count; - ins2->opnum = op; any = 1; IMCC_debug(interp, DEBUG_OPT2, " -> %d\n", ins2); @@ -804,14 +805,11 @@ opcode_t eval[4], *pc; int opnum; int i; - op_info_t *op_info; - - opnum = interp->op_lib->op_code(interp, op, 1); - if (opnum < 0) + op_info_t *op_info = parrot_hash_get(interp, interp->op_hash, (void *)op); + if (!op_info || !STREQ(op_info->full_name, op)) IMCC_fatal(interp, 1, "eval_ins: op '%s' not found\n", op); - op_info = interp->op_info_table + opnum; /* now fill registers */ - eval[0] = opnum; + eval[0] = 0; for (i = 0; i < op_info->op_count - 1; i++) { switch (op_info->types[i]) { case PARROT_ARG_IC: @@ -855,7 +853,7 @@ if (setjmp(interp->current_runloop->resume)) return -1; - pc = (interp->op_func_table[opnum]) (eval, interp); + pc = (OP_INFO_OPFUNC(op_info)) (eval, interp); free_runloop_jump_point(interp); /* the returned pc is either incremented by op_count or is eval, * as the branch offset is 0 - return true if it branched Index: compilers/imcc/imcparser.c =================================================================== --- compilers/imcc/imcparser.c (revision 48898) +++ compilers/imcc/imcparser.c (revision 48924) @@ -9,13 +9,12 @@ */ /* HEADERIZER HFILE: none */ /* HEADERIZER STOP */ +/* A Bison parser, made by GNU Bison 2.4.3. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +56,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -1151,7 +1150,7 @@ /* Line 189 of yacc.c */ -#line 1144 "compilers/imcc/imcparser.c" +#line 1143 "compilers/imcc/imcparser.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -1435,7 +1434,7 @@ /* Line 214 of yacc.c */ -#line 1428 "compilers/imcc/imcparser.c" +#line 1427 "compilers/imcc/imcparser.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -1447,7 +1446,7 @@ /* Line 264 of yacc.c */ -#line 1440 "compilers/imcc/imcparser.c" +#line 1439 "compilers/imcc/imcparser.c" #ifdef short # undef short @@ -1497,7 +1496,7 @@ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -2444,9 +2443,18 @@ /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -2503,7 +2511,7 @@ we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -3254,28 +3262,28 @@ { case 2: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1166 "compilers/imcc/imcc.y" { if (yynerrs) YYABORT; (yyval.i) = 0; } break; case 5: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1175 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 6: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1176 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 7: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1178 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); @@ -3286,7 +3294,7 @@ case 8: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1184 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); @@ -3297,42 +3305,42 @@ case 9: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1189 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 10: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1190 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 11: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1191 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 12: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1192 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 13: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1196 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 14: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1198 "compilers/imcc/imcc.y" { (yyval.i) = 0; @@ -3343,7 +3351,7 @@ case 15: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1207 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->line = atoi((yyvsp[(2) - (5)].s)); @@ -3354,7 +3362,7 @@ case 16: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1213 "compilers/imcc/imcc.y" { /* set_filename() frees the STRINGC */ @@ -3364,7 +3372,7 @@ case 17: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1221 "compilers/imcc/imcc.y" { /* We'll want to store an entry while emitting instructions, so just @@ -3377,7 +3385,7 @@ case 18: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1233 "compilers/imcc/imcc.y" { STRING * const hll_name = Parrot_str_unescape(interp, (yyvsp[(2) - (2)].s) + 1, '"', NULL); @@ -3392,14 +3400,14 @@ case 19: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1245 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 20: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1246 "compilers/imcc/imcc.y" { mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1); @@ -3410,14 +3418,14 @@ case 21: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1254 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 22: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1255 "compilers/imcc/imcc.y" { (yyval.i) = mk_pmc_const(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s)); @@ -3428,14 +3436,14 @@ case 23: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1261 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 24: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1262 "compilers/imcc/imcc.y" { (yyval.i) = mk_pmc_const_named(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s)); @@ -3447,49 +3455,49 @@ case 29: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1280 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 30: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1281 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 31: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1282 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 32: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1283 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 33: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1284 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 36: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1289 "compilers/imcc/imcc.y" { clear_state(interp); } break; case 37: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1291 "compilers/imcc/imcc.y" { (yyval.i) = INS(interp, IMCC_INFO(interp)->cur_unit, @@ -3501,7 +3509,7 @@ case 38: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1298 "compilers/imcc/imcc.y" { imc_close_unit(interp, IMCC_INFO(interp)->cur_unit); @@ -3511,7 +3519,7 @@ case 39: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1303 "compilers/imcc/imcc.y" { (yyval.i) = iSUBROUTINE(interp, @@ -3524,7 +3532,7 @@ case 40: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1311 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); @@ -3533,7 +3541,7 @@ case 41: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1315 "compilers/imcc/imcc.y" { char *name = mem_sys_strdup((yyvsp[(2) - (4)].s) + 1); @@ -3551,21 +3559,21 @@ case 42: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1327 "compilers/imcc/imcc.y" { (yyval.i) = 0;} break; case 44: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1335 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); } break; case 45: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1338 "compilers/imcc/imcc.y" { /* if (optimizer_level & OPT_PASM) @@ -3578,7 +3586,7 @@ case 48: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1354 "compilers/imcc/imcc.y" { int re_open = 0; @@ -3595,21 +3603,21 @@ case 49: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1368 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(2) - (3)].sr); } break; case 50: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1369 "compilers/imcc/imcc.y" { (yyval.sr) = NULL; } break; case 51: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1373 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->nkeys = 0; @@ -3618,7 +3626,7 @@ case 52: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1377 "compilers/imcc/imcc.y" { (yyval.sr) = link_keys(interp, @@ -3629,14 +3637,14 @@ case 53: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1385 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); } break; case 54: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1387 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr); @@ -3646,7 +3654,7 @@ case 55: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1395 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PCCSUB); @@ -3655,7 +3663,7 @@ case 56: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1399 "compilers/imcc/imcc.y" { iSUBROUTINE(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (3)].sr)); @@ -3664,7 +3672,7 @@ case 57: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1403 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(5) - (6)].t); @@ -3677,28 +3685,28 @@ case 58: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1411 "compilers/imcc/imcc.y" { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; } break; case 59: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1415 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 60: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1416 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 61: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1418 "compilers/imcc/imcc.y" { if (IMCC_INFO(interp)->adv_named_id) { @@ -3713,21 +3721,21 @@ case 62: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1430 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 63: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1430 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(3) - (3)].sr); IMCC_INFO(interp)->is_def = 0; } break; case 64: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1435 "compilers/imcc/imcc.y" { if ((yyvsp[(3) - (3)].t) & VT_OPT_FLAG && (yyvsp[(1) - (3)].t) != 'I') { @@ -3752,14 +3760,14 @@ case 65: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1459 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 66: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1464 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3770,7 +3778,7 @@ case 67: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1470 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3781,7 +3789,7 @@ case 68: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1479 "compilers/imcc/imcc.y" { (yyval.t) = P_VTABLE; @@ -3792,7 +3800,7 @@ case 69: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1485 "compilers/imcc/imcc.y" { (yyval.t) = P_VTABLE; @@ -3803,7 +3811,7 @@ case 70: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1494 "compilers/imcc/imcc.y" { (yyval.t) = P_METHOD; @@ -3814,7 +3822,7 @@ case 71: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1500 "compilers/imcc/imcc.y" { (yyval.t) = P_METHOD; @@ -3825,7 +3833,7 @@ case 72: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1509 "compilers/imcc/imcc.y" { (yyval.t) = P_NSENTRY; @@ -3836,7 +3844,7 @@ case 73: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1515 "compilers/imcc/imcc.y" { (yyval.t) = P_NSENTRY; @@ -3847,7 +3855,7 @@ case 74: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1524 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3857,7 +3865,7 @@ case 75: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1532 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3867,7 +3875,7 @@ case 76: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1537 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3879,7 +3887,7 @@ case 77: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1547 "compilers/imcc/imcc.y" { add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, NULL); @@ -3888,7 +3896,7 @@ case 78: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1551 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3898,7 +3906,7 @@ case 79: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1556 "compilers/imcc/imcc.y" { (yyval.t) = 0; @@ -3908,35 +3916,35 @@ case 80: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1563 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, "INTVAL", 'S'); } break; case 81: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1564 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); } break; case 82: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1565 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, "PMC", 'S'); } break; case 83: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1566 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, "STRING", 'S'); } break; case 84: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1568 "compilers/imcc/imcc.y" { SymReg *r; @@ -3952,7 +3960,7 @@ case 85: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1579 "compilers/imcc/imcc.y" { SymReg *r; @@ -3968,14 +3976,14 @@ case 86: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1589 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(2) - (3)].sr); } break; case 89: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1599 "compilers/imcc/imcc.y" { char name[128]; @@ -4002,112 +4010,112 @@ case 90: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1625 "compilers/imcc/imcc.y" { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; } break; case 91: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1629 "compilers/imcc/imcc.y" { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; } break; case 92: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1630 "compilers/imcc/imcc.y" { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; } break; case 93: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1634 "compilers/imcc/imcc.y" { (yyval.i) = NULL; } break; case 94: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1635 "compilers/imcc/imcc.y" { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); } break; case 95: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1639 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 97: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1644 "compilers/imcc/imcc.y" { (yyval.t) = (yyvsp[(1) - (1)].t); } break; case 98: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1645 "compilers/imcc/imcc.y" { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); } break; case 99: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1649 "compilers/imcc/imcc.y" { (yyval.t) = P_LOAD; } break; case 100: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1650 "compilers/imcc/imcc.y" { (yyval.t) = P_INIT; } break; case 101: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1651 "compilers/imcc/imcc.y" { (yyval.t) = P_MAIN; } break; case 102: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1652 "compilers/imcc/imcc.y" { (yyval.t) = P_IMMEDIATE; } break; case 103: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1653 "compilers/imcc/imcc.y" { (yyval.t) = P_POSTCOMP; } break; case 104: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1654 "compilers/imcc/imcc.y" { (yyval.t) = P_ANON; } break; case 105: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1655 "compilers/imcc/imcc.y" { (yyval.t) = P_NEED_LEX; } break; case 113: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1667 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr)); @@ -4117,7 +4125,7 @@ case 114: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1672 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); @@ -4126,7 +4134,7 @@ case 115: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1676 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); @@ -4135,7 +4143,7 @@ case 116: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1680 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); @@ -4144,7 +4152,7 @@ case 117: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1684 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (3)].s), 'S')); @@ -4153,7 +4161,7 @@ case 118: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1688 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr)); @@ -4163,7 +4171,7 @@ case 119: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1693 "compilers/imcc/imcc.y" { add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (5)].s), 'S')); @@ -4173,14 +4181,14 @@ case 120: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1701 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 121: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1702 "compilers/imcc/imcc.y" { if (IMCC_INFO(interp)->adv_named_id) { @@ -4195,21 +4203,21 @@ case 122: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1714 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(2) - (2)].sr); } break; case 123: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1719 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 124: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1721 "compilers/imcc/imcc.y" { if ((yyvsp[(2) - (3)].sr)) @@ -4219,21 +4227,21 @@ case 125: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1728 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); } break; case 126: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1729 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 127: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1730 "compilers/imcc/imcc.y" { IdList * const l = (yyvsp[(4) - (4)].idlist); @@ -4247,91 +4255,91 @@ case 128: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1741 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 129: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1742 "compilers/imcc/imcc.y" { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); } break; case 130: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1746 "compilers/imcc/imcc.y" { (yyval.t) = VT_FLAT; } break; case 131: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1747 "compilers/imcc/imcc.y" { (yyval.t) = VT_OPTIONAL; } break; case 132: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1748 "compilers/imcc/imcc.y" { (yyval.t) = VT_OPT_FLAG; } break; case 133: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1749 "compilers/imcc/imcc.y" { (yyval.t) = VT_NAMED; } break; case 134: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1750 "compilers/imcc/imcc.y" { adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = VT_NAMED; mem_sys_free((yyvsp[(3) - (4)].s)); } break; case 135: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1751 "compilers/imcc/imcc.y" { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = VT_NAMED; mem_sys_free((yyvsp[(3) - (4)].s)); } break; case 136: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1752 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 137: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1753 "compilers/imcc/imcc.y" { (yyval.t) = VT_CALL_SIG; } break; case 138: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1758 "compilers/imcc/imcc.y" { begin_return_or_yield(interp, 0); } break; case 139: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1760 "compilers/imcc/imcc.y" { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; } break; case 140: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1762 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->asm_state = AsmDefault; @@ -4341,28 +4349,28 @@ case 141: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1769 "compilers/imcc/imcc.y" { begin_return_or_yield(interp, 1); } break; case 142: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1771 "compilers/imcc/imcc.y" { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; } break; case 143: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1775 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 144: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1777 "compilers/imcc/imcc.y" { if ((yyvsp[(1) - (2)].sr)) @@ -4372,7 +4380,7 @@ case 145: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1782 "compilers/imcc/imcc.y" { if ((yyvsp[(2) - (3)].sr)) @@ -4382,14 +4390,14 @@ case 146: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1789 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 147: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1791 "compilers/imcc/imcc.y" { if ((yyvsp[(1) - (2)].sr)) @@ -4399,7 +4407,7 @@ case 148: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1796 "compilers/imcc/imcc.y" { if ((yyvsp[(2) - (3)].sr)) @@ -4409,21 +4417,21 @@ case 149: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1803 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); } break; case 150: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1807 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); } break; case 151: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1812 "compilers/imcc/imcc.y" { if (IMCC_INFO(interp)->asm_state == AsmDefault) @@ -4433,7 +4441,7 @@ case 152: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1817 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->asm_state = AsmDefault; @@ -4443,28 +4451,28 @@ case 153: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1824 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 154: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1825 "compilers/imcc/imcc.y" { (yyval.t) = 1; } break; case 155: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1829 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 156: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1831 "compilers/imcc/imcc.y" { if (IMCC_INFO(interp)->adv_named_id) { @@ -4479,7 +4487,7 @@ case 157: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1841 "compilers/imcc/imcc.y" { SymReg * const name = mk_const(interp, (yyvsp[(1) - (3)].s), 'S'); @@ -4489,7 +4497,7 @@ case 158: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1846 "compilers/imcc/imcc.y" { if (IMCC_INFO(interp)->adv_named_id) { @@ -4504,7 +4512,7 @@ case 159: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1856 "compilers/imcc/imcc.y" { SymReg * const name = mk_const(interp, (yyvsp[(3) - (5)].s), 'S'); @@ -4514,63 +4522,63 @@ case 162: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1877 "compilers/imcc/imcc.y" { clear_state(interp); } break; case 163: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1882 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(2) - (2)].i); } break; case 164: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1883 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 165: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1884 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 166: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1885 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 167: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1886 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 168: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1887 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 169: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1891 "compilers/imcc/imcc.y" { (yyval.i) = NULL; } break; case 173: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1902 "compilers/imcc/imcc.y" { Instruction * const i = iLABEL(interp, IMCC_INFO(interp)->cur_unit, mk_local_label(interp, (yyvsp[(1) - (1)].s))); @@ -4581,14 +4589,14 @@ case 174: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1912 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(2) - (3)].i); } break; case 175: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1914 "compilers/imcc/imcc.y" { if (yynerrs >= PARROT_MAX_RECOVER_ERRORS) { @@ -4601,7 +4609,7 @@ case 176: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1925 "compilers/imcc/imcc.y" { IdList* const l = (yyvsp[(1) - (1)].idlist); @@ -4612,7 +4620,7 @@ case 177: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1932 "compilers/imcc/imcc.y" { IdList* const l = (yyvsp[(3) - (3)].idlist); @@ -4623,7 +4631,7 @@ case 178: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1941 "compilers/imcc/imcc.y" { IdList* const l = mem_gc_allocate_n_zeroed_typed(interp, 1, IdList); @@ -4634,14 +4642,14 @@ case 183: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1957 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 184: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1958 "compilers/imcc/imcc.y" { IdList *l = (yyvsp[(4) - (4)].idlist); @@ -4659,7 +4667,7 @@ case 185: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1971 "compilers/imcc/imcc.y" { if ((yyvsp[(4) - (4)].sr)->set != 'P') { @@ -4681,7 +4689,7 @@ case 186: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 1988 "compilers/imcc/imcc.y" { if ((yyvsp[(4) - (4)].sr)->set != 'P') { @@ -4699,14 +4707,14 @@ case 187: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2000 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 188: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2001 "compilers/imcc/imcc.y" { mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 0); @@ -4717,14 +4725,14 @@ case 190: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2008 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->is_def = 1; } break; case 191: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2009 "compilers/imcc/imcc.y" { mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1); @@ -4735,7 +4743,7 @@ case 192: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2015 "compilers/imcc/imcc.y" { (yyval.i) = NULL; @@ -4746,7 +4754,7 @@ case 193: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2021 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "branch", 1, (yyvsp[(2) - (2)].sr)); @@ -4755,7 +4763,7 @@ case 194: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2025 "compilers/imcc/imcc.y" { (yyval.i) = INS(interp, @@ -4772,98 +4780,98 @@ case 195: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2036 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); } break; case 196: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2037 "compilers/imcc/imcc.y" { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; } break; case 197: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2038 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 200: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2041 "compilers/imcc/imcc.y" { (yyval.i) = 0;} break; case 201: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2045 "compilers/imcc/imcc.y" { (yyval.t) = 'I'; } break; case 202: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2046 "compilers/imcc/imcc.y" { (yyval.t) = 'N'; } break; case 203: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2047 "compilers/imcc/imcc.y" { (yyval.t) = 'S'; } break; case 204: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2048 "compilers/imcc/imcc.y" { (yyval.t) = 'P'; } break; case 205: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2053 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "set", 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); } break; case 206: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2055 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (4)].s), 2, (yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].sr)); } break; case 207: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2057 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(4) - (5)].s), 3, (yyvsp[(1) - (5)].sr), (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); } break; case 208: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2059 "compilers/imcc/imcc.y" { (yyval.i) = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(5) - (6)].sr)); } break; case 209: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2061 "compilers/imcc/imcc.y" { (yyval.i) = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(6) - (6)].sr)); } break; case 210: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2064 "compilers/imcc/imcc.y" { add_pcc_result(interp, (yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr)); @@ -4874,7 +4882,7 @@ case 211: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2070 "compilers/imcc/imcc.y" { (yyval.i) = IMCC_create_itcall_label(interp); @@ -4883,7 +4891,7 @@ case 212: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2074 "compilers/imcc/imcc.y" { IMCC_itcall_sub(interp, (yyvsp[(6) - (9)].sr)); @@ -4893,7 +4901,7 @@ case 216: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2082 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(1) - (3)].sr)); @@ -4902,189 +4910,189 @@ case 217: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2089 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"not"; } break; case 218: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2090 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"bnot"; } break; case 219: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2091 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"neg"; } break; case 220: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2095 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"sub"; } break; case 221: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2096 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"add"; } break; case 222: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2097 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"mul"; } break; case 223: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2098 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"div"; } break; case 224: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2099 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"mod"; } break; case 225: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2100 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"fdiv"; } break; case 226: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2101 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"pow"; } break; case 227: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2102 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"concat"; } break; case 228: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2103 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"iseq"; } break; case 229: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2104 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"isne"; } break; case 230: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2105 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"isgt"; } break; case 231: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2106 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"isge"; } break; case 232: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2107 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"islt"; } break; case 233: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2108 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"isle"; } break; case 234: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2109 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"shl"; } break; case 235: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2110 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"shr"; } break; case 236: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2111 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"lsr"; } break; case 237: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2112 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"and"; } break; case 238: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2113 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"or"; } break; case 239: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2114 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"xor"; } break; case 240: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2115 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"band"; } break; case 241: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2116 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"bor"; } break; case 242: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2117 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"bxor"; } break; case 243: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2123 "compilers/imcc/imcc.y" { (yyval.i) = IMCC_create_itcall_label(interp); @@ -5095,112 +5103,112 @@ case 244: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2128 "compilers/imcc/imcc.y" { (yyval.i) = 0; } break; case 245: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2135 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(2) - (3)].s), 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); } break; case 246: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2139 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"add"; } break; case 247: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2140 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"sub"; } break; case 248: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2141 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"mul"; } break; case 249: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2142 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"div"; } break; case 250: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2143 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"mod"; } break; case 251: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2144 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"fdiv"; } break; case 252: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2145 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"concat"; } break; case 253: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2146 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"band"; } break; case 254: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2147 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"bor"; } break; case 255: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2148 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"bxor"; } break; case 256: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2149 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"shr"; } break; case 257: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2150 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"shl"; } break; case 258: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2151 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"lsr"; } break; case 259: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2157 "compilers/imcc/imcc.y" { (yyval.i) = func_ins(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].s), @@ -5213,28 +5221,28 @@ case 260: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2167 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 261: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2168 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 262: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2169 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 263: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2171 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(1) - (1)].sr); @@ -5245,7 +5253,7 @@ case 264: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2177 "compilers/imcc/imcc.y" { /* disallow bareword method names; SREG name constants are fine */ @@ -5264,7 +5272,7 @@ case 265: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2191 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); @@ -5275,7 +5283,7 @@ case 266: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2197 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); @@ -5286,14 +5294,14 @@ case 267: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2202 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); } break; case 268: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2208 "compilers/imcc/imcc.y" { (yyval.i) = IMCC_create_itcall_label(interp); @@ -5303,21 +5311,21 @@ case 269: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2212 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(2) - (5)].i); } break; case 270: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2216 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 271: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2218 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5332,7 +5340,7 @@ case 272: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2228 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5347,7 +5355,7 @@ case 273: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2238 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5359,7 +5367,7 @@ case 274: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2245 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5369,7 +5377,7 @@ case 275: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2250 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5381,70 +5389,70 @@ case 276: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2259 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); } break; case 277: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2263 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 278: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2264 "compilers/imcc/imcc.y" { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); } break; case 279: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2268 "compilers/imcc/imcc.y" { (yyval.t) = VT_FLAT; } break; case 280: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2269 "compilers/imcc/imcc.y" { (yyval.t) = VT_NAMED; } break; case 281: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2270 "compilers/imcc/imcc.y" { (yyval.t) = VT_CALL_SIG; } break; case 282: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2272 "compilers/imcc/imcc.y" { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); mem_sys_free((yyvsp[(3) - (4)].s)); (yyval.t) = 0; } break; case 283: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2273 "compilers/imcc/imcc.y" { adv_named_set(interp, (yyvsp[(3) - (4)].s)); mem_sys_free((yyvsp[(3) - (4)].s)); (yyval.t) = 0; } break; case 284: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2277 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); } break; case 285: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2282 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5459,7 +5467,7 @@ case 286: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2292 "compilers/imcc/imcc.y" { add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, @@ -5470,7 +5478,7 @@ case 287: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2298 "compilers/imcc/imcc.y" { (yyval.sr) = 0; @@ -5485,7 +5493,7 @@ case 288: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2308 "compilers/imcc/imcc.y" { add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr)); @@ -5495,28 +5503,28 @@ case 289: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2312 "compilers/imcc/imcc.y" { (yyval.sr) = 0; } break; case 290: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2316 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 291: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2317 "compilers/imcc/imcc.y" { (yyval.i) = (yyvsp[(1) - (1)].i); } break; case 292: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2322 "compilers/imcc/imcc.y" { (yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, inv_op((yyvsp[(3) - (6)].s)), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr)); @@ -5525,7 +5533,7 @@ case 293: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2326 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); @@ -5534,7 +5542,7 @@ case 294: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2330 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr)); @@ -5543,7 +5551,7 @@ case 295: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2337 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr)); @@ -5552,7 +5560,7 @@ case 296: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2341 "compilers/imcc/imcc.y" { (yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr)); @@ -5561,7 +5569,7 @@ case 297: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2345 "compilers/imcc/imcc.y" { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); @@ -5570,91 +5578,91 @@ case 298: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2351 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 299: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2352 "compilers/imcc/imcc.y" { (yyval.t) = 0; } break; case 300: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2356 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"eq"; } break; case 301: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2357 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"ne"; } break; case 302: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2358 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"gt"; } break; case 303: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2359 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"ge"; } break; case 304: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2360 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"lt"; } break; case 305: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2361 "compilers/imcc/imcc.y" { (yyval.s) = (char *)"le"; } break; case 308: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2370 "compilers/imcc/imcc.y" { (yyval.sr) = NULL; } break; case 309: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2371 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(1) - (1)].sr); } break; case 310: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2375 "compilers/imcc/imcc.y" { (yyval.sr) = IMCC_INFO(interp)->regs[0]; } break; case 312: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2380 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); } break; case 313: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2382 "compilers/imcc/imcc.y" { IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (4)].sr); @@ -5666,7 +5674,7 @@ case 314: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2389 "compilers/imcc/imcc.y" { IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(2) - (3)].sr); @@ -5676,49 +5684,49 @@ case 316: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2396 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 317: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2397 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 318: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2401 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 319: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2402 "compilers/imcc/imcc.y" { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 320: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2406 "compilers/imcc/imcc.y" { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 321: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2407 "compilers/imcc/imcc.y" { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 326: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2421 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->nkeys = 0; @@ -5727,7 +5735,7 @@ case 327: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2425 "compilers/imcc/imcc.y" { (yyval.sr) = link_keys(interp, @@ -5738,7 +5746,7 @@ case 328: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2433 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->nkeys = 0; @@ -5747,7 +5755,7 @@ case 329: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2437 "compilers/imcc/imcc.y" { (yyval.sr) = link_keys(interp, @@ -5758,14 +5766,14 @@ case 330: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2445 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); } break; case 331: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2447 "compilers/imcc/imcc.y" { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr); @@ -5775,7 +5783,7 @@ case 332: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2455 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(1) - (1)].sr); @@ -5784,78 +5792,78 @@ case 333: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2461 "compilers/imcc/imcc.y" { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); } break; case 334: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2462 "compilers/imcc/imcc.y" { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); } break; case 335: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2463 "compilers/imcc/imcc.y" { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); } break; case 336: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2464 "compilers/imcc/imcc.y" { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); } break; case 337: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2465 "compilers/imcc/imcc.y" { (yyval.sr) = mk_pasm_reg(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 338: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2469 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 339: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2470 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 340: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2474 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 341: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2475 "compilers/imcc/imcc.y" { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); } break; case 342: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 2476 "compilers/imcc/imcc.y" { (yyval.sr) = (yyvsp[(1) - (1)].sr); } break; -/* Line 1455 of yacc.c */ -#line 5848 "compilers/imcc/imcparser.c" +/* Line 1464 of yacc.c */ +#line 5856 "compilers/imcc/imcparser.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -6066,7 +6074,7 @@ -/* Line 1675 of yacc.c */ +/* Line 1684 of yacc.c */ #line 2482 "compilers/imcc/imcc.y" Index: compilers/imcc/debug.c =================================================================== --- compilers/imcc/debug.c (revision 48898) +++ compilers/imcc/debug.c (revision 48924) @@ -202,7 +202,7 @@ Parrot_io_fprintf(interp, Parrot_io_STDERR(interp), "%4i %4d %4d %4d\t%x\t%8x %4d %4d %4d ", ins->index, ins->line, bb->index, bb->loop_depth, - ins->flags, ins->type, ins->opnum, + ins->flags, ins->type, OP_INFO_OPNUM(ins->op), ins->opsize, pc); } else { Index: compilers/imcc/parser_util.c =================================================================== --- compilers/imcc/parser_util.c (revision 48898) +++ compilers/imcc/parser_util.c (revision 48924) @@ -175,8 +175,8 @@ /* -=item C +=item C Return opcode value for op name @@ -184,15 +184,15 @@ */ -PARROT_WARN_UNUSED_RESULT -int -check_op(PARROT_INTERP, ARGOUT(char *fullname), ARGIN(const char *name), - ARGIN(SymReg * const * r), int narg, int keyvec) +void +check_op(PARROT_INTERP, ARGOUT(op_info_t **op_info), ARGOUT(char *fullname), + ARGIN(const char *name), ARGIN(SymReg * const * r), int narg, int keyvec) { ASSERT_ARGS(check_op) op_fullname(fullname, name, r, narg, keyvec); - - return interp->op_lib->op_code(interp, fullname, 1); + *op_info = parrot_hash_get(interp, interp->op_hash, fullname); + if (*op_info && !STREQ((*op_info)->full_name, fullname)) + *op_info = NULL; } /* @@ -210,8 +210,7 @@ is_op(PARROT_INTERP, ARGIN(const char *name)) { ASSERT_ARGS(is_op) - return interp->op_lib->op_code(interp, name, 0) >= 0 - || interp->op_lib->op_code(interp, name, 1) >= 0; + return parrot_hash_exists(interp, interp->op_hash, (void *)name); } /* @@ -234,7 +233,7 @@ ARGMOD(SymReg **r), int n, int emit) { ASSERT_ARGS(var_arg_ins) - int op; + op_info_t *op; Instruction *ins; char fullname[64]; @@ -251,12 +250,12 @@ r[0]->pmc_type = enum_class_FixedIntegerArray; op_fullname(fullname, name, r, 1, 0); - op = interp->op_lib->op_code(interp, fullname, 1); + op = parrot_hash_get(interp, interp->op_hash, fullname); - PARROT_ASSERT(op >= 0); + PARROT_ASSERT(op && STREQ(op->full_name, fullname)); ins = _mk_instruction(name, "", n, r, dirs); - ins->opnum = op; + ins->op = op; ins->opsize = n + 1; if (emit) @@ -309,33 +308,40 @@ return var_arg_ins(interp, unit, name, r, n, emit); else { Instruction *ins; - int i, op, len; + int i, len; int dirs = 0; - op_info_t *op_info; + op_info_t *op; char fullname[64] = "", format[128] = ""; op_fullname(fullname, name, r, n, keyvec); - op = interp->op_lib->op_code(interp, fullname, 1); + op = parrot_hash_get(interp, interp->op_hash, fullname); + if (op && !STREQ(op->full_name, fullname)) + op = NULL; /* maybe we have a fullname */ - if (op < 0) - op = interp->op_lib->op_code(interp, name, 1); + if (!op) { + op = parrot_hash_get(interp, interp->op_hash, name); + if (op && !STREQ(op->full_name, name)) + op = NULL; + } /* still wrong, try reverse compare */ - if (op < 0) { + if (!op) { const char * const n_name = try_rev_cmp(name, r); if (n_name) { name = n_name; op_fullname(fullname, name, r, n, keyvec); - op = interp->op_lib->op_code(interp, fullname, 1); + op = parrot_hash_get(interp, interp->op_hash, fullname); + if (op && !STREQ(op->full_name, fullname)) + op = NULL; } } /* still wrong, try to find an existing op */ - if (op < 0) + if (!op) op = try_find_op(interp, unit, name, r, n, keyvec, emit); - if (op < 0) { + if (!op) { int ok = 0; /* check mixed constants */ @@ -356,26 +362,25 @@ else strcpy(fullname, name); - if (op < 0) + if (!op) IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "The opcode '%s' (%s<%d>) was not found. " "Check the type and number of the arguments", fullname, name, n); - op_info = &interp->op_info_table[op]; *format = '\0'; /* info->op_count is args + 1 * build instruction format * set LV_in / out flags */ - if (n != op_info->op_count - 1) + if (n != op->op_count - 1) IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "arg count mismatch: op #%d '%s' needs %d given %d", - op, fullname, op_info->op_count-1, n); + op, fullname, op->op_count-1, n); /* XXX Speed up some by keep track of the end of format ourselves */ for (i = 0; i < n; i++) { - switch (op_info->dirs[i]) { + switch (op->dirs[i]) { case PARROT_ARGDIR_INOUT: dirs |= 1 << (16 + i); /* go on */ @@ -422,7 +427,7 @@ ins->keys |= keyvec; /* fill in oplib's info */ - ins->opnum = op; + ins->op = op; ins->opsize = n + 1; /* mark end as absolute branch */ @@ -443,8 +448,8 @@ /* set up branch flags * mark registers that are labels */ - for (i = 0; i < op_info->op_count - 1; i++) { - if (op_info->labels[i]) + for (i = 0; i < op->op_count - 1; i++) { + if (op->labels[i]) ins->type |= ITBRANCH | (1 << i); else { if (r[i]->type == VTADDRESS) @@ -453,7 +458,7 @@ } } - if (op_info->jump) { + if (op->jump) { ins->type |= ITBRANCH; /* TODO use opnum constants */ if (STREQ(name, "branch") @@ -965,8 +970,8 @@ /* -=item C +=item C Try to find valid op doing the same operation e.g. @@ -981,7 +986,7 @@ */ PARROT_WARN_UNUSED_RESULT -int +op_info_t * try_find_op(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(const char *name), ARGMOD(SymReg **r), int n, int keyvec, int emit) { @@ -1017,11 +1022,15 @@ } if (changed) { + op_info_t *op; op_fullname(fullname, name, r, n, keyvec); - return interp->op_lib->op_code(interp, fullname, 1); + op = parrot_hash_get(interp, interp->op_hash, fullname); + if (op && !STREQ(op->full_name, fullname)) + op = NULL; + return op; } - return -1; + return NULL; } /* Index: compilers/imcc/imcparser.h =================================================================== --- compilers/imcc/imcparser.h (revision 48898) +++ compilers/imcc/imcparser.h (revision 48924) @@ -9,13 +9,12 @@ */ /* HEADERIZER HFILE: none */ /* HEADERIZER STOP */ +/* A Bison parser, made by GNU Bison 2.4.3. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -295,7 +294,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 1685 of yacc.c */ #line 1071 "compilers/imcc/imcc.y" IdList * idlist; @@ -306,8 +305,8 @@ -/* Line 1676 of yacc.c */ -#line 300 "compilers/imcc/imcparser.h" +/* Line 1685 of yacc.c */ +#line 299 "compilers/imcc/imcparser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ Property changes on: compilers/pge/Rules.mak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/compilers/pge/Rules.mak:r48886-48917 Property changes on: t/pmc/namespace-old.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/pmc/namespace-old.t:r48886-48917 Index: t/pmc/lexinfo.t =================================================================== --- t/pmc/lexinfo.t (revision 48898) +++ t/pmc/lexinfo.t (revision 48924) @@ -17,11 +17,15 @@ =cut +.include 'except_types.pasm' + .sub main :main .include 'test_more.pir' - plan(3) + plan(5) inspect_test() + inspect_invalid_test() + declare_lex_preg_test() .end .sub inspect_test @@ -58,6 +62,33 @@ is(have_b, 1, "$b symbol was in list") .end +.sub inspect_invalid_test + .local pmc li, in, ex + .local int r, type + li = new ['LexInfo'] + r = 0 + push_eh catch + in = inspect li, 'fubar' + goto done + catch: + .get_results(ex) + type = ex['type'] + r = iseq type, .EXCEPTION_INVALID_OPERATION + done: + ok(r, 'invalid introspection key throws as expected') +.end + +.sub declare_lex_preg_test + .const string preg_name = 'foo' + .const int preg_value = 42 + .local pmc li + li = new ['LexInfo'] + li.'declare_lex_preg'(preg_name, preg_value) + .local int r + r = li[preg_name] + is(r, preg_value, 'declare_lex_preg method') +.end + # Local Variables: # mode: pir # fill-column: 100 Index: t/pmc/hashiteratorkey.t =================================================================== --- t/pmc/hashiteratorkey.t (revision 48898) +++ t/pmc/hashiteratorkey.t (revision 48924) @@ -55,7 +55,7 @@ # De facto behavior tested for code coverage - p = hik.'key'() + p = hik.'key'() i = isnull p is(i, 1, 'HIK.key gives null when unitialized') Property changes on: t/src/embed.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/src/embed.t:r48886-48917 Property changes on: t/compilers/tge/NoneGrammar.tg ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/compilers/tge/NoneGrammar.tg:r48886-48917 Property changes on: t/steps/init/hints/linux-01.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/steps/init/hints/linux-01.t:r48886-48917 Property changes on: t/oo/objects.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/oo/objects.t:r48886-48917 Property changes on: t/oo/root_new.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/oo/root_new.t:r48886-48917 Property changes on: t/examples/pgegrep.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/examples/pgegrep.t:r48886-48917 Property changes on: t/codingstd/pmc_docs.t ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/t/codingstd/pmc_docs.t:r48886-48917 Property changes on: config/auto/zlib ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/config/auto/zlib:r48886-48917 Property changes on: config/auto/sizes/intval_maxmin_c.in ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/config/auto/sizes/intval_maxmin_c.in:r48886-48917 Index: config/gen/config_h/config_h.in =================================================================== --- config/gen/config_h/config_h.in (revision 48898) +++ config/gen/config_h/config_h.in (revision 48924) @@ -152,9 +152,11 @@ #define PARROT_@jitcpu@ 1 /* Oplib and dynamic ops related. */ -#define PARROT_CORE_OPLIB_NAME "core_ops" -#define PARROT_CORE_OPLIB_INIT Parrot_DynOp_core_@MAJOR@_@MINOR@_@PATCH@ +#define PARROT_CORE_OPLIB_NAME "core_ops" +#define PARROT_CORE_OPLIB_INIT Parrot_DynOp_core_@MAJOR@_@MINOR@_@PATCH@ +#define PARROT_GET_CORE_OPLIB(i) PARROT_CORE_OPLIB_INIT((i), 1) + /* ICU. */ #define PARROT_HAS_ICU @has_icu@ Property changes on: examples/tools/pgegrep ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/examples/tools/pgegrep:r48886-48917 Property changes on: examples/languages/abc ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/examples/languages/abc:r48886-48917 Property changes on: examples/languages/squaak ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/examples/languages/squaak:r48886-48917 Property changes on: examples/pge/demo.pir ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/examples/pge/demo.pir:r48886-48917 Property changes on: examples/embed/cotorra.c ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup/examples/embed/cotorra.c:r48886-48917 Property changes on: . ___________________________________________________________________ Modified: svn:mergeinfo Merged /branches/oplib_handling_cleanup:r48886-48917