Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of github.com:JuliaLang/julia

Conflicts:
	Make.inc
	Makefile
	base/client.jl
	base/librandom.jl
	base/pkg.jl
	base/start_image.jl
	base/sysimg.jl
	deps/Makefile
	extras/iostring.jl
	src/gf.c
	src/init.c
	src/julia.h
	src/module.c
	src/task.c
	ui/Makefile
	ui/webserver/webserver.cpp
  • Loading branch information...
commit 73e1ae20ef6ad4614834e5defac08f908c266fe4 2 parents 0976783 + 7a7fc10
Keno Fischer authored

Showing 100 changed files with 2,054 additions and 2,107 deletions. Show diff stats Hide diff stats

  1. 17  .travis.yml
  2. 79  Make.inc
  3. 22  Makefile
  4. 3  README.md
  5. 10  base/abstractarray.jl
  6. 2  base/base.jl
  7. 43  base/blas.jl
  8. 4  base/boot.jl
  9. 37  base/client.jl
  10. 24  base/complex.jl
  11. 31  base/darray2.jl
  12. 3  base/dict.jl
  13. 1  base/dsp.jl
  14. 5  base/error.jl
  15. 7  base/export.jl
  16. 2  base/expr.jl
  17. 61  base/fftw.jl
  18. 7  base/file.jl
  19. 23  base/float.jl
  20. 5  base/floatfuncs.jl
  21. 2  base/git.jl
  22. 5  base/grisu.jl
  23. 50  base/inference.jl
  24. 11  base/io.jl
  25. 221  base/lapack.jl
  26. 2  base/libc.jl
  27. 41  base/librandom.jl
  28. 143  base/linalg_dense.jl
  29. 190  base/math.jl
  30. 6  base/multi.jl
  31. 13  base/pcre.jl
  32. 83  base/pkg.jl
  33. 9  base/pkgmetadata.jl
  34. 1  base/printf.jl
  35. 1  base/rng.jl
  36. 2  base/set.jl
  37. 4  base/show.jl
  38. 31  base/start_image.jl
  39. 1  base/string.jl
  40. 44  base/sysimg.jl
  41. 16  base/util.jl
  42. 37  contrib/fixup-libgfortran.sh
  43. 5  contrib/julia-mode.el
  44. 4  contrib/julia.xml
  45. 1  deps/.gitignore
  46. 256  deps/Makefile
  47. 2  deps/Rmath/src/Makefile
  48. 5  deps/Versions.make
  49. 2  deps/lighttpd.conf
  50. 12  doc/helpdb.jl
  51. 36  doc/manual/modules.rst
  52. 6  doc/stdlib/base.rst
  53. 1  examples/bigfib.jl
  54. 5  examples/tk_examples.jl
  55. 2  examples/wav.jl
  56. 5  examples/winston_tk.jl
  57. 1  extras/arpack.jl
  58. 56  extras/bitarray.jl
  59. 4  extras/glpk.jl
  60. 1  extras/gzip.jl
  61. 1  extras/linprog.jl
  62. 99  extras/profile.jl
  63. 5  extras/strpack.jl
  64. 1  extras/suitesparse.jl
  65. 1  extras/zlib.jl
  66. 18  src/Makefile
  67. 1  src/alloc.c
  68. 12  src/array.c
  69. 4  src/ast.c
  70. 62  src/builtins.c
  71. 168  src/ccall.cpp
  72. 6  src/cgutils.cpp
  73. 73  src/codegen.cpp
  74. 11  src/dlload.c
  75. 15  src/dump.c
  76. 13  src/gc.c
  77. 23  src/gf.c
  78. 9  src/init.c
  79. 11  src/interpreter.c
  80. 90  src/julia-parser.scm
  81. 53  src/julia-syntax.scm
  82. 6  src/julia.expmap
  83. 56  src/julia.h
  84. 2  src/module.c
  85. 166  src/task.c
  86. 20  src/toplevel.c
  87. 6  src/utils.scm
  88. 59  test/bitarray.jl
  89. 36  test/core.jl
  90. 690  test/linalg.jl
  91. 50  test/math.jl
  92. 16  test/runtests.jl
  93. 8  ui/Makefile
  94. 7  ui/repl-readline.c
  95. 4  ui/repl.c
  96. 2  ui/webserver/webserver.cpp
  97. 505  ui/zeromq/zmq.jl
  98. 43  ui/zeromq/zmq_client_julia.jl
  99. 43  ui/zeromq/zmq_serialize_julia.jl
  100. 63  ui/zeromq/zmq_server_julia.jl
17  .travis.yml
... ...
@@ -1,18 +1,19 @@
1 1
 language: cpp
2  
-compiler: clang
  2
+compiler: 
  3
+    - clang
  4
+    - gcc
3 5
 notifications:
4 6
     email: false
5 7
 before_install:
  8
+    - BUILDOPTS="LLVM_CONFIG=llvm-config-3.1 USE_QUIET=0"; for lib in LLVM ZLIB SUITESPARSE ARPACK BLAS FFTW LAPACK LIGHTTPD GMP PCRE LIBUNWIND READLINE GLPK; do export BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1"; done
6 9
     - sudo apt-get update -qq -y
7 10
     - sudo apt-get install zlib1g-dev
8 11
     - sudo add-apt-repository ppa:staticfloat/julia-deps -y
9 12
     - sudo apt-get update -qq -y
10  
-    - sudo apt-get install gfortran clang llvm-3.1-dev libsuitesparse-dev libncurses5-dev libopenblas-dev libarpack2-dev libfftw3-dev libpcre3-dev libglpk-dev lighttpd libgmp-dev libunwind7-dev libreadline-dev -y
11  
-env:
12  
-    - BUILDOPTS="LLVM_CONFIG=llvm-config-3.1 USECLANG=1 USE_SYSTEM_LLVM=1 USE_SYSTEM_ZLIB=1 USE_SYSTEM_SUITESPARSE=1 USE_SYSTEM_ARPACK=1 USE_SYSTEM_BLAS=1 USE_SYSTEM_FFTW=1 USE_SYSTEM_LAPACK=1 USE_SYSTEM_LIGHTTPD=1 USE_SYSTEM_GMP=1 USE_SYSTEM_PCRE=1 USE_SYSTEM_LIBUNWIND=1 USE_SYSTEM_READLINE=1 USE_SYSTEM_GLPK=1"
13  
-script: make $BUILDOPTS dist
  13
+    - sudo apt-get install gfortran llvm-3.1-dev libsuitesparse-dev libncurses5-dev libopenblas-dev libarpack2-dev libfftw3-dev libpcre3-dev libglpk-dev lighttpd libgmp-dev libunwind7-dev libreadline-dev -y
  14
+script: make $BUILDOPTS PREFIX=/tmp/julia install
14 15
 after_script:
15  
-    - make $BUILDOPTS testall
16  
-    - make $BUILDOPTS PREFIX=/tmp/julia install
  16
+    - cd .. && mv julia julia2
17 17
     - cd /tmp/julia/share/julia/test && /tmp/julia/bin/julia runtests.jl all
18  
-    - echo "Packaging steps here"
  18
+    - cd - && mv julia2 julia
  19
+    - echo "Ready for packaging..."
79  Make.inc
@@ -56,8 +56,13 @@ USE_COPY_STACKS = 1
56 56
 FC = gfortran
57 57
 JFFLAGS = -O2 $(fPIC)
58 58
 
  59
+ifeq ($(CC), clang)
  60
+USEGCC = 0
  61
+USECLANG = 1
  62
+else
59 63
 USEGCC = 1
60 64
 USECLANG = 0
  65
+endif
61 66
 
62 67
 ifeq ($(OS), Darwin)
63 68
 OSVER = $(shell uname -r | cut -b 1-2)
@@ -144,7 +149,7 @@ endif
144 149
 ifeq ($(USE_SYSTEM_LIBUNWIND), 1)
145 150
 LIBUNWIND=-lunwind-generic -lunwind
146 151
 else
147  
-LIBUNWIND=$(USR)/$(JL_LIBDIR)/libunwind-generic.a $(USR)/$(JL_LIBDIR)/libunwind.a
  152
+LIBUNWIND=$(USR)/lib/libunwind-generic.a $(USR)/lib/libunwind.a
148 153
 endif
149 154
 
150 155
 ifeq ($(USE_SYSTEM_LLVM), 1)
@@ -156,13 +161,13 @@ endif
156 161
 ifeq ($(USE_SYSTEM_READLINE), 1)
157 162
 READLINE = -lreadline 
158 163
 else
159  
-READLINE = $(USR)/$(JL_LIBDIR)/libreadline.a
  164
+READLINE = $(USR)/lib/libreadline.a
160 165
 endif
161 166
 
162 167
 ifneq ($(OS),WINNT)
163 168
 READLINE += -lncurses
164 169
 else
165  
-READLINE += $(USR)/$(JL_LIBDIR)/libhistory.a
  170
+READLINE += $(USR)/lib/libhistory.a
166 171
 endif
167 172
 
168 173
 ifeq ($(USE_SYSTEM_PCRE), 1)
@@ -180,7 +185,7 @@ LIBBLAS = -lblas
180 185
 LIBBLASNAME = libblas
181 186
 endif
182 187
 else
183  
-LIBBLAS = -L$(USR)/$(JL_LIBDIR) -lopenblas
  188
+LIBBLAS = -L$(USR)/lib -lopenblas
184 189
 LIBBLASNAME = libopenblas
185 190
 endif
186 191
 
@@ -199,38 +204,57 @@ endif
199 204
 
200 205
 # OS specific stuff
201 206
 
202  
-# must end with a / and have no trailing spaces
203  
-INSTALL_NAME_ID_DIR = @rpath/
  207
+# install_name_tool
  208
+ifeq ($(OS), Darwin)
  209
+  # must end with a / and have no trailing spaces
  210
+  INSTALL_NAME_ID_DIR = @rpath/
  211
+  INSTALL_NAME_CMD = install_name_tool -id $(INSTALL_NAME_ID_DIR)
  212
+  INSTALL_NAME_CHANGE_CMD = install_name_tool -change
  213
+else
  214
+  INSTALL_NAME_ID_DIR =
  215
+  INSTALL_NAME_CMD = true -ignore 
  216
+  INSTALL_NAME_CHANGE_CMD = true -ignore 
  217
+endif
204 218
 
205  
-RPATH = 
206  
-RPATH_ORIGIN = 
  219
+# shared library runtime paths
  220
+ifeq ($(OS), WINNT)
  221
+  RPATH =
  222
+  RPATH_ORIGIN =
  223
+else ifeq ($(OS), Darwin)
  224
+  RPATH = -Wl,-rpath,'@executable_path/../$(JL_PRIVATE_LIBDIR)' -Wl,-rpath,'@executable_path/../$(JL_LIBDIR)'
  225
+  RPATH_ORIGIN =
  226
+else
  227
+  RPATH = -Wl,-rpath,'$$ORIGIN/../$(JL_PRIVATE_LIBDIR)' -Wl,-rpath,'$$ORIGIN/../$(JL_LIBDIR)' -Wl,-z,origin
  228
+  RPATH_ORIGIN = -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin
  229
+endif
207 230
 
  231
+# file extensions
208 232
 ifeq ($(OS), WINNT)
209  
-SHELL_EXT = bat
  233
+  SHLIB_EXT = dll
  234
+  SHELL_EXT = bat
  235
+else ifeq ($(OS), Darwin)
  236
+  SHLIB_EXT = dylib
  237
+  SHELL_EXT = sh
  238
+else
  239
+  SHLIB_EXT = so
  240
+  SHELL_EXT = sh
  241
+endif
  242
+
  243
+# --whole-archive
  244
+ifeq ($(OS), Darwin)
  245
+  WHOLE_ARCHIVE = -Xlinker -all_load
  246
+  NO_WHOLE_ARCHIVE =
210 247
 else
211  
-SHELL_EXT = sh
  248
+  WHOLE_ARCHIVE = -Wl,--whole-archive
  249
+  NO_WHOLE_ARCHIVE = -Wl,--no-whole-archive
212 250
 endif
213 251
 
214 252
 ifeq ($(OS), Linux)
215  
-INSTALL_NAME_CMD = true -ignore
216  
-INSTALL_NAME_CHANGE_CMD = true -ignore
217  
-SHLIB_EXT = so
218  
-RPATH = -Wl,-rpath,'$$ORIGIN/../$(JL_LIBDIR)' -Wl,-rpath,'$$ORIGIN/../$(JL_PRIVATE_LIBDIR)'
219  
-RPATH_ORIGIN = -Wl,-rpath,'$$ORIGIN'
220 253
 OSLIBS += -ldl -lrt -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap -Wl,--no-whole-archive $(LIBUNWIND)
221  
-WHOLE_ARCHIVE = -Wl,--whole-archive
222  
-NO_WHOLE_ARCHIVE = -Wl,--no-whole-archive
223 254
 JLDFLAGS = -Wl,-Bdynamic
224 255
 endif
225 256
 
226 257
 ifeq ($(OS), FreeBSD)
227  
-INSTALL_NAME_CMD = true -ignore
228  
-INSTALL_NAME_CHANGE_CMD = true -ignore
229  
-SHLIB_EXT = so
230  
-RPATH = -Wl,-rpath,'$$ORIGIN/../$(JL_LIBDIR)' -Wl,-rpath,'$$ORIGIN/../$(JL_PRIVATE_LIBDIR)' -Wl,-z,origin
231  
-RPATH_ORIGIN = -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin
232  
-WHOLE_ARCHIVE = -Wl,--whole-archive
233  
-NO_WHOLE_ARCHIVE = -Wl,--no-whole-archive
234 258
 JLDFLAGS = -Wl,-Bdynamic
235 259
 OSLIBS += -lkvm -lrt -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap $(NO_WHOLE_ARCHIVE) $(LIBUNWIND)
236 260
 endif
@@ -240,18 +264,13 @@ INSTALL_NAME_CMD = install_name_tool -id $(INSTALL_NAME_ID_DIR)
240 264
 INSTALL_NAME_CHANGE_CMD = install_name_tool -change
241 265
 RPATH = -Wl,-rpath,'@executable_path/../$(JL_LIBDIR)' -Wl,-rpath,'@executable_path/../$(JL_PRIVATE_LIBDIR)'
242 266
 SHLIB_EXT = dylib
243  
-OSLIBS += -ldl -Wl,-w -framework CoreServices -framework ApplicationServices
  267
+OSLIBS += -ldl -Wl,-w -framework ApplicationServices
244 268
 WHOLE_ARCHIVE = -Xlinker -all_load
245 269
 NO_WHOLE_ARCHIVE =
246 270
 JLDFLAGS =
247 271
 endif
248 272
 
249 273
 ifeq ($(OS), WINNT)
250  
-INSTALL_NAME_CMD = true -ignore
251  
-INSTALL_NAME_CHANGE_CMD = true -ignore
252  
-SHLIB_EXT = dll
253  
-WHOLE_ARCHIVE = -Wl,--whole-archive
254  
-NO_WHOLE_ARCHIVE = -Wl,--no-whole-archive
255 274
 OSLIBS += -Wl,--export-all-symbols -Wl,--version-script=$(JULIAHOME)/src/julia.expmap -lpthread $(NO_WHOLE_ARCHIVE) -lPsapi -lkernel32 -lWs2_32 -lIphlpapi
256 275
 endif
257 276
 
22  Makefile
@@ -20,6 +20,7 @@ debug release: | $(DIRS) $(BUILD)/share/julia/extras $(BUILD)/share/julia/base $
20 20
 	$(MAKEs) JULIA_EXECUTABLE=$(JULIA_EXECUTABLE_$@) $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji
21 21
 
22 22
 julia-debug julia-release:
  23
+	@-git submodule update
23 24
 	@$(MAKEs) -C deps
24 25
 	@$(MAKEs) -C src lib$@
25 26
 	@$(MAKEs) -C base
@@ -35,6 +36,15 @@ $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji: VERSION base/*.jl $(BUILD)/share/julia/hel
35 36
 	$(QUIET_JULIA) cd base && \
36 37
 	(test -f $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji || $(JULIA_EXECUTABLE) -bf sysimg.jl) && $(JULIA_EXECUTABLE) -f sysimg.jl || echo "Note: this error is usually fixed by running 'make cleanall'."
37 38
 
  39
+# public libraries, that are installed in $(PREFIX)/lib
  40
+JL_LIBS = julia-release julia-debug
  41
+
  42
+# private libraries, that are installed in $(PREFIX)/lib/julia
  43
+JL_PRIVATE_LIBS = amd arpack cholmod colamd fftw3 fftw3f fftw3_threads \
  44
+                  fftw3f_threads glpk glpk_wrapper gmp gmp_wrapper grisu \
  45
+                  history openlibm pcre random readline Rmath spqr \
  46
+                  suitesparse_wrapper tk_wrapper umfpack z openblas
  47
+
38 48
 PREFIX ?= julia-$(JULIA_COMMIT)
39 49
 install: release
40 50
 	@$(MAKEs) -C test/unicode
@@ -44,10 +54,10 @@ install: release
44 54
 	cp $(BUILD)/bin/*julia* $(PREFIX)/bin
45 55
 	cd $(PREFIX)/bin && ln -s julia-release-$(DEFAULT_REPL) julia
46 56
 	-for suffix in $(JL_LIBS) ; do \
47  
-		cp $(BUILD)/$(JL_LIBDIR)/lib$${suffix}.$(SHLIB_EXT) $(PREFIX)/$(JL_LIBDIR) ; \
  57
+		cp -a $(BUILD)/lib/lib$${suffix}.* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
48 58
 	done
49 59
 	-for suffix in $(JL_PRIVATE_LIBS) ; do \
50  
-		cp $(BUILD)/$(JL_PRIVATE_LIBDIR)/lib$${suffix}.$(SHLIB_EXT) $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
  60
+		cp -a $(BUILD)/lib/lib$${suffix}.* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
51 61
 	done
52 62
 	# Copy system image
53 63
 	cp $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji $(PREFIX)/$(JL_PRIVATE_LIBDIR)
@@ -67,17 +77,11 @@ dist: cleanall
67 77
 #	-$(MAKE) -C deps clean-openblas
68 78
 	$(MAKE) install OPENBLAS_DYNAMIC_ARCH=1
69 79
 ifeq ($(OS), Darwin)
70  
-	-./contrib/fixup-libgfortran.sh $(PREFIX)/$(JL_LIBDIR) /usr/local/lib
  80
+	-./contrib/fixup-libgfortran.sh $(PREFIX)/$(JL_LIBDIR) $(PREFIX)/$(JL_PRIVATE_LIBDIR)
71 81
 endif
72 82
 	tar zcvf julia-$(JULIA_COMMIT)-$(OS)-$(ARCH).tar.gz julia-$(JULIA_COMMIT)
73 83
 	rm -fr julia-$(JULIA_COMMIT)
74 84
 
75  
-deb:
76  
-	fakeroot debian/rules binary
77  
-
78  
-debclean:
79  
-	fakeroot debian/rules clean
80  
-
81 85
 h2j: $(BUILD)/$(JL_LIBDIR)/libLLVM*.a $(BUILD)/$(JL_LIBDIR)/libclang*.a src/h2j.cpp
82 86
 	$(QUIET_CC) g++ -O2 -fno-rtti -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude $^ -o $@
83 87
 
3  README.md
Source Rendered
@@ -29,7 +29,8 @@ This is the GitHub repository of Julia source code, including instructions for c
29 29
 
30 30
 The mailing list for developer discussion is
31 31
 <http://groups.google.com/group/julia-dev/>. All are welcome, but the volume
32  
-of messages is higher, and the discussions tend to be more esoteric.
  32
+of messages is higher, and the discussions tend to be more esoteric. New
  33
+developers may find the notes in [CONTRIBUTING](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md) helpful to start contributing to the julia codebase.
33 34
 
34 35
 <a name="Currently-Supported-Platforms"/>
35 36
 ## Currently Supported Platforms
10  base/abstractarray.jl
@@ -138,6 +138,9 @@ for (f,t) in ((:char,   Char),
138 138
     @eval ($f)(x::AbstractArray) = iround_to(similar(x,$t), x)
139 139
 end
140 140
 
  141
+bool(x::AbstractArray{Bool}) = x
  142
+bool(x::AbstractArray) = copy_to(similar(x,Bool), x)
  143
+
141 144
 for (f,t) in ((:float32,    Float32),
142 145
               (:float64,    Float64),
143 146
               (:complex64,  Complex64),
@@ -230,6 +233,11 @@ end
230 233
 function gen_cartesian_map(cache, genbodies, ranges, exargnames, exargs...)
231 234
     N = length(ranges)
232 235
     if !has(cache,N)
  236
+        if isdefined(genbodies,:code)
  237
+            mod = genbodies.code.module
  238
+        else
  239
+            mod = Main
  240
+        end
233 241
         dimargnames = { symbol(string("_d",i)) for i=1:N }
234 242
         ivars = { symbol(string("_i",i)) for i=1:N }
235 243
         bodies = genbodies(ivars)
@@ -266,7 +274,7 @@ function gen_cartesian_map(cache, genbodies, ranges, exargnames, exargs...)
266 274
             end
267 275
             _F_
268 276
         end
269  
-        f = eval(fexpr)
  277
+        f = eval(mod,fexpr)
270 278
         cache[N] = f
271 279
     else
272 280
         f = cache[N]
2  base/base.jl
@@ -13,6 +13,8 @@ ptr_arg_convert{T}(::Type{Ptr{T}}, x) = convert(T, x)
13 13
 cconvert(T, x) = convert(T, x)
14 14
 # use the code in ccall.cpp to safely allocate temporary pointer arrays
15 15
 cconvert{T}(::Type{Ptr{Ptr{T}}}, a::Array) = a
  16
+# TODO: for some reason this causes a strange type inference problem
  17
+#cconvert(::Type{Ptr{Uint8}}, s::String) = bytestring(s)
16 18
 
17 19
 type ErrorException <: Exception
18 20
     msg::String
43  base/blas.jl
... ...
@@ -1,7 +1,6 @@
1 1
 typealias LapackType Union(Float64,Float32,Complex128,Complex64)
2 2
 
3 3
 module BLAS
4  
-using Base
5 4
 
6 5
 export copy!,
7 6
        scal!,
@@ -24,12 +23,14 @@ export copy!,
24 23
        symv!,
25 24
        symv
26 25
 
  26
+libblas = Base.libblas_name
  27
+
27 28
 # SUBROUTINE DCOPY(N,DX,INCX,DY,INCY)
28 29
 for (fname, elty) in ((:dcopy_,:Float64), (:scopy_,:Float32),
29 30
                       (:zcopy_,:Complex128), (:ccopy_,:Complex64))
30 31
     @eval begin
31 32
         function copy!(n::Integer, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer, DY::Union(Ptr{$elty},Array{$elty}), incy::Integer)
32  
-            ccall(dlsym(Base.libblas, $(string(fname))), Void,
  33
+            ccall(($(string(fname)),libblas), Void,
33 34
                   (Ptr{Int32}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32}),
34 35
                   &n, DX, &incx, DY, &incy)
35 36
             DY
@@ -42,14 +43,14 @@ for (fname, elty) in ((:dscal_,:Float64),    (:sscal_,:Float32),
42 43
                       (:zscal_,:Complex128), (:cscal_,:Complex64))
43 44
     @eval begin
44 45
         function scal!(n::Integer, DA::$elty, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer)
45  
-            ccall(dlsym(Base.libblas, $(string(fname))), Void,
  46
+            ccall(($(string(fname)),libblas), Void,
46 47
                   (Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
47 48
                   &n, &DA, DX, &incx)
48 49
             DX
49 50
         end
50 51
         function scal(n::Integer, DA::$elty, DX_orig::Union(Ptr{$elty},Array{$elty}), incx::Integer)
51 52
             DX = copy(DX_orig)
52  
-            ccall(dlsym(Base.libblas, $(string(fname))), Void,
  53
+            ccall(($(string(fname)),libblas), Void,
53 54
                   (Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
54 55
                   &n, &DA, DX, &incx)
55 56
             DX
@@ -64,7 +65,7 @@ end
64 65
 for (fname, elty) in ((:ddot_,:Float64), (:sdot_,:Float32))
65 66
     @eval begin
66 67
         function dot(n::Integer, DX::Union(Ptr{$elty},Array{$elty}), incx::Integer, DY::Union(Ptr{$elty},Array{$elty}), incy::Integer)
67  
-            ccall(dlsym(Base.libblas, $(string(fname))), $elty,
  68
+            ccall(($(string(fname)),libblas), $elty,
68 69
                   (Ptr{Int32}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32}),
69 70
                   &n, DX, &incx, DY, &incy)
70 71
         end
@@ -78,7 +79,7 @@ for (fname, elty, ret_type) in ((:dnrm2_,:Float64,:Float64),
78 79
                                 (:scnrm2_,:Complex64,:Float32))
79 80
     @eval begin
80 81
         function nrm2(n::Integer, X::Union(Ptr{$elty},Array{$elty}), incx::Integer)
81  
-            ccall(dlsym(Base.libblas, $(string(fname))), $ret_type,
  82
+            ccall(($(string(fname)),libblas), $ret_type,
82 83
                   (Ptr{Int32}, Ptr{$elty}, Ptr{Int32}),
83 84
                   &n, X, &incx)
84 85
         end
@@ -98,7 +99,7 @@ for (fname, elty) in ((:daxpy_,:Float64), (:saxpy_,:Float32),
98 99
         function axpy!(n::Integer, alpha::($elty),
99 100
                        dx::Union(Ptr{$elty},Array{$elty}), incx::Integer,
100 101
                        dy::Union(Ptr{$elty},Array{$elty}), incy::Integer)
101  
-            ccall(dlsym(Base.libblas, $(string(fname))), Void,
  102
+            ccall(($(string(fname)),libblas), Void,
102 103
                   (Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32}),
103 104
                   &n, &alpha, dx, &incx, dy, &incy)
104 105
             return dy
@@ -145,7 +146,7 @@ for (fname, elty) in ((:dsyrk_,:Float64), (:ssyrk_,:Float32),
145 146
            nn = size(A, trans == 'N' ? 1 : 2)
146 147
            if nn != n error("syrk!: dimension mismatch") end
147 148
            k  = size(A, trans == 'N' ? 2 : 1)
148  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  149
+           ccall(($(string(fname)),libblas), Void,
149 150
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty},
150 151
                   Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
151 152
                  &uplo, &trans, &n, &k, &alpha, A, &stride(A,2), &beta, C, &stride(C,2))
@@ -155,7 +156,7 @@ for (fname, elty) in ((:dsyrk_,:Float64), (:ssyrk_,:Float32),
155 156
            n = size(A, trans == 'N' ? 1 : 2)
156 157
            k = size(A, trans == 'N' ? 2 : 1)
157 158
            C = Array($elty, (n, n)) 
158  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  159
+           ccall(($(string(fname)),libblas), Void,
159 160
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty},
160 161
                   Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
161 162
                  &uplo, &trans, &n, &k, &alpha, A, &stride(A,2), &0., C, &stride(C,2))
@@ -181,7 +182,7 @@ for (fname, elty) in ((:zherk_,:Complex128), (:cherk_,:Complex64))
181 182
            nn = size(A, trans == 'N' ? 1 : 2)
182 183
            if nn != n error("syrk!: dimension mismatch") end
183 184
            k  = size(A, trans == 'N' ? 2 : 1)
184  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  185
+           ccall(($(string(fname)),libblas), Void,
185 186
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty},
186 187
                   Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
187 188
                  &uplo, &trans, &n, &k, &alpha, A, &stride(A,2), &beta, C, &stride(C,2))
@@ -191,7 +192,7 @@ for (fname, elty) in ((:zherk_,:Complex128), (:cherk_,:Complex64))
191 192
            n = size(A, trans == 'N' ? 1 : 2)
192 193
            k = size(A, trans == 'N' ? 2 : 1)
193 194
            C = Array($elty, (n, n)) 
194  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  195
+           ccall(($(string(fname)),libblas), Void,
195 196
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty},
196 197
                   Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
197 198
                  &uplo, &trans, &n, &k, &alpha, A, &stride(A,2), &0., C, &stride(C,2))
@@ -215,7 +216,7 @@ for (fname, elty) in ((:dgbmv_,:Float64), (:sgbmv_,:Float32),
215 216
        function gbmv!(trans, m::Integer, kl::Integer, ku::Integer,
216 217
                       alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty},
217 218
                       beta::($elty), y::StridedVector{$elty})
218  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  219
+           ccall(($(string(fname)),libblas), Void,
219 220
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{Int32}, Ptr{Int32},
220 221
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32},
221 222
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
@@ -227,7 +228,7 @@ for (fname, elty) in ((:dgbmv_,:Float64), (:sgbmv_,:Float32),
227 228
                      alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty})
228 229
            n = stride(A,2)
229 230
            y = Array($elty, n)
230  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  231
+           ccall(($(string(fname)),libblas), Void,
231 232
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{Int32}, Ptr{Int32},
232 233
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32},
233 234
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
@@ -254,7 +255,7 @@ for (fname, elty) in ((:dsbmv_,:Float64), (:ssbmv_,:Float32),
254 255
        function sbmv!(uplo, k::Integer,
255 256
                       alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, 
256 257
                       beta::($elty), y::StridedVector{$elty})
257  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  258
+           ccall(($(string(fname)),libblas), Void,
258 259
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32},
259 260
                  Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
260 261
                  &uplo, &size(A,2), &k, &alpha, A, &stride(A,2), x, &stride(x,1), &beta, y, &stride(y,1))
@@ -264,7 +265,7 @@ for (fname, elty) in ((:dsbmv_,:Float64), (:ssbmv_,:Float32),
264 265
                      x::StridedVector{$elty})
265 266
            n = size(A,2)
266 267
            y = Array($elty, n)
267  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  268
+           ccall(($(string(fname)),libblas), Void,
268 269
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32},
269 270
                  Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
270 271
                  &uplo, &size(A,2), &k, &alpha, A, &stride(A,2), x, &stride(x,1), &0., y, &1)
@@ -290,7 +291,7 @@ for (fname, elty) in ((:dgemm_,:Float64), (:sgemm_,:Float32),
290 291
            k = size(A, transA == 'N' ? 2 : 1)
291 292
            n = size(B, transB == 'N' ? 2 : 1)
292 293
            if m != size(C,1) || n != size(C,2) error("gemm!: mismatched dimensions") end
293  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  294
+           ccall(($(string(fname)),libblas), Void,
294 295
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{Int32},
295 296
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32},
296 297
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
@@ -304,7 +305,7 @@ for (fname, elty) in ((:dgemm_,:Float64), (:sgemm_,:Float32),
304 305
            if k != size(B, transB == 'N' ? 1 : 2) error("gemm!: mismatched dimensions") end
305 306
            n = size(B, transB == 'N' ? 2 : 1)
306 307
            C = Array($elty, (m, n))
307  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  308
+           ccall(($(string(fname)),libblas), Void,
308 309
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{Int32},
309 310
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{Int32},
310 311
                   Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
@@ -328,7 +329,7 @@ for (fname, elty) in ((:dgemv_,:Float64), (:sgemv_,:Float32),
328 329
    @eval begin
329 330
        function gemv!(trans, alpha::($elty), A::StridedMatrix{$elty},
330 331
                       X::StridedVector{$elty}, beta::($elty), Y::StridedVector{$elty})
331  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  332
+           ccall(($(string(fname)),libblas), Void,
332 333
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32},
333 334
                   Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
334 335
                  &trans, &size(A,1), &size(A,2), &alpha, A, &stride(A,2),
@@ -337,7 +338,7 @@ for (fname, elty) in ((:dgemv_,:Float64), (:sgemv_,:Float32),
337 338
        end
338 339
        function gemv!(trans, alpha::($elty), A::StridedMatrix{$elty}, X::StridedVector{$elty})
339 340
            Y = Array($elty, size(A,1))
340  
-           ccall(dlsym(Base.libblas, $(string(fname))), Void,
  341
+           ccall(($(string(fname)),libblas), Void,
341 342
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32},
342 343
                   Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
343 344
                  &trans, &size(A,1), &size(A,2), &alpha, A, &stride(A,2),
@@ -376,7 +377,7 @@ for (vfname, mfname, elty) in
376 377
            m, n = size(A)
377 378
            if m != n error("symm!: matrix A is $m by $n but must be square") end
378 379
            if m != length(X) || m != length(Y) error("symm!: dimension mismatch") end
379  
-           ccall(dlsym(Base.libblas, $(string(vfname))), Void,
  380
+           ccall(($(string(vfname)),libblas), Void,
380 381
                  (Ptr{Uint8}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32},
381 382
                  Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
382 383
                  &uplo, &n, &alpha, A, &stride(A,2), X, &stride(X,1), &beta, Y, &stride(Y,1))
@@ -392,7 +393,7 @@ for (vfname, mfname, elty) in
392 393
            k, j = size(A)
393 394
            if k != j error("symm!: matrix A is $k by $j but must be square") end
394 395
            if j != (side == 'L' ? m : n) || size(B,2) != n error("symm!: Dimension mismatch") end
395  
-           ccall(dlsym(Base.libblas, $(string(mfname))), Void,
  396
+           ccall(($(string(mfname)),libblas), Void,
396 397
                  (Ptr{Uint8}, Ptr{Uint8}, Ptr{Int32}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32},
397 398
                  Ptr{$elty}, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}),
398 399
                  &side, &uplo, &m, &n, &alpha, A, &stride(A,2), B, &stride(B,2),
4  base/boot.jl
@@ -129,11 +129,11 @@ export ..., ANY, ASCIIString, AbstractArray, AbstractKind, Any, Array,
129 129
     OverflowError, Ptr, QuoteNode, Real, Signed, StackOverflowError, String,
130 130
     Symbol, SymbolNode, Task, Top, TopNode, Tuple, Type, TypeConstructor,
131 131
     TypeName, TypeVar, UTF8String, Uint, Uint8, Uint16, Uint32, Uint64, Uint128,
132  
-    Undef, UndefRefError, Union, UnionKind, Unsigned, Void,
  132
+    UndefRefError, Union, UnionKind, Unsigned, Void,
133 133
     GetfieldNode,
134 134
     # functions
135 135
     setfield, applicable, apply, apply_type, arraylen, arrayref, arrayset,
136  
-    arraysize, convert_default, convert_tuple, eval, fieldtype, getfield,
  136
+    arraysize, convert_default, convert_tuple, fieldtype, getfield,
137 137
     include, invoke, is, ===, isa, isdefined, method_exists,
138 138
     subtype, throw, tuple, tuplelen, tupleref, typeassert, typeof, yieldto,
139 139
     # constants
37  base/client.jl
@@ -2,7 +2,7 @@
2 2
 ##             and REPL
3 3
 
4 4
 @unix_only _jl_repl = _jl_lib
5  
-@windows_only _jl_repl = ccall(:jl_wrap_raw_dl_handle,Ptr{Void},(Ptr{Void},),ccall(:GetModuleHandleA,stdcall,Ptr{Void},(Ptr{Void},),C_NULL))
  5
+@windows_only _jl_repl = ccall(:GetModuleHandleA,stdcall,Ptr{Void},(Ptr{Void},),C_NULL)
6 6
 
7 7
 const _jl_color_normal = "\033[0m"
8 8
 
@@ -54,8 +54,21 @@ function repl_show(io, v::ANY)
54 54
     end
55 55
 end
56 56
 
  57
+function add_backtrace(e, bt)
  58
+    if isa(e,LoadError)
  59
+        if isa(e.error,LoadError)
  60
+            add_backtrace(e.error,bt)
  61
+        else
  62
+            e.error = BackTrace(e.error, bt)
  63
+            e
  64
+        end
  65
+    else
  66
+        BackTrace(e, bt)
  67
+    end
  68
+end
  69
+
57 70
 function _jl_eval_user_input(ast::ANY, show_value)
58  
-    iserr, lasterr = false, ()
  71
+    iserr, lasterr, bt = false, (), nothing
59 72
     while true
60 73
         try
61 74
             ccall(:jl_register_toplevel_eh, Void, ())
@@ -64,11 +77,11 @@ function _jl_eval_user_input(ast::ANY, show_value)
64 77
                 print(_jl_color_normal)
65 78
             end
66 79
             if iserr
67  
-                show(lasterr)
  80
+                show(add_backtrace(lasterr,bt))
68 81
                 println()
69 82
                 iserr, lasterr = false, ()
70 83
             else
71  
-                value = eval(ast)
  84
+                value = eval(Main,ast)
72 85
                 global ans = value
73 86
                 if !is(value,nothing) && show_value
74 87
                     if _jl_have_color
@@ -82,11 +95,12 @@ function _jl_eval_user_input(ast::ANY, show_value)
82 95
                 end
83 96
             end
84 97
             break
85  
-        catch e
  98
+        catch err
86 99
             if iserr
87 100
                 println("SYSTEM ERROR: show(lasterr) caused an error")
88 101
             end
89  
-            iserr, lasterr = true, e
  102
+            iserr, lasterr = true, err
  103
+            bt = backtrace()
90 104
         end
91 105
     end
92 106
     println()
@@ -169,7 +183,7 @@ function process_options(args::Array{Any,1})
169 183
     repl = true
170 184
     startup = true
171 185
     if has(ENV, "JL_POST_BOOT")
172  
-        eval(parse_input_line(ENV["JL_POST_BOOT"]))
  186
+        eval(Main,parse_input_line(ENV["JL_POST_BOOT"]))
173 187
     end
174 188
     i = 1
175 189
     while i <= length(args)
@@ -183,18 +197,18 @@ function process_options(args::Array{Any,1})
183 197
             repl = false
184 198
             i+=1
185 199
             ARGS = args[i+1:end]
186  
-            eval(parse_input_line(args[i]))
  200
+            eval(Main,parse_input_line(args[i]))
187 201
             break
188 202
         elseif args[i]=="-E"
189 203
             repl = false
190 204
             i+=1
191 205
             ARGS = args[i+1:end]
192  
-            show(eval(parse_input_line(args[i])))
  206
+            show(eval(Main,parse_input_line(args[i])))
193 207
             println()
194 208
             break
195 209
         elseif args[i]=="-P"
196 210
             i+=1
197  
-            eval(parse_input_line(args[i]))
  211
+            eval(Main,parse_input_line(args[i]))
198 212
         elseif args[i]=="-L"
199 213
             i+=1
200 214
             load(args[i])
@@ -251,7 +265,6 @@ function _start()
251 265
     #atexit(()->flush(stdout_stream))
252 266
     try
253 267
         ccall(:jl_register_toplevel_eh, Void, ())
254  
-        #ccall(:jl_start_io_thread, Void, ())
255 268
         global const Workqueue = WorkItem[]
256 269
         global const Waiting = Dict(64)
257 270
 
@@ -295,7 +308,7 @@ function _start()
295 308
             run_repl()
296 309
         end
297 310
     catch e
298  
-        show(e)
  311
+        show(add_backtrace(e,backtrace()))
299 312
         println()
300 313
         exit(1)
301 314
     end
24  base/complex.jl
@@ -277,7 +277,7 @@ function sin(z::Complex)
277 277
     u = exp(imag(z))
278 278
     v = 1/u
279 279
     rz = real(z)
280  
-    u = 0.5(u+v)
  280
+    u = (u+v)/2
281 281
     v = u-v
282 282
     complex(u*sin(rz), v*cos(rz))
283 283
 end
@@ -286,7 +286,7 @@ function cos(z::Complex)
286 286
     u = exp(imag(z))
287 287
     v = 1/u
288 288
     rz = real(z)
289  
-    u = 0.5(u+v)
  289
+    u = (u+v)/2
290 290
     v = u-v
291 291
     complex(u*cos(rz), -v*sin(rz))
292 292
 end
@@ -296,20 +296,20 @@ function log(z::Complex)
296 296
     ai = abs(imag(z))
297 297
     if ar < ai
298 298
         r = ar/ai
299  
-        re = log(ai) + 0.5*log1p(r*r)
  299
+        re = log(ai) + log1p(r*r)/2
300 300
     else
301 301
         if ar == 0
302 302
             re = -inv(ar)
303 303
         else
304 304
             r = ai/ar
305  
-            re = log(ar) + 0.5*log1p(r*r)
  305
+            re = log(ar) + log1p(r*r)/2
306 306
         end
307 307
     end
308 308
     complex(re, atan2(imag(z), real(z)))
309 309
 end
310 310
 
311  
-log10(z::Complex) = log(z)/2.302585092994046
312  
-log2(z::Complex) = log(z)/0.6931471805599453
  311
+log10(z::Complex) = log(z)/oftype(real(z),2.302585092994046)
  312
+log2(z::Complex) = log(z)/oftype(real(z),0.6931471805599453)
313 313
 
314 314
 function exp(z::Complex)
315 315
     er = exp(real(z))
@@ -382,7 +382,7 @@ end
382 382
 function tan(z::Complex)
383 383
     u = exp(imag(z))
384 384
     v = 1/u
385  
-    u = 0.5(u+v)
  385
+    u = (u+v)/2
386 386
     v = u-v
387 387
     sinre = sin(real(z))
388 388
     cosre = cos(real(z))
@@ -415,14 +415,14 @@ function atan(z::Complex)
415 415
     yp1 = 1+imag(z)
416 416
     m1ysq = m1y*m1y
417 417
     yp1sq = yp1*yp1
418  
-    complex(0.5(atan2(real(z),m1y) - atan2(-real(z),yp1)),
419  
-            0.25*log((yp1sq + xsq)/(xsq + m1ysq)))
  418
+    complex((atan2(real(z),m1y) - atan2(-real(z),yp1))/2,
  419
+            log((yp1sq + xsq)/(xsq + m1ysq))/4)
420 420
 end
421 421
 
422 422
 function sinh(z::Complex)
423 423
     u = exp(real(z))
424 424
     v = 1/u
425  
-    u = 0.5(u+v)
  425
+    u = (u+v)/2
426 426
     v = u-v
427 427
     complex(v*cos(imag(z)), u*sin(imag(z)))
428 428
 end
@@ -430,7 +430,7 @@ end
430 430
 function cosh(z::Complex)
431 431
     u = exp(real(z))
432 432
     v = 1/u
433  
-    u = 0.5(u+v)
  433
+    u = (u+v)/2
434 434
     v = u-v
435 435
     complex(u*cos(imag(z)), v*sin(imag(z)))
436 436
 end
@@ -439,7 +439,7 @@ function tanh(z::Complex)
439 439
     cosim = cos(imag(z))
440 440
     u = exp(real(z))
441 441
     v = 1/u
442  
-    u = 0.5(u+v)
  442
+    u = (u+v)/2
443 443
     v = u-v
444 444
     d = cosim*cosim + v*v
445 445
     complex(u*v/d, sin(imag(z))*cosim/d)
31  base/darray2.jl
@@ -170,6 +170,31 @@ function convert{S,T,N}(::Type{Array{S,N}}, s::SubDArray{T,N})
170 170
     a
171 171
 end
172 172
 
  173
+function reshape{T,S<:Array}(A::DArray{T,1,S}, d::Dims)
  174
+    if prod(d) != numel(A)
  175
+        error("reshape: invalid dimensions")
  176
+    end
  177
+    DArray(d) do I
  178
+        sz = map(length,I)
  179
+        d1offs = first(I[1])
  180
+        nd = length(I)
  181
+
  182
+        B = Array(T,sz)
  183
+        nr = size(B,1)
  184
+        sztail = size(B)[2:]
  185
+
  186
+        for i=1:div(numel(B),nr)
  187
+            i2 = ind2sub(sztail, i)
  188
+            globalidx = [ I[j][i2[j-1]] for j=2:nd ]
  189
+            
  190
+            a = sub2ind(d, d1offs, globalidx...)
  191
+            
  192
+            B[:,i] = A[a:(a+nr-1)]
  193
+        end
  194
+        B
  195
+    end
  196
+end
  197
+
173 198
 ## indexing ##
174 199
 
175 200
 function ref(r::RemoteRef, args...)
@@ -214,10 +239,14 @@ function assign(a::Array, s::SubDArray, I::Range1{Int}...)
214 239
     n = length(I)
215 240
     d = s.parent
216 241
     J = s.indexes
  242
+    if length(J) < n
  243
+        a[I...] = convert(Array,s)
  244
+        return a
  245
+    end
217 246
     offs = [isa(J[i],Int) ? J[i]-1 : first(J[i])-1 for i=1:n]
218 247
     @sync begin
219 248
         for i = 1:length(d.chunks)
220  
-            K_c = d.indexes[i]
  249
+            K_c = {d.indexes[i]...}
221 250
             K = [ intersect(J[j],K_c[j]) for j=1:n ]
222 251
             if !anyp(isempty, K)
223 252
                 idxs = [ I[j][K[j]-offs[j]] for j=1:n ]
3  base/dict.jl
@@ -87,6 +87,9 @@ function filter!(f::Function, d::Associative)
87 87
 end
88 88
 filter(f::Function, d::Associative) = filter!(f,copy(d))
89 89
 
  90
+keytype{K,V}(a::Associative{K, V}) = K
  91
+valtype{K,V}(a::Associative{K, V}) = V
  92
+
90 93
 # some support functions
91 94
 
92 95
 function _tablesz(i::Integer)
1  base/dsp.jl
... ...
@@ -1,6 +1,5 @@
1 1
 module DSP
2 2
 
3  
-using Base
4 3
 using Base.FFTW
5 4
 
6 5
 export FFTW, filt, deconv, conv, conv2, xcorr, fftshift, ifftshift,
5  base/error.jl
@@ -9,6 +9,11 @@ macro unexpected()
9 9
     :(error("unexpected branch reached"))
10 10
 end
11 11
 
  12
+rethrow() = ccall(:jl_rethrow, Void, ())
  13
+rethrow(e) = ccall(:jl_rethrow_other, Void, (Any,), e)
  14
+
  15
+backtrace() = ccall(:jl_get_backtrace, Array{Any,1}, ())
  16
+
12 17
 ## system error handling ##
13 18
 
14 19
 errno() = ccall(:jl_errno, Int32, ())
7  base/export.jl
@@ -670,6 +670,8 @@ export
670 670
     eye,
671 671
     factors,
672 672
     ishermitian,
  673
+    isposdef,
  674
+    isposdef!,
673 675
     issym,
674 676
     issym_rnd,
675 677
     istril,
@@ -748,6 +750,7 @@ export
748 750
     isempty,
749 751
     key,
750 752
     keys,
  753
+    keytype,
751 754
     length,
752 755
     setdiff,
753 756
     map,
@@ -765,7 +768,9 @@ export
765 768
     toggle_each,
766 769
     union,
767 770
     union!,
  771
+    unique,
768 772
     values,
  773
+    valtype,
769 774
     xor!,
770 775
     pop,
771 776
     push,
@@ -994,6 +999,8 @@ export
994 999
 # errors
995 1000
     assert,
996 1001
     error,
  1002
+    rethrow,
  1003
+    backtrace,
997 1004
     system_error,
998 1005
     
999 1006
 # types
2  base/expr.jl
@@ -60,5 +60,5 @@ macroexpand(x) = ccall(:jl_macroexpand, Any, (Any,), x)
60 60
 ## misc syntax ##
61 61
 
62 62
 macro eval(x)
63  
-    :(eval($(expr(:quote,x))))
  63
+    :($(esc(:eval))($(expr(:quote,x))))
64 64
 end
61  base/fftw.jl
... ...
@@ -1,12 +1,13 @@
1 1
 module FFTW
2 2
 
3  
-using Base
4  
-
5 3
 export bfft, bfftn, brfft, brfftn, fft, fft2, fft3, fftn,
6 4
        ifft, ifft2, ifft3, ifftn, irfft, irfftn, rfft, rfftn
7 5
 
8 6
 ## FFT: Implement fft by calling fftw.
9 7
 
  8
+const libfftw = "libfftw3_threads"
  9
+const libfftwf = "libfftw3f_threads"
  10
+
10 11
 ## Direction of FFT
11 12
 
12 13
 const FORWARD = int32(-1)
@@ -42,7 +43,7 @@ const RODFT11 = int32(10)
42 43
 # Wisdom
43 44
 
44 45
 function import_64bit_wisdom(filename::String)
45  
-    stat = ccall(dlsym(Base.libfftw,:fftw_import_wisdom_from_filename),
  46
+    stat = ccall((:fftw_import_wisdom_from_filename,libfftw),
46 47
         Int32, (Ptr{Uint8},), bytestring(filename))
47 48
     if stat == 0
48 49
         error("failed to import wisdom from $filename")
@@ -50,7 +51,7 @@ function import_64bit_wisdom(filename::String)
50 51
 end
51 52
 
52 53
 function import_32bit_wisdom(filename::String)
53  
-    stat = ccall(dlsym(Base.libfftwf,:fftwf_import_wisdom_from_filename),
  54
+    stat = ccall((:fftwf_import_wisdom_from_filename,libfftwf),
54 55
         Int32, (Ptr{Uint8},), bytestring(filename))
55 56
     if stat == 0
56 57
         error("failed to import wisdom from $filename")
@@ -58,8 +59,8 @@ function import_32bit_wisdom(filename::String)
58 59
 end
59 60
 
60 61
 function forget_wisdom()
61  
-    ccall(dlsym(Base.libfftw,:fftw_forget_wisdom), Void, ())
62  
-    ccall(dlsym(Base.libfftwf,:fftwf_forget_wisdom), Void, ())
  62
+    ccall((:fftw_forget_wisdom,libfftw), Void, ())
  63
+    ccall((:fftwf_forget_wisdom,libfftwf), Void, ())
63 64
 end
64 65
 
65 66
 # Threads
@@ -68,54 +69,54 @@ let initialized = false
68 69
     global num_threads
69 70
     function num_threads(nthreads::Integer)
70 71
         if !initialized
71  
-            stat = ccall(dlsym(Base.libfftw,:fftw_init_threads), Int32, ())
72  
-            statf = ccall(dlsym(Base.libfftwf,:fftwf_init_threads), Int32, ())
  72
+            stat = ccall((:fftw_init_threads,libfftw), Int32, ())
  73
+            statf = ccall((:fftwf_init_threads,libfftwf), Int32, ())
73 74
             if stat == 0 || statf == 0
74 75
                 error("could not initialize fft threads")
75 76
             end
76 77
             initialized = true
77 78
         end
78  
-        ccall(dlsym(Base.libfftw,:fftw_plan_with_nthreads), Void, (Int32,), nthreads)
79  
-        ccall(dlsym(Base.libfftwf,:fftwf_plan_with_nthreads), Void, (Int32,), nthreads)
  79
+        ccall((:fftw_plan_with_nthreads,libfftw), Void, (Int32,), nthreads)
  80
+        ccall((:fftwf_plan_with_nthreads,libfftwf), Void, (Int32,), nthreads)
80 81
     end
81 82
 end
82 83
 
83 84
 # Execute
84 85
 
85 86
 execute(precision::Union(Type{Float64}, Type{Complex128}), plan) =
86  
-    ccall(dlsym(Base.libfftw, :fftw_execute), Void, (Ptr{Void},), plan)
  87
+    ccall((:fftw_execute,libfftw), Void, (Ptr{Void},), plan)
87 88
 
88 89
 execute(precision::Union(Type{Float32}, Type{Complex64}), plan) =
89  
-    ccall(dlsym(Base.libfftwf, :fftwf_execute), Void, (Ptr{Void},), plan)
  90
+    ccall((:fftwf_execute,libfftwf), Void, (Ptr{Void},), plan)
90 91
 
91 92
 # Destroy plan
92 93
 
93 94
 destroy_plan(precision::Union(Type{Float64}, Type{Complex128}), plan) =
94  
-    ccall(dlsym(Base.libfftw, :fftw_destroy_plan), Void, (Ptr{Void},), plan)
  95
+    ccall((:fftw_destroy_plan,libfftw), Void, (Ptr{Void},), plan)
95 96
 
96 97
 destroy_plan(precision::Union(Type{Float32}, Type{Complex64}), plan) =
97  
-    ccall(dlsym(Base.libfftwf, :fftwf_destroy_plan), Void, (Ptr{Void},), plan)
  98
+    ccall((:fftwf_destroy_plan,libfftwf), Void, (Ptr{Void},), plan)
98 99
 
99 100
 # Create nd plan
100 101
 
101 102
 for (libname, fname_complex, fname_r2c, fname_c2r, T_in, T_out) in
102  
-    ((:(Base.libfftw),"fftw_plan_dft","fftw_plan_dft_r2c","fftw_plan_dft_c2r",:Float64,:Complex128),
103  
-     (:(Base.libfftwf),"fftwf_plan_dft","fftwf_plan_dft_r2c","fftwf_plan_dft_c2r",:Float32,:Complex64))
  103
+    ((:libfftw,"fftw_plan_dft","fftw_plan_dft_r2c","fftw_plan_dft_c2r",:Float64,:Complex128),
  104
+     (:libfftwf,"fftwf_plan_dft","fftwf_plan_dft_r2c","fftwf_plan_dft_c2r",:Float32,:Complex64))
104 105
     @eval begin
105 106
         function plan_dft(X::Array{$T_out}, Y::Array{$T_out}, direction::Integer)
106  
-            ccall(dlsym($libname, $fname_complex),
  107
+            ccall(($fname_complex,$libname),
107 108
                   Ptr{Void},
108 109
                   (Int32, Ptr{Int32}, Ptr{$T_out}, Ptr{$T_out}, Int32, Uint32, ),
109 110
                   ndims(X), int32(reverse([size(X)...])), X, Y, direction, ESTIMATE)
110 111
         end
111 112
         function plan_dft(X::Array{$T_in}, Y::Array{$T_out})
112  
-            ccall(dlsym($libname, $fname_r2c),
  113
+            ccall(($fname_r2c,$libname),
113 114
                   Ptr{Void},
114 115
                   (Int32, Ptr{Int32}, Ptr{$T_in}, Ptr{$T_out}, Uint32, ),
115 116
                   ndims(X), int32(reverse([size(X)...])), X, Y, ESTIMATE)
116 117
         end
117 118
         function plan_dft(X::Array{$T_out}, Y::Array{$T_in})
118  
-            ccall(dlsym($libname, $fname_c2r),
  119
+            ccall(($fname_c2r,$libname),
119 120
                   Ptr{Void},
120 121
                   (Int32, Ptr{Int32}, Ptr{$T_out}, Ptr{$T_in}, Uint32),
121 122
                   ndims(Y), int32(reverse([size(Y)...])), X, Y, ESTIMATE)
@@ -126,12 +127,12 @@ end
126 127
 # Guru plans
127 128
 
128 129
 for (libname, fname_complex, fname_r2c, fname_c2r, T_in, T_out) in
129  
-    ((:(Base.libfftw),"fftw_plan_guru64_dft","fftw_plan_guru64_dft_r2c","fftw_plan_guru64_dft_c2r",:Float64,:Complex128),
130  
-     (:(Base.libfftwf),"fftwf_plan_guru64_dft","fftwf_plan_guru64_dft_r2c","fftwf_plan_guru64_dft_c2r",:Float32,:Complex64))
  130
+    ((:libfftw,"fftw_plan_guru64_dft","fftw_plan_guru64_dft_r2c","fftw_plan_guru64_dft_c2r",:Float64,:Complex128),
  131
+     (:libfftwf,"fftwf_plan_guru64_dft","fftwf_plan_guru64_dft_r2c","fftwf_plan_guru64_dft_c2r",:Float32,:Complex64))
131 132
     @eval begin
132 133
         function plan_guru_dft(dims::Array{Int,2}, howmany::Array{Int,2},
133 134
             X::Array{$T_out}, Y::Array{$T_out}, direction::Int32)
134  
-            ccall(dlsym($libname, $fname_complex),
  135
+            ccall(($fname_complex,$libname),
135 136
                   Ptr{Void},
136 137
                   (Int32, Ptr{Int}, Int32, Ptr{Int},
137 138
                    Ptr{$T_out}, Ptr{$T_out}, Int32, Uint32),
@@ -140,7 +141,7 @@ for (libname, fname_complex, fname_r2c, fname_c2r, T_in, T_out) in
140 141
         end
141 142
         function plan_guru_dft(dims::Array{Int,2}, howmany::Array{Int,2},
142 143
             X::Array{$T_in}, Y::Array{$T_out})
143  
-            ccall(dlsym($libname, $fname_r2c),
  144
+            ccall(($fname_r2c,$libname),
144 145
                   Ptr{Void},
145 146
                   (Int32, Ptr{Int}, Int32, Ptr{Int},
146 147
                    Ptr{$T_in}, Ptr{$T_out}, Uint32),
@@ -149,7 +150,7 @@ for (libname, fname_complex, fname_r2c, fname_c2r, T_in, T_out) in
149 150
         end
150 151
         function plan_guru_dft(dims::Array{Int,2}, howmany::Array{Int,2},
151 152
             X::Array{$T_out}, Y::Array{$T_in})
152  
-            ccall(dlsym($libname, $fname_c2r),
  153
+            ccall(($fname_c2r,$libname),
153 154
                   Ptr{Void},
154 155
                   (Int32, Ptr{Int}, Int32, Ptr{Int},
155 156
                    Ptr{$T_out}, Ptr{$T_in}, Uint32),
@@ -303,13 +304,13 @@ irfftn(X,d) = (Y=brfftn(X,d); Y./length(Y))
303 304
 # NOTE: Using MEASURE and PATIENT zeros out the input the 
304 305
 # first time it is used for a particular size. Use ESTIMATE
305 306
 
306  
-for (libname, fname, elty) in ((:(Base.libfftw) ,"fftw_plan_guru_r2r",:Float64),
307  
-                               (:(Base.libfftwf),"fftwf_plan_guru_r2r",:Float32))
  307
+for (libname, fname, elty) in ((:libfftw ,"fftw_plan_guru_r2r",:Float64),
  308
+                               (:libfftwf,"fftwf_plan_guru_r2r",:Float32))
308 309
     @eval begin
309 310
         function transpose(X::Matrix{$elty})
310 311
             P = similar(X)
311 312
             (n1, n2) = size(X)
312  
-            plan = ccall(dlsym($libname, $fname), Ptr{Void},
  313
+            plan = ccall(($fname,$libname), Ptr{Void},
313 314
                          (Int32, Ptr{Int32}, Int32, Ptr{Int32}, Ptr{$elty}, Ptr{$elty}, Ptr{Int32}, Uint32),
314 315
                          0, C_NULL, 2, int32([n1,n2,1,n2,1,n1]), X, P, [HC2R], ESTIMATE | PRESERVE_INPUT)
315 316
             execute($elty, plan)
@@ -319,13 +320,13 @@ for (libname, fname, elty) in ((:(Base.libfftw) ,"fftw_plan_guru_r2r",:Float64),
319 320
     end
320 321
 end
321 322
 
322  
-for (libname, fname, celty) in ((:(Base.libfftw) ,"fftw_plan_guru_dft",:Complex128),
323  
-                                (:(Base.libfftwf),"fftwf_plan_guru_dft",:Complex64))
  323
+for (libname, fname, celty) in ((:libfftw ,"fftw_plan_guru_dft",:Complex128),
  324
+                                (:libfftwf,"fftwf_plan_guru_dft",:Complex64))
324 325
     @eval begin
325 326
         function transpose(X::Matrix{$celty})
326 327
             P = similar(X)
327 328
             (n1, n2) = size(X)
328  
-            plan = ccall(dlsym($libname, $fname), Ptr{Void},
  329
+            plan = ccall(($fname,$libname), Ptr{Void},
329 330
                          (Int32, Ptr{Int32}, Int32, Ptr{Int32}, Ptr{$celty}, Ptr{$celty}, Int32, Uint32),
330 331
                          0, C_NULL, 2, int32([n1,n2,1,n2,1,n1]), X, P, FORWARD, ESTIMATE | PRESERVE_INPUT)
331 332
             execute($celty, plan)
7  base/file.jl
@@ -203,12 +203,9 @@ function cd(f::Function, dir::String)
203 203
     system_error("open", fd == -1)
204 204
     try
205 205
         cd(dir)
206  
-        retval = f()
  206
+        f()
  207
+    finally
207 208
         system_error("fchdir", ccall(:fchdir,Int32,(Int32,),fd) != 0)
208  
-        retval
209  
-    catch err
210  
-        system_error("fchdir", ccall(:fchdir,Int32,(Int32,),fd) != 0)
211  
-        throw(err)
212 209
     end
213 210
 end
214 211
 end
23  base/float.jl
@@ -70,7 +70,7 @@ iround(::Type{Uint64}, x::Float64) = box(Uint64,fpuiround64(unbox(Float64,x)))
70 70
 # TODO: Int128
71 71
 
72 72
 # this is needed very early because it is used by Range and colon
73  
-floor(x::Float64) = ccall(dlsym(libopenlibm,:floor), Float64, (Float64,), x)
  73
+floor(x::Float64) = ccall((:floor,:libopenlibm), Float64, (Float64,), x)
74 74
 
75 75
 iceil(x::FloatingPoint)  = itrunc(ceil(x))  # TODO: fast primitive for iceil
76 76
 ifloor(x::FloatingPoint) = itrunc(floor(x)) # TOOD: fast primitive for ifloor
@@ -81,23 +81,23 @@ promote_rule(::Type{Float64}, ::Type{Float32}) = Float64
81 81
 
82 82
 promote_rule(::Type{Float32}, ::Type{Int8} ) = Float32
83 83
 promote_rule(::Type{Float32}, ::Type{Int16}) = Float32
84  
-promote_rule(::Type{Float32}, ::Type{Int32}) = Float64
85  
-promote_rule(::Type{Float32}, ::Type{Int64}) = Float64 # TODO: should be Float80
  84
+promote_rule(::Type{Float32}, ::Type{Int32}) = Float32
  85
+promote_rule(::Type{Float32}, ::Type{Int64}) = Float32
86 86
 
87 87
 promote_rule(::Type{Float64}, ::Type{Int8} ) = Float64
88 88
 promote_rule(::Type{Float64}, ::Type{Int16}) = Float64
89 89
 promote_rule(::Type{Float64}, ::Type{Int32}) = Float64
90  
-promote_rule(::Type{Float64}, ::Type{Int64}) = Float64 # TODO: should be Float80
  90
+promote_rule(::Type{Float64}, ::Type{Int64}) = Float64
91 91
 
92 92
 promote_rule(::Type{Float32}, ::Type{Uint8} ) = Float32
93 93
 promote_rule(::Type{Float32}, ::Type{Uint16}) = Float32
94  
-promote_rule(::Type{Float32}, ::Type{Uint32}) = Float64
95  
-promote_rule(::Type{Float32}, ::Type{Uint64}) = Float64 # TODO: should be Float80
  94
+promote_rule(::Type{Float32}, ::Type{Uint32}) = Float32
  95
+promote_rule(::Type{Float32}, ::Type{Uint64}) = Float32
96 96
 
97 97
 promote_rule(::Type{Float64}, ::Type{Uint8} ) = Float64
98 98
 promote_rule(::Type{Float64}, ::Type{Uint16}) = Float64
99 99
 promote_rule(::Type{Float64}, ::Type{Uint32}) = Float64
100  
-promote_rule(::Type{Float64}, ::Type{Uint64}) = Float64 # TODO: should be Float80
  100
+promote_rule(::Type{Float64}, ::Type{Uint64}) = Float64
101 101
 
102 102
 promote_rule(::Type{Float32}, ::Type{Char}) = Float32
103 103
 promote_rule(::Type{Float64}, ::Type{Char}) = Float64
@@ -175,6 +175,15 @@ isless (a::FloatingPoint, b::Integer) = (a<b) | isless(a,float(b))
175 175
 <=(x::Int64  , y::Float32) = lesif64(unbox(Int64,x),unbox(Float64,float64(y)))
176 176
 <=(x::Uint64 , y::Float32) = leuif64(unbox(Uint64,x),unbox(Float64,float64(y)))
177 177
 
  178
+==(x::Float32, y::Union(Int32,Int64,Uint32,Uint64)) = float64(x)==float64(y)
  179
+==(x::Union(Int32,Int64,Uint32,Uint64), y::Float32) = float64(x)==float64(y)
  180
+
  181
+<(x::Float32, y::Union(Int32,Int64,Uint32,Uint64)) = float64(x)<float64(y)
  182
+<(x::Union(Int32,Int64,Uint32,Uint64), y::Float32) = float64(x)<float64(y)
  183
+
  184
+<=(x::Float32, y::Union(Int32,Int64,Uint32,Uint64)) = float64(x)<=float64(y)
  185
+<=(x::Union(Int32,Int64,Uint32,Uint64), y::Float32) = float64(x)<=float64(y)
  186
+
178 187
 ## floating point traits ##
179 188
 
180 189
 const Inf32 = box(Float32,unbox(Uint32,0x7f800000))
5  base/floatfuncs.jl
@@ -68,7 +68,6 @@ function _signif_og(x, digits, base)
68 68
         float(base) ^ floor(log2(abs(x))/log2(base) - digits + 1.)
69 69
     end
70 70
 end
71  
-_round_og(digits, base) = float(base) ^ (- digits)
72 71
 
73 72
 function signif(x, digits::Integer, base::Integer)
74 73
     if digits < 0
@@ -79,11 +78,13 @@ function signif(x, digits::Integer, base::Integer)
79 78
 end
80 79
 signif(x, digits) = signif(x, digits, 10)
81 80
 
  81
+_round_og(digits, base) = float(base) ^ digits
  82
+
82 83
 for f in (:round, :ceil, :floor, :trunc)
83 84
     @eval begin
84 85
         function ($f)(x, digits::Integer, base::Integer)
85 86
             og = _round_og(digits, base)
86  
-            ($f)(float(x) / og) * og
  87
+            ($f)(float(x) * og) / og
87 88
         end
88 89
         ($f)(x, digits) = ($f)(x, digits, 10)
89 90
     end
2  base/git.jl
@@ -3,8 +3,6 @@ module Git
3 3
 # some utility functions for working with git repos
4 4
 #
5 5
 
6  
-using Base
7  
-
8 6
 dir() = readchomp(`git rev-parse --git-dir`)
9 7
 modules(args::Cmd) = readchomp(`git config -f .gitmodules $args`)
10 8
 different(verA::String, verB::String, path::String) =
5  base/grisu.jl
... ...
@@ -1,7 +1,4 @@
1  
-libgrisu = dlopen("libgrisu")
2  
-
3 1
 module Grisu
4  
-using Base
5 2
 export print_shortest
6 3
 export @grisu_ccall, NEG, DIGITS, BUFLEN, LEN, POINT
7 4
 
@@ -15,7 +12,7 @@ const POINT  = Array(Int32,1)
15 12
 
16 13
 macro grisu_ccall(value, mode, ndigits)
17 14
     quote