Re: sequences of length 1 in inline-threaded

David Bélanger <[email protected]>
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
On Thu, Dec 02, 2004 at 08:44:41AM -0500, Etienne Gagnon wrote:
> Hi David,
> 
> David Bélanger wrote:
> >Is there a reason of using these 1-instruction sequences?
> 
> There is no fundamental reason.  If I remember correctly, the original 
> reason
> had to do with measurements, but I'm not sure.  It might also have been
> pure lazyness; not wanting to handle 1-instruction sequences differently. 
> ;-)
> 

ok, it is more tricky to get it right than I first thought.

Some of the 1-instruction sequences are not quite equivalent to the
direct implementation, there is some extra.  :)

I think I got it right though I didn't test much yet.  I have included a
patch for people interested.

I don't think it will change much performance.

Slightly less memory used.  Also, at code preparation, a lookup in the
splay tree is not needed for some of these 1-inst sequence.  That's
about it.

David

---

David Bélanger
Web page:   http://www.cs.mcgill.ca/~dbelan2/
Public key: http://www.cs.mcgill.ca/~dbelan2/public_key.txt

_______________________________________________
SableVM-devel mailing list
[email protected]
http://sablevm.org/lists/control/listinfo/sablevm-devel
one-sequence.patch (text/plain, 683 B)
Index: src/libsablevm/prepare_code.c
===================================================================
--- src/libsablevm/prepare_code.c	(revision 3059)
+++ src/libsablevm/prepare_code.c	(working copy)
@@ -6705,8 +6705,10 @@
 	  if (_svmf_no_inlining
 	      (env, instruction->code, SVM_IS_INLINED_BYTECODE))
 #else
-	  if (vm->instructions[instruction->code].flag ==
-	      SVM_INTRP_FLAG_CONTAINS_BRANCH_OR_CALL)
+	    if ((vm->instructions[instruction->code].flag ==
+		 SVM_INTRP_FLAG_CONTAINS_BRANCH_OR_CALL) ||
+		((instruction->sequence_length == 1) &&
+		 (!instruction->sequence_contains_resolution)))
 #endif
 	    {
 	      assert (instruction->sequence_length == 1);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.