File: Engine.cpp

package info (click to toggle)
storm-lang 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,004 kB
  • sloc: ansic: 261,462; cpp: 140,405; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (733 lines) | stat: -rw-r--r-- 18,394 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
#include "stdafx.h"
#include "Engine.h"
#include "Init.h"
#include "Type.h"
#include "Package.h"
#include "Code.h"
#include "Function.h"
#include "Core/Hash.h"
#include "Core/Thread.h"
#include "Core/Str.h"
#include "Core/Map.h"
#include "Core/Set.h"
#include "Core/StrBuf.h"
#include "Core/Handle.h"
#include "Core/Io/Utf8Text.h"
#include "Core/Convert.h"
#include "Core/Variant.h"
#include "Lib/Enum.h"
#include "Lib/Fn.h"
#include "Lib/Maybe.h"
#include "Lib/Join.h"
#include "Syntax/Node.h"
#include "Utils/Memory.h"
#include "Utils/StackInfoSet.h"
#include "StdIoThread.h"
#include "Visibility.h"
#include "Exception.h"
#include "SystemException.h"
#include "OS/StackTrace.h"
#include "BuiltInSource.h"

// Only included from here:
#include "OS/SharedMaster.h"

namespace storm {

	static THREAD Engine *currentEngine;
	namespace runtime {
		Engine *someEngineUnsafe() {
			return currentEngine;
		}
	}

	// Default arena size. 256 MB should be enough for a while at least.
	static const size_t defaultArena = 256 * 1024 * 1024;

	// Default finalizer interval.
	static const nat defaultFinalizer = 1000;

	// Get the compiler thread from flags.
	static os::Thread mainThread(Engine::ThreadMode mode, Engine &e) {
		switch (mode) {
		case Engine::newMain:
			return os::Thread::spawn(util::Fn<void>(), e.threadGroup);
		case Engine::reuseMain:
			os::Thread::initThread(); // TODO: Call cleanThread as well..
			e.attachThread();
			currentEngine = &e;
			return os::Thread::current();
		default:
			assert(false, L"Unknown thread mode.");
			WARNING(L"Unknown thread mode, defaulting to 'current'.");
			return os::Thread::current();
		}
	}

	void Engine::attachThread() {
		gc.attachThread();
		currentEngine = this;
	}

	void Engine::detachThread() {
		gc.detachThread(os::Thread::current());
		currentEngine = null;
	}

	vector<os::Thread> Engine::allThreads() {
		vector<os::Thread> threads = threadGroup.threads();

		os::Thread compiler = world.threads[0]->thread();
		if (std::find(threads.begin(), threads.end(), compiler) == threads.end())
			threads.insert(threads.begin(), compiler);

		return threads;
	}

	// Starts at -1 so that the first Engine will get id=0.
	static Nat engineId = -1;

	template <class T>
	struct ValFlags {
		static const nat pod = std::is_pod<T>::value ? typeCppPOD : typeNone;
		static const nat simple =
			(std::is_trivially_copy_constructible<T>::value & std::is_trivially_destructible<T>::value)
			? typeCppSimple : typeNone;

	public:
		static const TypeFlags v = TypeFlags(typeValue | pod | simple);
	};

	static Url *defaultCreateRoot(Engine &e, void *root) {
		return parsePathAsDir(e, (const wchar *)root);
	}

	Engine::Engine(const wchar *root, ThreadMode mode, void *stackBase) :
		id(atomicIncrement(engineId)),
		gc(defaultArena, defaultFinalizer),
		threadGroup(util::memberVoidFn(this, &Engine::attachThread), util::memberVoidFn(this, &Engine::detachThread)),
		world(gc),
		objRoot(null),
		ioThread(null),
		stackInfo(gc) {

		create(&defaultCreateRoot, (void *)root, mode, stackBase);
	}

	Engine::Engine(CreateRootUrl callback, void *param, ThreadMode mode, void *stackBase) :
		id(atomicIncrement(engineId)),
		gc(defaultArena, defaultFinalizer),
		threadGroup(util::memberVoidFn(this, &Engine::attachThread), util::memberVoidFn(this, &Engine::detachThread)),
		world(gc),
		objRoot(null),
		ioThread(null),
		stackInfo(gc) {

		create(callback, param, mode, stackBase);
	}

	void Engine::create(CreateRootUrl createRoot, void *createParam, ThreadMode mode, void *stackBase) {
		// Handle system errors.
		setupSystemExceptions();

		bootStatus = bootNone;

		stackId = ::stackInfo().attach(stackInfo);

		// Tell the thread system about the 'stackBase' we received.
		os::Thread::setStackBase(stackBase);

		// Initialize the roots we need.
		memset(&o, 0, sizeof(GcRoot));
		objRoot = gc.createRoot(&o, sizeof(GcRoot) / sizeof(void *));

		assert(Compiler::identifier == 0, L"Invalid ID for the compiler thread. Check CppTypes for errors!");

		try {
			// Since all types in the name tree need the Compiler thread, we need to create that a bit early.
			world.threads.resize(1);
			{
				os::Thread t = mainThread(mode, *this);
				// Ensure 'mainThread' is executed before operator new.
				world.threads[0] = new (Thread::First(*this)) Thread(t);
			}

			// Initialize the type system. This loads all types defined in the compiler.
			initTypes(*this, world);

			// Now, we can give the Compiler thread object a proper header with a type. Until this
			// point, doing as<> on that object will crash the system. However, that is not neccessary
			// this early during compiler startup.
			Thread::stormType(*this)->setType(world.threads[0]);

			// Set proper paths for the now created packages.
			Url *rootUrl = (*createRoot)(*this, createParam);
			o.root->setUrl(rootUrl->updated());

			// Done booting.
			advance(bootDone);
		} catch (...) {
			destroy();
			throw;
		}
	}

	Engine::~Engine() {
		// Do not place anything directly here, we need the cleanup when creation fails.
		destroy();
	}

	void Engine::destroy() {
		advance(bootShutdown);
		libs.shutdown();

		// Perform a GC now, to execute as many finalizers as possible now. We might actually need
		// to compile some destructors during shutdown...
		gc.collect();

		advance(bootLateShutdown);
		// We need to remove the root this array implies before the Gc is destroyed.
		world.clear();

		Gc::destroyRoot(objRoot);
		delete ioThread;
		// volatile Engine *volatile me = this;

		::stackInfo().detach(stackId);
		stackInfo.clear();

		gc.destroy();
		libs.unload();
		threadGroup.join();

		// TODO: Execute the sanity check in the UThreadData destructor now. Otherwise we might do
		// it at a point where we can not do cout properly.
	}

	Type *Engine::cppType(Nat id) const {
		return world.types[id];
	}

	TemplateList *Engine::cppTemplate(Nat id) const {
		if (id >= world.templates.count())
			return null;
		return world.templates[id];
	}

	Thread *Engine::cppThread(Nat id) const {
		return world.threads[id];
	}

	void Engine::forNamed(NamedFn fn) {
		world.forNamed(fn);

		// TODO: Do more packages need this?
		package()->lateInit();
	}

	/**
	 * Helpers for the pointer handle.
	 */

	static void tObjToS(const void *obj, StrBuf *to) {
		const TObject *o = *(const TObject **)obj;
		*to << o;
	}

	static Nat tObjHash(const void *obj) {
		const void *ptr = *(const void **)obj;
		return ptrHash(ptr);
	}

	static Bool tObjEqual(const void *a, const void *b) {
		const void *aa = *(const void **)a;
		const void *bb = *(const void **)b;
		return aa == bb;
	}

	const Handle &Engine::tObjHandle() {
		if (!o.tObjHandle) {
			o.tObjHandle = new (*this) Handle();
			o.tObjHandle->size = sizeof(void *);
			o.tObjHandle->locationHash = true;
			o.tObjHandle->gcArrayType = &pointerArrayType;
			o.tObjHandle->copyFn = null; // No special function, use memcpy.
			o.tObjHandle->deepCopyFn = null; // No need for deepCopy.
			o.tObjHandle->toSFn = &tObjToS;
			o.tObjHandle->hashFn = &tObjHash;
			o.tObjHandle->equalFn = &tObjEqual;
		}
		return *o.tObjHandle;
	}

	static void objDeepCopy(void *obj, CloneEnv *env) {
		Object *&o = *(Object **)obj;
		cloned(o, env);
	}

	static void objToS(const void *obj, StrBuf *to) {
		const Object *o = *(const Object **)obj;
		*to << o;
	}

	static Nat objHash(const void *obj) {
		const void *ptr = *(const void **)obj;
		return ptrHash(ptr);
	}

	static Bool objEqual(const void *a, const void *b) {
		const void *aa = *(const void **)a;
		const void *bb = *(const void **)b;
		return aa == bb;
	}

	const Handle &Engine::refObjHandle() {
		if (!o.refObjHandle) {
			o.refObjHandle = new (*this) Handle();
			o.refObjHandle->size = sizeof(void *);
			o.refObjHandle->locationHash = true;
			o.refObjHandle->gcArrayType = &pointerArrayType;
			o.refObjHandle->copyFn = null;
			o.refObjHandle->deepCopyFn = &objDeepCopy;
			o.refObjHandle->toSFn = &objToS;
			o.refObjHandle->hashFn = &objHash;
			o.refObjHandle->equalFn = &objEqual;
		}
		return *o.refObjHandle;
	}

	void Engine::advance(BootStatus to) {
		assert(to >= bootStatus, L"Trying to devolve the boot status.");
		bootStatus = to;
	}

	ScopeLookup *Engine::scopeLookup() {
		if (!o.rootLookup) {
			util::Lock::L z(createLock);
			if (!o.rootLookup)
				o.rootLookup = new (*this) ScopeLookup();
		}

		return o.rootLookup;
	}

	Scope Engine::scope() {
		return Scope(package(), scopeLookup());
	}

	code::Arena *Engine::arena() {
		if (!o.arena)
			o.arena = code::arena(*this);

		return o.arena;
	}

	VTableCalls *Engine::vtableCalls() {
		if (!o.vtableCalls)
			o.vtableCalls = new (*this) VTableCalls();

		return o.vtableCalls;
	}

	static const GcType voidArrayType = {
		GcType::tArray,
		null,
		null,
		0,
		0, {}
	};

	static void voidToS(const void *, StrBuf *to) {
		*to << L"void";
	}

	static Nat voidHash(const void *) {
		return 0;
	}

	static Bool voidEqual(const void *, const void *) {
		return true;
	}

	const Handle &Engine::voidHandle() {
		if (!o.voidHandle) {
			o.voidHandle = new (*this) Handle();
			o.voidHandle->size = 0;
			o.voidHandle->gcArrayType = &voidArrayType;
			o.voidHandle->toSFn = &voidToS;
			o.voidHandle->hashFn = &voidHash;
			o.voidHandle->equalFn = &voidEqual;
		}

		return *o.voidHandle;
	}

	code::Ref Engine::ref(builtin::BuiltIn ref) {
		code::RefSource **r = &o.refs[ref];
		if (!*r)
			*r = createRef(ref);

		return code::Ref(*r);
	}

	static void *allocType(Type *t) {
		return runtime::allocObject(0, t);
	}

	static void *allocArray(Type *t, size_t count) {
		return runtime::allocArray(t->engine, t->gcArrayType(), count);
	}

	static RootObject *stormAs(RootObject *in, Type *type) {
		if (!in)
			return null;
		if (in->isA(type))
			return in;
		return null;
	}

	static void fnNull() {
		// The null function in Storm!
	}

	static void CODECALL throwException(Exception *ex) {
		ex->throwMe();
	}

	static void CODECALL throwAbstractError(Str *identifier) {
		throw new (identifier) AbstractFnCalled(identifier);
	}

	static void CODECALL createValVariant(void *obj, const void *src, Type *type) {
		new (Place(obj)) Variant(src, type);
	}

	static void CODECALL createClassVariant(void *obj, Object *src) {
		new (Place(obj)) Variant(src);
	}

	static const void *CODECALL refSourceAddr(code::RefSource *src) {
		return src->address();
	}

	static Object *CODECALL cloneEnvGet(CloneEnv *env, Object *key) {
		return env->cloned(key);
	}

	static void CODECALL cloneEnvPut(CloneEnv *env, Object *key, Object *val) {
		env->cloned(key, val);
	}

	code::RefSource *Engine::createRef(builtin::BuiltIn ref) {
#define FNREF(id, fn) case builtin::id:									\
			return new (*this) BuiltInSource(builtin::id, address(&fn))

		switch (ref) {
			FNREF(lazyCodeUpdate, LazyCode::updateCode);
			FNREF(ruleThrow, syntax::Node::throwError);
			FNREF(alloc, allocType);
			FNREF(allocArray, allocArray);
			FNREF(as, stormAs);
			FNREF(mapAtValue, MapBase::atRawValue);
			FNREF(mapAtClass, MapBase::atRawClass);
			FNREF(mapGetUnsafe, MapBase::getUnsafeRaw);
			FNREF(setGetUnsafe, SetBase::getUnsafeRaw);
			FNREF(enumToS, Enum::toString);
			FNREF(futurePost, FutureBase::postRaw);
			FNREF(futureResult, FutureBase::resultRaw);
			FNREF(futureNoClone, FutureBase::setNoClone);
			FNREF(spawnResult, spawnThreadResult);
			FNREF(spawnFuture, spawnThreadFuture);
			FNREF(spawnFutureId, spawnThreadId);
			FNREF(spawnVoid, spawnThreadVoid);
			FNREF(spawnVoidId, spawnThreadVoidId);
			FNREF(fnNeedsCopy, FnBase::needsCopy);
			FNREF(fnCall, fnCallRaw);
			FNREF(fnCreate, fnCreateRaw);
			FNREF(fnNull, fnNull);
			FNREF(maybeToS, MaybeValueType::toSHelper);
			FNREF(globalAddr, GlobalVar::dataPtr);
			FNREF(throwAbstractError, throwAbstractError);
			FNREF(throwException, throwException);
			FNREF(createValVariant, createValVariant);
			FNREF(createClassVariant, createClassVariant);
			FNREF(createJoin, createJoin);
			FNREF(refSourceAddr, refSourceAddr);
			FNREF(cloneEnvGet, cloneEnvGet);
			FNREF(cloneEnvPut, cloneEnvPut);
		case builtin::engine:
			return arena()->externalSource(S("engine"), this);
		case builtin::VTableAllocOffset:
			// TODO: An offsetRef?
			return arena()->externalSource(S("vtableAllocOffset"), (const void *)VTableCpp::vtableAllocOffset());
		case builtin::TObjectOffset:
			// TODO: An offsetRef?
			return arena()->externalSource(S("threadOffset"), (const void *)OFFSET_OF(TObject, thread));
		default:
			assert(false, L"Unknown reference: " + ::toS(ref));
			return null;
		}
	}

	Visibility *Engine::visibility(VisType t) {
		Visibility *&r = o.visibility[t];
		if (!r)
			r = createVisibility(t);
		return r;
	}

	Visibility *Engine::createVisibility(VisType t) {
		switch (t) {
		case vPublic:
			return new (*this) Public();
		case vTypePrivate:
			return new (*this) TypePrivate();
		case vTypeProtected:
			return new (*this) TypeProtected();
		case vPackagePrivate:
			return new (*this) PackagePrivate();
		case vFilePrivate:
			return new (*this) FilePrivate();
		default:
			assert(false, L"Unknown visibility: " + ::toS(t));
			return null;
		}
	}

	StdIo *Engine::stdIo() {
		if (!ioThread) {
			util::Lock::L z(createLock);
			if (!ioThread) {
				ioThread = new StdIo();
			}
		}

		return ioThread;
	}

	TextInput *Engine::stdIn() {
		if (!o.stdIn)
			o.stdIn = new (*this) Utf8Input(proc::in(*this));
		return o.stdIn;
	}

	TextOutput *Engine::stdOut() {
		if (!o.stdOut)
			o.stdOut = new (*this) Utf8Output(proc::out(*this), sysTextInfo());
		return o.stdOut;
	}

	TextOutput *Engine::stdError() {
		if (!o.stdError)
			o.stdError = new (*this) Utf8Output(proc::error(*this), sysTextInfo());
		return o.stdError;
	}

	void Engine::stdIn(TextInput *to) {
		o.stdIn = to;
	}

	void Engine::stdOut(TextOutput *to) {
		o.stdOut = to;
	}

	void Engine::stdError(TextOutput *to) {
		o.stdError = to;
	}

	Array<Str *> *Engine::argv() {
		return atomicRead(o.argv);
	}

	void Engine::argv(Array<Str *> *val) {
		atomicWrite(o.argv, val);
	}

	code::TypeDesc *Engine::ptrDesc() {
		if (!o.ptrDesc)
			o.ptrDesc = code::ptrDesc(*this);
		return o.ptrDesc;
	}

	code::TypeDesc *Engine::voidDesc() {
		if (!o.voidDesc)
			o.voidDesc = code::voidDesc(*this);
		return o.voidDesc;
	}

	static RootObject *CODECALL readObject(RootObject **src) {
		return *src;
	}

	Function *Engine::readObjFn() {
		if (!o.readObj) {
			Value t(Object::stormType(*this));
			o.readObj = nativeFunction(*this, t, S("_read_"), valList(*this, 1, t.asRef()), address(&readObject));
			o.readObj->parentLookup(o.root);
		}
		return o.readObj;
	}

	Function *Engine::readTObjFn() {
		if (!o.readTObj) {
			Value t(TObject::stormType(*this));
			o.readTObj = nativeFunction(*this, t, S("_readT_"), valList(*this, 1, t.asRef()), address(&readObject));
			o.readTObj->parentLookup(o.root);
		}
		return o.readTObj;
	}

	Package *Engine::package() {
		if (!o.root) {
			assert(has(bootTypes), L"Can not create packages yet.");
			o.root = new (*this) Package(new (*this) Str(S("<root>")));
		}
		return o.root;
	}

	Package *Engine::corePackage() {
		if (!o.corePkg)
			o.corePkg = package(S("core"));
		return o.corePkg;
	}

	Package *Engine::package(SimpleName *name, bool create) {
		Package *now = package();

		for (nat i = 0; i < name->count(); i++) {
			SimplePart *p = name->at(i);

			// Not supported.
			if (p->params->any())
				return null;

			Named *next = now->find(p, Scope());
			if (!next) {
				Package *pkg = new (*this) Package(p->name);
				now->add(pkg);
				now = pkg;
			} else if (Package *p = as<Package>(next)) {
				now = p;
			} else {
				return null;
			}
		}

		return now;
	}

	Package *Engine::package(const wchar *name) {
		SimpleName *n = parseSimpleName(*this, name);
		return package(n, false);
	}

	NameSet *Engine::nameSet(SimpleName *name, bool create) {
		return nameSet(name, package(), create);
	}

	NameSet *Engine::nameSet(SimpleName *name, NameSet *now, bool create) {
		for (nat i = 0; i < name->count(); i++) {
			SimplePart *p = name->at(i);

			// Not supported.
			if (p->params->any())
				return null;

			Named *next = now->find(p, Scope());
			if (!next && create) {
				Package *pkg = new (*this) Package(p->name);
				now->add(pkg);
				now = pkg;
			} else if (NameSet *p = as<NameSet>(next)) {
				now = p;
			} else {
				return null;
			}
		}

		return now;
	}

	static Package *findChild(Package *p, Url *path, Nat start) {
		for (Nat i = start; p && i < path->count(); i++) {
			// TODO: Make sure we handle case sensitivity correctly!
			p = as<Package>(p->find(path->at(i), Scope()));
		}
		return p;
	}

	MAYBE(Package *) Engine::package(Url *path) {
		Map<Url *, Package *> *lookup = pkgMap();

		for (Url *at = path; !at->empty(); at = at->parent()) {
			if (Package *p = lookup->get(at, null)) {
				return findChild(p, path, at->count());
			}
		}

		return null;
	}

	Map<Url *, Package *> *Engine::pkgMap() {
		if (!o.pkgMap)
			o.pkgMap = new (*this) Map<Url *, Package *>();
		return o.pkgMap;
	}

	SharedLib *Engine::loadShared(Url *file) {
		return libs.load(file);
	}


	Engine::StormInfo::StormInfo(Gc &gc) : gc(gc) {}

	Engine::StormInfo::~StormInfo() {
		clear();
	}

	void Engine::StormInfo::clear() {
		if (!roots.empty()) {
			WARNING(L"The registered roots for stack traces were not empty. Possible leak!");
		}

		for (RootMap::iterator i = roots.begin(); i != roots.end(); ++i)
			gc.destroyRoot(i->second);
		roots.clear();
	}

	void Engine::StormInfo::alloc(StackFrame *frames, nat count) const {
		Gc::Root *r = gc.createRoot(frames, count * sizeof(StackFrame), true);
		roots.insert(std::make_pair(size_t(frames), r));
	}

	void Engine::StormInfo::free(StackFrame *frames, nat count) const {
		RootMap::iterator i = roots.find(size_t(frames));
		if (i != roots.end()) {
			gc.destroyRoot(i->second);
			roots.erase(i);
		}
	}

	bool Engine::StormInfo::translate(void *ip, void *&fnBase, int &offset) const {
		return false;
	}

	void Engine::StormInfo::format(GenericOutput &to, void *fnBase, int offset) const {}

	/**
	 * Interface which only exists in the compiler. Dynamic libraries have their own implementations
	 * which forward the calls to these implementations.
	 */

	Thread *DeclThread::thread(Engine &e) const {
		return e.cppThread(identifier);
	}

	void gc(EnginePtr e) {
		e.v.gc.collect();
	}

}

// Get the global StackInfoSet.
DEFINE_STACK_INFO()