[CVS] RPM: rpm-5_4: rpm/rpmio/ Makefile.am rpmjs45.cpp rpmjss.inp

2017-07-02 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   02-Jul-2017 14:34:30
  Branch: rpm-5_4  Handle: 2017070212342900

  Modified files:   (Branch: rpm-5_4)
rpm/rpmio   Makefile.am rpmjs45.cpp rpmjss.inp

  Log:
- r[pmjs45: WIP.

  Summary:
RevisionChanges Path
1.293.2.103 +1  -1  rpm/rpmio/Makefile.am
1.1.2.14+4263 -183  rpm/rpmio/rpmjs45.cpp
1.1.2.5 +64 -2  rpm/rpmio/rpmjss.inp
  

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/Makefile.am
  
  $ cvs diff -u -r1.293.2.102 -r1.293.2.103 Makefile.am
  --- rpm/rpmio/Makefile.am 28 Jun 2017 09:54:15 -  1.293.2.102
  +++ rpm/rpmio/Makefile.am 2 Jul 2017 12:34:29 -   1.293.2.103
  @@ -575,7 +575,7 @@
   rpmjs38_LDADD = -L/usr/lib64 -lmozjs-38 $(RPMIO_LDADD_COMMON)
   
   rpmjs45_SOURCES = rpmjs45.cpp
  -rpmjs45_CPPFLAGS = -include /usr/include/mozjs-45/js/RequiredDefines.h 
-I/usr/include/mozjs-45 -I/F/mozjs45/firefox-45.9.0esr/js/src -fPIC 
-DRPMJSS_SELF_TEST
  +rpmjs45_CPPFLAGS = -include /usr/include/mozjs-45/js/RequiredDefines.h 
-I/usr/include/mozjs-45 -I./js45/src/shell -I./js45/src -DXP_UNIX -fPIC 
-DRPMJSS_SELF_TEST
   rpmjs45_LDADD = -L/usr/lib64 -lmozjs-45 $(RPMIO_LDADD_COMMON)
   
   mozjs:   rpmjs185 rpmjs17 rpmjs24 rpmjs31 rpmjs38 rpmjs45
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjs45.cpp
  
  $ cvs diff -u -r1.1.2.13 -r1.1.2.14 rpmjs45.cpp
  --- rpm/rpmio/rpmjs45.cpp 1 Jul 2017 04:00:07 -   1.1.2.13
  +++ rpm/rpmio/rpmjs45.cpp 2 Jul 2017 12:34:29 -   1.1.2.14
  @@ -46,84 +46,6 @@
   
   #include "debug.h"
   
  -/*==*/
  -typedef struct JSI_s * JSI_t;
  -struct JSI_s {
  -JSRuntime*rt;
  -JSContext*cx;
  -JSObject *global;
  -};
  -
  -// Shell state set once at startup.
  -static bool enableCodeCoverage = false;
  -static bool enableDisassemblyDumps = false;
  -static bool offthreadCompilation = false;
  -static bool enableBaseline = false;
  -static bool enableIon = false;
  -static bool enableAsmJS = false;
  -static bool enableNativeRegExp = false;
  -static bool enableUnboxedArrays = false;
  -#ifdef JS_GC_ZEAL
  -static char gZealStr[128];
  -#endif
  -static bool printTiming = false;
  -static const char* jsCacheDir = nullptr;
  -static const char* jsCacheAsmJSPath = nullptr;
  -static bool reportWarnings = true;
  -static bool compileOnly = false;
  -static bool fuzzingSafe = false;
  -static bool disableOOMFunctions = false;
  -static const char* moduleLoadPath = ".";
  -
  -#ifdef DEBUG
  -static bool dumpEntrainedVariables = false;
  -static bool OOM_printAllocationCount = false;
  -#endif
  -
  -/*==*/
  -static bool
  -global_enumerate(JSContext* cx, HandleObject obj)
  -{
  -#ifdef LAZY_STANDARD_CLASSES
  -return JS_EnumerateStandardClasses(cx, obj);
  -#else
  -return true;
  -#endif
  -}
  -
  -static bool
  -global_resolve(JSContext* cx, HandleObject obj, HandleId id, bool* resolvedp)
  -{
  -#ifdef LAZY_STANDARD_CLASSES
  -if (!JS_ResolveStandardClass(cx, obj, id, resolvedp))
  -return false;
  -#endif
  -return true;
  -}
  -
  -static bool
  -global_mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj)
  -{
  -return JS_MayResolveStandardClass(names, id, maybeObj);
  -}
  -
  -static JSClass global_class = {
  -"global",
  -JSCLASS_GLOBAL_FLAGS,
  -nullptr,
  -nullptr,
  -nullptr,
  -nullptr,
  -global_enumerate,
  -global_resolve,
  -global_mayResolve,
  -nullptr,
  -nullptr,
  -nullptr,
  -nullptr,
  -JS_GlobalObjectTraceHook
  -};
  -
   static int rpmjss_nopens;
   
   static int _rpmjss45_debug;
  @@ -131,51 +53,13 @@
   if (_rpmjss45_debug) \
fprintf(stderr, _fmt, __VA_ARGS__)
   
  -/*==*/
  -static void
  -rpmjssReportError(JSContext *cx, const char *message, JSErrorReport *report)
  -{
  -fprintf(stderr, "%s:%u:%s\n",
  - report->filename ? report->filename : "",
  - (unsigned int) report->lineno, message);
  -}
  -
  -static void
  -rpmjssOOMCallback(JSContext* cx, void* data)
  -{
  -#ifdef   NOTYET
  -// If a script is running, the engine is about to throw the string "out 
of
  -// memory", which may or may not be caught. Otherwise the engine will 
just

[CVS] RPM: rpm-5_4: rpm/rpmio/ Makefile.am rpmjs45.cpp

2017-06-22 Thread Jeff Johnson
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Jeff Johnson
  Root:   /v/rpm/cvs   Email:  j...@rpm5.org
  Module: rpm  Date:   23-Jun-2017 02:43:56
  Branch: rpm-5_4  Handle: 2017062300435500

  Modified files:   (Branch: rpm-5_4)
rpm/rpmio   Makefile.am rpmjs45.cpp

  Log:
- rpmjs45: muzzle GCC/ASAN.

  Summary:
RevisionChanges Path
1.293.2.97  +3  -0  rpm/rpmio/Makefile.am
1.1.2.5 +67 -7  rpm/rpmio/rpmjs45.cpp
  

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/Makefile.am
  
  $ cvs diff -u -r1.293.2.96 -r1.293.2.97 Makefile.am
  --- rpm/rpmio/Makefile.am 22 Jun 2017 17:35:24 -  1.293.2.96
  +++ rpm/rpmio/Makefile.am 23 Jun 2017 00:43:55 -  1.293.2.97
  @@ -582,6 +582,9 @@
-./rpmjs38
-./rpmjs45
   
  +mozjs45: rpmjs45
  + @-env ASAN_OPTIONS=detect_leaks=0 ./rpmjs45
  +
   rpmpbzip2_SOURCES = rpmpbzip2.c
   rpmpbzip2_LDADD = $(RPMIO_LDADD_COMMON)
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjs45.cpp
  
  $ cvs diff -u -r1.1.2.4 -r1.1.2.5 rpmjs45.cpp
  --- rpm/rpmio/rpmjs45.cpp 22 Jun 2017 17:35:24 -  1.1.2.4
  +++ rpm/rpmio/rpmjs45.cpp 23 Jun 2017 00:43:55 -  1.1.2.5
  @@ -2,6 +2,8 @@
   // #define __STDC_LIMIT_MACROS
   // #include 
   
  +#pragma GCC diagnostic ignored "-Winvalid-offsetof"
  +
   #include "system.h"
   
   #define  js  jsns
  @@ -14,7 +16,35 @@
   
   #include "debug.h"
   
  -/* The class of the global object. */
  +/*==*/
  +#ifdef   NOTYET  /* XXX HandleObject and HandleId */
  +static bool
  +global_enumerate(JSContext* cx, HandleObject obj)
  +{
  +#ifdef LAZY_STANDARD_CLASSES
  +return JS_EnumerateStandardClasses(cx, obj);
  +#else
  +return true;
  +#endif
  +}
  +
  +static bool
  +global_resolve(JSContext* cx, HandleObject obj, HandleId id, bool* resolvedp)
  +{
  +#ifdef LAZY_STANDARD_CLASSES
  +if (!JS_ResolveStandardClass(cx, obj, id, resolvedp))
  +return false;
  +#endif
  +return true;
  +}
  +
  +static bool
  +global_mayResolve(const JSAtomState& names, jsid id, JSObject* maybeObj)
  +{
  +return JS_MayResolveStandardClass(names, id, maybeObj);
  +}
  +#endif   /* NOTYET */
  +
   static JSClass global_class = {
   "global",
   JSCLASS_GLOBAL_FLAGS,
  @@ -22,9 +52,15 @@
   nullptr,
   nullptr,
   nullptr,
  +#ifdef   NOTYET  /* XXX HandleObject and HandleId */
  +global_enumerate,
  +global_resolve,
  +global_mayResolve,
  +#else
   nullptr,
   nullptr,
   nullptr,
  +#endif
   nullptr,
   nullptr,
   nullptr,
  @@ -32,8 +68,12 @@
   JS_GlobalObjectTraceHook
   };
   
  -struct rpmjs_s _js;
  -rpmjs js = &_js;
  +static int rpmjs_nopens;
  +
  +static int _rpmjs45_debug;
  +#define SPEW(_fmt, ...) \
  +if (_rpmjs45_debug) \
  + fprintf(stderr, _fmt, __VA_ARGS__)
   
   /*==*/
   typedef struct JSI_s * JSI_t;
  @@ -52,8 +92,6 @@
   }
   
   /*==*/
  -static int rpmjs_nopens;
  -
   static void mozFini(rpmjs js)
   {
   JSI_t I = (JSI_t) js->I;
  @@ -80,6 +118,7 @@
   
   static uint32_t _maxbytes = 8L * 1024L * 1024L;
   static size_t _stackChunkSize = 8192;
  +bool ok;
   
   if (rpmjs_nopens++ == 0)
JS_Init();
  @@ -95,6 +134,22 @@
   assert(I->cx);
   JS_SetContextPrivate(I->cx, (void *)js);
   
  +#ifdef   NOTYET
  +JS_SetErrorReporter(I->cx, rpmjsReportError);
  +#endif
  +
  +#ifdef   HACK
  +#ifdef  JS_HAS_CTYPES
  +ok = JS_InitCTypesClass(I->cx, I->global);
  +assert(ok);
  +#endif
  + 
  +#ifdef   NOTYET
  +ok = JS_DefineFunctions(I->cx, I->global, _functions);
  +assert(ok);
  +#endif
  +#endif
  +
   return I;
   }
   
  @@ -118,14 +173,16 @@
JS_NewGlobalObject(I->cx, _clasp, _principals, 
JS::FireOnNewGlobalHook));
   if (!global)
return 1;
  +
   I->global = global;
   assert(I->global);
   
   JS::RootedValue rval(I->cx);
   
   {// Scope for JSAutoCompartment
  - JSAutoCompartment ac(I->cx, global);
  - JS_InitStandardClasses(I->cx, global);
  + JSAutoCompartment ac(I->cx, I->global);
  + ok = JS_InitStandardClasses(I->cx, global);
  +assert(ok);
   
JS::CompileOptions opts(I->cx);
opts.setFileAndLine(filename, lineno);
  @@ -145,6 +202,9 @@
   JSI