Closed Bug 429616 Opened 18 years ago Closed 15 years ago

Replacing JSScript.main with JSScript.prologLength

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(1 file, 2 obsolete files)

The proposed changes for 429615 and for bug 422137 uses a parallel JSScript.code array that does not contains JSOP_TRAP bytecodes. When using such parallel arrays one has to be careful to either patch JSScript.main (bug 429615) or use JSScript.origCode + (JScript.main - JSScript.code). To avoid this error prone usage I suggest to replace JSScript.main by the relative JSScript.prologLength. JSScript.main is not used in the interpreter on a performance-critical paths, so this should not affect the performance while simplifying addressing JSOP_TRAP checks issue.
Attached patch v1 (obsolete) — — Splinter Review
The patch replaces JSScript.main by JSScript.prologLength. The biggest chunk of changes comes from changing the interpreter to use JSScript.code, not JSScript.main, as the base for try notes.
Attached patch v2 (obsolete) — — Splinter Review
The new version fixes SrcNotes in js.c to start pc for source notes from JSScript.code + JSScript->prologLength, not JSScript.code. Note that currently the code has a bug as at one place it uses JSScript.code as the base for source note offsets and at other places JSScript.main is used. The previous version of the patch mistakenly changed that to JSScript.code.
Attachment #316459 - Attachment is obsolete: true
Attachment #316796 - Flags: review?(brendan)
Attached patch v3 — — Splinter Review
The new version adds the missed bumping of the XDR version. This is necessary as the patch changes JSTryNote.start to mean the offset from JSScript.code, not JSScript.main.
Attachment #316796 - Attachment is obsolete: true
Attachment #316797 - Flags: review?(brendan)
Attachment #316796 - Flags: review?(brendan)
Attachment #316797 - Attachment is patch: true
Attachment #316797 - Attachment mime type: application/octet-stream → text/plain
Attachment #316796 - Attachment is patch: true
Attachment #316796 - Attachment mime type: application/octet-stream → text/plain
Comment on attachment 316797 [details] [diff] [review] v3 > JS_FRIEND_API(JSBool) > js_Disassemble(JSContext *cx, JSScript *script, JSBool lines, FILE *fp) > { >- jsbytecode *pc, *end; >- uintN len; >+ uint32 i, len; These could be uintN (IIRC you use uintN elsewhere, at least in js.c's DEBUG UpdateSwitchTableBounds), since N>=32 and it's the "natural" unsigned int for the target architecture. > >- pc = script->code; >- end = pc + script->length; >- while (pc < end) { >- if (pc == script->main) >+ for (i = 0; i < script->length; i += len) { >+ if (i == script->prologLength) > fputs("main:\n", fp); >- len = js_Disassemble1(cx, script, pc, >- PTRDIFF(pc, script->code, jsbytecode), >- lines, fp); >- if (!len) >+ len = js_Disassemble1(cx, script, script->code + i, i, lines, fp); And doesn't js_Disassemble1 return uintN? >+ if ((size_t) (pc - (script->code + script->prologLength)) >= >+ script->length - script->prologLength) { [snip...] >+ LOCAL_ASSERT((size_t) (pc - (script->code + script->prologLength)) < >+ script->length - script->prologLength); Macroize as PC_IN_SCRIPT_MAIN or IS_MAIN_SCRIPT_PC? >@@ -94,17 +93,17 @@ struct JSScript { > uint16 ngvars; /* declared global var/const/function count */ > uint8 objectsOffset; /* offset to the array of nested function, > block, scope, xml and one-time regexps > objects or 0 if none */ > uint8 regexpsOffset; /* offset to the array of to-be-cloned > regexps or 0 if none. */ > uint8 trynotesOffset; /* offset to the array of try notes or > 0 if none */ >- jsbytecode *main; /* main entry point, after predef'ing prolog */ >+ uint32 prologLength;/* length of predef'ing prolog */ The inline comments need reindenting all over, and you started the task for the *Offset members, so why not indent prologLength's comment accordingly? r=me with these nits picked. Thanks, /be
Attachment #316797 - Flags: review?(brendan) → review+
Flags: wanted1.9.2?
These bugs are all part of a search I made for js bugs that are getting lost in transit: http://tinyurl.com/jsDeadEndBugs They all have a review+'ed, non-obsoleted patch and are not marked fixed-in-tracemonkey or checkin-needed but have not seen any activity in 300 days. Some of these got lost simply because the assignee/patch provider never requested a checkin, or just because they were forgotten about.
This is no longer relevant.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
Flags: wanted1.9.2?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: