From: Armin R. <ar...@us...> - 2003-02-04 20:17:44
|
Update of /cvsroot/psyco/psyco/c/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22061/Python Modified Files: frames.c pbltinmodule.c pycompiler.c pycompiler.h Log Message: more work on strings Index: frames.c =================================================================== RCS file: /cvsroot/psyco/psyco/c/Python/frames.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** frames.c 30 Jan 2003 18:41:49 -0000 1.2 --- frames.c 4 Feb 2003 20:17:32 -0000 1.3 *************** *** 315,319 **** int new_i = PyString_GET_SIZE(co->co_code) - 1; /* RETURN_VALUE */ ! assert(PyString_AS_STRING(co->co_code)[new_i] == 83); f->f_lasti = new_i; f->f_iblock = 0; --- 315,319 ---- int new_i = PyString_GET_SIZE(co->co_code) - 1; /* RETURN_VALUE */ ! psyco_assert(PyString_AS_STRING(co->co_code)[new_i] == 83); f->f_lasti = new_i; f->f_iblock = 0; Index: pbltinmodule.c =================================================================== RCS file: /cvsroot/psyco/psyco/c/Python/pbltinmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pbltinmodule.c 31 Jan 2003 13:46:52 -0000 1.13 --- pbltinmodule.c 4 Feb 2003 20:17:32 -0000 1.14 *************** *** 217,252 **** static vinfo_t* pbuiltin_ord(PsycoObject* po, vinfo_t* vself, vinfo_t* vobj) { - vinfo_t* vlen; vinfo_t* result; - PyTypeObject* vtp; - condition_code_t cc; METH_O_WRAPPER(ord, vself, vobj); ! /* TypeSwitch */ ! vtp = Psyco_NeedType(po, vobj); ! if (vtp == NULL) return NULL; ! ! if (PyType_TypeCheck(vtp, &PyString_Type)) { ! vlen = PsycoString_GET_SIZE(po, vobj); ! if (vlen == NULL) ! return NULL; ! cc = integer_cmp_i(po, vlen, 1, Py_NE); ! if (cc == CC_ERROR) ! return NULL; ! if (runtime_condition_f(po, cc)) ! goto use_proxy; ! ! result = psyco_get_field(po, vobj, CHARACTER_char); ! if (result == NULL) ! return NULL; return PsycoInt_FROM_LONG(result); - } - - #ifdef Py_USING_UNICODE - /* ... */ - #endif - use_proxy: return psyco_generic_call(po, cimpl_ord, CfReturnRef|CfPyErrIfNull, "lv", NULL, vobj); --- 217,229 ---- static vinfo_t* pbuiltin_ord(PsycoObject* po, vinfo_t* vself, vinfo_t* vobj) { vinfo_t* result; METH_O_WRAPPER(ord, vself, vobj); ! if (!PsycoCharacter_Ord(po, vobj, &result)) return NULL; ! ! if (result != NULL) return PsycoInt_FROM_LONG(result); return psyco_generic_call(po, cimpl_ord, CfReturnRef|CfPyErrIfNull, "lv", NULL, vobj); Index: pycompiler.c =================================================================== RCS file: /cvsroot/psyco/psyco/c/Python/pycompiler.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** pycompiler.c 4 Feb 2003 11:18:51 -0000 1.38 --- pycompiler.c 4 Feb 2003 20:17:33 -0000 1.39 *************** *** 43,47 **** return; } ! extra_assert(c_function != NULL); key = PyInt_FromLong((long) c_function); if (key != NULL) { --- 43,47 ---- return; } ! psyco_assert(c_function != NULL); key = PyInt_FromLong((long) c_function); if (key != NULL) { *************** *** 908,914 **** /***************************************************************/ ! DEFINEVAR source_known_t psyco_skNone; /* known value 'Py_None' */ ! DEFINEVAR source_known_t psyco_skZero; /* known value 0 */ DEFINEVAR source_known_t psyco_skOne; /* known value 1 */ DEFINEVAR source_known_t psyco_skNotImplemented; --- 908,916 ---- /***************************************************************/ ! DEFINEVAR source_known_t psyco_skZero; /* known value 0 */ DEFINEVAR source_known_t psyco_skOne; /* known value 1 */ + DEFINEVAR source_known_t psyco_skNone; /* known value 'Py_None' */ + DEFINEVAR source_known_t psyco_skPy_False; /* known value 'Py_False' */ + DEFINEVAR source_known_t psyco_skPy_True; /* known value 'Py_True' */ DEFINEVAR source_known_t psyco_skNotImplemented; *************** *** 919,935 **** { s_builtin_object = PyString_InternFromString("__builtins__"); ! ! memcpy(&psyco_skNone, ! sk_new((long) Py_None, SkFlagFixed), ! sizeof(source_known_t)); ! memcpy(&psyco_skZero, ! sk_new((long) 0, SkFlagFixed), ! sizeof(source_known_t)); ! memcpy(&psyco_skOne, ! sk_new((long) 1, SkFlagFixed), ! sizeof(source_known_t)); ! memcpy(&psyco_skNotImplemented, ! sk_new((long) Py_NotImplemented, SkFlagFixed), ! sizeof(source_known_t)); ERtPython = psyco_vsource_not_important; --- 921,937 ---- { s_builtin_object = PyString_InternFromString("__builtins__"); ! ! psyco_skZero .refcount1_flags = SkFlagFixed; ! psyco_skZero .value = (long) 0; ! psyco_skOne .refcount1_flags = SkFlagFixed; ! psyco_skOne .value = (long) 1; ! psyco_skNone .refcount1_flags = SkFlagFixed; ! psyco_skNone .value = (long) Py_None; ! psyco_skPy_False .refcount1_flags = SkFlagFixed; ! psyco_skPy_False .value = (long) Py_False; ! psyco_skPy_True .refcount1_flags = SkFlagFixed; ! psyco_skPy_True .value = (long) Py_True; ! psyco_skNotImplemented.refcount1_flags = SkFlagFixed; ! psyco_skNotImplemented.value = (long) Py_NotImplemented; ERtPython = psyco_vsource_not_important; *************** *** 1056,1065 **** of builtins to be a fatal error */ builtins = PyDict_GetItem((PyObject*) globals, s_builtin_object); ! assert(builtins != NULL); if (PyModule_Check(builtins)) { builtins = PyModule_GetDict(builtins); ! assert(builtins != NULL); } ! assert(PyDict_Check(builtins)); return builtins; } --- 1058,1067 ---- of builtins to be a fatal error */ builtins = PyDict_GetItem((PyObject*) globals, s_builtin_object); ! psyco_assert(builtins != NULL); if (PyModule_Check(builtins)) { builtins = PyModule_GetDict(builtins); ! psyco_assert(builtins != NULL); } ! psyco_assert(PyDict_Check(builtins)); return builtins; } *************** *** 1622,1626 **** PyObject *w; ! assert(v != NULL); it = PyObject_GetIter(v); --- 1624,1628 ---- PyObject *w; ! extra_assert(v != NULL); it = PyObject_GetIter(v); Index: pycompiler.h =================================================================== RCS file: /cvsroot/psyco/psyco/c/Python/pycompiler.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pycompiler.h 4 Feb 2003 11:18:52 -0000 1.16 --- pycompiler.h 4 Feb 2003 20:17:35 -0000 1.17 *************** *** 28,34 **** } ! DEF_SK_AND_VI(None) /* known value 'Py_None' */ ! DEF_SK_AND_VI(Zero) /* known value 0 */ ! DEF_SK_AND_VI(One) /* known value 1 */ DEF_SK_AND_VI(NotImplemented) /* 'Py_NotImplemented' */ --- 28,36 ---- } ! DEF_SK_AND_VI(Zero) /* known value 0 */ ! DEF_SK_AND_VI(One) /* known value 1 */ ! DEF_SK_AND_VI(None) /* known value 'Py_None' */ ! DEF_SK_AND_VI(Py_False) /* known value 'Py_False' */ ! DEF_SK_AND_VI(Py_True) /* known value 'Py_True' */ DEF_SK_AND_VI(NotImplemented) /* 'Py_NotImplemented' */ |