help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] JIT and ContextPart/Exception issue


From: Holger Hans Peter Freyther
Subject: Re: [Help-smalltalk] JIT and ContextPart/Exception issue
Date: Sat, 1 Feb 2014 18:28:07 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jan 20, 2014 at 02:44:38PM +0100, Holger Hans Peter Freyther wrote:

Hi Paolo,

I now understand the issue but I don't have a re-producer or a fix.

> [] in Object: BlockContext new: 16 "<0x4044ab40>" error: IP(35) is not correct

[] in An instance of BlockContext
  parent: CompiledMethod(CompiledCode)>>dispatchSuperoperator:with:at:to: 
(CompildCode.st:661)
  nativeIP: 79831804
  ip: 34
  sp: 3

...
   [33] send 5 args message #dispatchByte:with:at:to:with:
   [37] return stack top

dispatchTo: anObject with: param [
        "Disassemble the bytecodes and tell anObject about them in the form
         of message sends.  param is given as an argument to every message
         send."

        <category: ''decoding bytecodes''>
        | lastOfs |
        self allByteCodeIndicesDo: 
                [:i :byte :arg | 
                lastOfs = i 
                    ifFalse: 
                        [anObject bytecodeIndex: i with: param.
                        lastOfs := i].
                self 
                    dispatchByte: byte
                    with: arg
                    at: i
                    to: anObject
                    with: param]
    ]


So 34 + 1 would point to "35" but there is no bytecode at this offset. The
next one is at "37". As a hack I found the below to work. So the usage of
BYTECODE_SIZE is wrong in this case. The code_tree should know the number
of bytecodes used for the send. Is this somehow possible?

@@ -1411,6 +1413,7 @@ void
 gen_send (code_tree *tree)
 {
   inline_cache *ic = (inline_cache *) tree->data;
+  int offset = BYTECODE_SIZE;
 
   PUSH_CHILDREN;
   jit_movi_p (JIT_V1, ic);
@@ -1419,7 +1422,12 @@ gen_send (code_tree *tree)
   else
     EXPORT_SP (JIT_V0);
 
-  jit_movi_ul (JIT_R0, tree->bp - bc + BYTECODE_SIZE);
+  if (tree->bp - bc + BYTECODE_SIZE == 34 && in_block) {
+   printf("Code...?\n");
+   offset += BYTECODE_SIZE;
+  }
+
+  jit_movi_ul (JIT_R0, tree->bp - bc + offset);
   jit_ldxi_p (JIT_R1, JIT_V1, jit_field (inline_cache, cachedIP));
   jit_sti_ul (&ip, JIT_R0);
 
@@ -1427,7 +1435,7 @@ gen_send (code_tree *tree)
   jit_align (2);
 
   ic->native_ip = jit_get_label ();
-  define_ip_map_entry (tree->bp - bc + BYTECODE_SIZE);
+  define_ip_map_entry (tree->bp - bc + offset);




reply via email to

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