lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] About using lightning on a dynamically typed language


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] About using lightning on a dynamically typed language
Date: Mon, 17 May 2010 03:48:19 -0300
User-agent: SquirrelMail/1.4.19

Paolo Bonzini wrote:

  I am making some beginner like questions here hoping that these
may help others, otherwise, sorry for the noise...

>>  Sorry for showing my ignorance, but what would be the best way to
>> see the generated jit as assembly output? I think I would need that
>> to better map "in my little mind" what code is being generated...
>
> You can use gdb and its disass command, or embed a small disassembler
> in your program.  See the programs in the tests directory.

  I did not write any assembly for like 10 years, just C, so I am a
bit rusty; I am now using
(gdb) x/<number>i code
where number is the code length and code is the jit_insn* variable,
and already corrected a few bugs due to incorrect usage of 'r' and 'i'

>>                jit_ldxi_i(JIT_R1, JIT_V1, (int)&((thread_t*)0)->bp);
>
> Use offsetof here.
>
> I haven't tested the program, but a first hint is to run disass in gdb
> to see whether there is an obvious problem in the code.  Another way
> is to add an IP to your thread state and write there the IP before
> compiling each opcode (only in debugging mode of course).  Then it's
> clear from the disass output what IP you were executing at the time of
> the crash.

  I am attaching the first test as a C source code, and a study
of the dump, that hopefully may help other people also.
  I am now (re)learning the assembly syntax, to check what I am doing
wrong on accessing the thread_t structure and reading/writing the fields.
  This initial test is to have a small "feeling" on possibly
adapting/changing my current vm concepts to be able to generate
efficient code...

> Paolo

Many thanks for the help,
Paulo

Attachment: lightning-first-test.c
Description: Text Data

Attachment: dump.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]