IRBytecodeGenerator.st
changeset 23 377bc46cad12
parent 20 7d49846b36bd
child 26 db19d89eef60
--- a/IRBytecodeGenerator.st	Wed Aug 19 20:28:12 2009 +0000
+++ b/IRBytecodeGenerator.st	Sun Dec 06 08:24:34 2009 +0000
@@ -1,4 +1,4 @@
-"{ Package: 'stx:goodies/newcompiler' }"
+"{ Package: 'cvut:stx/goodies/newcompiler' }"
 
 Object subclass:#IRBytecodeGenerator
 	instanceVariableNames:'seqOrder orderSeq jumps literals lastLiteral currentSeqId
@@ -9,7 +9,21 @@
 	category:'NewCompiler-Bytecode'
 !
 
-IRBytecodeGenerator comment:'I generate bytecodes in response to ''instructions'' messages being sent to me.  I rewrite jumps at the end so their jump offsets are correct (see #bytecodes).  For example, to create a compiled method that compares first instVar to first arg and returns ''yes'' or ''no'' (same example as in IRBuilder), do:

	BytecodeGenerator new
		numArgs: 1;
		pushInstVar: 1;
		pushTemp: 1;
		send: #>;
		if: false goto: #else;
		pushLiteral: ''yes'';
		returnTop;
		label: #else;
		pushLiteral: ''no'';
		returnTop;
		compiledMethod

You can send #ir to the compiledMethod to decompile to its IRMethod, and you can send #methodNode to either to decompile to its parse tree.
'
+IRBytecodeGenerator comment:'I generate bytecodes in response to ''instructions'' messages being sent to me.  I rewrite jumps at the end so their jump offsets are correct (see #bytecodes).  For example, to create a compiled method that compares first instVar to first arg and returns ''yes'' or ''no'' (same example as in IRBuilder), do:
+	BytecodeGenerator new
+		numArgs: 1;
+		pushInstVar: 1;
+		pushTemp: 1;
+		send: #>;
+		if: false goto: #else;
+		pushLiteral: ''yes'';
+		returnTop;
+		label: #else;
+		pushLiteral: ''no'';
+		returnTop;
+		compiledMethod
+You can send #ir to the compiledMethod to decompile to its IRMethod, and you can send #methodNode to either to decompile to its parse tree.
+'
 !
 
 
@@ -794,5 +808,13 @@
 !IRBytecodeGenerator class methodsFor:'documentation'!
 
 version
-    ^'$Id$'
+    ^ '$Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBytecodeGenerator.st,v 1.3 2009/10/08 12:04:39 fm Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBytecodeGenerator.st,v 1.3 2009/10/08 12:04:39 fm Exp $'
+!
+
+version_SVN
+    ^'§Id: IRBytecodeGenerator.st 21 2009-05-16 16:51:05Z vranyj1 §'
 ! !