├── .github └── ISSUE_TEMPLATE.md ├── .gitignore ├── .mailmap ├── .travis.yml ├── CONTRIBUTING.md ├── DISTRIBUTING.md ├── HISTORY.md ├── LICENSE.md ├── Make.inc ├── Makefile ├── NEWS.md ├── README.arm.md ├── README.md ├── README.windows.md ├── VERSION ├── Windows.inc ├── appveyor.yml ├── base ├── .gitignore ├── Enums.jl ├── Makefile ├── abstractarray.jl ├── abstractarraymath.jl ├── array.jl ├── arraymath.jl ├── associative.jl ├── asyncmap.jl ├── atomics.jl ├── base.jl ├── base64.jl ├── bitarray.jl ├── bool.jl ├── boot.jl ├── broadcast.jl ├── c.jl ├── cartesian.jl ├── channels.jl ├── char.jl ├── checked.jl ├── client.jl ├── combinatorics.jl ├── complex.jl ├── coreimg.jl ├── coreio.jl ├── ctypes.jl ├── dSFMT.jl ├── datafmt.jl ├── dates │ ├── Dates.jl │ ├── accessors.jl │ ├── adjusters.jl │ ├── arithmetic.jl │ ├── conversions.jl │ ├── io.jl │ ├── parse.jl │ ├── periods.jl │ ├── query.jl │ ├── ranges.jl │ ├── rounding.jl │ └── types.jl ├── deepcopy.jl ├── deprecated.jl ├── dict.jl ├── distributed │ ├── Distributed.jl │ ├── cluster.jl │ ├── clusterserialize.jl │ ├── macros.jl │ ├── managers.jl │ ├── messages.jl │ ├── pmap.jl │ ├── process_messages.jl │ ├── remotecall.jl │ └── workerpool.jl ├── docs │ ├── Docs.jl │ ├── basedocs.jl │ ├── bindings.jl │ ├── core.jl │ ├── helpdb.jl │ ├── helpdb │ │ └── Base.jl │ └── utils.jl ├── env.jl ├── errno.jl ├── error.jl ├── essentials.jl ├── event.jl ├── exports.jl ├── expr.jl ├── fastmath.jl ├── file.jl ├── filesystem.jl ├── float.jl ├── floatfuncs.jl ├── generator.jl ├── gmp.jl ├── grisu │ ├── bignum.jl │ ├── bignums.jl │ ├── fastfixed.jl │ ├── fastprecision.jl │ ├── fastshortest.jl │ ├── float.jl │ └── grisu.jl ├── hashing.jl ├── hashing2.jl ├── i18n.jl ├── indices.jl ├── inference.jl ├── initdefs.jl ├── int.jl ├── interactiveutil.jl ├── intfuncs.jl ├── intset.jl ├── io.jl ├── iobuffer.jl ├── iostream.jl ├── irrationals.jl ├── iterators.jl ├── libc.jl ├── libdl.jl ├── libgit2 │ ├── blame.jl │ ├── blob.jl │ ├── callbacks.jl │ ├── commit.jl │ ├── config.jl │ ├── consts.jl │ ├── diff.jl │ ├── error.jl │ ├── index.jl │ ├── libgit2.jl │ ├── merge.jl │ ├── oid.jl │ ├── rebase.jl │ ├── reference.jl │ ├── remote.jl │ ├── repository.jl │ ├── signature.jl │ ├── status.jl │ ├── strarray.jl │ ├── tag.jl │ ├── tree.jl │ ├── types.jl │ ├── utils.jl │ └── walker.jl ├── libuv.jl ├── linalg │ ├── arnoldi.jl │ ├── arpack.jl │ ├── bidiag.jl │ ├── bitarray.jl │ ├── blas.jl │ ├── bunchkaufman.jl │ ├── cholesky.jl │ ├── conjarray.jl │ ├── dense.jl │ ├── diagonal.jl │ ├── eigen.jl │ ├── exceptions.jl │ ├── factorization.jl │ ├── generic.jl │ ├── givens.jl │ ├── hessenberg.jl │ ├── lapack.jl │ ├── ldlt.jl │ ├── linalg.jl │ ├── lq.jl │ ├── lu.jl │ ├── matmul.jl │ ├── qr.jl │ ├── rowvector.jl │ ├── schur.jl │ ├── special.jl │ ├── svd.jl │ ├── symmetric.jl │ ├── transpose.jl │ ├── triangular.jl │ ├── tridiag.jl │ └── uniformscaling.jl ├── loading.jl ├── lock.jl ├── locks.jl ├── markdown │ ├── Common │ │ ├── Common.jl │ │ ├── block.jl │ │ └── inline.jl │ ├── GitHub │ │ ├── GitHub.jl │ │ └── table.jl │ ├── IPython │ │ └── IPython.jl │ ├── Julia │ │ ├── Julia.jl │ │ └── interp.jl │ ├── Markdown.jl │ ├── parse │ │ ├── config.jl │ │ ├── parse.jl │ │ └── util.jl │ └── render │ │ ├── html.jl │ │ ├── latex.jl │ │ ├── plain.jl │ │ ├── rich.jl │ │ ├── rst.jl │ │ └── terminal │ │ ├── formatting.jl │ │ └── render.jl ├── math.jl ├── meta.jl ├── methodshow.jl ├── mmap.jl ├── mpfr.jl ├── multidimensional.jl ├── multimedia.jl ├── multinverses.jl ├── nofloat_hashing.jl ├── nullable.jl ├── number.jl ├── operators.jl ├── options.jl ├── ordering.jl ├── osutils.jl ├── pair.jl ├── parse.jl ├── path.jl ├── pcre.jl ├── permuteddimsarray.jl ├── pkg │ ├── cache.jl │ ├── dir.jl │ ├── entry.jl │ ├── pkg.jl │ ├── query.jl │ ├── read.jl │ ├── reqs.jl │ ├── resolve.jl │ ├── resolve │ │ ├── fieldvalue.jl │ │ ├── interface.jl │ │ ├── maxsum.jl │ │ └── versionweight.jl │ ├── types.jl │ └── write.jl ├── pointer.jl ├── poll.jl ├── precompile.jl ├── printf.jl ├── process.jl ├── profile.jl ├── promotion.jl ├── random.jl ├── range.jl ├── rational.jl ├── reduce.jl ├── reducedim.jl ├── reflection.jl ├── refpointer.jl ├── regex.jl ├── repl │ ├── LineEdit.jl │ ├── REPL.jl │ ├── REPLCompletions.jl │ ├── Terminals.jl │ ├── emoji_symbols.jl │ └── latex_symbols.jl ├── replutil.jl ├── reshapedarray.jl ├── rounding.jl ├── serialize.jl ├── set.jl ├── sharedarray.jl ├── shell.jl ├── show.jl ├── simdloop.jl ├── socket.jl ├── sort.jl ├── sparse │ ├── abstractsparse.jl │ ├── cholmod.jl │ ├── cholmod_h.jl │ ├── higherorderfns.jl │ ├── linalg.jl │ ├── sparse.jl │ ├── sparsematrix.jl │ ├── sparsevector.jl │ ├── spqr.jl │ ├── umfpack.jl │ └── umfpack_h.jl ├── special │ ├── exp.jl │ ├── exp10.jl │ ├── gamma.jl │ ├── log.jl │ └── trig.jl ├── stacktraces.jl ├── stat.jl ├── statistics.jl ├── stream.jl ├── strings │ ├── basic.jl │ ├── errors.jl │ ├── io.jl │ ├── search.jl │ ├── string.jl │ ├── strings.jl │ ├── types.jl │ ├── utf8proc.jl │ └── util.jl ├── subarray.jl ├── summarysize.jl ├── sysimg.jl ├── sysinfo.jl ├── task.jl ├── test.jl ├── threadcall.jl ├── threadingconstructs.jl ├── threads.jl ├── traits.jl ├── tuple.jl ├── twiceprecision.jl ├── util.jl ├── version.jl ├── version_git.sh └── weakkeydict.jl ├── contrib ├── Julia_Notepad++.xml ├── Notepad++_2_Julia.ahk ├── README.ackrc.txt ├── README.ctags.txt ├── README.md ├── ackrc ├── add_license_to_files.jl ├── build_sysimg.jl ├── check-whitespace.sh ├── commit-name.sh ├── ctags ├── debug_bootstrap.gdb ├── download_cmake.sh ├── filterArgs.sh ├── fixup-libgfortran.sh ├── fixup-libstdc++.sh ├── install.sh ├── julia-config.jl ├── julia.appdata.xml ├── julia.desktop ├── julia.hrc ├── julia.lang ├── julia.svg ├── julia.xml ├── mac │ ├── app │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── README.md │ │ ├── julia.icns │ │ └── startup.applescript │ ├── juliarc.jl │ ├── mac-gtk.sh │ └── macports.make ├── prepare_release.sh ├── relative_path.sh ├── repackage_system_suitesparse4.make ├── stringreplace.c ├── travis_fastfail.sh ├── vagrant │ ├── .gitignore │ ├── README.md │ └── Vagrantfile ├── valgrind-julia.supp └── windows │ ├── 7zS.sfx │ ├── 7zSFX-config.txt │ ├── 7zSFX-manifest.xml │ ├── Vagrantfile │ ├── appveyor_build.sh │ ├── build-installer.nsi │ ├── get_toolchain.sh │ ├── install-cygwin.ps1 │ ├── julia-manifest.xml │ ├── julia.ico │ ├── julia.rc │ ├── juliarc.jl │ └── winrpm.sh ├── deps ├── .gitignore ├── Makefile ├── NATIVE.cmake ├── SuiteSparse_wrapper.c ├── Versions.make ├── arpack.mk ├── blas.mk ├── checksums │ ├── SuiteSparse-4.4.5.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── UnicodeData.txt │ │ ├── md5 │ │ └── sha512 │ ├── arpack-ng-3.3.0-testA.mtx │ │ ├── md5 │ │ └── sha512 │ ├── arpack-ng-3.3.0.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── cfe-3.9.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── compiler-rt-3.9.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── curl-7.54.1.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── dsfmt-2.2.3.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── fftw-3.3.6-pl1.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── gmp-6.1.2.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z │ │ ├── md5 │ │ └── sha512 │ ├── lapack-3.5.0.tgz │ │ ├── md5 │ │ └── sha512 │ ├── libcxx-3.9.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── libgit2-15e119375018fba121cf58e02a9f17fe22df0df8.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libosxunwind-0.0.3.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libssh2-30e9c1347e3b8baa2951db612f05e6d87fc8e2f2.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libunwind-1.1-julia2.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libuv-52d72a52cc7ccd570929990f010ed16e2ec604c8.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── lldb-3.9.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.9.1-i686-w64-mingw32-juliadeps-r07.7z │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.9.1-x86_64-w64-mingw32-juliadeps-r07.7z │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.9.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── mbedtls-2.5.1-apache.tgz │ │ ├── md5 │ │ └── sha512 │ ├── mbedtls-2.5.1-gpl.tgz │ │ ├── md5 │ │ └── sha512 │ ├── mpfr-3.1.5.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── openblas-85636ff1a015d04d3a8f960bc644b85ee5157135.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── openlibm-1581174c85f7b645b15ba1ac1c3a98fb601f0fe7.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── openspecfun-39699a1c1824bf88410cabb8a7438af91ea98f4c.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── patchelf-0.9.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── pcre2-10.23.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── utf8proc-40e605959eb5cb90b2587fa88e3b661558fbc55a.tar.gz │ │ ├── md5 │ │ └── sha512 │ └── x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z │ │ ├── md5 │ │ └── sha512 ├── curl.mk ├── dsfmt.mk ├── gfortblas.alias ├── gfortblas.c ├── gmp.mk ├── libdSFMT.def ├── libgit2.mk ├── libgit2.version ├── libssh2.mk ├── libssh2.version ├── libuv.mk ├── libuv.version ├── llvm-options.mk ├── llvm-ver.make ├── llvm.mk ├── mbedtls.mk ├── mpfr.mk ├── objconv.mk ├── openblas.version ├── openlibm.mk ├── openlibm.version ├── openspecfun.mk ├── openspecfun.version ├── patchelf.mk ├── patches │ ├── SuiteSparse-winclang.patch │ ├── arpack-tests-blasint.patch │ ├── compiler-rt-3.7.1.patch │ ├── dSFMT.c.patch │ ├── dSFMT.h.patch │ ├── gmp-exception.patch │ ├── libgit2-agent-nonfatal.patch │ ├── libgit2-mbedtls-fixup.patch │ ├── libgit2-mbedtls-verify.patch │ ├── libgit2-mbedtls.patch │ ├── libgit2-ssh.patch │ ├── libssh2-encryptedpem.patch │ ├── libssh2-netinet-in.patch │ ├── libunwind-arm-dyn.patch │ ├── libunwind-arm-pc-offset.patch │ ├── libunwind-dwarf-ver.patch │ ├── libunwind-freebsd-mapper.patch │ ├── libunwind-prefer-extbl.patch │ ├── lldb-3.7.1.patch │ ├── llvm-3.9.0_D27296-libssp.patch │ ├── llvm-3.9.0_threads.patch │ ├── llvm-3.9.0_win64-reloc-dwarf.patch │ ├── llvm-4.0.0_threads.patch │ ├── llvm-D23597_sdag_names.patch │ ├── llvm-D24300_ptx_intrinsics.patch │ ├── llvm-D25865-cmakeshlib.patch │ ├── llvm-D27389.patch │ ├── llvm-D27397.patch │ ├── llvm-D27609-AArch64-UABS_G3.patch │ ├── llvm-D27629-AArch64-large_model.patch │ ├── llvm-D27629-AArch64-large_model_4.0.patch │ ├── llvm-D28009.patch │ ├── llvm-D28215_FreeBSD_shlib.patch │ ├── llvm-D28221-avx512.patch │ ├── llvm-D28759-loopclearance.patch │ ├── llvm-D28786-callclearance.patch │ ├── llvm-D28786-callclearance_4.0.patch │ ├── llvm-D30478-VNCoercion.patch │ ├── llvm-D32196-LIR-non-integral.patch │ ├── llvm-D32203-SORA-non-integral.patch │ ├── llvm-D32208-coerce-non-integral.patch │ ├── llvm-D32593.patch │ ├── llvm-D32623-GVN-non-integral.patch │ ├── llvm-D33110-codegen-prepare-inttoptr.patch │ ├── llvm-D33129-scevexpander-non-integral.patch │ ├── llvm-D33179.patch │ ├── llvm-D9168_argument_alignment.patch │ ├── llvm-PR22923.patch │ ├── llvm-PR276266.patch │ ├── llvm-PR277939.patch │ ├── llvm-PR278088.patch │ ├── llvm-PR278321.patch │ ├── llvm-PR278923.patch │ ├── llvm-PR29010-i386-xmm.patch │ ├── llvm-VNCoercion-signatures.patch │ ├── llvm-VNCoercion-template.patch │ ├── llvm-Yet-another-fix.patch │ ├── llvm-arm-fix-prel31.patch │ ├── llvm-rL293230-icc17-cmake.patch │ ├── mpfr-sincos.patch │ ├── openblas-clangasmbug.patch │ ├── openblas-cross-compile.patch │ ├── openblas-freebsd.patch │ ├── openblas-power-assembly-fixes.patch │ └── pcre-mingw.patch ├── pcre.mk ├── suitesparse.mk ├── tools │ ├── common.mk │ ├── find_python2 │ ├── git-external.mk │ ├── jlchecksum │ └── jldownload ├── unwind.mk ├── utf8proc.mk ├── utf8proc.version └── valgrind │ └── valgrind.h ├── doc ├── .gitignore ├── Makefile ├── NEWS-update.jl ├── README.md ├── REQUIRE ├── images │ ├── github_metadata_develbranch.png │ ├── github_metadata_fork.png │ ├── github_metadata_pullrequest.png │ ├── jltypes.ai │ ├── jltypes.svg │ └── travis-icon.png ├── make.jl ├── man │ └── julia.1 └── src │ ├── assets │ └── logo.png │ ├── devdocs │ ├── ast.md │ ├── backtraces.md │ ├── boundscheck.md │ ├── callconv.md │ ├── cartesian.md │ ├── compiler.md │ ├── debuggingtips.md │ ├── eval.md │ ├── functions.md │ ├── inference.md │ ├── init.md │ ├── libgit2.md │ ├── llvm.md │ ├── locks.md │ ├── meta.md │ ├── object.md │ ├── offset-arrays.md │ ├── reflection.md │ ├── require.md │ ├── sanitizers.md │ ├── stdio.md │ ├── subarrays.md │ ├── sysimg.md │ ├── types.md │ └── valgrind.md │ ├── index.md │ ├── manual │ ├── arrays.md │ ├── calling-c-and-fortran-code.md │ ├── complex-and-rational-numbers.md │ ├── constructors.md │ ├── control-flow.md │ ├── conversion-and-promotion.md │ ├── dates.md │ ├── documentation.md │ ├── embedding.md │ ├── environment-variables.md │ ├── faq.md │ ├── functions.md │ ├── getting-started.md │ ├── handling-operating-system-variation.md │ ├── index.md │ ├── integers-and-floating-point-numbers.md │ ├── interacting-with-julia.md │ ├── interfaces.md │ ├── introduction.md │ ├── linear-algebra.md │ ├── mathematical-operations.md │ ├── metaprogramming.md │ ├── methods.md │ ├── modules.md │ ├── networking-and-streams.md │ ├── noteworthy-differences.md │ ├── packages.md │ ├── parallel-computing.md │ ├── performance-tips.md │ ├── profile.md │ ├── running-external-programs.md │ ├── stacktraces.md │ ├── strings.md │ ├── style-guide.md │ ├── types.md │ ├── unicode-input.md │ ├── variables-and-scoping.md │ ├── variables.md │ └── workflow-tips.md │ └── stdlib │ ├── arrays.md │ ├── base.md │ ├── c.md │ ├── collections.md │ ├── constants.md │ ├── dates.md │ ├── file.md │ ├── index.md │ ├── io-network.md │ ├── iterators.md │ ├── libc.md │ ├── libdl.md │ ├── linalg.md │ ├── math.md │ ├── numbers.md │ ├── parallel.md │ ├── pkg.md │ ├── profile.md │ ├── punctuation.md │ ├── simd-types.md │ ├── sort.md │ ├── stacktraces.md │ ├── strings.md │ └── test.md ├── etc └── juliarc.jl ├── examples ├── Makefile ├── ModInts.jl ├── bubblesort.jl ├── clustermanager │ ├── 0mq │ │ ├── README │ │ ├── ZMQCM.jl │ │ ├── broker.jl │ │ ├── head.jl │ │ └── worker.jl │ └── simple │ │ ├── README │ │ ├── UnixDomainCM.jl │ │ ├── head.jl │ │ └── test_simple.jl ├── dictchannel.jl ├── embedding │ ├── .gitignore │ ├── Makefile │ ├── embedding-test.jl │ └── embedding.c ├── juliatypes.jl ├── lru.jl ├── lru_test.jl ├── ndgrid.jl ├── queens.jl ├── quine.jl ├── staged.jl ├── time.jl ├── typetree.jl └── wordcount.jl ├── src ├── .gitignore ├── APInt-C.cpp ├── APInt-C.h ├── Makefile ├── Windows.mk ├── abi_aarch64.cpp ├── abi_arm.cpp ├── abi_llvm.cpp ├── abi_ppc64le.cpp ├── abi_win32.cpp ├── abi_win64.cpp ├── abi_x86.cpp ├── abi_x86_64.cpp ├── anticodegen.c ├── array.c ├── ast.c ├── ast.scm ├── atomics.h ├── bin2hex.scm ├── builtin_proto.h ├── builtins.c ├── ccall.cpp ├── ccalltest.c ├── cgmemmgr.cpp ├── cgutils.cpp ├── codegen.cpp ├── codegen_shared.h ├── common_symbols1.inc ├── common_symbols2.inc ├── crc32c-tables.c ├── crc32c.c ├── datatype.c ├── debuginfo.cpp ├── debuginfo.h ├── disasm.cpp ├── dlload.c ├── dump.c ├── file_constants.h ├── fix_llvm_assert.h ├── flisp │ ├── .gitignore │ ├── Makefile │ ├── Windows.mk │ ├── aliases.scm │ ├── bootstrap.sh │ ├── builtins.c │ ├── color.lsp │ ├── compiler.lsp │ ├── cvalues.c │ ├── equal.c │ ├── equalhash.c │ ├── equalhash.h │ ├── flisp.boot │ ├── flisp.c │ ├── flisp.h │ ├── flmain.c │ ├── iostream.c │ ├── julia_charmap.h │ ├── julia_extensions.c │ ├── mkboot0.lsp │ ├── mkboot1.lsp │ ├── opcodes.h │ ├── print.c │ ├── profile.scm │ ├── read.c │ ├── string.c │ ├── system.lsp │ ├── table.c │ ├── types.c │ └── unittest.lsp ├── gc-debug.c ├── gc-pages.c ├── gc.c ├── gc.h ├── gen_sysimg_symtab.jl ├── getopt.c ├── getopt.h ├── gf.c ├── init.c ├── interpreter.c ├── intrinsics.cpp ├── intrinsics.h ├── jitlayers.cpp ├── jitlayers.h ├── jl_uv.c ├── jlapi.c ├── jlfrontend.scm ├── jloptions.c ├── jltypes.c ├── julia-parser.scm ├── julia-syntax.scm ├── julia.expmap ├── julia.h ├── julia_internal.h ├── julia_threads.h ├── llvm-gc-invariant-verifier.cpp ├── llvm-late-gc-lowering.cpp ├── llvm-lower-handlers.cpp ├── llvm-muladd.cpp ├── llvm-propagate-addrspaces.cpp ├── llvm-ptls.cpp ├── llvm-simdloop.cpp ├── llvm-version.h ├── locks.h ├── macroexpand.scm ├── match.scm ├── method.c ├── mk_julia_flisp_boot.scm ├── module.c ├── options.h ├── precompile.c ├── rtutils.c ├── runtime_ccall.cpp ├── runtime_intrinsics.c ├── safepoint.c ├── signal-handling.c ├── signals-mach.c ├── signals-unix.c ├── signals-win.c ├── simplevector.c ├── stackwalk.c ├── staticdata.c ├── subtype.c ├── support │ ├── .gitignore │ ├── END.h │ ├── ENTRY.amd64.h │ ├── ENTRY.i387.h │ ├── Makefile │ ├── MurmurHash3.c │ ├── MurmurHash3.h │ ├── Windows.mk │ ├── _longjmp.win32.S │ ├── _longjmp.win64.S │ ├── _setjmp.win32.S │ ├── _setjmp.win64.S │ ├── arraylist.c │ ├── arraylist.h │ ├── asprintf.c │ ├── bitvector.c │ ├── bitvector.h │ ├── dirname.c │ ├── dirpath.h │ ├── dtypes.h │ ├── hashing.c │ ├── hashing.h │ ├── htable.c │ ├── htable.h │ ├── htable.inc │ ├── int2str.c │ ├── ios.c │ ├── ios.h │ ├── libsupport.h │ ├── libsupportinit.c │ ├── operators.c │ ├── platform.h │ ├── ptrhash.c │ ├── ptrhash.h │ ├── strptime.c │ ├── strtod.c │ ├── strtod.h │ ├── timefuncs.c │ ├── timefuncs.h │ ├── tzfile.h │ ├── utf8.c │ ├── utf8.h │ ├── utils.h │ └── wsasocketpair.c ├── symbol.c ├── sys.c ├── table.c ├── task.c ├── threadgroup.c ├── threadgroup.h ├── threading.c ├── threading.h ├── timing.c ├── timing.h ├── tls.h ├── toplevel.c ├── typemap.c ├── utils.scm └── uv_constants.h ├── test ├── .gitignore ├── Makefile ├── TestHelpers.jl ├── abstractarray.jl ├── ambiguous.jl ├── arrayops.jl ├── asmvariant.jl ├── backtrace.jl ├── base64.jl ├── bigfloat.jl ├── bigint.jl ├── bitarray.jl ├── boundscheck.jl ├── boundscheck_exec.jl ├── broadcast.jl ├── cartesian.jl ├── ccall.jl ├── channels.jl ├── char.jl ├── checked.jl ├── choosetests.jl ├── cmdlineargs.jl ├── codegen.jl ├── combinatorics.jl ├── compile.jl ├── complex.jl ├── copy.jl ├── core.jl ├── datafmt.jl ├── dates │ ├── accessors.jl │ ├── adjusters.jl │ ├── arithmetic.jl │ ├── conversions.jl │ ├── io.jl │ ├── periods.jl │ ├── query.jl │ ├── ranges.jl │ ├── rounding.jl │ └── types.jl ├── deprecation_exec.jl ├── dict.jl ├── dimensionful.jl ├── distributed.jl ├── distributed_exec.jl ├── docs.jl ├── download.jl ├── enums.jl ├── env.jl ├── error.jl ├── euler.jl ├── examples.jl ├── fastmath.jl ├── file.jl ├── float16.jl ├── floatapprox.jl ├── floatfuncs.jl ├── functional.jl ├── goto.jl ├── grisu.jl ├── hashing.jl ├── i18n.jl ├── inference.jl ├── inline.jl ├── int.jl ├── intfuncs.jl ├── intrinsics.jl ├── intset.jl ├── iobuffer.jl ├── iostream.jl ├── iterators.jl ├── keywordargs.jl ├── libdl.jl ├── libgit2-helpers.jl ├── libgit2-online.jl ├── libgit2.jl ├── libgit2 │ ├── invalid │ ├── invalid.pub │ ├── valid │ ├── valid-passphrase │ ├── valid-passphrase.pub │ └── valid.pub ├── linalg │ ├── arnoldi.jl │ ├── bidiag.jl │ ├── blas.jl │ ├── bunchkaufman.jl │ ├── cholesky.jl │ ├── conjarray.jl │ ├── dense.jl │ ├── diagonal.jl │ ├── eigen.jl │ ├── generic.jl │ ├── givens.jl │ ├── hessenberg.jl │ ├── lapack.jl │ ├── lq.jl │ ├── lu.jl │ ├── matmul.jl │ ├── pinv.jl │ ├── qr.jl │ ├── rowvector.jl │ ├── schur.jl │ ├── special.jl │ ├── svd.jl │ ├── symmetric.jl │ ├── triangular.jl │ ├── tridiag.jl │ └── uniformscaling.jl ├── lineedit.jl ├── llvmcall.jl ├── llvmcall2.jl ├── llvmpasses │ ├── Makefile │ ├── gcroots.ll │ ├── lit.cfg │ ├── lower-handlers.ll │ ├── muladd.ll │ ├── propagate-addrspace.ll │ ├── refinements.ll │ ├── returnstwicegc.ll │ ├── safepoint_stress.jl │ └── simdloop.ll ├── loading.jl ├── markdown.jl ├── math.jl ├── meta.jl ├── misc.jl ├── mmap.jl ├── mod2pi.jl ├── mpfr.jl ├── netload │ ├── memtest.jl │ └── nettest.jl ├── nullable.jl ├── numbers.jl ├── offsetarray.jl ├── operators.jl ├── osutils.jl ├── parse.jl ├── path.jl ├── perf │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── array │ │ ├── indexing.jl │ │ └── perf.jl │ ├── blas │ │ ├── level1.jl │ │ ├── level2.jl │ │ ├── level3.jl │ │ └── perf.jl │ ├── cat │ │ └── perf.jl │ ├── kernel │ │ ├── .gitattributes │ │ ├── actor_centrality.jl │ │ ├── bench_eu.jl │ │ ├── bench_eu.m │ │ ├── getdivgrad.jl │ │ ├── gk.jl │ │ ├── gk.m │ │ ├── go_benchmark.c │ │ ├── go_benchmark.jl │ │ ├── imdb-1.tsv │ │ ├── indexing.jl │ │ ├── json.jl │ │ ├── laplace.jl │ │ ├── laplace │ │ │ ├── c_laplace.c │ │ │ ├── c_laplace_parallel_update.c │ │ │ ├── c_laplace_parallel_update_pointer.c │ │ │ ├── cilk_laplace.c │ │ │ ├── for_laplace.f90 │ │ │ ├── laplace.m │ │ │ ├── laplace2.py │ │ │ ├── laplace_for_update1.f90 │ │ │ └── laplace_for_update2.f90 │ │ ├── perf.jl │ │ ├── raytracer.jl │ │ ├── simplex.jl │ │ ├── stockcorr.jl │ │ ├── stockcorr.m │ │ └── ziggurat.jl │ ├── lapack │ │ ├── eig.jl │ │ ├── factorizations.jl │ │ └── perf.jl │ ├── micro │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── benchmarks │ │ │ └── .gitignore │ │ ├── bin │ │ │ ├── .gitignore │ │ │ ├── collect.pl │ │ │ └── table.pl │ │ ├── java │ │ │ ├── .gitignore │ │ │ ├── pom.xml │ │ │ ├── setup.sh │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ ├── Complex.java │ │ │ │ ├── PerfBLAS.java │ │ │ │ └── PerfPure.java │ │ ├── perf.R │ │ ├── perf.c │ │ ├── perf.do │ │ ├── perf.f90 │ │ ├── perf.go │ │ ├── perf.jl │ │ ├── perf.js │ │ ├── perf.lua │ │ ├── perf.m │ │ ├── perf.nb │ │ ├── perf.py │ │ ├── randmtzig.c │ │ └── scala │ │ │ ├── .gitignore │ │ │ ├── build.sbt │ │ │ └── src │ │ │ └── main │ │ │ └── scala │ │ │ └── perf.scala │ ├── perfcomp.jl │ ├── perfgeneric.jl │ ├── perfutil.jl │ ├── report.jl │ ├── shootout │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── README.md │ │ ├── binary_trees.jl │ │ ├── fannkuch.jl │ │ ├── fasta.jl │ │ ├── k_nucleotide.jl │ │ ├── mandelbrot.jl │ │ ├── meteor_contest.jl │ │ ├── nbody.jl │ │ ├── nbody_vec.jl │ │ ├── perf.jl │ │ ├── pidigits.jl │ │ ├── regex_dna.jl │ │ ├── revcomp.jl │ │ └── spectralnorm.jl │ ├── simd │ │ ├── axpy.jl │ │ ├── inner.jl │ │ ├── perf.jl │ │ ├── seismic_fdtd.jl │ │ └── sum_reduce.jl │ ├── sort │ │ └── perf.jl │ ├── sparse │ │ ├── fem.jl │ │ ├── fem.m │ │ ├── getindex.jl │ │ ├── getindex_skinny.jl │ │ └── perf.jl │ ├── spell │ │ └── perf.jl │ └── threads │ │ ├── laplace3d │ │ ├── README │ │ ├── laplace3d.c │ │ ├── laplace3d.jl │ │ ├── laplace3d_devec.m │ │ └── laplace3d_vec.m │ │ ├── lbm3d │ │ ├── README │ │ ├── circshift.jl │ │ ├── lbm3d.jl │ │ └── lbm3d.m │ │ └── stockcorr │ │ ├── pstockcorr.jl │ │ ├── stockcorr_devec.m │ │ └── stockcorr_vec.m ├── pkg.jl ├── pollfd.jl ├── printf.jl ├── profile.jl ├── random.jl ├── ranges.jl ├── read.jl ├── reduce.jl ├── reducedim.jl ├── reflection.jl ├── regex.jl ├── repl.jl ├── replcompletions.jl ├── replutil.jl ├── resolve.jl ├── resolvedata1.jl ├── rounding.jl ├── runtests.jl ├── serialize.jl ├── sets.jl ├── show.jl ├── simdloop.jl ├── socket.jl ├── sorting.jl ├── sparse │ ├── cholmod.jl │ ├── higherorderfns.jl │ ├── sparse.jl │ ├── sparsevector.jl │ ├── spqr.jl │ └── umfpack.jl ├── spawn.jl ├── specificity.jl ├── stacktraces.jl ├── staged.jl ├── statistics.jl ├── strings │ ├── basic.jl │ ├── io.jl │ ├── search.jl │ ├── types.jl │ └── util.jl ├── subarray.jl ├── subtype.jl ├── sysinfo.jl ├── test.jl ├── test_exec.jl ├── test_sourcepath.jl ├── testdefs.jl ├── testenv.jl ├── threads.jl ├── topology.jl ├── triplequote.jl ├── tuple.jl ├── unicode │ ├── UnicodeError.jl │ ├── utf8.jl │ └── utf8proc.jl ├── util │ ├── segfault.jl │ └── throw_error_exception.jl ├── vecelement.jl ├── version.jl ├── workspace.jl └── worlds.jl └── ui ├── .gitignore ├── Makefile └── repl.c /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | If you have a question or are unsure if the behavior you're experiencing is a bug, 2 | please search or post to our Discourse site: https://discourse.julialang.org. We use 3 | the GitHub issue tracker for bug reports and feature requests only. 4 | 5 | If you're submitting a bug report, be sure to include as much relevant information as 6 | possible, including a minimal reproducible example and the output of `versioninfo()`. 7 | If you're experiencing a problem with a particular package, open an issue on that 8 | package's repository instead. 9 | 10 | Thanks for contributing to the Julia project! 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /*.tar.gz 2 | /tmp 3 | /dist 4 | /dist-extras 5 | /julia 6 | /usr 7 | /usr-staging 8 | /Make.user 9 | /julia-* 10 | /source-dist.tmp 11 | /source-dist.tmp1 12 | 13 | *.exe 14 | *.dll 15 | *.dwo 16 | *.do 17 | *.o 18 | *.obj 19 | *.so 20 | *.dylib 21 | *.dSYM 22 | *.jl.cov 23 | *.jl.*.cov 24 | *.jl.mem 25 | *.ji 26 | 27 | .DS_Store 28 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.7.0-DEV 2 | -------------------------------------------------------------------------------- /base/.gitignore: -------------------------------------------------------------------------------- 1 | /pcre_h.jl 2 | /errno_h.jl 3 | /build_h.jl 4 | /file_constants.jl 5 | /uv_constants.jl 6 | /version_git.jl 7 | /version_git.jl.phony 8 | /userimg.jl 9 | -------------------------------------------------------------------------------- /base/coreio.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | show(x) = show(STDOUT::IO, x) 4 | print(xs...) = print(STDOUT::IO, xs...) 5 | println(xs...) = println(STDOUT::IO, xs...) 6 | println(io::IO) = print(io, '\n') 7 | 8 | struct DevNullStream <: IO end 9 | const DevNull = DevNullStream() 10 | isreadable(::DevNullStream) = false 11 | iswritable(::DevNullStream) = true 12 | isopen(::DevNullStream) = true 13 | read(::DevNullStream, ::Type{UInt8}) = throw(EOFError()) 14 | write(::DevNullStream, ::UInt8) = 1 15 | unsafe_write(::DevNullStream, ::Ptr{UInt8}, n::UInt)::Int = n 16 | close(::DevNullStream) = nothing 17 | flush(::DevNullStream) = nothing 18 | wait_connected(::DevNullStream) = nothing 19 | wait_readnb(::DevNullStream) = wait() 20 | wait_readbyte(::DevNullStream) = wait() 21 | wait_close(::DevNullStream) = wait() 22 | eof(::DevNullStream) = true 23 | 24 | let CoreIO = Union{Core.CoreSTDOUT, Core.CoreSTDERR} 25 | global write, unsafe_write 26 | write(io::CoreIO, x::UInt8) = Core.write(io, x) 27 | unsafe_write(io::CoreIO, x::Ptr{UInt8}, nb::UInt) = Core.unsafe_write(io, x, nb) 28 | end 29 | 30 | STDIN = DevNull 31 | STDOUT = Core.STDOUT 32 | STDERR = Core.STDERR 33 | -------------------------------------------------------------------------------- /base/docs/bindings.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | export @var 4 | 5 | struct Binding 6 | mod::Module 7 | var::Symbol 8 | 9 | function Binding(m::Module, v::Symbol) 10 | # Normalise the binding module for module symbols so that: 11 | # Binding(Base, :Base) === Binding(Main, :Base) 12 | m = module_name(m) === v ? module_parent(m) : m 13 | new(Base.binding_module(m, v), v) 14 | end 15 | end 16 | 17 | bindingexpr(x) = Expr(:call, Binding, splitexpr(x)...) 18 | 19 | defined(b::Binding) = isdefined(b.mod, b.var) 20 | resolve(b::Binding) = getfield(b.mod, b.var) 21 | 22 | function splitexpr(x::Expr) 23 | isexpr(x, :macrocall) ? splitexpr(x.args[1]) : 24 | isexpr(x, :.) ? (x.args[1], x.args[2]) : 25 | error("Invalid @var syntax `$x`.") 26 | end 27 | splitexpr(s::Symbol) = Expr(:macrocall, getfield(Base, Symbol("@__MODULE__")), nothing), quot(s) 28 | splitexpr(other) = error("Invalid @var syntax `$other`.") 29 | 30 | macro var(x) 31 | esc(bindingexpr(x)) 32 | end 33 | 34 | function Base.show(io::IO, b::Binding) 35 | if b.mod === Main 36 | print(io, b.var) 37 | else 38 | print(io, b.mod, '.', Base.isoperator(b.var) ? ":" : "", b.var) 39 | end 40 | end 41 | 42 | aliasof(b::Binding) = defined(b) ? (a = aliasof(resolve(b), b); defined(a) ? a : b) : b 43 | aliasof(d::DataType, b) = Binding(d.name.module, d.name.name) 44 | aliasof(λ::Function, b) = (m = typeof(λ).name.mt; Binding(m.module, m.name)) 45 | aliasof(m::Module, b) = Binding(m, module_name(m)) 46 | aliasof(other, b) = b 47 | -------------------------------------------------------------------------------- /base/docs/core.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | module CoreDocs 4 | 5 | import ..esc, ..push!, ..getindex, ..unsafe_load, ..Csize_t 6 | 7 | function doc!(source::LineNumberNode, mod::Module, str, ex) 8 | push!(DOCS, (mod, ex, str, source.file, source.line)) 9 | end 10 | const DOCS = Array{Any, 1}() 11 | 12 | isexpr(x, h) = isa(x, Expr) && x.head === h 13 | 14 | lazy_iterpolate(s::AbstractString) = Expr(:call, Core.svec, s) 15 | lazy_iterpolate(x) = isexpr(x, :string) ? Expr(:call, Core.svec, x.args...) : x 16 | 17 | function docm(source::LineNumberNode, mod::Module, str, x) 18 | out = esc(Expr(:call, doc!, QuoteNode(source), mod, lazy_iterpolate(str), Expr(:quote, x))) 19 | isexpr(x, :module) ? Expr(:toplevel, out, esc(x)) : 20 | isexpr(x, :call) ? out : Expr(:block, esc(x), out) 21 | end 22 | docm(source::LineNumberNode, mod::Module, x) = 23 | isexpr(x, :->) ? docm(source, mod, x.args[1], x.args[2].args[2]) : error("invalid '@doc'.") 24 | 25 | end 26 | -------------------------------------------------------------------------------- /base/docs/helpdb.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include(joinpath("helpdb", "Base.jl")) 4 | -------------------------------------------------------------------------------- /base/i18n.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | module I18n 4 | 5 | export locale 6 | 7 | LOCALE = nothing 8 | CALLBACKS = Function[] 9 | 10 | function locale() 11 | if LOCALE === nothing 12 | # XXX:TBD return default locale 13 | return "" 14 | end 15 | LOCALE 16 | end 17 | 18 | function locale(s::String) 19 | global LOCALE = s 20 | # XXX:TBD call setlocale 21 | for cb in CALLBACKS 22 | cb() 23 | end 24 | end 25 | 26 | end # module 27 | -------------------------------------------------------------------------------- /base/libgit2/blame.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function GitBlame(repo::GitRepo, path::AbstractString; options::BlameOptions=BlameOptions()) 4 | blame_ptr_ptr = Ref{Ptr{Void}}(C_NULL) 5 | @check ccall((:git_blame_file, :libgit2), Cint, 6 | (Ptr{Ptr{Void}}, Ptr{Void}, Cstring, Ptr{BlameOptions}), 7 | blame_ptr_ptr, repo.ptr, path, Ref(options)) 8 | return GitBlame(repo, blame_ptr_ptr[]) 9 | end 10 | 11 | function counthunks(blame::GitBlame) 12 | return ccall((:git_blame_get_hunk_count, :libgit2), Int32, (Ptr{Void},), blame.ptr) 13 | end 14 | 15 | function Base.getindex(blame::GitBlame, i::Integer) 16 | if !(1 <= i <= counthunks(blame)) 17 | throw(BoundsError(blame, (i,))) 18 | end 19 | hunk_ptr = ccall((:git_blame_get_hunk_byindex, :libgit2), 20 | Ptr{BlameHunk}, 21 | (Ptr{Void}, Csize_t), blame.ptr, i-1) 22 | return unsafe_load(hunk_ptr) 23 | end 24 | 25 | function Base.show(io::IO, blame_hunk::BlameHunk) 26 | println(io, "GitBlameHunk:") 27 | println(io, "Original path: ", unsafe_string(blame_hunk.orig_path)) 28 | println(io, "Lines in hunk: ", blame_hunk.lines_in_hunk) 29 | println(io, "Final commit oid: ", blame_hunk.final_commit_id) 30 | print(io, "Final signature: ") 31 | show(io, Signature(blame_hunk.final_signature)) 32 | println(io) 33 | println(io, "Original commit oid: ", blame_hunk.orig_commit_id) 34 | print(io, "Original signature: ") 35 | show(io, Signature(blame_hunk.orig_signature)) 36 | end 37 | -------------------------------------------------------------------------------- /base/libgit2/strarray.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | 4 | function Base.cconvert(::Type{Ptr{StrArrayStruct}}, x::Vector) 5 | str_ref = Base.cconvert(Ref{Cstring}, x) 6 | sa_ref = Ref(StrArrayStruct(Base.unsafe_convert(Ref{Cstring}, str_ref), length(x))) 7 | sa_ref, str_ref 8 | end 9 | function Base.unsafe_convert(::Type{Ptr{StrArrayStruct}}, rr::Tuple{Ref{StrArrayStruct}, Ref{Cstring}}) 10 | Base.unsafe_convert(Ptr{StrArrayStruct}, first(rr)) 11 | end 12 | 13 | function Base.convert(::Type{Vector{String}}, sa::StrArrayStruct) 14 | [unsafe_string(unsafe_load(sa.strings, i)) for i = 1:sa.count] 15 | end 16 | -------------------------------------------------------------------------------- /base/linalg/exceptions.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | export LAPACKException, 4 | ARPACKException, 5 | SingularException, 6 | PosDefException, 7 | RankDeficientException 8 | 9 | struct LAPACKException <: Exception 10 | info::BlasInt 11 | end 12 | 13 | struct ARPACKException <: Exception 14 | info::String 15 | end 16 | 17 | function ARPACKException(i::Integer) 18 | if i == -8 19 | return ARPACKException("error return from calculation of a real Schur form.") 20 | elseif i == -9 21 | return ARPACKException("error return from calculation of eigenvectors.") 22 | elseif i == -14 23 | return ARPACKException("did not find any eigenvalues to sufficient accuracy. Try with a different starting vector or more Lanczos vectors by increasing the value of ncv.") 24 | end 25 | return ARPACKException("unspecified ARPACK error: $i") 26 | end 27 | 28 | struct SingularException <: Exception 29 | info::BlasInt 30 | end 31 | 32 | struct PosDefException <: Exception 33 | info::BlasInt 34 | end 35 | 36 | struct RankDeficientException <: Exception 37 | info::BlasInt 38 | end 39 | -------------------------------------------------------------------------------- /base/markdown/Common/Common.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("block.jl") 4 | include("inline.jl") 5 | 6 | @flavor common [list, indentcode, blockquote, admonition, footnote, hashheader, horizontalrule, 7 | paragraph, 8 | 9 | linebreak, escapes, inline_code, 10 | asterisk_bold, asterisk_italic, image, footnote_link, link, autolink] 11 | 12 | -------------------------------------------------------------------------------- /base/markdown/IPython/IPython.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | mutable struct LaTeX 4 | formula::String 5 | end 6 | 7 | @trigger '$' -> 8 | function tex(stream::IO, md::MD) 9 | result = parse_inline_wrapper(stream, "\$", rep = true) 10 | return result === nothing ? nothing : LaTeX(result) 11 | end 12 | 13 | function blocktex(stream::IO, md::MD) 14 | withstream(stream) do 15 | ex = tex(stream, md) 16 | if ex ≡ nothing 17 | return false 18 | else 19 | push!(md, ex) 20 | return true 21 | end 22 | end 23 | end 24 | 25 | show(io::IO, tex::LaTeX) = 26 | print(io, '$', tex.formula, '$') 27 | 28 | latex(io::IO, tex::LaTeX) = 29 | println(io, "\$\$", tex.formula, "\$\$") 30 | 31 | latexinline(io::IO, tex::LaTeX) = 32 | print(io, '$', tex.formula, '$') 33 | 34 | term(io::IO, tex::LaTeX, cols) = println_with_format(:magenta, io, tex.formula) 35 | terminline(io::IO, tex::LaTeX) = print_with_format(:magenta, io, tex.formula) 36 | -------------------------------------------------------------------------------- /base/markdown/Julia/Julia.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # This file contains markdown extensions designed to make documenting 4 | # Julia easy peasy. 5 | # 6 | # We start by borrowing GitHub's `fencedcode` extension – more to follow. 7 | 8 | include("interp.jl") 9 | 10 | @flavor julia [blocktex, blockinterp, hashheader, list, indentcode, fencedcode, 11 | blockquote, admonition, footnote, github_table, horizontalrule, setextheader, paragraph, 12 | 13 | linebreak, escapes, tex, interp, en_dash, inline_code, 14 | asterisk_bold, asterisk_italic, image, footnote_link, link, autolink] 15 | 16 | -------------------------------------------------------------------------------- /base/markdown/Julia/interp.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function Base.parse(stream::IO; greedy::Bool = true, raise::Bool = true) 4 | pos = position(stream) 5 | ex, Δ = Base.parse(read(stream, String), 1, greedy = greedy, raise = raise) 6 | seek(stream, pos + Δ - 1) 7 | return ex 8 | end 9 | 10 | function interpinner(stream::IO, greedy = false) 11 | startswith(stream, '$') || return 12 | (eof(stream) || Char(peek(stream)) in whitespace) && return 13 | try 14 | return Base.parse(stream::IOBuffer, greedy = greedy) 15 | catch e 16 | return 17 | end 18 | end 19 | 20 | @trigger '$' -> 21 | function interp(stream::IO, md::MD) 22 | withstream(stream) do 23 | ex = interpinner(stream) 24 | return ex 25 | end 26 | end 27 | 28 | function blockinterp(stream::IO, md::MD) 29 | withstream(stream) do 30 | ex = interpinner(stream) 31 | if ex ≡ nothing 32 | return false 33 | else 34 | push!(md, ex) 35 | return true 36 | end 37 | end 38 | end 39 | 40 | toexpr(x) = x 41 | 42 | toexpr(xs::Vector{Any}) = Expr(:call, GlobalRef(Base,:vector_any), map(toexpr, xs)...) 43 | 44 | for T in Any[MD, Paragraph, Header, Link, Bold, Italic] 45 | @eval function toexpr(md::$T) 46 | Expr(:call, typeof(md), $(map(x->:(toexpr(md.$x)), fieldnames(Base.unwrap_unionall(T)))...)) 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /base/markdown/render/rich.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function tohtml(io::IO, m::MIME"text/html", x) 4 | show(io, m, x) 5 | end 6 | 7 | function tohtml(io::IO, m::MIME"text/plain", x) 8 | htmlesc(io, sprint(show, m, x)) 9 | end 10 | 11 | function tohtml(io::IO, m::MIME"image/png", img) 12 | print(io, """") 15 | end 16 | 17 | function tohtml(m::MIME"image/svg+xml", img) 18 | show(io, m, img) 19 | end 20 | 21 | # Display infrastructure 22 | 23 | function bestmime(val) 24 | for mime in ("text/html", "image/svg+xml", "image/png", "text/plain") 25 | mimewritable(mime, val) && return MIME(Symbol(mime)) 26 | end 27 | error("Cannot render $val to Markdown.") 28 | end 29 | 30 | tohtml(io::IO, x) = tohtml(io, bestmime(x), x) 31 | -------------------------------------------------------------------------------- /base/meta.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | module Meta 4 | # 5 | # convenience functions for metaprogramming 6 | # 7 | 8 | export quot, 9 | isexpr, 10 | show_sexpr 11 | 12 | quot(ex) = Expr(:quote, ex) 13 | 14 | isexpr(ex::Expr, head) = ex.head === head 15 | isexpr(ex::Expr, heads::Union{Set,Vector,Tuple}) = in(ex.head, heads) 16 | isexpr(ex, head) = false 17 | 18 | isexpr(ex, head, n::Int) = isexpr(ex, head) && length(ex.args) == n 19 | 20 | 21 | # ---- show_sexpr: print an AST as an S-expression ---- 22 | 23 | show_sexpr(ex) = show_sexpr(STDOUT, ex) 24 | show_sexpr(io::IO, ex) = show_sexpr(io, ex, 0) 25 | show_sexpr(io::IO, ex, indent::Int) = show(io, ex) 26 | 27 | const sexpr_indent_width = 2 28 | 29 | function show_sexpr(io::IO, ex::QuoteNode, indent::Int) 30 | inner = indent + sexpr_indent_width 31 | print(io, "(:quote, #QuoteNode\n", " "^inner) 32 | show_sexpr(io, ex.value, inner) 33 | print(io, '\n', " "^indent, ')') 34 | end 35 | function show_sexpr(io::IO, ex::Expr, indent::Int) 36 | inner = indent + sexpr_indent_width 37 | print(io, '(') 38 | show_sexpr(io, ex.head, inner) 39 | for arg in ex.args 40 | print(io, ex.head === :block ? ",\n"*" "^inner : ", ") 41 | show_sexpr(io, arg, inner) 42 | end 43 | if isempty(ex.args); print(io, ",)") 44 | else print(io, (ex.head === :block ? "\n"*" "^indent : ""), ')') 45 | end 46 | end 47 | 48 | end # module 49 | -------------------------------------------------------------------------------- /base/nofloat_hashing.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | ## hashing small, built-in numeric types 4 | ## for a system image built without floating point support 5 | 6 | hx(a::UInt64, b::UInt64, h::UInt) = hash_uint64(3a + b - h) 7 | 8 | hash(x::UInt64, h::UInt) = hx(x, x, h) 9 | hash(x::Int64, h::UInt) = hx(reinterpret(UInt64,abs(x)), reinterpret(UInt64,x), h) 10 | hash(x::Union{Bool,Char,Int8,UInt8,Int16,UInt16,Int32,UInt32}, h::UInt) = hash(Int64(x), h) 11 | -------------------------------------------------------------------------------- /base/osutils.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | """ 4 | @static 5 | 6 | Partially evaluate an expression at parse time. 7 | 8 | For example, `@static Sys.iswindows() ? foo : bar` will evaluate `Sys.iswindows()` and insert 9 | either `foo` or `bar` into the expression. 10 | This is useful in cases where a construct would be invalid on other platforms, 11 | such as a `ccall` to a non-existent function. 12 | `@static if Sys.isapple() foo end` and `@static foo <&&,||> bar` are also valid syntax. 13 | """ 14 | macro static(ex) 15 | if isa(ex, Expr) 16 | if ex.head === :if || ex.head === :&& || ex.head === :|| 17 | cond = eval(__module__, ex.args[1]) 18 | if xor(cond, ex.head === :||) 19 | return esc(ex.args[2]) 20 | elseif length(ex.args) == 3 21 | return esc(ex.args[3]) 22 | elseif ex.head === :if 23 | return nothing 24 | else 25 | return cond 26 | end 27 | end 28 | end 29 | throw(ArgumentError("invalid @static macro")) 30 | end 31 | -------------------------------------------------------------------------------- /base/pair.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | struct Pair{A,B} 4 | first::A 5 | second::B 6 | end 7 | 8 | const => = Pair 9 | 10 | start(p::Pair) = 1 11 | done(p::Pair, i) = i>2 12 | next(p::Pair, i) = (getfield(p,i), i+1) 13 | eltype(p::Pair{A,B}) where {A,B} = Union{A,B} 14 | 15 | indexed_next(p::Pair, i::Int, state) = (getfield(p,i), i+1) 16 | 17 | hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, h)) 18 | 19 | ==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second) 20 | isequal(p::Pair, q::Pair) = isequal(p.first,q.first) & isequal(p.second,q.second) 21 | 22 | isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first), 23 | isless(p.second,q.second)) 24 | getindex(p::Pair,i::Int) = getfield(p,i) 25 | getindex(p::Pair,i::Real) = getfield(p, convert(Int, i)) 26 | reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first) 27 | 28 | endof(p::Pair) = 2 29 | length(p::Pair) = 2 30 | first(p::Pair) = p.first 31 | last(p::Pair) = p.second 32 | 33 | convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x 34 | function convert(::Type{Pair{A,B}}, x::Pair) where {A,B} 35 | Pair{A,B}(convert(A, x[1]), convert(B, x[2])) 36 | end 37 | 38 | promote_rule(::Type{Pair{A1,B1}}, ::Type{Pair{A2,B2}}) where {A1,B1,A2,B2} = 39 | Pair{promote_type(A1, A2), promote_type(B1, B2)} 40 | -------------------------------------------------------------------------------- /base/sparse/abstractsparse.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | abstract type AbstractSparseArray{Tv,Ti,N} <: AbstractArray{Tv,N} end 4 | 5 | const AbstractSparseVector{Tv,Ti} = AbstractSparseArray{Tv,Ti,1} 6 | const AbstractSparseMatrix{Tv,Ti} = AbstractSparseArray{Tv,Ti,2} 7 | 8 | """ 9 | issparse(S) 10 | 11 | Returns `true` if `S` is sparse, and `false` otherwise. 12 | """ 13 | issparse(A::AbstractArray) = false 14 | issparse(S::AbstractSparseArray) = true 15 | 16 | issparse(S::Symmetric{<:Any,<:AbstractSparseMatrix}) = true 17 | issparse(S::Hermitian{<:Any,<:AbstractSparseMatrix}) = true 18 | issparse(S::LowerTriangular{<:Any,<:AbstractSparseMatrix}) = true 19 | issparse(S::LinAlg.UnitLowerTriangular{<:Any,<:AbstractSparseMatrix}) = true 20 | issparse(S::UpperTriangular{<:Any,<:AbstractSparseMatrix}) = true 21 | issparse(S::LinAlg.UnitUpperTriangular{<:Any,<:AbstractSparseMatrix}) = true 22 | 23 | indtype(S::AbstractSparseArray{<:Any,Ti}) where {Ti} = Ti 24 | -------------------------------------------------------------------------------- /base/strings/errors.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | ## Error messages for Unicode / UTF support 4 | 5 | const UTF_ERR_SHORT = "invalid UTF-8 sequence starting at index <<1>> (0x<<2>> missing one or more continuation bytes)" 6 | const UTF_ERR_INVALID_INDEX = "invalid character index" 7 | 8 | mutable struct UnicodeError <: Exception 9 | errmsg::AbstractString ##< A UTF_ERR_ message 10 | errpos::Int32 ##< Position of invalid character 11 | errchr::UInt32 ##< Invalid character 12 | end 13 | 14 | show(io::IO, exc::UnicodeError) = print(io, replace(replace(string("UnicodeError: ",exc.errmsg), 15 | "<<1>>",string(exc.errpos)),"<<2>>",hex(exc.errchr))) 16 | -------------------------------------------------------------------------------- /base/strings/strings.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("strings/errors.jl") 4 | include("strings/types.jl") 5 | include("strings/basic.jl") 6 | include("strings/search.jl") 7 | include("strings/util.jl") 8 | include("strings/io.jl") 9 | include("strings/utf8proc.jl") 10 | importall .UTF8proc 11 | -------------------------------------------------------------------------------- /base/threads.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | module Threads 4 | 5 | include("threadingconstructs.jl") 6 | include("atomics.jl") 7 | include("locks.jl") 8 | 9 | end 10 | -------------------------------------------------------------------------------- /base/traits.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | ## numeric/object traits 4 | # trait for objects that have an ordering 5 | abstract type TypeOrder end 6 | struct HasOrder <: TypeOrder end 7 | struct Unordered <: TypeOrder end 8 | 9 | TypeOrder(instance) = TypeOrder(typeof(instance)) 10 | TypeOrder(::Type{<:Real}) = HasOrder() 11 | TypeOrder(::Type{<:Any}) = Unordered() 12 | 13 | # trait for objects that support arithmetic 14 | abstract type TypeArithmetic end 15 | struct ArithmeticRounds <: TypeArithmetic end # least significant bits can be lost 16 | struct ArithmeticOverflows <: TypeArithmetic end # most significant bits can be lost 17 | struct ArithmeticUnknown <: TypeArithmetic end 18 | 19 | TypeArithmetic(instance) = TypeArithmetic(typeof(instance)) 20 | TypeArithmetic(::Type{<:AbstractFloat}) = ArithmeticRounds() 21 | TypeArithmetic(::Type{<:Integer}) = ArithmeticOverflows() 22 | TypeArithmetic(::Type{<:Any}) = ArithmeticUnknown() 23 | -------------------------------------------------------------------------------- /contrib/README.ackrc.txt: -------------------------------------------------------------------------------- 1 | The 'ackrc' file is for Ack (http://beyondgrep.com/) 2 | Place its contents in your ~/.ackrc file. 3 | -------------------------------------------------------------------------------- /contrib/README.ctags.txt: -------------------------------------------------------------------------------- 1 | The 'ctags' file is for Exuberant CTags (http://ctags.sourceforge.net/) 2 | Place its contents in your ~/.ctags file. 3 | -------------------------------------------------------------------------------- /contrib/ackrc: -------------------------------------------------------------------------------- 1 | --type-set=julia=.jl 2 | --type-add=julia:firstlinematch:/^#!.*\bjulia/ 3 | -------------------------------------------------------------------------------- /contrib/check-whitespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # Check for trailing white space in source files; 5 | # report an error if so 6 | 7 | # Files to check: 8 | set -f # disable glob expansion in this script 9 | file_patterns=' 10 | *.1 11 | *.c 12 | *.cpp 13 | *.h 14 | *.jl 15 | *.lsp 16 | *.scm 17 | *.inc 18 | *.make 19 | *.mk 20 | *.md 21 | *.rst 22 | *.sh 23 | *.yml 24 | *Makefile 25 | ' 26 | 27 | # TODO: Look also for trailing empty lines, and missing '\n' after the last line 28 | if git --no-pager grep --color -n --full-name -e ' $' -- $file_patterns; then 29 | echo "Error: trailing whitespace found in source file(s)" 30 | echo "" 31 | echo "This can often be fixed with:" 32 | echo " git rebase --whitespace=fix HEAD~1" 33 | echo "or" 34 | echo " git rebase --whitespace=fix master" 35 | echo "and then a forced push of the correct branch" 36 | exit 1 37 | fi 38 | -------------------------------------------------------------------------------- /contrib/commit-name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # Needs to be run from a julia repo clone 5 | # First argument (optional) is a ref to the commit 6 | 7 | gitref=${1:-HEAD} 8 | 9 | ver=$(git show "$gitref:VERSION") 10 | major=$(echo $ver | cut -f 1 -d .) 11 | minor=$(echo $ver | cut -f 2 -d .) 12 | 13 | if [ $major = 0 -a $minor -lt 5 ]; then 14 | # use tag based build number prior to 0.5.0- 15 | last_tag=$(git describe --tags --abbrev=0 "$gitref") 16 | nb=$(git rev-list --count "$gitref" "^$last_tag") 17 | if [ $nb = 0 ]; then 18 | echo $ver 19 | else 20 | echo "$ver+$nb" 21 | fi 22 | else 23 | topdir=$(git rev-parse --show-toplevel) 24 | verchanged=$(git blame -L ,1 -sl $gitref -- "$topdir/VERSION" | cut -f 1 -d " ") 25 | nb=$(git rev-list --count "$gitref" "^$verchanged") 26 | pre=$(echo $ver | cut -s -f 2 -d "-") 27 | if [ $ver = "0.5.0-dev" ]; then 28 | # bump to 0.5.0-dev was one commit after tag during 0.5.0-dev 29 | nb=$(expr $nb + 1) 30 | elif [ $ver = "0.5.0-pre" ]; then 31 | # bump to 0.5.0-pre was 5578 commits after tag 32 | nb=$(expr $nb + 5578) 33 | fi 34 | if [ -n "$pre" ]; then 35 | if [ $major = 0 -a $minor -le 5 ]; then 36 | echo "$ver+$nb" 37 | else 38 | echo "$ver.$nb" 39 | fi 40 | else 41 | echo $ver 42 | fi 43 | fi 44 | -------------------------------------------------------------------------------- /contrib/ctags: -------------------------------------------------------------------------------- 1 | --langdef=julia 2 | --langmap=julia:.jl 3 | --regex-julia=/^[ \t]*(function|macro|abstract type|primitive type|struct|mutable struct|typealias)[ \t]+([^ \t({[]+).*$/\2/f,function/ 4 | --regex-julia=/^[ \t]*(([^@#$ \t({[]+)|\(([^@#$ \t({[]+)\)|\((\$)\))[ \t]*(\{.*\})?[ \t]*\([^#]*\)[ \t]*=([^=].*$|$)/\2\3\4/f,function/ 5 | -------------------------------------------------------------------------------- /contrib/debug_bootstrap.gdb: -------------------------------------------------------------------------------- 1 | file ../usr/bin/julia-debug 2 | r --build ../usr/lib/julia/sys0.bc sysimg.jl 3 | bt 4 | -------------------------------------------------------------------------------- /contrib/filterArgs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # Loop over all command line arguments 5 | for i in "$@"; do 6 | # If an argument starts with -L, echo it out sans -L! 7 | case $i in 8 | -L*) printf '"%s"\n' "${i#-L}" ;; 9 | esac 10 | done 11 | -------------------------------------------------------------------------------- /contrib/fixup-libstdc++.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # Run as: fixup-libstdc++.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "Usage: $0 " 8 | exit 1 9 | fi 10 | 11 | libdir="$1" 12 | private_libdir="$2" 13 | 14 | if [ ! -f "$libdir/libjulia.so" ]; then 15 | echo "ERROR: Could not open $libdir/libjulia.so" >&2 16 | exit 2 17 | fi 18 | 19 | find_shlib () 20 | { 21 | if [ -f "$1" ]; then 22 | ldd "$1" | grep $2 | cut -d' ' -f3 | xargs 23 | fi 24 | } 25 | 26 | # Discover libstdc++ location and name 27 | LIBSTD=$(find_shlib "$libdir/libjulia.so" "libstdc++.so") 28 | LIBSTD_NAME=$(basename $LIBSTD) 29 | LIBSTD_DIR=$(dirname $LIBSTD) 30 | 31 | if [ ! -f "$private_libdir/$LIBSTD_NAME" ] && [ -f "$LIBSTD_DIR/$LIBSTD_NAME" ]; then 32 | cp -v "$LIBSTD_DIR/$LIBSTD_NAME" "$private_libdir" 33 | chmod 755 "$private_libdir/$LIBSTD_NAME" 34 | fi 35 | -------------------------------------------------------------------------------- /contrib/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # Usage: very similar to `install` 5 | # install.sh 755 src1 src2 ... dest 6 | 7 | PERMS=$1 8 | shift 9 | 10 | ARGS="" 11 | while [ $# -gt 1 ]; do 12 | ARGS="$ARGS $1" 13 | shift 14 | done 15 | DEST=$1 16 | 17 | for SRC in $ARGS; do 18 | cp -a $SRC $DEST 19 | 20 | if [ -d "$DEST" ]; then 21 | DESTFILE="$DEST/$(basename "$SRC")" 22 | else 23 | DESTFILE="$DEST" 24 | fi 25 | 26 | # Do the chmod dance, and ignore errors on platforms that don't like setting permissions of symlinks 27 | # TODO: Test if it's a symlink instead of having to redirect stderr to /dev/null 28 | chmod $PERMS $DESTFILE 2>/dev/null 29 | done 30 | 31 | exit 0 32 | -------------------------------------------------------------------------------- /contrib/julia.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | julia.desktop 5 | CC-BY-SA-3.0 6 | MIT and LGPL-2.1+ and GPL-2.0+ 7 | 8 |

9 | Julia is a high-level, high-performance dynamic programming language for 10 | technical computing, with syntax that is familiar to users of other 11 | technical computing environments. It provides a sophisticated compiler, 12 | distributed parallel execution, numerical accuracy, and an extensive 13 | mathematical function library. 14 |

15 |

16 | The library, largely written in Julia itself, 17 | also integrates mature, best-of-breed C and Fortran libraries for linear 18 | algebra, random number generation, signal processing, and string processing. 19 | In addition, the Julia developer community is contributing a number of 20 | external packages through Julia’s built-in package manager at a rapid pace. 21 |

22 |
23 | 24 | https://julialang.org/images/julia-gnome.png 25 | 26 | https://julialang.org/ 27 | julia-dev@googlegroups.com 28 |
29 | -------------------------------------------------------------------------------- /contrib/julia.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Julia 3 | Comment=High-level, high-performance dynamic language for technical computing 4 | Exec=julia 5 | Icon=julia 6 | Terminal=true 7 | Type=Application 8 | Categories=Development;ComputerScience;Building;Science;Math;NumericalAnalysis;ParallelComputing;DataVisualization;ConsoleOnly; 9 | -------------------------------------------------------------------------------- /contrib/mac/app/.gitignore: -------------------------------------------------------------------------------- 1 | julia/ 2 | dmg/ 3 | *.dmg 4 | -------------------------------------------------------------------------------- /contrib/mac/app/README.md: -------------------------------------------------------------------------------- 1 | Julia OS X packaging 2 | ==================== 3 | 4 | This builds the Julia OS X application bundle (.app folder), and stores it in a disk image 5 | (.dmg file). 6 | 7 | The application bundle is actually just a bundled applet which opens Terminal.app and 8 | executes the julia binary (which opens the REPL). All the Julia binary files and their 9 | dependencies are bundled inside this. 10 | 11 | Run `make` to build. 12 | 13 | Other files in this directory 14 | 15 | * `startup.applescript` is the script which is compiled to the applet. 16 | * `julia.icns` is the Julia icon file. 17 | -------------------------------------------------------------------------------- /contrib/mac/app/julia.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/contrib/mac/app/julia.icns -------------------------------------------------------------------------------- /contrib/mac/app/startup.applescript: -------------------------------------------------------------------------------- 1 | set RootPath to POSIX path of (path to me) 2 | tell application id "com.apple.terminal" 3 | do script ("exec '" & RootPath & "Contents/Resources/julia/bin/julia'") 4 | activate 5 | end tell 6 | -------------------------------------------------------------------------------- /contrib/mac/juliarc.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Set up environment for Julia OSX binary distribution 4 | let 5 | ROOT = abspath(JULIA_HOME,"..") 6 | ENV["PATH"]="$JULIA_HOME:$(ENV["PATH"])" 7 | ENV["FONTCONFIG_PATH"] = joinpath(ROOT, "etc", "fonts") 8 | ENV["TK_LIBRARY"] = "/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts" 9 | end 10 | -------------------------------------------------------------------------------- /contrib/mac/mac-gtk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # This script will attempt to download and build GTK+-3, 5 | # including dependencies, in ~/gtk (also puts stuff in 6 | # ~/.local, ~/Source, ~/.jhbuildrc*) 7 | # While this should work, it may be preferable to execute 8 | # each line separately in the terminal 9 | 10 | curl -O https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh 11 | sh gtk-osx-build-setup.sh 12 | export PATH=$PATH:~/.local/bin/ 13 | sed -i -e 's/^setup_sdk/#setup_sdk/g' ~/.jhbuildrc-custom 14 | cat << EOF >> .jhbuildrc-custom 15 | setup_sdk(target=_target, sdk_version=_target, architectures=[_default_arch]) 16 | os.environ["DYLD_LIBRARY_PATH"] = "" 17 | build_policy = "updated-deps" 18 | modules = [ "meta-gtk-osx-bootstrap", 19 | "freetype", "fontconfig", 20 | "meta-gtk-osx-core", 21 | "meta-gtk-osx-themes", 22 | "gtk-quartz-engine" ] 23 | EOF 24 | 25 | jhbuild bootstrap --skip=libiconv --ignore-system 26 | jhbuild build 27 | 28 | cd ~/gtk/source 29 | curl -O http://ftp.gnome.org/pub/gnome/sources/gtk-mac-bundler/0.6/gtk-mac-bundler-0.6.1.tar.bz2 30 | tar jxvf gtk-mac-bundler-0.6.1.tar.bz2 31 | cd gtk-mac-bundler-0.6.1 32 | make install 33 | cd ~/gtk 34 | 35 | 36 | -------------------------------------------------------------------------------- /contrib/mac/macports.make: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # Any Makefile variable can be set, but the following are the typical defaults 4 | # required to build with a MacPorts installation 5 | 6 | PREFIX=/opt/local 7 | LLVM_CONFIG=${PREFIX}/bin/llvm-config-mp-3.2 8 | PCRE_CONFIG=${PREFIX}/bin/pcre-config 9 | CFLAGS='-02 -I${PREFIX}/include -I${PREFIX}/include/ufsparse' 10 | CXXFLAGS='-02' 11 | LDFLAGS='-L${PREFIX}/lib' 12 | CC=/usr/bin/llvm-gcc-4.2 13 | CXX=/usr/bin/llvm-g++-4.2 14 | CPP=/usr/bin/llvm-cpp-4.2 15 | FC=${PREFIX}/bin/gfortran-mp-4.5 16 | USEGCC=1 17 | USECLANG=0 18 | SUITESPARSE_VER_MAJOR=4 19 | JMAKEFLAGS = USE_SYSTEM_LLVM=1 LLVM_CONFIG=${LLVM_CONFIG} \ 20 | USE_SYSTEM_PCRE=1 PCRE_CONFIG=${PCRE_CONFIG} \ 21 | USE_SYSTEM_LIBM=1 \ 22 | USE_SYSTEM_OPENLIBM=0 \ 23 | USE_SYSTEM_BLAS=1 USE_BLAS64=0\ 24 | USE_SYSTEM_LAPACK=1 \ 25 | USE_SYSTEM_GMP=1 \ 26 | USE_SYSTEM_MPFR=1 \ 27 | USE_SYSTEM_ARPACK=1 \ 28 | USE_SYSTEM_SUITESPARSE=1 \ 29 | USE_SYSTEM_ZLIB=1 \ 30 | USE_SYSTEM_GRISU=0 \ 31 | USE_SYSTEM_LIBUV=0 \ 32 | PREFIX=${PREFIX} CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS} \ 33 | CC=${CC} CXX=${CXX} CPP=${CPP} FC=${FC} USEGCC=${USEGCC} USECLANG=${USECLANG} 34 | 35 | all: default 36 | ../../usr/lib/libspqr.dylib: 37 | $(MAKE) -C .. -f repackage_system_suitesparse${SUITESPARSE_VER_MAJOR}.make \ 38 | USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1 USE_BLAS64=0 \ 39 | CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS} 40 | 41 | default test release debug: ../../usr/lib/libspqr.dylib 42 | $(MAKE) -C ../.. $(JMAKEFLAGS) $@ 43 | 44 | .PHONY: all default test release debug 45 | -------------------------------------------------------------------------------- /contrib/relative_path.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | # both $1 and $2 are absolute paths beginning with / 5 | # returns relative path to $2/$target from $1/$source 6 | 7 | relpath () { 8 | [ $# -ge 1 ] && [ $# -le 2 ] || return 1 9 | current="${2:+"$1"}" 10 | target="${2:-"$1"}" 11 | [ "$target" != . ] || target=/ 12 | target="/${target##/}" 13 | [ "$current" != . ] || current=/ 14 | current="${current:="/"}" 15 | current="/${current##/}" 16 | appendix="${target##/}" 17 | relative='' 18 | while appendix="${target#"$current"/}" 19 | [ "$current" != '/' ] && [ "$appendix" = "$target" ]; do 20 | if [ "$current" = "$appendix" ]; then 21 | relative="${relative:-.}" 22 | echo "${relative#/}" 23 | return 0 24 | fi 25 | current="${current%/*}" 26 | relative="$relative${relative:+/}.." 27 | done 28 | relative="$relative${relative:+${appendix:+/}}${appendix#/}" 29 | echo "$relative" 30 | } 31 | relpath "$@" 32 | -------------------------------------------------------------------------------- /contrib/stringreplace.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main( int argc, char ** argv ) { 8 | if( argc < 5 ) { 9 | printf("Usage:\n"); 10 | printf(" %s \n", argv[0] ); 11 | return -1; 12 | } 13 | 14 | unsigned long offset = strtoul(argv[1], NULL, 16); 15 | char * replacement = argv[2]; 16 | unsigned long maxlen = strtoul(argv[3], NULL, 10); 17 | 18 | FILE * f = fopen( argv[4], "r+" ); 19 | if( !f ) { 20 | printf( "ERROR: Could not open %s for writing!\n", argv[4] ); 21 | return -1; 22 | } 23 | 24 | if( strlen(replacement) > maxlen ) { 25 | printf( "ERROR: Replacement string length (%lu) is greater than maxlen! (%lu)\n", strlen(replacement), maxlen ); 26 | return -1; 27 | } 28 | 29 | fseek( f, offset, SEEK_SET ); 30 | fwrite( replacement, strlen(replacement)+1, 1, f ); 31 | 32 | fclose( f ); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /contrib/travis_fastfail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | curlhdr="Accept: application/vnd.travis-ci.2+json" 5 | endpoint="https://api.travis-ci.org/repos/$TRAVIS_REPO_SLUG" 6 | 7 | # Fail fast for superseded builds to PR's 8 | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then 9 | newestbuildforthisPR=$(curl -H "$curlhdr" $endpoint/builds?event_type=pull_request | \ 10 | jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number") 11 | if [ $newestbuildforthisPR != null -a $newestbuildforthisPR != \"$TRAVIS_BUILD_NUMBER\" ]; then 12 | echo "There are newer queued builds for this pull request, failing early." 13 | exit 1 14 | fi 15 | else 16 | # And for non-latest push builds in branches other than master or release* 17 | case $TRAVIS_BRANCH in 18 | master | release*) 19 | ;; 20 | *) 21 | if [ \"$TRAVIS_BUILD_NUMBER\" != $(curl -H "$curlhdr" \ 22 | $endpoint/branches/$TRAVIS_BRANCH | jq ".branch.number") ]; then 23 | echo "There are newer queued builds for this branch, failing early." 24 | exit 1 25 | fi 26 | ;; 27 | esac 28 | fi 29 | -------------------------------------------------------------------------------- /contrib/vagrant/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant 2 | -------------------------------------------------------------------------------- /contrib/valgrind-julia.supp: -------------------------------------------------------------------------------- 1 | # https://github.com/JuliaLang/julia/issues/4533 2 | { 3 | msync unwind 4 | Memcheck:Param 5 | msync(start) 6 | ... 7 | obj:*/libpthread*.so 8 | ... 9 | fun:rec_backtrace_ctx 10 | } 11 | -------------------------------------------------------------------------------- /contrib/windows/7zS.sfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/contrib/windows/7zS.sfx -------------------------------------------------------------------------------- /contrib/windows/7zSFX-config.txt: -------------------------------------------------------------------------------- 1 | ;!@Install@!UTF-8! 2 | Title="The Julia Language" 3 | RunProgram="julia-installer.exe" 4 | ;!@InstallEnd@! 5 | -------------------------------------------------------------------------------- /contrib/windows/7zSFX-manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /contrib/windows/install-cygwin.ps1: -------------------------------------------------------------------------------- 1 | $setup = "setup-$env:ARCH.exe".Replace("i686", "x86") 2 | 3 | mkdir -Force C:\cygdownloads | Out-Null 4 | (new-object net.webclient).DownloadFile( 5 | "http://cygwin.com/$setup", "C:\cygdownloads\$setup") 6 | & "C:\cygdownloads\$setup" -q -n -R C:\cygwin-$env:ARCH ` 7 | -l C:\cygdownloads -s http://mirrors.mit.edu/cygwin -g -I ` 8 | -P "make,curl,time,p7zip,mingw64-$env:ARCH-gcc-g++,mingw64-$env:ARCH-gcc-fortran" | Where-Object ` 9 | -FilterScript {$_ -notlike "Installing file *"} | Write-Output 10 | -------------------------------------------------------------------------------- /contrib/windows/julia-manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /contrib/windows/julia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/contrib/windows/julia.ico -------------------------------------------------------------------------------- /contrib/windows/julia.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 1 VERSIONINFO 4 | FILEVERSION JLVER 5 | PRODUCTVERSION JLVER 6 | /* 7 | FILEFLAGSMASK VS_FF_PRERELEASE 8 | FILEFLAGS VS_FF_PRERELEASE 9 | */ 10 | FILEOS VOS_DOS_WINDOWS32 11 | FILETYPE VFT_APP 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | BEGIN 17 | VALUE "CompanyName", "JuliaLang" 18 | VALUE "FileDescription", "Julia Programming Language" 19 | VALUE "FileVersion", JLVER_STR 20 | VALUE "InternalName", "julia" 21 | VALUE "LegalCopyright", "MIT Licensed" 22 | VALUE "OriginalFilename", "julia.exe" 23 | VALUE "ProductName", "Julia" 24 | VALUE "ProductVersion", JLVER_STR 25 | END 26 | END 27 | 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | /* US English, Unicode */ 31 | VALUE "Translation", 0x409, 1200 32 | END 33 | END 34 | 2 ICON "julia.ico" 35 | 1 RT_MANIFEST "julia-manifest.xml" 36 | -------------------------------------------------------------------------------- /contrib/windows/juliarc.jl: -------------------------------------------------------------------------------- 1 | # Set up environment for Julia Windows binary distribution 2 | ENV["PATH"] = JULIA_HOME*";"*ENV["PATH"] 3 | -------------------------------------------------------------------------------- /deps/.gitignore: -------------------------------------------------------------------------------- 1 | /srccache 2 | /build 3 | /scratch 4 | -------------------------------------------------------------------------------- /deps/NATIVE.cmake: -------------------------------------------------------------------------------- 1 | # native toolchain file to fix llvm cross-compilation finickiness 2 | # ref http://lists.llvm.org/pipermail/llvm-dev/2016-February/095366.html 3 | set(CMAKE_C_COMPILER cc) 4 | set(CMAKE_CXX_COMPILER c++) 5 | -------------------------------------------------------------------------------- /deps/SuiteSparse_wrapper.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern size_t jl_cholmod_common_size(void) { 5 | return sizeof(cholmod_common); 6 | } 7 | 8 | extern size_t jl_cholmod_sizeof_long(void) { 9 | return sizeof(SuiteSparse_long); 10 | } 11 | 12 | extern int jl_cholmod_version(int *ver) { 13 | if (ver != (int*) NULL) { 14 | ver[0] = CHOLMOD_MAIN_VERSION; 15 | ver[1] = CHOLMOD_SUB_VERSION; 16 | ver[2] = CHOLMOD_SUBSUB_VERSION; 17 | } 18 | return CHOLMOD_VERSION; 19 | } 20 | 21 | extern void jl_cholmod_common_offsets(size_t *vv) { 22 | vv[0] = offsetof(cholmod_common, dbound); 23 | vv[1] = offsetof(cholmod_common, maxrank); 24 | vv[2] = offsetof(cholmod_common, supernodal_switch); 25 | vv[3] = offsetof(cholmod_common, supernodal); 26 | vv[4] = offsetof(cholmod_common, final_asis); 27 | vv[5] = offsetof(cholmod_common, final_super); 28 | vv[6] = offsetof(cholmod_common, final_ll); 29 | vv[7] = offsetof(cholmod_common, final_pack); 30 | vv[8] = offsetof(cholmod_common, final_monotonic); 31 | vv[9] = offsetof(cholmod_common, final_resymbol); 32 | vv[10] = offsetof(cholmod_common, prefer_zomplex); 33 | vv[11] = offsetof(cholmod_common, prefer_upper); 34 | vv[12] = offsetof(cholmod_common, print); 35 | vv[13] = offsetof(cholmod_common, precise); 36 | vv[14] = offsetof(cholmod_common, nmethods); 37 | vv[15] = offsetof(cholmod_common, selected); 38 | vv[16] = offsetof(cholmod_common, postorder); 39 | vv[17] = offsetof(cholmod_common, itype); 40 | vv[18] = offsetof(cholmod_common, dtype); 41 | } 42 | -------------------------------------------------------------------------------- /deps/Versions.make: -------------------------------------------------------------------------------- 1 | LLVM_VER = 3.9.1 2 | PCRE_VER = 10.23 3 | DSFMT_VER = 2.2.3 4 | LAPACK_VER = 3.5.0 5 | ARPACK_VER = 3.3.0 6 | SUITESPARSE_VER = 4.4.5 7 | UNWIND_VER = 1.1-julia2 8 | OSXUNWIND_VER = 0.0.3 9 | GMP_VER = 6.1.2 10 | MPFR_VER = 3.1.5 11 | PATCHELF_VER = 0.9 12 | MBEDTLS_VER = 2.5.1 13 | CURL_VER = 7.54.1 14 | -------------------------------------------------------------------------------- /deps/checksums/SuiteSparse-4.4.5.tar.gz/md5: -------------------------------------------------------------------------------- 1 | a2926c27f8a5285e4a10265cc68bbc18 2 | -------------------------------------------------------------------------------- /deps/checksums/SuiteSparse-4.4.5.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 7f9c19c3c58f61e7d82cd2de25eeeec910ad3d6a5c7c79c62a23cbb7dc880cddeca6efa9860a87b3b3c05e74385c8c67bf61d44149b700ac094898237915a6d9 2 | -------------------------------------------------------------------------------- /deps/checksums/UnicodeData.txt/md5: -------------------------------------------------------------------------------- 1 | dde25b1cf9bbb4ba1140ac12e4128b0b 2 | -------------------------------------------------------------------------------- /deps/checksums/UnicodeData.txt/sha512: -------------------------------------------------------------------------------- 1 | 43eaf66d9cb3748012b2dfd77da1b41f667c5c7602a56bea8186b796b215bde82d555d79ab053378c2222521396354dcce5cf23a78fa3b1456062c47771c8433 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.3.0-testA.mtx/md5: -------------------------------------------------------------------------------- 1 | 2826846e98bcb009d339fb69973951d3 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.3.0-testA.mtx/sha512: -------------------------------------------------------------------------------- 1 | 00af7f2353441c4197c52d105d3670fe250a312b8e67ae2794246f2ce8cd0b63585e5c5ab764921d357efd9ad685fcc0ee5b8b8ee7ab9af2bea26ccbb97c50ba 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.3.0.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 343db685ebedbb9690e4ea5f9d62c19a 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.3.0.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 8d0e526831d62200af9d939e77e41548875caacdf39543c3f33a00321bb18fc04ffa625d9c4103f84c1f6a03a3c362dc1df8571db9a525d46487e5d1ae682474 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.9.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 45713ec5c417ed9cad614cd283d786a1 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.9.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 3f0eea194597e438bbe49ce9ef5fdced81459c21cbdd2653750b2fe02c55a0154d6a33a8cfd02e607b83314a8e35b2c300f944462120ab6de1d4139d85db56b8 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.9.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | aadc76e7e180fafb10fb729444e287a3 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.9.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 91a4c78a5e8c1cdd2d6bbcb27d2c34f49ea30a952733444ef4f4a7cc7503c880d4b6924595e87745ef6278851178f49f98d38d2068975d4fb6577fb9e9cdcdbe 2 | -------------------------------------------------------------------------------- /deps/checksums/curl-7.54.1.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | 6b6eb722f512e7a24855ff084f54fe55 2 | -------------------------------------------------------------------------------- /deps/checksums/curl-7.54.1.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | eb9639677f0ca1521ca631c520ab83ad071c52b31690e5e7f31546f6a44b2f11d1bb62282056cffb570eb290bf1e7830e87cb536295ac6a54a904663e795f2da 2 | -------------------------------------------------------------------------------- /deps/checksums/dsfmt-2.2.3.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 057c5a11d28296825fba584f561a4369 2 | -------------------------------------------------------------------------------- /deps/checksums/dsfmt-2.2.3.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 6d8ddcd01aab3f9039f4f0288a8af53e290cc2f293ed8c4a8c9f3b3f12398e7eedfce8016117b425766ba89c61c86c13b3e420035b5f9bf91315b8b814c03662 2 | -------------------------------------------------------------------------------- /deps/checksums/fftw-3.3.6-pl1.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 682a0e78d6966ca37c7446d4ab4cc2a1 2 | -------------------------------------------------------------------------------- /deps/checksums/fftw-3.3.6-pl1.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | e2ed33fcb068a36a841bbd898d12ceec74f4e9a0a349e7c55959878b50224a69a0f87656347dad7d7e1448ebc50d28d8f34f6da7992c43072d26942fd97c0134 2 | -------------------------------------------------------------------------------- /deps/checksums/gmp-6.1.2.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | 8ddbb26dc3bd4e2302984debba1406a5 2 | -------------------------------------------------------------------------------- /deps/checksums/gmp-6.1.2.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 268db88447174617f5746d9a6ba2b105940cc1a5e73155eb23b6eedf55f8e7724eda05d161b2de19aca9e794956d226ba9ed6f23124c7c82f7e1872e32b003cf 2 | -------------------------------------------------------------------------------- /deps/checksums/i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z/md5: -------------------------------------------------------------------------------- 1 | 6217dae4a1016b37b12aeed1cc950187 2 | -------------------------------------------------------------------------------- /deps/checksums/i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z/sha512: -------------------------------------------------------------------------------- 1 | 1f38cc758725f124552285940cde6d9e072a594298a09f7a542a6cc28cb25d119d80d73918e4e9207694819825787abb6eba4a83cee5892e5acaf6350221b97f 2 | -------------------------------------------------------------------------------- /deps/checksums/lapack-3.5.0.tgz/md5: -------------------------------------------------------------------------------- 1 | b1d3e3e425b2e44a06760ff173104bdf 2 | -------------------------------------------------------------------------------- /deps/checksums/lapack-3.5.0.tgz/sha512: -------------------------------------------------------------------------------- 1 | b948a0a0db032bda455ec4f519d4e89e4c29e29cecb5b6258ca61f68faaeeac9fdf4ece5c39ffcd0154c5505facbc392c7d09c8348b1d60bdd2685153ab2543f 2 | -------------------------------------------------------------------------------- /deps/checksums/libcxx-3.9.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 75a3214224301fc543fa6a38bdf7efe0 2 | -------------------------------------------------------------------------------- /deps/checksums/libcxx-3.9.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | a5976e4096624a7307b3e43f4a22ac2dc74572226e0f57af9f3ef537a14c3cff1601b7042aef9dc40a0ee53ca76b08d72eb9c253dcf34f115d3153c302db7070 2 | -------------------------------------------------------------------------------- /deps/checksums/libgit2-15e119375018fba121cf58e02a9f17fe22df0df8.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0d6fd3ed9265c6804349149b23ae6362 2 | -------------------------------------------------------------------------------- /deps/checksums/libgit2-15e119375018fba121cf58e02a9f17fe22df0df8.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 88a8a42bb8d18a5a722938404e048266d0899362ac89fdfedfa9f71aeb90408d8d98b4d9b9ea2ff46755d0a2cd8686ff04d31e85827566e1290a9536b8b36ac8 2 | -------------------------------------------------------------------------------- /deps/checksums/libosxunwind-0.0.3.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 40510da5eb85e099050cadbc620d0af9 2 | -------------------------------------------------------------------------------- /deps/checksums/libosxunwind-0.0.3.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 64c57c297b6b3779ed7d675d3ebcf471247b0d15bb560fce631afd82229adb352d438cf71509ab076610c6867bcc9ee359cf609c0257e53bea431235ff1da349 2 | -------------------------------------------------------------------------------- /deps/checksums/libssh2-30e9c1347e3b8baa2951db612f05e6d87fc8e2f2.tar.gz/md5: -------------------------------------------------------------------------------- 1 | d251ef0efecff323b6f570cc737d3411 2 | -------------------------------------------------------------------------------- /deps/checksums/libssh2-30e9c1347e3b8baa2951db612f05e6d87fc8e2f2.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | ae7535cf8f70e7c837e80365cd9ee7c4040d45e952871a3e5c8f1b71bd8eb2d96babb07fa4c5d66a83bb45960728ef8dbba30ab9a6387a68cf815a84cdae8795 2 | -------------------------------------------------------------------------------- /deps/checksums/libunwind-1.1-julia2.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 8310cbf1288248996e5b4f5450e24588 2 | -------------------------------------------------------------------------------- /deps/checksums/libunwind-1.1-julia2.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 5047890e727069c6ed74ca84bbe999ba6bc5c41d8d3914d6fbce19d18ff8a5944a7276d805ef5f67a857598852ae996a671c264d34a19123bb04d4daf6316f9a 2 | -------------------------------------------------------------------------------- /deps/checksums/libuv-52d72a52cc7ccd570929990f010ed16e2ec604c8.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0e6ec181c8bfd322a17dbd843b2b8ebb 2 | -------------------------------------------------------------------------------- /deps/checksums/libuv-52d72a52cc7ccd570929990f010ed16e2ec604c8.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 4bf9c8b16617691b70ea43c667ecc575d2a06b3d0c347b949d10360c012138585a13ecea5e18de81b1585a96cf7734b7cc3d6072490898f1d5531c702cf5afab 2 | -------------------------------------------------------------------------------- /deps/checksums/lldb-3.9.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 91399402f287d3f637db1207113deecb 2 | -------------------------------------------------------------------------------- /deps/checksums/lldb-3.9.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | e2957a1da60284595b21c205b07fa3db5c474bfad1935ab8e1bc832f30af497e9eb709efeb703591ef62e7dd73a28d22fc21398097a232c8a729946d72eb5df7 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.9.1-i686-w64-mingw32-juliadeps-r07.7z/md5: -------------------------------------------------------------------------------- 1 | 78a8751aab4333e636ab36d1bd56216a 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.9.1-i686-w64-mingw32-juliadeps-r07.7z/sha512: -------------------------------------------------------------------------------- 1 | 1a512d01f0751d184858de660cd69f1861af230f193522f6d94a61752caad32a5fa7af40f6abcfd153733107824eb3deaa6e6ef3d680eba3898af02d44a97d19 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.9.1-x86_64-w64-mingw32-juliadeps-r07.7z/md5: -------------------------------------------------------------------------------- 1 | 96af87df3140a00df866eda5b5a99d37 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.9.1-x86_64-w64-mingw32-juliadeps-r07.7z/sha512: -------------------------------------------------------------------------------- 1 | 24697b575688fea8f2ca5f9bf3f8f96353c09efbe32923cedc111bf976d5480a82a4c4dec52fc9343715887dee98605c80c3323e4d1b2f245e239cf5604ea02d 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.9.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 3259018a7437e157f3642df80f1983ea 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.9.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 50cbe8ee911080f586e77861c442348701bd02e2de0c090c54c34f82ac275ecfcd712af0f41e387c33b4a6057778a4258a27554292fe68ab4af3fd9dd6d90683 2 | -------------------------------------------------------------------------------- /deps/checksums/mbedtls-2.5.1-apache.tgz/md5: -------------------------------------------------------------------------------- 1 | 1299f38583cb4f93c78c99c14a8c913f 2 | -------------------------------------------------------------------------------- /deps/checksums/mbedtls-2.5.1-apache.tgz/sha512: -------------------------------------------------------------------------------- 1 | 8bde8f3d1d025a13c2a20fa8d2a4b9711adf0bb32d2226f1dd898dda3f3337c929b3d60e53684fbcf8094142568dd1d780353a92b94cb15c28c31c6d0542e6fc 2 | -------------------------------------------------------------------------------- /deps/checksums/mbedtls-2.5.1-gpl.tgz/md5: -------------------------------------------------------------------------------- 1 | 313f637f65b5f6d74d45310482a9c84f 2 | -------------------------------------------------------------------------------- /deps/checksums/mbedtls-2.5.1-gpl.tgz/sha512: -------------------------------------------------------------------------------- 1 | fa05a5f61d9d79bc74e47badc89f68f8b6fd228537f10706cbdacc03b02455171b88121b3c1c5f56dff648c39ff88936413a9c5eea0dd0e046fb1f889e173c63 2 | -------------------------------------------------------------------------------- /deps/checksums/mpfr-3.1.5.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | b1d23a55588e3b2a13e3be66bc69fd8d 2 | -------------------------------------------------------------------------------- /deps/checksums/mpfr-3.1.5.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | ebf94f49e1f850db6304eec8bf3cbf592b9fb06b743e0a99a660edae3c086aa47cdd089ea958fd4631ff02a444ec034b5e45d7e9701704d74c2e2d49021e49a7 2 | -------------------------------------------------------------------------------- /deps/checksums/openblas-85636ff1a015d04d3a8f960bc644b85ee5157135.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 4839fd98bce2900aa780cf1b1d387478 2 | -------------------------------------------------------------------------------- /deps/checksums/openblas-85636ff1a015d04d3a8f960bc644b85ee5157135.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 2be2a191817959841bcfb07972601f74f3112744fe8ac8c6f280525fd282ecbe4060513f72f5bf5386296be43489405567b04b418617152e6be54ac42e34dd62 2 | -------------------------------------------------------------------------------- /deps/checksums/openlibm-1581174c85f7b645b15ba1ac1c3a98fb601f0fe7.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 46654ecc67adba1d86426b1d9dfa3bc9 2 | -------------------------------------------------------------------------------- /deps/checksums/openlibm-1581174c85f7b645b15ba1ac1c3a98fb601f0fe7.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 64bb73800f3ff9219d7094b9f5f224468ee4cb34136bef77e1ae8b849e18d5f5fc1001f2e8dd92bcf0018f78152c3b52b9284e431bbafcea21d4f594c05e19ad 2 | -------------------------------------------------------------------------------- /deps/checksums/openspecfun-39699a1c1824bf88410cabb8a7438af91ea98f4c.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 00130a0879f691240df5f3ea25e6f0ba 2 | -------------------------------------------------------------------------------- /deps/checksums/openspecfun-39699a1c1824bf88410cabb8a7438af91ea98f4c.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 8681fc2f31696de2a6850cb4318c14ad39d3514742b066cf16058da87966d08e0d197fbb5104229fa19b61819a12ae5c76ea0279749f4338923cd4741ba31132 2 | -------------------------------------------------------------------------------- /deps/checksums/patchelf-0.9.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 3c265508526760f233620f35d79c79fc 2 | -------------------------------------------------------------------------------- /deps/checksums/patchelf-0.9.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 715db21156e6bd91cfa626f5201b32a6619e51532f5635ef52396da8193738ba66113485b61cc1e218b16737e66f72cc2e4bb3a7a33e73061ac2ef2c6330a299 2 | -------------------------------------------------------------------------------- /deps/checksums/pcre2-10.23.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | b2cd00ca7e24049040099b0a46bb3649 2 | -------------------------------------------------------------------------------- /deps/checksums/pcre2-10.23.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 3e5910bd2405cc35934d91e4be760abe4f2e900202a20b6ba74adb7a3acb2b74b3bf9b0e97e8de10f8e8534133e0722e0bf0f5fb40d6c2c4520d1ed61749d456 2 | -------------------------------------------------------------------------------- /deps/checksums/utf8proc-40e605959eb5cb90b2587fa88e3b661558fbc55a.tar.gz/md5: -------------------------------------------------------------------------------- 1 | f33af304538c3afba3b1d0ebae8e4555 2 | -------------------------------------------------------------------------------- /deps/checksums/utf8proc-40e605959eb5cb90b2587fa88e3b661558fbc55a.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 17a2df079e726a4ae1f10fcf48a7a771c2bcc93c7938f88148e1aa3b6cf9d250eb33cd7a9d8de54f29360e71c71e59b77996ba28dd894676888dc0453d67e9bb 2 | -------------------------------------------------------------------------------- /deps/checksums/x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z/md5: -------------------------------------------------------------------------------- 1 | b138576c92c425e8fa171a9d98e13b86 2 | -------------------------------------------------------------------------------- /deps/checksums/x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z/sha512: -------------------------------------------------------------------------------- 1 | 50dcb3aaab3e53d5ff4561079272daf473bacc8d7a2a3720e7c594ae6e402123cb3cc6f3eabaf67df8d94fa5c01bb3e45b5bb1bc7cbb87cd2beb6b5664e02072 2 | -------------------------------------------------------------------------------- /deps/gfortblas.alias: -------------------------------------------------------------------------------- 1 | _sasum_ _sasum 2 | _sasum_ _SASUM 3 | _sasum_ _SASUM_ 4 | _sasum_ _sasum_gfort_ 5 | 6 | _scasum_ _scasum 7 | _scasum_ _SCASUM 8 | _scasum_ _SCASUM_ 9 | _scasum_ _scasum_gfort_ 10 | 11 | _scnrm2_ _scnrm2 12 | _scnrm2_ _SCNRM2 13 | _scnrm2_ _SCNRM2_ 14 | _scnrm2_ _scnrm2_gfort_ 15 | 16 | _sdot_ _sdot 17 | _sdot_ _SDOT 18 | _sdot_ _SDOT_ 19 | _sdot_ _sdot_gfort_ 20 | 21 | _sdsdot_ _sdsdot 22 | _sdsdot_ _SDSDOT 23 | _sdsdot_ _SDSDOT_ 24 | _sdsdot_ _sdsdot_gfort_ 25 | 26 | _snrm2_ _snrm2 27 | _snrm2_ _SNRM2 28 | _snrm2_ _SNRM2_ 29 | _snrm2_ _snrm2_gfort_ 30 | 31 | 32 | _cdotc_ _cdotc 33 | _cdotc_ _CDOTC 34 | _cdotc_ _CDOTC_ 35 | _cdotc_ _cdotc_gfort_ 36 | 37 | _cdotu_ _cdotu 38 | _cdotu_ _CDOTU 39 | _cdotu_ _CDOTU_ 40 | _cdotu_ _cdotu_gfort_ 41 | 42 | _zdotc_ _zdotc 43 | _zdotc_ _ZDOTC 44 | _zdotc_ _ZDOTC_ 45 | _zdotc_ _zdotc_gfort_ 46 | 47 | _zdotu_ _zdotu 48 | _zdotu_ _ZDOTU 49 | _zdotu_ _ZDOTU_ 50 | _zdotu_ _zdotu_gfort_ 51 | -------------------------------------------------------------------------------- /deps/libdSFMT.def: -------------------------------------------------------------------------------- 1 | LIBRARY "libdSFMT.dll" 2 | EXPORTS 3 | dsfmt_chk_init_by_array 4 | dsfmt_chk_init_gen_rand 5 | dsfmt_fill_array_close1_open2 6 | dsfmt_fill_array_close_open 7 | dsfmt_fill_array_open_close 8 | dsfmt_fill_array_open_open 9 | dsfmt_gen_rand_all 10 | dsfmt_genrand_close1_open2 11 | dsfmt_genrand_close_open 12 | dsfmt_genrand_open_close 13 | dsfmt_genrand_open_open 14 | dsfmt_genrand_uint32 15 | dsfmt_get_idstring 16 | dsfmt_get_min_array_size 17 | dsfmt_global_data DATA 18 | dsfmt_gv_fill_array_close1_open2 19 | dsfmt_gv_fill_array_close_open 20 | dsfmt_gv_fill_array_open_close 21 | dsfmt_gv_fill_array_open_open 22 | dsfmt_gv_genrand_close1_open2 23 | dsfmt_gv_genrand_close_open 24 | dsfmt_gv_genrand_open_close 25 | dsfmt_gv_genrand_open_open 26 | dsfmt_gv_genrand_uint32 27 | dsfmt_gv_init_by_array 28 | dsfmt_gv_init_gen_rand 29 | dsfmt_init_by_array 30 | dsfmt_init_gen_rand 31 | -------------------------------------------------------------------------------- /deps/libgit2.version: -------------------------------------------------------------------------------- 1 | LIBGIT2_BRANCH=v0.26.0 2 | LIBGIT2_SHA1=15e119375018fba121cf58e02a9f17fe22df0df8 3 | -------------------------------------------------------------------------------- /deps/libssh2.version: -------------------------------------------------------------------------------- 1 | LIBSSH2_BRANCH=libssh2-1.8.0 2 | LIBSSH2_SHA1=30e9c1347e3b8baa2951db612f05e6d87fc8e2f2 3 | -------------------------------------------------------------------------------- /deps/libuv.version: -------------------------------------------------------------------------------- 1 | LIBUV_BRANCH=julia-uv1.9.0 2 | LIBUV_SHA1=52d72a52cc7ccd570929990f010ed16e2ec604c8 3 | -------------------------------------------------------------------------------- /deps/llvm-options.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(LLVM_DEBUG),1) 2 | LLVM_BUILDTYPE := Debug 3 | else 4 | LLVM_BUILDTYPE := Release 5 | endif 6 | LLVM_CMAKE_BUILDTYPE := $(LLVM_BUILDTYPE) 7 | ifeq ($(LLVM_ASSERTIONS),1) 8 | LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+Asserts 9 | endif 10 | LLVM_FLAVOR := $(LLVM_BUILDTYPE) 11 | ifeq ($(LLVM_SANITIZE),1) 12 | ifeq ($(SANITIZE_MEMORY),1) 13 | LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+MSAN 14 | else 15 | LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+ASAN 16 | endif 17 | endif 18 | 19 | LLVM_SRC_DIR:=$(SRCDIR)/srccache/llvm-$(LLVM_VER) 20 | LLVM_BUILD_DIR:=$(BUILDDIR)/llvm-$(LLVM_VER) 21 | LLVM_BUILDDIR_withtype := $(LLVM_BUILD_DIR)/build_$(LLVM_BUILDTYPE) 22 | -------------------------------------------------------------------------------- /deps/llvm-ver.make: -------------------------------------------------------------------------------- 1 | LLVM_VER_MAJ:=$(word 1, $(subst ., ,$(LLVM_VER))) 2 | LLVM_VER_MIN:=$(word 2, $(subst ., ,$(LLVM_VER))) 3 | # define a "short" LLVM version for easy comparisons 4 | ifeq ($(LLVM_VER),svn) 5 | LLVM_VER_SHORT:=svn 6 | else 7 | LLVM_VER_SHORT:=$(LLVM_VER_MAJ).$(LLVM_VER_MIN) 8 | endif 9 | LLVM_VER_PATCH:=$(word 3, $(subst ., ,$(LLVM_VER))) 10 | ifeq ($(LLVM_VER_PATCH),) 11 | LLVM_VER_PATCH := 0 12 | endif 13 | -------------------------------------------------------------------------------- /deps/objconv.mk: -------------------------------------------------------------------------------- 1 | ## objconv ## 2 | 3 | $(SRCDIR)/srccache/objconv.zip: | $(SRCDIR)/srccache 4 | $(JLDOWNLOAD) $@ http://www.agner.org/optimize/objconv.zip 5 | 6 | $(BUILDDIR)/objconv/source-extracted: $(SRCDIR)/srccache/objconv.zip 7 | -rm -r $(dir $@) 8 | mkdir -p $(BUILDDIR) 9 | unzip -d $(dir $@) $< 10 | cd $(dir $@) && unzip source.zip 11 | echo 1 > $@ 12 | 13 | $(BUILDDIR)/objconv/build-compiled: $(BUILDDIR)/objconv/source-extracted 14 | cd $(dir $<) && $(CXX) -o objconv -O2 *.cpp 15 | echo 1 > $@ 16 | 17 | $(eval $(call staged-install, \ 18 | objconv,objconv, \ 19 | BINFILE_INSTALL,$$(BUILDDIR)/objconv/objconv,,)) 20 | 21 | clean-objconv: 22 | -rm $(BUILDDIR)/objconv/build-compiled $(build_depsbindir)/objconv 23 | 24 | distclean-objconv: 25 | -rm -rf $(SRCDIR)/srccache/objconv.zip $(BUILDDIR)/objconv 26 | 27 | 28 | get-objconv: $(SRCDIR)/srccache/objconv.zip 29 | extract-objconv: $(BUILDDIR)/objconv/source-extracted 30 | configure-objconv: extract-objconv 31 | compile-objconv: $(BUILDDIR)/objconv/build-compiled 32 | fastcheck-objconv: check-objconv 33 | check-objconv: compile-objconv 34 | -------------------------------------------------------------------------------- /deps/openblas.version: -------------------------------------------------------------------------------- 1 | OPENBLAS_BRANCH=v0.2.19 2 | OPENBLAS_SHA1=85636ff1a015d04d3a8f960bc644b85ee5157135 3 | -------------------------------------------------------------------------------- /deps/openlibm.mk: -------------------------------------------------------------------------------- 1 | ## openlibm ## 2 | OPENLIBM_GIT_URL := git://github.com/JuliaLang/openlibm.git 3 | OPENLIBM_TAR_URL = https://api.github.com/repos/JuliaLang/openlibm/tarball/$1 4 | $(eval $(call git-external,openlibm,OPENLIBM,,,$(BUILDDIR))) 5 | 6 | OPENLIBM_FLAGS := ARCH="$(ARCH)" REAL_ARCH="$(MARCH)" CC="$(CC)" FC="$(FC)" AR="$(AR)" OS="$(OS)" USECLANG=$(USECLANG) USEGCC=$(USEGCC) 7 | 8 | $(BUILDDIR)/$(OPENLIBM_SRC_DIR)/build-compiled: $(BUILDDIR)/$(OPENLIBM_SRC_DIR)/source-extracted 9 | $(MAKE) -C $(dir $<) $(OPENLIBM_FLAGS) $(MAKE_COMMON) 10 | echo 1 > $@ 11 | 12 | $(eval $(call staged-install, \ 13 | openlibm,$$(OPENLIBM_SRC_DIR), \ 14 | MAKE_INSTALL,$$(OPENLIBM_FLAGS),, \ 15 | $(INSTALL_NAME_CMD)libopenlibm.$(SHLIB_EXT) $(build_shlibdir)/libopenlibm.$(SHLIB_EXT))) 16 | 17 | clean-openlibm: 18 | -rm $(BUILDDIR)/$(OPENLIBM_SRC_DIR)/build-compiled $(build_libdir)/libopenlibm.a 19 | -$(MAKE) -C $(BUILDDIR)/$(OPENLIBM_SRC_DIR) distclean $(OPENLIBM_FLAGS) 20 | 21 | 22 | get-openlibm: $(OPENLIBM_SRC_FILE) 23 | extract-openlibm: $(BUILDDIR)/$(OPENLIBM_SRC_DIR)/source-extracted 24 | configure-openlibm: extract-openlibm 25 | compile-openlibm: $(BUILDDIR)/$(OPENLIBM_SRC_DIR)/build-compiled 26 | fastcheck-openlibm: check-openlibm 27 | check-openlibm: compile-openlibm 28 | -------------------------------------------------------------------------------- /deps/openlibm.version: -------------------------------------------------------------------------------- 1 | OPENLIBM_BRANCH=v0.5.4 2 | OPENLIBM_SHA1=1581174c85f7b645b15ba1ac1c3a98fb601f0fe7 3 | -------------------------------------------------------------------------------- /deps/openspecfun.version: -------------------------------------------------------------------------------- 1 | OPENSPECFUN_BRANCH=v0.5.3 2 | OPENSPECFUN_SHA1=39699a1c1824bf88410cabb8a7438af91ea98f4c 3 | -------------------------------------------------------------------------------- /deps/patches/SuiteSparse-winclang.patch: -------------------------------------------------------------------------------- 1 | --- SuiteSparse_config/SuiteSparse_config.h 2015-07-15 03:26:41.000000000 +0000 2 | +++ SuiteSparse_config/SuiteSparse_config.h 2016-07-01 00:55:57.157465600 +0000 3 | @@ -54,7 +54,11 @@ 4 | #ifdef _WIN64 5 | 6 | #define SuiteSparse_long __int64 7 | +#ifdef _MSVC_VER 8 | #define SuiteSparse_long_max _I64_MAX 9 | +#else 10 | +#define SuiteSparse_long_max LLONG_MAX 11 | +#endif 12 | #define SuiteSparse_long_idd "I64d" 13 | 14 | #else 15 | -------------------------------------------------------------------------------- /deps/patches/gmp-exception.patch: -------------------------------------------------------------------------------- 1 | diff -r 842c2ba359bf errno.c 2 | --- a/errno.c Sun Jan 24 22:06:51 2016 +0100 3 | +++ b/errno.c Thu Jan 28 13:37:54 2016 -0500 4 | @@ -33,24 +33,24 @@ 5 | see https://www.gnu.org/licenses/. */ 6 | 7 | #include 8 | + 9 | +#include 10 | + 11 | #include "gmp.h" 12 | #include "gmp-impl.h" 13 | 14 | int gmp_errno = 0; 15 | 16 | 17 | -/* The deliberate divide by zero triggers an exception on most systems. On 18 | - those where it doesn't, for example power and powerpc, use abort instead. 19 | - 20 | - Enhancement: Perhaps raise(SIGFPE) (or the same with kill()) would be 21 | - better than abort. Perhaps it'd be possible to get the BSD style 22 | - FPE_INTDIV_TRAP parameter in there too. */ 23 | - 24 | +/* Use SIGFPE on systems which have it. Otherwise, deliberate divide 25 | + by zero, which triggers an exception on most systems. On those 26 | + where it doesn't, for example power and powerpc, use abort instead. */ 27 | void 28 | __gmp_exception (int error_bit) 29 | { 30 | gmp_errno |= error_bit; 31 | __gmp_junk = 10 / __gmp_0; 32 | + raise (SIGFPE); 33 | abort (); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /deps/patches/libgit2-agent-nonfatal.patch: -------------------------------------------------------------------------------- 1 | commit 70020247d1903c7a1262d967cf205a44dc6f6ebe 2 | Author: Keno Fischer 3 | Date: Wed Jul 20 19:59:00 2016 -0400 4 | 5 | Make failure to connect to ssh-agent non-fatal 6 | 7 | diff --git a/src/transports/ssh.c b/src/transports/ssh.c 8 | index cfd5736..82d2c63 100644 9 | --- a/src/transports/ssh.c 10 | +++ b/src/transports/ssh.c 11 | @@ -296,8 +296,10 @@ static int ssh_agent_auth(LIBSSH2_SESSION *session, git_cred_ssh_key *c) { 12 | 13 | rc = libssh2_agent_connect(agent); 14 | 15 | - if (rc != LIBSSH2_ERROR_NONE) 16 | + if (rc != LIBSSH2_ERROR_NONE) { 17 | + rc = LIBSSH2_ERROR_AUTHENTICATION_FAILED; 18 | goto shutdown; 19 | + } 20 | 21 | rc = libssh2_agent_list_identities(agent); 22 | 23 | -------------------------------------------------------------------------------- /deps/patches/libgit2-ssh.patch: -------------------------------------------------------------------------------- 1 | --- CMakeLists.txt 2016-05-26 23:13:48.000000000 -0400 2 | +++ CMakeLists.txt 2016-07-02 23:20:55.842735529 -0400 3 | @@ -354,14 +354,16 @@ 4 | 5 | # Optional external dependency: libssh2 6 | IF (USE_SSH) 7 | - PKG_CHECK_MODULES(LIBSSH2 libssh2) 8 | + FIND_PACKAGE(Libssh2) 9 | + GET_TARGET_PROPERTY(LIBSSH2_INCLUDE_DIRS Libssh2::libssh2 INTERFACE_INCLUDE_DIRECTORIES) 10 | + GET_TARGET_PROPERTY(LIBSSH2_LOCATION Libssh2::libssh2 IMPORTED_LOCATION_RELEASE) 11 | + GET_FILENAME_COMPONENT(LIBSSH2_LIBRARY_DIRS ${LIBSSH2_LOCATION} PATH) 12 | + SET(LIBSSH2_LIBRARIES "-lssh2") 13 | ENDIF() 14 | -IF (LIBSSH2_FOUND) 15 | +IF (Libssh2_FOUND) 16 | ADD_DEFINITIONS(-DGIT_SSH) 17 | INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIRS}) 18 | LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS}) 19 | - LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) 20 | - #SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}") 21 | SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES}) 22 | 23 | CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) 24 | -------------------------------------------------------------------------------- /deps/patches/libssh2-netinet-in.patch: -------------------------------------------------------------------------------- 1 | --- tests/CMakeLists.txt 2016-10-24 23:43:39.000000000 -0700 2 | +++ tests/CMakeLists.txt 2016-11-15 20:44:32.132344000 -0800 3 | @@ -47,6 +47,7 @@ 4 | check_include_files(arpa/inet.h HAVE_ARPA_INET_H) 5 | check_include_files(windows.h HAVE_WINDOWS_H) 6 | check_include_files(winsock2.h HAVE_WINSOCK2_H) 7 | +check_include_files(netinet/in.h HAVE_NETINET_IN_H) 8 | configure_file( 9 | "${CMAKE_CURRENT_SOURCE_DIR}/libssh2_config_cmake.h.in" 10 | "${CMAKE_CURRENT_BINARY_DIR}/libssh2_config.h") 11 | -------------------------------------------------------------------------------- /deps/patches/libunwind-dwarf-ver.patch: -------------------------------------------------------------------------------- 1 | From 155540bf1b1b57bd73ba1e7c1c77f3e4467bf253 Mon Sep 17 00:00:00 2001 2 | From: Yichao Yu 3 | Date: Sat, 1 Oct 2016 15:24:09 +0000 4 | Subject: [PATCH 2/3] Allow DWARF version 4 5 | 6 | --- 7 | src/dwarf/Gfde.c | 3 ++- 8 | 1 file changed, 2 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/src/dwarf/Gfde.c b/src/dwarf/Gfde.c 11 | index dc973fe..c1d6e1c 100644 12 | --- a/src/dwarf/Gfde.c 13 | +++ b/src/dwarf/Gfde.c 14 | @@ -116,7 +116,8 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, 15 | if ((ret = dwarf_readu8 (as, a, &addr, &version, arg)) < 0) 16 | return ret; 17 | 18 | - if (version != 1 && version != DWARF_CIE_VERSION) 19 | + if (version != 1 && version != DWARF_CIE_VERSION && 20 | + !(version == 4 && DWARF_CIE_VERSION)) 21 | { 22 | Debug (1, "Got CIE version %u, expected version 1 or " 23 | STR (DWARF_CIE_VERSION) "\n", version); 24 | -- 25 | 2.10.0 26 | 27 | -------------------------------------------------------------------------------- /deps/patches/libunwind-freebsd-mapper.patch: -------------------------------------------------------------------------------- 1 | --- tests/mapper.c 2014-10-06 14:46:27.000000000 -0400 2 | +++ tests/mapper.c 2014-10-06 14:47:00.000000000 -0400 3 | @@ -39,6 +39,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE 4 | #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) 5 | # define MAP_ANONYMOUS MAP_ANON 6 | #endif 7 | +#if !defined(MAP_NORESERVE) 8 | +# define MAP_NORESERVE 0 9 | +#endif 10 | 11 | int 12 | main (void) 13 | -------------------------------------------------------------------------------- /deps/patches/lldb-3.7.1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/tools/lldb/source/Host/Makefile b/tools/lldb/source/Host/Makefile 2 | index a8e4260..da90c8c 100644 3 | --- a/tools/lldb/source/Host/Makefile 4 | +++ b/tools/lldb/source/Host/Makefile 5 | @@ -14,7 +14,7 @@ include $(LEVEL)/Makefile.config 6 | 7 | define DIR_SOURCES 8 | SOURCES += $$(addprefix $(1)/,$$(notdir $$(wildcard $$(PROJ_SRC_DIR)/$(1)/*.cpp \ 9 | - $$(PROJ_SRC_DIR)/*.cc $$(PROJ_SRC_DIR)/$(1)/*.c))) 10 | + $$(PROJ_SRC_DIR)/*.cc $$(PROJ_SRC_DIR)/$(1)/*.c $$(PROJ_SRC_DIR)/$(1)/*.mm))) 11 | endef 12 | 13 | $(eval $(call DIR_SOURCES,common)) 14 | @@ -22,6 +22,15 @@ $(eval $(call DIR_SOURCES,common)) 15 | ifeq ($(HOST_OS),Darwin) 16 | $(eval $(call DIR_SOURCES,posix)) 17 | $(eval $(call DIR_SOURCES,macosx)) 18 | +CFCPP_SOURCES = \ 19 | + $(addprefix macosx/cfcpp/,$(notdir $(wildcard $(PROJ_SRC_DIR)/macosx/cfcpp/*.cpp))) 20 | +SOURCES += $(CFCPP_SOURCES) 21 | + 22 | +CFCPP_BaseNameSources := $(sort $(basename $(CFCPP_SOURCES))) 23 | +CFCPP_OBJECTS := $(CFCPP_BaseNameSources:%=$(ObjDir)/%.o) 24 | + 25 | +# Make sure the cfcpp output directory exists 26 | +$(CFCPP_OBJECTS): $(ObjDir)/cfcpp/.dir 27 | endif 28 | 29 | ifeq ($(HOST_OS),Linux) 30 | @@ -34,6 +43,11 @@ $(eval $(call DIR_SOURCES,posix)) 31 | $(eval $(call DIR_SOURCES,freebsd)) 32 | endif 33 | 34 | +ifeq ($(HOST_OS),NetBSD) 35 | +$(eval $(call DIR_SOURCES,posix)) 36 | +$(eval $(call DIR_SOURCES,netbsd)) 37 | +endif 38 | + 39 | ifeq ($(HOST_OS),MingW) 40 | $(eval $(call DIR_SOURCES,windows)) 41 | endif 42 | -------------------------------------------------------------------------------- /deps/patches/llvm-D28215_FreeBSD_shlib.patch: -------------------------------------------------------------------------------- 1 | Index: tools/llvm-shlib/CMakeLists.txt 2 | =================================================================== 3 | --- a/tools/llvm-shlib/CMakeLists.txt 4 | +++ b/tools/llvm-shlib/CMakeLists.txt 5 | @@ -37,7 +37,7 @@ 6 | add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES}) 7 | 8 | list(REMOVE_DUPLICATES LIB_NAMES) 9 | -if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR MINGW) # FIXME: It should be "GNU ld for elf" 10 | +if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf" 11 | # GNU ld doesn't resolve symbols in the version script. 12 | set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive) 13 | elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") 14 | -------------------------------------------------------------------------------- /deps/patches/llvm-D28221-avx512.patch: -------------------------------------------------------------------------------- 1 | Index: lib/Support/Host.cpp 2 | =================================================================== 3 | --- a/lib/Support/Host.cpp 4 | +++ b/lib/Support/Host.cpp 5 | @@ -475,13 +475,14 @@ 6 | 7 | // Skylake: 8 | case 0x4e: 9 | - *Type = INTEL_COREI7; // "skylake-avx512" 10 | - *Subtype = INTEL_COREI7_SKYLAKE_AVX512; 11 | - break; 12 | case 0x5e: 13 | *Type = INTEL_COREI7; // "skylake" 14 | *Subtype = INTEL_COREI7_SKYLAKE; 15 | break; 16 | + case 0x55: 17 | + *Type = INTEL_COREI7; // "skylake-avx512" 18 | + *Subtype = INTEL_COREI7_SKYLAKE_AVX512; 19 | + break; 20 | 21 | case 0x1c: // Most 45 nm Intel Atom processors 22 | case 0x26: // 45 nm Atom Lincroft 23 | -------------------------------------------------------------------------------- /deps/patches/llvm-Yet-another-fix.patch: -------------------------------------------------------------------------------- 1 | From e92be5eb5c60dfdeb5d41d81c82f0aca0c1e4aa9 Mon Sep 17 00:00:00 2001 2 | From: Yichao Yu 3 | Date: Sat, 17 Jun 2017 17:29:53 -0400 4 | Subject: [PATCH] 4.0 fix 5 | 6 | --- 7 | lib/CodeGen/CodeGenPrepare.cpp | 17 +++++++++++++++++ 8 | 1 file changed, 17 insertions(+) 9 | 10 | diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp 11 | index 44d6b3e264c..4177819e989 100644 12 | --- a/lib/CodeGen/CodeGenPrepare.cpp 13 | +++ b/lib/CodeGen/CodeGenPrepare.cpp 14 | @@ -4067,6 +4067,23 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, 15 | // non-integral pointers, so in that case bail out now. 16 | if (DL->isNonIntegralPointerType(Addr->getType())) 17 | return false; 18 | + if (AddrMode.BaseReg) { 19 | + Type *BaseTy = AddrMode.BaseReg->getType(); 20 | + if (BaseTy->isPointerTy() && DL->isNonIntegralPointerType(BaseTy)) { 21 | + return false; 22 | + } 23 | + } 24 | + if (AddrMode.Scale) { 25 | + Type *ScaleTy = AddrMode.ScaledReg->getType(); 26 | + if (ScaleTy->isPointerTy() && DL->isNonIntegralPointerType(ScaleTy)) { 27 | + return false; 28 | + } 29 | + } 30 | + if (AddrMode.BaseGV) { 31 | + if (DL->isNonIntegralPointerType(AddrMode.BaseGV->getType())) { 32 | + return false; 33 | + } 34 | + } 35 | 36 | DEBUG(dbgs() << "CGP: SINKING nonlocal addrmode: " << AddrMode << " for " 37 | << *MemoryInst << "\n"); 38 | -- 39 | 2.13.1 40 | 41 | -------------------------------------------------------------------------------- /deps/patches/llvm-rL293230-icc17-cmake.patch: -------------------------------------------------------------------------------- 1 | From eca8aa608d962e09ea9710670f1c412f608a6f12 Mon Sep 17 00:00:00 2001 2 | From: Yichao Yu 3 | Date: Thu, 26 Jan 2017 23:50:18 +0000 4 | Subject: [PATCH] CMake is funky on detecting Intel 17 as GCC compatible. 5 | 6 | Summary: This adds a fallback in case that the Intel compiler is failed to be detected correctly. 7 | 8 | Reviewers: chapuni 9 | 10 | Reviewed By: chapuni 11 | 12 | Subscribers: llvm-commits, mgorny 13 | 14 | Differential Revision: https://reviews.llvm.org/D27610 15 | 16 | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293230 91177308-0d34-0410-b5e6-96231b3b80d8 17 | --- 18 | cmake/modules/DetermineGCCCompatible.cmake | 2 ++ 19 | 1 file changed, 2 insertions(+) 20 | 21 | diff --git a/cmake/modules/DetermineGCCCompatible.cmake b/cmake/modules/DetermineGCCCompatible.cmake 22 | index 1bf15fcba72..1369ebe9d0e 100644 23 | --- a/cmake/modules/DetermineGCCCompatible.cmake 24 | +++ b/cmake/modules/DetermineGCCCompatible.cmake 25 | @@ -7,5 +7,7 @@ if(NOT DEFINED LLVM_COMPILER_IS_GCC_COMPATIBLE) 26 | set(LLVM_COMPILER_IS_GCC_COMPATIBLE OFF) 27 | elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) 28 | set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON) 29 | + elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) 30 | + set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON) 31 | endif() 32 | endif() 33 | -- 34 | 2.11.0 35 | 36 | -------------------------------------------------------------------------------- /deps/patches/mpfr-sincos.patch: -------------------------------------------------------------------------------- 1 | https://github.com/JuliaLang/julia/issues/22758 2 | svn diff -r 11589:11590 https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk 3 | --- src/sin_cos.c (revision 11589) 4 | +++ src/sin_cos.c (revision 11590) 5 | @@ -354,10 +354,12 @@ 6 | which reduces to T[k] = (2*i+2)*(2*i+3)*2^r-pp, 7 | Q[k] = (2*i)*(2*i+1)*(2*i+2)*(2*i+3). */ 8 | log2_nb_terms[k] = 1; 9 | - mpz_set_ui (Q[k], (2 * i + 2) * (2 * i + 3)); 10 | + mpz_set_ui (Q[k], 2 * i + 2); 11 | + mpz_mul_ui (Q[k], Q[k], 2 * i + 3); 12 | mpz_mul_2exp (T[k], Q[k], r); 13 | mpz_sub (T[k], T[k], pp); 14 | - mpz_mul_ui (Q[k], Q[k], (2 * i) * (2 * i + 1)); 15 | + mpz_mul_ui (Q[k], Q[k], 2 * i); 16 | + mpz_mul_ui (Q[k], Q[k], 2 * i + 1); 17 | /* the next term of the series is divided by Q[k] and multiplied 18 | by pp^2/2^(2r), thus the mult. factor < 1/2^mult[k] */ 19 | MPFR_MPZ_SIZEINBASE2(mult[k], Q[k]); 20 | --- PATCHES 2017-07-18 15:55:44.000000000 -0700 21 | +++ PATCHES 2017-07-18 15:55:57.000000000 -0700 22 | @@ -0,0 +1 @@ 23 | +r11590 24 | -------------------------------------------------------------------------------- /deps/patches/openblas-cross-compile.patch: -------------------------------------------------------------------------------- 1 | diff --git a/c_check b/c_check 2 | index 2ec9fc48..371dbf61 100644 3 | --- a/c_check 4 | +++ b/c_check 5 | @@ -34,7 +34,7 @@ if (dirname($compiler_name) ne ".") { 6 | $cross_suffix .= dirname($compiler_name) . "/"; 7 | } 8 | 9 | -if (basename($compiler_name) =~ /(.*-)(.*)/) { 10 | +if (basename($compiler_name) =~ /([^\s]*-)(.*)/) { 11 | $cross_suffix .= $1; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /deps/patches/openblas-freebsd.patch: -------------------------------------------------------------------------------- 1 | --- driver/others/blas_server.c 2016-08-31 20:58:42.000000000 -0700 2 | +++ driver/others/blas_server.c 2016-11-16 21:24:52.282666000 -0800 3 | @@ -70,7 +70,7 @@ 4 | /*********************************************************************/ 5 | 6 | #include "common.h" 7 | -#if defined(OS_LINUX) || defined(OS_NETBSD) || defined(OS_DARWIN) || defined(OS_ANDROID) || defined(OS_SUNOS) 8 | +#if defined(OS_LINUX) || defined(OS_NETBSD) || defined(OS_DARWIN) || defined(OS_ANDROID) || defined(OS_SUNOS) || defined(OS_FREEBSD) 9 | #include 10 | #include 11 | #include 12 | -------------------------------------------------------------------------------- /deps/patches/pcre-mingw.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/pcre2grep.c b/src/pcre2grep.c 2 | index e98d743..f00dac2 100644 3 | --- a/src/pcre2grep.c 4 | +++ b/src/pcre2grep.c 5 | @@ -628,7 +628,7 @@ z/OS, and "no support". */ 6 | 7 | /************* Directory scanning Unix-style and z/OS ***********/ 8 | 9 | -#if (defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS 10 | +#if ((defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS) && !defined WIN32 11 | #include 12 | #include 13 | #include 14 | -------------------------------------------------------------------------------- /deps/tools/find_python2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # LLVM requires 2.7 <= python2 < 3 4 | # 5 | 6 | valid_python() { 7 | $1 -c 'import sys; sys.exit(not (sys.version_info >= (2,7) and sys.version_info < (3,0)))' 2> /dev/null 8 | } 9 | 10 | for python in python python2 python2.7 python27; do 11 | if valid_python $python; then 12 | echo `which $python` 13 | break 14 | fi 15 | done 16 | 17 | -------------------------------------------------------------------------------- /deps/tools/jldownload: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # usage: jldownload [] 4 | # 5 | 6 | CACHE_HOST=https://cache.julialang.org 7 | 8 | WGET=$(which wget 2>/dev/null) 9 | CURL=$(which curl 2>/dev/null) 10 | FETCH=$(which fetch 2>/dev/null) 11 | 12 | TIMEOUT=15 # seconds 13 | WGET_OPTS="--no-check-certificate --tries=1 --timeout=$TIMEOUT" 14 | CURL_OPTS="-fkL --connect-timeout $TIMEOUT -y $TIMEOUT" 15 | FETCH_OPTS="-T $TIMEOUT" 16 | 17 | if [ $# -eq 1 ]; then 18 | CURL_OPTS="$CURL_OPTS -O" 19 | URL=$1 20 | elif [ $# -eq 2 ]; then 21 | WGET_OPTS="$WGET_OPTS -O $1" 22 | CURL_OPTS="$CURL_OPTS -o $1" 23 | FETCH_OPTS="$FETCH_OPTS -o $1" 24 | URL=$2 25 | else 26 | exit 1 27 | fi 28 | 29 | CACHE_URL="$CACHE_HOST/$URL" 30 | 31 | if [ -x "$CURL" ] && $CURL -V >/dev/null; then 32 | GETURL="$CURL $CURL_OPTS" 33 | elif [ -x "$WGET" ] && $WGET -V >/dev/null; then 34 | GETURL="$WGET $WGET_OPTS" 35 | elif [ -x "$FETCH" ]; then 36 | GETURL="$FETCH $FETCH_OPTS" 37 | else 38 | echo "Could not find working curl, wget, or fetch." 39 | echo "You need to install one of these to download dependencies." 40 | exit 1 41 | fi 42 | 43 | # Try to get from the cache if it is possible. Note that the cache will 44 | # forward to the original URL if it has not cached this download yet, or 45 | # if the URL is not cacheable. We fallback to directly querying the 46 | # uncached URL to protect against cache service downtime 47 | $GETURL $CACHE_URL || $GETURL $URL 48 | -------------------------------------------------------------------------------- /deps/utf8proc.version: -------------------------------------------------------------------------------- 1 | UTF8PROC_BRANCH=v2.1 2 | UTF8PROC_SHA1=40e605959eb5cb90b2587fa88e3b661558fbc55a 3 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | deps/ 2 | _build/ 3 | UnicodeData.txt 4 | 5 | -------------------------------------------------------------------------------- /doc/NEWS-update.jl: -------------------------------------------------------------------------------- 1 | # Script to automatically insert Markdown footnotes for all [#xxxx] issue 2 | # cross-references in the NEWS file. 3 | 4 | NEWS = get(ARGS, 1, "NEWS.md") 5 | 6 | s = read(NEWS, String) 7 | 8 | s = s[1:match(r"\[#[0-9]+\]:", s).offset-1]; 9 | 10 | footnote(n) = "[#$n]: https://github.com/JuliaLang/julia/issues/$n" 11 | N = map(m -> parse(Int,m.captures[1]), eachmatch(r"\[#([0-9]+)\]", s)) 12 | foots = join(map(footnote, sort!(unique(N))), "\n") 13 | 14 | open(NEWS, "w") do f 15 | println(f, s, foots) 16 | end 17 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Julia Documentation README 2 | 3 | Julia's documentation is written in Markdown. A reference of all supported syntax can be found in the [manual](https://docs.julialang.org/en/latest/manual/documentation/#markdown-syntax). All documentation can be found in the Markdown files in `doc/src/` and the docstrings in Julia source files in `base/`. 4 | 5 | ## Requirements 6 | 7 | This documentation is built using the [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl) package. 8 | 9 | All dependencies are automatically installed into a sandboxed package directory in `doc/deps/` to avoid interfering with user-installed packages. 10 | 11 | ## Building 12 | 13 | To build Julia's documentation run 14 | 15 | ```sh 16 | $ make docs 17 | ``` 18 | 19 | from the root directory. This will build the HTML documentation and output it to the `doc/_build/` folder. 20 | 21 | ## Testing 22 | 23 | To run the doctests found in the manual run 24 | 25 | ```sh 26 | $ make -C doc check 27 | ``` 28 | 29 | from the root directory. 30 | 31 | -------------------------------------------------------------------------------- /doc/REQUIRE: -------------------------------------------------------------------------------- 1 | Compat 0.25.2 0.25.2+ 2 | DocStringExtensions 0.3.3 0.3.3+ 3 | Documenter 0.11.1 0.11.1+ 4 | -------------------------------------------------------------------------------- /doc/images/github_metadata_develbranch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/doc/images/github_metadata_develbranch.png -------------------------------------------------------------------------------- /doc/images/github_metadata_fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/doc/images/github_metadata_fork.png -------------------------------------------------------------------------------- /doc/images/github_metadata_pullrequest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/doc/images/github_metadata_pullrequest.png -------------------------------------------------------------------------------- /doc/images/jltypes.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/doc/images/jltypes.ai -------------------------------------------------------------------------------- /doc/images/travis-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/doc/images/travis-icon.png -------------------------------------------------------------------------------- /doc/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/julia/0530b2ec0fb35c3c0c39d043fa67c83e7a871398/doc/src/assets/logo.png -------------------------------------------------------------------------------- /doc/src/devdocs/require.md: -------------------------------------------------------------------------------- 1 | # Module loading 2 | 3 | [`Base.require`](@ref) is responsible for loading modules and it also manages the 4 | precompilation cache. It is the implementation of the `import` statement. 5 | 6 | ## Experimental features 7 | The features below are experimental and not part of the stable Julia API. 8 | Before building upon them inform yourself about the current thinking and whether they might change soon. 9 | 10 | ### Module loading callbacks 11 | 12 | It is possible to listen to the modules loaded by `Base.require`, by registering a callback. 13 | 14 | ```julia 15 | loaded_packages = Channel{Symbol}() 16 | callback = (mod::Symbol) -> put!(loaded_packages, mod) 17 | push!(Base.package_callbacks, callback) 18 | ``` 19 | 20 | Please note that the symbol given to the callback is a non-unique identifier and 21 | it is the responsibility of the callback provider to walk the module chain to 22 | determine the fully qualified name of the loaded binding. 23 | 24 | The callback below is an example of how to do that: 25 | 26 | ```julia 27 | # Get the fully-qualified name of a module. 28 | function module_fqn(name::Symbol) 29 | fqn = Symbol[name] 30 | mod = getfield(Main, name) 31 | parent = Base.module_parent(mod) 32 | while parent !== Main 33 | push!(fqn, Base.module_name(parent)) 34 | parent = Base.module_parent(parent) 35 | end 36 | fqn = reverse!(fqn) 37 | return join(fqn, '.') 38 | end 39 | ``` 40 | 41 | -------------------------------------------------------------------------------- /doc/src/manual/handling-operating-system-variation.md: -------------------------------------------------------------------------------- 1 | # Handling Operating System Variation 2 | 3 | When dealing with platform libraries, it is often necessary to provide special cases for various 4 | platforms. The variable `Sys.KERNEL` can be used to write these special cases. There are several 5 | functions in the `Sys` module intended to make this easier: `isunix`, `islinux`, `isapple`, 6 | `isbsd`, and `iswindows`. These may be used as follows: 7 | 8 | ```julia 9 | if Sys.iswindows() 10 | some_complicated_thing(a) 11 | end 12 | ``` 13 | 14 | Note that `islinux` and `isapple` are mutually exclusive subsets of `isunix`. Additionally, 15 | there is a macro `@static` which makes it possible to use these functions to conditionally hide 16 | invalid code, as demonstrated in the following examples. 17 | 18 | Simple blocks: 19 | 20 | ``` 21 | ccall((@static Sys.iswindows() ? :_fopen : :fopen), ...) 22 | ``` 23 | 24 | Complex blocks: 25 | 26 | ```julia 27 | @static if Sys.islinux() 28 | some_complicated_thing(a) 29 | else 30 | some_different_thing(a) 31 | end 32 | ``` 33 | 34 | When chaining conditionals (including `if`/`elseif`/`end`), the `@static` must be repeated for 35 | each level (parentheses optional, but recommended for readability): 36 | 37 | ```julia 38 | @static Sys.iswindows() ? :a : (@static Sys.isapple() ? :b : :c) 39 | ``` 40 | -------------------------------------------------------------------------------- /doc/src/manual/index.md: -------------------------------------------------------------------------------- 1 | # The Julia Manual 2 | 3 | * [Introduction](@ref man-introduction) 4 | * [Getting Started](@ref) 5 | * [Variables](@ref) 6 | * [Integers and Floating-Point Numbers](@ref) 7 | * [Mathematical Operations and Elementary Functions](@ref) 8 | * [Complex and Rational Numbers](@ref) 9 | * [Strings](@ref) 10 | * [Functions](@ref) 11 | * [Control Flow](@ref) 12 | * [Scope of Variables](@ref scope-of-variables) 13 | * [Types](@ref man-types) 14 | * [Methods](@ref) 15 | * [Constructors](@ref man-constructors) 16 | * [Conversion and Promotion](@ref conversion-and-promotion) 17 | * [Interfaces](@ref) 18 | * [Modules](@ref) 19 | * [Documentation](@ref) 20 | * [Metaprogramming](@ref) 21 | * [Multi-dimensional Arrays](@ref man-multi-dim-arrays) 22 | * [Linear algebra](@ref) 23 | * [Networking and Streams](@ref) 24 | * [Parallel Computing](@ref) 25 | * [Date and DateTime](@ref) 26 | * [Running External Programs](@ref) 27 | * [Calling C and Fortran Code](@ref) 28 | * [Handling Operating System Variation](@ref) 29 | * [Environment Variables](@ref) 30 | * [Interacting With Julia](@ref) 31 | * [Embedding Julia](@ref) 32 | * [Packages](@ref) 33 | * [Package Development](@ref) 34 | * [Profiling](@ref) 35 | * [Memory allocation analysis](@ref) 36 | * [Stack Traces](@ref) 37 | * [Performance Tips](@ref man-performance-tips) 38 | * [Workflow Tips](@ref man-workflow-tips) 39 | * [Style Guide](@ref) 40 | * [Frequently Asked Questions](@ref) 41 | * [Noteworthy Differences from other Languages](@ref) 42 | * [Unicode Input](@ref) 43 | -------------------------------------------------------------------------------- /doc/src/stdlib/c.md: -------------------------------------------------------------------------------- 1 | # C Interface 2 | 3 | ```@docs 4 | ccall 5 | Core.Intrinsics.cglobal 6 | Base.cfunction 7 | Base.unsafe_convert 8 | Base.cconvert 9 | Base.unsafe_load 10 | Base.unsafe_store! 11 | Base.unsafe_copy!{T}(::Ptr{T}, ::Ptr{T}, ::Any) 12 | Base.unsafe_copy!(::Array, ::Any, ::Array, ::Any, ::Any) 13 | Base.copy!(::Any, ::Any) 14 | Base.copy!(::Any, ::Any, ::Any, ::Any, ::Any) 15 | Base.pointer 16 | Base.unsafe_wrap{T,N}(::Union{Type{Array},Type{Array{T}},Type{Array{T,N}}}, ::Ptr{T}, ::NTuple{N,Int}) 17 | Base.pointer_from_objref 18 | Base.unsafe_pointer_to_objref 19 | Base.disable_sigint 20 | Base.reenable_sigint 21 | Base.systemerror 22 | Core.Ptr 23 | Core.Ref 24 | Base.Cchar 25 | Base.Cuchar 26 | Base.Cshort 27 | Base.Cushort 28 | Base.Cint 29 | Base.Cuint 30 | Base.Clong 31 | Base.Culong 32 | Base.Clonglong 33 | Base.Culonglong 34 | Base.Cintmax_t 35 | Base.Cuintmax_t 36 | Base.Csize_t 37 | Base.Cssize_t 38 | Base.Cptrdiff_t 39 | Base.Cwchar_t 40 | Base.Cfloat 41 | Base.Cdouble 42 | ``` 43 | 44 | # LLVM Interface 45 | 46 | ```@docs 47 | Core.Intrinsics.llvmcall 48 | ``` 49 | -------------------------------------------------------------------------------- /doc/src/stdlib/constants.md: -------------------------------------------------------------------------------- 1 | # [Constants](@id lib-constants) 2 | 3 | ```@docs 4 | Core.nothing 5 | Base.PROGRAM_FILE 6 | Base.ARGS 7 | Base.C_NULL 8 | Base.VERSION 9 | Base.LOAD_PATH 10 | Base.JULIA_HOME 11 | Base.Sys.CPU_CORES 12 | Base.Sys.WORD_SIZE 13 | Base.Sys.KERNEL 14 | Base.Sys.ARCH 15 | Base.Sys.MACHINE 16 | ``` 17 | 18 | See also: 19 | 20 | * [`STDIN`](@ref) 21 | * [`STDOUT`](@ref) 22 | * [`STDERR`](@ref) 23 | * [`ENV`](@ref) 24 | * [`ENDIAN_BOM`](@ref) 25 | * `Libc.MS_ASYNC` 26 | * `Libc.MS_INVALIDATE` 27 | * `Libc.MS_SYNC` 28 | * [`Libdl.DL_LOAD_PATH`](@ref) 29 | * [`Libdl.RTLD_DEEPBIND`](@ref Base.Libdl.RTLD_NOW) 30 | * [`Libdl.RTLD_LOCAL`](@ref Base.Libdl.RTLD_NOW) 31 | * [`Libdl.RTLD_NOLOAD`](@ref Base.Libdl.RTLD_NOW) 32 | * [`Libdl.RTLD_LAZY`](@ref Base.Libdl.RTLD_NOW) 33 | * [`Libdl.RTLD_NOW`](@ref) 34 | * [`Libdl.RTLD_GLOBAL`](@ref Base.Libdl.RTLD_NOW) 35 | * [`Libdl.RTLD_NODELETE`](@ref Base.Libdl.RTLD_NOW) 36 | * [`Libdl.RTLD_FIRST`](@ref Base.Libdl.RTLD_NOW) 37 | -------------------------------------------------------------------------------- /doc/src/stdlib/index.md: -------------------------------------------------------------------------------- 1 | # The Julia Standard Library 2 | 3 | * [Essentials](@ref) 4 | * [Collections and Data Structures](@ref) 5 | * [Mathematics](@ref) 6 | * [Numbers](@ref lib-numbers) 7 | * [Strings](@ref lib-strings) 8 | * [Arrays](@ref lib-arrays) 9 | * [Tasks and Parallel Computing](@ref) 10 | * [Linear Algebra](@ref) 11 | * [Constants](@ref lib-constants) 12 | * [Filesystem](@ref) 13 | * [I/O and Network](@ref) 14 | * [Punctuation](@ref) 15 | * [Sorting and Related Functions](@ref) 16 | * [Package Manager Functions](@ref) 17 | * [Dates and Time](@ref stdlib-dates) 18 | * [Iteration utilities](@ref) 19 | * [Unit Testing](@ref) 20 | * [C Interface](@ref) 21 | * [LLVM Interface](@ref) 22 | * [C Standard Library](@ref) 23 | * [Dynamic Linker](@ref) 24 | * [Profiling](@ref lib-profiling) 25 | * [SIMD Support](@ref) 26 | -------------------------------------------------------------------------------- /doc/src/stdlib/iterators.md: -------------------------------------------------------------------------------- 1 | # Iteration utilities 2 | 3 | ```@docs 4 | Base.Iterators.zip 5 | Base.Iterators.enumerate 6 | Base.Iterators.rest 7 | Base.Iterators.countfrom 8 | Base.Iterators.take 9 | Base.Iterators.drop 10 | Base.Iterators.cycle 11 | Base.Iterators.repeated 12 | Base.Iterators.product 13 | Base.Iterators.flatten 14 | Base.Iterators.partition 15 | ``` 16 | -------------------------------------------------------------------------------- /doc/src/stdlib/libc.md: -------------------------------------------------------------------------------- 1 | # C Standard Library 2 | 3 | ```@docs 4 | Base.Libc.malloc 5 | Base.Libc.calloc 6 | Base.Libc.realloc 7 | Base.Libc.free 8 | Base.Libc.errno 9 | Base.Libc.strerror 10 | Base.Libc.GetLastError 11 | Base.Libc.FormatMessage 12 | Base.Libc.time(::Base.Libc.TmStruct) 13 | Base.Libc.strftime 14 | Base.Libc.strptime 15 | Base.Libc.TmStruct 16 | Base.Libc.flush_cstdio 17 | ``` 18 | -------------------------------------------------------------------------------- /doc/src/stdlib/libdl.md: -------------------------------------------------------------------------------- 1 | # Dynamic Linker 2 | 3 | The names in `Base.Libdl` are not exported and need to be called e.g. as `Libdl.dlopen()`. 4 | 5 | ```@docs 6 | Base.Libdl.dlopen 7 | Base.Libdl.dlopen_e 8 | Base.Libdl.RTLD_NOW 9 | Base.Libdl.dlsym 10 | Base.Libdl.dlsym_e 11 | Base.Libdl.dlclose 12 | Base.Libdl.dlext 13 | Base.Libdl.find_library 14 | Base.Libdl.DL_LOAD_PATH 15 | ``` 16 | -------------------------------------------------------------------------------- /doc/src/stdlib/pkg.md: -------------------------------------------------------------------------------- 1 | # Package Manager Functions 2 | 3 | All package manager functions are defined in the `Pkg` module. None of the `Pkg` module's functions 4 | are exported; to use them, you'll need to prefix each function call with an explicit `Pkg.`, e.g. 5 | [`Pkg.status()`](@ref) or [`Pkg.dir()`](@ref). 6 | 7 | Functions for package development (e.g. `tag`, `publish`, etc.) have been moved to the [PkgDev](https://github.com/JuliaLang/PkgDev.jl) 8 | package. See [PkgDev README](https://github.com/JuliaLang/PkgDev.jl/blob/master/README.md) for 9 | the documentation of those functions. 10 | 11 | ```@docs 12 | Base.Pkg.dir 13 | Base.Pkg.init 14 | Base.Pkg.resolve 15 | Base.Pkg.edit 16 | Base.Pkg.add 17 | Base.Pkg.rm 18 | Base.Pkg.clone 19 | Base.Pkg.setprotocol! 20 | Base.Pkg.available 21 | Base.Pkg.installed 22 | Base.Pkg.status 23 | Base.Pkg.update 24 | Base.Pkg.checkout 25 | Base.Pkg.pin 26 | Base.Pkg.free 27 | Base.Pkg.build 28 | Base.Pkg.test 29 | Base.Pkg.dependents 30 | ``` 31 | -------------------------------------------------------------------------------- /doc/src/stdlib/profile.md: -------------------------------------------------------------------------------- 1 | # [Profiling](@id lib-profiling) 2 | 3 | ```@docs 4 | Base.Profile.@profile 5 | ``` 6 | 7 | The methods in `Base.Profile` are not exported and need to be called e.g. as `Profile.print()`. 8 | 9 | ```@docs 10 | Base.Profile.clear 11 | Base.Profile.print 12 | Base.Profile.init 13 | Base.Profile.fetch 14 | Base.Profile.retrieve 15 | Base.Profile.callers 16 | Base.Profile.clear_malloc_data 17 | ``` 18 | -------------------------------------------------------------------------------- /doc/src/stdlib/simd-types.md: -------------------------------------------------------------------------------- 1 | # SIMD Support 2 | 3 | Type `VecElement{T}` is intended for building libraries of SIMD operations. Practical use of it 4 | requires using `llvmcall`. The type is defined as: 5 | 6 | ```julia 7 | struct VecElement{T} 8 | value::T 9 | end 10 | ``` 11 | 12 | It has a special compilation rule: a homogeneous tuple of `VecElement{T}` maps to an LLVM `vector` 13 | type when `T` is a primitive bits type and the tuple length is in the set {2-6,8-10,16}. 14 | 15 | At `-O3`, the compiler *might* automatically vectorize operations on such tuples. For example, 16 | the following program, when compiled with `julia -O3` generates two SIMD addition instructions 17 | (`addps`) on x86 systems: 18 | 19 | ```julia 20 | const m128 = NTuple{4,VecElement{Float32}} 21 | 22 | function add(a::m128, b::m128) 23 | (VecElement(a[1].value+b[1].value), 24 | VecElement(a[2].value+b[2].value), 25 | VecElement(a[3].value+b[3].value), 26 | VecElement(a[4].value+b[4].value)) 27 | end 28 | 29 | triple(c::m128) = add(add(c,c),c) 30 | 31 | code_native(triple,(m128,)) 32 | ``` 33 | 34 | However, since the automatic vectorization cannot be relied upon, future use will mostly be via 35 | libraries that use `llvmcall`. 36 | -------------------------------------------------------------------------------- /doc/src/stdlib/stacktraces.md: -------------------------------------------------------------------------------- 1 | # StackTraces 2 | 3 | ```@docs 4 | Base.StackTraces.StackFrame 5 | Base.StackTraces.StackTrace 6 | Base.StackTraces.stacktrace 7 | Base.StackTraces.catch_stacktrace 8 | ``` 9 | 10 | The following methods and types in `Base.StackTraces` are not exported and need to be called e.g. 11 | as `StackTraces.lookup(ptr)`. 12 | 13 | ```@docs 14 | Base.StackTraces.lookup 15 | Base.StackTraces.remove_frames! 16 | ``` 17 | -------------------------------------------------------------------------------- /etc/juliarc.jl: -------------------------------------------------------------------------------- 1 | # This file should contain site-specific commands to be executed on Julia startup 2 | # Users may store their own personal commands in the user home directory `homedir()`, in a file named `.juliarc.jl` 3 | 4 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | ## this is a simple wrapper just to forward on known commands to the 2 | ## embedding example with values pulled from Make.inc 3 | SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) 4 | JULIAHOME := $(abspath $(SRCDIR)/..) 5 | BUILDDIR := . 6 | include $(JULIAHOME)/Make.inc 7 | 8 | release: # default target 9 | # forward all variables expected by the embedding example 10 | JULIA:=$(call spawn,$(JULIA_EXECUTABLE)) 11 | BIN:=$(BUILDDIR)/embedding 12 | CC:=$(CC) 13 | include $(SRCDIR)/embedding/Makefile 14 | -------------------------------------------------------------------------------- /examples/ModInts.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | module ModInts 4 | export ModInt 5 | 6 | import Base: +, -, *, /, inv 7 | 8 | struct ModInt{n} <: Integer 9 | k::Int 10 | ModInt{n}(k) where {n} = new(mod(k,n)) 11 | end 12 | 13 | Base.show(io::IO, k::ModInt{n}) where {n} = 14 | print(io, get(io, :compact, false) ? k.k : "$(k.k) mod $n") 15 | 16 | (+)(a::ModInt{n}, b::ModInt{n}) where {n} = ModInt{n}(a.k+b.k) 17 | (-)(a::ModInt{n}, b::ModInt{n}) where {n} = ModInt{n}(a.k-b.k) 18 | (*)(a::ModInt{n}, b::ModInt{n}) where {n} = ModInt{n}(a.k*b.k) 19 | (-)(a::ModInt{n}) where {n} = ModInt{n}(-a.k) 20 | 21 | inv(a::ModInt{n}) where {n} = ModInt{n}(invmod(a.k, n)) 22 | (/)(a::ModInt{n}, b::ModInt{n}) where {n} = a*inv(b) # broaden for non-coprime? 23 | 24 | Base.promote_rule(::Type{ModInt{n}}, ::Type{Int}) where {n} = ModInt{n} 25 | Base.convert(::Type{ModInt{n}}, i::Int) where {n} = ModInt{n}(i) 26 | 27 | end # module 28 | -------------------------------------------------------------------------------- /examples/bubblesort.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | import Base.Sort 4 | struct BubbleSortAlg <: Sort.Algorithm end 5 | const BubbleSort = BubbleSortAlg() 6 | 7 | function Base.sort!(v::AbstractVector, lo::Int, hi::Int, ::BubbleSortAlg, o::Sort.Ordering) 8 | while true 9 | clean = true 10 | for i = lo:hi-1 11 | if Sort.lt(o, v[i+1], v[i]) 12 | v[i+1], v[i] = v[i], v[i+1] 13 | clean = false 14 | end 15 | end 16 | clean && break 17 | end 18 | return v 19 | end 20 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/README: -------------------------------------------------------------------------------- 1 | This is a proof-of-concept that uses ZeroMQ as transport. 2 | It uses a star topology as opposed to the native mesh network. 3 | 4 | Package ZMQ must be installed. All workers only run on localhost. 5 | 6 | All Julia nodes only connect to a "broker" process that listens on known ports 7 | 8100 and 8101 via ZMQ sockets. 8 | 9 | 10 | All commands must be run from `examples/clustermanager/0mq` directory 11 | 12 | First, start the broker. In a new console type: 13 | julia broker.jl 14 | 15 | This does not return. 16 | 17 | Next, start a Julia REPL and type: 18 | include("ZMQCM.jl") 19 | ZMQCM.start_master(4) # start with four workers 20 | 21 | 22 | Alternatively, head.jl, a test script could be run. It just launches the requested number of workers, 23 | executes a simple command on all of them and exits. 24 | julia head.jl 4 25 | 26 | NOTE: As stated this is a proof-of-concept. A real Julia cluster using ZMQ will probably use 27 | different ZMQ socket types and optimize the transport. 28 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/broker.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("ZMQCM.jl") 4 | start_broker() 5 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/head.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("ZMQCM.jl") 4 | 5 | # @spawn run(`julia broker.jl`) 6 | 7 | start_master(parse(Int,ARGS[1])) 8 | 9 | resp = pmap(x -> myid() *2, [1:nworkers()]) 10 | 11 | println(resp) 12 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/worker.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("ZMQCM.jl") 4 | 5 | start_worker(parse(Int,ARGS[1]), ARGS[2]) 6 | -------------------------------------------------------------------------------- /examples/clustermanager/simple/README: -------------------------------------------------------------------------------- 1 | This is a simple proof-of-concept that uses UNIX domain sockets as transport. 2 | 3 | All commands must be run from `examples/clustermanager/simple` directory 4 | 5 | Start a Julia REPL and type: 6 | include("UnixDomainCM.jl") 7 | addprocs(UnixDomainCM(4)) # start with four workers 8 | 9 | Alternatively, head.jl, a test script could be run. It just launches the requested number of workers, 10 | executes a simple command on all of them and exits. 11 | julia head.jl 4 12 | 13 | -------------------------------------------------------------------------------- /examples/clustermanager/simple/head.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("UnixDomainCM.jl") 4 | 5 | addprocs(UnixDomainCM(parse(Int,ARGS[1]))) 6 | resp = pmap(x -> myid() *2, [1:nworkers()]) 7 | println(resp) 8 | -------------------------------------------------------------------------------- /examples/clustermanager/simple/test_simple.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | cmanpath = joinpath(@__DIR__, "UnixDomainCM.jl") 4 | include(cmanpath) 5 | 6 | npids = addprocs(UnixDomainCM(2)) 7 | assert(length(npids) == 2) 8 | test_pids = [remotecall_fetch(myid, x) for x in npids] 9 | assert(npids == test_pids) 10 | rmprocs(npids; waitfor=1.0) 11 | 12 | exit(0) 13 | -------------------------------------------------------------------------------- /examples/dictchannel.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | import Base: put!, wait, isready, take!, fetch 4 | 5 | mutable struct DictChannel <: AbstractChannel 6 | d::Dict 7 | cond_take::Condition # waiting for data to become available 8 | DictChannel() = new(Dict(), Condition()) 9 | end 10 | 11 | function put!(D::DictChannel, k, v) 12 | D.d[k] = v 13 | notify(D.cond_take) 14 | D 15 | end 16 | 17 | function take!(D::DictChannel, k) 18 | v=fetch(D,k) 19 | delete!(D.d, k) 20 | v 21 | end 22 | 23 | isready(D::DictChannel) = length(D.d) > 1 24 | isready(D::DictChannel, k) = haskey(D.d,k) 25 | function fetch(D::DictChannel, k) 26 | wait(D,k) 27 | D.d[k] 28 | end 29 | 30 | function wait(D::DictChannel, k) 31 | while !isready(D, k) 32 | wait(D.cond_take) 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /examples/embedding/.gitignore: -------------------------------------------------------------------------------- 1 | /embedding 2 | /embedding-debug 3 | -------------------------------------------------------------------------------- /examples/embedding/embedding-test.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # tests the output of the embedding example is correct 4 | using Base.Test 5 | 6 | @test length(ARGS) == 1 7 | let 8 | stdout = Pipe() 9 | stderr = Pipe() 10 | p = spawn(pipeline(Cmd(ARGS), stdin=DevNull, stdout=stdout, stderr=stderr)) 11 | close(stdout.in) 12 | close(stderr.in) 13 | stderr_task = @async readlines(stderr) 14 | lines = readlines(stdout) 15 | @test length(lines) == 6 16 | @test parse(Float64, lines[1]) ≈ sqrt(2) 17 | lines = wait(stderr_task) 18 | @test lines == ["UndefVarError(:this_function_does_not_exist)"] 19 | @test success(p) 20 | end 21 | -------------------------------------------------------------------------------- /examples/ndgrid.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | ndgrid(v::AbstractVector) = copy(v) 4 | 5 | function ndgrid(v1::AbstractVector{T}, v2::AbstractVector{T}) where T 6 | m, n = length(v1), length(v2) 7 | v1 = reshape(v1, m, 1) 8 | v2 = reshape(v2, 1, n) 9 | (repmat(v1, 1, n), repmat(v2, m, 1)) 10 | end 11 | 12 | function ndgrid_fill(a, v, s, snext) 13 | for j = 1:length(a) 14 | a[j] = v[div(rem(j-1, snext), s)+1] 15 | end 16 | end 17 | 18 | function ndgrid(vs::AbstractVector{T}...) where T 19 | n = length(vs) 20 | sz = map(length, vs) 21 | out = ntuple(i->Array{T}(sz), n) 22 | s = 1 23 | for i=1:n 24 | a = out[i]::Array 25 | v = vs[i] 26 | snext = s*size(a,i) 27 | ndgrid_fill(a, v, s, snext) 28 | s = snext 29 | end 30 | out 31 | end 32 | 33 | meshgrid(v::AbstractVector) = meshgrid(v, v) 34 | 35 | function meshgrid(vx::AbstractVector{T}, vy::AbstractVector{T}) where T 36 | m, n = length(vy), length(vx) 37 | vx = reshape(vx, 1, n) 38 | vy = reshape(vy, m, 1) 39 | (repmat(vx, m, 1), repmat(vy, 1, n)) 40 | end 41 | 42 | function meshgrid(vx::AbstractVector{T}, vy::AbstractVector{T}, 43 | vz::AbstractVector{T}) where T 44 | m, n, o = length(vy), length(vx), length(vz) 45 | vx = reshape(vx, 1, n, 1) 46 | vy = reshape(vy, m, 1, 1) 47 | vz = reshape(vz, 1, 1, o) 48 | om = ones(Int, m) 49 | on = ones(Int, n) 50 | oo = ones(Int, o) 51 | (vx[om, :, oo], vy[:, on, oo], vz[om, on, :]) 52 | end 53 | -------------------------------------------------------------------------------- /examples/queens.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # n-queens (nqueens) solver, for nsquaresx-by-nsquaresy board 4 | 5 | struct Queen 6 | x::Int 7 | y::Int 8 | end 9 | hitshorz(queena, queenb) = queena.x == queenb.x 10 | hitsvert(queena, queenb) = queena.y == queenb.y 11 | hitsdiag(queena, queenb) = abs(queena.x - queenb.x) == abs(queena.y - queenb.y) 12 | hitshvd(qa, qb) = hitshorz(qa, qb) || hitsvert(qa, qb) || hitsdiag(qa, qb) 13 | hitsany(testqueen, queens) = any(q -> hitshvd(testqueen, q), queens) 14 | 15 | function trysolve(nsquaresx, nsquaresy, nqueens, presqueens = ()) 16 | nqueens == 0 && return presqueens 17 | for xsquare in 1:nsquaresx 18 | for ysquare in 1:nsquaresy 19 | testqueen = Queen(xsquare, ysquare) 20 | if !hitsany(testqueen, presqueens) 21 | tryqueens = (presqueens..., testqueen) 22 | maybesol = trysolve(nsquaresx, nsquaresy, nqueens - 1, tryqueens) 23 | maybesol !== nothing && return maybesol 24 | end 25 | end 26 | end 27 | return nothing 28 | end 29 | -------------------------------------------------------------------------------- /examples/quine.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | x="println(\"# This file is a part of Julia. License is MIT: https://julialang.org/license\\n\\nx=\$(repr(x))\\n\$x\")" 4 | println("# This file is a part of Julia. License is MIT: https://julialang.org/license\n\nx=$(repr(x))\n$x") 5 | -------------------------------------------------------------------------------- /examples/time.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | module Time 4 | export TimeDelta 5 | 6 | import Base.show, Base.+, Base.-, Base.convert, Base.promote_rule 7 | 8 | struct TimeDelta{p} 9 | v::Int64 10 | end 11 | 12 | const PREFIXES = [ 13 | "yocto", "zepto", "atto", "femto", "pico", "nano", "micro", "milli", 14 | "", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta", 15 | ] 16 | const ZERO_INDEX = 9 17 | const MAX_INDEX = 17 18 | 19 | function show(io::IO, x::TimeDelta{p}) where p 20 | k = max(1,min(MAX_INDEX,fld(p,3)+ZERO_INDEX)) 21 | r = p-3(k-ZERO_INDEX) 22 | prefix = PREFIXES[k] 23 | if r == 0 24 | s = x.v == 1 ? "" : "s" 25 | print(io, "$(x.v) $(prefix)second$s") 26 | elseif r > 0 27 | print(io, "$(x.v*10^r) $(prefix)seconds") 28 | else 29 | print(io, "$(x.v/10^-r) $(prefix)seconds") 30 | end 31 | end 32 | 33 | convert(::Type{TimeDelta{p}}, x::TimeDelta{q}) where {p,q} = 34 | TimeDelta{p}(p <= q ? x.v*10^(q-p) : div(x.v,10^(p-q))) 35 | 36 | promote_rule(::Type{TimeDelta{p}}, ::Type{TimeDelta{q}}) where {p,q} = TimeDelta{min(p,q)} 37 | 38 | (-)(x::TimeDelta{p}) where {p} = TimeDelta{p}(-x.v) 39 | (+)(x::TimeDelta{p}, y::TimeDelta{p}) where {p} = TimeDelta{p}(x.v+y.v) 40 | (-)(x::TimeDelta{p}, y::TimeDelta{p}) where {p} = TimeDelta{p}(x.v-y.v) 41 | 42 | (+)(x::TimeDelta, y::TimeDelta) = +(promote(x,y)...) 43 | (-)(x::TimeDelta, y::TimeDelta) = -(promote(x,y)...) 44 | 45 | end # module 46 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /*.do 3 | /*.exe 4 | /*.obj 5 | /*.lib 6 | /*.pdb 7 | /*.exp 8 | 9 | /boot.j.inc 10 | /julia_flisp.boot 11 | /julia_flisp.boot.inc 12 | /flisp.boot.inc 13 | 14 | /libjulia-debug.a 15 | /libjulia-debug.so 16 | /libjulia-debug.dylib 17 | /libjulia-release.a 18 | /libjulia-release.so 19 | /libjulia-release.dylib 20 | /julia_version.h 21 | -------------------------------------------------------------------------------- /src/bin2hex.scm: -------------------------------------------------------------------------------- 1 | (define (read-u8) (io.read *input-stream* 'uint8)) 2 | (define modulo mod) 3 | (define display princ) 4 | (let loop ((b (read-u8)) 5 | (i 0)) 6 | (if (not (eof-object? b)) 7 | (begin 8 | (if (> i 0) 9 | (display ", ")) 10 | (display "0x") (display (number->string b 16)) 11 | (if (= 0 (modulo (+ 1 i) 16)) 12 | (newline)) 13 | (loop (read-u8) (+ 1 i))))) 14 | (newline) 15 | -------------------------------------------------------------------------------- /src/builtin_proto.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_BUILTIN_PROTO_H 4 | #define JL_BUILTIN_PROTO_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | // declarations for julia-callable builtin functions 11 | 12 | #ifdef DEFINE_BUILTIN_GLOBALS 13 | #define DECLARE_BUILTIN(name) \ 14 | JL_CALLABLE(jl_f_##name); \ 15 | jl_value_t *jl_builtin_##name 16 | #else 17 | #define DECLARE_BUILTIN(name) \ 18 | JL_CALLABLE(jl_f_##name); \ 19 | extern jl_value_t *jl_builtin_##name 20 | #endif 21 | 22 | DECLARE_BUILTIN(throw); DECLARE_BUILTIN(is); 23 | DECLARE_BUILTIN(typeof); DECLARE_BUILTIN(sizeof); 24 | DECLARE_BUILTIN(issubtype); DECLARE_BUILTIN(isa); 25 | DECLARE_BUILTIN(_apply); DECLARE_BUILTIN(_apply_pure); 26 | DECLARE_BUILTIN(_apply_latest); 27 | DECLARE_BUILTIN(isdefined); DECLARE_BUILTIN(nfields); 28 | DECLARE_BUILTIN(tuple); DECLARE_BUILTIN(svec); 29 | DECLARE_BUILTIN(getfield); DECLARE_BUILTIN(setfield); 30 | DECLARE_BUILTIN(fieldtype); DECLARE_BUILTIN(arrayref); 31 | DECLARE_BUILTIN(arrayset); DECLARE_BUILTIN(arraysize); 32 | DECLARE_BUILTIN(apply_type); DECLARE_BUILTIN(applicable); 33 | DECLARE_BUILTIN(invoke); DECLARE_BUILTIN(_expr); 34 | DECLARE_BUILTIN(typeassert); 35 | 36 | JL_CALLABLE(jl_f_invoke_kwsorter); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/codegen_shared.h: -------------------------------------------------------------------------------- 1 | enum AddressSpace { 2 | Generic = 0, 3 | Tracked = 10, Derived = 11, CalleeRooted = 12, 4 | FirstSpecial = Tracked, 5 | LastSpecial = CalleeRooted, 6 | }; 7 | 8 | #define JLCALL_CC (CallingConv::ID)36 9 | #define JLCALL_F_CC (CallingConv::ID)37 10 | -------------------------------------------------------------------------------- /src/debuginfo.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | // Declarations for debuginfo.cpp 4 | 5 | extern int jl_DI_for_fptr(uint64_t fptr, uint64_t *symsize, int64_t *slide, int64_t *section_slide, 6 | const object::ObjectFile **object, 7 | llvm::DIContext **context); 8 | 9 | extern bool jl_dylib_DI_for_fptr(size_t pointer, const object::ObjectFile **object, llvm::DIContext **context, 10 | int64_t *slide, int64_t *section_slide, 11 | bool onlySysImg, bool *isSysImg, void **saddr, char **name, char **filename); 12 | -------------------------------------------------------------------------------- /src/file_constants.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #include 4 | #include 5 | #include 6 | const JL_DUMMY = 0 7 | const JL_O_WRONLY = O_WRONLY 8 | const JL_O_RDONLY = O_RDONLY 9 | const JL_O_RDWR = O_RDWR 10 | const JL_O_APPEND = O_APPEND 11 | const JL_O_CREAT = O_CREAT 12 | const JL_O_EXCL = O_EXCL 13 | const JL_O_TRUNC = O_TRUNC 14 | #ifdef O_TEMPORARY 15 | const JL_O_TEMPORARY = O_TEMPORARY 16 | #endif 17 | #ifdef O_SHORT_LIVED 18 | const JL_O_SHORT_LIVED = O_SHORT_LIVED 19 | #endif 20 | #ifdef O_SEQUENTIAL 21 | const JL_O_SEQUENTIAL = O_SEQUENTIAL 22 | #endif 23 | #ifdef O_RANDOM 24 | const JL_O_RANDOM = O_RANDOM 25 | #endif 26 | #ifdef O_NOCTTY 27 | const JL_O_NOCTTY = O_NOCTTY 28 | #endif 29 | -------------------------------------------------------------------------------- /src/fix_llvm_assert.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | // Include this file after every blocks of LLVM includes to set the assertion back. 4 | 5 | #ifdef NDEBUG 6 | # ifndef JL_NDEBUG 7 | # undef NDEBUG 8 | # include 9 | // Set NDEBUG back so that we can include another LLVM header right after 10 | # define NDEBUG 11 | # endif 12 | #else 13 | # ifdef JL_NDEBUG 14 | # undef JL_NDEBUG 15 | # endif 16 | #endif 17 | -------------------------------------------------------------------------------- /src/flisp/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /*.a 3 | /*.do 4 | /*.exe 5 | /*.obj 6 | /*.lib 7 | /*.pdb 8 | /*.exp 9 | /*.map 10 | /flisp 11 | /flisp-debug 12 | /flisp-release 13 | -------------------------------------------------------------------------------- /src/flisp/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp flisp.boot flisp.boot.bak 4 | 5 | echo "Creating stage 0 boot file..." 6 | #../../branches/interpreter/femtolisp/flisp mkboot0.lsp system.lsp compiler.lsp > flisp.boot.new 7 | ./flisp mkboot0.lsp system.lsp compiler.lsp > flisp.boot.new 8 | mv flisp.boot.new flisp.boot 9 | 10 | echo "Creating stage 1 boot file..." 11 | ./flisp mkboot1.lsp 12 | 13 | echo "Testing..." 14 | make test 15 | -------------------------------------------------------------------------------- /src/flisp/equalhash.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "flisp.h" 9 | #include "equalhash.h" 10 | 11 | #include "htable.inc" 12 | 13 | #define _equal_lispvalue_(x, y, ctx) \ 14 | equal_lispvalue((fl_context_t*)ctx, (value_t)(x), (value_t)(y)) 15 | #define _hash_lispvalue_(x, ctx) \ 16 | hash_lispvalue((fl_context_t*)ctx, (value_t)(x)) 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | HTIMPL_R(equalhash, _hash_lispvalue_, _equal_lispvalue_) 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /src/flisp/equalhash.h: -------------------------------------------------------------------------------- 1 | #ifndef JL_EQUALHASH_H 2 | #define JL_EQUALHASH_H 3 | 4 | #include "htable.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | HTPROT_R(equalhash) 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/flisp/julia_charmap.h: -------------------------------------------------------------------------------- 1 | /* Array of {original codepoint, replacement codepoint} normalizations 2 | to perform on Julia identifiers, to canonicalize characters that 3 | are both easily confused and easily inputted by accident. */ 4 | static const uint32_t charmap[][2] = { 5 | { 0x025B, 0x03B5 }, // latin small letter open e -> greek small letter epsilon 6 | { 0x00B5, 0x03BC }, // micro sign -> greek small letter mu 7 | }; 8 | -------------------------------------------------------------------------------- /src/flisp/mkboot0.lsp: -------------------------------------------------------------------------------- 1 | ; -*- scheme -*- 2 | 3 | (if (not (bound? 'top-level-value)) (set! top-level-value %eval)) 4 | (if (not (bound? 'set-top-level-value!)) (set! set-top-level-value! set)) 5 | (if (not (bound? 'eof-object?)) (set! eof-object? (lambda (x) #f))) 6 | 7 | ;(load "compiler.lsp") 8 | 9 | (define (compile-file inf) 10 | (let ((in (file inf :read))) 11 | (let next ((E (read in))) 12 | (if (not (io.eof? in)) 13 | (begin (print (compile-thunk (expand E))) 14 | (princ "\n") 15 | (next (read in))))) 16 | (io.close in))) 17 | 18 | (define (do-boot0) 19 | (for-each (lambda (file) 20 | (compile-file file)) 21 | (cdr *argv*))) 22 | 23 | (do-boot0) 24 | -------------------------------------------------------------------------------- /src/flisp/mkboot1.lsp: -------------------------------------------------------------------------------- 1 | ; -*- scheme -*- 2 | 3 | (load "system.lsp") 4 | (load "compiler.lsp") 5 | (make-system-image "flisp.boot") 6 | -------------------------------------------------------------------------------- /src/gen_sysimg_symtab.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # script to generate tables of common symbols from a system image 4 | # steps to rerun this: 5 | # 1. empty the contents of common_symbols*.inc 6 | # 2. modify dump.c to write symbols in a clearly marked format (#define GEN_SYMTAB_MODE) 7 | # 3. build sys.ji 8 | # 4. cd src && ../julia gen_sysimg_symtab.jl ../usr/lib/julia/sys.ji 9 | 10 | fname = ARGS[1] 11 | 12 | io,_ = open(pipeline(`strings -n 4 $fname`, 13 | `tr -d "() \t"`, 14 | `grep JJJ`, 15 | `sort`, `uniq -c`, `sort -g -r`, 16 | `head -n 315`)) # 63 + 252 17 | 18 | function outputline(io, line) 19 | row = split(line, " ", keep=false) 20 | println(io, "jl_symbol(\"", row[2][4:end], "\"),") 21 | end 22 | 23 | lines = eachline(io) 24 | 25 | open(f->foreach(l->outputline(f,l), Base.Iterators.take(lines,63)), "common_symbols1.inc", "w") 26 | open(f->foreach(l->outputline(f,l), lines), "common_symbols2.inc", "w") 27 | -------------------------------------------------------------------------------- /src/julia.expmap: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | __asan*; 4 | __stack_chk_guard; 5 | asprintf; 6 | bitvector_*; 7 | ev_break; 8 | get_exename; 9 | getlocalip; 10 | int32hash; 11 | int64hash; 12 | int64to32hash; 13 | ios_*; 14 | iswprint; 15 | jl_*; 16 | rec_backtrace; 17 | julia_*; 18 | libsupport_init; 19 | localtime_r; 20 | memhash; 21 | memhash32; 22 | memhash32_seed; 23 | memhash_seed; 24 | restore_arg_area_loc; 25 | restore_signals; 26 | rl_clear_input; 27 | save_arg_area_loc; 28 | u8_*; 29 | uv_*; 30 | add_library_mapping; 31 | utf8proc_*; 32 | jlbacktrace; 33 | julia_type_to_llvm; 34 | _IO_stdin_used; 35 | __ZN4llvm23createLowerSimdLoopPassEv; 36 | 37 | /* freebsd */ 38 | environ; 39 | __progname; 40 | 41 | local: 42 | *; 43 | }; 44 | -------------------------------------------------------------------------------- /src/llvm-version.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #include 4 | #include "fix_llvm_assert.h" 5 | 6 | // The LLVM version used, JL_LLVM_VERSION, is represented as a 5-digit integer 7 | // of the form ABBCC, where A is the major version, B is minor, and C is patch. 8 | // So for example, LLVM 3.7.0 is 30700. 9 | #define JL_LLVM_VERSION (LLVM_VERSION_MAJOR * 10000 + LLVM_VERSION_MINOR * 100 \ 10 | + LLVM_VERSION_PATCH) 11 | 12 | #if JL_LLVM_VERSION < 30901 13 | #error Only LLVM versions >= 3.9.1 are supported by Julia 14 | #endif 15 | -------------------------------------------------------------------------------- /src/mk_julia_flisp_boot.scm: -------------------------------------------------------------------------------- 1 | (set! lastpwd (path.cwd)) 2 | (path.cwd (cadr *argv*)) 3 | (load (caddr *argv*)) 4 | (path.cwd lastpwd) 5 | (make-system-image (cadddr *argv*)) 6 | -------------------------------------------------------------------------------- /src/support/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /*.do 3 | /*.obj 4 | /*.lib 5 | /*.pdb 6 | /libsupport.a 7 | /libsupport-debug.a 8 | -------------------------------------------------------------------------------- /src/support/MurmurHash3.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef JL_MURMURHASH3_H 6 | #define JL_MURMURHASH3_H 7 | 8 | //----------------------------------------------------------------------------- 9 | // Platform-specific functions and macros 10 | #include 11 | 12 | //----------------------------------------------------------------------------- 13 | 14 | void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ); 15 | 16 | void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out ); 17 | 18 | void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out ); 19 | 20 | //----------------------------------------------------------------------------- 21 | 22 | #endif // MURMURHASH3_H 23 | -------------------------------------------------------------------------------- /src/support/Windows.mk: -------------------------------------------------------------------------------- 1 | !INCLUDE <..\..\Windows.inc> 2 | 3 | .SUFFIXES: .c 4 | 5 | NAME = support 6 | 7 | HEADERS = \ 8 | arraylist.h \ 9 | bitvector.h \ 10 | dirpath.h \ 11 | dtypes.h \ 12 | hashing.h \ 13 | htable.h \ 14 | ios.h \ 15 | libsupport.h \ 16 | MurmurHash3.h \ 17 | ptrhash.h \ 18 | strtod.h \ 19 | timefuncs.h \ 20 | utf8.h \ 21 | utils.h \ 22 | platform.h 23 | 24 | OBJECTS = \ 25 | hashing.obj \ 26 | timefuncs.obj \ 27 | strtod.obj \ 28 | ptrhash.obj \ 29 | operators.obj \ 30 | utf8.obj \ 31 | ios.obj \ 32 | htable.obj \ 33 | bitvector.obj \ 34 | int2str.obj \ 35 | libsupportinit.obj \ 36 | arraylist.obj \ 37 | asprintf.obj \ 38 | dirname.obj 39 | 40 | INCLUDE = $(INCLUDE);$(MAKEDIR)\..\..\deps\libuv\include 41 | CFLAGS = $(CFLAGS) -D_CRT_SECURE_NO_WARNINGS -DLIBRARY_EXPORTS 42 | 43 | default: lib$(NAME).lib 44 | 45 | lib$(NAME).lib: $(OBJECTS) 46 | $(AR) /OUT:$@ $(OBJECTS) 47 | 48 | .c.obj: 49 | $(CC) $(CFLAGS) $< 50 | 51 | # vim: noexpandtab:ts=4:sw=4: 52 | 53 | -------------------------------------------------------------------------------- /src/support/_longjmp.win64.S: -------------------------------------------------------------------------------- 1 | #define CNAME jl_longjmp 2 | #include "ENTRY.amd64.h" 3 | mov rbx,QWORD PTR [rcx+8] 4 | mov rsp,QWORD PTR [rcx+16] 5 | mov rbp,QWORD PTR [rcx+24] 6 | mov rsi,QWORD PTR [rcx+32] 7 | mov rdi,QWORD PTR [rcx+40] 8 | mov r12,QWORD PTR [rcx+48] 9 | mov r13,QWORD PTR [rcx+56] 10 | mov r14,QWORD PTR [rcx+64] 11 | mov r15,QWORD PTR [rcx+72] 12 | mov r8, QWORD PTR [rcx+80] 13 | movaps xmm6,XMMWORD PTR [rcx+96] 14 | movaps xmm7,XMMWORD PTR [rcx+112] 15 | movaps xmm8,XMMWORD PTR [rcx+128] 16 | movaps xmm9,XMMWORD PTR [rcx+144] 17 | movaps xmm10,XMMWORD PTR [rcx+160] 18 | movaps xmm11,XMMWORD PTR [rcx+176] 19 | movaps xmm12,XMMWORD PTR [rcx+192] 20 | movaps xmm13,XMMWORD PTR [rcx+208] 21 | movaps xmm14,XMMWORD PTR [rcx+224] 22 | movaps xmm15,XMMWORD PTR [rcx+240] 23 | mov eax,edx 24 | test eax,eax 25 | jne a 26 | inc eax 27 | a: mov QWORD PTR [rsp],r8 28 | ret 29 | #include "END.h" 30 | -------------------------------------------------------------------------------- /src/support/_setjmp.win64.S: -------------------------------------------------------------------------------- 1 | #define CNAME jl_setjmp 2 | #include "ENTRY.amd64.h" 3 | mov rdx,QWORD PTR [rsp] 4 | mov QWORD PTR [rcx],0 5 | mov QWORD PTR [rcx+8],rbx 6 | mov QWORD PTR [rcx+16],rsp 7 | mov QWORD PTR [rcx+24],rbp 8 | mov QWORD PTR [rcx+32],rsi 9 | mov QWORD PTR [rcx+40],rdi 10 | mov QWORD PTR [rcx+48],r12 11 | mov QWORD PTR [rcx+56],r13 12 | mov QWORD PTR [rcx+64],r14 13 | mov QWORD PTR [rcx+72],r15 14 | mov QWORD PTR [rcx+80],rdx 15 | mov QWORD PTR [rcx+88],0 16 | movaps XMMWORD PTR [rcx+96],xmm6 17 | movaps XMMWORD PTR [rcx+112],xmm7 18 | movaps XMMWORD PTR [rcx+128],xmm8 19 | movaps XMMWORD PTR [rcx+144],xmm9 20 | movaps XMMWORD PTR [rcx+160],xmm10 21 | movaps XMMWORD PTR [rcx+176],xmm11 22 | movaps XMMWORD PTR [rcx+192],xmm12 23 | movaps XMMWORD PTR [rcx+208],xmm13 24 | movaps XMMWORD PTR [rcx+224],xmm14 25 | movaps XMMWORD PTR [rcx+240],xmm15 26 | xor rax,rax 27 | ret 28 | #include "END.h" 29 | -------------------------------------------------------------------------------- /src/support/arraylist.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_ARRAYLIST_H 4 | #define JL_ARRAYLIST_H 5 | 6 | #define AL_N_INLINE 29 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct { 13 | size_t len; 14 | size_t max; 15 | void **items; 16 | void *_space[AL_N_INLINE]; 17 | } arraylist_t; 18 | 19 | arraylist_t *arraylist_new(arraylist_t *a, size_t size); 20 | void arraylist_free(arraylist_t *a); 21 | 22 | void arraylist_push(arraylist_t *a, void *elt); 23 | void *arraylist_pop(arraylist_t *a); 24 | void arraylist_grow(arraylist_t *a, size_t n); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/support/bitvector.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | /* 4 | bit vector primitives 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "dtypes.h" 12 | #include "bitvector.h" 13 | 14 | #ifdef _OS_WINDOWS_ 15 | #include 16 | #endif 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz, 23 | int initzero) 24 | { 25 | uint32_t *p; 26 | size_t sz = ((newsz+31)>>5) * sizeof(uint32_t); 27 | p = (uint32_t*)LLT_REALLOC(b, sz); 28 | if (p == NULL) return NULL; 29 | if (initzero && newsz>oldsz) { 30 | size_t osz = ((oldsz+31)>>5) * sizeof(uint32_t); 31 | memset(&p[osz/sizeof(uint32_t)], 0, sz-osz); 32 | } 33 | return p; 34 | } 35 | 36 | uint32_t *bitvector_new(uint64_t n, int initzero) 37 | { 38 | return bitvector_resize(NULL, 0, n, initzero); 39 | } 40 | 41 | size_t bitvector_nwords(uint64_t nbits) 42 | { 43 | return ((nbits+31)>>5); 44 | } 45 | 46 | void bitvector_set(uint32_t *b, uint64_t n, uint32_t c) 47 | { 48 | if (c) 49 | b[n>>5] |= (1<<(n&31)); 50 | else 51 | b[n>>5] &= ~(1<<(n&31)); 52 | } 53 | 54 | uint32_t bitvector_get(uint32_t *b, uint64_t n) 55 | { 56 | return b[n>>5] & (1<<(n&31)); 57 | } 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /src/support/bitvector.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_BITVECTOR_H 4 | #define JL_BITVECTOR_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | JL_DLLEXPORT uint32_t *bitvector_new(uint64_t n, int initzero); 11 | JL_DLLEXPORT 12 | uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz, 13 | int initzero); 14 | size_t bitvector_nwords(uint64_t nbits); 15 | JL_DLLEXPORT void bitvector_set(uint32_t *b, uint64_t n, uint32_t c); 16 | JL_DLLEXPORT uint32_t bitvector_get(uint32_t *b, uint64_t n); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/support/dirpath.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_DIRPATH_H 4 | #define JL_DIRPATH_H 5 | 6 | #ifdef _OS_WINDOWS_ 7 | #define PATHSEPSTRING "\\" 8 | #define PATHLISTSEPSTRING ";" 9 | #if defined(_MSC_VER) || defined(_COMPILER_CLANG_) 10 | #define PATH_MAX MAX_PATH 11 | #endif 12 | #else 13 | #define PATHSEPSTRING "/" 14 | #define PATHLISTSEPSTRING ":" 15 | #ifndef PATH_MAX // many platforms don't have a max path, we define one anyways 16 | #define PATH_MAX 1024 17 | #endif 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/support/hashing.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_HASHING_H 4 | #define JL_HASHING_H 5 | 6 | #include "utils.h" 7 | #include "dtypes.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | uint_t nextipow2(uint_t i); 14 | JL_DLLEXPORT uint32_t int32hash(uint32_t a); 15 | JL_DLLEXPORT uint64_t int64hash(uint64_t key); 16 | JL_DLLEXPORT uint32_t int64to32hash(uint64_t key); 17 | #ifdef _P64 18 | #define inthash int64hash 19 | #else 20 | #define inthash int32hash 21 | #endif 22 | JL_DLLEXPORT uint64_t memhash(const char *buf, size_t n); 23 | JL_DLLEXPORT uint64_t memhash_seed(const char *buf, size_t n, uint32_t seed); 24 | JL_DLLEXPORT uint32_t memhash32(const char *buf, size_t n); 25 | JL_DLLEXPORT uint32_t memhash32_seed(const char *buf, size_t n, uint32_t seed); 26 | 27 | #ifdef _P64 28 | STATIC_INLINE uint64_t bitmix(uint64_t a, uint64_t b) 29 | { 30 | return int64hash(a^bswap_64(b)); 31 | } 32 | #else 33 | STATIC_INLINE uint32_t bitmix(uint32_t a, uint32_t b) 34 | { 35 | return int64to32hash((((uint64_t)a) << 32) | (uint64_t)b); 36 | } 37 | #endif 38 | #define bitmix(a, b) (bitmix)((uintptr_t)(a), (uintptr_t)(b)) 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/support/libsupport.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_LIBSUPPORT_H 4 | #define JL_LIBSUPPORT_H 5 | 6 | #include "platform.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include "dtypes.h" 12 | #include "utils.h" 13 | #include "utf8.h" 14 | #include "ios.h" 15 | #include "timefuncs.h" 16 | #include "hashing.h" 17 | #include "ptrhash.h" 18 | #include "bitvector.h" 19 | #include "dirpath.h" 20 | #include "strtod.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | JL_DLLEXPORT void libsupport_init(void); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/support/libsupportinit.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #include 4 | #include "libsupport.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | static int isInitialized = 0; 11 | 12 | void libsupport_init(void) 13 | { 14 | if (!isInitialized) { 15 | #ifdef _OS_WINDOWS_ 16 | SetConsoleCP(1252); // ANSI Latin1; Western European (Windows) 17 | #endif 18 | setlocale(LC_ALL, ""); // set to user locale 19 | setlocale(LC_NUMERIC, "C"); // use locale-independent numeric formats 20 | 21 | ios_init_stdstreams(); 22 | 23 | isInitialized=1; 24 | } 25 | } 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /src/support/ptrhash.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | /* 4 | pointer hash table 5 | optimized for storing info about particular values 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "dtypes.h" 15 | #include "hashing.h" 16 | #include "ptrhash.h" 17 | 18 | #define OP_EQ(x,y) ((x)==(y)) 19 | 20 | #include "htable.inc" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | HTIMPL(ptrhash, inthash, OP_EQ) 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /src/support/ptrhash.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_PTRHASH_H 4 | #define JL_PTRHASH_H 5 | 6 | #include "htable.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | HTPROT(ptrhash) 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/support/strtod.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_STRTOD_H 4 | #define JL_STRTOD_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr); 11 | JL_DLLEXPORT float jl_strtof_c(const char *nptr, char **endptr); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/support/timefuncs.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_TIMEFUNCS_H 4 | #define JL_TIMEFUNCS_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | struct jl_timeval { 11 | int64_t sec; /* seconds */ 12 | int64_t usec; /* microseconds */ 13 | }; 14 | 15 | JL_DLLEXPORT int jl_gettimeofday(struct jl_timeval *jtv); 16 | JL_DLLEXPORT double jl_clock_now(void); 17 | void sleep_ms(int ms); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/threading.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef THREADING_H 4 | #define THREADING_H 5 | 6 | #include 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #include "threadgroup.h" 12 | #include "julia.h" 13 | 14 | #define PROFILE_JL_THREADING 1 15 | 16 | // thread ID 17 | extern jl_ptls_t *jl_all_tls_states; 18 | extern JL_DLLEXPORT int jl_n_threads; // # threads we're actually using 19 | 20 | // thread state 21 | enum { 22 | TI_THREAD_INIT, 23 | TI_THREAD_WORK 24 | }; 25 | 26 | // passed to thread function 27 | typedef struct { 28 | int16_t volatile state; 29 | int16_t tid; 30 | ti_threadgroup_t *tg; 31 | } ti_threadarg_t; 32 | 33 | // commands to thread function 34 | enum { 35 | TI_THREADWORK_DONE, 36 | TI_THREADWORK_RUN 37 | }; 38 | 39 | // work command to thread function 40 | typedef struct { 41 | uint8_t command; 42 | jl_method_instance_t *mfunc; 43 | jl_generic_fptr_t fptr; 44 | jl_value_t **args; 45 | uint32_t nargs; 46 | jl_value_t *ret; 47 | jl_module_t *current_module; 48 | size_t world_age; 49 | } ti_threadwork_t; 50 | 51 | // thread function 52 | void ti_threadfun(void *arg); 53 | 54 | // helpers for thread function 55 | jl_value_t *ti_runthread(jl_function_t *f, jl_svec_t *args, size_t nargs); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* THREADING_H */ 62 | -------------------------------------------------------------------------------- /src/tls.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #ifndef JL_TLS_H 4 | #define JL_TLS_H 5 | 6 | // Thread-local storage access 7 | 8 | // Copied from libuv. Add `JL_CONST_FUNC` so that the compiler 9 | // can optimize this better. 10 | static inline unsigned long JL_CONST_FUNC jl_thread_self(void) 11 | { 12 | #ifdef _OS_WINDOWS_ 13 | return (unsigned long)GetCurrentThreadId(); 14 | #else 15 | return (unsigned long)pthread_self(); 16 | #endif 17 | } 18 | 19 | typedef struct _jl_tls_states_t *jl_ptls_t; 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | JL_DLLEXPORT int16_t jl_threadid(void); 26 | JL_DLLEXPORT void jl_threading_profile(void); 27 | 28 | JL_DLLEXPORT JL_CONST_FUNC jl_ptls_t (jl_get_ptls_states)(void); 29 | 30 | #ifndef JULIA_ENABLE_THREADING 31 | extern JL_DLLEXPORT jl_tls_states_t jl_tls_states; 32 | #define jl_get_ptls_states() (&jl_tls_states) 33 | #else // ifndef JULIA_ENABLE_THREADING 34 | typedef jl_ptls_t (*jl_get_ptls_states_func)(void); 35 | #if !defined(_OS_DARWIN_) && !defined(_OS_WINDOWS_) 36 | JL_DLLEXPORT void jl_set_ptls_states_getter(jl_get_ptls_states_func f); 37 | #endif 38 | #endif 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/uv_constants.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #include "uv.h" 4 | #define XX(uc,lc) :UV_##uc, 5 | #define YY(uc,lc) (:UV_##uc,UV__##uc), 6 | const uv_handle_types = [UV_HANDLE_TYPE_MAP(XX) :UV_FILE] 7 | const uv_req_types = [UV_REQ_TYPE_MAP(XX)] 8 | const uv_err_vals = [UV_ERRNO_MAP(YY)] 9 | let 10 | handles = [:UV_UNKNOWN_HANDLE; uv_handle_types; :UV_HANDLE_TYPE_MAX; :UV_RAW_FD; :UV_RAW_HANDLE] 11 | reqs = [:UV_UNKNOWN_REQ; uv_req_types; :UV_REQ_TYPE_PRIVATE; :UV_REQ_TYPE_MAX] 12 | for i=0:(length(handles)-1) 13 | @eval const $(handles[i+1]) = $i 14 | end 15 | for i=0:(length(reqs)-1) 16 | @eval const $(reqs[i+1]) = $i 17 | end 18 | for (v,val) in uv_err_vals 19 | @eval const $v = $val 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | /ccall 2 | /ccalltest 3 | /ccalltest.s 4 | /libccalltest.* 5 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) 2 | JULIAHOME := $(abspath $(SRCDIR)/..) 3 | BUILDDIR := . 4 | include $(JULIAHOME)/Make.inc 5 | # TODO: this Makefile ignores BUILDDIR, except for computing JULIA_EXECUTABLE 6 | 7 | TESTGROUPS = linalg sparse unicode strings dates 8 | TESTS = all $(TESTGROUPS) \ 9 | $(filter-out TestHelpers runtests testdefs, \ 10 | $(patsubst $(SRCDIR)/%.jl,%,$(wildcard $(SRCDIR)/*.jl))) \ 11 | $(foreach group,$(TESTGROUPS), \ 12 | $(patsubst $(SRCDIR)/%.jl,%,$(wildcard $(SRCDIR)/$(group)/*.jl))) 13 | # run `make print-TESTS` to see a list of all tests that can be run 14 | 15 | default: all 16 | 17 | $(TESTS): 18 | @cd $(SRCDIR) && \ 19 | $(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no ./runtests.jl $@) 20 | 21 | perf: 22 | @$(MAKE) -C $(SRCDIR)/perf all 23 | 24 | clean: 25 | @$(MAKE) -C perf $@ 26 | 27 | .PHONY: $(TESTS) perf clean 28 | -------------------------------------------------------------------------------- /test/asmvariant.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | using Base.Test 4 | 5 | ix86 = r"i[356]86" 6 | 7 | if Sys.ARCH === :x86_64 || ismatch(ix86, string(Sys.ARCH)) 8 | function linear_foo() 9 | x = 4 10 | y = 5 11 | end 12 | 13 | rgx = r"%" 14 | buf = IOBuffer() 15 | output="" 16 | #test that the string output is at&t syntax by checking for occurrences of '%'s 17 | code_native(buf,linear_foo,(),:att) 18 | output=String(take!(buf)) 19 | 20 | @test ismatch(rgx,output) 21 | 22 | #test that the code output is intel syntax by checking it has no occurrences of '%' 23 | code_native(buf,linear_foo,(),:intel) 24 | output=String(take!(buf)) 25 | 26 | @test !(ismatch(rgx,output)) 27 | 28 | code_native(buf,linear_foo,()) 29 | output=String(take!(buf)) 30 | 31 | @test ismatch(rgx, output) 32 | end 33 | -------------------------------------------------------------------------------- /test/bigfloat.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | @test big(2.0)^big(3) == 8 4 | 5 | for T in [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, BigInt] 6 | @test T(2)^big(3.0) == 8 7 | @test big(2.0)^T(3) == 8 8 | end 9 | 10 | for x in (2f0, pi, 7.8, big(e)) 11 | @test big(typeof(x)) == typeof(big(x)) 12 | @test big(typeof(complex(x, x))) == typeof(big(complex(x, x))) 13 | end 14 | 15 | # issue 15659 16 | @test (setprecision(53) do; big(1/3); end) < 1//3 17 | -------------------------------------------------------------------------------- /test/boundscheck.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # run boundscheck tests on separate workers launched with --check-bounds={default,yes,no} 4 | 5 | cmd = `$(Base.julia_cmd()) --depwarn=error --startup-file=no boundscheck_exec.jl` 6 | if !success(pipeline(cmd; stdout=STDOUT, stderr=STDERR)) 7 | error("boundscheck test failed, cmd : $cmd") 8 | end 9 | 10 | cmd = `$(Base.julia_cmd()) --check-bounds=yes --startup-file=no --depwarn=error boundscheck_exec.jl` 11 | if !success(pipeline(cmd; stdout=STDOUT, stderr=STDERR)) 12 | error("boundscheck test failed, cmd : $cmd") 13 | end 14 | 15 | cmd = `$(Base.julia_cmd()) --check-bounds=no --startup-file=no --depwarn=error boundscheck_exec.jl` 16 | if !success(pipeline(cmd; stdout=STDOUT, stderr=STDERR)) 17 | error("boundscheck test failed, cmd : $cmd") 18 | end 19 | -------------------------------------------------------------------------------- /test/cartesian.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | @test Base.Cartesian.exprresolve(:(1 + 3)) == 4 4 | ex = Base.Cartesian.exprresolve(:(if 5 > 4; :x; else :y; end)) 5 | @test ex.args[2] == QuoteNode(:x) 6 | -------------------------------------------------------------------------------- /test/distributed.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Run the distributed test outside of the main driver since it needs its own 4 | # set of dedicated workers. 5 | 6 | include("testenv.jl") 7 | cmd = `$test_exename $test_exeflags distributed_exec.jl` 8 | 9 | if !success(pipeline(cmd; stdout=STDOUT, stderr=STDERR)) && ccall(:jl_running_on_valgrind,Cint,()) == 0 10 | error("Distributed test failed, cmd : $cmd") 11 | end 12 | -------------------------------------------------------------------------------- /test/download.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | mktempdir() do temp_dir 4 | # Download a file 5 | file = joinpath(temp_dir, "ip") 6 | @test download("http://httpbin.org/ip", file) == file 7 | @test isfile(file) 8 | @test !isempty(read(file)) 9 | 10 | # Download an empty file 11 | empty_file = joinpath(temp_dir, "empty") 12 | @test download("http://httpbin.org/status/200", empty_file) == empty_file 13 | 14 | # Windows and older versions of curl do not create the empty file (https://github.com/curl/curl/issues/183) 15 | @test !isfile(empty_file) || isempty(read(empty_file)) 16 | 17 | # Make sure that failed downloads do not leave files around 18 | missing_file = joinpath(temp_dir, "missing") 19 | @test_throws ErrorException download("http://httpbin.org/status/404", missing_file) 20 | @test !isfile(missing_file) 21 | 22 | # Use a TEST-NET (192.0.2.0/24) address which shouldn't be bound 23 | invalid_host_file = joinpath(temp_dir, "invalid_host") 24 | @test_throws ErrorException download("http://192.0.2.1", invalid_host_file) 25 | @test !isfile(invalid_host_file) 26 | end 27 | -------------------------------------------------------------------------------- /test/i18n.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | using Base.I18n 4 | 5 | @test locale()=="" 6 | locale("en_US") 7 | @test locale()=="en_US" 8 | -------------------------------------------------------------------------------- /test/iostream.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Test skipchars for IOStreams 4 | mktemp() do path, file 5 | function append_to_file(str) 6 | mark(file) 7 | print(file, str) 8 | flush(file) 9 | reset(file) 10 | end 11 | 12 | # test it doesn't error on eof 13 | @test eof(skipchars(file, isspace)) 14 | 15 | # test it correctly skips 16 | append_to_file(" ") 17 | @test eof(skipchars(file, isspace)) 18 | 19 | # test it correctly detects comment lines 20 | append_to_file("# \n ") 21 | @test eof(skipchars(file, isspace, linecomment='#')) 22 | 23 | # test it stops at the appropriate time 24 | append_to_file(" not a space") 25 | @test !eof(skipchars(file, isspace)) 26 | @test read(file, Char) == 'n' 27 | 28 | # test it correctly ignores the contents of comment lines 29 | append_to_file(" #not a space \n not a space") 30 | @test !eof(skipchars(file, isspace, linecomment='#')) 31 | @test read(file, Char) == 'n' 32 | 33 | # test it correctly handles unicode 34 | for (byte,char) in zip(1:4, ('@','߷','࿊','𐋺')) 35 | append_to_file("abcdef$char") 36 | @test Base.codelen(char) == byte 37 | @test !eof(skipchars(file, isalpha)) 38 | @test read(file, Char) == char 39 | end 40 | end 41 | 42 | # issue #18755 43 | mktemp() do path, io 44 | write(io, zeros(UInt8, 131073)) 45 | @test position(io) == 131073 46 | write(io, zeros(UInt8, 131073)) 47 | @test position(io) == 262146 48 | end 49 | -------------------------------------------------------------------------------- /test/libgit2/invalid.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzUv5nyzkZ23MtcYzf7hRVDuNzmr+40/NCAZSX6cL6jZUW4eaiaQAjHGtLfORVPQDgCeStWr8faXYA6XEq50VqfijzsAlCxMeSP0u8UGGb5sF0dq7RIZJ+3xwJYBe/mWJ8UKFhrFPvxjdCdI7hDsBURdBUCYYWK7cKAEqrtzWytC3xXid0fw+4xh0iJi40bwc0CcSsaMCl00eaixjrePJuRGZN9++G5L8N/UUothjrRBhOEoznQ/7wcdfWO8f4kjltYvIOEb3sTxWaH1umC8eF1nnZYFVp/mLqqZgHYUEcd9vxi6H8QHf1FCM8sQj0rkc/kuQFcBbGjO/vmqYoXsCJ invalid-credentials 2 | -------------------------------------------------------------------------------- /test/libgit2/valid-passphrase.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLsjzj6P2eGJEASR+MqajdDkVzCK5rTnc/BXDzgCA3Zff8uGgHQlXTX++OspluSnPKvaHFuYUWbCDEH2mwHeLWiwXk68T5+3/GqOX9/m2dxEy6TOmLQ4iOPVC5mrBrSFbHTc5J2PPh3q9hwp/p35BwWo5nCUMc+pqq7WEVdgNNziRuFyAtva2vCVDXEZ5+6FJDvysoMndoIQQlVJXHoPp8w+Eb8gOg5kxTYtpNjb7Vjx/Ux70nl26B5JYtpWUTxLHfnzPRcjGrINgtbsbVDC6BJTnSnBttxaZRcON4/pZDpcvLBhOhqBKjkRkxoMvTGeiA7M5cm/G9LWROeCc88I/D valid-credentials-with-passphrase 2 | -------------------------------------------------------------------------------- /test/libgit2/valid.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDegDfXU73lFO6dxSucfEu7sJQw30yHlmiVdy3fdGgSgCRqvsSjJbYLQBD7IDsLc+OULZKaBht5tQL43/RsU6iJsPAUJSZls6VFNYhNhuru3R/qeTtyXiXwG/Iw9tE3bmjM/KfVKsZz+8ePXUucZcY1laoJ/PkQnot8siUDk//TzXhCtGR4+D8ndFnccmPtCW8e8b24BBD/9Zd4V2ZFAMo2FlsxzRuJvFkaAxB4ovuGgbAYEdNrkNJawJZ6uZQLkhiysLk8DMZw38rBNtDRL1TvFVM64oNIQy/wDMSaSkK2S6VWx6zHs/jvBQqE46b04WKRUQLazS6hG819QNRLOMUt valid-credentials 2 | -------------------------------------------------------------------------------- /test/linalg/conjarray.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | @testset "Core" begin 4 | m = [1+im 2; 2 4-im] 5 | cm = ConjMatrix(m) 6 | @test cm[1,1] == 1-im 7 | @test cm[1] == 1-im 8 | @test trace(cm*m) == 27 9 | @test cm' == m 10 | 11 | cm[:,2] = [3; 3-im] #setindex! with a vector 12 | @test conj(cm) == [1+im 3; 2 3+im] 13 | 14 | v = [[1+im], [1-im]] 15 | cv = ConjVector(v) 16 | @test cv[1] == [1-im] 17 | end 18 | 19 | @testset "RowVector conjugates" begin 20 | v = [1+im, 1-im] 21 | rv = v' 22 | @test (parent(rv) isa ConjArray) 23 | @test rv' === v 24 | 25 | # Currently, view behavior defaults to only RowVectors. 26 | @test isa((v').', Vector) 27 | @test isa((v.')', Vector) 28 | end 29 | -------------------------------------------------------------------------------- /test/linalg/hessenberg.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | using Base.Test 4 | 5 | using Base.LinAlg: BlasComplex, BlasFloat, BlasReal, QRPivoted 6 | 7 | let n = 10 8 | srand(1234321) 9 | 10 | Areal = randn(n,n)/2 11 | Aimg = randn(n,n)/2 12 | 13 | @testset for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int) 14 | A = eltya == Int ? 15 | rand(1:7, n, n) : 16 | convert(Matrix{eltya}, eltya <: Complex ? 17 | complex.(Areal, Aimg) : 18 | Areal) 19 | 20 | if eltya != BigFloat 21 | H = hessfact(A) 22 | @test size(H[:Q], 1) == size(A, 1) 23 | @test size(H[:Q], 2) == size(A, 2) 24 | @test size(H[:Q]) == size(A) 25 | @test_throws KeyError H[:Z] 26 | @test AbstractArray(H) ≈ A 27 | @test (H[:Q] * H[:H]) * H[:Q]' ≈ A 28 | @test (H[:Q]' *A) * H[:Q] ≈ H[:H] 29 | #getindex for HessenbergQ 30 | @test H[:Q][1,1] ≈ Array(H[:Q])[1,1] 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /test/llvmcall2.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function declared_floor(x::Float64) 4 | return ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), x) 5 | end 6 | @test declared_floor(4.2) == 4.0 7 | ir = sprint(code_llvm, declared_floor, Tuple{Float64}) 8 | @test contains(ir, "call double @llvm.floor.f64") # should be inlined 9 | 10 | function doubly_declared_floor(x::Float64) 11 | a = ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), x) 12 | b = ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), x + 1) - 1 13 | return a + b 14 | end 15 | @test doubly_declared_floor(4.2) == 8.0 16 | 17 | function doubly_declared2_trunc(x::Float64) 18 | a = ccall("llvm.trunc.f64", llvmcall, Float64, (Float64,), x) 19 | b = ccall("llvm.trunc.f64", llvmcall, Float64, (Float64,), x + 1) - 1 20 | return a + b 21 | end 22 | @test doubly_declared2_trunc(4.2) == 8.0 23 | 24 | # Test for single line 25 | function declared_ceil(x::Float64) 26 | return ccall("llvm.ceil.f64", llvmcall, Float64, (Float64,), x) 27 | end 28 | @test declared_ceil(4.2) == 5.0 29 | 30 | # Test for multiple lines 31 | function ceilfloor(x::Float64) 32 | a = ccall("llvm.ceil.f64", llvmcall, Float64, (Float64,), x) 33 | b = ccall("llvm.floor.f64", llvmcall, Float64, (Float64,), a) 34 | return b 35 | end 36 | @test ceilfloor(7.4) == 8.0 37 | -------------------------------------------------------------------------------- /test/llvmpasses/Makefile: -------------------------------------------------------------------------------- 1 | SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) 2 | JULIAHOME := $(abspath $(SRCDIR)/../..) 3 | include $(JULIAHOME)/deps/Versions.make 4 | include $(JULIAHOME)/Make.inc 5 | include $(JULIAHOME)/deps/llvm-ver.make 6 | BUILDDIR = $(JULIAHOME)/deps/scratch 7 | include $(JULIAHOME)/deps/llvm-options.mk 8 | LLVM_SRC_DIR:=$(JULIAHOME)/deps/srccache/llvm-$(LLVM_VER) 9 | test: 10 | PATH=$$PATH:$(LLVM_BUILDDIR_withtype)/bin $(LLVM_SRC_DIR)/utils/lit/lit.py -v . 11 | .PHONY: test 12 | -------------------------------------------------------------------------------- /test/llvmpasses/lit.cfg: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import re 4 | import platform 5 | 6 | import lit.util 7 | import lit.formats 8 | 9 | config.name = 'Julia' 10 | config.suffixes = ['.ll','.jl'] 11 | config.test_source_root = os.path.dirname(__file__) 12 | config.test_format = lit.formats.ShTest(True) 13 | 14 | path = os.path.pathsep.join((os.path.join(os.path.dirname(__file__),"../../usr/tools"), os.path.join(os.path.dirname(__file__),"../../usr/bin"), config.environment['PATH'])) 15 | config.environment['PATH'] = path 16 | config.environment['HOME'] = "/tmp" 17 | -------------------------------------------------------------------------------- /test/llvmpasses/lower-handlers.ll: -------------------------------------------------------------------------------- 1 | ; RUN: opt -load libjulia.so -LowerExcHandlers -S %s | FileCheck %s 2 | 3 | attributes #1 = { returns_twice } 4 | declare i32 @julia.except_enter() #1 5 | declare void @jl_pop_handler(i32) 6 | declare i8**** @jl_get_ptls_states() 7 | 8 | define void @simple() { 9 | top: 10 | %ptls = call i8**** @jl_get_ptls_states() 11 | ; CHECK: call void @llvm.lifetime.start 12 | ; CHECK: call void @jl_enter_handler 13 | ; CHECK: setjmp 14 | %r = call i32 @julia.except_enter() 15 | %cmp = icmp eq i32 %r, 0 16 | br i1 %cmp, label %try, label %catch 17 | try: 18 | br label %after 19 | catch: 20 | br label %after 21 | after: 22 | call void @jl_pop_handler(i32 1) 23 | ; CHECK: llvm.lifetime.end 24 | ret void 25 | } 26 | -------------------------------------------------------------------------------- /test/llvmpasses/muladd.ll: -------------------------------------------------------------------------------- 1 | ; RUN: opt -load libjulia.so -CombineMulAdd -S %s | FileCheck %s 2 | 3 | define double @fast_muladd1(double %a, double %b, double %c) { 4 | top: 5 | ; CHECK: {{contract|fmuladd}} 6 | %v1 = fmul double %a, %b 7 | %v2 = fadd fast double %v1, %c 8 | ; CHECK: ret double 9 | ret double %v2 10 | } 11 | 12 | define double @fast_mulsub1(double %a, double %b, double %c) { 13 | top: 14 | ; CHECK: {{contract|fmuladd}} 15 | %v1 = fmul double %a, %b 16 | %v2 = fsub fast double %v1, %c 17 | ; CHECK: ret double 18 | ret double %v2 19 | } 20 | 21 | define <2 x double> @fast_mulsub_vec1(<2 x double> %a, <2 x double> %b, <2 x double> %c) { 22 | top: 23 | ; CHECK: {{contract|fmuladd}} 24 | %v1 = fmul <2 x double> %a, %b 25 | %v2 = fsub fast <2 x double> %c, %v1 26 | ; CHECK: ret <2 x double> 27 | ret <2 x double> %v2 28 | } 29 | -------------------------------------------------------------------------------- /test/llvmpasses/propagate-addrspace.ll: -------------------------------------------------------------------------------- 1 | ; RUN: opt -load libjulia.so -PropagateJuliaAddrspaces -dce -S %s | FileCheck %s 2 | 3 | define i64 @simple() { 4 | ; CHECK-LABEL: @simple 5 | ; CHECK-NOT: addrspace(11) 6 | %stack = alloca i64 7 | %casted = addrspacecast i64 *%stack to i64 addrspace(11)* 8 | %loaded = load i64, i64 addrspace(11)* %casted 9 | ret i64 %loaded 10 | } 11 | 12 | define i64 @twogeps() { 13 | ; CHECK-LABEL: @twogeps 14 | ; CHECK-NOT: addrspace(11) 15 | %stack = alloca i64 16 | %casted = addrspacecast i64 *%stack to i64 addrspace(11)* 17 | %gep1 = getelementptr i64, i64 addrspace(11)* %casted, i64 1 18 | %gep2 = getelementptr i64, i64 addrspace(11)* %gep1, i64 1 19 | %loaded = load i64, i64 addrspace(11)* %gep2 20 | ret i64 %loaded 21 | } 22 | -------------------------------------------------------------------------------- /test/llvmpasses/returnstwicegc.ll: -------------------------------------------------------------------------------- 1 | ; RUN: opt -load libjulia.so -LateLowerGCFrame -S %s | FileCheck %s 2 | 3 | %jl_value_t = type opaque 4 | 5 | declare void @boxed_simple(%jl_value_t addrspace(10)*, %jl_value_t addrspace(10)*) 6 | declare %jl_value_t addrspace(10)* @jl_box_int64(i64) 7 | declare %jl_value_t*** @jl_get_ptls_states() 8 | declare i32 @sigsetjmp(i8*, i32) returns_twice 9 | declare void @one_arg_boxed(%jl_value_t addrspace(10)*) 10 | 11 | define void @try_catch(i64 %a, i64 %b) 12 | { 13 | ; Because of the returns_twice function, we need to keep aboxed live everywhere 14 | ; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4 15 | top: 16 | %sigframe = alloca [208 x i8], align 16 17 | %sigframe.sub = getelementptr inbounds [208 x i8], [208 x i8]* %sigframe, i64 0, i64 0 18 | call %jl_value_t*** @jl_get_ptls_states() 19 | %aboxed = call %jl_value_t addrspace(10)* @jl_box_int64(i64 %a) 20 | %val = call i32 @sigsetjmp(i8 *%sigframe.sub, i32 0) returns_twice 21 | %cmp = icmp eq i32 %val, 0 22 | br i1 %cmp, label %zero, label %not 23 | zero: 24 | %bboxed = call %jl_value_t addrspace(10)* @jl_box_int64(i64 %b) 25 | call void @one_arg_boxed(%jl_value_t addrspace(10)* %bboxed) 26 | unreachable 27 | not: 28 | call void @one_arg_boxed(%jl_value_t addrspace(10)* %aboxed) 29 | ret void 30 | } 31 | -------------------------------------------------------------------------------- /test/llvmpasses/safepoint_stress.jl: -------------------------------------------------------------------------------- 1 | # RUN: julia --startup-file=no %s | opt -load libjulia.so -LateLowerGCFrame -S - | FileCheck %s 2 | 3 | println(""" 4 | %jl_value_t = type opaque 5 | declare %jl_value_t addrspace(10)* @alloc() 6 | declare void @one_arg_boxed(%jl_value_t addrspace(10)*) 7 | declare %jl_value_t*** @jl_get_ptls_states() 8 | 9 | define void @stress(i64 %a, i64 %b) { 10 | %ptls = call %jl_value_t*** @jl_get_ptls_states() 11 | """) 12 | 13 | # CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 10002 14 | for i = 1:10000 15 | println("\t%arg$i = call %jl_value_t addrspace(10)* @alloc()") 16 | end 17 | 18 | for i = 1:10000 19 | println("\tcall void @one_arg_boxed(%jl_value_t addrspace(10)* %arg$i)") 20 | end 21 | 22 | println(""" 23 | ret void 24 | } 25 | """) 26 | -------------------------------------------------------------------------------- /test/llvmpasses/simdloop.ll: -------------------------------------------------------------------------------- 1 | ; RUN: opt -load libjulia.so -LowerSIMDLoop -S %s | FileCheck %s 2 | 3 | define void @simd_test(double *%a, double *%b) { 4 | top: 5 | br label %loop 6 | loop: 7 | %i = phi i64 [0, %top], [%nexti, %loop] 8 | %aptr = getelementptr double, double *%a, i64 %i 9 | %bptr = getelementptr double, double *%b, i64 %i 10 | ; CHECK: llvm.mem.parallel_loop_access 11 | %aval = load double, double *%aptr 12 | %bval = load double, double *%aptr 13 | %cval = fadd double %aval, %bval 14 | store double %cval, double *%bptr 15 | %nexti = add i64 %i, 1, !simd_loop !1 16 | %done = icmp sgt i64 %nexti, 500 17 | br i1 %done, label %loopdone, label %loop 18 | loopdone: 19 | ret void 20 | } 21 | 22 | define double @simd_test_sub(double *%a) { 23 | top: 24 | br label %loop 25 | loop: 26 | %i = phi i64 [0, %top], [%nexti, %loop] 27 | %v = phi double [0.000000e+00, %top], [%nextv, %loop] 28 | %aptr = getelementptr double, double *%a, i64 %i 29 | ; CHECK: llvm.mem.parallel_loop_access 30 | %aval = load double, double *%aptr 31 | %nextv = fsub double %v, %aval 32 | ; CHECK: fsub fast double %v, %aval 33 | %nexti = add i64 %i, 1, !simd_loop !1 34 | %done = icmp sgt i64 %nexti, 500 35 | br i1 %done, label %loopdone, label %loop 36 | loopdone: 37 | ret double %nextv 38 | } 39 | 40 | !1 = !{} 41 | -------------------------------------------------------------------------------- /test/osutils.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | @test !Sys.isunix(:Windows) 4 | @test !Sys.islinux(:Windows) 5 | @test Sys.islinux(:Linux) 6 | @test Sys.iswindows(:Windows) 7 | @test Sys.iswindows(:NT) 8 | @test !Sys.iswindows(:Darwin) 9 | @test Sys.isapple(:Darwin) 10 | @test Sys.isapple(:Apple) 11 | @test !Sys.isapple(:Windows) 12 | @test Sys.isunix(:Darwin) 13 | @test Sys.isunix(:FreeBSD) 14 | @test_throws ArgumentError Sys.isunix(:BeOS) 15 | if !Sys.iswindows() 16 | @test Sys.windows_version() == v"0.0.0" 17 | else 18 | @test Sys.windows_version() >= v"1.0.0-" 19 | end 20 | 21 | @test (@static true ? 1 : 2) === 1 22 | @test (@static false ? 1 : 2) === 2 23 | @test (@static if true 1 end) === 1 24 | @test (@static if false 1 end) === nothing 25 | @test (@static true && 1) === 1 26 | @test (@static false && 1) === false 27 | @test (@static true || 1) === true 28 | @test (@static false || 1) === 1 29 | 30 | # test that path variables use correct path delimiters on windows 31 | if Sys.iswindows() 32 | @test !contains(Base.SYSCONFDIR, "/") 33 | @test !contains(Base.DATAROOTDIR, "/") 34 | @test !contains(Base.DOCDIR, "/") 35 | @test !contains(Base.LIBDIR, "/") 36 | @test !contains(Base.PRIVATE_LIBDIR, "/") 37 | @test !contains(Base.INCLUDEDIR, "/") 38 | end 39 | -------------------------------------------------------------------------------- /test/perf/.gitignore: -------------------------------------------------------------------------------- 1 | big.txt 2 | -------------------------------------------------------------------------------- /test/perf/blas/level1.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function dottest(n, iter) 4 | a = rand(n) 5 | b = rand(n) 6 | c = similar(a) 7 | for i = 1:iter 8 | c = dot(a,b) 9 | end 10 | c 11 | end 12 | 13 | function axpytest(n, iter) 14 | a = rand(1)[1] 15 | x = rand(n) 16 | y = zeros(n) 17 | for i = 1:iter 18 | BLAS.axpy!(a, x, y) 19 | end 20 | y 21 | end 22 | 23 | problemsizes = [(2, 10^6, "tiny"), (2^4, 10^6, "small"), (2^6, 10^6, "medium"), (2^8, 10^5, "large"), (2^10, 10^5, "huge")] 24 | testdata = [(dottest, "dot", "dot product", problemsizes), (axpytest, "axpy", "axpy", problemsizes)] 25 | include("../perfgeneric.jl") 26 | 27 | -------------------------------------------------------------------------------- /test/perf/blas/level2.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function gemvtest(n, iter) 4 | A = rand(n,n) 5 | x = rand(n) 6 | z = similar(x) 7 | for i = 1:iter 8 | z = A * x 9 | end 10 | z 11 | end 12 | 13 | problemsizes =[(2, 10^6, "tiny"), (2^4, 10^5, "small"), (2^6, 10^4, "medium"), (2^8, 10^3, "large"), (2^10, 10^2, "huge")] 14 | testdata = [(gemvtest, "gemv", "matrix-vector multiplication", problemsizes)] 15 | include("../perfgeneric.jl") 16 | -------------------------------------------------------------------------------- /test/perf/blas/level3.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # gemm on various size matrices 4 | 5 | function matmultest(n, iter) 6 | a = rand(n,n) 7 | b = similar(a) 8 | for i=1:iter 9 | A_mul_B!(b, a, a) 10 | end 11 | b 12 | end 13 | 14 | problemsizes = [(2^2, 10^6, "tiny"), (2^4, 10^5, "small"), (2^6, 10^4, "medium"), (2^8, 10^2, "large")] 15 | testdata = [(matmultest, "matmul", "matrix-matrix multiplication", problemsizes)] 16 | include("../perfgeneric.jl") 17 | 18 | -------------------------------------------------------------------------------- /test/perf/blas/perf.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("../perfutil.jl") 4 | 5 | include("level1.jl") 6 | include("level2.jl") 7 | include("level3.jl") 8 | -------------------------------------------------------------------------------- /test/perf/kernel/.gitattributes: -------------------------------------------------------------------------------- 1 | *.tsv binary 2 | -------------------------------------------------------------------------------- /test/perf/kernel/bench_eu.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Benchmark European option 4 | # https://groups.google.com/forum/?hl=en&fromgroups=#!topic/julia-dev/ImhGsqX_IHc 5 | 6 | function bench_eu_devec(numPaths) 7 | steps = 250 8 | r = 0.05 9 | sigma = .4 10 | T = 1 11 | dt = T/(steps) 12 | K = 100 13 | 14 | S = 100 * ones(numPaths,1) 15 | 16 | t1 = (r-0.5*sigma.^2)*dt 17 | t2 = sigma*sqrt(dt) 18 | for i=1:steps 19 | for j=1:numPaths 20 | S[j] *= exp(t1 + t2*randn()) 21 | end 22 | end 23 | 24 | V = mean( exp(-r*T)*max.(K.-S,0) ) 25 | end 26 | 27 | function bench_eu_vec(numPaths) 28 | steps = 250 29 | r = 0.05 30 | sigma = .4 31 | T = 1 32 | dt = T/(steps) 33 | K = 100 34 | 35 | S = 100 * ones(numPaths,1) 36 | 37 | t1 = (r-0.5*sigma.^2)*dt 38 | t2 = sigma*sqrt(dt) 39 | for i=1:steps 40 | S = S .* exp.(t1.+t2*randn(numPaths)) 41 | end 42 | 43 | V = mean( exp(-r*T)*max.(K.-S,0) ) 44 | end 45 | -------------------------------------------------------------------------------- /test/perf/kernel/bench_eu.m: -------------------------------------------------------------------------------- 1 | function V = bench_eu(numPaths) 2 | %Simple European 3 | steps = 250; 4 | r = (0.05); 5 | sigma = (0.4); 6 | T = (1); 7 | dt = T/(steps); 8 | K = (100); 9 | 10 | S = 100 * ones(numPaths,1); 11 | 12 | for i=1:steps 13 | rnd = randn(numPaths,1); 14 | S = S .* exp((r-0.5*sigma.^2)*dt + sigma*sqrt(dt)*rnd); 15 | end 16 | V = mean( exp(-r*T)*max(K-S,0) ) 17 | -------------------------------------------------------------------------------- /test/perf/kernel/getdivgrad.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # https://github.com/JuliaLang/julia/issues/4707 4 | 5 | #----------------- Get the A matrix 6 | function getDivGrad(n1,n2,n3) 7 | # the Divergence 8 | D1 = kron(speye(n3),kron(speye(n2),ddx(n1))) 9 | D2 = kron(speye(n3),kron(ddx(n2),speye(n1))) 10 | D3 = kron(ddx(n3),kron(speye(n2),speye(n1))) 11 | # DIV from faces to cell-centers 12 | Div = [D1 D2 D3] 13 | 14 | return Div*Div' 15 | end 16 | 17 | #----------------- 1D finite difference on staggered grid 18 | function ddx(n) 19 | # generate 1D derivatives 20 | return d = spdiags(ones(n)*[-1, 1]',[0,1],n,n+1) 21 | end 22 | 23 | #------------- Build a diagonal matrix 24 | function spdiags(B,d,m,n) 25 | # spdiags(B,d,m,n) 26 | # creates a sparse matrix from its diagonals 27 | d = d[:] 28 | p = length(d) 29 | 30 | len = zeros(Int, p+1, 1) 31 | for k = 1:p 32 | len[k+1] = len[k] + length(max(1,1-d[k]):min(m,n-d[k])) 33 | end 34 | a = zeros(Int, len[p+1], 3) 35 | for k = 1:p 36 | # Append new d[k]-th diagonal to compact form 37 | i = max(1,1-d[k]):min(m,n-d[k]) 38 | a[(len[k]+1):len[k+1],:] = [i i+d[k] B[i+(m>=n)*d[k],k]] 39 | end 40 | 41 | A = sparse(a[:,1],a[:,2],a[:,3],m,n) 42 | 43 | return A 44 | end 45 | -------------------------------------------------------------------------------- /test/perf/kernel/indexing.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function add1!(x,y) 4 | x[y] .+= 1 5 | end 6 | 7 | function devec_add1!(x,y) 8 | for i=1:length(y) 9 | x[y[i]] += 1 10 | end 11 | end 12 | 13 | function devec_add1_logical!(x,y) 14 | for i=1:length(y) 15 | if y[i] 16 | x[i] += 1 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function laplace_iter_devec(u, dx2, dy2, Niter, N) 4 | uout = copy(u) 5 | for iter = 1:Niter 6 | for i = 2:N-1 7 | for j = 2:N-1 8 | uout[i,j] = ( (u[i-1,j]+u[i+1,j])*dy2 + (u[i,j-1]+u[i,j+1])*dx2 ) * (1 ./ (2*(dx2+dy2))) 9 | end 10 | end 11 | u, uout = uout, u 12 | end 13 | return u 14 | end 15 | 16 | function laplace_devec() 17 | N = 150 18 | u = zeros(N, N) 19 | u[1,:] = 1 20 | Niter = 2^10 21 | dx2 = dy2 = 0.1*0.1 22 | u = laplace_iter_devec(u, dx2, dy2, Niter, N) 23 | end 24 | 25 | function laplace_iter_vec(u, dx2, dy2, Niter, N) 26 | for i = 1:Niter 27 | u[2:N-1, 2:N-1] = ((u[1:N-2, 2:N-1] + u[3:N, 2:N-1])*dy2 + (u[2:N-1,1:N-2] + u[2:N-1, 3:N])*dx2) * (1 ./ (2*(dx2+dy2))) 28 | end 29 | return u 30 | end 31 | 32 | function laplace_vec() 33 | N = 150 34 | u = zeros(N,N) 35 | u[1,:] = 1 36 | Niter = 2^10 37 | dx2 = dy2 = 0.1*0.1 38 | u = laplace_iter_vec(u, dx2, dy2, Niter, N) 39 | end 40 | 41 | function laplace_iter_vec_sub(u, dx2, dy2, Niter, N) 42 | for i = 1:Niter 43 | u[2:N-1, 2:N-1] = ((view(u, 1:N-2, 2:N-1) + view(u,3:N, 2:N-1))*dy2 + (view(u,2:N-1,1:N-2) + view(u,2:N-1, 3:N))*dx2) * (1 ./ (2*(dx2+dy2))) 44 | end 45 | return u 46 | end 47 | 48 | function laplace_vec_sub() 49 | N = 150 50 | u = zeros(N,N) 51 | u[1,:] = 1 52 | Niter = 2^10 53 | dx2 = dy2 = 0.1*0.1 54 | u = laplace_iter_vec_sub(u, dx2, dy2, Niter, N) 55 | end 56 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/c_laplace.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #include 4 | #include 5 | 6 | main() { 7 | int size_mat = 150; 8 | int Niter=1024; 9 | double u[size_mat][size_mat]; 10 | double dx=0.1, dy=0.1, dx2, dy2; 11 | int i, j, k; 12 | 13 | time_t t1 = clock(); 14 | 15 | for(i=0; i 4 | #include "parameter.h" 5 | //#define N 150 6 | 7 | main() { 8 | double u[size_mat][size_mat], u1[size_mat][size_mat]; 9 | double dx=0.1, dy=0.1, dx2, dy2; 10 | int i, j, k; 11 | int Niter; 12 | 13 | FILE *f; 14 | f = fopen("data_C (pure, parallel update)", "w"); 15 | 16 | scanf("%d", &Niter); 17 | 18 | for(i=0; i 4 | #include 5 | #include "parameter.h" 6 | //#define N 150 7 | 8 | main() { 9 | double u[size_mat][size_mat]; 10 | double dx=0.1, dy=0.1, dx2, dy2; 11 | int i, j, k; 12 | int Niter; 13 | 14 | FILE *f; 15 | f = fopen("data_Cilk__pure", "w"); 16 | 17 | scanf("%d", &Niter); 18 | 19 | // initializing the array 20 | u[:][:] = 0.0; 21 | u[:][0] = 1.0; 22 | 23 | dx2 = dx*dx; 24 | dy2 = dy*dy; 25 | 26 | for(i=0; i) { 4 | chomp; 5 | @_ = split /,/; 6 | $_{"$_[0],$_[1]"} = $_[2] if 7 | !(exists $_{"$_[0],$_[1]"}) && 0 < $_[2] || 8 | 0 < $_[2] && $_[2] < $_{"$_[0],$_[1]"}; 9 | } 10 | print "$_,$_{$_}\n" for sort keys %_; 11 | -------------------------------------------------------------------------------- /test/perf/micro/java/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /test/perf/micro/java/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: https://julialang.org/license 3 | 4 | mvn compile exec:java 5 | # requires maven and java 7 6 | -------------------------------------------------------------------------------- /test/perf/micro/java/src/main/java/Complex.java: -------------------------------------------------------------------------------- 1 | public class Complex { 2 | private final double re; 3 | private final double im; 4 | 5 | public Complex(double real, double imag) { 6 | re = real; 7 | im = imag; 8 | } 9 | 10 | public static double abs(Complex z) { 11 | return Math.sqrt(z.re*z.re + z.im*z.im); 12 | } 13 | 14 | public static Complex add(Complex a, Complex b) { 15 | return new Complex(a.re + b.re, a.im + b.im); 16 | } 17 | 18 | public static Complex mul(Complex a, Complex b) { 19 | return new Complex(a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/perf/micro/scala/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.log 3 | 4 | # sbt specific 5 | .cache 6 | .history 7 | .lib/ 8 | dist/* 9 | target/ 10 | lib_managed/ 11 | src_managed/ 12 | project/boot/ 13 | project/plugins/project/ 14 | 15 | # Scala-IDE specific 16 | .scala_dependencies 17 | .worksheet 18 | -------------------------------------------------------------------------------- /test/perf/micro/scala/build.sbt: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | libraryDependencies ++= Seq( 4 | "org.scalanlp" %% "breeze" % "0.10", 5 | "org.scalanlp" %% "breeze-natives" % "0.10" 6 | ) 7 | 8 | resolvers ++= Seq( 9 | "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/" 10 | ) 11 | 12 | scalaVersion := "2.11.1" 13 | 14 | showSuccess := false 15 | 16 | onLoadMessage := "" 17 | 18 | logLevel := Level.Warn 19 | -------------------------------------------------------------------------------- /test/perf/perfgeneric.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | #Generic benchmark driver 4 | for (testfunc, testname, longtestname, problem_sizes) in testdata 5 | for (n, t, size) in problem_sizes 6 | @timeit testfunc(n, t) string(testname,"_",size) string(uppercase(size[1]),size[2:end]," ",longtestname," test") 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/perf/report.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | using HTTPClient.HTTPC 4 | 5 | env_name = chomp(read(`hostname`, String)) 6 | commit = Base.GIT_VERSION_INFO.commit 7 | flavor = ENV["JULIA_FLAVOR"] 8 | json = "{\"env\": \"$env_name\", \"blas\":\"$flavor\", \"commit\":\"$commit\"}" 9 | post("http://status.julialang.org/put/codespeed", json ) 10 | -------------------------------------------------------------------------------- /test/perf/shootout/.gitignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | -------------------------------------------------------------------------------- /test/perf/shootout/Makefile: -------------------------------------------------------------------------------- 1 | JULIAHOME := $(abspath ../../..) 2 | include ../../../Make.inc 3 | 4 | SHOOTOUTFILES = knucleotide-input.txt regexdna-input.txt revcomp-input.txt fasta-output.txt mandelbrot-output.txt nbody-output.txt fannkuchredux-output.txt pidigits-output.txt knucleotide-output.txt revcomp-output.txt spectralnorm-output.txt regexdna-output.txt meteor-output.txt 5 | 6 | getall: $(SHOOTOUTFILES) 7 | 8 | %.txt: 9 | $(JLDOWNLOAD) http://benchmarksgame.alioth.debian.org/download/$@ 10 | 11 | clean: 12 | rm -f *.txt *~ 13 | 14 | .PHONY: getall 15 | -------------------------------------------------------------------------------- /test/perf/shootout/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the Julia version of the "The 2 | Computer Language Benchmarks Game": 3 | https://benchmarksgame.alioth.debian.org/ 4 | 5 | The source code for all the benchmarks are available there: 6 | https://alioth.debian.org/scm/viewvc.php/benchmarksgame/bench/?root=benchmarksgame 7 | 8 | See specific Julia discussion here: 9 | https://github.com/JuliaLang/julia/issues/660 10 | -------------------------------------------------------------------------------- /test/perf/shootout/mandelbrot.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # The Computer Language Benchmarks Game 4 | # http://shootout.alioth.debian.org/ 5 | # 6 | # Contributed by David Campbell 7 | 8 | const ITER = 50 9 | 10 | function ismandel(z::Complex128) 11 | c = z 12 | for n = 1:ITER 13 | if abs2(z) > 4 14 | return false 15 | end 16 | z = z^2 + c 17 | end 18 | return true 19 | end 20 | 21 | function draw_mandel(M::Array{UInt8, 2}, n::Int) 22 | for y = 0:n-1 23 | ci = 2y/n - 1 24 | for x = 0:n-1 25 | c = complex(2x/n - 1.5, ci) 26 | if ismandel(c) 27 | M[div(x, 8) + 1, y + 1] |= 1 << UInt8(7 - x%8) 28 | end 29 | end 30 | end 31 | end 32 | 33 | function mandelbrot(n::Int=200, outfile="mandelbrot-output-julia.txt") 34 | if n%8 != 0 35 | error("Error: n of $n is not divisible by 8") 36 | end 37 | 38 | M = zeros(UInt8, div(n, 8), n) 39 | draw_mandel(M, n) 40 | 41 | output = open(outfile, "w") 42 | write(output, "P4\n$n $n\n") 43 | write(output, M) 44 | close(output) 45 | end 46 | -------------------------------------------------------------------------------- /test/perf/shootout/regex_dna.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # The Computer Language Benchmarks Game 4 | # http://shootout.alioth.debian.org/ 5 | # 6 | # Contributed by Daniel Jones 7 | # Fix from David Campbell 8 | 9 | const variants = [ 10 | "agggtaaa|tttaccct", 11 | "[cgt]gggtaaa|tttaccc[acg]", 12 | "a[act]ggtaaa|tttacc[agt]t", 13 | "ag[act]gtaaa|tttac[agt]ct", 14 | "agg[act]taaa|ttta[agt]cct", 15 | "aggg[acg]aaa|ttt[cgt]ccct", 16 | "agggt[cgt]aa|tt[acg]accct", 17 | "agggta[cgt]a|t[acg]taccct", 18 | "agggtaa[cgt]|[acg]ttaccct" 19 | ] 20 | 21 | const subs = [ 22 | (r"B", "(c|g|t)"), 23 | (r"D", "(a|g|t)"), 24 | (r"H", "(a|c|t)"), 25 | (r"K", "(g|t)"), 26 | (r"M", "(a|c)"), 27 | (r"N", "(a|c|g|t)"), 28 | (r"R", "(a|g)"), 29 | (r"S", "(c|g)"), 30 | (r"V", "(a|c|g)"), 31 | (r"W", "(a|t)"), 32 | (r"Y", "(c|t)") 33 | ] 34 | 35 | function regex_dna(infile="regexdna-input.txt") 36 | seq = read(infile, String) 37 | l1 = length(seq) 38 | 39 | seq = replace(seq, r">.*\n|\n", "") 40 | l2 = length(seq) 41 | 42 | for v in variants 43 | k = 0 44 | for m in eachmatch(Regex(v), seq) 45 | k += 1 46 | end 47 | # @printf("%s %d\n", v, k) 48 | end 49 | 50 | for (u, v) in subs 51 | seq = replace(seq, u, v) 52 | end 53 | 54 | # println() 55 | # println(l1) 56 | # println(l2) 57 | # println(length(seq)) 58 | end 59 | 60 | -------------------------------------------------------------------------------- /test/perf/shootout/spectralnorm.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # 4 | # The Computer Language Benchmarks Game 5 | # spectral-norm benchmark 6 | # http://shootout.alioth.debian.org/u32/performance.php?test=spectralnorm 7 | # 8 | # Based on the Javascript program 9 | # 10 | 11 | A(i,j) = 1.0 / ((i+j)*(i+j+1.0)/2.0+i+1.0) 12 | 13 | function Au(u,w) 14 | n = length(u) 15 | for i = 1:n, j = 1:n 16 | j == 1 && (w[i] = 0) 17 | w[i] += A(i-1,j-1) * u[j] 18 | end 19 | end 20 | 21 | function Atu(w,v) 22 | n = length(w) 23 | for i = 1:n, j = 1:n 24 | j == 1 && (v[i] = 0) 25 | v[i] += A(j-1,i-1) * w[j] 26 | end 27 | end 28 | 29 | function approximate(n) 30 | u = ones(Float64,n) 31 | v = zeros(Float64,n) 32 | w = zeros(Float64,n) 33 | vv = vBv = 0 34 | for i = 1:10 35 | Au(u,w) 36 | Atu(w,v) 37 | Au(v,w) 38 | Atu(w,u) 39 | end 40 | for i = 1:n 41 | vBv += u[i]*v[i] 42 | vv += v[i]*v[i] 43 | end 44 | return sqrt(vBv/vv) 45 | end 46 | 47 | function spectralnorm(N::Int=100) 48 | approximate(N) 49 | end 50 | 51 | # @assert spectralnorm(100) == 1.274219991 52 | # @timeit spectralnorm(500) "spectralnorm(n=500)" 53 | # @timeit spectralnorm(3000) "spectralnorm(n=3000)" 54 | # @timeit spectralnorm(5500) "spectralnorm(n=5500)" 55 | -------------------------------------------------------------------------------- /test/perf/simd/axpy.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Compute y += a*x using @simd for vectors x and y 4 | function simd_axpy( a, x, y ) 5 | # LLVM's auto-vectorizer typically vectorizes this loop even without @simd 6 | @simd for i=1:length(x) 7 | @inbounds y[i] += a*x[i] 8 | end 9 | end 10 | 11 | # Run axpy(a,x,y) m times 12 | function flog_axpy( m, a, x, y ) 13 | for j=1:m 14 | simd_axpy(a,x,y) 15 | end 16 | end 17 | 18 | # Run axpy for Float32 and Float64 19 | for t in [Float32,Float64] 20 | n = 1000 21 | x = rand(t,n) 22 | y = rand(t,n) 23 | a = convert(t,0.5) 24 | bits = 8*sizeof(t) 25 | @timeit(flog_axpy(100,a,x,y), "simd_axpy_$bits", "SIMD BLAS axpy for type $t", "SIMD") 26 | end 27 | -------------------------------------------------------------------------------- /test/perf/simd/inner.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Inner produce of x and y 4 | function inner( x, y ) 5 | s = zero(eltype(x)) 6 | @simd for i=1:length(x) 7 | @inbounds s += x[i]*y[i] 8 | end 9 | s 10 | end 11 | 12 | function flog_inner( m, x, y ) 13 | s = zero(eltype(x)) 14 | for j=1:m 15 | s += inner(x,y) 16 | end 17 | s 18 | end 19 | 20 | for t in [Float32,Float64] 21 | n = 1000 22 | x = rand(t,n) 23 | y = rand(t,n) 24 | bits = 8*sizeof(t) 25 | @timeit(flog_inner(100,x,y), "inner_$bits", "SIMD inner product for type $t", "SIMD") 26 | end 27 | 28 | -------------------------------------------------------------------------------- /test/perf/simd/perf.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | include("../perfutil.jl") 4 | 5 | include("axpy.jl") 6 | include("sum_reduce.jl") 7 | include("inner.jl") 8 | include("seismic_fdtd.jl") 9 | -------------------------------------------------------------------------------- /test/perf/simd/sum_reduce.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function sum_reduce(x, istart, iend) 4 | s = zero(eltype(x)) 5 | @simd for i = istart:iend 6 | @inbounds s += x[i] 7 | end 8 | s 9 | end 10 | 11 | function flog_sum_reduce( m, x ) 12 | s = zero(eltype(x)) 13 | for j=1:m 14 | # Try different starting and ending indices. 15 | sum_reduce(x,j,length(x)-(j-1)) 16 | end 17 | s 18 | end 19 | 20 | for t in [Float32,Float64] 21 | n = 1000 22 | x = rand(t,n) 23 | bits = 8*sizeof(t) 24 | @timeit(flog_sum_reduce(100,x), "sum_reduction_$bits", "SIMD sum reduction over array of type $t", "SIMD") 25 | end 26 | 27 | -------------------------------------------------------------------------------- /test/perf/sparse/fem.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | ## FEM benchmark from https://github.com/JuliaLang/julia/issues/9668 4 | 5 | # assemble the finite-difference laplacian 6 | function fdlaplacian(N) 7 | # create a 1D laplacian and a sparse identity 8 | fdl1 = spdiagm((ones(N-1),-2*ones(N),ones(N-1)), [-1,0,1]) 9 | # laplace operator on the full grid 10 | return kron(speye(N), fdl1) + kron(fdl1, speye(N)) 11 | end 12 | 13 | # get the list of boundary dof-indices 14 | function get_free(N) 15 | L = zeros(Int, N, N) 16 | L[2:N-1, 2:N-1] = 1 17 | return find(L) 18 | end 19 | 20 | # timing of assembly, slice and solve 21 | function run_fem(N) 22 | Ifree = get_free(N) 23 | # assembly 24 | A = fdlaplacian(N) 25 | # boundary condition 26 | B = A[Ifree, Ifree] 27 | # solver 28 | lufact(B) 29 | end 30 | 31 | function fem_perf() 32 | # run tests once to compile 33 | run_fem(10) 34 | 35 | # run 36 | @timeit run_fem(256) "finite_elements" "" 37 | 38 | # runs the tests 39 | #NN = 2.^(3:8) 40 | #TT = zeros(3, length(NN)) 41 | #@printf("(All times are seconds)\n") 42 | #@printf(" N | assembly | slice | lufact | slice / N^4 \n") 43 | #@printf("---------|------------|-----------|-----------|-------------\n") 44 | #for n = 1:length(NN) 45 | # t1, t2, t3 = timings(NN[n]) 46 | # @printf(" %4.1e | %4.2e | %4.2e | %4.2e | %4.2e \n", 47 | # NN[n], t1, t2, t3, t2 / NN[n]^4) 48 | #end 49 | end 50 | -------------------------------------------------------------------------------- /test/perf/sparse/fem.m: -------------------------------------------------------------------------------- 1 | function fem() 2 | 3 | % run tests once to compile 4 | run_fem(10); 5 | 6 | % runs the tests 7 | NN = 2.^[3:8]; 8 | TT = zeros(3, length(NN)); 9 | fprintf(1, '(All times are seconds)\n') 10 | fprintf(1, ' N | assembly | slice | lufact | slice / N^4 \n') 11 | fprintf(1, '---------|------------|-----------|-----------|-------------\n') 12 | for n = 1:length(NN) 13 | [t1, t2, t3] = run_fem(NN(n)); 14 | fprintf(1, ' %4.1e | %4.2e | %4.2e | %4.2e | %4.2e \n', ... 15 | NN(n), t1, t2, t3, t2 / NN(n)^4); 16 | end 17 | 18 | end 19 | 20 | % assemble the finite-difference laplacian 21 | function F = fdlaplacian(N) 22 | % create a 1D laplacian and a sparse identity 23 | fdl1 = spdiags([ones(N,1) -2*ones(N,1) ones(N,1)], [-1,0,1], N, N); 24 | % laplace operator on the full grid 25 | F = kron(speye(N), fdl1) + kron(fdl1, speye(N)); 26 | end 27 | 28 | % get the list of boundary dof-indices 29 | function f = get_free(N) 30 | L = zeros(N, N); 31 | L(2:N-1, 2:N-1) = 1; 32 | f = find(L); 33 | end 34 | 35 | % timing of assembly, slice and solve 36 | function [t1,t2,t3] = run_fem(N) 37 | Ifree = get_free(N); 38 | % timing for assembly 39 | tic; A = fdlaplacian(N); t1 = toc; 40 | % timing for the boundary condition 41 | tic; B = A(Ifree, Ifree); t2 = toc; 42 | % timing for the solver 43 | tic; [l,u,p,q,r] = lu(B); t3 = toc; 44 | end 45 | -------------------------------------------------------------------------------- /test/perf/sparse/getindex_skinny.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # Test getindex for skinny sparse matrix 4 | function sparse_getindex_skinny_perf() 5 | seed = 1 6 | srand(seed) 7 | 8 | # matsize = (size(A,1), nnz(A)) 9 | matsize = [ 10 | (2^12,1 ), 11 | (2^12,2^6), 12 | (2^18,1 ), 13 | (2^18,2^9)] 14 | # indsize = (length(I), number of repetitions) 15 | indsize = [ 16 | (1, 2^12), 17 | (2^8, 2^8 ), 18 | (2^16,2^4 )] 19 | 20 | c = 0 # counter 21 | for (m,nz) in matsize 22 | A = sprand(m,1,nz/m) 23 | for (n,p) in indsize 24 | c += 1 25 | I = rand(1:m,n) 26 | @timeit indexing(A,I,p) "sparse_getindex_skinny$c" "" 27 | end 28 | end 29 | end 30 | 31 | function indexing(A,I,p) 32 | J = [1] 33 | for k = 1:p 34 | A[I,J] 35 | end 36 | nothing 37 | end 38 | -------------------------------------------------------------------------------- /test/perf/sparse/perf.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | ## Sparse matrix performance 4 | include("../perfutil.jl") 5 | 6 | include("getindex.jl") 7 | sparse_getindex_perf() 8 | 9 | include("getindex_skinny.jl") 10 | sparse_getindex_skinny_perf() 11 | 12 | include("fem.jl") 13 | fem_perf() 14 | -------------------------------------------------------------------------------- /test/perf/threads/laplace3d/README: -------------------------------------------------------------------------------- 1 | Laplace 3D 2 | 3 | This is a simple 7 point stencil on a 3D grid. It is bandwidth-bound. 4 | The C version gets 60 GB/s on a 2 socket SNB-EP. The code doesn't 5 | handle corner cases at the grid edges, so each dimension must be 4n+2 6 | for SSE or 8n+2 for AVX. 7 | 8 | E.g.: 9 | 10 | $ ./laplace3d 258 258 258 1000 avx 0 11 | 12 | The Matlab/Octave versions are enough slower than the C and Julia 13 | versions that they use only 1/10 the iterations. 14 | 15 | -------------------------------------------------------------------------------- /test/perf/threads/laplace3d/laplace3d_devec.m: -------------------------------------------------------------------------------- 1 | % 3D Laplace equation solver 2 | 3 | nx = 290; 4 | ny = 290; 5 | nz = 290; 6 | iters = 100; 7 | sixth = 1.0/6.0; 8 | 9 | u1 = zeros(nx, ny, nz); 10 | u2 = zeros(nx, ny, nz); 11 | 12 | for k3 = 1:nz 13 | for k2 = 1:ny 14 | for k1 = 1:nx 15 | if k1==1 || k1==nx || k2==1 || k2==ny || k3==1 || k3==nz 16 | u1(k1,k2,k3) = 1.0; 17 | u2(k1,k2,k3) = 1.0; 18 | end 19 | end 20 | end 21 | end 22 | 23 | tic 24 | for n = 1:iters 25 | for k3 = 2:nz-1 26 | for k2 = 2:ny-1 27 | for k1 = 2:nx-1 28 | s = (u1(k1-1,k2,k3) + u1(k1+1,k2,k3) + u1(k1,k2-1,k3) + u1(k1,k2+1,k3) + u1(k1,k2,k3-1) + u1(k1,k2,k3+1)) * sixth; 29 | u2(k1,k2,k3) = s; 30 | end 31 | end 32 | end 33 | foo = u1; 34 | u1 = u2; 35 | u2 = foo; 36 | end 37 | toc 38 | 39 | -------------------------------------------------------------------------------- /test/perf/threads/laplace3d/laplace3d_vec.m: -------------------------------------------------------------------------------- 1 | % 3D Laplace equation solver 2 | 3 | nx = 290; 4 | ny = 290; 5 | nz = 290; 6 | iters = 100; 7 | sixth = 1.0/6.0; 8 | 9 | u1 = zeros(nx, ny, nz); 10 | u2 = zeros(nx, ny, nx); 11 | 12 | %Boundary conditions 13 | u1(1,:,:) = 1.0; 14 | u1(nx,:,:) = 1.0; 15 | u1(:,1,:) = 1.0; 16 | u1(:,ny,:) = 1.0; 17 | u1(:,:,1) = 1.0; 18 | u1(:,:,nz) = 1.0; 19 | u2 = u1; 20 | 21 | i = 2:nx-1; 22 | j = 2:ny-1; 23 | k = 2:nz-1; 24 | 25 | %Main 26 | tic 27 | for n = 1:iters 28 | u2(i,j,k) = (u1(i-1,j,k) + u1(i+1,j,k) + u1(i,j-1,k) + u1(i,j+1,k) + u1(i,j,k-1) + u1(i,j,k+1))*sixth; 29 | foo = u1; 30 | u1 = u2; 31 | u2 = foo; 32 | end 33 | toc 34 | 35 | -------------------------------------------------------------------------------- /test/perf/threads/lbm3d/README: -------------------------------------------------------------------------------- 1 | 3D Lattice Boltzmann (BGK) model of a fluid (http://exolete.com/lbm/) 2 | 3 | The Matlab/Octave version is from the website. The Julia version is 4 | rewritten in devectorized form with threading directives applied to 5 | the parallelizable code. 6 | 7 | The circshift! implementation needs work to support arbitrary 8 | dimensioned grids. 9 | 10 | -------------------------------------------------------------------------------- /test/perf/threads/stockcorr/stockcorr_vec.m: -------------------------------------------------------------------------------- 1 | %% Simulate two correlated assets 2 | %% Original code from Mike Croucher (http://www.walkingrandomly.com/?p=3604) 3 | 4 | %% Correlated asset information 5 | CurrentPrice = [78 102]; %Initial Prices of the two stocks 6 | Corr = [1 0.4; 0.4 1]; %Correlation Matrix 7 | T = 500; %Number of days to simulate = 2years = 500days 8 | Div=[0.01 0.01]; %Dividend 9 | Vol=[0.2 0.3]; %Volatility 10 | 11 | %% Market Information 12 | r = 0.03; %Risk-free rate 13 | 14 | %% Simulation parameters 15 | n=1000000; %Number of simulation 16 | dt=1/250; %Time step (1year = 250days) 17 | 18 | %% Define storages 19 | SimulPrices=repmat(CurrentPrice,n,1); 20 | CorrWiener = zeros(T-1,2,n); 21 | 22 | %% Generating the paths of stock prices by Geometric Brownian Motion 23 | UpperTriangle=chol(Corr); %UpperTriangle Matrix by Cholesky decomposition 24 | 25 | tic; 26 | for i=1:n 27 | CorrWiener(:,:,i)=randn(T-1,2)*UpperTriangle; 28 | end 29 | Volr = repmat(Vol,[T-1,1,n]); 30 | Divr = repmat(Div,[T-1,1,n]); 31 | 32 | %% do simulation 33 | sim = cumprod(exp((r-Divr-Volr.^2./2).*dt+Volr.*sqrt(dt).*CorrWiener)); 34 | %get just the final prices 35 | SimulPrices = SimulPrices.*reshape(sim(end,:,:),2,n)'; 36 | toc; 37 | 38 | %% Plot the distribution of final prices 39 | % Comment this section out if doing timings 40 | %subplot(1,2,1);hist(SimulPrices(:,1),100); 41 | %subplot(1,2,2);hist(SimulPrices(:,2),100); 42 | 43 | -------------------------------------------------------------------------------- /test/profile.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | function busywait(t, n_tries) 4 | iter = 0 5 | while iter < n_tries && Profile.len_data() == 0 6 | iter += 1 7 | tend = time() + t 8 | while time() < tend end 9 | end 10 | end 11 | 12 | Profile.clear() 13 | @profile busywait(1, 20) 14 | 15 | let r = Profile.retrieve() 16 | mktemp() do path, io 17 | serialize(io, r) 18 | close(io) 19 | open(path) do io 20 | @test isa(deserialize(io), Tuple{Vector{UInt},Dict{UInt64,Vector{StackFrame}}}) 21 | end 22 | end 23 | end 24 | 25 | let iobuf = IOBuffer() 26 | Profile.print(iobuf, format=:tree, C=true) 27 | str = String(take!(iobuf)) 28 | @test !isempty(str) 29 | truncate(iobuf, 0) 30 | Profile.print(iobuf, format=:tree, maxdepth=2) 31 | str = String(take!(iobuf)) 32 | @test !isempty(str) 33 | truncate(iobuf, 0) 34 | Profile.print(iobuf, format=:flat, C=true) 35 | str = String(take!(iobuf)) 36 | @test !isempty(str) 37 | truncate(iobuf, 0) 38 | Profile.print(iobuf) 39 | @test !isempty(String(take!(iobuf))) 40 | truncate(iobuf, 0) 41 | Profile.print(iobuf, format=:flat, sortedby=:count) 42 | @test !isempty(String(take!(iobuf))) 43 | Profile.clear() 44 | @test isempty(Profile.fetch()) 45 | end 46 | -------------------------------------------------------------------------------- /test/sysinfo.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # We can't guarantee that these are correct, but we can at least check 4 | # that they run 5 | @test length(Base.Sys.cpu_info()) > 0 6 | sprint(Base.Sys.cpu_summary) 7 | @test Base.Sys.uptime() > 0 8 | Base.Sys.loadavg() 9 | -------------------------------------------------------------------------------- /test/test_exec.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | using Base.Test 4 | # Check that the fallback test set throws immediately 5 | @test 1 == 2 6 | -------------------------------------------------------------------------------- /test/test_sourcepath.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # source path in tasks 4 | path = Base.source_path()::String # this variable is leaked to the source script 5 | @test endswith(path, joinpath("test","test_sourcepath.jl")) 6 | @test let ct = current_task() 7 | yieldto(@task yieldto(ct, Base.source_path())) 8 | end == path 9 | @test let ct = current_task() 10 | yieldto(@task schedule(ct, Base.source_path())) 11 | end == path 12 | @test let ct = current_task(), t = @task Base.source_path() 13 | schedule(ct) 14 | yieldto(t) 15 | wait(t) 16 | end == path 17 | @test isabspath(@__FILE__) 18 | -------------------------------------------------------------------------------- /test/triplequote.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | # triple-quote delimited strings 4 | @test """abc""" == "abc" 5 | @test """ab"c""" == "ab\"c" 6 | @test """ab""c""" == "ab\"\"c" 7 | @test """ab"\"c""" == "ab\"\"c" 8 | @test """abc\"""" == "abc\"" 9 | n = 3 10 | @test """$n\n""" == "$n\n" 11 | @test """$(n)""" == "3" 12 | @test """$(2n)""" == "6" 13 | @test """$(n+4)""" == "7" 14 | @test """$("string")""" == "string" 15 | a = [3,1,2] 16 | @test """$(a[2])""" == "1" 17 | @test """$(a[3]+7)""" == "9" 18 | @test """$(floor(Int,4.5))""" == "4" 19 | nl = " 20 | " 21 | @test """ 22 | a 23 | b 24 | 25 | c 26 | """ == "a$(nl)b$(nl)$(nl)c$(nl)" 27 | @test """ 28 | """ == "" 29 | @test """x 30 | a 31 | """ == "x$(nl) a$(nl)" 32 | @test """ 33 | $n 34 | """ == " $n$(nl)" 35 | @test """ 36 | a 37 | b 38 | c""" == " a$(nl)b$(nl) c" 39 | # tabs + spaces 40 | @test """ 41 | a 42 | b 43 | """ == " a$(nl) b$(nl)" 44 | @test """ 45 | a 46 | """ == "a$(nl) " 47 | s = " p" 48 | @test """ 49 | $s""" == "$s" 50 | @test """ 51 | $s 52 | """ == " $s$(nl)" 53 | @test """\t""" == "\t" 54 | @test """ 55 | \t""" == "" 56 | @test """ 57 | foo 58 | \tbar""" == "foo$(nl)\tbar" 59 | @test """ 60 | foo 61 | \tbar 62 | """ == "foo$(nl)\tbar$(nl)" 63 | @test """ 64 | foo 65 | bar\t""" == "foo$(nl)bar\t" 66 | @test """ 67 | $("\n ") 68 | """ == "\n $(nl)" 69 | -------------------------------------------------------------------------------- /test/unicode/UnicodeError.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | @testset "invalid utf8" begin 4 | let io = IOBuffer() 5 | show(io, UnicodeError(Base.UTF_ERR_SHORT, 1, 10)) 6 | check = "UnicodeError: invalid UTF-8 sequence starting at index 1 (0xa missing one or more continuation bytes)" 7 | @test String(take!(io)) == check 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/util/segfault.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | unsafe_load(convert(Ptr{UInt8},C_NULL)) 4 | -------------------------------------------------------------------------------- /test/util/throw_error_exception.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: https://julialang.org/license 2 | 3 | error("This purposefully dies") 4 | -------------------------------------------------------------------------------- /ui/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /*.do 3 | /*.dSYM 4 | /*.obj 5 | /*.pdb 6 | --------------------------------------------------------------------------------