Subj : Re: js engine crashes at NewScopeProperty To : Pradip Singh From : Brendan Eich Date : Mon Mar 22 2004 11:40 pm Pradip Singh wrote: > Hi Brendon, > > Thanx for replying so fast. Actually the whole scenario is like this. I am > compiling a script using the function JS_CompileFileHandle(cx, glob, > filename,&fileRef); > > It was failing in compilation in the file jsemit.c in function > JSBool > js_SetSrcNoteOffset(JSContext *cx, JSCodeGenerator *cg, uintN index,uintN > which, ptrdiff_t offset) > > at point if ((jsuword)offset >= (jsuword)(((ptrdiff_t)SN_3BYTE_OFFSET_FLAG) > << 16)) > > and it gave me the error statement to large. So i changed the value of the > macro SN_3BYTE_OFFSET_FLAG to 0x100. Why in the world would you do that? It makes no sense, since the flag is stored in a byte. If you don't know what you're doing, you certainly shouldn't be hacking around in the engine. You should be using the API only, the frozen API at that. > Now after changing the value to hundred the script started compiling. That doesn't mean your change was any good. > But it > failed to execute as it was crashing in the function > NewScopeProperty(JSRuntime *rt); As u sugested to Debug more. I debuged and > found that it was crashing at point JS_ARENA_ALLOCATE_CAST(sprop, > JSScopeProperty *, > &rt->propertyArenaPool, > sizeof(JSScopeProperty)); > > Inside this macro it was crashing at point _q = _p + _nb; > I feel _p doesnot contain proper value. Its value was comming as 0x0000001 > which i think is wrong. Your change to SN_3BYTE_OFFSET_FLAG is clearly wrong, and it invalidates invariants required elsewhere in the code. Please stop hacking with the engine's internals, especially when you haven't studied them enough to know, e.g., that jssrcnote is uint8 and 0x100 does not fit in a byte. Why was your script so large that it incurred the "statement too large" error? Can you say more about that script? How many lines, how many characters, etc.? /be .