Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ system/ linguist-vendored

AUTHORS merge=union
ChangeLog.md merge=union

# line endings
* text=auto eol=lf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, this means that for almost all files, developers will see unix line endings, even on windows? Why is that desirable?

Copy link
Contributor Author

@aminya aminya Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any executable file that is supposed to run on Linux must be LF, and any executable that wants to run on Windows must be CRLF.
If someone clones this repository on Windows and then opens it in WSL, the line-endings will break because they become CRLF by default if no option is specified.

So, to fix these issues, one convention should be chosen. The easiest one is to specify CRLF for Windows executables and make everything else LF.

My addition is based on this:
https://rehansaeed.com/gitattributes-best-practices/

I can change the code to be less forceful for consistent line-ending. However, this only covers .sh files. It is usually common to use hash bangs for executables and not the file extension, and so those files will become faulty if they are accessed from another operating system.

# Set default behaviour to automatically normalize line endings.
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is just to support WSL users who are using a kind of hybrid environment I'm not sure it worth it. I would have though that WSL users already have to savy enough to setup global settings.

In any case, can we split out this PR so we can discuss the .gitattributes separately. It seems like its worth further discussion and I don't want to block to this PR.

*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any files with mixed case extensions like this. I think just adding cmd and bat to the list below should be fine.

*.{vcxproj,vcxproj.filters} text eol=crlf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a newline at EOF.

4 changes: 2 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Current Trunk
------------------
- `emscripten/vr.h` and other remnants of WebVR support removed. (#13210, which
is a followup to #10460)
- Stop overriding CMake default flags based on build type. This will
- Stop overriding CMake default flags based on build type. This will
result in builds that are more like CMake does on other platforms. You
may notice that `RelWithDebInfo` will now include debug info (it did not
before, which appears to have been an error), and that `Release` will
Expand Down Expand Up @@ -216,7 +216,7 @@ Current Trunk
is encountered. This makes the Emscripten program behave more like a native
program where the OS would terminate the process and no further code can be
executed when an unhandled exception (e.g. out-of-bounds memory access) happens.
Once the program aborts any exported function calls will fail with a "program
Once the program aborts any exported function calls will fail with a "program
has already aborted" exception to prevent calls into code with a potentially
corrupted program state.
- Use `__indirect_function_table` as the import name for the table, which is
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ the following conditions:
Neither the names of Mozilla,
nor the names of its contributors may be used to endorse
or promote products derived from this Software without specific prior
written permission.
written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Expand Down
2 changes: 1 addition & 1 deletion docs/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ linux distributions, or other downstream SDKs.

Firstly, we provide an install script in `tools/install.py`. This allows
just the end-user parts of emscripten to be installed. For example this avoids
including the `tests/third_party` directory which is of that biggest parts
including the `tests/third_party` directory which is of that biggest parts
of the source tree.

If you prefer, you can use `make install` or `make dist` which invokes
Expand Down
2 changes: 1 addition & 1 deletion site/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@


#Build "Todo" notes into the source
#todo_include_todos = 'True'
#todo_include_todos = 'True'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
18 changes: 9 additions & 9 deletions site/source/docs/api_reference/Filesystem-API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,12 @@ Paths
.. js:function:: FS.analyzePath(path, dontResolveLastLink)

Looks up the incoming path and returns an object containing information about
file stats and nodes. Built on top of ``FS.lookupPath`` and provides more
information about given path and its parent. If any error occurs it won't
file stats and nodes. Built on top of ``FS.lookupPath`` and provides more
information about given path and its parent. If any error occurs it won't
throw but returns an ``error`` property.

:param string path: The incoming path.
:param boolean dontResolveLastLink: If true, don't follow the last component
:param boolean dontResolveLastLink: If true, don't follow the last component
if it is a symlink.

:returns: an object with the format:
Expand All @@ -780,13 +780,13 @@ Paths

{
isRoot: boolean,
exists: boolean,
error: Error,
name: string,
path: resolved_path,
exists: boolean,
error: Error,
name: string,
path: resolved_path,
object: resolved_node,
parentExists: boolean,
parentPath: resolved_parent_path,
parentExists: boolean,
parentPath: resolved_parent_path,
parentObject: resolved_parent_node
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Creating the compiler configuration file
The settings file is created the first time a user runs :ref:`emcc <emccdoc>` (or any of the other Emscripten tools):

1. Navigate to the directory where you cloned the Emscripten repository.
2. Enter the command:
2. Enter the command:

::

./emcc --help

You should get a ``Welcome to Emscripten!`` message. Behind the scenes, Emscripten generates a file called ``.emscripten`` in your home folder.


Emscripten makes a "best guess" at the correct locations for tools and updates the file appropriately. Where possible it will look for "system" apps (like Python and Java).

In most cases it is necessary to edit the generated file and modify at least the
Expand Down Expand Up @@ -57,28 +57,28 @@ Compiler configuration file-format
The file simply assigns paths to a number of *variables* representing the main tools used by Emscripten. For example, if the user installed python to the **C:/Python27/** directory, then the file might have the line: ::

PYTHON = 'C:\\Python38\\python.exe'


The default *emcc* configuration file often gets the paths from environment variables if defined. If no variable is defined the system will also attempt to find "system executables". For example: ::

PYTHON = os.path.expanduser(os.getenv('PYTHON', 'C:\\Python38\\python.exe'))

You can find out the other variable names from the default *.emscripten* file or the :ref:`example here <compiler-configuration-file>`.
You can find out the other variable names from the default *.emscripten* file or the :ref:`example here <compiler-configuration-file>`.

Editing the compiler configuration file
=======================================

The compiler configuration file can be edited with the text editor of your choice. As stated above, most default settings are likely to be correct. If you're building manually from source, you are most likely to have to update the variable ``LLVM_ROOT``


#. Edit the variable ``LLVM_ROOT`` to point to the directory where you built the LLVM binaries, such as:

::

LLVM_ROOT = os.path.expanduser(os.getenv('LLVM', '/home/ubuntu/a-path/llvm/build/bin'))

.. note:: Use forward slashes!

.. comment .. The settings are now correct in the configuration file, but the paths and environment variables are not set in the command prompt/terminal. **HamishW** Follow up with Jukka on this.

After setting those paths, run ``emcc`` again. It should again perform the sanity checks to test the specified paths. There are further validation tests available at :ref:`verifying-the-emscripten-environment`.
2 changes: 1 addition & 1 deletion site/source/docs/compiling/Building-Projects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ The :ref:`Tutorial` showed how :ref:`emcc <emccdoc>` can be used to compile sing
./emcc src1.o src2.o -r -o combined.o

# Combine two object files into library file
./emar rcs libfoo.a src1.o src2.o
./emar rcs libfoo.a src1.o src2.o


In addition to the capabilities it shares with *gcc*, *emcc* supports options to optimize code, control what debug information is emitted, generate HTML and other output formats, etc. These options are documented in the :ref:`emcc tool reference <emccdoc>` (``./emcc --help`` on the command line).
Expand Down
2 changes: 1 addition & 1 deletion site/source/docs/contributing/developers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ binaries with a checkout of the core Emscripten repository, simply by calling
``emcc.py`` from that checkout, and it will use the binaries from the emsdk.

If you do want to contribute to LLVM or Binaryen, or to test modifications
to them, you can
to them, you can
:ref:`build them from source <installing-from-source>`.

Repositories and branches of interest
Expand Down
2 changes: 1 addition & 1 deletion site/source/docs/getting_started/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ strings, so it accepts ``[a]`` or ``[a,b]`` etc.).


Why do I get a Python ``SyntaxError: invalid syntax`` on ``file=..`` or on a string starting with ``f'..'``?
============================================================================================================
============================================================================================================

Emscripten requires a recent-enough version of Python. An older Python version,
like ``2.*``, will not support the print statement by default, so it will error on
Expand Down
2 changes: 1 addition & 1 deletion site/source/docs/getting_started/downloads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ There are also "tip-of-tree builds", which are the very latest code that passes

::

# Get a tip-of-tree
# Get a tip-of-tree
./emsdk install tot

(In the above examples we installed the various targets; remember to also ``activate`` them as in the full example from earlier.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Attributes
Object attributes are defined in IDL using the ``attribute`` keyword. These can then be accessed in JavaScript using either ``get_foo()``/``set_foo()`` accessor methods, or directly as a property of the object.

.. code-block:: cpp

// C++
int attr;

Expand Down Expand Up @@ -210,7 +210,7 @@ Undecorated argument and return values of a custom type in the IDL are assumed t

// WebIDL
MyClass process(MyClass input);

This assumption isn't true for base types like void,int,bool,DOMString,etc.

References should be decorated using ``[Ref]``:
Expand Down
22 changes: 11 additions & 11 deletions site/source/docs/porting/simd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ The following table highlights the availability and expected performance of diff
Only the 128-bit wide instructions from AVX instruction set are available. 256-bit wide AVX instructions are not provided.


======================================================
======================================================
Compiling SIMD code targeting ARM NEON instruction set
======================================================

Expand Down Expand Up @@ -1071,9 +1071,9 @@ For detailed information on each intrinsic function, refer to `NEON Intrinsics R
- ⚫ Not implemented, will trigger compiler error
* - vaddv
- ⚫ Not implemented, will trigger compiler error
* - vaddw
* - vaddw
- ❌ Will be emulated with slow instructions, or scalarized
* - vand
* - vand
- native
* - vbic
- ⚫ Not implemented, will trigger compiler error
Expand Down Expand Up @@ -1101,13 +1101,13 @@ For detailed information on each intrinsic function, refer to `NEON Intrinsics R
- ⚫ Not implemented, will trigger compiler error
* - vclt
- native
* - vcltz
* - vcltz
- ⚠ Does not have direct implementation, but is emulated using fast NEON instructions
* - vcnt
- ⚫ Not implemented, will trigger compiler error
* - vclz
- ⚫ Not implemented, will trigger compiler error
* - vcombine
* - vcombine
- ❌ Will be emulated with slow instructions, or scalarized
* - vcreate
- ❌ Will be emulated with slow instructions, or scalarized
Expand Down Expand Up @@ -1145,7 +1145,7 @@ For detailed information on each intrinsic function, refer to `NEON Intrinsics R
- native
* - vminv
- ⚫ Not implemented, will trigger compiler error
* - vmla
* - vmla
- ⚠ Does not have direct implementation, but is emulated using fast NEON instructions
* - vmlal
- ❌ Will be emulated with slow instructions, or scalarized
Expand All @@ -1157,9 +1157,9 @@ For detailed information on each intrinsic function, refer to `NEON Intrinsics R
- native
* - vmul
- native
* - vmul_n
* - vmul_n
- ⚠ Does not have direct implementation, but is emulated using fast NEON instructions
* - vmull
* - vmull
- ⚠ Does not have direct implementation, but is emulated using fast NEON instructions
* - vmull_n
- ⚠ Does not have direct implementation, but is emulated using fast NEON instructions
Expand All @@ -1177,7 +1177,7 @@ For detailed information on each intrinsic function, refer to `NEON Intrinsics R
- ❌ Will be emulated with slow instructions, or scalarized
* - vpadd
- ❌ Will be emulated with slow instructions, or scalarized
* - vpaddl
* - vpaddl
- ❌ Will be emulated with slow instructions, or scalarized
* - vpmax
- ❌ Will be emulated with slow instructions, or scalarized
Expand All @@ -1189,11 +1189,11 @@ For detailed information on each intrinsic function, refer to `NEON Intrinsics R
- ⚫ Not implemented, will trigger compiler error
* - vqabsb
- ⚫ Not implemented, will trigger compiler error
* - vqadd
* - vqadd
- 💡 Depends on a smart enough compiler, but should be near native
* - vqaddb
- ⚫ Not implemented, will trigger compiler error
* - vqdmulh
* - vqdmulh
- ❌ Will be emulated with slow instructions, or scalarized
* - vqneg
- ⚫ Not implemented, will trigger compiler error
Expand Down
2 changes: 1 addition & 1 deletion site/source/docs/tools_reference/emsdk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ How do I install a tool/SDK version?
Use the ``install`` argument to download and install a new tool or SDK version: ::

./emsdk install <tool/sdk name>

For example: ::

./emsdk install sdk-1.38.21-64bit
Expand Down
2 changes: 1 addition & 1 deletion site/source/home_page_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h3>Emscripten is a complete compiler toolchain to WebAssembly, using LLVM, with
<div class="signpost-heading" style="font-size:2em; font-style:bold; margin-bottom:10px;">Fast</div>
<div class="signpost-body" style=""><p>Thanks to the combination of LLVM, Emscripten, <a href="https://github.com/WebAssembly/binaryen">Binaryen</a>, and <a href="http://webassembly.org/">WebAssembly</a>, the output is compact and runs at near-native speed.</p></div>
</div>
</div>
</div>
</div>

<div style="margin-left: auto; margin-right: auto; text-align: center; margin-bottom: 10px; padding: 20px 20px 1px; background-color: rgb(217, 240, 180);background-image:linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,0.15));box-shadow:3px 3px 5px gray;">
Expand Down
18 changes: 9 additions & 9 deletions src/cpuprofiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var emscriptenCpuProfiler = {
for (var i = 0; i < this.fpsCounterTicks.length-1; ++i) this.fpsCounterTicks[i] = this.fpsCounterTicks[i+1];
this.fpsCounterTicks[this.fpsCounterTicks.length-1] = now;
}

if (now - this.fpsCounterLastPrint > this.fpsCounterUpdateInterval) {
var fps = ((this.fpsCounterTicks.length - 1) * 1000.0 / (this.fpsCounterTicks[this.fpsCounterTicks.length - 1] - this.fpsCounterTicks[0]));
var totalDt = 0;
Expand Down Expand Up @@ -209,7 +209,7 @@ var emscriptenCpuProfiler = {
fn = fn.trim();
cs += '"' + fn + '"';
}

console.error('Trace: at t=' + performance.realNow().toFixed(1) + ', section "' + sect.name + '" called via ' + cs + ' took ' + timeInSection.toFixed(2) + ' msecs!');
}
if (this.insideMainLoopRecursionCounter) sect.accumulatedTimeInsideMainLoop += timeInSection;
Expand Down Expand Up @@ -240,7 +240,7 @@ var emscriptenCpuProfiler = {
sect.accumulatedTimeInsideMainLoop = 0;
sect.accumulatedTimeOutsideMainLoop = 0;
}

var t = performance.realNow();
var cpuMainLoopDuration = t - this.currentFrameStartTime;
var durationBetweenFrameUpdates = t - this.previousFrameEndTime;
Expand Down Expand Up @@ -353,7 +353,7 @@ var emscriptenCpuProfiler = {

if (location.search.indexOf('expandhelp') != -1) this.toggleHelpTextVisible();
}

this.canvas = document.getElementById('cpuprofiler_canvas');
this.canvas.width = document.documentElement.clientWidth - 32;
this.drawContext = this.canvas.getContext('2d');
Expand Down Expand Up @@ -396,7 +396,7 @@ var emscriptenCpuProfiler = {
this.drawContext.fillRect(startX,this.canvas.height - height, endX - startX, pixelThickness);
},

clearUi: function clearUi(startX, endX) {
clearUi: function clearUi(startX, endX) {
// Background clear
this.drawContext.fillStyle = this.colorBackground;
this.drawContext.fillRect(startX, 0, endX - startX, this.canvas.height);
Expand Down Expand Up @@ -448,7 +448,7 @@ var emscriptenCpuProfiler = {

// Main UI update/redraw entry point. Drawing occurs incrementally to touch as few pixels as possible and to cause the least impact to the overall performance
// while profiling.
updateUi: function updateUi(startX, endX) {
updateUi: function updateUi(startX, endX) {
// Poll whether user as changed the browser window, and if so, resize the profiler window and redraw it.
if (this.canvas.width != document.documentElement.clientWidth - 32) {
this.canvas.width = document.documentElement.clientWidth - 32;
Expand Down Expand Up @@ -622,19 +622,19 @@ var emscriptenCpuProfiler = {
}
var this_ = this;
// The above injection won't work for texImage2D and texSubImage2D, which have multiple overloads.
glCtx['texImage2D'] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
glCtx['texImage2D'] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
this_.enterSection(1);
var ret = (a7 !== undefined) ? glCtx['real_texImage2D'](a1, a2, a3, a4, a5, a6, a7, a8, a9) : glCtx['real_texImage2D'](a1, a2, a3, a4, a5, a6);
this_.endSection(1);
return ret;
};
glCtx['texSubImage2D'] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
glCtx['texSubImage2D'] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
this_.enterSection(0);
var ret = (a8 !== undefined) ? glCtx['real_texSubImage2D'](a1, a2, a3, a4, a5, a6, a7, a8, a9) : glCtx['real_texSubImage2D'](a1, a2, a3, a4, a5, a6, a7);
this_.endSection(0);
return ret;
};
glCtx['texSubImage3D'] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) {
glCtx['texSubImage3D'] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) {
this_.enterSection(0);
var ret = (a9 !== undefined) ? glCtx['real_texSubImage3D'](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) : glCtx['real_texSubImage2D'](a1, a2, a3, a4, a5, a6, a7, a8);
this_.endSection(0);
Expand Down
Loading