├── VERSION ├── test ├── perf │ ├── .gitignore │ ├── micro │ │ ├── java │ │ │ ├── .gitignore │ │ │ ├── setup.sh │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── java │ │ │ │ │ └── Complex.java │ │ │ └── pom.xml │ │ ├── benchmarks │ │ │ └── .gitignore │ │ ├── bin │ │ │ ├── .gitignore │ │ │ └── collect.pl │ │ ├── .gitignore │ │ └── scala │ │ │ ├── .gitignore │ │ │ └── build.sbt │ ├── shootout │ │ ├── .gitignore │ │ ├── README │ │ ├── Makefile │ │ ├── mandelbrot.jl │ │ ├── spectralnorm.jl │ │ ├── regex_dna.jl │ │ ├── binary_trees.jl │ │ ├── pidigits.jl │ │ └── revcomp.jl │ ├── kernel │ │ ├── .gitattributes │ │ ├── bench_eu.m │ │ ├── indexing.jl │ │ ├── laplace │ │ │ ├── laplace.m │ │ │ ├── for_laplace.f90 │ │ │ ├── laplace2.py │ │ │ ├── c_laplace.c │ │ │ ├── cilk_laplace.c │ │ │ ├── laplace_for_update1.f90 │ │ │ ├── laplace_for_update2.f90 │ │ │ ├── c_laplace_parallel_update.c │ │ │ └── c_laplace_parallel_update_pointer.c │ │ ├── bench_eu.jl │ │ ├── getdivgrad.jl │ │ ├── laplace.jl │ │ ├── stockcorr.m │ │ └── stockcorr.jl │ ├── lapack │ │ ├── perf.jl │ │ └── eig.jl │ ├── blas │ │ ├── perf.jl │ │ ├── level2.jl │ │ ├── level3.jl │ │ └── level1.jl │ ├── simd │ │ ├── perf.jl │ │ ├── inner.jl │ │ ├── sum_reduce.jl │ │ └── axpy.jl │ ├── sparse │ │ ├── perf.jl │ │ ├── getindex_skinny.jl │ │ ├── fem.m │ │ └── fem.jl │ ├── threads │ │ ├── lbm3d │ │ │ └── README │ │ ├── laplace3d │ │ │ ├── README │ │ │ ├── laplace3d_vec.m │ │ │ └── laplace3d_devec.m │ │ └── stockcorr │ │ │ └── stockcorr_vec.m │ ├── perfgeneric.jl │ └── report.jl ├── .gitignore ├── i18n.jl ├── bigfloat.jl ├── sparse.jl ├── unicode.jl ├── unicode │ ├── UnicodeError.jl │ ├── types.jl │ ├── utf16.jl │ └── utf8.jl ├── workspace.jl ├── testdefs.jl ├── dates.jl ├── string.jl ├── TestHelpers.jl ├── test_sourcepath.jl ├── remote.jl ├── Makefile ├── parallel.jl ├── loading.jl ├── profile.jl ├── sysinfo.jl ├── triplequote.jl ├── libgit2-online.jl ├── operators.jl └── inline.jl ├── contrib ├── vagrant │ └── .gitignore ├── mac │ ├── app │ │ ├── .gitignore │ │ ├── julia.icns │ │ ├── script │ │ ├── README │ │ └── run-install-name-tool-change.sh │ ├── juliarc.jl │ ├── mac-gtk.sh │ └── macports.make ├── ackrc ├── windows │ ├── 7zS.sfx │ ├── julia.ico │ ├── 7zSFX-config.txt │ ├── juliarc.jl │ ├── julia.rc │ └── 7zSFX-manifest.xml ├── debug_bootstrap.gdb ├── README.ackrc.txt ├── README.ctags.txt ├── valgrind-julia.supp ├── commit-name.sh ├── ctags ├── julia.desktop ├── filterArgs.sh ├── check-whitespace.sh ├── install.sh ├── fixup-libstdc++.sh ├── stringreplace.c ├── travis_fastfail.sh ├── julia.appdata.xml └── relative_path.sh ├── deps ├── .gitignore ├── checksums │ ├── fftw-3.3.4.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── gmp-6.1.0.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── lapack-3.5.0.tgz │ │ ├── md5 │ │ └── sha512 │ ├── Rmath-julia-0.1.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── arpack-ng-3.2.0.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── cfe-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── cfe-3.7.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── cfe-3.7.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── dsfmt-2.2.3.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── git-1.8.5.6.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libcxx-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── lldb-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── lldb-3.7.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.7.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.7.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── mpfr-3.1.3.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── patchelf-0.8.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── pcre2-10.21.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── SuiteSparse-4.4.5.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── arpack-ng-3.2.0-testA.mtx │ │ ├── md5 │ │ └── sha512 │ ├── compiler-rt-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libosxunwind-0.0.3.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libunwind-1.1-julia2.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── virtualenv-15.0.0.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── compiler-rt-3.7.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── compiler-rt-3.7.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.7.1-i686-w64-mingw32-juliadeps-r04.7z │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.7.1-x86_64-w64-mingw32-juliadeps-r04.7z │ │ ├── md5 │ │ └── sha512 │ ├── x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z │ │ ├── md5 │ │ └── sha512 │ ├── libgit2-785d8c48ea8725691da3c50e7dae8751523d4c30.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libuv-07730c4bd595b4d45a498a8ee0bcd53878ff7c10.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── openblas-a71e8c82f6a9f73093b631e5deab1e8da716b61f.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── openlibm-3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── utf8proc-85789180158ac7fff85b9f008828d6ac44f072ea.tar.gz │ │ ├── md5 │ │ └── sha512 │ └── openspecfun-381db9bc865e51de67be9dcaa1610a6f90029c72.tar.gz │ │ ├── md5 │ │ └── sha512 ├── libgit2.version ├── libuv.version ├── openblas.version ├── openlibm.version ├── utf8proc.version ├── openspecfun.version ├── NATIVE.cmake ├── libgit2-require-openssl.patch ├── Versions.make ├── find_python2 ├── llvm-ver.make ├── llvm-3.7.1_3.patch ├── instcombine-llvm-3.3.patch ├── osx-10.10.llvm-3.3.patch ├── libdSFMT.def ├── gfortblas.alias ├── llvm-3.7.0.patch ├── openblas-make.patch ├── jldownload ├── lldb-3.7.1.patch └── SuiteSparse_wrapper.c ├── doc ├── .gitignore ├── images │ ├── jltypes.ai │ ├── travis-icon.png │ ├── github_metadata_fork.png │ ├── github_metadata_develbranch.png │ └── github_metadata_pullrequest.png ├── latex.rst ├── requirements.txt ├── devdocs │ ├── C.rst │ └── julia.rst ├── stdlib │ └── index.rst ├── NEWS-update.jl ├── manual │ ├── unicode-input.rst │ ├── index.rst │ └── handling-operating-system-variation.rst └── README.md ├── ui └── .gitignore ├── src ├── support │ ├── .gitignore │ ├── ptrhash.h │ ├── strtod.h │ ├── timefuncs.h │ ├── dirpath.h │ ├── ptrhash.c │ ├── libsupport.h │ ├── arraylist.h │ ├── libsupportinit.c │ ├── hashing.h │ ├── bitvector.h │ ├── MurmurHash3.h │ ├── Windows.mk │ ├── _longjmp.win64.S │ ├── _setjmp.win64.S │ ├── timefuncs.c │ ├── htable.c │ └── htable.h ├── flisp │ ├── mkboot1.lsp │ ├── .gitignore │ ├── equalhash.h │ ├── bootstrap.sh │ ├── equalhash.c │ └── mkboot0.lsp ├── mk_julia_flisp_boot.scm ├── .gitignore ├── bin2hex.scm ├── fenv_constants.h ├── uv_constants.h ├── file_constants.h ├── julia.expmap ├── gen_sysimg_symtab.jl ├── builtin_proto.h ├── llvm-version.h ├── threading.h ├── codegen_internal.h ├── common_symbols1.inc └── threadgroup.h ├── examples ├── clustermanager │ ├── 0mq │ │ ├── broker.jl │ │ ├── worker.jl │ │ ├── head.jl │ │ └── README │ └── simple │ │ ├── head.jl │ │ ├── test_simple.jl │ │ └── README ├── quine.jl ├── bubblesort.jl ├── queens.jl ├── modint.jl ├── dictchannel.jl ├── time.jl ├── Makefile ├── ndgrid.jl └── lru_test.jl ├── base ├── docs │ ├── helpdb.jl │ └── bindings.jl ├── .gitignore ├── threads.jl ├── string.jl ├── unicode.jl ├── markdown │ ├── Common │ │ └── Common.jl │ ├── Julia │ │ ├── Julia.jl │ │ └── interp.jl │ ├── render │ │ └── rich.jl │ └── IPython │ │ └── IPython.jl ├── nofloat_hashing.jl ├── i18n.jl ├── libgit2 │ ├── blob.jl │ ├── utils.jl │ ├── status.jl │ ├── tree.jl │ ├── strarray.jl │ └── tag.jl ├── sparse │ └── abstractsparse.jl ├── linalg │ └── exceptions.jl ├── unicode │ └── types.jl ├── meta.jl ├── osutils.jl ├── lock.jl └── options.jl ├── etc └── juliarc.jl ├── .gitignore ├── DEBUGGER.md └── Make.powerpc /VERSION: -------------------------------------------------------------------------------- 1 | 0.5.0-dev 2 | -------------------------------------------------------------------------------- /test/perf/.gitignore: -------------------------------------------------------------------------------- 1 | big.txt 2 | -------------------------------------------------------------------------------- /contrib/vagrant/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant 2 | -------------------------------------------------------------------------------- /deps/.gitignore: -------------------------------------------------------------------------------- 1 | /srccache 2 | /build 3 | -------------------------------------------------------------------------------- /test/perf/micro/java/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /test/perf/shootout/.gitignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | UnicodeData.txt 2 | _build/ 3 | -------------------------------------------------------------------------------- /test/perf/kernel/.gitattributes: -------------------------------------------------------------------------------- 1 | *.tsv binary 2 | -------------------------------------------------------------------------------- /test/perf/micro/benchmarks/.gitignore: -------------------------------------------------------------------------------- 1 | /*.csv 2 | -------------------------------------------------------------------------------- /test/perf/micro/bin/.gitignore: -------------------------------------------------------------------------------- 1 | /perf* 2 | /fperf* 3 | -------------------------------------------------------------------------------- /contrib/mac/app/.gitignore: -------------------------------------------------------------------------------- 1 | julia/ 2 | dmg/ 3 | *.dmg 4 | -------------------------------------------------------------------------------- /ui/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /*.do 3 | /*.dSYM 4 | /*.obj 5 | /*.pdb 6 | -------------------------------------------------------------------------------- /deps/checksums/fftw-3.3.4.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 2edab8c06b24feeb3b82bbb3ebf3e7b3 2 | -------------------------------------------------------------------------------- /deps/checksums/gmp-6.1.0.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | 86ee6e54ebfc4a90b643a65e402c4048 2 | -------------------------------------------------------------------------------- /deps/checksums/lapack-3.5.0.tgz/md5: -------------------------------------------------------------------------------- 1 | b1d3e3e425b2e44a06760ff173104bdf 2 | -------------------------------------------------------------------------------- /deps/checksums/Rmath-julia-0.1.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 4e3f9e41e7b8cd3070225d1f5e8b21d9 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.2.0.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0ae8a0bb796370b06647d9e005c0f3ea 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 8284891e3e311829b8e44ac813d0c9ef 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.7.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 8f9d27335e7331cf0a4711e952f21f01 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.7.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 0acd026b5529164197563d135a8fd83e 2 | -------------------------------------------------------------------------------- /deps/checksums/dsfmt-2.2.3.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 057c5a11d28296825fba584f561a4369 2 | -------------------------------------------------------------------------------- /deps/checksums/git-1.8.5.6.tar.gz/md5: -------------------------------------------------------------------------------- 1 | c437b3485cb157f8e84e5b2ccb135885 2 | -------------------------------------------------------------------------------- /deps/checksums/libcxx-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 59006e659ffb33f5222a7b79d4cd071e 2 | -------------------------------------------------------------------------------- /deps/checksums/lldb-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | c583c80c25e56a41e3e5ae7c2f442929 2 | -------------------------------------------------------------------------------- /deps/checksums/lldb-3.7.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | e5931740400d1dc3e7db4c7ba2ceff68 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | b98b9495e5655a672d6cb83e1a180f8e 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | bf8b3a2c79e61212c5409041dfdbd319 2 | -------------------------------------------------------------------------------- /deps/checksums/mpfr-3.1.3.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | 5fdfa3cfa5c86514ee4a241a1affa138 2 | -------------------------------------------------------------------------------- /deps/checksums/patchelf-0.8.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 407b229e6a681ffb0e2cdd5915cb2d01 2 | -------------------------------------------------------------------------------- /deps/checksums/pcre2-10.21.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | e79460519f916e3fcb204e59714bfd4a 2 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | /ccall 2 | /ccalltest 3 | /ccalltest.s 4 | /libccalltest.* 5 | -------------------------------------------------------------------------------- /deps/checksums/SuiteSparse-4.4.5.tar.gz/md5: -------------------------------------------------------------------------------- 1 | a2926c27f8a5285e4a10265cc68bbc18 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.2.0-testA.mtx/md5: -------------------------------------------------------------------------------- 1 | 2826846e98bcb009d339fb69973951d3 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 9c129ce24514467cfe492cf2fed8e2c4 2 | -------------------------------------------------------------------------------- /deps/checksums/libosxunwind-0.0.3.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 40510da5eb85e099050cadbc620d0af9 2 | -------------------------------------------------------------------------------- /deps/checksums/libunwind-1.1-julia2.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 8310cbf1288248996e5b4f5450e24588 2 | -------------------------------------------------------------------------------- /deps/checksums/virtualenv-15.0.0.tar.gz/md5: -------------------------------------------------------------------------------- 1 | d9652f8d154546926939066e596af83c 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.7.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 383c10affd513026f08936b5525523f5 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.7.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 1c6975daf30bb3b0473b53c3a1a6ff01 2 | -------------------------------------------------------------------------------- /contrib/ackrc: -------------------------------------------------------------------------------- 1 | --type-set=julia=.jl 2 | --type-add=julia:firstlinematch:/^#!.*\bjulia/ 3 | -------------------------------------------------------------------------------- /doc/images/jltypes.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/doc/images/jltypes.ai -------------------------------------------------------------------------------- /contrib/windows/7zS.sfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/contrib/windows/7zS.sfx -------------------------------------------------------------------------------- /deps/checksums/i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z/md5: -------------------------------------------------------------------------------- 1 | 6217dae4a1016b37b12aeed1cc950187 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.1-i686-w64-mingw32-juliadeps-r04.7z/md5: -------------------------------------------------------------------------------- 1 | d639c06cdad6b7c55c1dbdb82e3def15 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.1-x86_64-w64-mingw32-juliadeps-r04.7z/md5: -------------------------------------------------------------------------------- 1 | f27bdc73c67ce670b30a2494dcf82e58 2 | -------------------------------------------------------------------------------- /deps/checksums/x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z/md5: -------------------------------------------------------------------------------- 1 | b138576c92c425e8fa171a9d98e13b86 2 | -------------------------------------------------------------------------------- /contrib/mac/app/julia.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/contrib/mac/app/julia.icns -------------------------------------------------------------------------------- /contrib/windows/julia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/contrib/windows/julia.ico -------------------------------------------------------------------------------- /deps/libgit2.version: -------------------------------------------------------------------------------- 1 | LIBGIT2_BRANCH=v0.24.0 2 | LIBGIT2_SHA1=785d8c48ea8725691da3c50e7dae8751523d4c30 3 | -------------------------------------------------------------------------------- /deps/libuv.version: -------------------------------------------------------------------------------- 1 | LIBUV_BRANCH=julia-uv0.11.26 2 | LIBUV_SHA1=07730c4bd595b4d45a498a8ee0bcd53878ff7c10 3 | -------------------------------------------------------------------------------- /deps/openblas.version: -------------------------------------------------------------------------------- 1 | OPENBLAS_BRANCH=v0.2.17 2 | OPENBLAS_SHA1=a71e8c82f6a9f73093b631e5deab1e8da716b61f 3 | -------------------------------------------------------------------------------- /deps/openlibm.version: -------------------------------------------------------------------------------- 1 | OPENLIBM_BRANCH=v0.4.1 2 | OPENLIBM_SHA1=3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06 3 | -------------------------------------------------------------------------------- /deps/utf8proc.version: -------------------------------------------------------------------------------- 1 | UTF8PROC_BRANCH=v1.3 2 | UTF8PROC_SHA1=85789180158ac7fff85b9f008828d6ac44f072ea 3 | -------------------------------------------------------------------------------- /doc/images/travis-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/doc/images/travis-icon.png -------------------------------------------------------------------------------- /deps/checksums/libgit2-785d8c48ea8725691da3c50e7dae8751523d4c30.tar.gz/md5: -------------------------------------------------------------------------------- 1 | fd5c285856ae59d3aea3e316fb31885b 2 | -------------------------------------------------------------------------------- /deps/checksums/libuv-07730c4bd595b4d45a498a8ee0bcd53878ff7c10.tar.gz/md5: -------------------------------------------------------------------------------- 1 | b05f089b4ac277deaac0d8372b7d4ea6 2 | -------------------------------------------------------------------------------- /deps/checksums/openblas-a71e8c82f6a9f73093b631e5deab1e8da716b61f.tar.gz/md5: -------------------------------------------------------------------------------- 1 | a3850786d63f4af657d2aeb1baab5b20 2 | -------------------------------------------------------------------------------- /deps/checksums/openlibm-3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0b45305ae6812bf17e866fbae5df7d57 2 | -------------------------------------------------------------------------------- /deps/checksums/utf8proc-85789180158ac7fff85b9f008828d6ac44f072ea.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 9dab2320faeb9b7ca8623737b108a815 2 | -------------------------------------------------------------------------------- /contrib/debug_bootstrap.gdb: -------------------------------------------------------------------------------- 1 | file ../usr/bin/julia-debug 2 | r --build ../usr/lib/julia/sys0.bc sysimg.jl 3 | bt 4 | -------------------------------------------------------------------------------- /deps/checksums/openspecfun-381db9bc865e51de67be9dcaa1610a6f90029c72.tar.gz/md5: -------------------------------------------------------------------------------- 1 | f0b73590572edd8fa60d570aeba00631 2 | -------------------------------------------------------------------------------- /deps/openspecfun.version: -------------------------------------------------------------------------------- 1 | OPENSPECFUN_BRANCH=master 2 | OPENSPECFUN_SHA1=381db9bc865e51de67be9dcaa1610a6f90029c72 3 | -------------------------------------------------------------------------------- /src/support/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /*.do 3 | /*.obj 4 | /*.lib 5 | /*.pdb 6 | /libsupport.a 7 | /libsupport-debug.a 8 | -------------------------------------------------------------------------------- /test/perf/micro/.gitignore: -------------------------------------------------------------------------------- 1 | /perf.h 2 | /benchmarks.csv 3 | /benchmarks.txt 4 | /benchmarks.html 5 | gopath 6 | mods/* 7 | -------------------------------------------------------------------------------- /contrib/README.ackrc.txt: -------------------------------------------------------------------------------- 1 | The 'ackrc' file is for Ack (http://beyondgrep.com/) 2 | Place its contents in your ~/.ackrc file. 3 | -------------------------------------------------------------------------------- /doc/images/github_metadata_fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/doc/images/github_metadata_fork.png -------------------------------------------------------------------------------- /src/flisp/mkboot1.lsp: -------------------------------------------------------------------------------- 1 | ; -*- scheme -*- 2 | 3 | (load "system.lsp") 4 | (load "compiler.lsp") 5 | (make-system-image "flisp.boot") 6 | -------------------------------------------------------------------------------- /contrib/windows/7zSFX-config.txt: -------------------------------------------------------------------------------- 1 | ;!@Install@!UTF-8! 2 | Title="The Julia Language" 3 | RunProgram="julia-installer.exe" 4 | ;!@InstallEnd@! 5 | -------------------------------------------------------------------------------- /doc/images/github_metadata_develbranch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/doc/images/github_metadata_develbranch.png -------------------------------------------------------------------------------- /doc/images/github_metadata_pullrequest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaLangPt/julia/master/doc/images/github_metadata_pullrequest.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/broker.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("ZMQCM.jl") 4 | start_broker() 5 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc 2 | -------------------------------------------------------------------------------- /deps/checksums/dsfmt-2.2.3.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 6d8ddcd01aab3f9039f4f0288a8af53e290cc2f293ed8c4a8c9f3b3f12398e7eedfce8016117b425766ba89c61c86c13b3e420035b5f9bf91315b8b814c03662 2 | -------------------------------------------------------------------------------- /deps/checksums/fftw-3.3.4.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 1ee2c7bec3657f6846e63c6dfa71410563830d2b951966bf0123bd8f4f2f5d6b50f13b76d9a7b0eae70e44856f829ca6ceb3d080bb01649d1572c9f3f68e8eb1 2 | -------------------------------------------------------------------------------- /deps/checksums/git-1.8.5.6.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | fd004a5a99e8ff80556e669ef6e297a4eea9c9f9c58ef9162eef1c66580c4156165c81371ff5832e56ad729d6ed3fb1459a14d682cfd2b8c37c9ceb298be2ef3 2 | -------------------------------------------------------------------------------- /deps/checksums/gmp-6.1.0.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 3c82aeab9c1596d4da8afac2eec38e429e84f3211e1a572cf8fd2b546493c44c039b922a1133eaaa48bd7f3e11dbe795a384e21ed95cbe3ecc58d7ac02246117 2 | -------------------------------------------------------------------------------- /deps/checksums/lapack-3.5.0.tgz/sha512: -------------------------------------------------------------------------------- 1 | b948a0a0db032bda455ec4f519d4e89e4c29e29cecb5b6258ca61f68faaeeac9fdf4ece5c39ffcd0154c5505facbc392c7d09c8348b1d60bdd2685153ab2543f 2 | -------------------------------------------------------------------------------- /deps/checksums/mpfr-3.1.3.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 29f1f18628e8f46cb4f12f246cc8e67e44457b549bad9e6ec5dcc3af0e5ba0f60594aef489081cee5a439eb2a0a22c5e2a793a38bf2f501b43d37bae8d9b3280 2 | -------------------------------------------------------------------------------- /contrib/windows/juliarc.jl: -------------------------------------------------------------------------------- 1 | # Set up environment for Julia Windows binary distribution 2 | ENV["PATH"] = JULIA_HOME*";"*joinpath(JULIA_HOME,"..","Git","bin")*";"*ENV["PATH"] 3 | -------------------------------------------------------------------------------- /deps/checksums/Rmath-julia-0.1.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 1dd94eca05bc06c3f33e8be5087d3b1742d01c8b38588e0fa79b8f6b9998760bca21bee1b65873825c4dde2d994a8271166bc21f670a34810fa9db598473a887 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.2.0.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 50c8a9b43eeb23100265b06c1ce0d5a80dbc7fef2a48911c9cdcaeee3d19f2875e5282b7ec462375e4be70676d27bff8f892ea120bb5881fdcee2b8c558b061e 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.7.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 099d34cb019ea548c6ee85efd22b150beba0aa92061394fa3e423b1ebfe4a5c98c0586e5d56fc5c39e2b1606d36db59f442c056cc59473e32df76c8790c9d0ae 2 | -------------------------------------------------------------------------------- /deps/checksums/cfe-3.7.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 8e3285a32ad0fd4721fa77c4fb9709f31bb4e4f7cb5245357aaf57b0767b6ef18a30d902b59d1437a6febffb6c2128214f9ce5aa913bb298743221a28c4f9de5 2 | -------------------------------------------------------------------------------- /deps/checksums/libcxx-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 806ee0321ceac4d0bdcdad581208e8589d13f688124dfa75f484242fe299b8d423f6bd0172d674a01daf57b4f1e1a9751f5f331e734639917aa24f427b2f5e2c 2 | -------------------------------------------------------------------------------- /deps/checksums/lldb-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 73d24adb06a944244c2ad11f13711610fd54b5209afce7d0b7829439ec3bd0366cc2bac176b12defa5af73ab6115635022940c3eb176f448b45ea2402ecf2586 2 | -------------------------------------------------------------------------------- /deps/checksums/lldb-3.7.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 52157782ef13e2c8b7b35ff3ccc05887195fe46ddb6bafcf0707a3c46c1e034734b55342b8dbfc46cae7a8c3cb1012345284e4bedb2344c5016b8d19a12e90df 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | fe3bfefd3d49423831ad12b89f944ac9f469aaaaafdea1dd94fc7fb6d5cc9fbe66b6463796aeaabfc145ae474ec3ad68da41c4a011e8aa4bc650f1835af75388 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | ac521debc02f6deba96ef975d6a546b0c5c77299c1dbf5e1b87a7974ff5e7fd715bd7e384b92d9adf572ce47130bdbf6d3c648eb0d7f72f16f976292e4909e90 2 | -------------------------------------------------------------------------------- /deps/checksums/patchelf-0.8.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | f8b8420d7b5fcdd9aa17f318cd7314024831e990d422b8e566c48ab009978a4c8c2cff4623b906aa50cf8805328b7c9ecb6ea1d65ed8a1e1d44db282249d92c9 2 | -------------------------------------------------------------------------------- /deps/checksums/pcre2-10.21.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 82f16e5476919de66bbd15a96a0f769bc03f55e679280d470f13e932b660efb7f57637c42a5d0907d1a84f836636bf57756ea961ae1d5763463c6964a8c37bb6 2 | -------------------------------------------------------------------------------- /examples/quine.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | x="println(\"x=\$(repr(x))\\n\$x\")" 4 | println("x=$(repr(x))\n$x") 5 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /deps/checksums/SuiteSparse-4.4.5.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 7f9c19c3c58f61e7d82cd2de25eeeec910ad3d6a5c7c79c62a23cbb7dc880cddeca6efa9860a87b3b3c05e74385c8c67bf61d44149b700ac094898237915a6d9 2 | -------------------------------------------------------------------------------- /deps/checksums/arpack-ng-3.2.0-testA.mtx/sha512: -------------------------------------------------------------------------------- 1 | 00af7f2353441c4197c52d105d3670fe250a312b8e67ae2794246f2ce8cd0b63585e5c5ab764921d357efd9ad685fcc0ee5b8b8ee7ab9af2bea26ccbb97c50ba 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.7.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 2ba6abb3d6ec7f1469cfe1d48fde2069e9a767d19144f80f05516ac63f353ace90a9df3e9d1c1f708f3c397aba0ec61b12e4f105b25a2e1cd26b25b0dd252bc9 2 | -------------------------------------------------------------------------------- /deps/checksums/compiler-rt-3.7.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | bf434519ea0838264c30de1e1e8681320aa868df0ecc825a45c659077b963a4120c18216946558cbf8aea24a8ac8ec39af2066dab906bc7cabc0894d51d61325 2 | -------------------------------------------------------------------------------- /deps/checksums/libosxunwind-0.0.3.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 64c57c297b6b3779ed7d675d3ebcf471247b0d15bb560fce631afd82229adb352d438cf71509ab076610c6867bcc9ee359cf609c0257e53bea431235ff1da349 2 | -------------------------------------------------------------------------------- /deps/checksums/libunwind-1.1-julia2.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 5047890e727069c6ed74ca84bbe999ba6bc5c41d8d3914d6fbce19d18ff8a5944a7276d805ef5f67a857598852ae996a671c264d34a19123bb04d4daf6316f9a 2 | -------------------------------------------------------------------------------- /deps/checksums/virtualenv-15.0.0.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | d47bc903689f6e8824144dfb410f3cd01f4f03dbe2249a8a8ab10372b6c0129435403bdd11ad97032d3b2c3b8cefff95f9e9a0dc3c50676c30635103669de5ae 2 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/worker.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("ZMQCM.jl") 4 | 5 | start_worker(parse(Int,ARGS[1])) 6 | -------------------------------------------------------------------------------- /base/docs/helpdb.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | import .Docs: keywords 4 | 5 | include("helpdb/Base.jl") 6 | include("helpdb/Dates.jl") 7 | -------------------------------------------------------------------------------- /deps/checksums/i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z/sha512: -------------------------------------------------------------------------------- 1 | 1f38cc758725f124552285940cde6d9e072a594298a09f7a542a6cc28cb25d119d80d73918e4e9207694819825787abb6eba4a83cee5892e5acaf6350221b97f 2 | -------------------------------------------------------------------------------- /test/i18n.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | using Base.I18n 4 | 5 | @test locale()=="" 6 | locale("en_US") 7 | @test locale()=="en_US" 8 | -------------------------------------------------------------------------------- /test/perf/micro/java/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This file is a part of Julia. License is MIT: http://julialang.org/license 3 | 4 | mvn compile exec:java 5 | # requires maven and java 7 6 | -------------------------------------------------------------------------------- /base/.gitignore: -------------------------------------------------------------------------------- 1 | /pcre_h.jl 2 | /errno_h.jl 3 | /build_h.jl 4 | /fenv_constants.jl 5 | /file_constants.jl 6 | /uv_constants.jl 7 | /version_git.jl 8 | /version_git.jl.phony 9 | /userimg.jl 10 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.1-i686-w64-mingw32-juliadeps-r04.7z/sha512: -------------------------------------------------------------------------------- 1 | 93785655d61d3eec63a1834669153148102171115982bfc01011a1f154192395ee7e787efc52047dc63a2887a11832ae3faccd7cf3fae4b168ffcd160786adee 2 | -------------------------------------------------------------------------------- /deps/checksums/llvm-3.7.1-x86_64-w64-mingw32-juliadeps-r04.7z/sha512: -------------------------------------------------------------------------------- 1 | a61e0564816427be4c8d5005077354f01b9c4cb1c0abb1c6ccedf90b44654be4350edabe9a0c5fcd52833f1c4caa6aa286713879bec2eae96cb848c5422113c1 2 | -------------------------------------------------------------------------------- /deps/checksums/x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z/sha512: -------------------------------------------------------------------------------- 1 | 50dcb3aaab3e53d5ff4561079272daf473bacc8d7a2a3720e7c594ae6e402123cb3cc6f3eabaf67df8d94fa5c01bb3e45b5bb1bc7cbb87cd2beb6b5664e02072 2 | -------------------------------------------------------------------------------- /etc/juliarc.jl: -------------------------------------------------------------------------------- 1 | # This file should contain site-specific commands to be executed on Julia startup 2 | # Users should store their own personal commands in homedir(), in a file named .juliarc.jl 3 | 4 | -------------------------------------------------------------------------------- /test/perf/lapack/perf.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("../perfutil.jl") 4 | 5 | include("eig.jl") 6 | include("factorizations.jl") 7 | -------------------------------------------------------------------------------- /deps/checksums/libuv-07730c4bd595b4d45a498a8ee0bcd53878ff7c10.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 5bf5a4a026c57a26c8a4cbce2d69b4b12a0d325bd46a83c48ca8a24af1fc8548967f2060258e6cd751c8b86b653c42d41c42512fc6ce2114a06738332fdd243b 2 | -------------------------------------------------------------------------------- /deps/checksums/libgit2-785d8c48ea8725691da3c50e7dae8751523d4c30.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | a5d7b03c337e770194ed83497fa1c895cdd02ab518e0b1c87b42115f9d26b31de0bf3a54cbe80a6ed58fcb5d5440c71325714b5cb607892f67d0c6269c302211 2 | -------------------------------------------------------------------------------- /deps/checksums/openblas-a71e8c82f6a9f73093b631e5deab1e8da716b61f.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 0a3e7bb0660148207732a58d411bb492f674d57e6733eee1c293b749f00516efd9d47e62193a9ac480bbbddb0b25c5bd4a66eb9caa717a0d2906c9dcbb3c39fe 2 | -------------------------------------------------------------------------------- /deps/checksums/openlibm-3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | c6745389f6ee5bfc37d7055a49b6a13ae36e468c8ea387cf436fa0cbd97ba9aad0daf74941db24eebda831f78416905367ee006c45f8fe607fc9e8e460d11f9a 2 | -------------------------------------------------------------------------------- /deps/checksums/utf8proc-85789180158ac7fff85b9f008828d6ac44f072ea.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 3e0b7cb61d6fb8161d9890ed03485c445eee761ea228c4196af9fe190ca78ef9893f41f4a76ee2ecb49bcd42e69541cf6e763730970a130ab592e2956d1e8316 2 | -------------------------------------------------------------------------------- /doc/latex.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | %%%%%%%%%%%%%%%%%%%%% 4 | Julia Documentation 5 | %%%%%%%%%%%%%%%%%%%%% 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | manual/index 11 | stdlib/index 12 | 13 | -------------------------------------------------------------------------------- /deps/checksums/openspecfun-381db9bc865e51de67be9dcaa1610a6f90029c72.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 3b593db9a1dbd30a5c4547e47f6ac450189f9ba7076c0061eb08ac6d7be9e5865862462cfddcc3c292ade8de3e87d8728d5b1be51f8337a10fa20fd303f88a5a 2 | -------------------------------------------------------------------------------- /test/perf/blas/perf.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("../perfutil.jl") 4 | 5 | include("level1.jl") 6 | include("level2.jl") 7 | include("level3.jl") 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /contrib/mac/app/script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ROOT="${0%/script}" 4 | osascript 2>&1>/dev/null < myid() *2, [1:nworkers()]) 7 | println(resp) 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/devdocs/C.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _devdocs-c-index: 4 | 5 | ##################################### 6 | Developing/debugging Julia's C code 7 | ##################################### 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | backtraces 13 | debuggingtips 14 | valgrind 15 | -------------------------------------------------------------------------------- /test/perf/micro/bin/collect.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | while (<>) { 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 | -------------------------------------------------------------------------------- /contrib/ctags: -------------------------------------------------------------------------------- 1 | --langdef=julia 2 | --langmap=julia:.jl 3 | --regex-julia=/^[ \t]*(function|macro|abstract|type|typealias|immutable)[ \t]+([^ \t({[]+).*$/\2/f,function/ 4 | --regex-julia=/^[ \t]*(([^@#$ \t({[]+)|\(([^@#$ \t({[]+)\)|\((\$)\))[ \t]*(\{.*\})?[ \t]*\([^#]*\)[ \t]*=([^=].*$|$)/\2\3\4/f,function/ 5 | -------------------------------------------------------------------------------- /test/bigfloat.jl: -------------------------------------------------------------------------------- 1 | @test big(2.0)^big(3) == 8 2 | 3 | for T in [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, BigInt] 4 | @test T(2)^big(3.0) == 8 5 | @test big(2.0)^T(3) == 8 6 | end 7 | 8 | # issue 15659 9 | @test (setprecision(53) do; big(1/3); end) < 1//3 10 | -------------------------------------------------------------------------------- /examples/clustermanager/0mq/head.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /test/sparse.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("sparsedir/sparse.jl") 4 | include("sparsedir/sparsevector.jl") 5 | if Base.USE_GPL_LIBS 6 | include("sparsedir/umfpack.jl") 7 | include("sparsedir/cholmod.jl") 8 | include("sparsedir/spqr.jl") 9 | end 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/support/ptrhash.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef PTRHASH_H 4 | #define 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 | -------------------------------------------------------------------------------- /.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 | *.do 16 | *.o 17 | *.obj 18 | *.so 19 | *.dylib 20 | *.dSYM 21 | *.jl.cov 22 | *.jl.*.cov 23 | *.jl.mem 24 | *.ji 25 | 26 | .DS_Store 27 | -------------------------------------------------------------------------------- /contrib/filterArgs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: http://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 | if [[ $i == -L* ]]; then 8 | echo "\"${i:2:${#i}}\"" 9 | fi 10 | done 11 | -------------------------------------------------------------------------------- /test/unicode.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("unicode/UnicodeError.jl") 4 | include("unicode/types.jl") 5 | include("unicode/checkstring.jl") 6 | include("unicode/utf8.jl") 7 | include("unicode/utf16.jl") 8 | include("unicode/utf32.jl") 9 | include("unicode/utf8proc.jl") 10 | -------------------------------------------------------------------------------- /test/perf/sparse/perf.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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/unicode/UnicodeError.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | let io = IOBuffer() 4 | show(io, UnicodeError(Base.UTF_ERR_SHORT, 1, 10)) 5 | check = "UnicodeError: invalid UTF-8 sequence starting at index 1 (0xa missing one or more continuation bytes)" 6 | @test takebuf_string(io) == check 7 | end 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /base/unicode.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("unicode/UnicodeError.jl") 4 | include("unicode/types.jl") 5 | include("unicode/checkstring.jl") 6 | include("unicode/utf8.jl") 7 | include("unicode/utf16.jl") 8 | include("unicode/utf32.jl") 9 | include("unicode/utf8proc.jl") 10 | importall .UTF8proc 11 | -------------------------------------------------------------------------------- /deps/libgit2-require-openssl.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 73c9630..3dedd0a 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -217,7 +217,7 @@ ELSE () 6 | ENDIF () 7 | 8 | IF (NOT AMIGA AND USE_OPENSSL) 9 | - FIND_PACKAGE(OpenSSL) 10 | + FIND_PACKAGE(OpenSSL REQUIRED) 11 | ENDIF () 12 | 13 | IF (CURL_FOUND) 14 | -------------------------------------------------------------------------------- /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/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/perfgeneric.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /deps/Versions.make: -------------------------------------------------------------------------------- 1 | LLVM_VER = 3.7.1 2 | LLVM_LIB_SUFFIX = 3 | PCRE_VER = 10.21 4 | DSFMT_VER = 2.2.3 5 | LAPACK_VER = 3.5.0 6 | ARPACK_VER = 3.2.0 7 | FFTW_VER = 3.3.4 8 | SUITESPARSE_VER = 4.4.5 9 | UNWIND_VER = 1.1-julia2 10 | OSXUNWIND_VER = 0.0.3 11 | GMP_VER = 6.1.0 12 | MPFR_VER = 3.1.3 13 | PATCHELF_VER = 0.8 14 | GIT_VER = 1.8.5.6 15 | VIRTUALENV_VER = 15.0.0 16 | RMATH_JULIA_VER = 0.1 17 | -------------------------------------------------------------------------------- /test/perf/report.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | using HTTPClient.HTTPC 4 | 5 | env_name = chomp(readstring(`hostname`)) 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/README: -------------------------------------------------------------------------------- 1 | This directory contains the Julia version of the "The 2 | Computer Language Benchmarks Game": 3 | http://shootout.alioth.debian.org/ 4 | 5 | The source code for all the benchmarks are available there: 6 | http://alioth.debian.org/scm/viewvc.php/shootout/bench/?root=shootout 7 | 8 | See specific Julia discussion here: 9 | https://github.com/JuliaLang/julia/issues/660 10 | -------------------------------------------------------------------------------- /src/support/strtod.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef STRTOD_H 4 | #define 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 | -------------------------------------------------------------------------------- /base/markdown/Common/Common.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | include("block.jl") 4 | include("inline.jl") 5 | 6 | @flavor common [list, indentcode, blockquote, hashheader, horizontalrule, 7 | paragraph, 8 | 9 | linebreak, escapes, inline_tex, inline_code, 10 | asterisk_bold, asterisk_italic, image, footnote, link] 11 | -------------------------------------------------------------------------------- /examples/clustermanager/simple/test_simple.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | cmanpath = joinpath(dirname(@__FILE__), "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 | -------------------------------------------------------------------------------- /test/perf/kernel/indexing.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/workspace.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | script = """ 4 | # Issue #11948 5 | f(x) = x+1 6 | workspace() 7 | @assert !isdefined(:f) 8 | LastMain.f(2) 9 | 10 | # PR #12990 11 | io = IOBuffer() 12 | show(io, Pair) 13 | @assert takebuf_string(io) == "Pair{A,B}" 14 | @assert !Base.inbase(LastMain) 15 | """ 16 | exename = Base.julia_cmd() 17 | run(`$exename -f -e $script`) 18 | -------------------------------------------------------------------------------- /deps/find_python2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # LLVM requires 2.5 <= python2 < 3 4 | # 5 | 6 | valid_python() { 7 | $1 -c 'import sys; sys.exit(not (sys.version_info >= (2,5) and sys.version_info < (3,0)))' 2> /dev/null 8 | } 9 | 10 | for python in python python2 python2.7 python27 python2.6 python26 python2.5 python25; do 11 | if valid_python $python; then 12 | echo `which $python` 13 | break 14 | fi 15 | done 16 | 17 | -------------------------------------------------------------------------------- /test/unicode/types.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | nullstring16 = UInt16[] 4 | badstring16 = UInt16[0x0065] 5 | @test_throws UnicodeError UTF16String(nullstring16) 6 | @test_throws UnicodeError UTF16String(badstring16) 7 | 8 | nullstring32 = UInt32[] 9 | badstring32 = UInt32['a'] 10 | @test_throws UnicodeError UTF32String(nullstring32) 11 | @test_throws UnicodeError UTF32String(badstring32) 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/devdocs/julia.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _devdocs-index: 4 | 5 | #################################### 6 | Documentation of Julia's Internals 7 | #################################### 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | init 13 | eval 14 | ast 15 | types 16 | object 17 | functions 18 | callconv 19 | cartesian 20 | meta 21 | subarrays 22 | sysimg 23 | llvm 24 | stdio 25 | promote-op 26 | boundscheck 27 | -------------------------------------------------------------------------------- /test/testdefs.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | using Base.Test 4 | 5 | function runtests(name) 6 | @printf(" \033[1m*\033[0m \033[31m%-21s\033[0m", name) 7 | tt = @elapsed include("$name.jl") 8 | rss = Sys.maxrss() 9 | @printf(" in %6.2f seconds, maxrss %7.2f MB\n", tt, rss / 2^20) 10 | rss 11 | end 12 | 13 | # looking in . messes things up badly 14 | filter!(x->x!=".", LOAD_PATH) 15 | -------------------------------------------------------------------------------- /test/dates.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | module TestDates 4 | 5 | using Base.Dates 6 | using Base.Test 7 | 8 | include("dates/types.jl") 9 | include("dates/periods.jl") 10 | include("dates/accessors.jl") 11 | include("dates/query.jl") 12 | include("dates/arithmetic.jl") 13 | include("dates/conversions.jl") 14 | include("dates/ranges.jl") 15 | include("dates/adjusters.jl") 16 | include("dates/io.jl") 17 | 18 | end 19 | -------------------------------------------------------------------------------- /src/fenv_constants.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #include 4 | const JL_FE_INEXACT = FE_INEXACT 5 | const JL_FE_UNDERFLOW = FE_UNDERFLOW 6 | const JL_FE_OVERFLOW = FE_OVERFLOW 7 | const JL_FE_DIVBYZERO = FE_DIVBYZERO 8 | const JL_FE_INVALID = FE_INVALID 9 | const JL_FE_TONEAREST = FE_TONEAREST 10 | const JL_FE_UPWARD = FE_UPWARD 11 | const JL_FE_DOWNWARD = FE_DOWNWARD 12 | const JL_FE_TOWARDZERO = FE_TOWARDZERO 13 | -------------------------------------------------------------------------------- /doc/stdlib/index.rst: -------------------------------------------------------------------------------- 1 | .. _stdlib-index: 2 | 3 | ############################ 4 | The Julia Standard Library 5 | ############################ 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | base 11 | collections 12 | math 13 | numbers 14 | strings 15 | arrays 16 | parallel 17 | linalg 18 | constants 19 | file 20 | io-network 21 | punctuation 22 | sort 23 | pkg 24 | dates 25 | test 26 | c 27 | libc 28 | libdl 29 | profile 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /contrib/mac/app/README: -------------------------------------------------------------------------------- 1 | To build the Julia.app OS X application bundle: 2 | 3 | 1. First install Winston, and compile all the relevant libraries with Pkg.add("Winston"). The libraries are copied from ~/.julia/{Cairo,Tk} in here. 4 | 2. Make sure Platypus is installed with its command line tool (from Platypus Preferences) 5 | 3. Run `make` here to create a self-sufficient julia distribution with Cairo and Tk. 6 | 7 | The `julia.icns` file provides the Julia icon, and the `script` file launches julia in a terminal. 8 | -------------------------------------------------------------------------------- /test/perf/micro/scala/build.sbt: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /base/nofloat_hashing.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/laplace.m: -------------------------------------------------------------------------------- 1 | % Run this script with tic; laplace; toc, and multiply the time by 2 | % 1000 to get time in ms - in order to compare with laplace.jl. 3 | 4 | dx = 0.1; 5 | dy = 0.1; 6 | dx2 = dx*dx; 7 | dy2 = dy*dy; 8 | 9 | N = 150; 10 | Niter = 2^10; 11 | 12 | u = zeros(N,N); 13 | u(1,:) = 1; 14 | 15 | for i = 1:Niter 16 | u(2:end-1, 2:end-1) = ((u(1:end-2, 2:end-1) + u(3:end, 2:end-1))*dy2 + (u(2:end-1,1:end-2) + u(2:end-1, 3:end))*dx2) * (1./ (2*(dx2+dy2))); 17 | end 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/perf/blas/level2.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /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 = readstring(NEWS) 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 | -------------------------------------------------------------------------------- /test/string.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | ## generic string uses only endof and next; used for testing ## 4 | 5 | immutable GenericString <: AbstractString 6 | string::AbstractString 7 | end 8 | 9 | Base.endof(s::GenericString) = endof(s.string) 10 | Base.next(s::GenericString, i::Int) = next(s.string, i) 11 | 12 | include("strings/basic.jl") 13 | include("strings/types.jl") 14 | include("strings/search.jl") 15 | include("strings/util.jl") 16 | include("strings/io.jl") 17 | -------------------------------------------------------------------------------- /src/support/timefuncs.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef TIMEFUNCS_H 4 | #define 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 | -------------------------------------------------------------------------------- /base/i18n.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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::ByteString) 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 | -------------------------------------------------------------------------------- /test/perf/blas/level3.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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/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 | -------------------------------------------------------------------------------- /src/support/dirpath.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef DIRPATH_H 4 | #define 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 | -------------------------------------------------------------------------------- /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 | 14 | ifeq ($(LLVM_VER_SHORT),$(filter $(LLVM_VER_SHORT),3.3 3.4 3.5 3.6 3.7 3.8)) 15 | LLVM_USE_CMAKE := 0 16 | else 17 | LLVM_USE_CMAKE := 1 18 | endif 19 | -------------------------------------------------------------------------------- /contrib/mac/juliarc.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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:$(joinpath(ROOT, "libexec", "git-core")):$(ENV["PATH"])" 7 | ENV["FONTCONFIG_PATH"] = joinpath(ROOT, "etc", "fonts") 8 | ENV["GIT_EXEC_PATH"] = joinpath(ROOT, "libexec", "git-core") 9 | ENV["GIT_TEMPLATE_DIR"] = joinpath(ROOT, "share", "git-core") 10 | ENV["TK_LIBRARY"] = "/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts" 11 | end 12 | -------------------------------------------------------------------------------- /examples/bubblesort.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | import Base.Sort 4 | immutable 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 | -------------------------------------------------------------------------------- /test/TestHelpers.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | module TestHelpers 4 | 5 | type FakeTerminal <: Base.Terminals.UnixTerminal 6 | in_stream::Base.IO 7 | out_stream::Base.IO 8 | err_stream::Base.IO 9 | hascolor::Bool 10 | raw::Bool 11 | FakeTerminal(stdin,stdout,stderr,hascolor=true) = 12 | new(stdin,stdout,stderr,hascolor,false) 13 | end 14 | 15 | Base.Terminals.hascolor(t::FakeTerminal) = t.hascolor 16 | Base.Terminals.raw!(t::FakeTerminal, raw::Bool) = t.raw = raw 17 | Base.Terminals.size(t::FakeTerminal) = (24, 80) 18 | 19 | end 20 | -------------------------------------------------------------------------------- /src/support/ptrhash.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /base/markdown/Julia/Julia.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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, github_table, horizontalrule, setextheader, paragraph, 12 | 13 | linebreak, escapes, tex, interp, en_dash, inline_tex, inline_code, 14 | asterisk_bold, asterisk_italic, image, footnote, link] 15 | -------------------------------------------------------------------------------- /test/test_sourcepath.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # source path in tasks 4 | path = Base.source_path()::ByteString # 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/perf/simd/inner.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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/remote.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # Check that serializer hasn't gone out-of-frame 4 | @test Serializer.sertag(Symbol) == 2 5 | @test Serializer.sertag(()) == 47 6 | @test Serializer.sertag(false) == 123 7 | 8 | # issue #1770 9 | let 10 | a = ['T', 'e', 's', 't'] 11 | f = IOBuffer() 12 | serialize(f, a) 13 | seek(f, 0) 14 | @test deserialize(f) == a 15 | f = IOBuffer() 16 | serialize(f, a) 17 | seek(f, 0) 18 | @test deserialize(f) == a 19 | 20 | # issue #4414 21 | seek(f,0) 22 | serialize(f, :β) 23 | seek(f,0) 24 | @test deserialize(f) === :β 25 | end 26 | -------------------------------------------------------------------------------- /base/libgit2/blob.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function content(blob::GitBlob) 4 | return ccall((:git_blob_rawcontent, :libgit2), Ptr{Void}, (Ptr{Void},), blob.ptr) 5 | end 6 | 7 | function Base.length(blob::GitBlob) 8 | return ccall((:git_blob_rawsize, :libgit2), Int64, (Ptr{Void},), blob.ptr) 9 | end 10 | 11 | function lookup(repo::GitRepo, oid::Oid) 12 | blob_ptr_ptr = Ref{Ptr{Void}}(C_NULL) 13 | @check ccall((:git_blob_lookup, :libgit2), Cint, 14 | (Ptr{Ptr{Void}}, Ptr{Void}, Ref{Oid}), 15 | blob_ptr_ptr, repo.ptr, Ref(oid)) 16 | return GitBlob(blob_ptr_ptr[]) 17 | end 18 | -------------------------------------------------------------------------------- /src/support/libsupport.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef LIBSUPPORT_H 4 | #define 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/manual/unicode-input.rst: -------------------------------------------------------------------------------- 1 | .. _man-unicode-input: 2 | 3 | *************** 4 | Unicode Input 5 | *************** 6 | 7 | .. only:: html 8 | 9 | .. warning:: 10 | This table may appear to contain missing characters in the second column, 11 | or even show characters that are inconsistent with the characters as they 12 | are rendered in the Julia REPL. In these cases, users are strongly 13 | advised to check their choice of fonts in their browser and REPL 14 | environment, as there are known issues with glyphs in many fonts. 15 | 16 | .. include:: unicode-input-table.rst 17 | 18 | .. only:: latex 19 | 20 | Please see the online documentation. 21 | 22 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | TESTS = all linalg $(filter-out TestHelpers runtests testdefs,$(patsubst $(SRCDIR)/%.jl,%,$(wildcard $(SRCDIR)/*.jl $(SRCDIR)/linalg/*.jl))) 8 | 9 | default: all 10 | 11 | $(TESTS): 12 | @cd $(SRCDIR) && $(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no ./runtests.jl $@) 13 | 14 | perf: 15 | @$(MAKE) -C $(SRCDIR)/perf all 16 | 17 | clean: 18 | @$(MAKE) -C perf $@ 19 | 20 | .PHONY: $(TESTS) perf clean 21 | -------------------------------------------------------------------------------- /examples/queens.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | addqueen(queens::Array{Vector{Int}}, queen::Vector{Int}) = push!(copy(queens), queen) 4 | 5 | hitsany(queen::Vector{Int}, queens::Array{Vector{Int}}) = any(x->hits(queen, x), queens) 6 | hits(a::Array{Int}, b::Array{Int}) = any(a .== b) || abs(a-b)[1] == abs(a-b)[2] 7 | 8 | function solve(x, y, n, d=Array(Vector{Int}, 0)) 9 | if n == 0 10 | return d 11 | end 12 | for px = 1:x 13 | for py = 1:y 14 | if !hitsany([px, py], d) 15 | s = solve(x, y, n-1, addqueen(d, [px, py])) 16 | s != nothing && return s 17 | end 18 | end 19 | end 20 | return nothing 21 | end 22 | -------------------------------------------------------------------------------- /src/support/arraylist.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef ARRAYLIST_H 4 | #define 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/libsupportinit.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /test/perf/simd/sum_reduce.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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/blas/level1.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /deps/llvm-3.7.1_3.patch: -------------------------------------------------------------------------------- 1 | Index: /lib/Analysis/ScalarEvolutionExpander.cpp 2 | =================================================================== 3 | --- /lib/Analysis/ScalarEvolutionExpander.cpp 4 | +++ /lib/Analysis/ScalarEvolutionExpander.cpp 5 | @@ -1273,6 +1273,11 @@ 6 | if (!SE.dominates(Step, L->getHeader())) { 7 | PostLoopScale = Step; 8 | Step = SE.getConstant(Normalized->getType(), 1); 9 | + if (!PostLoopOffset) { 10 | + // otherwise, Start is known to already be a constant zero 11 | + PostLoopOffset = Start; 12 | + Start = SE.getConstant(Normalized->getType(), 0); 13 | + } 14 | Normalized = 15 | cast(SE.getAddRecExpr( 16 | Start, Step, Normalized->getLoop(), 17 | -------------------------------------------------------------------------------- /test/parallel.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # Run the parallel test outside of the main driver since it needs its own 4 | # set of dedicated workers. 5 | 6 | inline_flag = Base.JLOptions().can_inline == 1 ? `` : `--inline=no` 7 | cov_flag = `` 8 | if Base.JLOptions().code_coverage == 1 9 | cov_flag = `--code-coverage=user` 10 | elseif Base.JLOptions().code_coverage == 2 11 | cov_flag = `--code-coverage=all` 12 | end 13 | 14 | cmd = `$(Base.julia_cmd()) $inline_flag $cov_flag --check-bounds=yes --depwarn=error parallel_exec.jl` 15 | 16 | if !success(pipeline(cmd; stdout=STDOUT, stderr=STDERR)) && ccall(:jl_running_on_valgrind,Cint,()) == 0 17 | error("Parallel test failed, cmd : $cmd") 18 | end 19 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/for_laplace.f90: -------------------------------------------------------------------------------- 1 | SUBROUTINE for_update1(u, dx2, dy2, nx, ny) 2 | real(8), intent(inout) :: u(nx,ny) 3 | real(8), intent(in) :: dx2, dy2 4 | integer, intent(in) :: nx, ny 5 | integer :: i, j 6 | 7 | DO j = 2, ny-1 8 | DO i = 2, nx-1 9 | u(i, j) = ((u(i+1, j) + u(i-1, j)) * dy2 + & 10 | (u(i, j+1) + u(i, j-1)) * dx2) * (1./ (2*(dx2+dy2))) 11 | END DO 12 | END DO 13 | END SUBROUTINE 14 | 15 | SUBROUTINE for_update2(u, dx2, dy2, nx, ny) 16 | real(8), intent(inout) :: u(nx,ny) 17 | real(8), intent(in) :: dx2, dy2 18 | integer, intent(in) :: nx, ny 19 | 20 | 21 | u(2:nx-1,2:ny-1) = ((u(3:,2:ny-1)+u(:ny-2,2:ny-1))*dy2 + & 22 | (u(2:nx-1,3:) + u(2:nx-1,:ny-2))*dx2) * (1./ (2*(dx2+dy2))) 23 | END SUBROUTINE 24 | -------------------------------------------------------------------------------- /deps/instcombine-llvm-3.3.patch: -------------------------------------------------------------------------------- 1 | diff -u -r -N llvm-3.3.src/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp llvm-3.3/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 2 | --- llvm-3.3.src/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 2013-01-02 06:36:10.000000000 -0500 3 | +++ llvm-3.3/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 2014-06-18 23:11:49.000000000 -0400 4 | @@ -754,7 +754,7 @@ 5 | ComputeMaskedBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth+1); 6 | // If it's known zero, our sign bit is also zero. 7 | if (LHSKnownZero.isNegative()) 8 | - KnownZero |= LHSKnownZero; 9 | + KnownZero.setBit(KnownZero.getBitWidth() - 1); 10 | } 11 | break; 12 | case Instruction::URem: { 13 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/laplace2.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | dx = 0.1 4 | dy = 0.1 5 | dx2 = dx*dx 6 | dy2 = dy*dy 7 | 8 | def py_update(u,nx,ny): 9 | for i in xrange(1,nx-1): 10 | for j in xrange(1, ny-1): 11 | u[i][j] = ((u[i+1][j] + u[i-1][j]) * dy2 + 12 | (u[i][j+1] + u[i][j-1]) * dx2) / (2*(dx2+dy2)) 13 | 14 | def calc(N, Niter=100): 15 | u = [[0.0]*N for i in xrange(N)] 16 | for i in xrange(N): 17 | u[0][i] = 1.0 18 | for i in range(Niter): 19 | py_update(u,N,N) 20 | return u 21 | 22 | start = time.time() 23 | u = calc(150,8000) 24 | elapsed = time.time() - start 25 | print "Python: %f seconds" % elapsed 26 | 27 | import pickle 28 | f = open('myfile.pkl', 'w') 29 | pickle.dump(u, f) 30 | f.close() 31 | -------------------------------------------------------------------------------- /test/perf/simd/axpy.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /src/uv_constants.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /examples/modint.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | module ModInts 4 | export ModInt 5 | 6 | import Base: +, -, * 7 | 8 | immutable ModInt{n} <: Integer 9 | k::Int 10 | ModInt(k) = new(mod(k,n)) 11 | end 12 | 13 | -{n}(a::ModInt{n}) = ModInt{n}(-a.k) 14 | +{n}(a::ModInt{n}, b::ModInt{n}) = ModInt{n}(a.k+b.k) 15 | -{n}(a::ModInt{n}, b::ModInt{n}) = ModInt{n}(a.k-b.k) 16 | *{n}(a::ModInt{n}, b::ModInt{n}) = ModInt{n}(a.k*b.k) 17 | 18 | Base.convert{n}(::Type{ModInt{n}}, i::Int) = ModInt{n}(i) 19 | Base.promote_rule{n}(::Type{ModInt{n}}, ::Type{Int}) = ModInt{n} 20 | 21 | Base.show{n}(io::IO, k::ModInt{n}) = print(io, "$(k.k) mod $n") 22 | Base.showcompact(io::IO, k::ModInt) = print(io, k.k) 23 | 24 | Base.inv{n}(a::ModInt{n}) = ModInt{n}(invmod(a.k, n)) 25 | 26 | end # module 27 | -------------------------------------------------------------------------------- /src/file_constants.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /deps/osx-10.10.llvm-3.3.patch: -------------------------------------------------------------------------------- 1 | --- llvm-3.3.src/Makefile.rules.old 2014-07-29 12:01:50.000000000 +0530 2 | +++ llvm-3.3/Makefile.rules 2014-07-29 12:02:10.000000000 +0530 3 | @@ -571,9 +571,9 @@ ifeq ($(HOST_OS),Darwin) 4 | DARWIN_VERSION := `sw_vers -productVersion` 5 | endif 6 | # Strip a number like 10.4.7 to 10.4 7 | - DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/') 8 | + DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/') 9 | # Get "4" out of 10.4 for later pieces in the makefile. 10 | - DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/') 11 | + DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]+).*/\1/') 12 | 13 | LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress 14 | SharedLinkOptions := -dynamiclib 15 | -------------------------------------------------------------------------------- /src/support/hashing.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef HASHING_H 4 | #define HASHING_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | uint_t nextipow2(uint_t i); 11 | JL_DLLEXPORT uint32_t int32hash(uint32_t a); 12 | JL_DLLEXPORT uint64_t int64hash(uint64_t key); 13 | JL_DLLEXPORT uint32_t int64to32hash(uint64_t key); 14 | #ifdef _P64 15 | #define inthash int64hash 16 | #else 17 | #define inthash int32hash 18 | #endif 19 | JL_DLLEXPORT uint64_t memhash(const char *buf, size_t n); 20 | JL_DLLEXPORT uint64_t memhash_seed(const char *buf, size_t n, uint32_t seed); 21 | JL_DLLEXPORT uint32_t memhash32(const char *buf, size_t n); 22 | JL_DLLEXPORT uint32_t memhash32_seed(const char *buf, size_t n, uint32_t seed); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /base/libgit2/utils.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function version() 4 | major = Ref{Cint}(0) 5 | minor = Ref{Cint}(0) 6 | patch = Ref{Cint}(0) 7 | ccall((:git_libgit2_version, :libgit2), Void, 8 | (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}), major, minor, patch) 9 | return VersionNumber(major[], minor[], patch[]) 10 | end 11 | 12 | isset(val::Integer, flag::Integer) = (val & flag == flag) 13 | 14 | function prompt(msg::AbstractString; default::AbstractString="", password::Bool=false) 15 | msg = !isempty(default) ? msg*" [$default]:" : msg*":" 16 | uinput = if password 17 | bytestring(ccall(:getpass, Cstring, (Cstring,), msg)) 18 | else 19 | print(msg) 20 | chomp(readline(STDIN)) 21 | end 22 | isempty(uinput) ? default : uinput 23 | end 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /contrib/windows/julia.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 1 VERSIONINFO 3 | FILEVERSION JLVER 4 | PRODUCTVERSION JLVER 5 | /* 6 | FILEFLAGSMASK VS_FF_PRERELEASE 7 | FILEFLAGS VS_FF_PRERELEASE 8 | */ 9 | FILEOS VOS_DOS_WINDOWS32 10 | FILETYPE VFT_APP 11 | BEGIN 12 | BLOCK "StringFileInfo" 13 | BEGIN 14 | BLOCK "040904E4" 15 | BEGIN 16 | VALUE "CompanyName", "JuliaLang" 17 | VALUE "FileDescription", "Julia Programming Language" 18 | VALUE "FileVersion", JLVER_STR 19 | VALUE "InternalName", "julia" 20 | VALUE "LegalCopyright", "MIT Licensed" 21 | VALUE "OriginalFilename", "julia.exe" 22 | VALUE "ProductName", "Julia" 23 | VALUE "ProductVersion", JLVER_STR 24 | END 25 | END 26 | 27 | BLOCK "VarFileInfo" 28 | BEGIN 29 | /* US English, Unicode */ 30 | VALUE "Translation", 0x409, 1200 31 | END 32 | END 33 | 2 ICON "julia.ico" 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /base/markdown/render/rich.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function tohtml(io::IO, m::MIME"text/html", x) 4 | writemime(io, m, x) 5 | end 6 | 7 | function tohtml(io::IO, m::MIME"text/plain", x) 8 | htmlesc(io, sprint(writemime, 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 | writemime(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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /contrib/mac/app/run-install-name-tool-change.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: http://julialang.org/license 3 | 4 | if [ $# -lt 3 ]; then 5 | echo "Usage: $0 library old_prefix new_prefix action" 6 | exit 1 7 | fi 8 | 9 | LIBRARY=$1 10 | WRONG_PREFIX=$2 11 | RIGHT_PREFIX="@executable_path/../$3" 12 | ACTION=$4 13 | 14 | if [ "x$ACTION" == "xchange" ]; then 15 | libs="`otool -L $LIBRARY 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $WRONG_PREFIX | sort | uniq`" 16 | for lib in $libs; do 17 | if ! echo $lib | grep --silent "@executable_path" ; then 18 | fixed=`echo $lib | sed -e s,\$WRONG_PREFIX,\$RIGHT_PREFIX,` 19 | install_name_tool -change $lib $fixed $LIBRARY 20 | fi 21 | done; 22 | elif [ "x$ACTION" == "xid" ]; then 23 | lib="`otool -D $LIBRARY 2>/dev/null | grep ^$WRONG_PREFIX`" 24 | install_name_tool -id "$RIGHT_PREFIX/$lib" $LIBRARY; 25 | fi 26 | 27 | -------------------------------------------------------------------------------- /src/support/bitvector.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef BITVECTOR_H 4 | #define 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 | JL_DLLEXPORT uint64_t bitvector_next(uint32_t *b, uint64_t n0, uint64_t n); 19 | 20 | JL_DLLEXPORT 21 | uint64_t bitvector_count(uint32_t *b, uint64_t offs, uint64_t nbits); 22 | JL_DLLEXPORT 23 | uint32_t bitvector_any1(uint32_t *b, uint64_t offs, uint64_t nbits); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/c_laplace.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 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 | -------------------------------------------------------------------------------- /test/loading.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | using Base.Test 4 | 5 | @test @__LINE__ == 5 6 | 7 | include("test_sourcepath.jl") 8 | thefname = "the fname!//\\&\0\1*" 9 | @test include_string("include_string_test() = @__FILE__", thefname)() == Base.source_path() 10 | @test include_string("Base.source_path()", thefname) == Base.source_path() 11 | @test basename(@__FILE__) == "loading.jl" 12 | @test isabspath(@__FILE__) 13 | 14 | # Issue #5789 and PR #13542: 15 | let true_filename = "cAsEtEsT.jl", lowered_filename="casetest.jl" 16 | touch(true_filename) 17 | @test Base.isfile_casesensitive(true_filename) 18 | @test !Base.isfile_casesensitive(lowered_filename) 19 | rm(true_filename) 20 | end 21 | 22 | # Test Unicode normalization; pertinent for OS X 23 | let nfc_name = "\U00F4.jl" 24 | touch(nfc_name) 25 | @test Base.isfile_casesensitive(nfc_name) 26 | rm(nfc_name) 27 | end 28 | -------------------------------------------------------------------------------- /contrib/check-whitespace.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This file is a part of Julia. License is MIT: http://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 | *.md 20 | *.rst 21 | *.sh 22 | *.yml 23 | *Makefile 24 | ' 25 | 26 | # TODO: Look also for trailing empty lines, and missing '\n' after the last line 27 | if git --no-pager grep --color -n --full-name -e ' $' -- $file_patterns; then 28 | echo "Error: trailing whitespace found in source file(s)" 29 | echo "" 30 | echo "This can often be fixed with:" 31 | echo " git rebase --whitespace=fix HEAD~1" 32 | echo "or" 33 | echo " git rebase --whitespace=fix master" 34 | echo "and then a forced push of the correct branch" 35 | exit 1 36 | fi 37 | -------------------------------------------------------------------------------- /contrib/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: http://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 | # Copy file, then take output of the form 'src' -> 'dest' and get only 'dest' 19 | DESTFILE=$(LC_ALL=C cp -va $SRC $DEST | sed -e $'s/ -> /\\\n/g' | tail -n 1) 20 | 21 | # If there are surrounding quotes, remove them. We do this simply by knowing that the destination is always an absolute path 22 | if [ "$(echo $DESTFILE | head -c1)" != "/" ]; then 23 | DESTFILE=$(echo $DESTFILE | awk '{print substr($0, 2, length-2)}') 24 | fi 25 | 26 | # Do the chmod dance, and ignore errors on platforms that don't like setting permissions of symlinks 27 | chmod $PERMS $DESTFILE 2>/dev/null 28 | done 29 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/cilk_laplace.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #include 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 5 | 6 | if [ -z "$1" ]; then 7 | echo "Usage: $0 " 8 | exit 1 9 | fi 10 | 11 | private_libdir=$1 12 | 13 | if [ ! -f "$private_libdir/libjulia.so" ]; then 14 | echo "ERROR: Could not open $private_libdir/libjulia.so" >&2 15 | exit 2 16 | fi 17 | 18 | find_shlib () 19 | { 20 | if [ -f "$private_libdir/lib$1.so" ]; then 21 | ldd "$private_libdir/lib$1.so" | grep $2 | cut -d' ' -f3 | xargs 22 | fi 23 | } 24 | 25 | # Discover libstdc++ location and name 26 | LIBSTD=$(find_shlib "julia" "libstdc++.so") 27 | LIBSTD_NAME=$(basename $LIBSTD) 28 | LIBSTD_DIR=$(dirname $LIBSTD) 29 | 30 | if [ ! -f "$private_libdir/$LIBSTD_NAME" ] && [ -f "$LIBSTD_DIR/$LIBSTD_NAME" ]; then 31 | cp -v "$LIBSTD_DIR/$LIBSTD_NAME" "$private_libdir" 32 | chmod 755 "$private_libdir/$LIBSTD_NAME" 33 | fi 34 | -------------------------------------------------------------------------------- /test/perf/sparse/getindex_skinny.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # Test getindex for skinny sparse matrix 4 | function sparse_getindex_skinny_perf() 5 | 6 | seed = 1 7 | srand(seed) 8 | 9 | # matsize = (size(A,1), nnz(A)) 10 | matsize = [ 11 | (2^12,1 ), 12 | (2^12,2^6), 13 | (2^18,1 ), 14 | (2^18,2^9)] 15 | # indsize = (length(I), number of repetitions) 16 | indsize = [ 17 | (1, 2^12), 18 | (2^8, 2^8 ), 19 | (2^16,2^4 )] 20 | 21 | c = 0 # counter 22 | for (m,nz) in matsize 23 | A = sprand(m,1,nz/m) 24 | for (n,p) in indsize 25 | c += 1 26 | I = rand(1:m,n) 27 | @timeit indexing(A,I,p) "sparse_getindex_skinny$c" "" 28 | end 29 | end 30 | 31 | end 32 | 33 | function indexing(A,I,p) 34 | 35 | J = [1] 36 | for k = 1:p 37 | A[I,J] 38 | end 39 | nothing 40 | 41 | end 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /deps/llvm-3.7.0.patch: -------------------------------------------------------------------------------- 1 | commit 06e88db43d1ff367d03b731c9c1f4f69da78149b 2 | Author: Keno Fischer 3 | Date: Fri Oct 9 17:24:54 2015 +0000 4 | 5 | Clear SectionSymbols in MCContext::Reset 6 | 7 | This was just forgotten when SectionSymbols was introduced and could cause 8 | corruption if the MCContext was reused after Reset. 9 | 10 | Reviewers: rafael 11 | 12 | Subscribers: llvm-commits 13 | 14 | Differential Revision: http://reviews.llvm.org/D13547 15 | 16 | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249854 91177308-0d34-0410-b5e6-96231b3b80d8 17 | 18 | diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp 19 | index ff195d0..2160b4e 100644 20 | --- a/lib/MC/MCContext.cpp 21 | +++ b/lib/MC/MCContext.cpp 22 | @@ -80,6 +80,7 @@ void MCContext::reset() { 23 | 24 | UsedNames.clear(); 25 | Symbols.clear(); 26 | + SectionSymbols.clear(); 27 | Allocator.Reset(); 28 | Instances.clear(); 29 | CompilationDir.clear(); 30 | -------------------------------------------------------------------------------- /base/sparse/abstractsparse.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | abstract AbstractSparseArray{Tv,Ti,N} <: AbstractArray{Tv,N} 4 | 5 | typealias AbstractSparseVector{Tv,Ti} AbstractSparseArray{Tv,Ti,1} 6 | typealias 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{T, A<:AbstractSparseMatrix}(S::Symmetric{T, A}) = true 17 | issparse{T, A<:AbstractSparseMatrix}(S::Hermitian{T, A}) = true 18 | issparse{T, A<:AbstractSparseMatrix}(S::LowerTriangular{T, A}) = true 19 | issparse{T, A<:AbstractSparseMatrix}(S::LinAlg.UnitLowerTriangular{T, A}) = true 20 | issparse{T, A<:AbstractSparseMatrix}(S::UpperTriangular{T, A}) = true 21 | issparse{T, A<:AbstractSparseMatrix}(S::LinAlg.UnitUpperTriangular{T, A}) = true 22 | 23 | indtype{Tv,Ti}(S::AbstractSparseArray{Tv,Ti}) = Ti 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/manual/index.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _manual-index: 3 | 4 | ################## 5 | The Julia Manual 6 | ################## 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | introduction 12 | getting-started 13 | variables 14 | integers-and-floating-point-numbers 15 | mathematical-operations 16 | complex-and-rational-numbers 17 | strings 18 | functions 19 | control-flow 20 | variables-and-scoping 21 | types 22 | methods 23 | constructors 24 | conversion-and-promotion 25 | interfaces 26 | modules 27 | documentation 28 | metaprogramming 29 | arrays 30 | linear-algebra 31 | networking-and-streams 32 | parallel-computing 33 | dates 34 | interacting-with-julia 35 | running-external-programs 36 | calling-c-and-fortran-code 37 | handling-operating-system-variation 38 | interacting-with-julia 39 | embedding 40 | packages 41 | profile 42 | stacktraces 43 | performance-tips 44 | workflow-tips 45 | style-guide 46 | faq 47 | noteworthy-differences 48 | unicode-input 49 | -------------------------------------------------------------------------------- /test/perf/kernel/bench_eu.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /base/markdown/IPython/IPython.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | type LaTeX 4 | formula::UTF8String 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 | writemime(io::IO, ::MIME"text/plain", 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 | -------------------------------------------------------------------------------- /test/unicode/utf16.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # UTF16 4 | u8 = "\U10ffff\U1d565\U1d7f6\U00066\U2008a" 5 | u16 = utf16(u8) 6 | @test sizeof(u16) == 18 7 | @test length(u16.data) == 10 && u16.data[end] == 0 8 | @test length(u16) == 5 9 | @test utf8(u16) == u8 10 | @test collect(u8) == collect(u16) 11 | @test u8 == utf16(u16.data[1:end-1]) == utf16(copy!(Array(UInt8, 18), 1, reinterpret(UInt8, u16.data), 1, 18)) 12 | @test u8 == utf16(pointer(u16)) == utf16(convert(Ptr{Int16}, pointer(u16))) 13 | @test_throws UnicodeError utf16(utf32(Char(0x120000))) 14 | @test_throws UnicodeError utf16(UInt8[1,2,3]) 15 | 16 | # Add tests for full coverage 17 | @test convert(UTF16String, "test") == "test" 18 | @test convert(UTF16String, u16) == u16 19 | @test convert(UTF16String, UInt16[[0x65, 0x66] [0x67, 0x68]]) == "efgh" 20 | @test convert(UTF16String, Int16[[0x65, 0x66] [0x67, 0x68]]) == "efgh" 21 | @test map(lowercase, utf16("TEST\U1f596")) == "test\U1f596" 22 | @test typeof(Base.unsafe_convert(Ptr{UInt16}, utf16("test"))) == Ptr{UInt16} 23 | 24 | -------------------------------------------------------------------------------- /contrib/stringreplace.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /test/profile.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | let iobuf = IOBuffer() 15 | Profile.print(iobuf, format=:tree, C=true) 16 | str = takebuf_string(iobuf) 17 | @test !isempty(str) 18 | truncate(iobuf, 0) 19 | Profile.print(iobuf, format=:tree, maxdepth=2) 20 | str = takebuf_string(iobuf) 21 | @test !isempty(str) 22 | truncate(iobuf, 0) 23 | Profile.print(iobuf, format=:flat, C=true) 24 | str = takebuf_string(iobuf) 25 | @test !isempty(str) 26 | truncate(iobuf, 0) 27 | Profile.print(iobuf) 28 | @test !isempty(takebuf_string(iobuf)) 29 | truncate(iobuf, 0) 30 | Profile.print(iobuf, format=:flat, sortedby=:count) 31 | @test !isempty(takebuf_string(iobuf)) 32 | Profile.clear() 33 | @test isempty(Profile.fetch()) 34 | end 35 | -------------------------------------------------------------------------------- /src/gen_sysimg_symtab.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 and read a '\0' after every symbol name 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(pipe(`strings -n 3 $fname`, 13 | `tr -d "() \t+-"`, 14 | `sort`, `uniq -c`, `sort -g -r`, 15 | `grep -v Main`, # for some reason Main breaks things 16 | `head -n 315`)) # 63 + 252 17 | 18 | function outputline(io, line) 19 | row = split(chomp(line), " ", keep=false) 20 | println(io, "jl_symbol(\"", row[2], "\"),") 21 | end 22 | 23 | foreach(f, it) = for x in it; f(x); end 24 | 25 | lines = eachline(io) 26 | 27 | open(f->foreach(l->outputline(f,l), take(lines,63)), "common_symbols1.inc", "w") 28 | open(f->foreach(l->outputline(f,l), lines), "common_symbols2.inc", "w") 29 | -------------------------------------------------------------------------------- /base/libgit2/status.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function GitStatus(repo::GitRepo; status_opts=StatusOptions()) 4 | stat_ptr_ptr = Ref{Ptr{Void}}(C_NULL) 5 | @check ccall((:git_status_list_new, :libgit2), Cint, 6 | (Ptr{Ptr{Void}}, Ptr{Void}, Ptr{StatusOptions}), 7 | stat_ptr_ptr, repo.ptr, Ref(status_opts)) 8 | return GitStatus(stat_ptr_ptr[]) 9 | end 10 | 11 | function Base.length(status::GitStatus) 12 | return Int(ccall((:git_status_list_entrycount, :libgit2), Csize_t, 13 | (Ptr{Ptr{Void}}, ), status.ptr)) 14 | end 15 | 16 | function Base.getindex(status::GitStatus, i::Csize_t) 17 | if length(status) == 0 18 | throw(BoundsError()) 19 | end 20 | entry_ptr = ccall((:git_status_byindex, :libgit2), Ptr{Void}, 21 | (Ptr{Void}, Csize_t), status.ptr, i-1) 22 | entry_ptr == C_NULL && return nothing 23 | return unsafe_load(convert(Ptr{StatusEntry}, entry_ptr), 1) 24 | end 25 | Base.getindex(status::GitStatus, i::Int) = getindex(status, Csize_t(i)) 26 | -------------------------------------------------------------------------------- /test/sysinfo.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | 10 | # issue #10994 11 | @test_throws ArgumentError ENV["bad\0name"] = "ok" 12 | @test_throws ArgumentError ENV["okname"] = "bad\0val" 13 | @test_throws ArgumentError Sys.set_process_title("bad\0title") 14 | 15 | withenv("bad"=>"dog") do 16 | @test_throws ArgumentError ENV["bad\0cat"] 17 | end 18 | 19 | # issue #11170 20 | withenv("TEST"=>"nonempty") do 21 | @test ENV["TEST"] == "nonempty" 22 | end 23 | withenv("TEST"=>"") do 24 | @test ENV["TEST"] == "" 25 | end 26 | 27 | let c = collect(ENV) 28 | @test isa(c, Vector) 29 | @test length(ENV) == length(c) 30 | @test isempty(ENV) || first(ENV) in c 31 | end 32 | 33 | # test for non-existent keys 34 | key = randstring(25) 35 | @test !haskey(ENV,key) 36 | @test_throws KeyError ENV[key] 37 | @test get(ENV,key,"default") == "default" 38 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/laplace_for_update1.f90: -------------------------------------------------------------------------------- 1 | PROGRAM laplace_for 2 | implicit none 3 | 4 | INTERFACE 5 | SUBROUTINE for_update1(u, dx2, dy2, nx, ny) 6 | real(8), intent(inout) :: u(nx,ny) 7 | real(8), intent(in) :: dx2, dy2 8 | integer, intent(in) :: nx, ny 9 | END SUBROUTINE 10 | END INTERFACE 11 | 12 | integer, parameter :: dp=kind(0.d0) 13 | 14 | integer, parameter :: N = 150 15 | integer :: Niter 16 | real(dp) :: u(N, N), t1, t2 17 | 18 | read(*,*) Niter 19 | 20 | call cpu_time(t1) 21 | u = calc(N, Niter, 0.1_dp, 0.1_dp) 22 | call cpu_time(t2) 23 | 24 | open(101,file='data_Looped Fortran (pure)', status='unknown') 25 | write(101,*) u 26 | !print *, t2-t1 27 | !print *, u(2, 2) 28 | !print *, sum(u) 29 | !print *, sum(u**2) 30 | CONTAINS 31 | 32 | FUNCTION calc(N, Niter, dx, dy) RESULT(u) 33 | integer, intent(in) :: N, Niter 34 | real(dp), intent(in) :: dx, dy 35 | real(dp) :: u(N,N), dx2, dy2 36 | integer :: i 37 | u = 0 38 | u(1,:) = 1 39 | dx2 = dx**2 40 | dy2 = dy**2 41 | DO i = 1,Niter 42 | call for_update1(u, dx2, dy2, N, N) 43 | END DO 44 | END FUNCTION 45 | 46 | END program 47 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/laplace_for_update2.f90: -------------------------------------------------------------------------------- 1 | program laplace_for 2 | implicit none 3 | 4 | INTERFACE 5 | SUBROUTINE for_update2(u, dx2, dy2, nx, ny) 6 | real(8), intent(inout) :: u(nx,ny) 7 | real(8), intent(in) :: dx2, dy2 8 | integer, intent(in) :: nx, ny 9 | END SUBROUTINE 10 | END INTERFACE 11 | 12 | integer, parameter :: dp=kind(0.d0) 13 | 14 | integer, parameter :: N = 150 15 | integer :: Niter 16 | real(dp) :: u(N, N), t1, t2 17 | 18 | read(*,*) Niter 19 | 20 | call cpu_time(t1) 21 | u = calc(N, Niter, 0.1_dp, 0.1_dp) 22 | call cpu_time(t2) 23 | 24 | open(101,file='data_Vectorized Fortran (pure)', status='unknown') 25 | write(101,*) u 26 | !print *, t2-t1 27 | !print *, u(2, 2) 28 | !print *, sum(u) 29 | !print *, sum(u**2) 30 | contains 31 | 32 | function calc(N, Niter, dx, dy) result(u) 33 | integer, intent(in) :: N, Niter 34 | real(dp), intent(in) :: dx, dy 35 | real(dp) :: u(N,N), dx2, dy2 36 | integer :: i 37 | u = 0 38 | u(1,:) = 1 39 | dx2 = dx**2 40 | dy2 = dy**2 41 | DO i = 1,Niter 42 | call for_update2(u, dx2, dy2, N, N) 43 | END DO 44 | end function 45 | 46 | end program 47 | -------------------------------------------------------------------------------- /base/linalg/exceptions.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | export LAPACKException, 4 | ARPACKException, 5 | SingularException, 6 | PosDefException, 7 | RankDeficientException 8 | 9 | type LAPACKException <: Exception 10 | info::BlasInt 11 | end 12 | 13 | type ARPACKException <: Exception 14 | info::ByteString 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 | type SingularException <: Exception 29 | info::BlasInt 30 | end 31 | 32 | type PosDefException <: Exception 33 | info::BlasInt 34 | end 35 | 36 | type RankDeficientException <: Exception 37 | info::BlasInt 38 | end 39 | -------------------------------------------------------------------------------- /contrib/travis_fastfail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /test/perf/shootout/mandelbrot.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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/kernel/laplace/c_laplace_parallel_update.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #include 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 0 27 | printf("MAKE += -j %d\n", MAKE_NB_JOBS); 28 | + #else 29 | + // Let make use parent -j argument or -j1 if there 30 | + // is no make parent 31 | + #endif 32 | #elif NO_PARALLEL_MAKE==1 33 | printf("MAKE += -j 1\n"); 34 | #else 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/builtin_proto.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef BUILTIN_PROTO_H 4 | #define 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(typeassert); DECLARE_BUILTIN(_apply); 26 | DECLARE_BUILTIN(isdefined); DECLARE_BUILTIN(nfields); 27 | DECLARE_BUILTIN(tuple); DECLARE_BUILTIN(svec); 28 | DECLARE_BUILTIN(getfield); DECLARE_BUILTIN(setfield); 29 | DECLARE_BUILTIN(fieldtype); DECLARE_BUILTIN(arrayref); 30 | DECLARE_BUILTIN(arrayset); DECLARE_BUILTIN(arraysize); 31 | DECLARE_BUILTIN(apply_type); DECLARE_BUILTIN(applicable); 32 | DECLARE_BUILTIN(invoke); DECLARE_BUILTIN(_expr); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /contrib/mac/mac-gtk.sh: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #/bin/sh 4 | 5 | # This script will attempt to download and build GTK+-3, 6 | # including dependencies, in ~/gtk (also puts stuff in 7 | # ~/.local, ~/Source, ~/.jhbuildrc*) 8 | # While this should work, it may be preferable to execute 9 | # each line separately in the terminal 10 | 11 | curl -O https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh 12 | sh gtk-osx-build-setup.sh 13 | export PATH=$PATH:~/.local/bin/ 14 | sed -i -e 's/^setup_sdk/#setup_sdk/g' ~/.jhbuildrc-custom 15 | cat << EOF >> .jhbuildrc-custom 16 | setup_sdk(target=_target, sdk_version=_target, architectures=[_default_arch]) 17 | os.environ["DYLD_LIBRARY_PATH"] = "" 18 | build_policy = "updated-deps" 19 | modules = [ "meta-gtk-osx-bootstrap", 20 | "freetype", "fontconfig", 21 | "meta-gtk-osx-core", 22 | "meta-gtk-osx-themes", 23 | "gtk-quartz-engine" ] 24 | EOF 25 | 26 | jhbuild bootstrap --skip=libiconv --ignore-system 27 | jhbuild build 28 | 29 | cd ~/gtk/source 30 | curl -O http://ftp.gnome.org/pub/gnome/sources/gtk-mac-bundler/0.6/gtk-mac-bundler-0.6.1.tar.bz2 31 | tar jxvf gtk-mac-bundler-0.6.1.tar.bz2 32 | cd gtk-mac-bundler-0.6.1 33 | make install 34 | cd ~/gtk 35 | 36 | 37 | -------------------------------------------------------------------------------- /examples/dictchannel.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | import Base: put!, wait, isready, take!, fetch 4 | 5 | type 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 | 36 | # Usage: 37 | 38 | # RemoteRef to a DictChannel on worker pid 39 | # dc_ref=RemoteRef(()->DictChannel(), pid) 40 | 41 | # Test if there is any data 42 | # isready(dc_ref) 43 | 44 | # add 45 | # put!(dc_ref, 1, 2) 46 | 47 | # Test if key 1 exists 48 | # isready(dc_ref, 1) 49 | 50 | # fetch key 1 51 | # fetch(dc_ref, 1) 52 | 53 | # fetch and remove key 1 54 | # take!(dc_ref, 1) 55 | 56 | # wait for key 3 to be added 57 | # wait(dc_ref, 3) 58 | -------------------------------------------------------------------------------- /DEBUGGER.md: -------------------------------------------------------------------------------- 1 | The Julia Debugger 2 | ------------------ 3 | 4 | In order to have a Julia debugger, we first need a version of LLDB 5 | that understands Julia's JITed stack frames. To do so, build Julia 6 | with instructions from https://github.com/Keno/Cxx.jl. Just the julia 7 | parts are required. The Cxx part won't be necessary until the debugger 8 | UI is released. 9 | 10 | Use LLDB just as you would usually. 11 | 12 | This should at least get stack traces and the ability to step 13 | through julia code. Please file any issues as bug reports. 14 | 15 | For local variables, you may get some, and you'll get more if you set 16 | `DISABLE_OPT` in `src/options.h`. If you set the latter, it is useful 17 | to collect a set of test cases that don't get local variables even 18 | though they should. You will probably find a lot of functions don't 19 | work, yet. 20 | 21 | OS X 22 | ==== 23 | 24 | * Enable FORCE_ELF in src/options. 25 | 26 | * Comment out `if (arch.GetTriple().getVendor() != llvm::Triple::Apple)` 27 | in deps/llvm-svn/tools/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp 28 | 29 | * export `LLDB_DEBUGSERVER_PATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/debugserver` 30 | 31 | References 32 | ========== 33 | 34 | The original post on julia-dev: https://groups.google.com/forum/#!topic/julia-dev/gcZ5dZJni5o 35 | -------------------------------------------------------------------------------- /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 | http://julialang.org/images/julia-gnome.png 25 | 26 | http://julialang.org/ 27 | julia-dev@googlegroups.com 28 |
29 | -------------------------------------------------------------------------------- /Make.powerpc: -------------------------------------------------------------------------------- 1 | # This Make.ppc script should help you get started building Julia on a PowerPC machine 2 | # $ echo "include $(JULIAHOME)/Make.powerpc" >> Make.user 3 | 4 | # most of our dependencies these contain m4 scripts that are too old (specifically libtool.m4) to know about ppc64le 5 | # so for now, we must use the system ones 6 | USE_SYSTEM_FFTW=1 7 | USE_SYSTEM_PCRE=1 8 | USE_SYSTEM_ARPACK=1 9 | USE_SYSTEM_GMP=1 10 | USE_SYSTEM_MPFR=1 11 | 12 | # openblas doesn't know about ld version 2 assembly PROLOGUE syntax 13 | USE_SYSTEM_BLAS=1 14 | 15 | # it's not optimized, and we trust the system libm 16 | USE_SYSTEM_LIBM=1 17 | 18 | # this one doesn't seem to be able to compile for assembly code 19 | USE_SYSTEM_LIBUNWIND=1 20 | 21 | # this one takes awhile to build, but it's generally worthwhile -- your choice 22 | USE_SYSTEM_LLVM?=0 23 | ifeq ($(USE_SYSTEM_LLVM),1) 24 | LLVM_CONFIG=llvm-config-3.5 25 | else 26 | LLVM_ASSERTIONS=1 27 | endif 28 | 29 | # On a newly allocated machine, you'll need the following dependencies: 30 | # build essentials: 31 | # $ sudo apt-get install git g++ gfortran make cmake libedit-dev zlib1g-dev libssl-dev 32 | # system lib replacements: 33 | # $ sudo apt-get install libfftw3-dev libunwind8-dev libllvm3.5 libblas3 libarpack2-dev libedit-dev libpcre3-dev libgmp-dev libmpfr-dev 34 | # autogen essentials: 35 | # $ sudo apt-get install libtool autoconf 36 | -------------------------------------------------------------------------------- /test/perf/shootout/spectralnorm.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /base/libgit2/tree.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | """ 4 | Traverse the entries in a tree and its subtrees in post or pre order. 5 | 6 | Function parameter should have following signature: 7 | 8 | (Cstring, Ptr{Void}, Ptr{Void}) -> Cint 9 | """ 10 | function treewalk(f::Function, tree::GitTree, payload=Any[], post::Bool = false) 11 | cbf = cfunction(f, Cint, (Cstring, Ptr{Void}, Ptr{Void})) 12 | cbf_payload = Ref{typeof(payload)}(payload) 13 | @check ccall((:git_tree_walk, :libgit2), Cint, 14 | (Ptr{Void}, Cint, Ptr{Void}, Ptr{Void}), 15 | tree.ptr, post, cbf, cbf_payload) 16 | return cbf_payload 17 | end 18 | 19 | function filename(te::GitTreeEntry) 20 | str = ccall((:git_tree_entry_name, :libgit2), Cstring, (Ptr{Void},), te.ptr) 21 | str != C_NULL && return bytestring(str) 22 | return nothing 23 | end 24 | 25 | function filemode(te::GitTreeEntry) 26 | return ccall((:git_tree_entry_filemode, :libgit2), Cint, (Ptr{Void},), te.ptr) 27 | end 28 | 29 | 30 | function object(repo::GitRepo, te::GitTreeEntry) 31 | obj_ptr_ptr = Ref{Ptr{Void}}(C_NULL) 32 | @check ccall((:git_tree_entry_to_object, :libgit2), Cint, 33 | (Ptr{Ptr{Void}}, Ptr{Void}, Ref{Void}), 34 | obj_ptr_ptr, repo.ptr, te.ptr) 35 | return GitAnyObject(obj_ptr_ptr[]) 36 | end 37 | -------------------------------------------------------------------------------- /base/unicode/types.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | ##\brief Base UTF16String type, has 16-bit NULL termination word after data, native byte order 4 | # 5 | # \throws UnicodeError 6 | 7 | immutable UTF16String <: AbstractString 8 | data::Vector{UInt16} # includes 16-bit NULL termination after string chars 9 | function UTF16String(data::Vector{UInt16}) 10 | if length(data) < 1 || data[end] != 0 11 | throw(UnicodeError(UTF_ERR_NULL_16_TERMINATE, 0, 0)) 12 | end 13 | new(data) 14 | end 15 | end 16 | 17 | ##\brief Base UTF32String type, has 32-bit NULL termination word after data, native byte order 18 | # 19 | # \throws UnicodeError 20 | 21 | immutable UTF32String <: DirectIndexString 22 | data::Vector{UInt32} # includes 32-bit NULL termination after string chars 23 | 24 | function UTF32String(data::Vector{UInt32}) 25 | if length(data) < 1 || data[end] != 0 26 | throw(UnicodeError(UTF_ERR_NULL_32_TERMINATE, 0, 0)) 27 | end 28 | new(data) 29 | end 30 | end 31 | UTF32String(data::Vector{Char}) = UTF32String(reinterpret(UInt32, data)) 32 | 33 | isvalid{T<:Union{ASCIIString,UTF8String,UTF16String,UTF32String}}(str::T) = isvalid(T, str.data) 34 | isvalid{T<:Union{ASCIIString,UTF8String,UTF16String,UTF32String}}(::Type{T}, str::T) = isvalid(T, str.data) 35 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | Julia Documentation README 2 | ========================== 3 | 4 | Julia's documentation is written in reStructuredText, a good reference for which 5 | is the [Documenting Python](http://docs.python.org/devguide/documenting.html) 6 | chapter of the Python Developer's Guide. 7 | 8 | 9 | Prerequisites for building the documentation 10 | -------------------------------------------- 11 | 12 | The documentation is built using [Sphinx](http://sphinx.pocoo.org/) and LaTeX. 13 | On ubuntu, you'll need the following packages installed: 14 | 15 | latex-cjk-all 16 | texlive 17 | texlive-lang-cjk 18 | texlive-latex-extra 19 | 20 | On OS X, you can install MacTex using the GUI installer 21 | 22 | 23 | Building the documentation 24 | -------------------------- 25 | 26 | Build the documentation by running 27 | 28 | $ make html 29 | $ make latexpdf 30 | 31 | 32 | File layout 33 | ----------- 34 | 35 | conf.py Sphinx configuration 36 | stdlib/ Julia standard library documentation 37 | UNDOCUMENTED.rst Undocumented functions (to be filled in and copied to 38 | the correct location in stdlib/) 39 | 40 | Sphinx extensions and theme 41 | --------------------------- 42 | The extensions to Sphinx and the theme are in the 43 | https://github.com/JuliaLang/JuliaDoc repository, and can also be used to style 44 | package documentation. 45 | -------------------------------------------------------------------------------- /test/perf/kernel/getdivgrad.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | 8 | # the Divergence 9 | D1 = kron(speye(n3),kron(speye(n2),ddx(n1))) 10 | D2 = kron(speye(n3),kron(ddx(n2),speye(n1))) 11 | D3 = kron(ddx(n3),kron(speye(n2),speye(n1))) 12 | # DIV from faces to cell-centers 13 | Div = [D1 D2 D3] 14 | 15 | return Div*Div'; 16 | end 17 | 18 | #----------------- 1D finite difference on staggered grid 19 | function ddx(n) 20 | # generate 1D derivatives 21 | return d = spdiags(ones(n)*[-1 1],[0,1],n,n+1) 22 | end 23 | 24 | #------------- Build a diagonal matrix 25 | function spdiags(B,d,m,n) 26 | # spdiags(B,d,m,n) 27 | # creates a sparse matrix from its diagonals 28 | 29 | d = d[:] 30 | p = length(d) 31 | 32 | len = zeros(Int, p+1, 1) 33 | for k = 1:p 34 | len[k+1] = len[k] + length(max(1,1-d[k]):min(m,n-d[k])) 35 | end 36 | a = zeros(Int, len[p+1], 3) 37 | for k = 1:p 38 | # Append new d[k]-th diagonal to compact form 39 | i = max(1,1-d[k]):min(m,n-d[k]) 40 | a[(len[k]+1):len[k+1],:] = [i i+d[k] B[i+(m>=n)*d[k],k]] 41 | end 42 | 43 | A = sparse(a[:,1],a[:,2],a[:,3],m,n) 44 | 45 | return A 46 | 47 | end 48 | 49 | -------------------------------------------------------------------------------- /base/libgit2/strarray.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function StrArrayStruct{T<:AbstractString}(strs::T...) 4 | strcount = length(strs) 5 | map(s->Base.unsafe_convert(Cstring, bytestring(s)), strs) # check for null-strings 6 | sa_strings = convert(Ptr{Cstring}, Libc.malloc(sizeof(Cstring) * strcount)) 7 | for i=1:strcount 8 | len = length(strs[i]) 9 | in_ptr = pointer(bytestring(strs[i])) 10 | out_ptr = convert(Ptr{UInt8}, Libc.malloc(sizeof(UInt8) * (len + 1))) 11 | unsafe_copy!(out_ptr, in_ptr, len) 12 | unsafe_store!(out_ptr, zero(UInt8), len + 1) # NULL byte 13 | unsafe_store!(sa_strings, convert(Cstring, out_ptr), i) 14 | end 15 | return StrArrayStruct(sa_strings, strcount) 16 | end 17 | StrArrayStruct{T<:AbstractString}(strs::Vector{T}) = StrArrayStruct(strs...) 18 | 19 | function Base.convert(::Type{Vector{AbstractString}}, sa::StrArrayStruct) 20 | arr = Array(AbstractString, sa.count) 21 | for i=1:sa.count 22 | arr[i] = bytestring(unsafe_load(sa.strings, i)) 23 | end 24 | return arr 25 | end 26 | 27 | function Base.copy(src::StrArrayStruct) 28 | dst_ptr = Ref(StrArrayStruct()) 29 | @check ccall((:git_strarray_copy, :libgit2), Cint, 30 | (Ptr{StrArrayStruct}, Ptr{StrArrayStruct}), 31 | dst_ptr, Ref(src)) 32 | return dst_ptr[] 33 | end 34 | -------------------------------------------------------------------------------- /doc/manual/handling-operating-system-variation.rst: -------------------------------------------------------------------------------- 1 | .. _man-handling-operating-system-variation: 2 | 3 | ************************************* 4 | Handling Operating System Variation 5 | ************************************* 6 | 7 | When dealing with platform libraries, it is often necessary to provide special cases 8 | for various platforms. The variable ``OS_NAME`` can be used to write these special 9 | cases. There are several macros intended to make this easier: ``@windows_only``, 10 | ``@unix_only``, ``@linux_only``, and ``@osx_only``. These may be used as follows:: 11 | 12 | @windows_only begin 13 | some_complicated_thing(a) 14 | end 15 | 16 | Note that ``@linux_only`` and ``@osx_only`` are mutually exclusive subsets of ``@unix_only``\ . (This 17 | similarly applies to ``@unix``\ .) 18 | Additionally, there are:``@windows``, ``@unix``, ``@linux``, and ``@osx``. Their usage takes 19 | the form of a ternary conditional operator, as demonstrated in the following examples. 20 | 21 | Simple blocks:: 22 | 23 | ccall( (@windows? :_fopen : :fopen), ...) 24 | 25 | Complex blocks:: 26 | 27 | @linux? ( 28 | begin 29 | some_complicated_thing(a) 30 | end 31 | : begin 32 | some_different_thing(a) 33 | end 34 | ) 35 | 36 | Chaining (parentheses optional, but recommended for readability):: 37 | 38 | @windows? :a : (@osx? :b : :c) 39 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /base/markdown/Julia/interp.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function Base.parse(stream::IO; greedy::Bool = true, raise::Bool = true) 4 | pos = position(stream) 5 | ex, Δ = Base.parse(readstring(stream), 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) || 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(:cell1d, map(toexpr, xs)...) 43 | 44 | function deftoexpr(T) 45 | @eval function toexpr(md::$T) 46 | Expr(:call, typeof(md), $(map(x->:(toexpr(md.$x)), fieldnames(T))...)) 47 | end 48 | end 49 | 50 | map(deftoexpr, [MD, Paragraph, Header, 51 | Link, Bold, Italic]) 52 | -------------------------------------------------------------------------------- /deps/jldownload: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # usage: jldownload [] 4 | # 5 | 6 | CACHE_HOST=https://cache.e.ip.saba.us 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 | -------------------------------------------------------------------------------- /examples/time.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | module Time 4 | export TimeDelta 5 | 6 | import Base.show, Base.+, Base.-, Base.convert, Base.promote_rule 7 | 8 | immutable 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{p}(io::IO, x::TimeDelta{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{p,q}(::Type{TimeDelta{p}}, x::TimeDelta{q}) = 34 | TimeDelta{p}(p <= q ? x.v*10^(q-p) : div(x.v,10^(p-q))) 35 | 36 | promote_rule{p,q}(::Type{TimeDelta{p}}, ::Type{TimeDelta{q}}) = TimeDelta{min(p,q)} 37 | 38 | -{p}(x::TimeDelta{p}) = TimeDelta{p}(-x.v) 39 | +{p}(x::TimeDelta{p}, y::TimeDelta{p}) = TimeDelta{p}(x.v+y.v) 40 | -{p}(x::TimeDelta{p}, y::TimeDelta{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 | -------------------------------------------------------------------------------- /base/docs/bindings.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | export @var 4 | 5 | immutable 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(:call, current_module), quot(s) 28 | splitexpr(other) = error("Invalid @var syntax `$other`.") 29 | 30 | macro var(x) 31 | esc(bindingexpr(x)) 32 | end 33 | 34 | Base.show(io::IO, b::Binding) = b.mod === Main ? print(io, b.var) : print(io, b.mod, '.', b.var) 35 | 36 | aliasof(b::Binding) = defined(b) ? (a = aliasof(resolve(b), b); defined(a) ? a : b) : b 37 | aliasof(d::DataType, b) = Binding(d.name.module, d.name.name) 38 | aliasof(λ::Function, b) = (m = typeof(λ).name.mt; Binding(m.module, m.name)) 39 | aliasof(m::Module, b) = Binding(m, module_name(m)) 40 | aliasof(other, b) = b 41 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | JULIAHOME = $(abspath ..) 2 | include $(JULIAHOME)/Make.inc 3 | 4 | FLAGS = -Wall -Wno-strict-aliasing -fno-omit-frame-pointer \ 5 | -I$(JULIAHOME)/src -I$(JULIAHOME)/src/support -I$(build_includedir) $(CFLAGS) 6 | 7 | DEBUGFLAGS += $(FLAGS) 8 | SHIPFLAGS += $(FLAGS) 9 | JLDFLAGS += $(LDFLAGS) $(NO_WHOLE_ARCHIVE) $(call exec,$(LLVM_CONFIG) --ldflags) $(OSLIBS) $(RPATH) 10 | 11 | ifeq ($(USE_SYSTEM_LIBM),0) 12 | ifneq ($(UNTRUSTED_SYSTEM_LIBM),0) 13 | JLDFLAGS += $(WHOLE_ARCHIVE) $(build_libdir)/libopenlibm.a $(NO_WHOLE_ARCHIVE) 14 | endif 15 | endif 16 | 17 | embedding-release: embedding 18 | 19 | release debug: 20 | $(MAKE) embedding-$@ 21 | 22 | %.o: %.c 23 | @$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(SHIPFLAGS) -c $< -o $@) 24 | %.do: %.c 25 | @$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@) 26 | 27 | embedding: $(build_bindir)/embedding$(EXE) 28 | embedding-debug: $(build_bindir)/embedding-debug$(EXE) 29 | 30 | $(build_bindir)/embedding$(EXE): embedding.o 31 | @$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(SHIPFLAGS) $^ -o $@ -L$(build_private_libdir) -L$(build_shlibdir) -ljulia $(JLDFLAGS)) 32 | $(build_bindir)/embedding-debug$(EXE): embedding.do 33 | @$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(DEBUGFLAGS) $^ -o $@ -L$(build_private_libdir) -L$(build_shlibdir) -ljulia-debug $(JLDFLAGS)) 34 | 35 | 36 | clean: | $(CLEAN_TARGETS) 37 | rm -f *.o *.do 38 | rm -f $(build_bindir)/embedding-debug $(build_bindir)/embedding 39 | 40 | .PHONY: clean release debug 41 | 42 | -------------------------------------------------------------------------------- /deps/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 | -------------------------------------------------------------------------------- /test/perf/shootout/regex_dna.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 = readstring(infile) 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/triplequote.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /base/meta.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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::Set) = in(ex.head, heads) 16 | isexpr(ex::Expr, heads::Vector) = in(ex.head, heads) 17 | isexpr(ex, head) = false 18 | 19 | isexpr(ex, head, n::Int) = isexpr(ex, head) && length(ex.args) == n 20 | 21 | 22 | # ---- show_sexpr: print an AST as an S-expression ---- 23 | 24 | show_sexpr(ex) = show_sexpr(STDOUT, ex) 25 | show_sexpr(io::IO, ex) = show_sexpr(io, ex, 0) 26 | show_sexpr(io::IO, ex, indent::Int) = show(io, ex) 27 | 28 | const sexpr_indent_width = 2 29 | 30 | function show_sexpr(io::IO, ex::QuoteNode, indent::Int) 31 | inner = indent + sexpr_indent_width 32 | print(io, "(:quote, #QuoteNode\n", " "^inner) 33 | show_sexpr(io, ex.value, inner) 34 | print(io, '\n', " "^indent, ')') 35 | end 36 | function show_sexpr(io::IO, ex::Expr, indent::Int) 37 | inner = indent + sexpr_indent_width 38 | print(io, '(') 39 | show_sexpr(io, ex.head, inner) 40 | for arg in ex.args 41 | print(io, ex.head === :block ? ",\n"*" "^inner : ", ") 42 | show_sexpr(io, arg, inner) 43 | end 44 | if isempty(ex.args); print(io, ",)") 45 | else print(io, (ex.head === :block ? "\n"*" "^indent : ""), ')') 46 | end 47 | end 48 | 49 | end # module 50 | -------------------------------------------------------------------------------- /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/perf/sparse/fem.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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 | -------------------------------------------------------------------------------- /contrib/relative_path.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This file is a part of Julia. License is MIT: http://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 | # Source copied from http://stackoverflow.com/a/12498485/230778 8 | 9 | source=$1 10 | target=$2 11 | 12 | if [[ ! "$source" == /* ]] || [[ ! "$target" == /* ]]; then 13 | echo "ERROR: paths must be absolute paths, they must start with a forward slash!" 14 | exit 1 15 | fi 16 | 17 | common_part=$source # for now 18 | result="" # for now 19 | 20 | while [[ "${target#$common_part/}" == "${target}" ]] && [[ "$common_part" != "/" ]]; do 21 | # no match, means that candidate common part is not correct 22 | # go up one level (reduce common part) 23 | common_part="$(dirname $common_part)" 24 | # and record that we went back, with correct / handling 25 | if [[ -z $result ]]; then 26 | result=".." 27 | else 28 | result="../$result" 29 | fi 30 | done 31 | 32 | if [[ "$common_part" == "/" ]]; then 33 | # special case for root (no common path) 34 | result="$result/" 35 | fi 36 | 37 | # since we now have identified the common part, 38 | # compute the non-common part 39 | forward_part="${target#$common_part}" 40 | 41 | # and now stick all parts together 42 | if [[ -n $result ]] && [[ -n $forward_part ]]; then 43 | result="$result$forward_part" 44 | elif [[ -n $forward_part ]]; then 45 | # extra slash removal 46 | result="${forward_part:1}" 47 | fi 48 | 49 | echo $result 50 | -------------------------------------------------------------------------------- /examples/ndgrid.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | ndgrid(v::AbstractVector) = copy(v) 4 | 5 | function ndgrid{T}(v1::AbstractVector{T}, v2::AbstractVector{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{T}(vs::AbstractVector{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{T}(vx::AbstractVector{T}, vy::AbstractVector{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{T}(vx::AbstractVector{T}, vy::AbstractVector{T}, 43 | vz::AbstractVector{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 | -------------------------------------------------------------------------------- /base/osutils.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | const OS_NAME = ccall(:jl_get_OS_NAME, Any, ()) 4 | 5 | function is_unix(os::Symbol) 6 | if (os==:Windows) return false; 7 | elseif (os==:Linux) return true; 8 | elseif (os==:FreeBSD) return true; 9 | elseif (os==:Darwin) return true; 10 | else throw(ArgumentError("unknown operating system, $(repr(os))")) 11 | end 12 | end 13 | 14 | function _os_test(qm,ex,test) 15 | @assert qm == :? 16 | @assert isa(ex,Expr) 17 | @assert ex.head == :(:) 18 | @assert length(ex.args) == 2 19 | if test 20 | return esc(ex.args[1]) 21 | else 22 | return esc(ex.args[2]) 23 | end 24 | end 25 | 26 | macro windows(qm,ex) 27 | _os_test(qm, ex, OS_NAME===:Windows) 28 | end 29 | macro unix(qm,ex) 30 | _os_test(qm, ex, is_unix(OS_NAME)) 31 | end 32 | macro osx(qm,ex) 33 | _os_test(qm, ex, OS_NAME===:Darwin) 34 | end 35 | macro linux(qm,ex) 36 | _os_test(qm, ex, OS_NAME===:Linux) 37 | end 38 | 39 | macro windows_only(ex) 40 | @windows? esc(ex) : nothing 41 | end 42 | macro unix_only(ex) 43 | @unix? esc(ex) : nothing 44 | end 45 | macro osx_only(ex) 46 | @osx? esc(ex) : nothing 47 | end 48 | macro linux_only(ex) 49 | @linux? esc(ex) : nothing 50 | end 51 | 52 | # Windows version macros 53 | 54 | @windows_only function windows_version() 55 | verinfo = ccall(:GetVersion, UInt32, ()) 56 | (verinfo & 0xFF, (verinfo >> 8) & 0xFF) 57 | end 58 | @unix_only windows_version() = (0,0) 59 | 60 | WINDOWS_VISTA_VER = (6,0) 61 | -------------------------------------------------------------------------------- /base/lock.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # Advisory reentrant lock 4 | type ReentrantLock 5 | locked_by::Nullable{Task} 6 | cond_wait::Condition 7 | reentrancy_cnt::Int 8 | 9 | ReentrantLock() = new(nothing, Condition(), 0) 10 | end 11 | 12 | function lock(rl::ReentrantLock) 13 | t = current_task() 14 | while true 15 | if rl.reentrancy_cnt == 0 16 | rl.locked_by = t 17 | rl.reentrancy_cnt = 1 18 | return 19 | elseif t == get(rl.locked_by) 20 | rl.reentrancy_cnt += 1 21 | return 22 | end 23 | wait(rl.cond_wait) 24 | end 25 | end 26 | 27 | function unlock(rl::ReentrantLock) 28 | rl.reentrancy_cnt = rl.reentrancy_cnt - 1 29 | if rl.reentrancy_cnt < 0 30 | error("unlock count must match lock count") 31 | end 32 | if rl.reentrancy_cnt == 0 33 | rl.locked_by = nothing 34 | notify(rl.cond_wait) 35 | end 36 | return rl 37 | end 38 | 39 | type Semaphore 40 | sem_size::Int 41 | curr_cnt::Int 42 | cond_wait::Condition 43 | Semaphore(sem_size) = new(sem_size, 0, Condition()) 44 | end 45 | 46 | function acquire(s::Semaphore) 47 | while true 48 | if s.curr_cnt < s.sem_size 49 | s.curr_cnt = s.curr_cnt + 1 50 | return 51 | else 52 | wait(s.cond_wait) 53 | end 54 | end 55 | end 56 | 57 | function release(s::Semaphore) 58 | s.curr_cnt = s.curr_cnt - 1 59 | notify(s.cond_wait; all=false) 60 | end 61 | -------------------------------------------------------------------------------- /base/options.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # NOTE: This type needs to be kept in sync with jl_options in src/julia.h 4 | immutable JLOptions 5 | quiet::Int8 6 | julia_home::Ptr{UInt8} 7 | julia_bin::Ptr{UInt8} 8 | eval::Ptr{UInt8} 9 | print::Ptr{UInt8} 10 | postboot::Ptr{UInt8} 11 | load::Ptr{UInt8} 12 | image_file::Ptr{UInt8} 13 | cpu_target::Ptr{UInt8} 14 | nprocs::Int32 15 | machinefile::Ptr{UInt8} 16 | isinteractive::Int8 17 | color::Int8 18 | historyfile::Int8 19 | startupfile::Int8 20 | compile_enabled::Int8 21 | code_coverage::Int8 22 | malloc_log::Int8 23 | opt_level::Int8 24 | check_bounds::Int8 25 | depwarn::Int8 26 | can_inline::Int8 27 | fast_math::Int8 28 | worker::Int8 29 | handle_signals::Int8 30 | use_precompiled::Int8 31 | use_compilecache::Int8 32 | bindto::Ptr{UInt8} 33 | outputbc::Ptr{UInt8} 34 | outputo::Ptr{UInt8} 35 | outputji::Ptr{UInt8} 36 | incremental::Int8 37 | end 38 | 39 | JLOptions() = unsafe_load(cglobal(:jl_options, JLOptions)) 40 | 41 | function show(io::IO, opt::JLOptions) 42 | println(io, "JLOptions(") 43 | fields = fieldnames(opt) 44 | nfields = length(fields) 45 | for (i,f) in enumerate(fieldnames(opt)) 46 | v = getfield(opt,f) 47 | if isa(v, Ptr{UInt8}) 48 | v = v != C_NULL ? bytestring(v) : "" 49 | end 50 | println(io, " ", f, " = ", repr(v), i < nfields ? "," : "") 51 | end 52 | print(io,")") 53 | end 54 | -------------------------------------------------------------------------------- /src/llvm-version.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #include 4 | 5 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9 6 | #define LLVM39 1 7 | #endif 8 | 9 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8 10 | #define LLVM38 1 11 | #define USE_ORCJIT 12 | #endif 13 | 14 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7 15 | #define LLVM37 1 16 | 17 | // We enable ORCJIT only if we have our custom patches 18 | #ifndef SYSTEM_LLVM 19 | #define USE_ORCJIT 20 | #endif 21 | 22 | #endif 23 | 24 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6 25 | #define LLVM36 1 26 | #endif 27 | 28 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5 29 | #define LLVM35 1 30 | #endif 31 | 32 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 4 33 | #define LLVM34 1 34 | #define USE_MCJIT 35 | #endif 36 | 37 | #if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 3 38 | #define LLVM33 1 39 | #else 40 | #error LLVM versions < 3.3 are not supported by Julia 41 | #endif 42 | 43 | #ifdef USE_ORCJIT //temporary, since in some places USE_MCJIT may be used instead of the correct LLVM version test 44 | #define USE_MCJIT 45 | #endif 46 | #ifdef USE_ORCMCJIT //temporary, since in some places USE_MCJIT may be used instead of the correct LLVM version test 47 | #define USE_MCJIT 48 | #endif 49 | -------------------------------------------------------------------------------- /src/threading.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://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 | #define ti_tid (jl_get_ptls_states()->tid) 18 | extern jl_thread_task_state_t *jl_all_task_states; 19 | extern JL_DLLEXPORT int jl_n_threads; // # threads we're actually using 20 | 21 | #ifdef JULIA_ENABLE_THREADING 22 | // GC 23 | extern struct _jl_thread_heap_t **jl_all_heaps; 24 | #endif 25 | 26 | // thread state 27 | enum { 28 | TI_THREAD_INIT, 29 | TI_THREAD_WORK 30 | }; 31 | 32 | 33 | // passed to thread function 34 | typedef struct { 35 | int16_t volatile state; 36 | int16_t tid; 37 | ti_threadgroup_t *tg; 38 | } ti_threadarg_t; 39 | 40 | 41 | // commands to thread function 42 | enum { 43 | TI_THREADWORK_DONE, 44 | TI_THREADWORK_RUN 45 | }; 46 | 47 | 48 | // work command to thread function 49 | typedef struct { 50 | uint8_t command; 51 | jl_function_t *fun; 52 | jl_svec_t *args; 53 | jl_value_t *ret; 54 | jl_module_t *current_module; 55 | } ti_threadwork_t; 56 | 57 | 58 | // thread function 59 | void ti_threadfun(void *arg); 60 | 61 | // helpers for thread function 62 | jl_value_t *ti_runthread(jl_function_t *f, jl_svec_t *args, size_t nargs); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* THREADING_H */ 69 | -------------------------------------------------------------------------------- /src/codegen_internal.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | // Declarations for disasm.cpp 4 | extern "C" 5 | void jl_dump_asm_internal(uintptr_t Fptr, size_t Fsize, int64_t slide, 6 | #ifndef USE_MCJIT 7 | std::vector lineinfo, 8 | #endif 9 | llvm::DIContext *context, 10 | #ifdef LLVM37 11 | raw_ostream &rstream 12 | #else 13 | formatted_raw_ostream &stream 14 | #endif 15 | ); 16 | 17 | // Declarations for debuginfo.cpp 18 | extern int jl_DI_for_fptr(uint64_t fptr, uint64_t *symsize, int64_t *slide, int64_t *section_slide, 19 | const object::ObjectFile **object, 20 | #ifdef USE_MCJIT 21 | llvm::DIContext **context 22 | #else 23 | std::vector *lines 24 | #endif 25 | ); 26 | 27 | extern bool jl_dylib_DI_for_fptr(size_t pointer, const object::ObjectFile **object, llvm::DIContext **context, int64_t *slide, int64_t *section_slide, 28 | bool onlySysImg, bool *isSysImg, void **saddr, char **name, char **filename); 29 | 30 | #ifdef USE_ORCJIT 31 | extern JL_DLLEXPORT void ORCNotifyObjectEmitted(JITEventListener *Listener, 32 | const object::ObjectFile &obj, 33 | const object::ObjectFile &debugObj, 34 | const RuntimeDyld::LoadedObjectInfo &L); 35 | #endif 36 | -------------------------------------------------------------------------------- /src/common_symbols1.inc: -------------------------------------------------------------------------------- 1 | jl_symbol("Any"), 2 | jl_symbol("getfield"), 3 | jl_symbol("box"), 4 | jl_symbol("apply_type"), 5 | jl_symbol("Ptr"), 6 | jl_symbol("#s323"), 7 | jl_symbol("#s322"), 8 | jl_symbol("Bool"), 9 | jl_symbol("getindex"), 10 | jl_symbol("not_int"), 11 | jl_symbol("add_int"), 12 | jl_symbol("start"), 13 | jl_symbol("svec"), 14 | jl_symbol("ccall"), 15 | jl_symbol("BlasInt"), 16 | jl_symbol("#s321"), 17 | jl_symbol("==="), 18 | jl_symbol("Void"), 19 | jl_symbol("#s79"), 20 | jl_symbol("#s320"), 21 | jl_symbol("Array"), 22 | jl_symbol("unsafe_convert"), 23 | jl_symbol("slt_int"), 24 | jl_symbol("done"), 25 | jl_symbol("new"), 26 | jl_symbol("convert"), 27 | jl_symbol("#s274"), 28 | jl_symbol("indexed_next"), 29 | jl_symbol("tuple.jl"), 30 | jl_symbol("cconvert"), 31 | jl_symbol("UInt8"), 32 | jl_symbol("#s317"), 33 | jl_symbol("length"), 34 | jl_symbol("args"), 35 | jl_symbol("Int32"), 36 | jl_symbol("arrayref"), 37 | jl_symbol("#s318"), 38 | jl_symbol("next"), 39 | jl_symbol("throw"), 40 | jl_symbol("#s19"), 41 | jl_symbol("index"), 42 | jl_symbol("boundscheck"), 43 | jl_symbol("Int"), 44 | jl_symbol("cmd"), 45 | jl_symbol("#s319"), 46 | jl_symbol("#s18"), 47 | jl_symbol("arraylen"), 48 | jl_symbol("colon"), 49 | jl_symbol("sub_int"), 50 | jl_symbol("setindex!"), 51 | jl_symbol("size"), 52 | jl_symbol("ptr_arg_unsafe_convert"), 53 | jl_symbol("ptr_arg_cconvert"), 54 | jl_symbol("#s316"), 55 | jl_symbol("Float64"), 56 | jl_symbol("Bz"), 57 | jl_symbol("nfields"), 58 | jl_symbol("..."), 59 | jl_symbol("key"), 60 | jl_symbol("string"), 61 | jl_symbol("data"), 62 | jl_symbol("#s273"), 63 | jl_symbol("#s78"), 64 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://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] = ((sub(u, 1:N-2, 2:N-1) + sub(u,3:N, 2:N-1))*dy2 + (sub(u,2:N-1,1:N-2) + sub(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/stockcorr.m: -------------------------------------------------------------------------------- 1 | %ORIGINAL_CORR - The original, unoptimised code that simulates two correlated assets 2 | %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 | n = 10000; %Number of simulations 9 | dt = 1/250; %Time step (1year = 250days) 10 | Div=[0.01 0.01]; %Dividend 11 | Vol=[0.2 0.3]; %Volatility 12 | 13 | %%Market Information 14 | r = 0.03; %Risk-free rate 15 | 16 | %% Define storages 17 | SimulPriceA=zeros(T,n); %Simulated Price of Asset A 18 | SimulPriceA(1,:)=CurrentPrice(1); 19 | SimulPriceB=zeros(T,n); %Simulated Price of Asset B 20 | SimulPriceB(1,:)=CurrentPrice(2); 21 | 22 | %% Generating the paths of stock prices by Geometric Brownian Motion 23 | UpperTriangle=chol(Corr); %UpperTriangle Matrix by Cholesky decomposition 24 | 25 | for i=1:n 26 | Wiener=randn(T-1,2); 27 | CorrWiener=Wiener*UpperTriangle; 28 | for j=2:T 29 | SimulPriceA(j,i)=SimulPriceA(j-1,i)*exp((r-Div(1)-Vol(1)^2/2)*dt+Vol(1)*sqrt(dt)*CorrWiener(j-1,1)); 30 | SimulPriceB(j,i)=SimulPriceB(j-1,i)*exp((r-Div(2)-Vol(2)^2/2)*dt+Vol(2)*sqrt(dt)*CorrWiener(j-1,2)); 31 | end 32 | end 33 | 34 | %% Plot the distribution of final prices 35 | % Comment this section out if doing timings 36 | % subplot(1,2,1);hist(SimulPriceA(end,:),100); 37 | % subplot(1,2,2);hist(SimulPriceB(end,:),100); 38 | -------------------------------------------------------------------------------- /src/support/timefuncs.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "dtypes.h" 14 | 15 | #if defined(_OS_WINDOWS_) 16 | #include 17 | #include 18 | #include 19 | #else 20 | #include 21 | #include 22 | #include 23 | #endif 24 | 25 | #include "timefuncs.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | JL_DLLEXPORT int jl_gettimeofday(struct jl_timeval *jtv) 32 | { 33 | #if defined(_OS_WINDOWS_) 34 | struct __timeb64 tb; 35 | errno_t code = _ftime64_s(&tb); 36 | jtv->sec = tb.time; 37 | jtv->usec = tb.millitm * 1000; 38 | #else 39 | struct timeval tv; 40 | int code = gettimeofday(&tv, NULL); 41 | jtv->sec = tv.tv_sec; 42 | jtv->usec = tv.tv_usec; 43 | #endif 44 | return code; 45 | } 46 | 47 | JL_DLLEXPORT double jl_clock_now(void) 48 | { 49 | struct jl_timeval now; 50 | jl_gettimeofday(&now); 51 | return now.sec + now.usec * 1e-6; 52 | } 53 | 54 | void sleep_ms(int ms) 55 | { 56 | if (ms == 0) 57 | return; 58 | 59 | #if defined(_OS_WINDOWS_) 60 | Sleep(ms); 61 | #else 62 | struct timeval timeout; 63 | 64 | timeout.tv_sec = ms / 1000; 65 | timeout.tv_usec = (ms % 1000) * 1000; 66 | 67 | select(0, NULL, NULL, NULL, &timeout); 68 | #endif 69 | } 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /test/perf/micro/java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | julialang.org 4 | javaBenchmarks 5 | 0.0.1-SNAPSHOT 6 | javaBenchmarks 7 | micro benchmarks for Julia done in Java 8 | 9 | 10 | org.jblas 11 | jblas 12 | 1.2.3 13 | 14 | 15 | com.googlecode.efficient-java-matrix-library 16 | ejml 17 | 0.23 18 | 19 | 20 | 21 | 22 | 23 | maven-compiler-plugin 24 | 3.0 25 | 26 | 1.7 27 | 1.7 28 | 29 | 30 | 31 | org.codehaus.mojo 32 | exec-maven-plugin 33 | 1.2.1 34 | 35 | 36 | 37 | java 38 | 39 | 40 | 41 | 42 | PerfBLAS 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /test/unicode/utf8.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | ## Test for CESU-8 sequences 4 | 5 | let ch = 0x10000 6 | for hichar = 0xd800:0xdbff 7 | for lochar = 0xdc00:0xdfff 8 | @test convert(UTF8String, utf8(Char[hichar, lochar]).data) == string(Char(ch)) 9 | ch += 1 10 | end 11 | end 12 | end 13 | 14 | 15 | let str = UTF8String(b"this is a test\xed\x80") 16 | @test next(str, 15) == ('\ufffd', 16) 17 | @test_throws BoundsError getindex(str, 0:3) 18 | @test_throws BoundsError getindex(str, 17:18) 19 | @test_throws BoundsError getindex(str, 2:17) 20 | @test_throws UnicodeError getindex(str, 16:17) 21 | @test string(Char(0x110000)) == "\ufffd" 22 | sa = SubString{ASCIIString}(ascii("This is a silly test"), 1, 14) 23 | s8 = convert(SubString{UTF8String}, sa) 24 | @test typeof(s8) == SubString{UTF8String} 25 | @test s8 == "This is a sill" 26 | @test convert(UTF8String, b"this is a test\xed\x80\x80") == "this is a test\ud000" 27 | end 28 | 29 | ## Reverse of UTF8String 30 | @test reverse(UTF8String("")) == "" 31 | @test reverse(UTF8String("a")) == "a" 32 | @test reverse(UTF8String("abc")) == "cba" 33 | @test reverse(UTF8String("xyz\uff\u800\uffff\U10ffff")) == "\U10ffff\uffff\u800\uffzyx" 34 | for str in (b"xyz\xc1", b"xyz\xd0", b"xyz\xe0", b"xyz\xed\x80", b"xyz\xf0", b"xyz\xf0\x80", b"xyz\xf0\x80\x80") 35 | @test_throws UnicodeError reverse(UTF8String(str)) 36 | end 37 | 38 | ## Specifically check UTF-8 string whose lead byte is same as a surrogate 39 | @test convert(UTF8String,b"\xed\x9f\xbf") == "\ud7ff" 40 | -------------------------------------------------------------------------------- /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_FFTW=1 \ 26 | USE_SYSTEM_GMP=1 \ 27 | USE_SYSTEM_MPFR=1 \ 28 | USE_SYSTEM_ARPACK=1 \ 29 | USE_SYSTEM_SUITESPARSE=1 \ 30 | USE_SYSTEM_ZLIB=1 \ 31 | USE_SYSTEM_GRISU=0 \ 32 | USE_SYSTEM_RMATH=0 \ 33 | USE_SYSTEM_LIBUV=0 \ 34 | PREFIX=${PREFIX} CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS} \ 35 | CC=${CC} CXX=${CXX} CPP=${CPP} FC=${FC} USEGCC=${USEGCC} USECLANG=${USECLANG} 36 | 37 | all: default 38 | ../../usr/lib/libspqr.dylib: 39 | $(MAKE) -C .. -f repackage_system_suitesparse${SUITESPARSE_VER_MAJOR}.make \ 40 | USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1 USE_BLAS64=0 \ 41 | CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS} 42 | 43 | default test release debug: ../../usr/lib/libspqr.dylib 44 | $(MAKE) -C ../.. $(JMAKEFLAGS) $@ 45 | 46 | .PHONY: all default test release debug 47 | -------------------------------------------------------------------------------- /test/perf/kernel/laplace/c_laplace_parallel_update_pointer.c: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #include 4 | #include 5 | #include "parameter.h" 6 | //#define N 150 7 | 8 | main() { 9 | double **u, **u1; 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_C (pure, parallel update)", "w"); 16 | 17 | scanf("%d", &Niter); 18 | 19 | u = ((double **)malloc(size_mat*sizeof(double *))); 20 | u1 = ((double **)malloc(size_mat*sizeof(double *))); 21 | for(i=0; i 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "dtypes.h" 14 | #include "htable.h" 15 | #include "hashing.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | htable_t *htable_new(htable_t *h, size_t size) 22 | { 23 | if (size <= HT_N_INLINE/2) { 24 | h->size = size = HT_N_INLINE; 25 | h->table = &h->_space[0]; 26 | } 27 | else { 28 | size = nextipow2(size); 29 | size *= 2; // 2 pointers per key/value pair 30 | size *= 2; // aim for 50% occupancy 31 | h->size = size; 32 | h->table = (void**)LLT_ALLOC(size*sizeof(void*)); 33 | } 34 | if (h->table == NULL) return NULL; 35 | size_t i; 36 | for(i=0; i < size; i++) 37 | h->table[i] = HT_NOTFOUND; 38 | return h; 39 | } 40 | 41 | void htable_free(htable_t *h) 42 | { 43 | if (h->table != &h->_space[0]) 44 | LLT_FREE(h->table); 45 | } 46 | 47 | // empty and reduce size 48 | void htable_reset(htable_t *h, size_t sz) 49 | { 50 | sz = nextipow2(sz); 51 | if (h->size > sz*4 && h->size > HT_N_INLINE) { 52 | size_t newsz = sz*4; 53 | void **newtab = (void**)LLT_REALLOC(h->table, newsz*sizeof(void*)); 54 | h->size = newsz; 55 | h->table = newtab; 56 | } 57 | size_t i, hsz=h->size; 58 | for(i=0; i < hsz; i++) 59 | h->table[i] = HT_NOTFOUND; 60 | } 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | -------------------------------------------------------------------------------- /examples/lru_test.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | using LRUExample 4 | 5 | TestLRU = LRUExample.UnboundedLRU{ASCIIString, ASCIIString}() 6 | TestBLRU = LRUExample.BoundedLRU{ASCIIString, ASCIIString}(1000) 7 | 8 | get_str(i) = ascii(vcat(map(x->[x>>4; x&0x0F], reinterpret(UInt8, [Int32(i)]))...)) 9 | 10 | isbounded{L<:LRUExample.LRU}(::Type{L}) = any(map(n->n==:maxsize, fieldnames(L))) 11 | isbounded{L<:LRUExample.LRU}(l::L) = isbounded(L) 12 | 13 | nmax = round(Int,logspace(2, 5, 4)) 14 | 15 | function lrutest() 16 | #println("LRU consistency tests") 17 | for lru in (TestLRU,TestBLRU) 18 | for n in nmax 19 | empty!(lru) 20 | #@printf(" %s, %d items\n", lru, n) 21 | #print(" Simple eviction: ") 22 | for i in 1:n 23 | str = get_str(i) 24 | lru[str] = str 25 | @assert lru.q[1].v == str 26 | if isbounded(lru) && length(lru) >= lru.maxsize 27 | tailstr = get_str(i-lru.maxsize+1) 28 | @assert lru.q[end].v == tailstr 29 | end 30 | end 31 | #println("pass") 32 | 33 | #print(" Lookup, random access: ") 34 | for i in 1:n 35 | str = get_str(rand(1:n)) 36 | if haskey(lru, str) # the bounded LRUs can have cache misses 37 | blah = lru[str] 38 | @assert lru.q[1].v == blah 39 | end 40 | end 41 | #println("pass") 42 | end 43 | empty!(lru) 44 | end 45 | end 46 | 47 | lrutest() 48 | -------------------------------------------------------------------------------- /base/libgit2/tag.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function tag_list(repo::GitRepo) 4 | with(StrArrayStruct()) do sa 5 | sa_ref = Ref(sa) 6 | @check ccall((:git_tag_list, :libgit2), Cint, 7 | (Ptr{StrArrayStruct}, Ptr{Void}), sa_ref, repo.ptr) 8 | convert(Vector{AbstractString}, sa_ref[]) 9 | end 10 | end 11 | 12 | function tag_delete(repo::GitRepo, tag::AbstractString) 13 | @check ccall((:git_tag_delete, :libgit2), Cint, 14 | (Ptr{Void}, Cstring, ), repo.ptr, tag) 15 | end 16 | 17 | function tag_create(repo::GitRepo, tag::AbstractString, commit::Union{AbstractString,Oid}; 18 | msg::AbstractString = "", 19 | force::Bool = false, 20 | sig::Signature = Signature(repo)) 21 | oid_ptr = Ref(Oid()) 22 | with(get(GitCommit, repo, commit)) do commit_obj 23 | commit_obj === nothing && return oid_ptr[] # return empty oid 24 | with(convert(GitSignature, sig)) do git_sig 25 | @check ccall((:git_tag_create, :libgit2), Cint, 26 | (Ptr{Oid}, Ptr{Void}, Cstring, Ptr{Void}, Ptr{SignatureStruct}, Cstring, Cint), 27 | oid_ptr, repo.ptr, tag, commit_obj.ptr, git_sig.ptr, msg, Cint(force)) 28 | end 29 | end 30 | return oid_ptr[] 31 | end 32 | 33 | function name(tag::GitTag) 34 | return bytestring(ccall((:git_tag_name, :libgit2), Cstring, (Ptr{Void}, ), tag.ptr)) 35 | end 36 | 37 | function target(tag::GitTag) 38 | oid_ptr = Ref(ccall((:git_tag_target_id, :libgit2), Ptr{Oid}, (Ptr{Void}, ), tag.ptr)) 39 | return oid_ptr[] 40 | end 41 | -------------------------------------------------------------------------------- /test/libgit2-online.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #@testset "libgit2-online" begin 4 | 5 | ######### 6 | # TESTS # 7 | ######### 8 | # init & clone 9 | mktempdir() do dir 10 | repo_url = "github.com/JuliaLang/Example.jl" 11 | https_prefix = "https://" 12 | ssh_prefix = "git@" 13 | #@testset "Cloning repository" begin 14 | #@testset "with 'https' protocol" begin 15 | repo_path = joinpath(dir, "Example1") 16 | repo = LibGit2.clone(https_prefix*repo_url, repo_path) 17 | try 18 | @test isdir(repo_path) 19 | @test isdir(joinpath(repo_path, ".git")) 20 | finally 21 | finalize(repo) 22 | end 23 | #end 24 | #@testset "with incorrect url" begin 25 | repo_path = joinpath(dir, "Example2") 26 | # credential are required because github try authenticate on uknown repo 27 | x = Nullable(LibGit2.UserPasswordCredentials("X","X")) 28 | @test_throws LibGit2.Error.GitError LibGit2.clone(https_prefix*repo_url*randstring(10), repo_path, payload=x) 29 | #end 30 | 31 | try 32 | #@testset "with 'ssh' protocol (by default is not supported)" begin 33 | repo_path = joinpath(dir, "Example3") 34 | @test_throws LibGit2.Error.GitError LibGit2.clone(ssh_prefix*repo_url, repo_path) 35 | #end 36 | catch ex 37 | # but we cloned succesfully, so check that repo was created 38 | ex.fail == 1 && @test isdir(joinpath(path, ".git")) 39 | end 40 | #end 41 | end 42 | 43 | #end 44 | -------------------------------------------------------------------------------- /test/perf/kernel/stockcorr.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | ## Test case from Issue #445 4 | 5 | #STOCKCORR - The original, unoptimised code that simulates two correlated assets 6 | function stockcorr() 7 | 8 | ## Correlated asset information 9 | CurrentPrice = [78. 102.] # Initial Prices of the two stocks 10 | Corr = [1. 0.4; 0.4 1.] # Correlation Matrix 11 | T = 500 # Number of days to simulate = 2years = 500days 12 | n = 10000 # Number of simulations 13 | dt = 1/250 # Time step (1year = 250days) 14 | Div=[0.01 0.01] # Dividend 15 | Vol=[0.2 0.3] # Volatility 16 | 17 | ## Market Information 18 | r = 0.03 # Risk-free rate 19 | 20 | ## Define storages 21 | SimulPriceA = zeros(T,n) # Simulated Price of Asset A 22 | SimulPriceA[1,:] = CurrentPrice[1] 23 | SimulPriceB = zeros(T,n) # Simulated Price of Asset B 24 | SimulPriceB[1,:] = CurrentPrice[2] 25 | 26 | ## Generating the paths of stock prices by Geometric Brownian Motion 27 | UpperTriangle=chol(Corr) # UpperTriangle Matrix by Cholesky decomposition 28 | 29 | for i = 1:n 30 | Wiener = randn(T-1,2) 31 | CorrWiener = Wiener*UpperTriangle 32 | for j = 2:T 33 | SimulPriceA[j,i] = SimulPriceA[j-1,i]*exp((r-Div[1]-Vol[1]^2/2)*dt+Vol[1]*sqrt(dt)*CorrWiener[j-1,1]) 34 | SimulPriceB[j,i] = SimulPriceB[j-1,i]*exp((r-Div[2]-Vol[2]^2/2)*dt+Vol[2]*sqrt(dt)*CorrWiener[j-1,2]) 35 | end 36 | end 37 | 38 | return (SimulPriceA, SimulPriceB) 39 | end 40 | -------------------------------------------------------------------------------- /test/perf/shootout/binary_trees.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # 4 | # The Computer Language Benchmarks Game 5 | # binary-trees benchmark 6 | # http://shootout.alioth.debian.org/u32/performance.php?test=binarytrees 7 | # 8 | # Ported from an OCaml version 9 | # 10 | 11 | abstract BTree 12 | 13 | type Empty <: BTree 14 | end 15 | 16 | type Node <: BTree 17 | info 18 | left::BTree 19 | right::BTree 20 | end 21 | 22 | function make(val, d) 23 | if d == 0 24 | Node(val, Empty(), Empty()) 25 | else 26 | nval = val * 2 27 | Node(val, make(nval-1, d-1), make(nval, d-1)) 28 | end 29 | end 30 | 31 | check(t::Empty) = 0 32 | check(t::Node) = t.info + check(t.left) - check(t.right) 33 | 34 | function loop_depths(d, min_depth, max_depth) 35 | for i = 0:div(max_depth - d, 2) 36 | niter = 1 << (max_depth - d + min_depth) 37 | c = 0 38 | for j = 1:niter 39 | c += check(make(i, d)) + check(make(-i, d)) 40 | end 41 | # @printf("%i\t trees of depth %i\t check: %i\n", 2*niter, d, c) 42 | d += 2 43 | end 44 | end 45 | 46 | function binary_trees(N::Int=10) 47 | const min_depth = 4 48 | const max_depth = N 49 | const stretch_depth = max_depth + 1 50 | 51 | # create and check stretch tree 52 | let c = check(make(0, stretch_depth)) 53 | # @printf("stretch tree of depth %i\t check: %i\n", stretch_depth, c) 54 | end 55 | 56 | long_lived_tree = make(0, max_depth) 57 | 58 | loop_depths(min_depth, min_depth, max_depth) 59 | # @printf("long lived tree of depth %i\t check: %i\n", max_depth, check(long_lived_tree)) 60 | end 61 | 62 | -------------------------------------------------------------------------------- /src/threadgroup.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef THREADGROUP_H 4 | #define THREADGROUP_H 5 | 6 | #include 7 | #include "uv.h" 8 | 9 | // for the barrier 10 | typedef struct { 11 | volatile int sense; 12 | } ti_thread_sense_t; 13 | 14 | 15 | // thread group 16 | typedef struct { 17 | int16_t *tid_map, num_threads, added_threads; 18 | uint8_t num_sockets, num_cores, num_threads_per_core; 19 | 20 | // fork/join/barrier 21 | volatile uint8_t group_sense; 22 | ti_thread_sense_t **thread_sense; 23 | void *envelope; 24 | 25 | // to let threads sleep 26 | uv_mutex_t alarm_lock; 27 | uv_cond_t alarm; 28 | uint64_t sleep_threshold; 29 | } ti_threadgroup_t; 30 | 31 | 32 | int ti_threadgroup_create(uint8_t num_sockets, uint8_t num_cores, 33 | uint8_t num_threads_per_core, 34 | ti_threadgroup_t **newtg); 35 | int ti_threadgroup_addthread(ti_threadgroup_t *tg, int16_t ext_tid, 36 | int16_t *tgtid); 37 | int ti_threadgroup_initthread(ti_threadgroup_t *tg, int16_t ext_tid); 38 | int ti_threadgroup_member(ti_threadgroup_t *tg, int16_t ext_tid, 39 | int16_t *tgtid); 40 | int ti_threadgroup_size(ti_threadgroup_t *tg, int16_t *tgsize); 41 | int ti_threadgroup_fork(ti_threadgroup_t *tg, int16_t ext_tid, 42 | void **bcast_val); 43 | int ti_threadgroup_join(ti_threadgroup_t *tg, int16_t ext_tid); 44 | int ti_threadgroup_destroy(ti_threadgroup_t *tg); 45 | 46 | extern ti_threadgroup_t *tgworld; 47 | 48 | #endif /* THREADGROUP_H */ 49 | -------------------------------------------------------------------------------- /test/perf/shootout/pidigits.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | function pidigits(N::Int, printOut::Bool) 4 | """ 5 | See http://shootout.alioth.debian.org/u64q/performance.php?test=pidigits#about 6 | 7 | Transliterated from Mario Pernici Python's program 8 | 9 | 10 | INPUT: 11 | 12 | - N -- a positive integer giving the number of digits of pi to be computed 13 | 14 | - printOut -- a boolean specifying if we want intermediate printouts of digits in packets of 10 15 | 16 | OUTPUT: 17 | 18 | - returns the last ten digits anyway 19 | 20 | - prints all the digits in packets of 10 iff printOut == true 21 | 22 | """ 23 | 24 | i = k = ns = 0 25 | k1 = 1 26 | n,a,d,t,u = map(BigInt,(1,0,1,0,0)) 27 | 28 | while true 29 | k += 1 30 | t = n << 1 31 | n *= k 32 | a += t 33 | k1 += 2 34 | a *= k1 35 | d *= k1 36 | 37 | if a >= n 38 | t,u = divrem(n*3 +a, d) 39 | u += n 40 | if d > u 41 | ns = ns*10 + t 42 | i += 1 43 | if mod(i,10) == 0 44 | if printOut 45 | print(ns) 46 | @printf("\t:%d\n", i) 47 | end 48 | if i >= N 49 | return ns 50 | end 51 | ns = 0 52 | end 53 | a -= d*t 54 | a *= 10 55 | n *= 10 56 | 57 | end 58 | end 59 | end 60 | end 61 | 62 | function pidigits(N::Int=1000) 63 | pidigits(N,false) 64 | end 65 | -------------------------------------------------------------------------------- /test/perf/shootout/revcomp.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | # The Computer Language Benchmarks Game 4 | # http://shootout.alioth.debian.org/ 5 | # 6 | # Contributed by David Campbell 7 | 8 | # FIXME(davekong) Is there support in Julia for doing more efficient IO and 9 | # handling of byte arrays? 10 | 11 | const revcompdata = Dict( 12 | 'A'=> 'T', 'a'=> 'T', 13 | 'C'=> 'G', 'c'=> 'G', 14 | 'G'=> 'C', 'g'=> 'C', 15 | 'T'=> 'A', 't'=> 'A', 16 | 'U'=> 'A', 'u'=> 'A', 17 | 'M'=> 'K', 'm'=> 'K', 18 | 'R'=> 'Y', 'r'=> 'Y', 19 | 'W'=> 'W', 'w'=> 'W', 20 | 'S'=> 'S', 's'=> 'S', 21 | 'Y'=> 'R', 'y'=> 'R', 22 | 'K'=> 'M', 'k'=> 'M', 23 | 'V'=> 'B', 'v'=> 'B', 24 | 'H'=> 'D', 'h'=> 'D', 25 | 'D'=> 'H', 'd'=> 'H', 26 | 'B'=> 'V', 'b'=> 'V', 27 | 'N'=> 'N', 'n'=> 'N', 28 | ) 29 | 30 | function print_buff(b) 31 | br = reverse(b) 32 | l = length(br) 33 | for i = 1:60:l 34 | if i+59 > l 35 | write(br[i:end]); println() 36 | else 37 | write(br[i:i+59]); println() 38 | end 39 | end 40 | end 41 | 42 | function revcomp(infile="revcomp-input.txt") 43 | input = open(infile, "r") 44 | buff = UInt8[] 45 | while true 46 | line = readline(input).data 47 | if isempty(line) 48 | # print_buff(buff) 49 | return 50 | elseif line[1] == '>' 51 | # print_buff(buff) 52 | buff = UInt8[] 53 | # write(line) 54 | else 55 | l = length(line)-1 56 | append!(buff, [UInt8(revcompdata[Char(line[i])]) for i=1:l]) 57 | end 58 | end 59 | close(input) 60 | end 61 | 62 | -------------------------------------------------------------------------------- /src/support/htable.h: -------------------------------------------------------------------------------- 1 | // This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | #ifndef HTABLE_H 4 | #define HTABLE_H 5 | 6 | #define HT_N_INLINE 32 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct { 13 | size_t size; 14 | void **table; 15 | void *_space[HT_N_INLINE]; 16 | } htable_t; 17 | 18 | // define this to be an invalid key/value 19 | #define HT_NOTFOUND ((void*)1) 20 | 21 | // initialize and free 22 | htable_t *htable_new(htable_t *h, size_t size); 23 | void htable_free(htable_t *h); 24 | 25 | // clear and (possibly) change size 26 | void htable_reset(htable_t *h, size_t sz); 27 | 28 | #define HTPROT(HTNAME) \ 29 | void *HTNAME##_get(htable_t *h, void *key); \ 30 | void HTNAME##_put(htable_t *h, void *key, void *val); \ 31 | void HTNAME##_adjoin(htable_t *h, void *key, void *val); \ 32 | int HTNAME##_has(htable_t *h, void *key); \ 33 | int HTNAME##_remove(htable_t *h, void *key); \ 34 | void **HTNAME##_bp(htable_t *h, void *key); 35 | 36 | #define HTPROT_R(HTNAME) \ 37 | void *HTNAME##_get_r(htable_t *h, void *key, void *ctx); \ 38 | void HTNAME##_put_r(htable_t *h, void *key, void *val, void *ctx); \ 39 | void HTNAME##_adjoin_r(htable_t *h, void *key, void *val, void *ctx); \ 40 | int HTNAME##_has_r(htable_t *h, void *key, void *ctx); \ 41 | int HTNAME##_remove_r(htable_t *h, void *key, void *ctx); \ 42 | void **HTNAME##_bp_r(htable_t *h, void *key, void *ctx); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /test/operators.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | @test ifelse(true, 1, 2) == 1 4 | @test ifelse(false, 1, 2) == 2 5 | 6 | s = Set() 7 | ifelse(true, push!(s, 1), push!(s, 2)) 8 | @test s == Set([1, 2]) 9 | 10 | s = Set() 11 | true ? push!(s, 1) : push!(s, 2) 12 | false ? push!(s, 3) : push!(s, 4) 13 | @test s == Set([1, 4]) 14 | 15 | B = [true true false] 16 | @test ifelse(B, 1, 2) == [1 1 2] 17 | @test ifelse(B, 1, [2 3 4]) == [1 1 4] 18 | @test ifelse(B, [2 3 4], 1) == [2 3 1] 19 | @test ifelse(B, [2 3 4], [5 6 7]) == [2 3 7] 20 | 21 | @test reverse(Pair(1,2)) == Pair(2,1) 22 | @test reverse(Pair("13","24")) == Pair("24","13") 23 | @test typeof(reverse(Pair{ByteString,Int64}("a",1))) == Pair{Int64,ByteString} 24 | 25 | p = 1=>:foo 26 | @test first(p) == 1 27 | @test last(p) == :foo 28 | @test first(reverse(p)) == :foo 29 | @test last(reverse(p)) == 1 30 | @test endof(p) == 2 31 | @test p[endof(p)] == p[end] == p[2] == :foo 32 | 33 | @test (|)(2) == 2 34 | @test ($)(2) == 2 35 | 36 | @test ctranspose('a') == 'a' 37 | 38 | @test_throws ArgumentError Base.scalarmin(['a','b'],['c','d']) 39 | @test_throws ArgumentError Base.scalarmin('a',['c','d']) 40 | @test_throws ArgumentError Base.scalarmin(['a','b'],'c') 41 | @test_throws ArgumentError Base.scalarmax(['a','b'],['c','d']) 42 | @test_throws ArgumentError Base.scalarmax('a',['c','d']) 43 | @test_throws ArgumentError Base.scalarmax(['a','b'],'c') 44 | 45 | @test lexless('a','b') 46 | 47 | @test 1 .!= 2 48 | @test 1 .== 1 49 | @test 1 .< 2 50 | @test 1 .<= 2 51 | 52 | # issue #13144: max() with 4 or more array arguments 53 | let xs = [[i:i+4;] for i in 1:10] 54 | for n in 2:10 55 | @test max(xs[1:n]...) == [n:n+4;] 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /test/inline.jl: -------------------------------------------------------------------------------- 1 | # This file is a part of Julia. License is MIT: http://julialang.org/license 2 | 3 | using Base.Test 4 | 5 | """ 6 | Helper to walk the AST and call a function on every node. 7 | """ 8 | function walk(func, expr) 9 | func(expr) 10 | if isa(expr, Expr) 11 | func(expr.head) 12 | for o in expr.args 13 | walk(func, o) 14 | end 15 | end 16 | end 17 | 18 | """ 19 | Helper to test that every slot is in range after inlining. 20 | """ 21 | function test_inlined_symbols(func, argtypes) 22 | linfo = code_typed(func, argtypes)[1] 23 | nl = length(linfo.slottypes) 24 | ast = Expr(:body); ast.args = Base.uncompressed_ast(linfo) 25 | walk(ast) do e 26 | if isa(e, Slot) 27 | @test 1 <= e.id <= nl 28 | end 29 | if isa(e, NewvarNode) 30 | @test 1 <= e.slot.id <= nl 31 | end 32 | end 33 | end 34 | 35 | # Test case 1: 36 | # Make sure that all symbols are properly escaped after inlining 37 | # https://github.com/JuliaLang/julia/issues/12620 38 | @inline function test_inner(count) 39 | x = 1 40 | i = 0 41 | while i <= count 42 | y = x 43 | x = x + y 44 | i += 1 45 | end 46 | end 47 | function test_outer(a) 48 | test_inner(a) 49 | end 50 | test_inlined_symbols(test_outer, Tuple{Int64}) 51 | 52 | # Test case 2: 53 | # Make sure that an error is thrown for the undeclared 54 | # y in the else branch. 55 | # https://github.com/JuliaLang/julia/issues/12620 56 | @inline function foo_inl(x) 57 | if x 58 | y = 2 59 | else 60 | return y 61 | end 62 | end 63 | function bar() 64 | for i = 1:3 65 | foo_inl(i==1) 66 | end 67 | end 68 | @test_throws UndefVarError bar() 69 | 70 | --------------------------------------------------------------------------------