lightning
[Top][All Lists]
Advanced

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

Re: Embedding data in the code stream


From: Paul Cercueil
Subject: Re: Embedding data in the code stream
Date: Thu, 11 Aug 2022 13:00:24 +0200

Why don't you simply malloc your object, and tell Lightning to emit code at offset (e.g.) 0x100? Then your first 0x100 bytes would be for meta-data use.

Cheers,
-Paul

Le jeu., août 11 2022 at 12:44:08 +0200, Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> a écrit :
Am Do., 11. Aug. 2022 um 12:28 Uhr schrieb Paul Cercueil <paul@crapouillou.net>:
Hi Marc,

 Obvious questions first: why would you do that?

Say, I want to implement a VM using GNU lightning. Code objects would be first-class objects. Some information (e.g. for the garbage collector) would need to be attached to such code objects to remove the need for an extra pointer indirection.

An example:

jit_align (16);
jit_data_ui (meta_information);
jit_align (16);
entry = label_indirect ();
/* the actual code */
...
unsigned char *addr = jit_address (entry);
unsigned int info = * (unsigned int *) (addr - 16);






reply via email to

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