@@ -6,19 +6,10 @@ using Core.Intrinsics, Core.IR
6
6
7
7
# to start, we're going to use a very simple definition of `include`
8
8
# that doesn't require any function (except what we can get from the `Core` top-module)
9
- # start this big so that we don't have to resize before we have defined how to grow an array
10
- const _included_files = Array {Tuple{Module,String},1} (Core. undef, 400 )
11
- setfield! (_included_files, :size , (1 ,))
9
+ const _included_files = Array {Tuple{Module,String},1} (Core. undef, 1 )
12
10
function include (mod:: Module , path:: String )
13
- len = getfield (_included_files. size, 1 )
14
- memlen = _included_files. ref. mem. length
15
- lenp1 = Core. add_int (len, 1 )
16
- if len === memlen # by the time this is true we hopefully will have defined _growend!
17
- _growend! (_included_files, UInt (1 ))
18
- else
19
- setfield! (_included_files, :size , (lenp1,))
20
- end
21
- Core. memoryrefset! (Core. memoryref (_included_files. ref, lenp1), (mod, ccall (:jl_prepend_cwd , Any, (Any,), path)), :not_atomic , true )
11
+ ccall (:jl_array_grow_end , Cvoid, (Any, UInt), _included_files, UInt (1 ))
12
+ Core. arrayset (true , _included_files, (mod, ccall (:jl_prepend_cwd , Any, (Any,), path)), arraylen (_included_files))
22
13
Core. println (path)
23
14
ccall (:jl_uv_flush , Nothing, (Ptr{Nothing},), Core. io_pointer (Core. stdout ))
24
15
Core. include (mod, path)
@@ -40,7 +31,6 @@ macro noinline() Expr(:meta, :noinline) end
40
31
getproperty (x:: Module , f:: Symbol ) = (@inline ; getglobal (x, f))
41
32
getproperty (x:: Type , f:: Symbol ) = (@inline ; getfield (x, f))
42
33
setproperty! (x:: Type , f:: Symbol , v) = error (" setfield! fields of Types should not be changed" )
43
- setproperty! (x:: Array , f:: Symbol , v) = error (" setfield! fields of Array should not be changed" )
44
34
getproperty (x:: Tuple , f:: Int ) = (@inline ; getfield (x, f))
45
35
setproperty! (x:: Tuple , f:: Int , v) = setfield! (x, f, v) # to get a decent error
46
36
@@ -202,22 +192,23 @@ include("strings/lazy.jl")
202
192
203
193
# array structures
204
194
include (" indices.jl" )
205
- include (" genericmemory.jl" )
206
195
include (" array.jl" )
207
196
include (" abstractarray.jl" )
208
197
include (" subarray.jl" )
209
198
include (" views.jl" )
210
199
include (" baseext.jl" )
211
200
212
- include (" c.jl" )
213
201
include (" ntuple.jl" )
202
+
214
203
include (" abstractdict.jl" )
215
204
include (" iddict.jl" )
216
205
include (" idset.jl" )
206
+
217
207
include (" iterators.jl" )
218
208
using . Iterators: zip, enumerate, only
219
209
using . Iterators: Flatten, Filter, product # for generators
220
210
using . Iterators: Stateful # compat (was formerly used in reinterpretarray.jl)
211
+
221
212
include (" namedtuple.jl" )
222
213
223
214
# For OS specific stuff
@@ -233,17 +224,6 @@ function strcat(x::String, y::String)
233
224
end
234
225
include (strcat ((length (Core. ARGS )>= 2 ? Core. ARGS [2 ] : " " ), " build_h.jl" )) # include($BUILDROOT/base/build_h.jl)
235
226
include (strcat ((length (Core. ARGS )>= 2 ? Core. ARGS [2 ] : " " ), " version_git.jl" )) # include($BUILDROOT/base/version_git.jl)
236
- # Initialize DL_LOAD_PATH as early as possible. We are defining things here in
237
- # a slightly more verbose fashion than usual, because we're running so early.
238
- const DL_LOAD_PATH = String[]
239
- let os = ccall (:jl_get_UNAME , Any, ())
240
- if os === :Darwin || os === :Apple
241
- if Base. DARWIN_FRAMEWORK
242
- push! (DL_LOAD_PATH, " @loader_path/Frameworks" )
243
- end
244
- push! (DL_LOAD_PATH, " @loader_path" )
245
- end
246
- end
247
227
248
228
# numeric operations
249
229
include (" hashing.jl" )
@@ -291,24 +271,24 @@ include("set.jl")
291
271
292
272
# Strings
293
273
include (" char.jl" )
294
- function array_new_memory (mem:: Memory{UInt8} , newlen:: Int )
295
- # add an optimization to array_new_memory for StringVector
296
- if (@assume_effects :total @ccall jl_genericmemory_owner (mem:: Any ,):: Any ) isa String
297
- # If data is in a String, keep it that way.
298
- # When implemented, this could use jl_gc_expand_string(oldstr, newlen) as an optimization
299
- str = _string_n (newlen)
300
- return (@assume_effects :total ! : consistent @ccall jl_string_to_genericmemory (str:: Any ,):: Memory{UInt8} )
301
- else
302
- # TODO : when implemented, this should use a memory growing call
303
- return typeof (mem)(undef, newlen)
304
- end
305
- end
306
274
include (" strings/basic.jl" )
307
275
include (" strings/string.jl" )
308
276
include (" strings/substring.jl" )
309
- include (" strings/cstring.jl" )
277
+
278
+ # Initialize DL_LOAD_PATH as early as possible. We are defining things here in
279
+ # a slightly more verbose fashion than usual, because we're running so early.
280
+ const DL_LOAD_PATH = String[]
281
+ let os = ccall (:jl_get_UNAME , Any, ())
282
+ if os === :Darwin || os === :Apple
283
+ if Base. DARWIN_FRAMEWORK
284
+ push! (DL_LOAD_PATH, " @loader_path/Frameworks" )
285
+ end
286
+ push! (DL_LOAD_PATH, " @loader_path" )
287
+ end
288
+ end
310
289
311
290
include (" osutils.jl" )
291
+ include (" c.jl" )
312
292
313
293
# Core I/O
314
294
include (" io.jl" )
0 commit comments