[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lightning] Porting GNU Smalltalk to lightning 2
From: |
Holger Hans Peter Freyther |
Subject: |
Re: [Lightning] Porting GNU Smalltalk to lightning 2 |
Date: |
Sun, 26 Oct 2014 18:54:01 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Sun, Oct 26, 2014 at 03:17:11PM -0200, Paulo César Pereira de Andrade wrote:
> I created the reverse hash to simulate the above, after finding that code
> that did store a nativeCode* could change it to another one (so I could
> not play smart and store a pointer to a method_entry pointer, and then
> just dereference the nativeCode pointer when needing it).
> Storing the method_entry somewhere in the jit code is possible, could
> be a jump over the value stored (ugly), a function in the jit that would
> return the method_entry associated with it (complicated), so, a
> naive/simple solution for now is the reverse hash table. But other
> kinds of optimizations could be done.
Ah thanks for the explanation. Okay we have the start of the code pointer
and we want to find the method_entry it refers to. I know you mentioned it
already but could you re-iterate why we can't have a "reservation" in front
of the native code generated by lightning?
jit_pointer_t
-_jit_emit(jit_state_t *_jit)
+_jit_emit(jit_state_t *_jit, size_t offset )
{
jit_pointer_t code;
jit_node_t *node;
@@ -1859,10 +1859,11 @@ _jit_emit(jit_state_t *_jit)
#if defined(__sgi)
mmap_fd = open("/dev/zero", O_RDWR);
#endif
- _jit->code.ptr = mmap(NULL, _jit->code.length,
+ _jit->code.ptr = mmap(NULL, _jit->code.length + offset,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, mmap_fd, 0);
assert(_jit->code.ptr != MAP_FAILED);
+ _jit->code.ptr += offset;
}
_jitc->code.end = _jit->code.ptr + _jit->code.length -
jit_get_max_instr();
@@ -1879,6 +1880,7 @@ _jit_emit(jit_state_t *_jit)
}
if (_jit->user_code)
goto fail;
+#error "add the offset everywhere"
this doesn't look too awful? Does it?
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, (continued)
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/25
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/25
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2,
Holger Hans Peter Freyther <=
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Holger Hans Peter Freyther, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26
- Re: [Lightning] Porting GNU Smalltalk to lightning 2, Paulo César Pereira de Andrade, 2014/10/26