Skip to content
Commits on Mar 30, 2012
  1. @psyeugenic

    Update copyright years

    psyeugenic committed
Commits on Mar 22, 2012
  1. @bufflig
  2. @slfritchie @bufflig

    Add DTrace support for OS X, Solaris, and Linux (via SystemTap), 1/4

    slfritchie committed with bufflig
    Since it's been quite a while since I've written C code, *and* I
    haven't done any significant hacking on the VM itself in years, it's
    quite likely that I haven't done things in 100% proper style.  Or
    my co-collaborators Dustin Sallings (CouchBase) or Michal Ptaszek
    (Erlang Solutions).  My intent for this patch is to start discussion
    and review of DTrace support for consideration for the R15 release.
    For additional background on the motivation for this work, please
    see the slides for the presentation at the Erlang User Conference 2011
    in Stockholm:
    Changes relative to dtrace-review2 branch:
        * Fix errors in OTP test suite 'kernel' file_SUITE
        * Fix errors in OTP test suite 'kernel' prim_file_SUITE
        * Fix bad pointer bug in efile_drv.c flush_write()
        * Move the DTrace material from the top of `` into a
          new file, ``
    Changes since last push to GitHub (relative to commit 5828a4f, which
    was the former `dtrace-review1` branch):
        * Rebased onto 14 Nov 2011's "master" branch
        * Recent changes to the async task queuing mechanism means that
          the async worker queue length is not available.  A bogus value
          of -1 is hard-coded until there's a good way to peek into the
          new queue structure and find the queue length.
        * Small fixes based on review comments by Mikael Pettersson,
          Andrew Thompson, and Andreas Schultz.
    Add autoconf support: use "./configure --enable-dtrace" on all supported
        * OS X Snow Leopard or later
        * Solaris 10 or OpenSolaris
        * Linux, via SystemTap's DTrace compatibility packages
        * FreeBSD 9.0RC1.  FreeBSD 8 and earlier do not have support
          for USDT, DTrace's User-land Statically Defined Tracing.
    See the file `erts/emulator/beam/erlang_dtrace.d` for the definition
    of all DTrace probes in the virtual machine so far.
    Example D scripts can be found in `lib/dtrace/examples`.  Note that if
    you see the error message `{name of probe} does not match any probes`,
    then there is no Erlang VM process + DTrace probes running.  To fix,
    start a DTrace-enabled VM or remove `-q` from the `dtrace` command line.
    The `lib/dtrace` directory contains a small code-only OTP application
    that contains code that allows Erlang code to trigger a DTrace probe.
    Dynamic creation & deletion of DTrace probes is not currently
    supported, so the `dtrace:p()` function is hacked to allow a variable
    number of arguments (up to four integers and up to four strings) to be
    used.  See the comments at the top of `lib/dtrace/src/dtrace.c` for
    more detail.
    One feature that may be controversial is the notion I've introduced
    of a special process dictionary key that can be used by Erlang code to
    tag I/O operations for an application-specific purpose.  Right now,
    that tag's name is `dtrace_utag`.  The dictionary keys used by `sys`
    and other modules start with a dollar sign.  Perhaps there is some
    convention (but not a dollar sign?) that this tag should use?
    The purpose of the process dictionary key is to allow the tag to
    be included in trace messages, e.g. for file I/O, without changing the
    API of the `file.erl` module's functions.  For example, here's a use
    of the tag when calling the `file:rename/2` function:
        (bar@sbb2)1> put(dtrace_utag, "GGOOOAAALL!!!!!").
        (bar@sbb2)2> dtrace:init().
        %% Now start both the `user-probe.d` and `efile_drv.d` D scripts
        %% found in the `lib/dtrace/examples` directory.
        (bar@sbb2)3> dtrace:p(7, 8, 9, "one", "four").
        %% The output from the `user-probe.d` script:
        <0.40.0> GGOOOAAALL!!!!! 7 8 9 0 'one' 'four' '' ''
        (bar@sbb2)4> file:rename("old-name", "new-name").
        %% The output from the `efile_drv.d` script:
        async I/O pool port #Port<0.59> queue len 1
        async I/O pool port #Port<0.59> queue len 0
        efile_drv enter tag={1,110} user tag GGOOOAAALL!!!!! | RENAME (12) | args: old-name new-name , 0 0 (port #Port<0.59>)
        async I/O worker tag={1,110} | RENAME (12) | efile_drv-int_entry
        async I/O worker tag={1,110} | RENAME (12) | efile_drv-int_return
        efile_drv return tag={1,110} user tag GGOOOAAALL!!!!! | RENAME (12) | errno 2
    I'm not exactly happy with this choice of tagging, namely using
    `put(dtrace_utag, Tag::list())`.  But this is an experiment, so
    we'll see how it goes.  I can't imagine changing the API for
    all file.erl functions in order pass the tag explicitly.
    Some modules have some extensive (ab)use of the C preprocessor to
    reduce the amount of #ifdefs that clutter the code.  In several places,
    I have not #ifdef'ed automatic variables because of clutter.  For the
    same reason, there are a handful of cases where I added DTrace-related
    members to a struct definition without an #ifdef.  I feel that the
    result is easier to read than earlier drafts where I did use many more
    `` if
    you're curious.)  I expect there may be some debate about whether the
    bloat of the affected structs is worthwhile.  I erred on adding stuff
    to structs, especially in the efile_drv.c driver, not having a full
    grasp on what was thread-safe and what was not ... so I erred on the
    side of caution.
    The efile_drv.c has a work-around for a crazy GCC optimization bug.
    Thank goodness for Google, I dunno how I would've found a work-around
    for this silly thing.  Many thanks to Trond Norbye for writing clearly
    about the problem in a membase Git repo commit message.
     * A note on probe naming: if "__" appears in a provider probe
     * definition, then two things happen during compilation:
     *    1. The "__" will turn into a hypen, "-", for the probe name.
     *    2. The "__" will turn into a single underscore, "_", for the
     *       macro names and function definitions that the compiler and
     *       C developers will see.
     * We'll try to use the following naming convention.  We're a bit
     * limited because, as a USDT probe, we can only specify the 4th part
     * of the probe name, e.g. erlang*:::mumble.  The 2nd part of the
     * probe name is always going to be "beam" or "beam.smp", and the 3rd
     * part of the probe name will always be the name of the function
     * that's calling the probe.
     * So, all probes will be have names defined in this file using the
     * convention category__name or category__sub_category__name.  This
     * will translate to probe names of category-name or
     * category-sub_category-name.
     * Each of "category", "sub_category", and "name" may have underscores
     * but may not have hyphens.
    Add tentative support for sequential tracing sending, queueing, and
    receiving a message.  I don't believe I've fully covered all the major
    places where it would be useful to have the sequential trace token info
    in a probe -- guidance from the OTP team would be helpful, if there's
    time to do that kind of review.
    Add global variable `erts_this_node_sysname`.
Commits on Feb 28, 2012
  1. @bufflig
Commits on Jun 14, 2011
  1. @rickard-green

    Improve ethread atomics

    rickard-green committed
    The ethread atomics API now also provide double word size atomics.
    Double word size atomics are implemented using native atomic
    instructions on x86 (when the cmpxchg8b instruction is available)
    and on x86_64 (when the cmpxchg16b instruction is available). On
    other hardware where 32-bit atomics or word size atomics are
    available, an optimized fallback is used; otherwise, a spinlock,
    or a mutex based fallback is used.
    The ethread library now performs runtime tests for presence of
    hardware features, such as for example SSE2 instructions, instead
    of requiring this to be determined at compile time.
    There are now functions implementing each atomic operation with the
    following implied memory barrier semantics: none, read, write,
    acquire, release, and full. Some of the operation-barrier
    combinations aren't especially useful. But instead of filtering
    useful ones out, and potentially miss a useful one, we implement
    them all.
    A much smaller set of functionality for native atomics are required
    to be implemented than before. More or less only cmpxchg and a
    membar macro are required to be implemented for each atomic size.
    Other functions will automatically be constructed from these. It is,
    of course, often wise to implement more that this if possible from a
    performance perspective.
Commits on Sep 22, 2010
  1. @rickard-green
Commits on Aug 27, 2010
  1. @rickard-green

    Fix SSL build failure when building in minimal source tree

    rickard-green committed
    Building in a source tree without prebuilt platform independent
    build results failed on the SSL examples when cross building.
    This has been solved by not building the SSL examples during a
    cross build.
Commits on Aug 10, 2010
  1. @rickard-green

    Rewrite ethread library

    rickard-green committed
    Large parts of the ethread library have been rewritten. The
    ethread library is an Erlang runtime system internal, portable
    thread library used by the runtime system itself.
    Most notable improvement is a reader optimized rwlock
    implementation which dramatically improve the performance of
    read-lock/read-unlock operations on multi processor systems by
    avoiding ping-ponging of the rwlock cache lines. The reader
    optimized rwlock implementation is used by miscellaneous
    rwlocks in the runtime system that are known to be read-locked
    frequently, and can be enabled on ETS tables by passing the
    `{read_concurrency, true}' option upon table creation. See the
    documentation of `ets:new/2' for more information.
    The ethread library can now also use the libatomic_ops library
    for atomic memory accesses. This makes it possible for the
    Erlang runtime system to utilize optimized atomic operations
    on more platforms than before. Use the
    `--with-libatomic_ops=PATH' configure command line argument
    when specifying where the libatomic_ops installation is
    located. The libatomic_ops library can be downloaded from:
    The changed API of the ethread library has also caused
    modifications in the Erlang runtime system. Preparations for
    the to come "delayed deallocation" feature has also been done
    since it depends on the ethread library.
    Note: When building for x86, the ethread library will now use
    instructions that first appeared on the pentium 4 processor. If
    you want the runtime system to be compatible with older
    processors (back to 486) you need to pass the
    `--enable-ethread-pre-pentium4-compatibility' configure command
    line argument when configuring the system.
Commits on Apr 6, 2010
  1. @tuncer

    Build placeholder PDF files if FOP is not found

    tuncer committed
    If FOP is not found create PDF files with fakefop script.
    Signed-off-by: Tuncer Ayaz <>
Commits on Mar 22, 2010
  1. Merge branch 'pan/otp_8332_halfword' into dev

    Erlang/OTP committed
    * pan/otp_8332_halfword:
      Teach testcase in driver_suite the new prototype for driver_async
      wx: Correct usage of driver callbacks from wx thread
      Adopt the new (R13B04) Nif functionality to the halfword codebase
      Support monitoring and demonitoring from driver threads
      Fix further test-suite problems
      Correct the VM to work for more test suites
      Teach {wordsize,internal|external} to system_info/1
      Make tracing and distribution work
      Turn on instruction packing in the loader and virtual machine
      Add the BeamInstr data type for loaded BEAM code
      Fix the BEAM dissambler for the half-word emulator
      Store pointers to heap data in 32-bit words
      Add a custom mmap wrapper to force heaps into the lower address range
      Fit all heap data into the 32-bit address range
  2. @rickard-green

    OTP-8512 Add Erlangish MarkDown to Erlangish XML support

    rickard-green committed with Erlang/OTP
    The,, and "readme files" are
    now included in both the HTML and the PDF documentation.
Commits on Mar 10, 2010
  1. @bufflig @bjorng

    Store pointers to heap data in 32-bit words

    bufflig committed with bjorng
    Store Erlang terms in 32-bit entities on the heap, expanding the
    pointers to 64-bit when needed. This works because all terms are stored
    on addresses in the 32-bit address range (the 32 most significant bits
    of pointers to term data are always 0).
    Introduce a new datatype called UWord (along with its companion SWord),
    which is an integer having the exact same size as the machine word
    (a void *), but might be larger than Eterm/Uint.
    Store code as machine words, as the instructions are pointers to
    executable code which might reside outside the 32-bit address range.
    Continuation pointers are stored on the 32-bit stack and hence must
    point to addresses in the low range, which means that loaded beam code
    much be placed in the low 32-bit address range (but, as said earlier,
    the instructions themselves are full words).
    No Erlang term data can be stored on C stacks (enforced by an
    earlier commit).
    This version gives a prompt, but test cases still fail (and dump core).
    The loader (and emulator loop) has instruction packing disabled.
    The main issues has been in rewriting loader and actual virtual
    machine. Subsystems (like distribution) does not work yet.
Commits on Feb 18, 2010
  1. @rickard-green

    OTP-8449 Documentation improvements.

    rickard-green committed with Erlang/OTP
              The most important "readme" files now use Markdown notation. HTML
              versions of these files are now also automatically generated and
              included in the HTML documentation.
              - Building and Installing Erlang/OTP - $ERL_TOP/
              (previously known as $ERL_TOP/README).
              - Cross Compiling Erlang/OTP - $ERL_TOP/
              - How to Build Erlang/OTP on Windows - $ERL_TOP/
              (previously known as $ERL_TOP/README.win32).
Commits on Feb 6, 2010
  1. @bufflig @bjorng
Commits on Feb 3, 2010
  1. @rickard-green

    OTP-8323 Cross compilation improvements and other build system

    rickard-green committed with Erlang/OTP
              Most notable:
              Lots of cross compilation improvements. The old cross compilation
              support was more or less non-existing as well as broken. Please,
              note that the cross compilation support should still be
              considered as experimental. Also note that old cross compilation
              configurations cannot be used without modifications. For more
              information on cross compiling Erlang/OTP see the
              $ERL_TOP/xcomp/README file.
              Support for staged install using <url
              ESTDIR</url>. The old broken INSTALL_PREFIX has also been fixed.
              For more information see the $ERL_TOP/README file.
              Documentation of the release target of the top Makefile. For more
              information see the $ERL_TOP/README file.
              make install now by default creates relative symbolic links
              instead of absolute ones. For more information see the
              $ERL_TOP/README file.
              $ERL_TOP/configure --help=recursive now works and prints help for
              all applications with configure scripts.
              Doing make install, or make release directly after make all no
              longer triggers miscellaneous rebuilds.
              Existing bootstrap system is now used when doing make install, or
              make release without a preceding make all.
              The crypto and ssl applications use the same runtime library path
              when dynamically linking against and The
              runtime library search path has also been extended.
              The configure scripts of erl_interface and odbc now search for
              thread libraries and thread library quirks the same way as erts
              The configure script of the odbc application now also looks for
              odbc libraries in lib64 and lib/64 directories when building on a
              64-bit system.
              The file in the erl_interface application is now
              automatically generated in instead of statically updated which
              reduces the risk of configure tests without any effect.
Commits on Nov 20, 2009
  1. The R13B03 release.

    Erlang/OTP committed
Something went wrong with that request. Please try again.