Structure declaration support.
1 /* vim: set ts=4 sw=4 tw=99 et:
3 * Copyright (C) 2012 David Anderson
5 * This file is part of JITCraft.
7 * JITCraft is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 3 of the License, or (at your option)
12 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with
17 * JITCraft. If not, see http://www.gnu.org/licenses/.
20 #include "BytecodeCompiler.h"
27 #include "Environments.h"
32 typedef BytecodeEmitter::Label Label;
36 BytecodeCompiler::BytecodeCompiler(Zone *zone, ParseTree *tree, ModuleData *module)
39 emitter_(zone->pool()),
47 static inline TokenKind
48 ToCompare(Expression *expr)
50 if (expr->isBinaryExpression()) {
51 BinaryExpression *b = expr->toBinaryExpression();
52 if (b->token() >= TOK_EQUALS && b->token() <= TOK_OR)
54 } else if (expr->isUnaryExpression()) {
55 UnaryExpression *u = expr->toUnaryExpression();
56 if (u->token() == TOK_NOT)
63 CompareTokenToJump(TokenKind kind)
77 assert(kind == TOK_LE);
83 TokenToOpcode(TokenKind kind)
119 assert(kind == TOK_BITXOR);
125 BytecodeCompiler::recordLifoSlot(Scope *scope)
130 if (Variable *var = scope->lifoSlot()) {
131 locals_->set(zone_, var->slot(), var->type());
132 __ savelifo(var->slot());
137 BytecodeCompiler::unwindTo(Scope *scope)
139 // Note: we only need to unwind to the outermost scope's LIFO slot.
140 Variable *var = NULL;
141 for (Scope *current = scope_; current != scope; current = current->enclosing()) {
142 if (Variable *slot = current->lifoSlot())
147 __ unwindlifo(var->slot());
151 BytecodeCompiler::visit(NameProxy *name)
153 switch (name->binding()->kind()) {
154 case BoundName::VARIABLE:
156 Variable *var = name->binding()->toVariable();
158 if (var->location() == Variable::STACK) {
160 assert(!name->type()->isReference());
161 } else if (var->location() == Variable::ENVIRONMENT) {
164 assert(var->location() == Variable::PARAMETER);
167 // If this argument is actually a reference, dereference it now.
168 if (var->type()->isReference())
169 __ getref(var->type()->contained());
174 case BoundName::FUNCTION:
176 NamedFunction *fun = name->binding()->toNamedFunction();
178 __ getmodule_fn(fun->slot());
184 NamedConstant *constant = name->binding()->toNamedConstant();
185 __ int_(constant->value().toInt());
192 BytecodeCompiler::visit(ExpressionStatement *node)
194 // Expressions leave their value on the top of the stack, so we make sure
195 // to balance the stack if they're used as a statement.
196 node->expression()->accept(this);
197 if (!node->expression()->type()->isVoid())
202 BytecodeCompiler::visit(Assignment *node)
204 // The first step is three sub-steps:
206 // (1) Bind the left-hand side.
207 // -- If a cumulative operation (+=, etc):
208 // (2) Save a copy of the binding on the stack.
209 // (3) Dereference the binding to get a value.
211 if (node->lvalue()->isNameProxy()) {
212 NameProxy *proxy = node->lvalue()->toNameProxy();
213 Variable *var = proxy->binding()->toVariable();
216 if (var->type()->isReference() || var->type()->isArray())
219 // Get the value if needed.
220 if (node->token() != TOK_ASSIGN) {
221 // += etc is not allowed on arrays.
222 assert(!var->type()->isArray());
224 if (var->type()->isReference()) {
226 __ getref(var->type()->contained());
232 IndexExpression *index = node->lvalue()->toIndexExpression();
233 __ note_position(index->pos());
235 // Note: Eventually, watch out for a whole here. An expression like:
237 // (a[4] = (5, a = []))
239 // Could shrink array, so we need to either bind a[i] to a Reference,
240 // or keep the bounds check near the set. This is just a semantic
242 index->left()->accept(this);
243 index->right()->accept(this);
245 if (node->token() != TOK_ASSIGN) {
248 if (node->type()->isArray())
251 __ getarray(node->type());
255 if (node->token() == TOK_ASSIGN) {
256 node->expression()->accept(this);
258 visitForALU(node->type(), node->expression());
260 TokenKind alu = TokenKind(int(node->token()) - (TOK_ASSIGN_ADD - TOK_PLUS));
261 __ note_position(node->pos());
262 __ binary(TokenToOpcode(alu));
266 if (node->expression()->type()->isArray()) {
267 // Unlike references, which can only be computed from a NamePRoxy,
268 // arrays can be computed from multiple lvalue types.
269 __ note_position(node->pos());
271 } else if (node->lvalue()->isNameProxy()) {
272 NameProxy *proxy = node->lvalue()->toNameProxy();
273 Variable *var = proxy->binding()->toVariable();
275 if (var->type()->isReference())
276 __ setref(var->type()->contained());
280 IndexExpression *index = node->lvalue()->toIndexExpression();
281 // :TODO: get rid of the BOUNDS instruction, embed it in g/setarray*?
282 // We can't emit it here because the stack is slightly out of position.
284 __ setarray(index->left()->type()->contained());
289 BytecodeCompiler::visit(IncDecExpression *node)
291 // In the postfix case, the logic looks like:
293 // (2) Dup -> REF REF
294 // (3) Fetch -> REF VAL
295 // (4) Swap -> VAL REF
296 // (5) Pick -> VAL REF VAL
297 // (6) Add -> VAL REF VAL+1
298 // (7) Store -> VAL VAL+1
301 // In the prefix case, the logic looks like:
303 // (2) Dup -> REF REF
304 // (3) Fetch -> REF VAL
307 // (6) Add -> REF VAL+1
308 // (7) Store -> VAL+1
311 // This is squirrely enough such that we don't bother sharing too much
314 // Note: We simulate a "Pick" operation with a dup2+pop.
316 // This is steps (1) to (5).
317 Expression *expr = node->expression();
318 if (expr->isNameProxy()) {
319 NameProxy *proxy = expr->toNameProxy();
320 Variable *var = proxy->binding()->toVariable();
323 if (var->type()->isReference() || var->type()->isArray())
327 if (var->type()->isReference()) {
329 __ getref(node->type());
330 if (node->postfix()) {
335 assert(!var->type()->isArray());
341 IndexExpression *index = expr->toIndexExpression();
342 __ note_position(index->pos());
344 index->left()->accept(this);
345 index->right()->accept(this);
347 assert(!node->type()->isArray());
350 __ getarray(node->type());
352 if (node->postfix()) {
353 // The stack looks like this now:
356 // So we must use a PICK operation to rotate the stack into position.
357 __ roll3(); // INDEX VALUE ARRAY
358 __ roll3(); // VALUE ARRAY INDEX
359 __ pick3(); // VALUE ARRAY INDEX VALUE
364 if (node->type()->isFloat()) {
367 assert(node->type()->isInt32());
371 __ note_position(node->pos());
372 if (node->token() == TOK_INCREMENT)
378 if (expr->isNameProxy()) {
379 NameProxy *proxy = expr->toNameProxy();
380 Variable *var = proxy->binding()->toVariable();
382 if (var->type()->isReference())
383 __ setref(node->type());
387 __ setarray(node->type());
396 BytecodeCompiler::visitForALU(Type *needed, Expression *node)
399 if (needed->isFloat() && !node->type()->isFloat())
402 assert(needed->primitive() == node->type()->primitive());
406 GetCoercionType(TokenKind tok, Type *left, Type *right)
414 BytecodeCompiler::visit(UnaryExpression *node)
416 Local<Type> out(zone_, ((Expression *)node)->type());
418 switch (node->token()) {
421 Local<Type> type(zone_, node->expression()->type());
422 node->expression()->accept(this);
433 Local<Type> type(zone_, node->expression()->type());
434 node->expression()->accept(this);
445 Local<Type> from(zone_, node->expression()->type());
447 node->expression()->accept(this);
448 if (!from->isFloat() && out->isFloat())
450 else if (from->isFloat() && !out->isFloat())
456 assert(node->token() == TOK_TILDE);
457 node->expression()->accept(this);
464 BytecodeCompiler::visit(BinaryExpression *node)
466 if (node->token() == TOK_AND || node->token() == TOK_OR) {
467 Label success, failure, done;
468 visitForTest(node, &success, &failure, &success);
471 __ drop(1); // Otherwise, the stack depth will be +1 too much.
479 Local<Type> leftType(zone_, node->left()->type());
480 Local<Type> rightType(zone_, node->right()->type());
481 Local<Type> coerce(zone_, GetCoercionType(node->token(), leftType, rightType));
483 visitForALU(coerce, node->left());
484 visitForALU(coerce, node->right());
486 Opcode op = TokenToOpcode(node->token());
487 if (node->type()->isFloat())
488 op = (Opcode)(int(op) + (OP_ADD_F - OP_ADD));
490 __ note_position(node->pos());
495 BytecodeCompiler::visit(IndexExpression *node)
497 node->left()->accept(this);
498 node->right()->accept(this);
499 __ note_position(node->pos());
502 if (node->type()->isArray())
505 __ getarray(node->type());
509 BytecodeCompiler::visit(ReturnStatement *node)
511 if (node->expression()) {
512 node->expression()->accept(this);
520 BytecodeCompiler::visitForTest(Expression *expression,
525 TokenKind token = ToCompare(expression);
526 if (token == TOK_EOF || token == TOK_NOT) {
527 if (token == TOK_EOF)
528 expression->accept(this);
530 expression->toUnaryExpression()->expression()->accept(this);
532 bool jumpOnTrue = (fallthrough == falseBranch) ^ (token == TOK_NOT);
534 Opcode op = jumpOnTrue ? OP_JT : OP_JF;
535 if (expression->type()->isFloat())
536 op = (Opcode)(int(op) + (OP_JL_F - OP_JL));
538 if (fallthrough == falseBranch)
539 __ j(op, trueBranch);
541 __ j(op, falseBranch);
545 BinaryExpression *binary = expression->toBinaryExpression();
547 if (token == TOK_AND || token == TOK_OR) {
549 if (token == TOK_AND)
550 visitForTest(binary->left(), &next, falseBranch, &next);
552 visitForTest(binary->left(), trueBranch, &next, &next);
554 visitForTest(binary->right(), trueBranch, falseBranch, fallthrough);
558 Opcode op = CompareTokenToJump(token);
559 if (fallthrough == trueBranch)
562 Local<Type> leftType(zone_, binary->left()->type());
563 Local<Type> rightType(zone_, binary->right()->type());
564 Local<Type> coerce(zone_, GetCoercionType(binary->token(), leftType, rightType));
566 visitForALU(coerce, binary->left());
567 visitForALU(coerce, binary->right());
568 if (coerce->isFloat())
569 op = (Opcode)(int(op) + (OP_JL_F - OP_JL));
571 if (fallthrough == trueBranch)
572 __ j(op, falseBranch);
574 __ j(op, trueBranch);
578 BytecodeCompiler::visit(ForStatement *node)
580 AutoEnterScope forScope(this, node->scope());
582 recordLifoSlot(node->scope());
585 LoopScope loop(scope_, &join, &update, &loop_);
587 if (node->initialization())
588 node->initialization()->accept(this);
591 if (node->condition())
595 node->body()->accept(this);
599 node->update()->accept(this);
601 if (node->condition()) {
603 visitForTest(node->condition(), &header, &join, &join);
611 unwindTo(node->scope()->enclosing());
612 assert(__ stackDepth() == 0);
616 BytecodeCompiler::visit(WhileStatement *node)
622 LoopScope loop(scope_, &join, &header, &loop_);
624 if (node->token() == TOK_WHILE) {
627 visitForTest(node->condition(), &body, &join, &body);
629 node->body()->accept(this);
632 node->body()->accept(this);
633 visitForTest(node->condition(), &header, &join, &join);
640 BytecodeCompiler::visit(BreakStatement *node)
642 unwindTo(loop_->scope());
643 __ jump(loop_->break_());
647 BytecodeCompiler::visit(ContinueStatement *node)
649 unwindTo(loop_->scope());
650 __ jump(loop_->continue_());
654 BytecodeCompiler::visit(BlockStatement *node)
656 AutoEnterScope blockScope(this, node->scope());
658 recordLifoSlot(node->scope());
660 for (size_t i = 0; i < node->statements()->length(); i++) {
661 Statement *statement = node->statements()->at(i);
662 statement->accept(this);
663 assert(__ stackDepth() == 0);
666 // We don't bother emitting an "unwind" instruction for function scopes,
667 // since this is taken care of by the calling convention.
668 if (node->scope() && node->scope()->enclosing()->kind() != Scope::FUNCTION)
669 unwindTo(node->scope()->enclosing());
673 BytecodeCompiler::visit(IntegerLiteral *node)
675 __ int_(node->value());
679 BytecodeCompiler::visit(BooleanLiteral *node)
681 if (node->token() == TOK_TRUE)
688 BytecodeCompiler::visit(FloatLiteral *node)
690 __ float_((float)node->value());
693 static inline ArrayMap *
694 BuildArrayMap(Zone *zone, Handle<Type> type)
696 Local<ArrayMap> contained(zone);
697 if (type->levels() > 1) {
698 Local<Type> containedType(zone, type->contained());
699 contained = BuildArrayMap(zone, containedType);
704 return ArrayMap::New(zone, type, contained);
708 BytecodeCompiler::visit(StringLiteral *node)
710 Local<Type> type(zone_, node->type());
711 Local<ArrayMap> map(zone_, BuildArrayMap(zone_, type));
715 Local<Array> array(zone_, Array::New(zone_, map, node->string()->length(), Heap::Tenure_Old));
719 assert(array->nelements() >= node->string()->length());
720 memcpy(array->chars(), node->string()->raw(), node->string()->length() * sizeof(char));
722 __ note_position(node->pos());
727 BytecodeCompiler::getEnvSlot(Variable *var)
729 assert(var->scope()->kind() == Scope::GLOBAL);
734 BytecodeCompiler::setEnvSlot(Variable *var)
736 assert(var->scope()->kind() == Scope::GLOBAL);
741 BytecodeCompiler::visit(VariableDeclaration *node)
743 Variable *var = node->variable();
745 Local<Type> type(zone_, var->type());
746 if (type->isArray()) {
747 Local<ArrayMap> map(zone_, BuildArrayMap(zone_, type));
748 __ note_position(node->pos());
749 if (var->scope()->kind() == Scope::GLOBAL)
750 __ newarray(map, Heap::Tenure_Old);
751 else if (var->needsHeapAllocation())
752 __ newarray(map, Heap::Tenure_Default);
754 __ newarray(map, Heap::Tenure_Stack);
756 if (node->initialization()) {
757 node->initialization()->accept(this);
758 __ note_position(node->pos());
761 } else if (type->isStruct()) {
762 Local<Map> map(zone_, type->newMap());
763 if (var->scope()->kind() == Scope::GLOBAL)
764 __ newstruct(map, Heap::Tenure_Old);
765 else if (var->needsHeapAllocation())
766 __ newstruct(map, Heap::Tenure_Default);
768 __ newstruct(map, Heap::Tenure_Stack);
770 if (node->initialization()) {
771 node->initialization()->accept(this);
773 if (type->isInt32OrEnum() || type->isBool()) {
776 assert(type->isFloat());
782 if (var->location() == Variable::STACK) {
784 locals_->set(zone_, var->slot(), var->type());
786 assert(var->location() == Variable::ENVIRONMENT);
794 BytecodeCompiler::visit(CallExpression *node)
796 Local<Type> funType(zone_, node->callee()->type());
798 // Sniff out natives, which have a specific opcode and are guaranteed to
799 // be called via name proxy.
800 NamedFunction *native = NULL;
801 if (funType->isNative()) {
802 native = node->callee()->toNameProxy()->binding()->toNamedFunction();
805 for (size_t i = node->arguments()->length() - 1; i < node->arguments()->length(); i--) {
806 Expression *arg = node->arguments()->at(i);
808 // We need to compute a reference if the parameter was in the form:
810 // Note this form does not allow: f({})
812 // We also need to compute references for all variadic native
813 // arguments, but arrays and references are already in the
815 Local<Type> given(zone_, arg->type());
816 bool mustPushReference = false;
817 if (i >= funType->parameters()->length()) {
818 assert(funType->isNative() && funType->isNativeVariadic());
819 mustPushReference = !given->isArray() && !given->isReference();
820 } else if (funType->parameterAt(i)->isReference()) {
821 mustPushReference = !given->isReference();
824 // If a native is passed to a native, it must only be one level deep.
825 assert(!funType->isNative() || !given->isArray() || given->levels() == 1);
827 if (mustPushReference) {
828 if (arg->isNameProxy()) {
829 // :TODO: test with functions and globals
830 // Compute a reference to the name.
831 Variable *var = arg->toNameProxy()->binding()->toVariable();
832 __ note_position(node->pos());
834 } else if (arg->isIndexExpression()) {
835 IndexExpression *expr = arg->toIndexExpression();
836 expr->left()->accept(this);
837 expr->right()->accept(this);
838 __ note_position(expr->pos());
842 // We don't know how to, or can't, build a direct reference to
843 // this type. Make an indirect one, by taking the top of the
844 // stack and boxing it up.
846 __ note_position(node->pos());
854 __ note_position(node->pos());
856 __ callnative(native->slot(), node->arguments()->length());
857 __ drop(node->arguments()->length());
859 node->callee()->accept(this);
861 __ drop(node->arguments()->length() + 1);
866 BytecodeCompiler::visit(TernaryExpression *node)
868 Label success, failure, join;
870 visitForTest(node->condition(), &success, &failure, &success);
872 node->left()->accept(this);
876 node->right()->accept(this);
881 BytecodeCompiler::visit(IfStatement *node)
884 if (!node->ifFalse()) {
887 visitForTest(node->condition(), &success, &join, &success);
889 node->ifTrue()->accept(this);
893 visitForTest(node->condition(), &success, &next, &success);
895 node->ifTrue()->accept(this);
898 node->ifFalse()->accept(this);
905 BytecodeCompiler::visit(FunctionStatement *node)
907 if (!node->fun()->used())
910 if (node->fun()->isNative()) {
911 assert(!moduleData_->natives->at(node->fun()->slot()));
913 Local<Type> type(zone_, node->fun()->type());
914 Local<String> name(zone_, node->fun()->name());
915 Local<Native> native(zone_, Native::New(zone_, type, name));
919 moduleData_->natives->set(zone_, node->fun()->slot(), native);
923 // If the function has no body, then it's just a declaration.
925 assert(node->fun()->isForward() || node->fun()->isPublic());
929 BytecodeCompiler child(zone_, tree_, moduleData_);
930 Local<Function> fun(zone_, child.compileFunction(moduleData_, node));
934 assert(!moduleData_->module->getFunction(node->fun()->slot()));
935 moduleData_->module->setFunction(zone_, node->fun()->slot(), fun);
939 BytecodeCompiler::visit(EnumStatement *node)
941 // :TODO: eventually, we'll export these.
945 BytecodeCompiler::visit(StructureStatement *node)
950 BytecodeCompiler::compileCode(Scope *scope, unsigned lineno)
952 // STOP doubles as RETURNVOID.
955 if (__ oom() || zone_->hasPendingException())
958 Local<ByteArray> bytes(zone_, ByteArray::New(zone_, __ length() * sizeof(bytecode), Heap::Tenure_Old));
961 memcpy(bytes->raw(), __ buffer(), __ length());
963 for (size_t i = 0; i < scope->maxContainedLocals(); i++)
964 assert(locals_->at(i));
966 Local<FixedArray> objects(zone_, FixedArray::New(zone_, __ objects()->length(), Heap::Tenure_Old));
970 for (size_t i = 0; i < __ objects()->length(); i++)
971 objects->set(zone_, i, *(__ objects()->at(i)));
973 Local<ByteArray> safepoints(zone_);
975 // If any stack slots hold gc pointers at potential failure points in the
976 // bytecode, record them now. We do this by building a list of tuples;
977 // each tuple contains the pc offset, and a bitset containing which stack
978 // slots must be scanned by the gc.
979 if (__ oopRecords()->length()) {
980 size_t bytesPerSafepoint = Code::BytesPerSafepoint(__ maxStackDepth());
981 size_t gcmapSize = bytesPerSafepoint * __ oopRecords()->length();
982 safepoints = ByteArray::New(zone_, gcmapSize, Heap::Tenure_Old);
986 Address cursor = safepoints->raw();
987 for (size_t i = 0; i < __ oopRecords()->length(); i++) {
988 OopRecord *record = __ oopRecords()->at(i);
989 assert(record->depth <= __ maxStackDepth());
991 *reinterpret_cast<unsigned *>(cursor) = record->offset;
993 unsigned char *bits = reinterpret_cast<unsigned char *>(cursor + sizeof(unsigned));
994 for (unsigned i = 0; i < record->depth; i++)
995 bits[i / 8] |= (1 << (i % 8));
997 cursor += bytesPerSafepoint;
1000 assert(cursor == safepoints->raw() + gcmapSize);
1003 Local<ByteArray> sourcemap(zone_);
1004 if (__ sourcemapLength()) {
1005 sourcemap = ByteArray::New(zone_, __ sourcemapLength(), Heap::Tenure_Old);
1009 memcpy(sourcemap->raw(), __ sourcemap(), __ sourcemapLength());
1012 Local<Code> code(zone_);
1014 code = Code::New(zone_,
1019 moduleData_->module,
1027 BytecodeCompiler::compileFunction(ModuleData *module, FunctionStatement *node)
1029 // Note: No need to record a life slot here, since it's part of the Frame.
1030 AutoEnterScope functionScope(this, node->scope());
1032 // Set the initial line, because line mappings are deltas.
1033 __ setFirstLine(node->pos().line);
1034 locals_ = FixedArray::New(zone_, node->scope()->maxContainedLocals(), Heap::Tenure_Old);
1036 node->body()->accept(this);
1038 unsigned nargs = node->scope()->numArguments();
1039 Local<FixedArray> args(zone_, FixedArray::New(zone_, nargs, Heap::Tenure_Old));
1043 for (size_t i = 0; i < node->scope()->numArguments(); i++)
1044 args->set(zone_, i, node->scope()->getArgument(i)->type());
1047 Local<Code> code(zone_, compileCode(node->scope(), node->pos().line));
1051 Local<Type> type(zone_, node->fun()->type());
1052 Local<String> name(zone_, node->fun()->name());
1053 Local<Function> fun(zone_, Function::New(zone_, code, type, name, node->pos()));
1057 // If this function had a forward, export it as a named public.
1058 if (node->fun()->isPublic()) {
1059 assert(node->fun()->isPublic());
1060 ScopedRoot<Function> root(fun);
1063 if (!moduleData_->publics.append(root))
1067 Disassemble(code, stdout);
1073 BytecodeCompiler::compile()
1075 AutoEnterScope scope(this, tree_->scope());
1077 ModuleData moduleData;
1079 moduleData_ = &moduleData;
1080 moduleData_->module = Module::New(zone_, tree_->scope()->numFunctions());
1085 moduleData_->natives = FixedArray::New(zone_, tree_->scope()->numNatives(), Heap::Tenure_Old);
1086 if (!moduleData_->natives)
1089 for (size_t i = 0; i < tree_->statements()->length(); i++) {
1090 Statement *statement = tree_->statements()->at(i);
1091 statement->accept(this);
1094 if (zone_->hasPendingException())
1098 for (size_t i = 0; i < tree_->scope()->numFunctions(); i++)
1099 assert(moduleData_->module->getFunction(i));
1100 for (size_t i = 0; i < tree_->scope()->numNatives(); i++)
1101 assert(moduleData_->natives->at(i));
1104 if (moduleData_->publics.length()) {
1105 Local<Function> fun(zone_);
1106 Local<FixedArray> list(zone_, FixedArray::New(zone_, moduleData_->publics.length(),
1111 for (size_t i = 0; i < moduleData_->publics.length(); i++)
1112 list->set(zone_, i, moduleData_->publics[i]);
1114 moduleData_->module->setPublics(list);
1117 moduleData_->module->setNatives(moduleData_->natives);
1119 if (scope_->numEnvironmentVars()) {
1120 Local<EnvironmentMap> globalMap(zone_, scope_->createEnvironmentMap(zone_));
1124 Local<Environment> environment(zone_, Environment::New(zone_, globalMap));
1128 moduleData_->module->setEnvironment(environment);
1131 Local<Code> code(zone_, compileCode(tree_->scope(), 1));
1135 Disassemble(code, stdout);
1137 moduleData_->module->setCode(code);
1139 return moduleData_->module;