Tests refactored to be actually a testcase. Introduced LLVMConstant class
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 03 Aug 2015 18:08:14 +0100
changeset 16 23e82cf19788
parent 15 a992f2c8b8d9
child 17 f49716b8d8c8
Tests refactored to be actually a testcase. Introduced LLVMConstant class as a factory for LLVM constant values (such as integer or string constants)
LLVM.st
LLVMBuilder.st
LLVMConstant.st
LLVMExamples.st
LLVMModule.st
LLVMType.st
LLVMValue.st
Make.proto
Make.spec
abbrev.stc
bc.mak
extensions.st
jv_llvm_s.st
libInit.cc
--- a/LLVM.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/LLVM.st	Mon Aug 03 18:08:14 2015 +0100
@@ -1747,6 +1747,8 @@
 
     <cdecl: LLVMValue "LLVMConstInt" ( LLVMType long int32 ) >
     self primitiveFailed
+
+    "Modified: / 03-08-2015 / 17:12:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 ConstIntCast: ConstantVal _: ToType _: isSigned 
--- a/LLVMBuilder.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/LLVMBuilder.st	Mon Aug 03 18:08:14 2015 +0100
@@ -59,96 +59,6 @@
     "Created: / 11-07-2015 / 13:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!LLVMBuilder methodsFor:'constants'!
-
-signedInt16Constant: value
-    ^ self signedIntConstant: value type: LLVMType int16
-
-    "Created: / 11-07-2015 / 16:43:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-signedInt1Constant: value
-    ^ self signedIntConstant: value type: LLVMType int1
-
-    "Created: / 11-07-2015 / 16:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-signedInt32Constant: value
-    ^ self signedIntConstant: value type: LLVMType int32
-
-    "Created: / 11-07-2015 / 16:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-signedInt64Constant: value
-    ^ self signedIntConstant: value type: LLVMType int64
-
-    "Created: / 11-07-2015 / 16:44:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-signedInt8Constant: value
-    ^ self signedIntConstant: value type: LLVMType int8
-
-    "Created: / 11-07-2015 / 16:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-signedIntConstant: value type: type
-    self assert: type isIntegerType.
-    self assert: value isInteger.
-    ^ LLVM ConstInt: type _: value _: 1
-
-    "Created: / 11-07-2015 / 16:41:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-signedIntptrConstant: value
-    ^ self signedIntConstant: value type: LLVMType intptr
-
-    "Created: / 11-07-2015 / 16:43:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedInt16Constant: value
-    ^ self unsignedIntConstant: value type: LLVMType int16
-
-    "Created: / 11-07-2015 / 16:42:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedInt18Constant: value
-    ^ self unsignedIntConstant: value type: LLVMType int8
-
-    "Created: / 11-07-2015 / 16:47:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedInt1Constant: value
-    ^ self unsignedIntConstant: value type: LLVMType int1
-
-    "Created: / 11-07-2015 / 16:42:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedInt32Constant: value
-    ^ self unsignedIntConstant: value type: LLVMType int32
-
-    "Created: / 11-07-2015 / 16:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedInt64Constant: value
-    ^ self unsignedIntConstant: value type: LLVMType int64
-
-    "Created: / 11-07-2015 / 16:42:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedIntConstant: value type: type
-    self assert: type isIntegerType.
-    self assert: value isInteger.
-    ^ LLVM ConstInt: type _: value _: 0
-
-    "Created: / 11-07-2015 / 16:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-unsignedIntptrConstant: value
-    ^ self unsignedIntConstant: value type: LLVMType intptr
-
-    "Created: / 11-07-2015 / 16:42:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !LLVMBuilder methodsFor:'initialization & release'!
 
 dispose
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LLVMConstant.st	Mon Aug 03 18:08:14 2015 +0100
@@ -0,0 +1,162 @@
+"
+    Copyright (C) 2015-now Jan Vrany
+
+    This code is not an open-source (yet). You may use this code
+    for your own experiments and projects, given that:
+
+    * all modification to the code will be sent to the
+      original author for inclusion in future releases
+    * this is not used in any commercial software
+
+    This license is provisional and may (will) change in
+    a future.
+"
+"{ Package: 'jv:llvm_s' }"
+
+"{ NameSpace: Smalltalk }"
+
+Object subclass:#LLVMConstant
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'LLVM-S-Core'
+!
+
+!LLVMConstant class methodsFor:'documentation'!
+
+copyright
+"
+    Copyright (C) 2015-now Jan Vrany
+
+    This code is not an open-source (yet). You may use this code
+    for your own experiments and projects, given that:
+
+    * all modification to the code will be sent to the
+      original author for inclusion in future releases
+    * this is not used in any commercial software
+
+    This license is provisional and may (will) change in
+    a future.
+"
+!
+
+documentation
+"
+    A simple factory for creating constant values.
+
+    LLVMConstant sint16: 10.
+    LLVMConstant string: 'Hello World!!'.
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!LLVMConstant class methodsFor:'constants - int - signed'!
+
+sint16:value 
+    ^ self sint:value type:LLVMType int16
+
+    "Created: / 11-07-2015 / 16:43:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sint1:value 
+    ^ self sint:value type:LLVMType int1
+
+    "Created: / 11-07-2015 / 16:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sint32:value 
+    ^ self sint:value type:LLVMType int32
+
+    "Created: / 03-08-2015 / 15:59:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sint64:value 
+    ^ self sint:value type:LLVMType int64
+
+    "Created: / 03-08-2015 / 15:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sint:value type:type 
+    self assert:type isIntegerType.
+    self assert:value isInteger.
+    ^ LLVM ConstInt:type _:value _:1
+
+    "Created: / 11-07-2015 / 16:41:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 03-08-2015 / 17:08:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sintptr:value 
+    ^ self sint:value type:LLVMType intptr
+
+    "Created: / 03-08-2015 / 15:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LLVMConstant class methodsFor:'constants - int - unsigned'!
+
+uint16:value 
+    ^ self uint:value type:LLVMType int16
+
+    "Created: / 03-08-2015 / 16:00:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+uint1:value 
+    ^ self uint:value type:LLVMType int1
+
+    "Created: / 03-08-2015 / 16:01:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+uint32:value 
+    ^ self uint:value type:LLVMType int32
+
+    "Created: / 03-08-2015 / 16:01:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+uint64:value 
+    ^ self uint:value type:LLVMType int64
+
+    "Created: / 03-08-2015 / 16:01:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+uint:value type:type 
+    self assert:type isIntegerType.
+    self assert:value isInteger.
+    ^ LLVM 
+        ConstInt:type
+        _:value
+        _:0
+
+    "Created: / 11-07-2015 / 16:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+uintptr:value 
+    ^ self uint:value type:LLVMType intptr
+
+    "Created: / 03-08-2015 / 16:01:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LLVMConstant class methodsFor:'constants - strings'!
+
+string:aString 
+    ^ self string:aString nullTerminate:true
+
+    "Created: / 03-08-2015 / 16:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+string:aString nullTerminate:nullTerminate 
+    self assert:aString isSingleByteString.
+    ^ LLVM 
+        ConstString:aString
+        _:aString size
+        _:((nullTerminate == true) ifTrue:[ 1 ] ifFalse:[ 0 ])
+             "Created: / 03-08-2015 / 16:17:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/LLVMExamples.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/LLVMExamples.st	Mon Aug 03 18:08:14 2015 +0100
@@ -15,7 +15,7 @@
 
 "{ NameSpace: Smalltalk }"
 
-Object subclass:#LLVMExamples
+TestCase subclass:#LLVMExamples
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
@@ -40,38 +40,85 @@
 "
 ! !
 
-!LLVMExamples class methodsFor:'examples'!
+!LLVMExamples class methodsFor:'accessing'!
+
+isTestSelector:aSelector
+    ^ (super isTestSelector:aSelector) or:[ aSelector startsWith: 'example' ]
+
+    "Created: / 03-08-2015 / 09:25:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!LLVMExamples methodsFor:'examples'!
 
 example1_sum
+    "
+    Creates a simple function taking two arguments (as intptr_t) and returning
+    their sum (as intptr_t).
+    "
+
     | module functionType function functionEntry asm jit externalFunction |
 
-    module := LLVMModule newWithName: thisContext selector.
+    "/ 1) create a module to which the function would belong. A module is
+    "/    a set of functions and globals that are compiled at once by the MCJIT. Once
+    "/    module is compiled, no more methods or clobals can be added.
+    
+    module := LLVMModule newWithName: testSelector.
+
+    "/ 2) Define a function within the module with type (intptr_t, intptr_t) -> intptr_t
     functionType := LLVMType function: { LLVMType intptr . LLVMType intptr } returning: LLVMType intptr.
     function := module addFunctionNamed: 'sum' type: functionType.
 
+    "/ 3) Generate function code. LLVM IR does not work with
+    "/    labels / jumps to labels but rather the user is responsible
+    "/    for creating basic blocks and adding them to the function.
+    "/    Hence, create a basic block named 'entry'
     functionEntry := function addBasicBlockNamed: 'entry'.
+
+    "/ 4) To emit LLVM IR, create an IR builder and position it
+    "/    to the end of just created basic block.
     asm := LLVMBuilder new.
     asm positionAtEnd: functionEntry.
     asm ret: (asm add: (function parameterAt: 1) and: (function parameterAt: 2)).
+    "/ Now, the module should look like
+    self assert: (module dumpString =
+'; ModuleID = ''example1_sum''
 
+define i64 @sum(i64, i64) {
+entry:
+  %2 = add i64 %0, %1
+  ret i64 %2
+}
+').
+
+
+    "/ 5) To compile a function (strictly speaking, whole module) at runtime,
+    "/    create a jit object (called ExecutionEngine in LLVM)
     jit := LLVMExecutionEngine newForModule: module.
+
+    "/ 6) Finally, obtain a reference to the function. This cause
+    "/    the module to be closed and compiled to machine code.
     externalFunction := jit externalOfFunction: function.
 
-    ^ externalFunction callWith: 3 with: 4.
+    self assert: (externalFunction callWith: 3 with: 4) == 7
 
     "
     LLVMExamples example1_sum
     "
 
     "Created: / 17-07-2015 / 11:47:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-08-2015 / 10:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 example2_function_call
+    "
+    Creates a module with two functions, @sum and @sum_caller. The latter
+    calls the former.
+    "
     | module calleeFunctionType calleeFunction calleFunctionEntry 
     callerFunctionType callerFunction callerFunctionEntry
     asm jit externalFunction |
 
-    module := LLVMModule newWithName: thisContext selector.
+    module := LLVMModule newWithName: testSelector.
 
     calleeFunctionType := LLVMType function: { LLVMType intptr . LLVMType intptr } returning: LLVMType intptr.
     calleeFunction := module addFunctionNamed: 'sum' type: calleeFunctionType.
@@ -88,49 +135,73 @@
     asm := LLVMBuilder new.
     asm positionAtEnd: callerFunctionEntry.
     asm ret: (asm call: calleeFunction with: (callerFunction parameterAt: 1) with: (callerFunction parameterAt: 2)).
+     self assert: (module dumpString = 
+'; ModuleID = ''example2_function_call''
 
+define i64 @sum(i64, i64) {
+entry:
+  %2 = add i64 %0, %1
+  ret i64 %2
+}
+
+define i64 @sum_caller(i64, i64) {
+entry:
+  %2 = call i64 @sum(i64 %0, i64 %1)
+  ret i64 %2
+}
+').
 
     jit := LLVMExecutionEngine newForModule: module.
     externalFunction := jit externalOfFunction: callerFunction.
 
-    ^ externalFunction callWith: 3 with: 4.
+    self assert: (externalFunction callWith: 3 with: 4) == 7.
 
     "
     LLVMExamples example2_function_call
     "
 
     "Created: / 17-07-2015 / 12:45:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 17-07-2015 / 17:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-08-2015 / 10:29:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-example3_function_call
+example3_hello_world
+    "
+    Creates a function @main() which calls @printf() to print
+    a famous 'Hello World!!' message on stdout
+    "    
+
     | module printfFunctionType printfFunction  
-    callerFunctionType callerFunction callerFunctionEntry
-    asm jit externalFunction |
+     helloWorldString
+     mainFunctionType mainFunction mainFunctionEntry
+     asm jit externalFunction |
 
-    module := LLVMModule newWithName: thisContext selector.
+    module := LLVMModule newWithName: testSelector.
 
-    printfFunctionType := LLVMType function: { LLVMType intptr . LLVMType intptr } returning: LLVMType intptr.
-    printfFunction := module addFunctionNamed: 'sum' type: printfFunctionType.
+    printfFunctionType := LLVMType function: #() returning: LLVMType int32.
+    printfFunction := module addFunctionNamed: 'printf' type: printfFunctionType.
 
-    callerFunctionType := LLVMType function: { LLVMType intptr . LLVMType intptr } returning: LLVMType intptr.
-    callerFunction := module addFunctionNamed: 'sum_caller' type: callerFunctionType.
+    helloWorldString := module addGlobalNamed: '.str' value: (LLVMConstant string: 'Hello World!!\n').
 
-    callerFunctionEntry := callerFunction addBasicBlockNamed: 'entry'.
+    mainFunctionType := LLVMType function: #() returning: LLVMType intptr.
+    mainFunction := module addFunctionNamed: 'main' type: mainFunctionType.
+
+    mainFunctionEntry := mainFunction addBasicBlockNamed: 'entry'.
     asm := LLVMBuilder new.
-    asm positionAtEnd: callerFunctionEntry.
-    asm ret: (asm call: printfFunction with: (callerFunction parameterAt: 1) with: (callerFunction parameterAt: 2)).
-
+    asm positionAtEnd: mainFunctionEntry.
+    asm call: printfFunction with: helloWorldString.
+    asm ret: (LLVMConstant sint32: 0).
 
     jit := LLVMExecutionEngine newForModule: module.
-    externalFunction := jit externalOfFunction: callerFunction.
+    externalFunction := jit externalOfFunction: mainFunction.
 
-    ^ externalFunction callWith: 3 with: 4.
+    externalFunction call.
+    Stdout flush
 
     "
-    LLVMExamples example2_function_call
+    LLVMExamples example3_hello_world
     "
 
-    "Created: / 17-07-2015 / 17:21:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 03-08-2015 / 10:28:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-08-2015 / 18:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/LLVMModule.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/LLVMModule.st	Mon Aug 03 18:08:14 2015 +0100
@@ -66,6 +66,26 @@
     "Created: / 07-07-2015 / 21:59:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+addGlobalNamed: name type: type value: value
+    | global |
+    self assert: name isSingleByteString.
+    self assert:(type isKindOf: LLVMType).
+    self assert:(value isKindOf: LLVMValue).
+    self assert:(value type kind == type kind).
+
+    global := LLVM AddGlobal: self _: type _: name.
+    LLVM SetInitializer: global _: value.
+    ^ global
+
+    "Created: / 03-08-2015 / 16:41:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addGlobalNamed: name value: value
+    ^ self addGlobalNamed: name type: value type value: value
+
+    "Created: / 03-08-2015 / 16:57:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 addMethodForClass: class selector: selector
     | name type typeObj typeIlcPtr argTypes|
 
--- a/LLVMType.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/LLVMType.st	Mon Aug 03 18:08:14 2015 +0100
@@ -176,3 +176,10 @@
     "Created: / 11-07-2015 / 14:56:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!LLVMType class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/LLVMValue.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/LLVMValue.st	Mon Aug 03 18:08:14 2015 +0100
@@ -104,6 +104,12 @@
 
 !LLVMValue methodsFor:'testing'!
 
+isConstant
+    ^ LLVM IsConstant: self
+
+    "Created: / 03-08-2015 / 16:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 isIntegerOrVectorValue
     ^ self type isIntegerType or:[ type isVectorType ]
 
@@ -112,8 +118,9 @@
 !
 
 isIntegerValue
-    ^ self type isIntegetType
+    ^ self type isIntegerType
 
     "Created: / 11-07-2015 / 14:55:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-08-2015 / 16:38:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/Make.proto	Tue Aug 04 07:21:26 2015 +0100
+++ b/Make.proto	Mon Aug 03 18:08:14 2015 +0100
@@ -34,7 +34,7 @@
 # add the path(es) here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic
 
 
 # if you need any additional defines for embedded C code,
@@ -102,6 +102,10 @@
 # build all mandatory prerequisite packages (containing superclasses) for this package
 prereq:
 	cd $(TOP)/libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd $(TOP)/libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd $(TOP)/libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd $(TOP)/libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd $(TOP)/goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 
 
 
@@ -127,9 +131,9 @@
 $(OUTDIR)LLVMAttribute.$(O) LLVMAttribute.$(H): LLVMAttribute.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMByteOrdering.$(O) LLVMByteOrdering.$(H): LLVMByteOrdering.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMCallConv.$(O) LLVMCallConv.$(H): LLVMCallConv.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
+$(OUTDIR)LLVMConstant.$(O) LLVMConstant.$(H): LLVMConstant.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMDLLStorageClass.$(O) LLVMDLLStorageClass.$(H): LLVMDLLStorageClass.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMDiagnosticSeverity.$(O) LLVMDiagnosticSeverity.$(H): LLVMDiagnosticSeverity.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
-$(OUTDIR)LLVMExamples.$(O) LLVMExamples.$(H): LLVMExamples.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMIntPredicate.$(O) LLVMIntPredicate.$(H): LLVMIntPredicate.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMLandingPadClauseTy.$(O) LLVMLandingPadClauseTy.$(H): LLVMLandingPadClauseTy.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMLinkage.$(O) LLVMLinkage.$(H): LLVMLinkage.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SharedPool.$(H) $(STCHDR)
@@ -162,7 +166,7 @@
 $(OUTDIR)LLVMPassManager.$(O) LLVMPassManager.$(H): LLVMPassManager.st $(INCLUDE_TOP)/jv/llvm_s/LLVMDisposableObject.$(H) $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMTargetData.$(O) LLVMTargetData.$(H): LLVMTargetData.st $(INCLUDE_TOP)/jv/llvm_s/LLVMDisposableObject.$(H) $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMStXMethod.$(O) LLVMStXMethod.$(H): LLVMStXMethod.st $(INCLUDE_TOP)/jv/llvm_s/LLVMFunction.$(H) $(INCLUDE_TOP)/jv/llvm_s/LLVMObject.$(H) $(INCLUDE_TOP)/jv/llvm_s/LLVMValue.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/sunit/stx_goodies_sunit.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/stx_libbasic.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/Make.spec	Tue Aug 04 07:21:26 2015 +0100
+++ b/Make.spec	Mon Aug 03 18:08:14 2015 +0100
@@ -57,9 +57,9 @@
 	LLVMAttribute \
 	LLVMByteOrdering \
 	LLVMCallConv \
+	LLVMConstant \
 	LLVMDLLStorageClass \
 	LLVMDiagnosticSeverity \
-	LLVMExamples \
 	LLVMIntPredicate \
 	LLVMLandingPadClauseTy \
 	LLVMLinkage \
@@ -103,9 +103,9 @@
     $(OUTDIR_SLASH)LLVMAttribute.$(O) \
     $(OUTDIR_SLASH)LLVMByteOrdering.$(O) \
     $(OUTDIR_SLASH)LLVMCallConv.$(O) \
+    $(OUTDIR_SLASH)LLVMConstant.$(O) \
     $(OUTDIR_SLASH)LLVMDLLStorageClass.$(O) \
     $(OUTDIR_SLASH)LLVMDiagnosticSeverity.$(O) \
-    $(OUTDIR_SLASH)LLVMExamples.$(O) \
     $(OUTDIR_SLASH)LLVMIntPredicate.$(O) \
     $(OUTDIR_SLASH)LLVMLandingPadClauseTy.$(O) \
     $(OUTDIR_SLASH)LLVMLinkage.$(O) \
--- a/abbrev.stc	Tue Aug 04 07:21:26 2015 +0100
+++ b/abbrev.stc	Mon Aug 03 18:08:14 2015 +0100
@@ -7,9 +7,10 @@
 LLVMAttribute LLVMAttribute jv:llvm_s 'LLVM-S-Core-Constants' 0
 LLVMByteOrdering LLVMByteOrdering jv:llvm_s 'LLVM-S-Core-Constants' 0
 LLVMCallConv LLVMCallConv jv:llvm_s 'LLVM-S-Core-Constants' 0
+LLVMConstant LLVMConstant jv:llvm_s 'LLVM-S-Core' 0
 LLVMDLLStorageClass LLVMDLLStorageClass jv:llvm_s 'LLVM-S-Core-Constants' 0
 LLVMDiagnosticSeverity LLVMDiagnosticSeverity jv:llvm_s 'LLVM-S-Core-Constants' 0
-LLVMExamples LLVMExamples jv:llvm_s 'LLVM-S-Core-Examples' 0
+LLVMExamples LLVMExamples jv:llvm_s 'LLVM-S-Core-Examples' 1
 LLVMIntPredicate LLVMIntPredicate jv:llvm_s 'LLVM-S-Core-Constants' 0
 LLVMLandingPadClauseTy LLVMLandingPadClauseTy jv:llvm_s 'LLVM-S-Core-Constants' 0
 LLVMLinkage LLVMLinkage jv:llvm_s 'LLVM-S-Core-Constants' 0
--- a/bc.mak	Tue Aug 04 07:21:26 2015 +0100
+++ b/bc.mak	Mon Aug 03 18:08:14 2015 +0100
@@ -35,7 +35,7 @@
 
 
 
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic
 LOCALDEFINES=
 
 STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES)  -varPrefix=$(LIBNAME)
@@ -52,6 +52,10 @@
 # build all mandatory prerequisite packages (containing superclasses) for this package
 prereq:
 	pushd ..\..\stx\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\stx\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\stx\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\stx\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\stx\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 
 
 
@@ -74,9 +78,9 @@
 $(OUTDIR)LLVMAttribute.$(O) LLVMAttribute.$(H): LLVMAttribute.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMByteOrdering.$(O) LLVMByteOrdering.$(H): LLVMByteOrdering.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMCallConv.$(O) LLVMCallConv.$(H): LLVMCallConv.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
+$(OUTDIR)LLVMConstant.$(O) LLVMConstant.$(H): LLVMConstant.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMDLLStorageClass.$(O) LLVMDLLStorageClass.$(H): LLVMDLLStorageClass.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMDiagnosticSeverity.$(O) LLVMDiagnosticSeverity.$(H): LLVMDiagnosticSeverity.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
-$(OUTDIR)LLVMExamples.$(O) LLVMExamples.$(H): LLVMExamples.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMIntPredicate.$(O) LLVMIntPredicate.$(H): LLVMIntPredicate.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMLandingPadClauseTy.$(O) LLVMLandingPadClauseTy.$(H): LLVMLandingPadClauseTy.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)LLVMLinkage.$(O) LLVMLinkage.$(H): LLVMLinkage.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
@@ -109,7 +113,7 @@
 $(OUTDIR)LLVMPassManager.$(O) LLVMPassManager.$(H): LLVMPassManager.st $(INCLUDE_TOP)\jv\llvm_s\LLVMDisposableObject.$(H) $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMTargetData.$(O) LLVMTargetData.$(H): LLVMTargetData.st $(INCLUDE_TOP)\jv\llvm_s\LLVMDisposableObject.$(H) $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)LLVMStXMethod.$(O) LLVMStXMethod.$(H): LLVMStXMethod.st $(INCLUDE_TOP)\jv\llvm_s\LLVMFunction.$(H) $(INCLUDE_TOP)\jv\llvm_s\LLVMObject.$(H) $(INCLUDE_TOP)\jv\llvm_s\LLVMValue.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\sunit\stx_goodies_sunit.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\stx_libbasic.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/extensions.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/extensions.st	Mon Aug 03 18:08:14 2015 +0100
@@ -6,11 +6,27 @@
     | array size | 
 
     size := self size.
+    size == 0 ifTrue:[ 
+        ^ nil
+    ].
     array := LLVMObjectArray new: size.
     array replaceFrom: 1 count: size with: self.
     ^array
 
     "Created: / 08-07-2015 / 22:58:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-08-2015 / 17:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!stx_goodies_sunit class methodsFor:'documentation'!
+
+version_HG
+    ^ '$Changeset: <not expanded> $'
+! !
+
+!stx_libbasic class methodsFor:'documentation'!
+
+version_HG
+    ^ '$Changeset: <not expanded> $'
 ! !
 
 !jv_llvm_s class methodsFor:'documentation'!
--- a/jv_llvm_s.st	Tue Aug 04 07:21:26 2015 +0100
+++ b/jv_llvm_s.st	Mon Aug 03 18:08:14 2015 +0100
@@ -76,6 +76,7 @@
      by searching along the inheritance chain of all of my classes."
 
     ^ #(
+        #'stx:goodies/sunit'    "TestAsserter - superclass of LLVMExamples"
         #'stx:libbasic'    "ArrayedCollection - superclass of LLVMObjectArray"
     )
 !
@@ -120,9 +121,10 @@
         LLVMAttribute
         LLVMByteOrdering
         LLVMCallConv
+        LLVMConstant
         LLVMDLLStorageClass
         LLVMDiagnosticSeverity
-        LLVMExamples
+        (LLVMExamples autoload)
         LLVMIntPredicate
         LLVMLandingPadClauseTy
         LLVMLinkage
@@ -164,6 +166,8 @@
 
     ^ #(
         SequenceableCollection asLLVMObjectArray
+        'stx_goodies_sunit class' #'version_HG'
+        'stx_libbasic class' #'version_HG'
     )
 ! !
 
--- a/libInit.cc	Tue Aug 04 07:21:26 2015 +0100
+++ b/libInit.cc	Mon Aug 03 18:08:14 2015 +0100
@@ -33,9 +33,9 @@
 _LLVMAttribute_Init(pass,__pRT__,snd);
 _LLVMByteOrdering_Init(pass,__pRT__,snd);
 _LLVMCallConv_Init(pass,__pRT__,snd);
+_LLVMConstant_Init(pass,__pRT__,snd);
 _LLVMDLLStorageClass_Init(pass,__pRT__,snd);
 _LLVMDiagnosticSeverity_Init(pass,__pRT__,snd);
-_LLVMExamples_Init(pass,__pRT__,snd);
 _LLVMIntPredicate_Init(pass,__pRT__,snd);
 _LLVMLandingPadClauseTy_Init(pass,__pRT__,snd);
 _LLVMLinkage_Init(pass,__pRT__,snd);