Bug 192614 - [patch] lang/spidermonkey* : add DTRACE option
Summary: [patch] lang/spidermonkey* : add DTRACE option
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Koop Mast
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-12 15:25 UTC by Jan Beich
Modified: 2019-08-18 03:46 UTC (History)
3 users (show)

See Also:


Attachments
esr24 patch (5.44 KB, patch)
2014-08-12 15:26 UTC, Jan Beich
no flags Details | Diff
esr24 build log (DTRACE=on) (477.79 KB, text/plain)
2014-08-12 15:49 UTC, Jan Beich
no flags Details
esr24 patch (7.10 KB, patch)
2014-08-12 22:57 UTC, Jan Beich
no flags Details | Diff
esr24 build log (DTRACE=off) (472.91 KB, text/plain)
2014-08-12 22:59 UTC, Jan Beich
no flags Details
esr17 patch (7.31 KB, patch)
2014-08-12 23:16 UTC, Jan Beich
no flags Details | Diff
esr17 build log (DTRACE=on) (448.13 KB, text/plain)
2014-08-12 23:17 UTC, Jan Beich
no flags Details
esr17 build log (DTRACE=off) (444.95 KB, text/plain)
2014-08-12 23:22 UTC, Jan Beich
no flags Details
js-1.8.x patch (7.33 KB, patch)
2014-08-12 23:38 UTC, Jan Beich
koobs: maintainer-approval+
Details | Diff
js-1.8.x build log (DTRACE=on) (965.88 KB, text/plain)
2014-08-12 23:40 UTC, Jan Beich
no flags Details
js-1.8.x build log (DTRACE=off) (963.41 KB, text/plain)
2014-08-12 23:40 UTC, Jan Beich
no flags Details
js-1.8.x patch (keep static library) (7.42 KB, patch)
2015-01-31 06:39 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2014-08-12 15:25:38 UTC
DTRACE option enables profiling with usdt and ustack. DTraceToolkit has a few examples how to use the probes under JavaScript directory. Note, check it works first:

  $ kldload sdt
  $ js24
  >
  $ dtrace -P javascript\* -l | c++filt
     ID   PROVIDER            MODULE                          FUNCTION NAME
  28063 javascript63331              js24 js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::AbstractFramePtr, JS::Value*) execute-done
  28064 javascript63331              js24 js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value const&, js::ExecuteType, js::AbstractFramePtr, JS::Value*) execute-start
  28065 javascript63331              js24 js::StackFrame::prologue(JSContext*) function-entry
  28066 javascript63331              js24 js::Probes::DTraceEnterJSFun(JSContext*, JSFunction*, JSScript*) function-entry
  28067 javascript63331              js24 Interpret(JSContext*, js::RunState&) function-entry
  28068 javascript63331              js24 js::jit::HandleException(js::jit::ResumeFromException*) function-return
  28069 javascript63331              js24 js::StackFrame::epilogue(JSContext*) function-return
  28070 javascript63331              js24 js::Probes::DTraceExitJSFun(JSContext*, JSFunction*, JSScript*) function-return
  28071 javascript63331              js24 Interpret(JSContext*, js::RunState&) function-return
  28072 javascript63331              js24 NewObject(JSContext*, js::Class*, js::types::TypeObject*, JSObject*, js::gc::AllocKind, js::NewObjectKind) object-create
  28073 javascript63331              js24 js::NewDenseAllocatedArray(JSContext*, unsigned int, JSObject*, js::NewObjectKind) object-create
  28074 javascript63331              js24 js::NewDenseUnallocatedArray(JSContext*, unsigned int, JSObject*, js::NewObjectKind) object-create
  28075 javascript63331              js24 js::NewDenseCopiedArray(JSContext*, unsigned int, JS::Value const*, JSObject*, js::NewObjectKind) object-create
  28076 javascript63331              js24 js::NewDenseEmptyArray(JSContext*, JSObject*, js::NewObjectKind) object-create
  28077 javascript63331              js24 js::NewDenseCopiedArray(JSContext*, unsigned int, JS::Handle<JSObject*>, unsigned int, JSObject*) object-create
  28078 javascript63331              js24 bool js::gc::Arena::finalize<JSObject>(js::FreeOp*, js::gc::AllocKind, unsigned long) object-finalize
Comment 1 Jan Beich freebsd_committer 2014-08-12 15:26:13 UTC
Created attachment 145714 [details]
esr24 patch
Comment 2 John Marino freebsd_committer 2014-08-12 15:34:06 UTC
Hmm, this is 4 ports with 3 different maintainers.  kwm@ wins, the other two are on copy.
Comment 3 Jan Beich freebsd_committer 2014-08-12 15:49:44 UTC
Created attachment 145715 [details]
esr24 build log (DTRACE=on)

False positives to ignore:

  ====> Running Q/A tests (stage-qa)
  Warning: 'bin/js24' is not stripped consider using ${STRIP_CMD}
  Warning: 'lib/libmozjs-24.so' is not stripped consider using ${STRIP_CMD}
Comment 4 Jan Beich freebsd_committer 2014-08-12 22:57:55 UTC
Created attachment 145733 [details]
esr24 patch

Oops, --disable-dtrace is broken. Needs one more patch from upstream bugzilla.
Comment 5 Jan Beich freebsd_committer 2014-08-12 22:59:24 UTC
Created attachment 145734 [details]
esr24 build log (DTRACE=off)
Comment 6 Jan Beich freebsd_committer 2014-08-12 23:16:32 UTC
Created attachment 145735 [details]
esr17 patch

DTrace probes aren't included from static library (Mozilla bug 702179). Not to mention static libs are discouraged in general (security, waste of resources).

If you disagree I can put lib/libmozjs-17.0.a behind %%NO_DTRACE%% at the expense of moving files/patch-bug702179 to EXTRA_PATCHES.
Comment 7 Jan Beich freebsd_committer 2014-08-12 23:17:50 UTC
Created attachment 145736 [details]
esr17 build log (DTRACE=on)

see comment 3
Comment 8 Jan Beich freebsd_committer 2014-08-12 23:22:57 UTC
Created attachment 145737 [details]
esr17 build log (DTRACE=off)
Comment 9 Jan Beich freebsd_committer 2014-08-12 23:38:21 UTC
Created attachment 145738 [details]
js-1.8.x patch

see comment 6
Comment 10 Jan Beich freebsd_committer 2014-08-12 23:40:21 UTC
Created attachment 145739 [details]
js-1.8.x build log (DTRACE=on)
Comment 11 Jan Beich freebsd_committer 2014-08-12 23:40:58 UTC
Created attachment 145740 [details]
js-1.8.x build log (DTRACE=off)
Comment 12 Jan Beich freebsd_committer 2014-08-12 23:57:59 UTC
js-1.7.x is too old to have DTRACE probes. Profiling with ustack is generic and needs only non-debug symbols + -fno-omit-frame-pointer, similar to hwpmc/pmcstat. So, fixing PROFILE option should be global and belongs in bsd.port.mk (untangle STRIP et al. from WITH_DEBUG).
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2014-08-13 06:24:22 UTC
Comment on attachment 145738 [details]
js-1.8.x patch

Great PR Jan.

Any reason we must lose the static library unconditionally?
Comment 14 Koop Mast freebsd_committer 2014-08-13 11:06:24 UTC
See comment #6 why static is removed.

I'm personaly don't care about the removal of the static library but I know it used in some places.
Comment 15 Kubilay Kocak freebsd_committer freebsd_triage 2014-08-13 11:12:15 UTC
I'd like to not limit (user) consumption choice and flexibility, even if other ports in the tree don't use the static library themselves.
Comment 16 commit-hook freebsd_committer 2015-01-30 09:58:16 UTC
A commit references this bug:

Author: kwm
Date: Fri Jan 30 09:58:07 UTC 2015
New revision: 378144
URL: https://svnweb.freebsd.org/changeset/ports/378144

Log:
  Fix the build on ARM [1]
  Add DTRACE option (default off) [2]

  PR:		197058 [1]
  PR:		192614 [2]
  Submitted by:	sbruno@ [1], jbeich@ [2]

Changes:
  head/lang/spidermonkey24/Makefile
  head/lang/spidermonkey24/files/
  head/lang/spidermonkey24/files/patch-assembler_jit_ExecutableAllocator.h
  head/lang/spidermonkey24/files/patch-bug1041795
  head/lang/spidermonkey24/files/patch-bug1046224
  head/lang/spidermonkey24/files/patch-bug702179
  head/lang/spidermonkey24/files/patch-jit_AsmJSSignalHandlers.cpp
  head/lang/spidermonkey24/files/patch-jit_arm_Architecture-arm.cpp
  head/lang/spidermonkey24/pkg-plist
Comment 17 commit-hook freebsd_committer 2015-01-30 10:05:18 UTC
A commit references this bug:

Author: kwm
Date: Fri Jan 30 10:04:29 UTC 2015
New revision: 378145
URL: https://svnweb.freebsd.org/changeset/ports/378145

Log:
  Add DTRACE option

  PR:		192614
  Submitted by:	jbeich@

Changes:
  head/lang/spidermonkey170/Makefile
  head/lang/spidermonkey170/files/patch-bug1041795
  head/lang/spidermonkey170/files/patch-bug1046224
  head/lang/spidermonkey170/files/patch-bug702179
  head/lang/spidermonkey170/pkg-plist
Comment 18 Koop Mast freebsd_committer 2015-01-30 10:06:07 UTC
Over to koobs@ for last port
Comment 19 Kubilay Kocak freebsd_committer freebsd_triage 2015-01-30 11:53:57 UTC
Submitter is committer. Can we leave the static library in place Jan?
Comment 20 Jan Beich freebsd_committer 2015-01-31 06:39:47 UTC
Created attachment 152410 [details]
js-1.8.x patch (keep static library)

Hmm, DTRACE doesn't work for spidermonkey185. The probes aren't initialized as in comment 0. I've tested by launching js shell under WRKSRC and old lang/gjs. dtrace_dof* and __dtrace_javascript* symbols are there, though.

  $ readelf -a /usr/local/lib/libmozjs-24.so | fgrep dtrace
    2237: 0000000000404920   152 FUNC    LOCAL  DEFAULT   11 dtrace_dof_fini
    2238: 0000000000404440   951 FUNC    LOCAL  DEFAULT   11 dtrace_dof_init
    2312: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtraceenabled_javascrip
    2649: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtrace_javascript___obj
    3164: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtraceenabled_javascrip
    3310: 0000000000203b40   476 FUNC    LOCAL  HIDDEN    11 $dtrace13930195._ZL9NewOb
    3406: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtraceenabled_javascrip
    4216: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtraceenabled_javascrip
    5582: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtrace_javascript___obj
    5978: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtrace_javascript___fun
    7853: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtrace_javascript___fun
    9466: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtrace_javascript___exe
   11425: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtraceenabled_javascrip
   11814: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtraceenabled_javascrip
   12550: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS __dtrace_javascript___exe
   12949: 00000000000d4710 39863 FUNC    LOCAL  HIDDEN    11 $dtrace13930059._ZL9Inter

vs.

  $ readelf -a /usr/local/lib/libmozjs185.so | fgrep dtrace
     143: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___exe
     190: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___fun
     271: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___obj
     357: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
     421: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
     430: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
     517: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
     536: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___fun
     727: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
     752: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___exe
     845: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___obj
     885: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
    1212: 0000000000296720   152 FUNC    LOCAL  DEFAULT   11 dtrace_dof_fini
    1213: 0000000000296240   951 FUNC    LOCAL  DEFAULT   11 dtrace_dof_init
    1378: 00000000000a88e0  1993 FUNC    LOCAL  HIDDEN    11 $dtrace13899205._ZL19Wrap
    1614: 0000000000272040   373 FUNC    LOCAL  HIDDEN    11 $dtrace13899324._ZN2jsL14
    1809: 00000000001a88d0   756 FUNC    LOCAL  HIDDEN    11 $dtrace13899270._ZL19NewX
    2796: 00000000000dd050   373 FUNC    LOCAL  HIDDEN    11 $dtrace13899215._ZN2jsL14
    3306: 00000000000fdf80  1959 FUNC    LOCAL  HIDDEN    11 $dtrace13899231._ZL10obj_
    4151: 00000000000aa660  3007 FUNC    LOCAL  HIDDEN    11 $dtrace13899205._ZL8Funct
    4459: 00000000000dcf00   327 FUNC    LOCAL  HIDDEN    11 $dtrace13899215._ZL14Scri
    4642: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___exe
    4743: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___fun
    4896: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___exe
    4927: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
    4998: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___obj
    5023: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
    5049: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
    5086: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
    5161: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___fun
    5358: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
    5474: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtrace_javascript___obj
    5514: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS __dtraceenabled_javascrip
Comment 21 Walter Schwarzenfeld freebsd_triage 2018-01-12 04:15:37 UTC
Is this still relevant? firefox-esr has 52.5.3.
Comment 22 Walter Schwarzenfeld freebsd_triage 2019-08-16 12:59:36 UTC
The changes are all in the spidermonkey ports. Overcome by events.
Comment 23 Kubilay Kocak freebsd_committer freebsd_triage 2019-08-18 03:46:36 UTC
^Triage: 

 - Assign to committer that resolved
 - Correct resolution, this issue was resolved by commit(s), therefore FIXED