From ef514207877b3ab108a52f1c223ad1703b84ccf6 Mon Sep 17 00:00:00 2001 From: Brendan Eich Date: Mon, 2 Feb 2009 13:56:34 -0800 Subject: [PATCH] Bug 476181 - imacros.c.out out of date; also Makefile.in bustage/cleanup (r=ted/jorendorff). --- js/src/Makefile.in | 31 ++++++++++++------------------- js/src/imacro_asm.js.in | 30 +++++++++++++++--------------- js/src/imacros.c.out | 8 ++++---- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 851692e709d..8f6f7e0f1fe 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -360,19 +360,6 @@ DEFINES += -DEXPORT_JS_API INCLUDES += -I$(srcdir) -# MSVC '-Gy' cc flag and '/OPT:REF' linker flag cause JS_GetArgument and -# JS_GetLocalVariable to be folded to the same address by the linker, -# leading to a crash on startup. See bug 151066. So, in optimized builds, -# add the /OPT:NOICF flag, which turns off 'identical COMDAT folding'. -# -# N.B.: 'identical COMDAT folding' that folds functions whose addresses -# are taken violates the ISO C and C++ standards. -ifndef MOZ_DEBUG -ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) -LDFLAGS += -OPT:NOICF -endif -endif - GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) @@ -600,7 +587,7 @@ SDK_BINARY = js-config install:: $(INSTALLED_HEADERS) $(SYSINSTALL) $^ $(includedir)/$(MODULE) -install:: $(SCRIPTS) $(PROGRAM) +install:: $(SCRIPTS) $(SYSINSTALL) $^ $(bindir) install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) @@ -643,10 +630,16 @@ $(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d $(addsuffix .$(OBJ_SUFFIX),jsdtracef jsinterp jsobj): $(CURDIR)/javascript-trace.h endif -imacro_asm.js: imacro_asm.js.in - $(CC) -c -x c -E -P -I$(srcdir) $? > $@ +imacro_asm.js: imacro_asm.js.in jsopcode.tbl + $(CC) -c -x c -E -P -I$(srcdir) $< > $@ -GARBAGE += imacro_asm.js +GARBAGE += imacros.c.out imacro_asm.js -%.c.out: %.jsasm $(PROGRAM) imacro_asm.js - ./$(PROGRAM) imacro_asm.js $< > $@ +# Build imacros.c.out after descending into DIRS and building the js shell. +# This may result in an updated imacros.c.out file that requires a re-build +# to stabilize. +libs:: imacros.c.out + @cmp -s $< $(srcdir)/$< || cp $< $(srcdir) + +%.c.out: %.jsasm js imacro_asm.js + ./js imacro_asm.js $< > $@ diff --git a/js/src/imacro_asm.js.in b/js/src/imacro_asm.js.in index 28b2d0aa2da..d970e980890 100644 --- a/js/src/imacro_asm.js.in +++ b/js/src/imacro_asm.js.in @@ -124,16 +124,6 @@ function immediate(op) { throw new Error(info.jsop + " format not yet implemented"); } -const line_regexp_parts = [ - "^(?:(\\w+):)?", - "\\s*(\\.?\\w+)", - "(?:\\s+(\\w+|\\([^)]*\\)))?", - "(?:\\s+([\\w-]+|\\([^)]*\\)))?", - "(?:\\s*(?:#.*))?$" -]; - -const line_regexp = new RegExp(line_regexp_parts.join("")); - /* * Syntax (spaces are significant only to delimit tokens): * @@ -153,11 +143,21 @@ const line_regexp = new RegExp(line_regexp_parts.join("")); * .imacro must nest in .igroup, neither nests in itself. See imacros.jsasm for * examples. */ +const line_regexp_parts = [ + "^(?:(\\w+):)?", // optional label at start of line + "\\s*(\\.?\\w+)", // optional spaces, (pseudo-)opcode + "(?:\\s+(\\w+|\\([^)]*\\)))?", // optional first immediate operand + "(?:\\s+([\\w-]+|\\([^)]*\\)))?", // optional second immediate operand + "(?:\\s*(?:#.*))?$" // optional spaces and comment +]; + +const line_regexp = new RegExp(line_regexp_parts.join("")); + function assemble(filename) { let igroup = null, imacro = null; let opcode2extra = []; - print("/* GENERATED BY imacro_asm.js from " + filename + " -- DO NOT EDIT!!! */"); + print("/* GENERATED BY imacro_asm.js FROM " + filename + " -- DO NOT EDIT!!! */"); let s = snarf(filename); let a = s.split('\n'); @@ -295,11 +295,11 @@ function assemble(filename) { if (info.oplen == -1) throw new Error("unimplemented opcode " + opname); - if (label) { - if (!imacro) - throw new Error("label " + label + " outside of .imacro"); + if (!imacro) + throw new Error("opcode " + opname + " outside of .imacro"); + + if (label) imacro.labeldefs[label] = imacro.offset; - } let op = {offset: imacro.offset, info: info, imm1: imm1, imm2: imm2}; if (info.flags.indexOf("JOF_JUMP") >= 0) { diff --git a/js/src/imacros.c.out b/js/src/imacros.c.out index 0f0a2b291f9..77aea701ce6 100644 --- a/js/src/imacros.c.out +++ b/js/src/imacros.c.out @@ -1,4 +1,4 @@ -/* GENERATED BY imacro_asm.js from imacros.jsasm -- DO NOT EDIT!!! */ +/* GENERATED BY imacro_asm.js FROM ../imacros.jsasm -- DO NOT EDIT!!! */ static struct { jsbytecode any_obj[37]; jsbytecode obj_any[39]; @@ -709,7 +709,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = { 0, /* JSOP_GETPROP */ 0, /* JSOP_SETPROP */ 2, /* JSOP_GETELEM */ - 2, /* JSOP_SETELEM */ + 3, /* JSOP_SETELEM */ 0, /* JSOP_CALLNAME */ 0, /* JSOP_CALL */ 0, /* JSOP_NAME */ @@ -731,7 +731,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = { 3, /* JSOP_ITER */ 2, /* JSOP_NEXTITER */ 0, /* JSOP_ENDITER */ - 7, /* JSOP_APPLY */ + 8, /* JSOP_APPLY */ 0, /* JSOP_SWAP */ 0, /* JSOP_OBJECT */ 0, /* JSOP_POP */ @@ -745,7 +745,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = { 0, /* JSOP_NEWINIT */ 0, /* JSOP_ENDINIT */ 0, /* JSOP_INITPROP */ - 2, /* JSOP_INITELEM */ + 3, /* JSOP_INITELEM */ 0, /* JSOP_DEFSHARP */ 0, /* JSOP_USESHARP */ 0, /* JSOP_INCARG */