[Development] V4 porting

Hausmann Simon Simon.Hausmann at theqtcompany.com
Thu Dec 24 15:02:26 CET 2015


Hi,

Registers that are native to the processor are saved on the regular stack.


Simon

From: Dmitriy -
Sent: Thursday, December 24, 2015 14:11
To: Hausmann Simon
Cc: development at qt-project.org
Subject: Re: [Development] V4 porting


One more question:

qt-5.5.1/qtdeclarative/src/qml/jit/qv4assembler_p.h


    // V4 uses two stacks: one stack with QV4::Value items, which is checked by the garbage

    // collector, and one stack used by the native C/C++/ABI code. This C++ stack is not scanned

    // by the garbage collector, so if any JS object needs to be retained, it should be put on the

    // JS stack.

    //

    // The "saved reg arg X" are on the C++ stack is used to store values in registers that need to

    // be passed by reference to native functions. It is fine to use the C++ stack, because only

    // non-object values can be stored in registers.

    //

    // Stack layout for the C++ stack:

    //   return address

    //   old FP                     <- FP

    //   callee saved reg n

    //   ...

    //   callee saved reg 0

    //   saved reg arg n

    //   ...

    //   saved reg arg 0            <- SP

    //

    // Stack layout for the JS stack:

    //   function call argument n   <- LocalsRegister

    //   ...

    //   function call argument 0

    //   local 0

    //   ...

    //   local n





// First save any arguments that reside in registers, because they could be overwritten

// if that register is also used to pass arguments.

saveOutRegister<5>(arg6);

saveOutRegister<4>(arg5);

saveOutRegister<3>(arg4);

saveOutRegister<2>(arg3);

saveOutRegister<1>(arg2);

saveOutRegister<0>(arg1);

...


What kind of stack use for saving registers? Is it c++/ABI stack (I hope) or Js stack?


On Thu, Dec 24, 2015 at 5:42 PM, Dmitriy - <dima00782 at gmail.com<mailto:dima00782 at gmail.com>> wrote:
Thank.
I want to port JIT. Where should I start?
You have any roadmap for this?

Now I'm using qmljs tool for testing purpose.
I has seen in qt-5.5.1/qtdeclarative/src/qml/jsruntime/qv4script.cpp:

Script::parse():
...

RuntimeCodegen cg(v4, strictMode);

cg.generateFromProgram(sourceFile, sourceCode, program, &module, QQmlJS::Codegen::EvalCode, inheritedLocals);

if (v4->hasException) return;

QV4::Compiler::JSUnitGenerator jsGenerator(&module);

QScopedPointer<EvalInstructionSelection> isel(...);

...

QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit = isel->compile();

vmFunction = compilationUnit->linkToEngine(v4);

...


Why do you compile script while parse it? Do you use AOT compiling?

On Thu, Dec 24, 2015 at 5:18 PM, Hausmann Simon <Simon.Hausmann at theqtcompany.com<mailto:Simon.Hausmann at theqtcompany.com>> wrote:
Hi,

Moth is the portable interpreter that will be used instead of the just-in-time compiler if your platform doesn't support it. It should be chosen automatically for you according to the #ifdefs in qv4global_p.h.

So if you have qtbase compiling, then qml should also work. If you want things to run faster, then you will have to port the JIT.

Simon

From: Dmitriy -
Sent: Thursday, December 24, 2015 10:47
To: development at qt-project.org<mailto:development at qt-project.org>
Subject: [Development] V4 porting


Hi!
I want to port v4 engine to the new platform. The platform is Linux OS and new processor. The processor looks like intel itanium. It is VLIW and EPIC.
I have a c++/c compilers for the new architecture.

I want to design qt quic qml application for the new platform. As a can see in code, I need v4vm backend for this purpose.

I'm see this:

case use_moth: {
        QV4::EvalISelFactory* iSelFactory = 0;
        if (mode == use_moth) {
            iSelFactory = new QV4::Moth::ISelFactory;
#ifdef V4_ENABLE_JIT
        } else {
            iSelFactory = new QV4::JIT::ISelFactory;
#endif // V4_ENABLE_JIT
        }

        QV4::ExecutionEngine vm(iSelFactory);

        QV4::Scope scope(&vm);
        QV4::ScopedContext ctx(scope, vm.rootContext());



As I understand v4vm has two backends - Moth and Masm.

What is Moth?

--
Regards,
Dmitry Bezheckov.



--
Regards,
Dmitry Bezheckov.



--
Regards,
Dmitry Bezheckov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20151224/98df3c8c/attachment.html>


More information about the Development mailing list